@frigade/react 1.35.41 → 1.35.42
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 +122 -122
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +114 -114
- 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 ko=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,T=(e,t)=>{for(var o in t||(t={}))oi.call(t,o)&&ti(e,o,t[o]);if(ko)for(var o of ko(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 n in e)oi.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&ko)for(var n of ko(e))t.indexOf(n)<0&&ri.call(e,n)&&(o[n]=e[n]);return o};var $=(e,t,o)=>new Promise((n,i)=>{var r=d=>{try{p(o.next(d))}catch(l){i(l)}},s=d=>{try{p(o.throw(d))}catch(l){i(l)}},p=d=>d.done?n(d.value):Promise.resolve(d.value).then(r,s);p((o=o.apply(e,t)).next())});import vt,{createContext as hd,useEffect as Ko,useState as je}from"react";import{ThemeProvider as Cd}from"styled-components";import Pt,{useContext as Kp,useEffect as xo,useState as Vo}from"react";import{useCallback as Tt,useContext as ya,useEffect as Sa}from"react";import rr,{useMemo as si}from"react";var ni="1.35.41 ";var He="NOT_STARTED_STEP",Z="COMPLETED_FLOW",Po="ABORTED_FLOW",wt="STARTED_FLOW",$e="NOT_STARTED_FLOW",Ke="COMPLETED_STEP",vo="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 Ut(){let{shouldGracefullyDegrade:e,readonly:t}=rr.useContext(Q);return(o,n)=>$(this,null,function*(){if(t&&(n.method==="POST"||n.method==="PUT"||n.method==="DELETE"))return Mt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Mt();let i=la+o,r=aa+o;if(window&&window.localStorage&&n&&n.body&&n.method==="POST"){let p=window.localStorage.getItem(i),d=window.localStorage.getItem(r);if(p&&d&&d==n.body){let l=new Date(p);if(new Date().getTime()-l.getTime()<1e3)return Mt()}window.localStorage.setItem(i,new Date().toISOString()),window.localStorage.setItem(r,n.body)}let s;try{s=yield fetch(o,n)}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 Wt(){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 xa,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:n,completedFlowsToKeepOpenDuringSession:i}=pa(Q);function r(c,g=!1){var y;return(y=e[c])!=null?y:g}function s(c,g){t(y=>_(T({},y),{[c]:g}))}function p(c){t(g=>{let S=g,{[c]:y}=S,F=Ie(S,[ii(c)]);return T({},F)})}function d(c){i.includes(c)||n(g=>[...g,c])}function l(c){return i.includes(c)}function m(c){return Object.entries(e).some(([g,y])=>y&&g!=c)||o}return{getOpenFlowState:r,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:m,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:l}}import fa from"swr/immutable";import io 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 n=io(t);return Object.entries(o).forEach(([i,r])=>{ir(r)?n[i]!==void 0?Object.assign(n,{[i]:Ce(n[i],io(r))}):Object.assign(n,{[i]:io(r)}):Array.isArray(r)?n[i]!==void 0?Object.assign(n,{[i]:[...n[i],...io(r)]}):Object.assign(n,{[i]:io(r)}):Object.assign(n,{[i]:r})}),n}var ga="unknown";function Me(){let{config:e,apiUrl:t}=Je(),{publicApiKey:o,userId:n,organizationId:i,flows:r,setShouldGracefullyDegrade:s,readonly:p}=da(Q),{resetOpenFlowState:d}=Be(),[l,m]=ma(!1),c={data:r.map(f=>({flowId:f.id,flowState:Z,lastStepId:null,userId:n,foreignUserId:n,stepStates:{},shouldTrigger:!1}))},g=f=>fetch(f,e).then(P=>{if(P.ok)return P.json();throw new Error("Failed to fetch user flow states")}).catch(P=>(console.log(`Error fetching ${f}: ${P}. Will gracefully degrade and hide Frigade`),s(!0),c)),y=o&&r&&n?`${t}userFlowStates?foreignUserId=${encodeURIComponent(n)}${i?`&foreignUserGroupId=${encodeURIComponent(i)}`:""}`:null,{data:F,isLoading:S,mutate:x,error:v}=p?fa(y,g):ua(y,g,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),b=F==null?void 0:F.data;ca(()=>{!l&&!S&&b&&m(!0)},[b,l,S]);function E(f){return $(this,null,function*(){if(b&&!p){let P=b.find(N=>N.flowId===f);P&&P.flowState!==Z&&(P.flowState=Z),yield x(Promise.resolve(Ce(F,{data:b})),{optimisticData:Ce(F,{data:b}),revalidate:!1,rollbackOnError:!1})}})}function A(f,P,N){return $(this,null,function*(){if(b){let L=b.find(I=>I.flowId===f);L&&(L.stepStates[P]=N,L.flowState=wt),yield x(Promise.resolve(Ce(F,{data:b})),{optimisticData:Ce(F,{data:b}),revalidate:!1,rollbackOnError:!1})}})}function O(f,P,N){return $(this,null,function*(){if(b){let L=b.find(I=>I.flowId===f);L&&(L.lastStepId=P,L.stepStates[P]=N,L.flowState=wt),yield x(Ce(F,{data:b}),{optimisticData:Ce(F,{data:b}),revalidate:!1,rollbackOnError:!1})}})}function h(f){return $(this,null,function*(){if(b){let P=b.find(N=>N.flowId===f);P&&P.flowState!==$e&&(P.flowState=$e,P.lastStepId=ga,Object.keys(P.stepStates).forEach(N=>{P.stepStates[N].actionType=He,P.stepStates[N].createdAt=new Date().toISOString()}),yield x(Ce(F,{data:b}),{optimisticData:Ce(F,{data:b}),revalidate:!1,rollbackOnError:!1}),d(f))}})}function w(f,P){return $(this,null,function*(){if(b){let N=b.find(L=>L.flowId===f);N&&N.stepStates[P]!==He&&(N.stepStates[P]=He),yield x(Ce(F,{data:b}),{optimisticData:Ce(F,{data:b}),revalidate:!1,rollbackOnError:!1})}})}return{userFlowStatesData:b,isLoadingUserFlowStateData:!l,mutateUserFlowState:x,optimisticallyMarkFlowCompleted:E,optimisticallyMarkFlowNotStarted:h,optimisticallyMarkStepCompleted:A,optimisticallyMarkStepNotStarted:w,optimisticallyMarkStepStarted:O,error:v}}function no(){let{config:e,apiUrl:t}=Je(),{userFlowStatesData:o,mutateUserFlowState:n}=Me(),{failedFlowResponses:i,setFailedFlowResponses:r,flowResponses:s,setFlowResponses:p}=xa(Q),[d,l]=li(new Set),[m,c]=li(new Set),g=Ut();function y(x){let v=JSON.stringify(x);if(d.has(v))return null;d.add(v),l(d),m.add(x),c(m);let b=s==null?void 0:s.find(E=>E.flowSlug===x.flowSlug&&E.stepId===x.stepId&&E.actionType===x.actionType&&E.createdAt===x.createdAt);return g(`${t}flowResponses`,_(T({},e),{method:"POST",body:v})).then(E=>{E.status!==200&&E.status!==201?(console.log("Failed to send flow response for step "+x.stepId+". Will retry again later."),r([...i,x])):b||p(A=>[...A!=null?A:[],x])})}function F(x){return $(this,null,function*(){x.foreignUserId&&(x.actionType===wt||x.actionType===$e?yield y(x):x.actionType===Z?yield y(x):x.actionType===vo?yield y(x):x.actionType===Ke?yield y(x):x.actionType===Po?yield y(x):x.actionType===He&&(yield y(x)))})}function S(){let x=[];return o==null||o.forEach(v=>{if(v&&v.stepStates&&Object.keys(v.stepStates).length!==0)for(let b in v.stepStates){let E=v.stepStates[b];x.push({foreignUserId:v.foreignUserId,flowSlug:v.flowId,stepId:E.stepId,actionType:E.actionType,data:{},createdAt:new Date(E.createdAt),blocked:E.blocked,hidden:E.hidden})}}),[...x,...s]}return{addResponse:F,setFlowResponses:p,getFlowResponses:S}}import ba from"swr";var ha=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,ai=e=>{let t=ha.exec(e);if(t===null)return null;let o=null;return t.forEach((n,i)=>{let r=Ca(n,"'","");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:n,userId:i,organizationId:r,publicApiKey:s,customVariables:p,setCustomVariables:d,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,setFlowResponses:c,setShouldGracefullyDegrade:g,readonly:y}=ya(Q),F={data:[]},{verifySDKInitiated:S}=Wt(),{addResponse:x,getFlowResponses:v}=no(),b=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`),g(!0),F)).catch(u=>(console.log(`Error fetching ${C}: ${u}. Will gracefully degrade and hide Frigade`),g(!0),F)),{mutateUserFlowState:E,userFlowStatesData:A,isLoadingUserFlowStateData:O,optimisticallyMarkFlowCompleted:h,optimisticallyMarkFlowNotStarted:w,optimisticallyMarkStepCompleted:f,optimisticallyMarkStepNotStarted:P,optimisticallyMarkStepStarted:N}=Me(),{data:L,error:I,isLoading:q}=ba(s?`${t}flows${y?"?readonly=true":""}`:null,b,{keepPreviousData:!0});Sa(()=>{if(I){console.error(I);return}L&&L.data&&n(L.data)},[L,I]);function M(C){if(q)return null;let u=o.find(k=>k.slug===C);return!u&&o.length>0&&!O&&!q?(console.log(`Flow with id ${C} not found`),null):(u==null?void 0:u.active)===!1&&!y?null:u}function j(C){var z,xe;if(!M(C))return[];let u=M(C).data;return u?(u=le(u),((xe=(z=nr(u))==null?void 0:z.data)!=null?xe:[]).map(he=>{let ro=J(he);return _(T({handleSecondaryButtonClick:()=>{he.skippable===!0&&V(C,he.id,{skipped:!0})}},he),{complete:ue(C,he.id)===Ke||ro>=1,blocked:Oe(C,he.id),hidden:we(C,he.id),handlePrimaryButtonClick:()=>{(!he.completionCriteria&&(he.autoMarkCompleted||he.autoMarkCompleted===void 0)||he.completionCriteria&&he.autoMarkCompleted===!0)&&V(C,he.id)},progress:ro})}).filter(he=>he.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 K(C,u){d(k=>_(T({},k),{[C]:u}))}function se(C){!O&&!q&&C&&JSON.stringify(p)!=JSON.stringify(T(T({},p),C))&&Object.keys(C).forEach(u=>{K(u,C[u])})}let de=Tt((C,u,k)=>$(this,null,function*(){if(!S())return;let z={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:u,actionType:vo,data:k!=null?k:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield N(C,u,z),x(z))}),[i,r,A]),be=Tt((C,u,k)=>$(this,null,function*(){if(!S())return;let z={foreignUserId:i,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 P(C,u),x(z))}),[i,r,A]),V=Tt((C,u,k)=>$(this,null,function*(){if(!S())return;let z={foreignUserId:i,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 f(C,u,z),x(z))}),[i,r,A]),Y=Tt((C,u)=>$(this,null,function*(){if(!S()||fe(C)===$e)return;let k={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:$e,data:u!=null?u:{},createdAt:new Date,blocked:!1,hidden:!1};yield w(C),X(k)&&x(k)}),[i,r,A]),ee=Tt((C,u)=>$(this,null,function*(){if(!S())return;let k={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:wt,data:u!=null?u:{},createdAt:new Date,blocked:!1,hidden:!1};X(k)&&x(k)}),[i,r,A]),Ve=Tt((C,u)=>$(this,null,function*(){if(!S())return;let k={foreignUserId:i,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 h(C),x(k))}),[i,r,A]),Le=Tt((C,u)=>$(this,null,function*(){if(!S())return;let k={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:Po,data:u!=null?u:{},createdAt:new Date,blocked:!1,hidden:!1};X(k)&&(yield h(C),x(k))}),[i,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 O?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(O)return null;let k=A==null?void 0:A.find(xe=>xe.flowId===C);return!k||!k.stepStates[u]?null:(z=k.stepStates[u])!=null?z:null}function D(C){var k,z;if(O||!A)return null;if(fe(C)===$e)return(k=j(C)[0])!=null?k:null;let u=(z=A.find(xe=>xe.flowId===C))==null?void 0:z.lastStepId;return u?j(C).find(xe=>xe.id===u):null}function W(C){var z;let u=D(C);if(!u)return 0;let k=(z=j(C).findIndex(xe=>xe.id===u.id))!=null?z:0;return ue(C,u.id)===Ke&&k<j(C).length-1?k+1:k}function J(C){if(!C.completionCriteria)return;let u=ai(C.completionCriteria);if(u===null)return;let k=De(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 De(C){let u=j(C);return u.length===0?0:u.filter(z=>ue(C,z.id)===Ke).length}function Ge(C){return j(C).length}function Xe(C){let u=o.find(k=>k.slug===C);return u?nr(u.data):null}function bt(C){if(y)return!1;if(O)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&&i&&i.startsWith("guest_"))}function Dt(C){return!bt(M(C))}function $t(){i&&E()}return{getFlow:M,getFlowData:Xe,isLoading:O||q,getStepStatus:ue,getFlowSteps:j,getCurrentStepIndex:W,markStepStarted:de,markStepCompleted:V,markFlowNotStarted:Y,markFlowStarted:ee,markFlowCompleted:Ve,markFlowAborted:Le,markStepNotStarted:be,getFlowStatus:fe,getNumberOfStepsCompleted:De,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:bt,setCustomVariable:K,updateCustomVariables:se,customVariables:p,getStepOptionalProgress:J,getFlowMetadata:pe,isStepBlocked:Oe,isStepHidden:we,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,isFlowAvailableToUser:Dt,refresh:$t}}import{useCallback as lr,useContext as wa,useEffect as Ta}from"react";var zt="guest_";function so(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:i}=wa(Q),{config:r,apiUrl:s}=Je(),{mutateUserFlowState:p}=Me(),d=Ut(),{verifySDKInitiated:l}=Wt();function m(F){return`frigade-user-registered-${F}`}Ta(()=>{if(e&&!t){if(e.startsWith(zt))return;let F=m(e);localStorage.getItem(F)||(d(`${s}users`,_(T({},r),{method:"POST",body:JSON.stringify({foreignId:e})})),localStorage.setItem(F,"true"))}},[e,i,t]);let c=lr(F=>$(this,null,function*(){if(!l())return;let S={foreignId:e,properties:F};yield d(`${s}users`,_(T({},r),{method:"POST",body:JSON.stringify(S)})),n(x=>T(T({},x),F)),p()}),[e,r,i,p]),g=lr((F,S)=>$(this,null,function*(){if(!l())return;let v={foreignId:e,events:[{event:F,properties:S}]};yield d(`${s}users`,_(T({},r),{method:"POST",body:JSON.stringify(v)})),p()}),[e,r,p]),y=lr((F,S)=>$(this,null,function*(){if(l())if(S){let x=m(F);localStorage.setItem(x,"true"),o(F);let v={foreignId:F,properties:S};yield d(`${s}users`,_(T({},r),{method:"POST",body:JSON.stringify(v)})),n(b=>T(T({},b),S)),p()}else o(F)}),[r,i,p]);return{userId:e,setUserId:o,setUserIdWithProperties:y,addPropertiesToUser:c,trackEventForUser:g}}import{v4 as qp}from"uuid";import et,{useEffect as mn,useState as un}from"react";import qe,{useEffect as cr,useState as Ia}from"react";import Oo from"styled-components";import Fa from"react";import ka from"styled-components";var pi="fr-",lo="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+" "+lo+e}return o}function B(e){if(!e.className||e.className.indexOf(lo)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(pi)?"":`:not(${o.map(n=>`.${n}`).join(", ")})`}function Bo(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=>`${Bo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Te(...e){return e.filter(Boolean).join(" ")}function ao(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 ko=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(ko)for(var o of ko(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&&ko)for(var i of ko(e))t.indexOf(i)<0&&ri.call(e,i)&&(o[i]=e[i]);return o};var M=(e,t,o)=>new Promise((i,n)=>{var r=d=>{try{p(o.next(d))}catch(s){n(s)}},l=d=>{try{p(o.throw(d))}catch(s){n(s)}},p=d=>d.done?i(d.value):Promise.resolve(d.value).then(r,l);p((o=o.apply(e,t)).next())});import vt,{createContext as hd,useEffect as Ko,useState as je}from"react";import{ThemeProvider as Cd}from"styled-components";import Pt,{useContext as Kp,useEffect as xo,useState as Vo}from"react";import{useCallback as Tt,useContext as ya,useEffect as Sa}from"react";import rr,{useMemo as si}from"react";var ni="1.35.42 ";var He="NOT_STARTED_STEP",Z="COMPLETED_FLOW",Po="ABORTED_FLOW",wt="STARTED_FLOW",Me="NOT_STARTED_FLOW",Ke="COMPLETED_STEP",vo="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 Ut(){let{shouldGracefullyDegrade:e,readonly:t}=rr.useContext(Q);return(o,i)=>M(this,null,function*(){if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Dt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Dt();let n=la+o,r=aa+o;if(window&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(n),d=window.localStorage.getItem(r);if(p&&d&&d==i.body){let s=new Date(p);if(new Date().getTime()-s.getTime()<1e3)return Dt()}window.localStorage.setItem(n,new Date().toISOString()),window.localStorage.setItem(r,i.body)}let l;try{l=yield fetch(o,i)}catch(p){return Dt(p)}return l?l.ok?l:Dt(l.statusText):Dt()})}function Dt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Wt(){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 xa,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,g=!1){var y;return(y=e[c])!=null?y:g}function l(c,g){t(y=>_(w({},y),{[c]:g}))}function p(c){t(g=>{let S=g,{[c]:y}=S,T=Ie(S,[ii(c)]);return w({},T)})}function d(c){n.includes(c)||i(g=>[...g,c])}function s(c){return n.includes(c)}function m(c){return Object.entries(e).some(([g,y])=>y&&g!=c)||o}return{getOpenFlowState:r,setOpenFlowState:l,resetOpenFlowState:p,hasOpenModals:m,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:s}}import fa from"swr/immutable";import io 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=io(t);return Object.entries(o).forEach(([n,r])=>{ir(r)?i[n]!==void 0?Object.assign(i,{[n]:Ce(i[n],io(r))}):Object.assign(i,{[n]:io(r)}):Array.isArray(r)?i[n]!==void 0?Object.assign(i,{[n]:[...i[n],...io(r)]}):Object.assign(i,{[n]:io(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:l,readonly:p}=da(Q),{resetOpenFlowState:d}=Be(),[s,m]=ma(!1),c={data:r.map(u=>({flowId:u.id,flowState:Z,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},g=u=>fetch(u,e).then(P=>{if(P.ok)return P.json();throw new Error("Failed to fetch user flow states")}).catch(P=>(console.log(`Error fetching ${u}: ${P}. Will gracefully degrade and hide Frigade`),l(!0),c)),y=o&&r&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${n?`&foreignUserGroupId=${encodeURIComponent(n)}`:""}`:null,{data:T,isLoading:S,mutate:x,error:B}=p?fa(y,g):ua(y,g,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),v=T==null?void 0:T.data;ca(()=>{!s&&!S&&v&&m(!0)},[v,s,S]);function F(u){return M(this,null,function*(){if(v&&!p){let P=v.find(N=>N.flowId===u);P&&P.flowState!==Z&&(P.flowState=Z),yield x(Promise.resolve(Ce(T,{data:v})),{optimisticData:Ce(T,{data:v}),revalidate:!1,rollbackOnError:!1})}})}function A(u,P,N){return M(this,null,function*(){if(v){let L=v.find(I=>I.flowId===u);L&&(L.stepStates[P]=N,L.flowState=wt),yield x(Promise.resolve(Ce(T,{data:v})),{optimisticData:Ce(T,{data:v}),revalidate:!1,rollbackOnError:!1})}})}function O(u,P,N){return M(this,null,function*(){if(v){let L=v.find(I=>I.flowId===u);L&&(L.lastStepId=P,L.stepStates[P]=N,L.flowState=wt),yield x(Ce(T,{data:v}),{optimisticData:Ce(T,{data:v}),revalidate:!1,rollbackOnError:!1})}})}function h(u){return M(this,null,function*(){if(v){let P=v.find(N=>N.flowId===u);P&&P.flowState!==Me&&(P.flowState=Me,P.lastStepId=ga,Object.keys(P.stepStates).forEach(N=>{P.stepStates[N].actionType=He,P.stepStates[N].createdAt=new Date().toISOString()}),yield x(Ce(T,{data:v}),{optimisticData:Ce(T,{data:v}),revalidate:!1,rollbackOnError:!1}),d(u))}})}function b(u,P){return M(this,null,function*(){if(v){let N=v.find(L=>L.flowId===u);N&&N.stepStates[P]!==He&&(N.stepStates[P]=He),yield x(Ce(T,{data:v}),{optimisticData:Ce(T,{data:v}),revalidate:!1,rollbackOnError:!1})}})}return{userFlowStatesData:v,isLoadingUserFlowStateData:!s,mutateUserFlowState:x,optimisticallyMarkFlowCompleted:F,optimisticallyMarkFlowNotStarted:h,optimisticallyMarkStepCompleted:A,optimisticallyMarkStepNotStarted:b,optimisticallyMarkStepStarted:O,error:B}}function no(){let{config:e,apiUrl:t}=Je(),{userFlowStatesData:o,mutateUserFlowState:i}=De(),{failedFlowResponses:n,setFailedFlowResponses:r,flowResponses:l,setFlowResponses:p}=xa(Q),[d,s]=li(new Set),[m,c]=li(new Set),g=Ut();function y(x){let B=JSON.stringify(x);if(d.has(B))return null;d.add(B),s(d),m.add(x),c(m);let v=l==null?void 0:l.find(F=>F.flowSlug===x.flowSlug&&F.stepId===x.stepId&&F.actionType===x.actionType&&F.createdAt===x.createdAt);return g(`${t}flowResponses`,_(w({},e),{method:"POST",body:B})).then(F=>{F.status!==200&&F.status!==201?(console.log("Failed to send flow response for step "+x.stepId+". Will retry again later."),r([...n,x])):v||p(A=>[...A!=null?A:[],x])})}function T(x){return M(this,null,function*(){x.foreignUserId&&(x.actionType===wt||x.actionType===Me?yield y(x):x.actionType===Z?yield y(x):x.actionType===vo?yield y(x):x.actionType===Ke?yield y(x):x.actionType===Po?yield y(x):x.actionType===He&&(yield y(x)))})}function S(){let x=[];return o==null||o.forEach(B=>{if(B&&B.stepStates&&Object.keys(B.stepStates).length!==0)for(let v in B.stepStates){let F=B.stepStates[v];x.push({foreignUserId:B.foreignUserId,flowSlug:B.flowId,stepId:F.stepId,actionType:F.actionType,data:{},createdAt:new Date(F.createdAt),blocked:F.blocked,hidden:F.hidden})}}),[...x,...l]}return{addResponse:T,setFlowResponses:p,getFlowResponses:S}}import ba from"swr";var ha=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,ai=e=>{let t=ha.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=(s=>(s.CHECKLIST="CHECKLIST",s.FORM="FORM",s.TOUR="TOUR",s.SUPPORT="SUPPORT",s.CUSTOM="CUSTOM",s.BANNER="BANNER",s.EMBEDDED_TIP="EMBEDDED_TIP",s.NPS_SURVEY="NPS_SURVEY",s.ANNOUNCEMENT="ANNOUNCEMENT",s))(sr||{});function R(){let{config:e,apiUrl:t}=Je(),{flows:o,setFlows:i,userId:n,organizationId:r,publicApiKey:l,customVariables:p,setCustomVariables:d,hasActiveFullPageFlow:s,setHasActiveFullPageFlow:m,setFlowResponses:c,setShouldGracefullyDegrade:g,readonly:y}=ya(Q),T={data:[]},{verifySDKInitiated:S}=Wt(),{addResponse:x,getFlowResponses:B}=no(),v=C=>fetch(C,e).then(f=>f.ok?f.json():(console.log(`Error fetching ${C} (${f.status}): ${f.statusText}. Will gracefully degrade and hide Frigade`),g(!0),T)).catch(f=>(console.log(`Error fetching ${C}: ${f}. Will gracefully degrade and hide Frigade`),g(!0),T)),{mutateUserFlowState:F,userFlowStatesData:A,isLoadingUserFlowStateData:O,optimisticallyMarkFlowCompleted:h,optimisticallyMarkFlowNotStarted:b,optimisticallyMarkStepCompleted:u,optimisticallyMarkStepNotStarted:P,optimisticallyMarkStepStarted:N}=De(),{data:L,error:I,isLoading:q}=ba(l?`${t}flows${y?"?readonly=true":""}`:null,v,{keepPreviousData:!0});Sa(()=>{if(I){console.error(I);return}L&&L.data&&i(L.data)},[L,I]);function D(C){if(q)return null;let f=o.find(k=>k.slug===C);return!f&&o.length>0&&!O&&!q?(console.log(`Flow with id ${C} not found`),null):(f==null?void 0:f.active)===!1&&!y?null:f}function j(C){var z,xe;if(!D(C))return[];let f=D(C).data;return f?(f=le(f),((xe=(z=nr(f))==null?void 0:z.data)!=null?xe:[]).map(he=>{let ro=J(he);return _(w({handleSecondaryButtonClick:()=>{he.skippable===!0&&V(C,he.id,{skipped:!0})}},he),{complete:ue(C,he.id)===Ke||ro>=1,blocked:Oe(C,he.id),hidden:we(C,he.id),handlePrimaryButtonClick:()=>{(!he.completionCriteria&&(he.autoMarkCompleted||he.autoMarkCompleted===void 0)||he.completionCriteria&&he.autoMarkCompleted===!0)&&V(C,he.id)},progress:ro})}).filter(he=>he.hidden!==!0)):[]}function le(C){return C.replaceAll(/\${(.*?)}/g,(f,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(!D(C))return[];let f=D(C).data;return f?(f=le(f),(k=JSON.parse(f))!=null?k:{}):[]}function K(C,f){d(k=>_(w({},k),{[C]:f}))}function se(C){!O&&!q&&C&&JSON.stringify(p)!=JSON.stringify(w(w({},p),C))&&Object.keys(C).forEach(f=>{K(f,C[f])})}let de=Tt((C,f,k)=>M(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:f,actionType:vo,data:k!=null?k:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield N(C,f,z),x(z))}),[n,r,A]),be=Tt((C,f,k)=>M(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:f,actionType:He,data:k!=null?k:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield P(C,f),x(z))}),[n,r,A]),V=Tt((C,f,k)=>M(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:f,actionType:Ke,data:k!=null?k:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield u(C,f,z),x(z))}),[n,r,A]),Y=Tt((C,f)=>M(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:f!=null?f:{},createdAt:new Date,blocked:!1,hidden:!1};yield b(C),X(k)&&x(k)}),[n,r,A]),ee=Tt((C,f)=>M(this,null,function*(){if(!S())return;let k={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:wt,data:f!=null?f:{},createdAt:new Date,blocked:!1,hidden:!1};X(k)&&x(k)}),[n,r,A]),Ve=Tt((C,f)=>M(this,null,function*(){if(!S())return;let k={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:Z,data:f!=null?f:{},createdAt:new Date,blocked:!1,hidden:!1};X(k)&&(yield h(C),x(k))}),[n,r,A]),Le=Tt((C,f)=>M(this,null,function*(){if(!S())return;let k={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:Po,data:f!=null?f:{},createdAt:new Date,blocked:!1,hidden:!1};X(k)&&(yield h(C),x(k))}),[n,r,A]);function X(C){var f;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&&((f=k.stepStates[C.stepId])==null?void 0:f.actionType)===C.actionType||k&&k.flowState===Z&&C.actionType===Z)return!1}return!0}function ue(C,f){let k=U(C,f);return O?null:k?k.actionType:He}function Oe(C,f){let k=U(C,f);return k?k.blocked:!1}function we(C,f){let k=U(C,f);return k?k.hidden:!1}function U(C,f){var z;if(O)return null;let k=A==null?void 0:A.find(xe=>xe.flowId===C);return!k||!k.stepStates[f]?null:(z=k.stepStates[f])!=null?z:null}function $(C){var k,z;if(O||!A)return null;if(fe(C)===Me)return(k=j(C)[0])!=null?k:null;let f=(z=A.find(xe=>xe.flowId===C))==null?void 0:z.lastStepId;return f?j(C).find(xe=>xe.id===f):null}function W(C){var z;let f=$(C);if(!f)return 0;let k=(z=j(C).findIndex(xe=>xe.id===f.id))!=null?z:0;return ue(C,f.id)===Ke&&k<j(C).length-1?k+1:k}function J(C){if(!C.completionCriteria)return;let f=ai(C.completionCriteria);if(f===null)return;let k=$e(f),z=Ge(f);return z===0?void 0:k/z}function fe(C){let f=A==null?void 0:A.find(k=>k.flowId===C);return f?f.flowState:null}function $e(C){let f=j(C);return f.length===0?0:f.filter(z=>ue(C,z.id)===Ke).length}function Ge(C){return j(C).length}function Xe(C){let f=o.find(k=>k.slug===C);return f?nr(f.data):null}function bt(C){if(y)return!1;if(O)return!0;if(C!=null&&C.targetingLogic&&A){let f=A.find(k=>k.flowId===C.slug);if(f)return f.shouldTrigger===!1}return!!(C!=null&&C.targetingLogic&&n&&n.startsWith("guest_"))}function $t(C){return!bt(D(C))}function Mt(){n&&F()}return{getFlow:D,getFlowData:Xe,isLoading:O||q,getStepStatus:ue,getFlowSteps:j,getCurrentStepIndex:W,markStepStarted:de,markStepCompleted:V,markFlowNotStarted:Y,markFlowStarted:ee,markFlowCompleted:Ve,markFlowAborted:Le,markStepNotStarted:be,getFlowStatus:fe,getNumberOfStepsCompleted:$e,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:bt,setCustomVariable:K,updateCustomVariables:se,customVariables:p,getStepOptionalProgress:J,getFlowMetadata:pe,isStepBlocked:Oe,isStepHidden:we,hasActiveFullPageFlow:s,setHasActiveFullPageFlow:m,isFlowAvailableToUser:$t,refresh:Mt}}import{useCallback as lr,useContext as wa,useEffect as Ta}from"react";var zt="guest_";function so(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:n}=wa(Q),{config:r,apiUrl:l}=Je(),{mutateUserFlowState:p}=De(),d=Ut(),{verifySDKInitiated:s}=Wt();function m(T){return`frigade-user-registered-${T}`}Ta(()=>{if(e&&!t){if(e.startsWith(zt))return;let T=m(e);localStorage.getItem(T)||(d(`${l}users`,_(w({},r),{method:"POST",body:JSON.stringify({foreignId:e})})),localStorage.setItem(T,"true"))}},[e,n,t]);let c=lr(T=>M(this,null,function*(){if(!s())return;let S={foreignId:e,properties:T};yield d(`${l}users`,_(w({},r),{method:"POST",body:JSON.stringify(S)})),i(x=>w(w({},x),T)),p()}),[e,r,n,p]),g=lr((T,S)=>M(this,null,function*(){if(!s())return;let B={foreignId:e,events:[{event:T,properties:S}]};yield d(`${l}users`,_(w({},r),{method:"POST",body:JSON.stringify(B)})),p()}),[e,r,p]),y=lr((T,S)=>M(this,null,function*(){if(s())if(S){let x=m(T);localStorage.setItem(x,"true"),o(T);let B={foreignId:T,properties:S};yield d(`${l}users`,_(w({},r),{method:"POST",body:JSON.stringify(B)})),i(v=>w(w({},v),S)),p()}else o(T)}),[r,n,p]);return{userId:e,setUserId:o,setUserIdWithProperties:y,addPropertiesToUser:c,trackEventForUser:g}}import{v4 as qp}from"uuid";import et,{useEffect as mn,useState as un}from"react";import qe,{useEffect as cr,useState as Ia}from"react";import Oo from"styled-components";import Fa from"react";import ka from"styled-components";var pi="fr-",lo="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+" "+lo+e}return o}function E(e){if(!e.className||e.className.indexOf(lo)!==-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 Bo(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=>`${Bo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Te(...e){return e.filter(Boolean).join(" ")}function ao(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=>E(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 Eo=rt.div`
|
|
31
|
-
${e=>
|
|
31
|
+
${e=>E(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=>E(e)} {
|
|
62
62
|
${e=>e.hasImage?Aa:Oa};
|
|
63
63
|
}
|
|
64
64
|
`,ui=rt.img`
|
|
65
|
-
${e=>
|
|
65
|
+
${e=>E(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=>E(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=>E(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=>E(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 Ao({appearance:e}){return Ti.createElement(wi,{className:a("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",Ti.createElement(ci,null))}var La=Oo.div`
|
|
147
|
-
${e=>
|
|
147
|
+
${e=>E(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 */
|
|
@@ -157,7 +157,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
157
157
|
|
|
158
158
|
width: ${e=>{var t;return(t=e.width)!=null?t:"1000px"}};
|
|
159
159
|
z-index: 1500;
|
|
160
|
-
border-radius: ${e=>{var t,o,
|
|
160
|
+
border-radius: ${e=>{var t,o,i;return(i=(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius)!=null?i:8}}px;
|
|
161
161
|
${e=>ke(e)}
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -185,27 +185,27 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
185
185
|
opacity: 1;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
|
|
188
|
+
`,$a=Oo.div`
|
|
189
189
|
position: relative;
|
|
190
190
|
flex: 0 1 auto;
|
|
191
|
-
|
|
191
|
+
`,Ma=Oo.div`
|
|
192
192
|
position: absolute;
|
|
193
193
|
top: 16px;
|
|
194
194
|
right: 16px;
|
|
195
195
|
cursor: pointer;
|
|
196
196
|
z-index: 1501;
|
|
197
|
-
${e=>
|
|
197
|
+
${e=>E(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
|
}
|
|
201
|
-
`,
|
|
201
|
+
`,Da=Oo.div`
|
|
202
202
|
overflow: scroll;
|
|
203
203
|
flex: 1 1;
|
|
204
204
|
display: flex;
|
|
205
205
|
::-webkit-scrollbar {
|
|
206
206
|
display: none;
|
|
207
207
|
}
|
|
208
|
-
`,Qe=({onClose:e,visible:t,headerContent:o=null,style:
|
|
208
|
+
`,Qe=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:n,appearance:r,dismissible:l=!0,showFrigadeBranding:p=!1})=>{let[d,s]=Ia("");return cr(()=>{let m=getComputedStyle(document.body).getPropertyValue("overflow");s(m)},[]),cr(()=>{let m=c=>{c.key==="Escape"&&e()};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[e]),cr(()=>{let m=document.body.style;return t?m.setProperty("overflow","hidden"):m.setProperty("overflow",d),()=>{m.setProperty("overflow",d)}},[t]),t?qe.createElement(Na,null,qe.createElement(di,{appearance:r,onClose:()=>{l&&e()}}),qe.createElement(La,{appearance:r,className:a("modalContainer",r),styleOverrides:i},l&&qe.createElement(Ma,{className:a("modalClose",r),onClick:()=>e(),appearance:r},qe.createElement(Ee,null)),o&&qe.createElement($a,null,o),qe.createElement(Da,null,n),p&&qe.createElement(Si,{appearance:r,className:a("poweredByFrigadeRibbon",r)},qe.createElement(Ao,{appearance:r})))):qe.createElement(qe.Fragment,null)};import ft,{useEffect as mr,useState as Ua}from"react";import Io from"styled-components";import{Portal as Wa}from"react-portal";function za(e){switch(e){case"top-left":return`
|
|
209
209
|
top: 0;
|
|
210
210
|
left: 0;
|
|
211
211
|
`;case"top-right":return`
|
|
@@ -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=Io.div`
|
|
218
|
-
${e=>
|
|
218
|
+
${e=>E(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=>E(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
|
}
|
|
@@ -249,8 +249,8 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
249
249
|
::-webkit-scrollbar {
|
|
250
250
|
display: none;
|
|
251
251
|
}
|
|
252
|
-
`,No=({onClose:e,visible:t,headerContent:o=null,children:
|
|
253
|
-
${e=>
|
|
252
|
+
`,No=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:n,modalPosition:r="bottom-right",dismissible:l=!0})=>{let[p,d]=Ua("");return mr(()=>{let s=getComputedStyle(document.body).getPropertyValue("overflow");d(s)},[]),mr(()=>{let s=m=>{m.key==="Escape"&&e()};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[e]),mr(()=>{let s=document.body.style;return t?s.setProperty("overflow","hidden"):s.setProperty("overflow",p),()=>{s.setProperty("overflow",p)}},[t]),t?ft.createElement(Wa,null,ft.createElement(_a,{appearance:n,className:a("cornerModalContainer",n),modalPosition:r},l&&ft.createElement(ja,{className:a("cornerModalClose",n),onClick:()=>e()},ft.createElement(Ee,null)),o&&ft.createElement(Ha,null,o),ft.createElement(Va,null,i))):ft.createElement(ft.Fragment,null)};import{useContext as Ga}from"react";function te(){let{defaultAppearance:e}=Ga(Q);function t(o){var n,r,l;let i=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign((n=i.styleOverrides)!=null?n:{},(r=o.styleOverrides)!=null?r:{}),theme:Object.assign(i.theme,(l=o.theme)!=null?l:{})}:i}return{mergeAppearanceWithDefault:t}}import Ft,{useContext as up,useEffect as zi,useState as wr}from"react";import Uo from"styled-components";import Mo,{useEffect as Ei,useState as gr}from"react";import xr from"styled-components";import Lo from"styled-components";var Fi=Lo.label`
|
|
253
|
+
${e=>E(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=Lo.label`
|
|
264
|
-
${e=>
|
|
264
|
+
${e=>E(e)} {
|
|
265
265
|
font-size: 12px;
|
|
266
266
|
line-height: 20px;
|
|
267
267
|
margin-bottom: 5px;
|
|
@@ -275,17 +275,17 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
275
275
|
display: flex;
|
|
276
276
|
margin-right: 5px;
|
|
277
277
|
margin-top: 10px;
|
|
278
|
-
|
|
278
|
+
`,$o=Lo.div`
|
|
279
279
|
display: flex;
|
|
280
280
|
align-items: flex-start;
|
|
281
281
|
justify-content: left;
|
|
282
282
|
margin-bottom: 10px;
|
|
283
|
-
`;import ur from"react";var it={theme:{colorPrimary:"#0171F8",colorSecondary:"#2E343D",colorText:"#0F1114",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#2E343D",colorTextDisabled:"#5A6472",colorBorder:"#E5E5E5",colorTextError:"#c00000",colorTextSuccess:"#00D149",borderRadius:10}};function gt({title:e,required:t,appearance:o=it}){return e?ur.createElement(
|
|
283
|
+
`;import ur from"react";var it={theme:{colorPrimary:"#0171F8",colorSecondary:"#2E343D",colorText:"#0F1114",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#2E343D",colorTextDisabled:"#5A6472",colorBorder:"#E5E5E5",colorTextError:"#c00000",colorTextSuccess:"#00D149",borderRadius:10}};function gt({title:e,required:t,appearance:o=it}){return e?ur.createElement($o,{className:a("formLabelWrapper",o)},t?ur.createElement(Pi,{className:a("formLabelRequired",o),appearance:o},"*"):null,ur.createElement(Fi,{className:a("formLabel",o)},e)):null}import vi from"react";function _t({title:e,appearance:t}){return e?vi.createElement($o,null,vi.createElement(ki,{className:a("formSubLabel",t)},e)):null}import{z as fr}from"zod";function Bi(e,t){var o,i,n,r,l,p,d;try{if(t){if(t.type=="number"){let s=fr.number();if(t.props)for(let m of t.props)m.requirement=="min"?s=s.min(Number(m.value),(o=m.message)!=null?o:"Value is too small"):m.requirement=="max"?s=s.max(Number(m.value),(i=m.message)!=null?i:"Value is too large"):m.requirement=="positive"?s=s.positive((n=m.message)!=null?n:"Value must be positive"):m.requirement=="negative"&&(s=s.nonpositive((r=m.message)!=null?r:"Value must be negative"));s.parse(Number(e))}if(t.type=="string"){let s=fr.string();if(t.props)for(let m of t.props)m.requirement=="min"?s=s.min(Number(m.value),(l=m.message)!=null?l:"Value is too short"):m.requirement=="max"?s=s.max(Number(m.value),(p=m.message)!=null?p:"Value is too long"):m.requirement=="regex"&&(s=s.regex(new RegExp(String(m.value)),(d=m.message)!=null?d:"Value does not match requirements"));s.parse(e)}return}}catch(s){if(s instanceof fr.ZodError)return s.issues&&s.issues.length>0?s.issues[0].message:null;console.error("Frigade Form validation failed for rule ",t,s)}return null}var Ka=xr.div`
|
|
284
284
|
display: flex;
|
|
285
285
|
flex-direction: column;
|
|
286
286
|
width: 100%;
|
|
287
287
|
`,hr=xr.input`
|
|
288
|
-
${e=>
|
|
288
|
+
${e=>E(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=xr.textarea`
|
|
304
|
-
${e=>
|
|
304
|
+
${e=>E(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:
|
|
319
|
+
`;function Cr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:n}){let r=e,[l,p]=gr((n==null?void 0:n.text)||""),[d,s]=gr(!1),[m,c]=gr(!1),g=hr;Ei(()=>{l===""&&!d&&(s(!0),y(""))},[]),Ei(()=>{if(m){y(l);return}},[m]);function y(S){var B;if(p(S),o({text:S}),r.required===!0&&S.trim()===""){i([{id:r.id,message:`${(B=r.title)!=null?B:"Field"} is required`,hidden:!m}]);return}let x=Bi(S,r.validation);if(x&&(S.trim()!==""||r.required===!0)){i([{id:r.id,message:x,hidden:!m}]);return}i([])}r.multiline&&(g=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 Mo.createElement(Ka,null,Mo.createElement(gt,{title:r.title,required:r.required,appearance:t.appearance}),Mo.createElement(g,{className:a("inputComponent",t.appearance),value:l,onChange:S=>{y(S.target.value)},appearance:t.appearance,placeholder:r.placeholder,type:T(),onBlur:()=>{c(!0)}}),Mo.createElement(_t,{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=>E(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;
|
|
@@ -335,7 +335,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
335
335
|
|
|
336
336
|
padding: 0 10px;
|
|
337
337
|
margin-bottom: 10px;
|
|
338
|
-
color: ${e=>{var t,o,n
|
|
338
|
+
color: ${e=>{var t,o,i,n;return e.value==""?(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextDisabled:(n=(i=e.appearance)==null?void 0:i.theme)==null?void 0:n.colorText}};
|
|
339
339
|
|
|
340
340
|
appearance: none;
|
|
341
341
|
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'><path stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/></svg>");
|
|
@@ -343,16 +343,16 @@ 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:
|
|
346
|
+
`;function Ni({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var m,c,g,y,T,S,x,B,v;let r=e,[l,p]=Oi(!1),[d,s]=Oi(!1);return Ai(()=>{var F,A,O,h;if(!((F=i==null?void 0:i.choice)!=null&&F[0])&&!l){if(p(!0),r.requireSelection){o({choice:[yr]});return}if(r.defaultValue&&((A=r.props.options)!=null&&A.find(b=>b.id===r.defaultValue))){let b=(O=r.props.options)==null?void 0:O.find(u=>u.id===r.defaultValue);o({choice:[b.id]})}else o({choice:[((h=r.props.options)==null?void 0:h[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(gt,{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=>{s(!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},(g=r.placeholder)!=null?g:"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(gt,{title:(v=(B=(x=r.props.options)==null?void 0:x.find(F=>{var A;return F.id===((A=i==null?void 0:i.choice)==null?void 0:A[0])}))==null?void 0:B.openEndedLabel)!=null?v:"Please specify",required:!1,appearance:t.appearance}),Ze.createElement(hr,{type:"text",placeholder:"Enter your answer here",onChange:F=>{o({choice:[F.target.value]})},appearance:t.appearance})),Ze.createElement(_t,{title:r.subtitle,appearance:t.appearance}))}import mo,{useEffect as Sr,useState as $i}from"react";import Mi from"styled-components";import co from"react";import po 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 po.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:l})=>po.createElement("svg",{style:l,className:r,width:t,height:t,overflow:"visible"},po.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},po.createElement(Li,{color:n,size:t}),po.createElement(Li,{color:e,percentage:o,size:t})),i),Ht=Ja;import Qa from"styled-components";var Za=({color:e="#FFFFFF"})=>co.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},co.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
|
-
`,nt=({value:e,type:t="round",primaryColor:o="#000000",progress:
|
|
348
|
+
`,nt=({value:e,type:t="round",primaryColor:o="#000000",progress:i,appearance:n=it,style:r,className:l})=>{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?co.createElement(Ht,{fillColor:o,percentage:i,size:22}):co.createElement(lp,{styleOverrides:p,style:r,role:"checkbox",className:Te(a("checkIconContainer",n),a(e?"checkIconContainerChecked":"checkIconContainerUnchecked",n),e?"checkIconContainerChecked":"checkIconContainerUnchecked",l)},e&&co.createElement(Za,{color:"#FFFFFF"}))};var ap=Mi.div`
|
|
349
349
|
display: flex;
|
|
350
350
|
flex-direction: column;
|
|
351
351
|
width: 100%;
|
|
352
352
|
-webkit-appearance: none;
|
|
353
353
|
appearance: none;
|
|
354
|
-
`,pp
|
|
355
|
-
${e=>
|
|
354
|
+
`,pp=Mi.button`
|
|
355
|
+
${e=>E(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;
|
|
@@ -376,8 +376,8 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
376
376
|
height: 48px;
|
|
377
377
|
padding: 0 18px;
|
|
378
378
|
margin-bottom: 10px;
|
|
379
|
-
`;function
|
|
380
|
-
${e=>
|
|
379
|
+
`;function Di({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var m;let r=e,[l,p]=$i((i==null?void 0:i.choice)||[]),[d,s]=$i(!1);return Sr(()=>{l.length==0&&!d&&(s(!0),o({choice:[]}))},[]),Sr(()=>{o({choice:l})},[l]),Sr(()=>{r.required&&(l.length<r.props.minChoices||l.length>r.props.maxChoices)?n([{message:"",id:r.id}]):n([])},[l]),mo.createElement(ap,null,mo.createElement(gt,{title:r.title,required:r.required,appearance:t.appearance}),(m=r.props.options)==null?void 0:m.map(c=>mo.createElement(pp,{appearance:t.appearance,className:a(l.includes(c.id)?"multipleChoiceListItemSelected":"multipleChoiceListItem",t.appearance),key:c.id,value:c.id,"data-selected":l.includes(c.id),onClick:()=>{if(l.includes(c.id)){p(l.filter(g=>g!==c.id));return}l.length<r.props.maxChoices?p([...l,c.id]):l.length==1&&r.props.maxChoices==1&&p([c.id])}},c.title,mo.createElement(nt,{type:"round",primaryColor:t.appearance.theme.colorPrimary,value:l.includes(c.id),appearance:t.appearance}))),mo.createElement(_t,{title:r.subtitle,appearance:t.appearance}))}import Do 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=>E(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=>E(e)} {
|
|
393
393
|
font-style: normal;
|
|
394
394
|
font-weight: 400;
|
|
395
395
|
font-size: 14px;
|
|
@@ -397,7 +397,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
397
397
|
letter-spacing: 0.28px;
|
|
398
398
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
399
399
|
}
|
|
400
|
-
`;function Ae({appearance:e,title:t,subtitle:o,size:
|
|
400
|
+
`;function Ae({appearance:e,title:t,subtitle:o,size:i="medium",classPrefix:n=""}){return Do.createElement(Do.Fragment,null,Do.createElement(cp,{appearance:e,className:a(`${n}${n?ao(i):i}Title`,e),dangerouslySetInnerHTML:ce(t),size:i}),o&&Do.createElement(mp,{appearance:e,className:a(`${n}${n?ao(i):i}Subtitle`,e),dangerouslySetInnerHTML:ce(o),size:i}))}import*as br from"react";var Wi=e=>br.createElement("svg",w({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,"aria-hidden":"true",viewBox:"0 0 16 16"},e),br.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"m10.115 1.308 5.635 11.269A2.365 2.365 0 0 1 13.634 16H2.365A2.365 2.365 0 0 1 .25 12.577L5.884 1.308a2.365 2.365 0 0 1 4.231 0zM8 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM8 9c.552 0 1-.32 1-.714V4.714C9 4.32 8.552 4 8 4s-1 .32-1 .714v3.572C7 8.68 7.448 9 8 9z"}));var fp=Uo.div`
|
|
401
401
|
display: flex;
|
|
402
402
|
flex-direction: column;
|
|
403
403
|
justify-content: flex-end;
|
|
@@ -415,7 +415,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
415
415
|
`,hp=Uo.div`
|
|
416
416
|
padding-left: 1px;
|
|
417
417
|
padding-right: 1px;
|
|
418
|
-
`,Cp={text:Cr,multipleChoice:Ni,multipleChoiceList:
|
|
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:l,prefillData:p}){var O;let d=t.props,[s,m]=wr([]),[c,g]=wr([]),{userId:y}=so(),[T,S]=wr(F()||(p?p[t.id]:null)||{}),{readonly:x}=up(Q),B=w(w({},Cp),l);zi(()=>{i(s.length===0)},[s,i]),zi(()=>{n(T)},[T]);function v(h,b){S(u=>{let P=_(w({},u),{[h.id]:b});return window&&window.localStorage&&!x&&window.localStorage.setItem(A(),JSON.stringify(P)),P})}function F(){if(window&&window.localStorage){let h=window.localStorage.getItem(A());if(h)return JSON.parse(h)}return null}function A(){return`${Tr}-${e}-${t.id}-${y}`}return Ft.createElement(hp,{className:a("multiInput",r)},Ft.createElement(Ae,{appearance:r,title:t.title,subtitle:t.subtitle}),Ft.createElement(fp,{className:a("multiInputContainer",r)},(O=d.data)==null?void 0:O.map(h=>{let b=s.reverse().find(u=>u.id===h.id);return B[h.type]?Ft.createElement("span",{key:h.id,"data-field-id":h.id,className:a("multiInputField",r)},B[h.type]({formInput:h,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r},onSaveInputData:u=>{!c.includes(h.id)&&u&&(u==null?void 0:u.text)!==""&&g(P=>[...P,h.id]),v(h,u)},inputData:T[h.id],setFormValidationErrors:u=>{u.length===0&&s.length===0||m(P=>u.length===0?P.filter(N=>N.id!==h.id):[...P,...u])}}),b&&b.message&&c.includes(h.id)&&b.hidden!==!0&&Ft.createElement(gp,{key:h.id,style:{overflow:"hidden"},appearance:r,className:a("multiInputValidationError",r)},Ft.createElement(xp,{appearance:r,className:a("multiInputValidationErrorIcon",r)},Ft.createElement(Wi,null)),b.message)):null})))}import jt from"styled-components";var Hi=jt.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=>E(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"};
|
|
@@ -482,8 +482,8 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
482
482
|
${e=>e.withMargin?"margin: 16px 0px 16px 0px;":""}
|
|
483
483
|
|
|
484
484
|
border: 1px solid ${e=>{var t,o;return e.secondary?"#C5CBD3":(o=(t=e==null?void 0:e.appearance)==null?void 0:t.theme)==null?void 0:o.colorPrimary}};
|
|
485
|
-
color: ${e=>{var t,o,n
|
|
486
|
-
background-color: ${e=>{var t,o,n
|
|
485
|
+
color: ${e=>{var t,o,i,n;return e.secondary?(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText:(n=(i=e.appearance)==null?void 0:i.theme)==null?void 0:n.colorTextOnPrimaryBackground}};
|
|
486
|
+
background-color: ${e=>{var t,o,i,n;return e.secondary?(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground:(n=(i=e==null?void 0:e.appearance)==null?void 0:i.theme)==null?void 0:n.colorPrimary}};
|
|
487
487
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
488
488
|
padding: ${e=>e.size=="small"?"6px 14px 6px 14px":"8px 20px 8px 20px"};
|
|
489
489
|
font-size: ${e=>e.size=="small"?"14px":"15px"};
|
|
@@ -504,7 +504,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
504
504
|
cursor: not-allowed;
|
|
505
505
|
}
|
|
506
506
|
`,Wo=Ji.div`
|
|
507
|
-
${e=>
|
|
507
|
+
${e=>E(e)} {
|
|
508
508
|
display: flex;
|
|
509
509
|
flex-direction: row;
|
|
510
510
|
justify-content: flex-start;
|
|
@@ -514,9 +514,9 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
514
514
|
margin-right: 8px;
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
-
`,oe=({onClick:e,title:t,style:o,disabled:
|
|
517
|
+
`,oe=({onClick:e,title:t,style:o,disabled:i,type:n="inline",size:r="medium",secondary:l=!1,appearance:p,withMargin:d=!0,classPrefix:s="",loading:m=!1})=>{var g;function c(){let y=l?"buttonSecondary":"button";return s===""?y:`${s}${ao(y)}`}return Xi.createElement(Sp,{secondary:l,appearance:p,disabled:i||m,loading:(g=m==null?void 0:m.toString())!=null?g:"",onClick:e,styleOverrides:o,type:n,withMargin:d,size:r,className:a(c(),p)},m?Xi.createElement(Yi,{className:a("buttonLoader",p)}):t!=null?t:"Continue")};var Qi=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:n,selectedStep:r,steps:l,onBack:p,allowBackNavigation:d,errorMessage:s,isSaving:m})=>{var y;let c=l.length>1&&r!=0&&d,g=e.primaryButtonTitle&&e.secondaryButtonTitle||c?"inline":"full-width";return xt.createElement(xt.Fragment,null,s!==null&&s!=null&&xt.createElement(ji,{appearance:o,className:a("formCTAError",o)},s),xt.createElement(Hi,{showBackButton:c,className:a("formCTAContainer",o)},c&&xt.createElement(oe,{title:(y=e.backButtonTitle)!=null?y:"Back",onClick:p,secondary:!0,withMargin:!1,type:g,appearance:o,style:{width:"90px",maxWidth:"90px"},classPrefix:"back"}),xt.createElement(Vi,{className:a("ctaWrapper",o)},e.secondaryButtonTitle?xt.createElement(oe,{title:e.secondaryButtonTitle,onClick:n,secondary:!0,withMargin:!1,type:g,appearance:o,disabled:m}):null," ",e.primaryButtonTitle?xt.createElement(oe,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:g,appearance:o,loading:m}):null)))};import Fr from"react";import bp from"styled-components";var wp=bp.div`
|
|
518
518
|
text-align: center;
|
|
519
|
-
`,Zi=({stepCount:e=0,currentStep:t=0,className:o,appearance:
|
|
519
|
+
`,Zi=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:n}=te().mergeAppearanceWithDefault(i);return Fr.createElement(wp,{className:o},Fr.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((r,l)=>Fr.createElement("rect",{key:l,x:16*l,y:0,width:8,height:8,rx:4,fill:t===l?n.colorPrimary:"#E6E6E6"}))))};import kt from"react";import Vt from"styled-components";import{useContext as Tp}from"react";function ae(){let e=Tp(Q);function t(n){i(n.primaryButtonUri,n.primaryButtonUriTarget)}function o(n){i(n.secondaryButtonUri,n.secondaryButtonUriTarget)}function i(n,r){if(!n)return;let l=n.startsWith("http")?"_blank":"_self";r&&r!=="_blank"&&(l="_self"),e.navigate(n,l)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:i}}var Fp=Vt.div`
|
|
520
520
|
display: flex;
|
|
521
521
|
flex-wrap: wrap;
|
|
522
522
|
align-content: center;
|
|
@@ -564,7 +564,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
564
564
|
margin-top: 12px;
|
|
565
565
|
margin-bottom: 16px;
|
|
566
566
|
max-width: 70%;
|
|
567
|
-
`;function Ri({stepData:e,appearance:t}){var n
|
|
567
|
+
`;function Ri({stepData:e,appearance:t}){var i,n;let{handleUrl:o}=ae();return kt.createElement("div",null,kt.createElement(Bp,null,e.title),kt.createElement(Ep,null,e.subtitle),kt.createElement(Fp,null,(n=(i=e.props)==null?void 0:i.links)==null?void 0:n.map(r=>kt.createElement(kp,{key:r.title},kt.createElement(Pp,{src:r.imageUri}),kt.createElement(vp,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{var l;r.uri&&o(r.uri,(l=r.uriTarget)!=null?l:"_blank")}},r.title)))))}import Gt,{useEffect as Mp}from"react";import Ho from"styled-components";import kr from"react";var zo=({style:e,className:t})=>kr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:t,style:e},kr.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),kr.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.91 11.672a.375.375 0 010 .656l-5.603 3.113a.375.375 0 01-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112z"}));import uo,{useRef as Ap,useState as Op}from"react";import _o from"styled-components";var Ip=_o.div`
|
|
568
568
|
display: flex;
|
|
569
569
|
align-items: center;
|
|
570
570
|
justify-content: flex-start;
|
|
@@ -595,36 +595,36 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
595
595
|
width: 100%;
|
|
596
596
|
height: 100%;
|
|
597
597
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
598
|
-
|
|
598
|
+
`,$p=_o.iframe`
|
|
599
599
|
width: 100%;
|
|
600
600
|
height: 100%;
|
|
601
601
|
min-height: 260px;
|
|
602
602
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
603
|
-
`;function Re({appearance:e,videoUri:t}){let o=Ap(),[n
|
|
604
|
-
${e=>
|
|
603
|
+
`;function Re({appearance:e,videoUri:t}){let o=Ap(),[i,n]=Op(!1);if(t.includes("youtube")){let r=t.split("v=")[1],l=r.indexOf("&");return l!==-1&&(r=r.substring(0,l)),uo.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})}return uo.createElement(Ip,{className:a("videoPlayerWrapper",e),appearance:e},!i&&uo.createElement(Np,{onClick:()=>{n(!0),o.current.play()},appearance:e},uo.createElement(zo,null)),uo.createElement(Lp,{appearance:e,controls:i,ref:o,play:i,src:t}))}var Dp=Ho.div`
|
|
604
|
+
${e=>E(e)} {
|
|
605
605
|
display: flex;
|
|
606
606
|
flex-direction: column;
|
|
607
607
|
justify-content: center;
|
|
608
608
|
}
|
|
609
609
|
`,Up=Ho.img`
|
|
610
|
-
${e=>
|
|
610
|
+
${e=>E(e)} {
|
|
611
611
|
width: 100%;
|
|
612
612
|
height: auto;
|
|
613
613
|
max-height: 250px;
|
|
614
614
|
margin-bottom: 24px;
|
|
615
615
|
}
|
|
616
616
|
`,Wp=Ho.div`
|
|
617
|
-
${e=>
|
|
617
|
+
${e=>E(e)} {
|
|
618
618
|
margin-bottom: 24px;
|
|
619
619
|
}
|
|
620
620
|
`,zp=Ho.div`
|
|
621
|
-
${e=>
|
|
621
|
+
${e=>E(e)} {
|
|
622
622
|
width: 100%;
|
|
623
623
|
height: auto;
|
|
624
624
|
max-height: 250px;
|
|
625
625
|
margin-bottom: 24px;
|
|
626
626
|
}
|
|
627
|
-
`;function en({stepData:e,appearance:t,setCanContinue:o}){return
|
|
627
|
+
`;function en({stepData:e,appearance:t,setCanContinue:o}){return Mp(()=>{o(!0)},[]),Gt.createElement(Dp,{className:a("callToActionContainer",t)},Gt.createElement(Wp,{className:a("callToActionTextContainer",t)},Gt.createElement(Ae,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&Gt.createElement(Up,{className:a("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&Gt.createElement(zp,{appearance:t,className:a("callToActionVideo",t)},Gt.createElement(Re,{appearance:t,videoUri:e.videoUri})))}import st,{useEffect as Pr,useState as vr}from"react";import ht from"styled-components";var tn=ht.div`
|
|
628
628
|
width: auto;
|
|
629
629
|
display: flex;
|
|
630
630
|
flex-direction: column;
|
|
@@ -677,8 +677,8 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
677
677
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
678
678
|
display: flex;
|
|
679
679
|
align-self: center;
|
|
680
|
-
`;var dn=({stepData:e,setCanContinue:t,onSaveData:o,appearance:
|
|
681
|
-
${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map(([n,i])=>typeof i=="object"?`${n} { ${Object.entries(i).map(([s,p])=>`${Bo(s)}: ${p};`).join(" ")} }`:`${Bo(n)}: ${i};`).join(" ")} }`).join(" ")}`;function ie({appearance:e}){if(!e||!e.styleOverrides)return go.createElement(go.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([o,n])=>typeof n=="object");return t.length===0?go.createElement(go.Fragment,null):go.createElement(jp,{inlineStyles:t})}var fn=({flowId:e,customStepTypes:t={},type:o="inline",visible:n,setVisible:i,customVariables:r,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:l=!0,onStepCompletion:m,onButtonClick:c,dismissible:g=!0,endFlowOnDismiss:y=!1,modalPosition:F="center",repeatable:S=!1,onDismiss:x,showPagination:v=!1,allowBackNavigation:b=!1,validationHandler:E,showFrigadeBranding:A=!1,onFormDataChange:O,showFooter:h=!0,prefillData:w={},updateUrlOnPageChange:f=!1})=>{var D;let{getFlow:P,getFlowSteps:N,isLoading:L,targetingLogicShouldHideFlow:I,getFlowStatus:q,getCurrentStepIndex:M,markFlowCompleted:j,markFlowNotStarted:le,markStepStarted:pe}=R(),K=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]=n!==void 0&&i!==void 0?[n,i]:[Ve(e,!0),W=>ee(e,W)];if(mn(()=>{!de&&!L&&(be(!0),(q(e)===Z&&S||q(e)===$e)&&(q(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 De=W;fe=X.findIndex(Ge=>Ge.id===De),V===W&&(fe=-1),Y(W)}else fe=0,Y("");fe!==-1&&pe(e,X[fe].id)}},[X,(D=window==null?void 0:window.location)==null?void 0:D.hash]),L)return null;let we=P(e);if(!we||I(we)||!X||n!==void 0&&n===!1||q(e)===Z&&l||(o=="modal"||o=="corner-modal")&&Le(e))return null;let U=()=>{Oe(!1),x&&x(),y===!0&&j(e)};if(F=="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:g,showFrigadeBranding:A},et.createElement(ie,{appearance:d}),et.createElement(jo,{appearance:d,steps:X,selectedStep:K,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:i,setShowModal:Oe,onDismiss:x,showPagination:v,customFormElements:s,allowBackNavigation:b,validationHandler:E,onFormDataChange:O,showFooter:h,prefillData:w,updateUrlOnPageChange:f}))}return o==="modal"&&F!=="center"?et.createElement(No,{appearance:d,onClose:U,visible:ue,modalPosition:F},et.createElement(ie,{appearance:d}),et.createElement(jo,{appearance:d,steps:X,selectedStep:K,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:i,setShowModal:Oe,onDismiss:x,showPagination:v,customFormElements:s,allowBackNavigation:b,validationHandler:E,onFormDataChange:O,showFooter:h,prefillData:w,updateUrlOnPageChange:f})):et.createElement(et.Fragment,null,et.createElement(ie,{appearance:d}),et.createElement(jo,{appearance:d,steps:X,selectedStep:K,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:i,setShowModal:Oe,onDismiss:x,showPagination:v,customFormElements:s,allowBackNavigation:b,validationHandler:E,onFormDataChange:O,showFooter:h,prefillData:w,updateUrlOnPageChange:f}))},gn=fn;import{useCallback as Br,useContext as Vp,useEffect as Gp}from"react";function Er(){let{organizationId:e,userId:t,setOrganizationId:o}=Vp(Q),{mutateUserFlowState:n}=Me(),{config:i,apiUrl:r}=Je(),s=Ut(),{verifySDKInitiated:p}=Wt();function d(g,y){return`frigade-user-group-registered-${g}-${y}`}Gp(()=>{if(t&&e){if(t.startsWith(zt))return;let g=d(t,e);localStorage.getItem(g)||(s(`${r}userGroups`,_(T({},i),{method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})})),localStorage.setItem(g,"true"))}},[t,e]);let l=Br(g=>$(this,null,function*(){if(!p())return;if(!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationIdInternal:e,userId:t});return}let y={foreignUserId:t,foreignUserGroupId:e,properties:g};yield s(`${r}userGroups`,_(T({},i),{method:"POST",body:JSON.stringify(y)})),n()}),[e,t,i,n]),m=Br((g,y)=>$(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:g,properties:y}]};yield s(`${r}userGroups`,_(T({},i),{method:"POST",body:JSON.stringify(S)})),n()}),[e,t,i,n]),c=Br((g,y)=>$(this,null,function*(){if(p())if(y){let F=d(t,g);localStorage.setItem(F,"true"),o(g);let S={foreignUserId:t,foreignUserGroupId:g,properties:y};yield s(`${r}userGroups`,_(T({},i),{method:"POST",body:JSON.stringify(S)})),n()}else o(g)}),[t,i,n]);return{organizationId:e,setOrganizationId:o,setOrganizationIdWithProperties:c,addPropertiesToOrganization:l,trackEventForOrganization:m}}var xn="frigade-xFrigade_guestUserId",ho="frigade-xFrigade_userId",hn=({})=>{let{setFlowResponses:e}=no(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:n}=Me(),{userId:i,setUserId:r}=so(),[s,p]=Vo(i),{getFlowStatus:d}=R(),{flows:l,userProperties:m,setIsNewGuestUser:c,flowResponses:g}=Kp(Q),[y,F]=Vo([]),[S,x]=Vo([]),{organizationId:v}=Er(),[b,E]=Vo(v);xo(()=>{if(!o&&t)for(let w=0;w<t.length;w++){let f=t[w],P=l.find(N=>N.slug===(f==null?void 0:f.flowId));if(P&&f&&f.shouldTrigger===!0&&P.type=="FORM"&&P.triggerType==="AUTOMATIC"&&!S.includes(P.slug)){setTimeout(()=>{A(f.flowId)},500);break}}},[o,t]),xo(()=>{g.length>0&&n()},[g]);function A(w){let f=l.find(P=>P.slug===w);f&&f.triggerType==="AUTOMATIC"&&!S.includes(f.slug)&&(x([...S,f.slug]),F([f]))}function O(){if(!i){let w=localStorage.getItem(ho);if(w){r(w);return}let f=localStorage.getItem(xn);if(f){r(f);return}c(!0);let P=zt+qp();try{localStorage.setItem(xn,P)}catch(N){console.log("Failed to save guest user id locally: Local storage unavailable",N)}r(N=>N||P)}}xo(()=>{try{if(l){let w=[];l.forEach(f=>{if(f.data){let P=f.data.match(/"imageUri":"(.*?)"/g);P&&P.forEach(N=>{let L=N.replace('"imageUri":"',"").replace('"',"");if(w.includes(L))return;let I=new Image;I.src=L,w.push(L)})}})}}catch(w){}},[l]),xo(()=>{if(i!==s&&(e([]),n()),p(i),i&&!i.startsWith(zt))try{localStorage.setItem(ho,i)}catch(w){console.log("Failed to save user id locally: Local storage available",w)}i===null&&setTimeout(()=>{i===null&&O()},50)},[i,l,m]),xo(()=>{v!=b&&(E(v),e([]),n())},[v,b,E]);function h(){return Pt.createElement(Pt.Fragment,null,y.map(w=>d(w.slug)!==$e?null:Pt.createElement("span",{key:w.slug},Pt.createElement(gn,{flowId:w.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return Pt.createElement(Pt.Fragment,null,Pt.createElement(h,null))};import{ErrorBoundary as yd}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 Yp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,n])=>{if(Cn[o]){let i=Cn[o].split("."),r=t;i.forEach((s,p)=>{r[s]||(r[s]=p===i.length-1?n:{}),r=r[s]})}}),t}function Xp(e){if(!e)return;let t=Ce({},e),o={};return Object.keys(t).forEach(n=>{let i=`.fr-${n}`;o[i]=t[n]}),o}function yn(e){let{theme:t,styleOverrides:o}=e,n=Yp(t),i=Xp(o);return{overrides:n,css:i}}import pd from"styled-components";import{compose as dd,variant as bn}from"styled-system";import Sn from"react";import Jp,{ThemeProvider as Qp,useTheme as Zp}from"styled-components";import{border as Rp,color as ed,compose as td,get as od,shadow as rd,space as id,system as nd,typography as sd}from"styled-system";var ld={width:{property:"width",scale:"sizes",transform:(e,t)=>od(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},ad=Jp("div")(({css:e})=>e,td(Rp,ed,rd,id,sd,nd(ld))),Co=i=>{var r=i,{as:e,children:t,overrides:o}=r,n=Ie(r,["as","children","overrides"]);let s=Zp(),p={border:"none",boxSizing:"border-box",m:0,p:0},d=()=>Sn.createElement(ad,T(T({as:e},p),n),t);if(o!==void 0){let l=Ce(s,o);return Sn.createElement(Qp,{theme:l},d())}return d()};var yo={Primary:{backgroundColor:"primary.background",color:"primary.foreground","&:hover":{backgroundColor:"blue400"}},Secondary:{backgroundColor:"white",border:"1px solid",borderColor:"gray800",color:"neutral.foreground","&:hover":{backgroundColor:"blue900"}},Link:{backgroundColor:"transparent",color:"primary.inverted"},Plain:{backgroundColor:"transparent",color:"neutral.foreground"}},cd={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},wn=pd(Co)(()=>({whiteSpace:"nowrap"}),dd(bn({scale:"components.Button",variants:"components.Button"}),bn({prop:"size",variants:cd})));import md from"styled-components";import{variant as ud,system as fd}from"styled-system";var Go={Display1:{fontSize:"5xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"4xl"},Display2:{fontSize:"4xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"3xl"},H1:{fontSize:"3xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"2xl"},H2:{fontSize:"2xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"xl"},H3:{fontSize:"xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"lg"},H4:{fontSize:"lg",fontWeight:"bold",letterSpacing:"md",lineHeight:"md"},Body1:{fontSize:"md",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Body2:{fontSize:"sm",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Caption:{fontSize:"xs",fontWeight:"regular",letterSpacing:"md",lineHeight:"sm"}};var Tn=md(Co)(ud({scale:"components.Text",variants:"components.Text"}),fd({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Fn=4,kn="px",gd=20,xd=Object.fromEntries(Array.from(Array(gd+1),(e,t)=>t===0?[.5,`${.5*Fn}${kn}`]:[t,`${t*Fn}${kn}`])),Kt={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:_(T({},Kt),{neutral:{foreground:Kt.gray300},primary:{background:Kt.blue500,foreground:Kt.white,inverted:Kt.blue500},negative:{foreground:Kt.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:yo,Text:Go}};var Pn="https://api.frigade.com",Q=hd({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 Sd(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var bd=({publicApiKey:e,userId:t,organizationId:o,config:n,children:i})=>{var K,se,de,be,V;let[r,s]=je(t||null),[p,d]=je(o||null),[l,m]=je([]),[c,g]=je([]),[y,F]=je([]),[S,x]=je({}),[v,b]=je({}),[E,A]=je([]),[O,h]=je({}),[w,f]=je(!1),[P,N]=je(!1),[L,I]=je(!j(e)),q=(Y,ee)=>{if(ee==="_blank"){window.open(Y,"_blank");return}setTimeout(()=>{window.location.href=Y},50)},M={theme:T(T({},it.theme),(se=(K=n==null?void 0:n.defaultAppearance)==null?void 0:K.theme)!=null?se:{}),styleOverrides:T(T({},it.styleOverrides),(be=(de=n==null?void 0:n.defaultAppearance)==null?void 0:de.styleOverrides)!=null?be:{})};function j(Y){return!!(Y&&Y.length>10&&Y.substring(0,10)==="api_public")}Ko(()=>{t&&s(t)},[t]),Ko(()=>{r&&window&&window.localStorage&&window.localStorage.getItem(ho)&&window.localStorage.getItem(ho)!==r&&Sd()},[r]),Ko(()=>{o&&d(o)},[o]),Ko(()=>{if(j(e))I(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),I(!0);return}},[e,I]);let le={publicApiKey:e,userId:r,setUserId:s,setFlows:m,flows:l,failedFlowResponses:c,setFailedFlowResponses:g,flowResponses:y,setFlowResponses:F,userProperties:S,setUserProperties:x,openFlowStates:v,setOpenFlowStates:b,completedFlowsToKeepOpenDuringSession:E,setCompletedFlowsToKeepOpenDuringSession:A,customVariables:O,setCustomVariables:h,isNewGuestUser:w,setIsNewGuestUser:f,hasActiveFullPageFlow:P,setHasActiveFullPageFlow:N,organizationId:p,setOrganizationId:d,navigate:n&&n.navigate?n.navigate:q,defaultAppearance:M,shouldGracefullyDegrade:L,setShouldGracefullyDegrade:I,apiUrl:n&&n.apiUrl?n.apiUrl:Pn,readonly:n&&n.readonly?n.readonly:!1,debug:n&&n.debug?n.debug:!1};if(L)return vt.createElement(Q.Provider,{value:le},i);let{overrides:pe}=yn(M);return vt.createElement(yd,{fallback:vt.createElement(vt.Fragment,null,i)},vt.createElement(Q.Provider,{value:le},vt.createElement(Cd,{theme:Ce(M.theme,Ar,pe!=null?pe:{},(V=n==null?void 0:n.theme)!=null?V:{})},i,vt.createElement(hn,null))))};import pc from"react";import ye,{useEffect as ol,useState as rl}from"react";import Ye,{useState as Wd}from"react";import At from"styled-components";import Xo from"react";import Bt from"react";import Bn from"styled-components";var vn=Bn.span`
|
|
680
|
+
`;var dn=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let n=e.props,[r,l]=vr([]),[p,d]=vr(!1),[s,m]=vr(e.id);return Pr(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),Pr(()=>{s!==e.id&&(m(e.id),l([]))},[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,g)=>{let y=r.includes(c.id);return st.createElement(sn,{key:`select-item-${g}`,onClick:()=>{if(r.includes(c.id)){l(r.filter(T=>T!==c.id));return}r.length<n.maxChoices?l([...r,c.id]):r.length==1&&n.maxChoices==1&&l([c.id])},hideBottomBorder:g===n.options.length-1,className:a("selectListSelectItem",i)},st.createElement(ln,{className:a("selectListItemImage",i)},c.imageUri&&st.createElement(an,{src:c.imageUri,alt:`select-icon-${g}`}),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 fo}from"react";var _p=({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:l,flowId:p,type:d,hideOnFlowCompletion:s,onComplete:m,setVisible:c,setShowModal:g,onDismiss:y,showPagination:T=!1,customFormElements:S,allowBackNavigation:x,validationHandler:B,onFormDataChange:v,showFooter:F,prefillData:A,updateUrlOnPageChange:O})=>{var U;let b=w(w({},{linkCollection:Ri,multiInput:_i,callToAction:en,selectList:dn}),i),{primaryCTAClickSideEffects:u,secondaryCTAClickSideEffects:P}=ae(),[N,L]=fo(!1),[I,q]=fo({}),[D,j]=fo(!1),[le,pe]=fo(!1),[K,se]=fo(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(()=>{v&&v(I,Le(),t[o],o)},[I]);function Le(){var W;return{data:(W=I[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 l&&l($,J,fe,I,Le()),r?r($,o,W,fe):!0}function ue($,W){q(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&&!D,formType:d,selectedStep:o,appearance:e,onPrimaryClick:()=>M(void 0,null,function*(){if(j(!0),B){let J=yield B(t[o],o,t[o+1],I,Le());if(J!==!0){se(typeof J=="string"?J:null),j(!1);return}else se(null)}let $=w({},Le());yield be(p,t[o].id,$),o+1<t.length&&!x&&(yield V(p,t[o+1].id));let W=X(t[o],"primary",o);if(o+1>=t.length&&(m&&m(),y&&y(),s&&W&&(c&&c(!1),g(!1)),yield Ve(p)),u(t[o]),j(!1),x&&o+1<t.length&&(window.location.hash=t[o+1].id),window&&!x&&O&&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),P(t[o])},onBack:()=>M(void 0,null,function*(){o-1>=0&&(j(!0),x&&(window.location.hash=t[o-1].id),yield V(p,t[o-1].id),j(!1))}),steps:t,allowBackNavigation:x,errorMessage:K,isSaving:D});return Ue.createElement(Ue.Fragment,null,Ue.createElement(Gi,{className:a("formContainer",e)},Ue.createElement(_p,{id:o,shouldWrap:d==="large-modal"},Ue.createElement(Ki,{key:de.id,type:d,className:a("formContent",e)},t.map($=>{let W=b[$.type];return de.id!==$.id?null: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 go from"react";import{createGlobalStyle as Hp}from"styled-components";var jp=Hp`
|
|
681
|
+
${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map(([i,n])=>typeof n=="object"?`${i} { ${Object.entries(n).map(([l,p])=>`${Bo(l)}: ${p};`).join(" ")} }`:`${Bo(i)}: ${n};`).join(" ")} }`).join(" ")}`;function ie({appearance:e}){if(!e||!e.styleOverrides)return go.createElement(go.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([o,i])=>typeof i=="object");return t.length===0?go.createElement(go.Fragment,null):go.createElement(jp,{inlineStyles:t})}var fn=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:n,customVariables:r,customFormElements:l,onComplete:p,appearance:d,hideOnFlowCompletion:s=!0,onStepCompletion:m,onButtonClick:c,dismissible:g=!0,endFlowOnDismiss:y=!1,modalPosition:T="center",repeatable:S=!1,onDismiss:x,showPagination:B=!1,allowBackNavigation:v=!1,validationHandler:F,showFrigadeBranding:A=!1,onFormDataChange:O,showFooter:h=!0,prefillData:b={},updateUrlOnPageChange:u=!1})=>{var $;let{getFlow:P,getFlowSteps:N,isLoading:L,targetingLogicShouldHideFlow:I,getFlowStatus:q,getCurrentStepIndex:D,markFlowCompleted:j,markFlowNotStarted:le,markStepStarted:pe}=R(),K=D(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),(q(e)===Z&&S||q(e)===Me)&&(q(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=P(e);if(!we||I(we)||!X||i!==void 0&&i===!1||q(e)===Z&&s||(o=="modal"||o=="corner-modal")&&Le(e))return null;let U=()=>{Oe(!1),x&&x(),y===!0&&j(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:g,showFrigadeBranding:A},et.createElement(ie,{appearance:d}),et.createElement(jo,{appearance:d,steps:X,selectedStep:K,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:s,onComplete:p,setVisible:n,setShowModal:Oe,onDismiss:x,showPagination:B,customFormElements:l,allowBackNavigation:v,validationHandler:F,onFormDataChange:O,showFooter:h,prefillData:b,updateUrlOnPageChange:u}))}return o==="modal"&&T!=="center"?et.createElement(No,{appearance:d,onClose:U,visible:ue,modalPosition:T},et.createElement(ie,{appearance:d}),et.createElement(jo,{appearance:d,steps:X,selectedStep:K,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:s,onComplete:p,setVisible:n,setShowModal:Oe,onDismiss:x,showPagination:B,customFormElements:l,allowBackNavigation:v,validationHandler:F,onFormDataChange:O,showFooter:h,prefillData:b,updateUrlOnPageChange:u})):et.createElement(et.Fragment,null,et.createElement(ie,{appearance:d}),et.createElement(jo,{appearance:d,steps:X,selectedStep:K,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:s,onComplete:p,setVisible:n,setShowModal:Oe,onDismiss:x,showPagination:B,customFormElements:l,allowBackNavigation:v,validationHandler:F,onFormDataChange:O,showFooter:h,prefillData:b,updateUrlOnPageChange:u}))},gn=fn;import{useCallback as Br,useContext as Vp,useEffect as Gp}from"react";function Er(){let{organizationId:e,userId:t,setOrganizationId:o}=Vp(Q),{mutateUserFlowState:i}=De(),{config:n,apiUrl:r}=Je(),l=Ut(),{verifySDKInitiated:p}=Wt();function d(g,y){return`frigade-user-group-registered-${g}-${y}`}Gp(()=>{if(t&&e){if(t.startsWith(zt))return;let g=d(t,e);localStorage.getItem(g)||(l(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})})),localStorage.setItem(g,"true"))}},[t,e]);let s=Br(g=>M(this,null,function*(){if(!p())return;if(!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationIdInternal:e,userId:t});return}let y={foreignUserId:t,foreignUserGroupId:e,properties:g};yield l(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(y)})),i()}),[e,t,n,i]),m=Br((g,y)=>M(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:g,properties:y}]};yield l(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(S)})),i()}),[e,t,n,i]),c=Br((g,y)=>M(this,null,function*(){if(p())if(y){let T=d(t,g);localStorage.setItem(T,"true"),o(g);let S={foreignUserId:t,foreignUserGroupId:g,properties:y};yield l(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(S)})),i()}else o(g)}),[t,n,i]);return{organizationId:e,setOrganizationId:o,setOrganizationIdWithProperties:c,addPropertiesToOrganization:s,trackEventForOrganization:m}}var xn="frigade-xFrigade_guestUserId",ho="frigade-xFrigade_userId",hn=({})=>{let{setFlowResponses:e}=no(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=De(),{userId:n,setUserId:r}=so(),[l,p]=Vo(n),{getFlowStatus:d}=R(),{flows:s,userProperties:m,setIsNewGuestUser:c,flowResponses:g}=Kp(Q),[y,T]=Vo([]),[S,x]=Vo([]),{organizationId:B}=Er(),[v,F]=Vo(B);xo(()=>{if(!o&&t)for(let b=0;b<t.length;b++){let u=t[b],P=s.find(N=>N.slug===(u==null?void 0:u.flowId));if(P&&u&&u.shouldTrigger===!0&&P.type=="FORM"&&P.triggerType==="AUTOMATIC"&&!S.includes(P.slug)){setTimeout(()=>{A(u.flowId)},500);break}}},[o,t]),xo(()=>{g.length>0&&i()},[g]);function A(b){let u=s.find(P=>P.slug===b);u&&u.triggerType==="AUTOMATIC"&&!S.includes(u.slug)&&(x([...S,u.slug]),T([u]))}function O(){if(!n){let b=localStorage.getItem(ho);if(b){r(b);return}let u=localStorage.getItem(xn);if(u){r(u);return}c(!0);let P=zt+qp();try{localStorage.setItem(xn,P)}catch(N){console.log("Failed to save guest user id locally: Local storage unavailable",N)}r(N=>N||P)}}xo(()=>{try{if(s){let b=[];s.forEach(u=>{if(u.data){let P=u.data.match(/"imageUri":"(.*?)"/g);P&&P.forEach(N=>{let L=N.replace('"imageUri":"',"").replace('"',"");if(b.includes(L))return;let I=new Image;I.src=L,b.push(L)})}})}}catch(b){}},[s]),xo(()=>{if(n!==l&&(e([]),i()),p(n),n&&!n.startsWith(zt))try{localStorage.setItem(ho,n)}catch(b){console.log("Failed to save user id locally: Local storage available",b)}n===null&&setTimeout(()=>{n===null&&O()},50)},[n,s,m]),xo(()=>{B!=v&&(F(B),e([]),i())},[B,v,F]);function h(){return Pt.createElement(Pt.Fragment,null,y.map(b=>d(b.slug)!==Me?null:Pt.createElement("span",{key:b.slug},Pt.createElement(gn,{flowId:b.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return Pt.createElement(Pt.Fragment,null,Pt.createElement(h,null))};import{ErrorBoundary as yd}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 Yp(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((l,p)=>{r[l]||(r[l]=p===n.length-1?i:{}),r=r[l]})}}),t}function Xp(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=Yp(t),n=Xp(o);return{overrides:i,css:n}}import pd from"styled-components";import{compose as dd,variant as bn}from"styled-system";import Sn from"react";import Jp,{ThemeProvider as Qp,useTheme as Zp}from"styled-components";import{border as Rp,color as ed,compose as td,get as od,shadow as rd,space as id,system as nd,typography as sd}from"styled-system";var ld={width:{property:"width",scale:"sizes",transform:(e,t)=>od(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},ad=Jp("div")(({css:e})=>e,td(Rp,ed,rd,id,sd,nd(ld))),Co=n=>{var r=n,{as:e,children:t,overrides:o}=r,i=Ie(r,["as","children","overrides"]);let l=Zp(),p={border:"none",boxSizing:"border-box",m:0,p:0},d=()=>Sn.createElement(ad,w(w({as:e},p),i),t);if(o!==void 0){let s=Ce(l,o);return Sn.createElement(Qp,{theme:s},d())}return d()};var yo={Primary:{backgroundColor:"primary.background",color:"primary.foreground","&:hover":{backgroundColor:"blue400"}},Secondary:{backgroundColor:"white",border:"1px solid",borderColor:"gray800",color:"neutral.foreground","&:hover":{backgroundColor:"blue900"}},Link:{backgroundColor:"transparent",color:"primary.inverted"},Plain:{backgroundColor:"transparent",color:"neutral.foreground"}},cd={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},wn=pd(Co)(()=>({whiteSpace:"nowrap"}),dd(bn({scale:"components.Button",variants:"components.Button"}),bn({prop:"size",variants:cd})));import md from"styled-components";import{variant as ud,system as fd}from"styled-system";var Go={Display1:{fontSize:"5xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"4xl"},Display2:{fontSize:"4xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"3xl"},H1:{fontSize:"3xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"2xl"},H2:{fontSize:"2xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"xl"},H3:{fontSize:"xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"lg"},H4:{fontSize:"lg",fontWeight:"bold",letterSpacing:"md",lineHeight:"md"},Body1:{fontSize:"md",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Body2:{fontSize:"sm",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Caption:{fontSize:"xs",fontWeight:"regular",letterSpacing:"md",lineHeight:"sm"}};var Tn=md(Co)(ud({scale:"components.Text",variants:"components.Text"}),fd({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Fn=4,kn="px",gd=20,xd=Object.fromEntries(Array.from(Array(gd+1),(e,t)=>t===0?[.5,`${.5*Fn}${kn}`]:[t,`${t*Fn}${kn}`])),Kt={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({},Kt),{neutral:{foreground:Kt.gray300},primary:{background:Kt.blue500,foreground:Kt.white,inverted:Kt.blue500},negative:{foreground:Kt.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:yo,Text:Go}};var Pn="https://api.frigade.com",Q=hd({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 Sd(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var bd=({publicApiKey:e,userId:t,organizationId:o,config:i,children:n})=>{var K,se,de,be,V;let[r,l]=je(t||null),[p,d]=je(o||null),[s,m]=je([]),[c,g]=je([]),[y,T]=je([]),[S,x]=je({}),[B,v]=je({}),[F,A]=je([]),[O,h]=je({}),[b,u]=je(!1),[P,N]=je(!1),[L,I]=je(!j(e)),q=(Y,ee)=>{if(ee==="_blank"){window.open(Y,"_blank");return}setTimeout(()=>{window.location.href=Y},50)},D={theme:w(w({},it.theme),(se=(K=i==null?void 0:i.defaultAppearance)==null?void 0:K.theme)!=null?se:{}),styleOverrides:w(w({},it.styleOverrides),(be=(de=i==null?void 0:i.defaultAppearance)==null?void 0:de.styleOverrides)!=null?be:{})};function j(Y){return!!(Y&&Y.length>10&&Y.substring(0,10)==="api_public")}Ko(()=>{t&&l(t)},[t]),Ko(()=>{r&&window&&window.localStorage&&window.localStorage.getItem(ho)&&window.localStorage.getItem(ho)!==r&&Sd()},[r]),Ko(()=>{o&&d(o)},[o]),Ko(()=>{if(j(e))I(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),I(!0);return}},[e,I]);let le={publicApiKey:e,userId:r,setUserId:l,setFlows:m,flows:s,failedFlowResponses:c,setFailedFlowResponses:g,flowResponses:y,setFlowResponses:T,userProperties:S,setUserProperties:x,openFlowStates:B,setOpenFlowStates:v,completedFlowsToKeepOpenDuringSession:F,setCompletedFlowsToKeepOpenDuringSession:A,customVariables:O,setCustomVariables:h,isNewGuestUser:b,setIsNewGuestUser:u,hasActiveFullPageFlow:P,setHasActiveFullPageFlow:N,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:q,defaultAppearance:D,shouldGracefullyDegrade:L,setShouldGracefullyDegrade:I,apiUrl:i&&i.apiUrl?i.apiUrl:Pn,readonly:i&&i.readonly?i.readonly:!1,debug:i&&i.debug?i.debug:!1};if(L)return vt.createElement(Q.Provider,{value:le},n);let{overrides:pe}=yn(D);return vt.createElement(yd,{fallback:vt.createElement(vt.Fragment,null,n)},vt.createElement(Q.Provider,{value:le},vt.createElement(Cd,{theme:Ce(D.theme,Ar,pe!=null?pe:{},(V=i==null?void 0:i.theme)!=null?V:{})},n,vt.createElement(hn,null))))};import pc from"react";import ye,{useEffect as ol,useState as rl}from"react";import Ye,{useState as Wd}from"react";import At from"styled-components";import Xo from"react";import Bt from"react";import Bn from"styled-components";var vn=Bn.span`
|
|
682
682
|
font-weight: 600;
|
|
683
683
|
font-size: 14px;
|
|
684
684
|
font-style: normal;
|
|
@@ -699,7 +699,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
699
699
|
padding-right: 8px;
|
|
700
700
|
width: 100%;
|
|
701
701
|
${e=>ke(e)}
|
|
702
|
-
`,qo=({label:e,value:t,labelStyle:o={},labelPosition:
|
|
702
|
+
`,qo=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:n,primaryColor:r="#000000",checkBoxType:l="round",appearance:p})=>Bt.createElement(Bt.Fragment,null,Bt.createElement(wd,{className:a("checklistStepsContainer",p),appearance:p,styleOverrides:w({},n)},i==="left"&&e&&Bt.createElement(vn,{className:a("checklistStepLabel",p),styleOverrides:o,appearnace:p},e),Bt.createElement(nt,{appearance:p,value:t,type:l,primaryColor:r}),i==="right"&&e&&Bt.createElement(vn,{className:a("checklistStepLabel",p),styleOverrides:o,appearance:p},e)),Bt.createElement(ie,{appearance:p}));import So from"styled-components";var En=So.div`
|
|
703
703
|
font-weight: 700;
|
|
704
704
|
font-size: 18px;
|
|
705
705
|
line-height: 22px;
|
|
@@ -732,7 +732,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
732
732
|
justify-content: flex-start;
|
|
733
733
|
border-bottom: 1px solid ${e=>e.theme.colorBorder};
|
|
734
734
|
padding-right: 16px;
|
|
735
|
-
`;var Nn=({data:e,index:t,isSelected:o,primaryColor:
|
|
735
|
+
`;var Nn=({data:e,index:t,isSelected:o,primaryColor:i,style:n,onClick:r,appearance:l})=>{var p,d,s,m,c;return Xo.createElement("div",{style:{position:"relative",paddingLeft:"0px"},onClick:()=>{r()}},o&&Xo.createElement(Yo,{className:a("checklistStepItemSelectedIndicator",l),layoutId:"checklis-step-selected",style:{backgroundColor:(d=(p=l==null?void 0:l.theme)==null?void 0:p.colorPrimary)!=null?d:i}}),Xo.createElement(In,{className:a("checklistStepItem",l),key:`hero-checklist-step-${t}`,appearance:l,role:"listitem"},Xo.createElement(qo,{value:e.complete,labelPosition:"left",label:(s=e.stepName)!=null?s:e.title,style:n,primaryColor:(c=(m=l==null?void 0:l.theme)==null?void 0:m.colorPrimary)!=null?c:i,appearance:l})))};import Et from"react";import Or from"styled-components";import lt from"styled-components";var oC=lt.div`
|
|
736
736
|
background: #ffffff;
|
|
737
737
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
738
738
|
border-radius: 20px;
|
|
@@ -766,7 +766,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
766
766
|
width: ${e=>e.fgWidth};
|
|
767
767
|
border-radius: 20px;
|
|
768
768
|
background-color: ${e=>e.theme.colorPrimary};
|
|
769
|
-
|
|
769
|
+
`,$n=lt.div`
|
|
770
770
|
position: relative;
|
|
771
771
|
left: 0;
|
|
772
772
|
top: 0;
|
|
@@ -795,11 +795,11 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
795
795
|
padding-right: ${e=>e.padding};
|
|
796
796
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
797
797
|
${e=>ke(e)}
|
|
798
|
-
`;var We=({count:e,total:t,display:o="count",textLocation:
|
|
798
|
+
`;var We=({count:e,total:t,display:o="count",textLocation:i="left",style:n={},textStyle:r={},appearance:l})=>{var g;if(t===0)return Et.createElement(Et.Fragment,null);Object.keys(r).length===0&&r.constructor===Object&&(r={color:(g=l==null?void 0:l.theme)==null?void 0:g.colorText});let p=e===0?"10px":`${e/t*100}%`,d=o==="compact"?"8px":"10px",s=Math.round(e/t*100),m=o==="compact"?"5px":"14px",c;return o==="count"||o==="compact"?c=`${e}/${t}`:o==="percent"&&(c=`${s}% complete`),i==="top"&&(m="0px"),Et.createElement(Td,{className:a("progressBarContainer",l),textLocation:i,styleOverrides:n},Et.createElement(kd,{className:a("progressBarStepText",l),styleOverrides:_(w({},r),{fontSize:o==="compact"?12:14,fontWeight:600}),appearance:l,padding:m,textLocation:i},c),Et.createElement(Fd,{textLocation:i,className:a("progressBar",l)},Et.createElement(Ln,{style:{zIndex:o=="compact"?1:5},fgWidth:p,barHeight:d,appearance:l,className:a("progressBarFill",l)}),Et.createElement($n,{className:a("progressBarBackground",l),barHeight:d,appearance:l})))};import bo from"react";import vd from"styled-components";import Qo from"react";import Jo from"react";var qt=({stepData:e,appearance:t})=>Jo.createElement(Jo.Fragment,null,Jo.createElement(An,{appearance:t,className:a("checklistStepTitle",t),dangerouslySetInnerHTML:ce(e.title)}),Jo.createElement(On,{appearance:t,className:a("checklistStepSubtitle",t),dangerouslySetInnerHTML:ce(e.subtitle)}));import Ir from"react";var Yt=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return Ir.createElement(Wo,{className:a("ctaContainer",t)},Ir.createElement(oe,{appearance:t,title:e.primaryButtonTitle,onClick:o}),e.secondaryButtonTitle&&Ir.createElement(oe,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}))};var Xt=({stepData:e,appearance:t})=>Qo.createElement(Qo.Fragment,null,Qo.createElement(qt,{stepData:e,appearance:t}),Qo.createElement(Yt,{stepData:e,appearance:t}));import Pd from"react";function Mn(e){return Pd.createElement(Re,{appearance:e.appearance,videoUri:e.videoUri})}var Nr="default",Bd=vd.img`
|
|
799
799
|
border-radius: 4px;
|
|
800
800
|
max-height: 260px;
|
|
801
801
|
min-height: 200px;
|
|
802
|
-
`,
|
|
802
|
+
`,Dn=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return bo.createElement("div",null,o)}return bo.createElement(En,{className:a("checklistStepContent",t)},e.imageUri?bo.createElement(Bd,{className:a("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?bo.createElement(Mn,{videoUri:e.videoUri,appearance:t}):null,bo.createElement(Xt,{stepData:e,appearance:t}))};import ze,{useRef as Ed,useState as Ad}from"react";import Jt from"styled-components";var Un=Jt.div`
|
|
803
803
|
display: block;
|
|
804
804
|
`,Od=Jt.div`
|
|
805
805
|
display: flex;
|
|
@@ -824,7 +824,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
824
824
|
font-size: 14px;
|
|
825
825
|
line-height: 20px;
|
|
826
826
|
text-align: center;
|
|
827
|
-
|
|
827
|
+
`,$d=Jt.div`
|
|
828
828
|
position: absolute;
|
|
829
829
|
width: 200px;
|
|
830
830
|
height: 120px;
|
|
@@ -844,9 +844,9 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
844
844
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
845
845
|
border-radius: 50%;
|
|
846
846
|
}
|
|
847
|
-
`,Wn="videoCarousel",zn=({stepData:e,appearance:t})=>{var
|
|
847
|
+
`,Wn="videoCarousel",zn=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.videos))return ze.createElement(Un,null,ze.createElement(Xt,{stepData:e,appearance:t}));function o({video:r}){let l=Ed(),[p,d]=Ad(!1);return ze.createElement(Id,null,!p&&ze.createElement($d,{onClick:()=>{d(!0),l.current.play()},appearance:t},ze.createElement(zo,null)),ze.createElement(Nd,{controls:p,ref:l,play:p,src:r.uri}),ze.createElement(Ld,null,r.title))}let i=e.props;return i.videos?ze.createElement(Un,null,ze.createElement(qt,{stepData:e,appearance:t}),ze.createElement(Od,null,i.videos.map((r,l)=>ze.createElement("span",{key:`${r.uri}-${l}`},ze.createElement(o,{video:r})))),ze.createElement(Yt,{stepData:e,appearance:t})):null};import at from"react";import Zo from"styled-components";var _n=Zo.div`
|
|
848
848
|
display: block;
|
|
849
|
-
|
|
849
|
+
`,Md=Zo.pre`
|
|
850
850
|
display: block;
|
|
851
851
|
background-color: #2a2a2a;
|
|
852
852
|
color: #f8f8f8;
|
|
@@ -862,14 +862,14 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
862
862
|
white-space: -o-pre-wrap; /* Opera 7 */
|
|
863
863
|
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
|
864
864
|
margin-bottom: 24px;
|
|
865
|
-
`,
|
|
865
|
+
`,Dd=Zo.div`
|
|
866
866
|
font-size: 15px;
|
|
867
867
|
line-height: 20px;
|
|
868
868
|
margin-bottom: 12px;
|
|
869
869
|
margin-top: 12px;
|
|
870
870
|
`,Ud=Zo.div`
|
|
871
871
|
margin-top: 24px;
|
|
872
|
-
`,Hn="codeSnippet",jn=({stepData:e,appearance:t})=>{var
|
|
872
|
+
`,Hn="codeSnippet",jn=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return at.createElement(_n,null,at.createElement(Xt,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?at.createElement(_n,null,at.createElement(qt,{stepData:e,appearance:t}),at.createElement(Ud,null,o.codeSnippets.map((n,r)=>at.createElement("div",{key:r},n.title?at.createElement(Dd,null,n.title):null,n.code?at.createElement(Md,null,n.code):null))),at.createElement(Yt,{stepData:e,appearance:t})):null};var zd=At.div`
|
|
873
873
|
display: flex;
|
|
874
874
|
flex-direction: row;
|
|
875
875
|
overflow: hidden;
|
|
@@ -905,9 +905,9 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
905
905
|
`,Gd=At.div`
|
|
906
906
|
flex: 2;
|
|
907
907
|
padding: 2rem 2rem 2rem 0rem;
|
|
908
|
-
`,Kd=({title:e,subtitle:t,steps:o=[],style:
|
|
908
|
+
`,Kd=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:n,setSelectedStep:r,className:l="",customStepTypes:p=new Map,appearance:d,type:s})=>{let{mergeAppearanceWithDefault:m}=te();d=m(d);let c={[Nr]:Dn,[Wn]:zn,[Hn]:jn},g=w(w({},c),p),[y,T]=Wd(0),S=n!=null?n:y,x=r!=null?r:T,B=o.filter(F=>F.complete===!0).length,v=()=>{var F;return!((F=o[S])!=null&&F.type)||!g[o[S].type]?g[Nr]({stepData:o[S],appearance:d}):g[o[S].type]({stepData:o[S],appearance:d})};return Ye.createElement(zd,{type:s,styleOverrides:i,className:l,appearance:d},Ye.createElement(Vn,{style:{flex:1}},Ye.createElement(Vn,{style:{padding:"28px 0px 28px 28px",borderBottom:"1px solid #E5E5E5"}},Ye.createElement(_d,{className:a("checklistTitle",d),appearance:d},e),Ye.createElement(Hd,{className:a("checklistSubtitle",d),appearance:d},t),Ye.createElement(We,{total:o.length,count:B,style:{marginTop:"24px",paddingRight:"40px"},appearance:d})),Ye.createElement(jd,{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:()=>{x(A)},appearance:d})))),Ye.createElement(Vd,{appearance:d,className:a("checklistDivider",d)}),Ye.createElement(Gd,null,Ye.createElement(v,null)))},Lr=Kd;import H,{useState as Qd}from"react";import Gn from"react";import qd from"styled-components";var Yd=qd.svg`
|
|
909
909
|
transition: 'transform 0.35s ease-in-out';
|
|
910
|
-
`,Qt=({style:e,className:t})=>Gn.createElement(Yd,{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
|
|
910
|
+
`,Qt=({style:e,className:t})=>Gn.createElement(Yd,{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`
|
|
911
911
|
max-height: 350px;
|
|
912
912
|
padding-bottom: 40px;
|
|
913
913
|
`,qn=Se.div`
|
|
@@ -929,7 +929,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
929
929
|
padding-left: 1px;
|
|
930
930
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
931
931
|
`,Jn=Se.div`
|
|
932
|
-
${e=>
|
|
932
|
+
${e=>E(e)} {
|
|
933
933
|
border: 1px solid #fafafa;
|
|
934
934
|
}
|
|
935
935
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
@@ -943,7 +943,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
943
943
|
flex-direction: row;
|
|
944
944
|
justify-content: space-between;
|
|
945
945
|
`,Zn=Se.p`
|
|
946
|
-
${e=>
|
|
946
|
+
${e=>E(e)} {
|
|
947
947
|
font-weight: 400;
|
|
948
948
|
font-size: 10px;
|
|
949
949
|
line-height: 12px;
|
|
@@ -957,7 +957,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
957
957
|
`,es=Se.div`
|
|
958
958
|
flex: 1;
|
|
959
959
|
`,ts=Se.div`
|
|
960
|
-
${e=>
|
|
960
|
+
${e=>E(e)} {
|
|
961
961
|
display: flex;
|
|
962
962
|
justify-content: center;
|
|
963
963
|
align-content: center;
|
|
@@ -967,7 +967,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
967
967
|
padding-right: 8px;
|
|
968
968
|
}
|
|
969
969
|
`,os=Se.p`
|
|
970
|
-
${e=>
|
|
970
|
+
${e=>E(e)} {
|
|
971
971
|
font-style: normal;
|
|
972
972
|
font-weight: 600;
|
|
973
973
|
font-size: 22px;
|
|
@@ -979,7 +979,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
979
979
|
margin-bottom: 16px;
|
|
980
980
|
}
|
|
981
981
|
`,rs=Se.p`
|
|
982
|
-
${e=>
|
|
982
|
+
${e=>E(e)} {
|
|
983
983
|
font-weight: 400;
|
|
984
984
|
font-size: 14px;
|
|
985
985
|
line-height: 18px;
|
|
@@ -988,14 +988,14 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
988
988
|
margin-bottom: 8px;
|
|
989
989
|
}
|
|
990
990
|
`,is=Se.div`
|
|
991
|
-
${e=>
|
|
991
|
+
${e=>E(e)} {
|
|
992
992
|
display: flex;
|
|
993
993
|
flex-direction: row;
|
|
994
994
|
justify-content: center;
|
|
995
995
|
gap: 8px;
|
|
996
996
|
}
|
|
997
997
|
`,ns=Se.div`
|
|
998
|
-
${e=>
|
|
998
|
+
${e=>E(e)} {
|
|
999
999
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1000
1000
|
background-color: ${e=>e.selected?"#FAFAFA":"#FFFFFF"};
|
|
1001
1001
|
:hover {
|
|
@@ -1015,7 +1015,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1015
1015
|
position: relative;
|
|
1016
1016
|
cursor: pointer;
|
|
1017
1017
|
`,ss=Se.p`
|
|
1018
|
-
${e=>
|
|
1018
|
+
${e=>E(e)} {
|
|
1019
1019
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1020
1020
|
color: ${e=>e.selected?"#434343":"#BFBFBF"};
|
|
1021
1021
|
}
|
|
@@ -1058,7 +1058,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1058
1058
|
overflow: hidden;
|
|
1059
1059
|
row-gap: 10px;
|
|
1060
1060
|
`,us=pt.div`
|
|
1061
|
-
${e=>
|
|
1061
|
+
${e=>E(e)} {
|
|
1062
1062
|
color: #595959;
|
|
1063
1063
|
}
|
|
1064
1064
|
text-transform: uppercase;
|
|
@@ -1068,7 +1068,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1068
1068
|
letter-spacing: 0.09em;
|
|
1069
1069
|
margin-bottom: 12px;
|
|
1070
1070
|
`,fs=pt.div`
|
|
1071
|
-
${e=>
|
|
1071
|
+
${e=>E(e)} {
|
|
1072
1072
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1073
1073
|
background: #ffffff;
|
|
1074
1074
|
border: 1px solid #fafafa;
|
|
@@ -1081,7 +1081,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1081
1081
|
max-width: 150px;
|
|
1082
1082
|
min-width: 200px;
|
|
1083
1083
|
`,gs=pt.div`
|
|
1084
|
-
${e=>
|
|
1084
|
+
${e=>E(e)} {
|
|
1085
1085
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
1086
1086
|
}
|
|
1087
1087
|
width: 40px;
|
|
@@ -1099,7 +1099,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1099
1099
|
width: 20px;
|
|
1100
1100
|
height: 20px;
|
|
1101
1101
|
`,hs=pt.div`
|
|
1102
|
-
${e=>
|
|
1102
|
+
${e=>E(e)} {
|
|
1103
1103
|
color: #434343;
|
|
1104
1104
|
}
|
|
1105
1105
|
font-weight: 600;
|
|
@@ -1108,7 +1108,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1108
1108
|
margin-top: 12px;
|
|
1109
1109
|
margin-bottom: 8px;
|
|
1110
1110
|
`,Cs=pt.div`
|
|
1111
|
-
${e=>
|
|
1111
|
+
${e=>E(e)} {
|
|
1112
1112
|
color: #8c8c8c;
|
|
1113
1113
|
}
|
|
1114
1114
|
font-weight: 400;
|
|
@@ -1120,7 +1120,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1120
1120
|
line-height: 14px;
|
|
1121
1121
|
font-weight: 400;
|
|
1122
1122
|
cursor: pointer;
|
|
1123
|
-
`;var Jd=({steps:e,style:t,title:o,primaryColor:
|
|
1123
|
+
`;var Jd=({steps:e,style:t,title:o,primaryColor:i,appearance:n,onButtonClick:r})=>{let{primaryCTAClickSideEffects:l}=ae();return dt.createElement(cs,{style:t,className:a("guideContainer",n)},dt.createElement(us,{className:a("guideTitle",n)},o),dt.createElement(ms,{className:a("guideItemContainer",n)},e.map((p,d)=>{var s;return dt.createElement(fs,{key:`guide-${(s=p.id)!=null?s:d}`,className:a("guideItem",n)},p.icon&&dt.createElement(gs,{className:a("guideIcon",n)},dt.createElement(xs,null,p.icon)),dt.createElement(hs,{className:a("guideItemTitle",n),dangerouslySetInnerHTML:ce(p.title)}),dt.createElement(Cs,{className:a("guideItemSubtitle",n),dangerouslySetInnerHTML:ce(p.subtitle)}),dt.createElement(ys,{className:a("guideItemLink",n),color:i,onClick:()=>{p.primaryButtonUri&&l(p),r&&r(p)}},p.primaryButtonTitle))})))},wo=Jd;var Zd=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:n,onClose:r,selectedStep:l,setSelectedStep:p,customStepTypes:d,appearance:s,guideData:m,guideTitle:c,onGuideButtonClick:g})=>{let y=({stepData:h,handleSecondaryCTAClick:b,handleCTAClick:u})=>h?H.createElement(ts,{className:a("checklistStepContainer",s),"data-testid":"checklistStepContainer"},H.createElement(os,{appearance:s,className:a("checklistStepTitle",s),dangerouslySetInnerHTML:ce(h.title)}),H.createElement(rs,{appearance:s,className:a("checklistStepSubtitle",s),dangerouslySetInnerHTML:ce(h.subtitle)}),H.createElement(is,{className:a("checklistCTAContainer",s)},h.secondaryButtonTitle&&H.createElement(oe,{title:h.secondaryButtonTitle,onClick:b,appearance:s,secondary:!0}),H.createElement(oe,{title:h.primaryButtonTitle,onClick:u,appearance:s}))):H.createElement(H.Fragment,null),S=w(w({},{default:h=>{var N;if((N=e[v])!=null&&N.StepContent){let L=e[v].StepContent;return H.createElement("div",null,L)}let b=e[v];return H.createElement(y,{stepData:h,handleCTAClick:()=>{b.handlePrimaryButtonClick&&b.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{b.handleSecondaryButtonClick&&b.handleSecondaryButtonClick()}})}}),d),[x,B]=Qd(0),v=l!=null?l:x,F=p!=null?p:B,A=()=>{var h;return e?!((h=e[v])!=null&&h.type)||!S[e[v].type]?S.default(e[v]):S[e[v].type]({stepData:e[v],primaryColor:s.theme.colorPrimary}):H.createElement(H.Fragment,null)},O=e.filter(h=>h.complete).length;return n?(s.theme.modalContainer||(s.theme.borderRadius&&($r.borderRadius=s.theme.borderRadius+"px"),s.theme.modalContainer=$r),H.createElement(Qe,{onClose:r,visible:n,appearance:s},H.createElement(ps,null,H.createElement(qn,null,H.createElement(Yn,{appearance:s,className:a("checklistTitle",s)},t),H.createElement(Xn,{appearance:s,className:a("checklistSubtitle",s)},o)),H.createElement(Kn,null,e&&e.length>0&&H.createElement(Jn,{className:a("stepsContainer",s)},H.createElement(Qn,null,H.createElement("div",{style:{flex:3}},H.createElement(Zn,{className:a("stepsTitle",s)},i)),H.createElement(as,null,H.createElement(We,{style:{width:"100%"},count:O,total:e.length,appearance:s}))),H.createElement(Rn,null,H.createElement(es,{className:a("checklistStepListContainer",s),appearance:s},e.map((h,b)=>{var P;let u=v===b;return H.createElement(ns,{selected:u,className:a(`checklistStepListItem${u?"Selected":""}`,s),key:`checklist-guide-step-${(P=h.id)!=null?P:b}`,disabled:h.blocked,onClick:()=>{h.blocked||F(b)},title:h.blocked?"Finish remaining steps to continue":void 0},u&&H.createElement(Yo,{className:a("checklistStepItemSelectedIndicator",s),layoutId:"checklist-step-selected",style:{backgroundColor:s.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),H.createElement(ss,{selected:u,className:a(`checklistStepListStepName${u?"Selected":""}`,s)},h.stepName),H.createElement(ls,null,H.createElement(nt,{value:h.complete,type:"round",primaryColor:s.theme.colorPrimary,progress:h.progress,appearance:s}),H.createElement(ds,null,H.createElement(Qt,{style:{marginLeft:"10px"},color:s.theme.colorBackgroundSecondary}))))})),H.createElement(A,null))),m&&m.length>0&&H.createElement(wo,{steps:m,title:c,primaryColor:s.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:s,onButtonClick:h=>(g&&g(h),!0)}))))):H.createElement(H.Fragment,null)},Mr=Zd;import Ne,{useEffect as Ls,useState as $s}from"react";import Fe from"react";import ct from"styled-components";var Ss=ct.div`
|
|
1124
1124
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1125
1125
|
border: 1px solid;
|
|
1126
1126
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1161,7 +1161,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1161
1161
|
:hover {
|
|
1162
1162
|
opacity: 0.8;
|
|
1163
1163
|
}
|
|
1164
|
-
`,
|
|
1164
|
+
`,iy=ct.div``,Ps=ct.p`
|
|
1165
1165
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1166
1166
|
font-weight: 400;
|
|
1167
1167
|
font-size: 14px;
|
|
@@ -1171,7 +1171,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1171
1171
|
flex-direction: row;
|
|
1172
1172
|
justify-content: flex-start;
|
|
1173
1173
|
align-items: center;
|
|
1174
|
-
`;var Bs=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:
|
|
1174
|
+
`;var Bs=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:n,appearance:r,customStepTypes:l})=>{var c,g;let p=t?{}:{transform:"rotate(90deg)"},d=t?{overflow:"hidden",maxHeight:"0px",transition:"max-height 0.2s ease-out"}:{overflow:"hidden",maxHeight:"1000px",transition:"max-height 0.15s ease-in"};function s(){var y;return Fe.createElement(Fe.Fragment,null,e.imageUri||e.videoUri?Fe.createElement(bs,{className:a("stepMediaContainer",r)},e.imageUri?Fe.createElement(ws,{className:a("stepImage",r),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Fe.createElement(Re,{appearance:r,videoUri:e.videoUri}):null):null,Fe.createElement(Ps,{className:a("stepSubtitle",r),appearance:r,dangerouslySetInnerHTML:ce(e.subtitle)}),Fe.createElement(Wo,{className:a("checklistCTAContainer",r)},e.secondaryButtonTitle?Fe.createElement(oe,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>n(),appearance:r}):null,Fe.createElement(oe,{title:(y=e.primaryButtonTitle)!=null?y:"Continue",onClick:()=>i(),appearance:r})))}function m(){if(!l)return null;let y=l[e.type];return y?y(e,r):null}return Fe.createElement(Ss,{"data-testid":`step-${e.id}`,className:a("checklistStepContainer",r),appearance:r},Fe.createElement(Ts,{className:a("stepHeader",r)},Fe.createElement(vs,null,Fe.createElement(qo,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(c=r==null?void 0:r.theme)==null?void 0:c.colorPrimary,appearance:r}),Fe.createElement(Fs,{appearance:r,className:a("stepTitle",r),dangerouslySetInnerHTML:ce(e.title),onClick:()=>o()})),Fe.createElement(ks,{className:a("stepChevronContainer",r),onClick:()=>o(),appearance:r},Fe.createElement(Qt,{style:_(w({},p),{transition:"transform 0.2s ease-in-out"})}))),Fe.createElement("div",{key:e.id,style:w({},d)},(g=m())!=null?g:s()))};import Zt from"styled-components";var Cy=Zt.div`
|
|
1175
1175
|
background: #ffffff;
|
|
1176
1176
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1177
1177
|
border-radius: 6px;
|
|
@@ -1212,9 +1212,9 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1212
1212
|
padding: 24px;
|
|
1213
1213
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
1214
1214
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1215
|
-
`;var Rd=({title:e,subtitle:t,steps:o,onClose:
|
|
1215
|
+
`;var Rd=({title:e,subtitle:t,steps:o,onClose:i,visible:n,autoExpandFirstIncompleteStep:r=!0,autoCollapse:l=!0,autoExpandNextStep:p=!0,selectedStep:d,setSelectedStep:s,appearance:m,type:c,className:g,customStepTypes:y,style:T})=>{let S=o.filter(b=>b.complete).length,[x,B]=$s(Array(o.length).fill(!0)),[v,F]=$s(!1);Ls(()=>{let b=[...x];if(r){for(let u=0;u<o.length;u++)if(!o[u].complete){b[u]=!1;break}B(b)}},[]),Ls(()=>{if(!v&&!r){F(!0);return}A(d)},[d]);let A=b=>{let u=[...x];if(l)for(let P=0;P<x.length;++P)P!==b&&(u[P]=!0);u[b]=!u[b],B(u)};if(!n&&c=="modal")return Ne.createElement(Ne.Fragment,null);let O=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})),h=Ne.createElement(Is,{className:Te(a("checklistContainer",m),g)},o.map((b,u)=>{var N;let P=x[u];return Ne.createElement(Bs,{appearance:m,stepData:b,collapsed:P,key:`modal-checklist-${(N=b.id)!=null?N:u}`,onClick:()=>{if(d===u){A(u);return}s(u)},onPrimaryButtonClick:()=>{b.handlePrimaryButtonClick&&b.handlePrimaryButtonClick(),p&&!b.completionCriteria&&u<x.length-1&&x[u+1]&&s(u+1)},onSecondaryButtonClick:()=>{b.handleSecondaryButtonClick&&b.handleSecondaryButtonClick()},customStepTypes:y})}));return c==="inline"?Ne.createElement(Ns,{appearance:m,className:Te(a("checklistInlineContainer",m),g),style:T},O,h):Ne.createElement(Ne.Fragment,null,Ne.createElement(Qe,{onClose:i,visible:n,appearance:m,style:{maxWidth:"600px"},headerContent:O},h))},Dr=Rd;import me,{useEffect as Ur,useRef as lc,useState as Ot}from"react";import{useEffect as ec,useState as tc}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]=tc(t),n=null,r=()=>{n!==null?clearTimeout(n):l(),n=setTimeout(()=>{l()},16)},l=()=>{let p=Object.fromEntries(Object.entries(e).map(([d,s])=>{if(!window)return[d,!1];let m=window.matchMedia(s);return m.addEventListener("change",r),[d,m.matches]}));i(p)};return ec(()=>{l()},[]),o};import Rt from"react";import ge,{css as Ds,keyframes as Us}from"styled-components";var Ws=Ds`
|
|
1216
1216
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1217
|
-
`,oc=
|
|
1217
|
+
`,oc=Ds`
|
|
1218
1218
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
1219
1219
|
`,rc=Us`
|
|
1220
1220
|
from {
|
|
@@ -1295,17 +1295,17 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1295
1295
|
margin-bottom: 12px;
|
|
1296
1296
|
width: 40px;
|
|
1297
1297
|
`,qs=ge(Vs)`
|
|
1298
|
-
${e=>
|
|
1298
|
+
${e=>E(e)} {
|
|
1299
1299
|
${oc}
|
|
1300
1300
|
|
|
1301
1301
|
background: ${({theme:e})=>e.colorBackground};
|
|
1302
1302
|
}
|
|
1303
|
-
|
|
1303
|
+
`,$y=ge.div`
|
|
1304
1304
|
color: ${({theme:e})=>e.colorPrimary};
|
|
1305
1305
|
display: flex;
|
|
1306
1306
|
flex-flow: row nowrap;
|
|
1307
1307
|
align-items: center;
|
|
1308
|
-
|
|
1308
|
+
`,My=ge.div`
|
|
1309
1309
|
white-space: nowrap;
|
|
1310
1310
|
`,Ys=ge.div`
|
|
1311
1311
|
background: #d8fed8;
|
|
@@ -1354,7 +1354,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1354
1354
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1355
1355
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1356
1356
|
`}
|
|
1357
|
-
`;var Rs=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:
|
|
1357
|
+
`;var Rs=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=te(),{primaryCTAClickSideEffects:n}=ae();o=i(o);let{imageUri:r=null,subtitle:l=null,title:p=null,complete:d=!1,blocked:s=!1}=e,m=e.primaryButtonTitle||e.secondaryButtonTitle,c=()=>{n(e)};return Rt.createElement(Gs,{className:a("carouselCard",o),onClick:s?null:c,style:t,blocked:s,complete:d},r&&Rt.createElement(Ks,{className:a("carouselCardImage",o),src:r,alt:p,style:{opacity:d||s?.4:1}}),d&&Rt.createElement(Ys,{className:a("carouselCompletedPill",o)},Rt.createElement(Zs,{style:{color:"#108E0B"}},"Complete")),p&&Rt.createElement(Qs,{blocked:s,complete:d,className:a("carouselCardTitle",o)},p),l&&Rt.createElement(Ct.Quiet,{blocked:s,complete:d,className:a("carouselCardSubtitle",o)},l))};var ac=()=>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]=Ot(!1),[r,l]=Ot(!1);Ur(()=>{t===!0&&i===!1?n(!0):t===!1&&i===!0&&l(!0)},[t]);let p=()=>{n(!1),l(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?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(ac,null))):null},tl=({flowId:e,appearance:t,customVariables:o,className:i})=>{let n=lc(null),[r,l]=Ot(!1),[p,d]=Ot(!1),[s,m]=Ot(null),[c,g]=Ot([]),[y,T]=Ot(0),{isSmall:S}=Ms(),x=S?1:3,{getFlowMetadata:B,getFlowSteps:v,getNumberOfStepsCompleted:F,updateCustomVariables:A,isLoading:O}=R();Ur(()=>{A(o)},[o,O]),Ur(()=>{if(O)return;let L=B(e),I=F(e),q=v(e);m(L),L.data!==null&&(g(q.sort((D,j)=>Number(D.complete)-Number(j.complete))),d(q.length>x),T(I))},[O]);let h=[];for(let L=0;L<c.length;L+=x)h.push(c.slice(L,L+x));let b=L=>{let I=L.target,q=I.scrollWidth-I.clientWidth,D=Math.ceil(I.scrollLeft);D>0&&r===!1&&l(!0),D===0&&r===!0&&l(!1),D<q&&p===!1&&d(!0),D===q&&p===!0&&d(!1)},u=(L=!0)=>{let I=L?1:-1;n.current!==null&&n.current.scrollBy({left:n.current.clientWidth*I,behavior:"smooth"})},P=null,N=L=>{P!==null?clearTimeout(P):b(L),P=setTimeout(()=>{b(L)},16)};return O?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)},s==null?void 0:s.title),me.createElement(Ct.Quiet,{className:a("carouselSubtitle",t)},s==null?void 0:s.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:()=>u(!1)}),me.createElement(el,{side:"right",show:p,onClick:u}),me.createElement(zs,{ref:n,onScroll:N},h.map((L,I)=>me.createElement(_s,{key:I,style:{flex:`0 0 calc(100% - ${c.length>x?36:0}px)`}},L.map((q,D)=>me.createElement(Rs,{key:D,stepData:q,style:{flex:c.length>x?`0 1 calc(100% / ${x} - 16px * 2 / ${x})`:1},appearance:t})))))),me.createElement(ie,{appearance:t}))};var Wr=A=>{var O=A,{flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:n,className:r,type:l="inline",onDismiss:p,visible:d,customVariables:s,onStepCompletion:m,onButtonClick:c,appearance:g,hideOnFlowCompletion:y,setVisible:T,customStepTypes:S,checklistStyle:x="default",autoExpandFirstIncompleteStep:B,autoExpandNextStep:v}=O,F=Ie(O,["flowId","title","subtitle","style","initialSelectedStep","className","type","onDismiss","visible","customVariables","onStepCompletion","onButtonClick","appearance","hideOnFlowCompletion","setVisible","customStepTypes","checklistStyle","autoExpandFirstIncompleteStep","autoExpandNextStep"]);let{getFlow:h,getFlowSteps:b,markStepCompleted:u,getStepStatus:P,getNumberOfStepsCompleted:N,isLoading:L,targetingLogicShouldHideFlow:I,updateCustomVariables:q,getFlowMetadata:D,isStepBlocked:j,getFlowStatus:le,hasActiveFullPageFlow:pe,setHasActiveFullPageFlow:K}=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=l==="modal",{mergeAppearanceWithDefault:Oe}=te();if(g=Oe(g),ol(()=>{q(s)},[s,L]),ol(()=>{d!==void 0&&(ue&&d===!0?K(!0):ue&&d===!1&&K(!1))},[d,T,pe]),L)return null;let we=h(e);if(!we||I(we))return null;let U=b(e);if(!U||y===!0&&le(e)===Z)return null;let $=D(e);if($!=null&&$.title&&(t=$.title),$!=null&&$.subtitle&&(o=$.subtitle),!Ve&&n===void 0&&N(e)>0){let f=U.findIndex(k=>k.complete===!1);ee(f>-1?f:U.length-1),Le(!0)}function W(){if(Y+1>=U.length){ue&&V(e,!1);return}j(e,U[Y+1].id)||ee(Y+1)}function J(f,k,z){let xe=Y+1<U.length?U[Y+1]:null;c&&c(f,Y,k,xe)===!0&&ue&&Xe(),m&&m(f,z,xe),!m&&!c&&(f.primaryButtonUri||f.secondaryButtonUri)&&ue&&Xe()}function fe(){return U.map((f,k)=>_(w({},f),{handleSecondaryButtonClick:()=>{W(),de(f),f.skippable===!0&&u(e,f.id,{skipped:!0}),J(f,"secondary",k)},handlePrimaryButtonClick:()=>{(!f.completionCriteria&&(f.autoMarkCompleted||f.autoMarkCompleted===void 0)||f.completionCriteria&&f.autoMarkCompleted===!0)&&(u(e,f.id),W()),J(f,"primary",k),se(f),P(e,f.id)===Ke&&W()}}))}function $e(){return ye.createElement(ie,{appearance:g})}let Ge={steps:fe(),title:t,subtitle:o,primaryColor:g.theme.colorPrimary,appearance:g,customStepTypes:S,type:l,className:r,autoExpandFirstIncompleteStep:B,autoExpandNextStep:v};function Xe(){V(e,!1),p&&p(),T&&T(!1)}function bt(){return ye.createElement(ye.Fragment,null,ye.createElement($e,null),ye.createElement(tl,{flowId:e,appearance:g,customVariables:s,className:r}))}function $t(){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:g},Ge)))}function Mt(){var z;let f=F.guideFlowId,k;return f&&h(f)&&(k=b(f)),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:g,title:t,subtitle:o,onGuideButtonClick:xe=>{J(xe,"link",0)},customStepTypes:S},Ge)))}function C(){let f=ye.createElement(Lr,w({flowId:e,style:i,selectedStep:Y,setSelectedStep:ee,appearance:g,type:l},Ge));return ue?ye.createElement(Qe,{onClose:()=>{Xe()},visible:X,appearance:g,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},ye.createElement($e,null),f):ye.createElement(ye.Fragment,null,ye.createElement($e,null),f)}switch(x){case"condensed":return $t();case"with-guide":return Mt();case"default":return C();case"carousel":return bt();default:return C()}};var dc=e=>pc.createElement(Wr,w({type:"inline"},e));import St,{useEffect as cc}from"react";import tt from"react";import Ro from"styled-components";var il=Ro.div`
|
|
1358
1358
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1359
1359
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1360
1360
|
padding: 10px 12px 10px 12px;
|
|
@@ -1386,7 +1386,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1386
1386
|
display: flex;
|
|
1387
1387
|
height: 100%;
|
|
1388
1388
|
align-items: center;
|
|
1389
|
-
`;var al=({title:e,count:t,total:o,onClick:
|
|
1389
|
+
`;var al=({title:e,count:t,total:o,onClick:i,style:n={},className:r,appearance:l,type:p="default"})=>tt.createElement(tt.Fragment,null,tt.createElement(ie,{appearance:l}),tt.createElement(il,{onClick:()=>i!==void 0&&i(),styleOverrides:w(w({},p=="condensed"?{display:"flex",justifyContent:"space-between"}:{}),n),className:Te(r!=null?r:"",a("progressBadgeContainer",l)),appearance:l},p=="condensed"&&o&&o!==0&&tt.createElement(ll,{className:a("progressRingContainer",l)},tt.createElement(Ht,{size:19,percentage:t/o,fillColor:l.theme.colorPrimary,bgColor:l.theme.colorBackgroundSecondary})),tt.createElement(nl,{type:p,className:a("badgeTitleContainer",l)},tt.createElement(sl,{type:p,appearance:l,className:a("badgeTitle",l)},e),i!==void 0&&tt.createElement(Qt,{className:a("badgeChevron",l),color:l.theme.colorPrimary})),p=="default"&&o&&o!==0&&tt.createElement(We,{display:"compact",count:t,total:o,bgColor:l.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:l,textStyle:{color:"#818898"}})));import yt from"react";import To from"styled-components";var pl=To.div`
|
|
1390
1390
|
display: flex;
|
|
1391
1391
|
flex-direction: row;
|
|
1392
1392
|
width: 100%;
|
|
@@ -1397,7 +1397,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1397
1397
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1398
1398
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1399
1399
|
`,dl=To.div`
|
|
1400
|
-
${e=>
|
|
1400
|
+
${e=>E(e)} {
|
|
1401
1401
|
display: flex;
|
|
1402
1402
|
justify-content: center;
|
|
1403
1403
|
align-items: center;
|
|
@@ -1414,7 +1414,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1414
1414
|
justify-content: center;
|
|
1415
1415
|
margin-left: 16px;
|
|
1416
1416
|
min-width: 200px;
|
|
1417
|
-
`,
|
|
1417
|
+
`,DS=To.div`
|
|
1418
1418
|
display: flex;
|
|
1419
1419
|
justify-content: center;
|
|
1420
1420
|
align-items: flex-end;
|
|
@@ -1423,7 +1423,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1423
1423
|
:hover {
|
|
1424
1424
|
opacity: 0.8;
|
|
1425
1425
|
}
|
|
1426
|
-
`;var ul=({title:e,subtitle:t,icon:o,appearance:
|
|
1426
|
+
`;var ul=({title:e,subtitle:t,icon:o,appearance:i,count:n,total:r,className:l,style:p})=>yt.createElement(yt.Fragment,null,yt.createElement(pl,{appearance:i,className:Te(a("fullWidthProgressBadgeContainer",i),l!=null?l:""),style:p},o&&yt.createElement(dl,{className:a("fullWidthProgressBadgeIcon",i)},o),yt.createElement(cl,null,yt.createElement(Ae,{size:"small",appearance:i,title:e,subtitle:t})),yt.createElement(ml,{className:a("fullWidthProgressBadgeProgressContainer",i)},yt.createElement(We,{count:n,total:r,display:"percent",textLocation:"top"}))));var mc=({flowId:e,title:t,subtitle:o,icon:i,style:n,onClick:r,className:l,customVariables:p,hideOnFlowCompletion:d,appearance:s,type:m="default"})=>{let{getFlow:c,getFlowSteps:g,getFlowStatus:y,getNumberOfStepsCompleted:T,isLoading:S,targetingLogicShouldHideFlow:x,updateCustomVariables:B}=R(),{mergeAppearanceWithDefault:v}=te();s=v(s);let{setOpenFlowState:F,getOpenFlowState:A}=Be();if(cc(()=>{B(p)},[p,S]),S)return null;let O=c(e);if(!O||x(O)||d===!0&&y(e)===Z)return null;let h=g(e),b=T(e);return m==="full-width"?St.createElement(St.Fragment,null,St.createElement(ie,{appearance:s}),St.createElement(ul,{title:t,subtitle:o,count:b,total:h.length,style:n,className:l,appearance:s,icon:i,onClick:()=>{}})):St.createElement(St.Fragment,null,St.createElement(ie,{appearance:s}),St.createElement(al,{count:b,total:h.length,title:t,style:n,onClick:()=>{F(e,!0),r&&r()},type:m,className:l,appearance:s}))};import uc from"react";var fc=n=>{var r=n,{flowId:e,style:t,appearance:o}=r,i=Ie(r,["flowId","style","appearance"]);let{getFlow:l,targetingLogicShouldHideFlow:p,getFlowSteps:d}=R(),{mergeAppearanceWithDefault:s}=te();o=s(o);let m=l(e);if(!m||p(m))return null;let c=d(e);return uc.createElement(wo,w({steps:c,style:t,appearance:o},i))};import It,{useContext as vc,useEffect as Bc}from"react";import G,{useEffect as er,useLayoutEffect as xl,useRef as Sc,useState as eo}from"react";import Fo from"styled-components";import{useCallback as gc,useEffect as xc,useState as hc}from"react";var zr=(e,t,o,i={x:20,y:20},n)=>{let r=n=="fixed"?0:window.scrollY,l=n=="fixed"?0:window.scrollX;return t==="left"?{x:e.left-o+i.x+l,y:e.top-i.y+r}:t==="right"?{x:e.left+e.width+i.x+l,y:e.top-i.y+r}:{x:0,y:0}};function 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]=hc(o),r=gc(()=>{e&&n(e.getBoundingClientRect())},[e]);return xc(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[e,t]),i}import{useContext as Cc,useState as yc}from"react";function gl(){let{debug:e}=Cc(Q),[t,o]=yc([]);function i(r){e&&(t.find(l=>l===r)||(o([...t,r]),console.log(r)))}function n(r){e&&(t.find(l=>l===r)||(o([...t,r]),console.warn(r)))}return{logIfDebugMode:i,logErrorIfDebugMode:n}}var hl=300,Cl=100,bc=500,to=12,wc=Fo.div`
|
|
1427
1427
|
width: 100%;
|
|
1428
1428
|
height: 100%;
|
|
1429
1429
|
border-radius: 9999px;
|
|
@@ -1464,8 +1464,8 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1464
1464
|
`,kc=Fo(yl)`
|
|
1465
1465
|
width: ${to+12}px;
|
|
1466
1466
|
height: ${to+12}px;
|
|
1467
|
-
`,Pc=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:
|
|
1468
|
-
${e=>
|
|
1467
|
+
`,Pc=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:n=!0,primaryColor:r="#000000",offset:l={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:s=0,customStepTypes:m,appearance:c,dismissible:g=!1,showHighlightOnly:y,showStepCount:T=!0,completedStepsCount:S=0,showFrigadeBranding:x=!1,cssPosition:B="absolute"})=>{var $e,Ge,Xe,bt,$t,Mt,C,f,k,z,xe,he,ro,Xr,Jr,Qr,Zr,Rr,ei;let{logErrorIfDebugMode:v}=gl(),[F,A]=eo(),[O,h]=eo(new Date),b=Sc(null),[u,P]=eo(document.querySelector(e[s].selector)),N=fl(u,O),[L,I]=eo(),[q,D]=eo(!y),j=(Ge=($e=e[s])==null?void 0:$e.props)!=null&&Ge.position?e[s].props.position:B,le=($t=(bt=(Xe=e[s])==null?void 0:Xe.props)==null?void 0:bt.zIndex)!=null?$t:90,pe=(Mt=F==null?void 0:F.width)!=null?Mt:hl,K=(C=F==null?void 0:F.height)!=null?C:Cl,[se,de]=eo(new Date().getTime());l=(z=(k=(f=e[s])==null?void 0:f.props)==null?void 0:k.offset)!=null?z:l;let be=window.location.pathname.split("/").pop();xl(()=>{b.current&&A({width:b.current.clientWidth,height:b.current.clientHeight})},[s,O,j]),er(()=>{y||D(!0)},[s]);let V=()=>{let ne=document.querySelector(e[s].selector);if(!ne){I(void 0),P(null),v(`FrigadeTour: Could not find element with selector "${e[s].selector}" for step ${e[s].id}`);return}L&&L===JSON.stringify(ne==null?void 0:ne.getBoundingClientRect())||(P(ne),h(new Date),ne&&I(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]),xl(()=>{setTimeout(()=>{V()},bc),V()},[s,be]),u===null||!p||N.height===0&&N.width===0&&j!=="fixed"&&B!=="static")return null;let Y=i==="auto"?"right":i,ee=zr(N,Y,pe,l,j),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,l,j),Y="left"),(he=(xe=e[s])==null?void 0:xe.props)!=null&&he.tooltipPosition&&((Xr=(ro=e[s])==null?void 0:ro.props)==null?void 0:Xr.tooltipPosition)!=="auto"&&(((Qr=(Jr=e[s])==null?void 0:Jr.props)==null?void 0:Qr.tooltipPosition)==="left"||((Rr=(Zr=e[s])==null?void 0:Zr.props)==null?void 0:Rr.tooltipPosition)==="right")&&(Y=e[s].props.tooltipPosition);let X=()=>{let ne=()=>{if(e[s].handlePrimaryButtonClick&&(e[s].handlePrimaryButtonClick(),D(!1),setTimeout(()=>{V()},30)),S===e.length-1)return o()},ut=()=>{e[s].handleSecondaryButtonClick&&(e[s].handleSecondaryButtonClick(),y&&!e[s].secondaryButtonUri&&D(!1))};return G.createElement(G.Fragment,null,T&&e.length>1&&G.createElement(hi,null,G.createElement(yi,{className:a("tooltipStepCounter",c)},s+1," of ",e.length)),(e[s].primaryButtonTitle||e[s].secondaryButtonTitle)&&G.createElement(Ci,{showStepCount:T,className:a("tooltipCTAContainer",c)},e[s].secondaryButtonTitle&&G.createElement(oe,{title:e[s].secondaryButtonTitle,appearance:c,onClick:ut,size:"small",withMargin:!1,secondary:!0}),e[s].primaryButtonTitle&&G.createElement(oe,{title:e[s].primaryButtonTitle,appearance:c,onClick:ne,withMargin:!1,size:"small"})))},ue=()=>G.createElement(G.Fragment,null,g&&G.createElement(mi,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:a("tooltipClose",c),hasImage:!!e[s].imageUri||!!e[s].videoUri},G.createElement(Ee,null)),e[s].imageUri&&G.createElement(ui,{dismissible:g,appearance:c,src:e[s].imageUri,className:a("tooltipImageContainer",c)}),e[s].videoUri&&!e[s].imageUri&&G.createElement(fi,{dismissible:g,appearance:c,className:a("tooltipVideoContainer",c)},G.createElement(Re,{appearance:c,videoUri:e[s].videoUri})),G.createElement(xi,{className:a("tooltipContentContainer",c)},G.createElement(Ae,{appearance:c,title:e[s].title,subtitle:e[s].subtitle,size:"small"}),G.createElement(gi,{className:a("tooltipFooter",c)},G.createElement(X,null)))),we=w(w({},{default:ne=>{var ut;if((ut=e[s])!=null&&ut.StepContent){let ra=e[s].StepContent;return G.createElement("div",null,ra)}return G.createElement(ue,null)}}),m),U=()=>{var ne;return e?!((ne=e[s])!=null&&ne.type)||!we[e[s].type]?we.default(e[s]):we[e[s].type]({stepData:e[s],primaryColor:r}):G.createElement(G.Fragment,null)};if(e[s].complete===!0||ee.x==0&&ee.y==0&&new Date().getTime()-se<100)return null;let $={top:(ee==null?void 0:ee.y)-to,left:(ei=Y=="left"?N.x+l.x:(ee==null?void 0:ee.x)-to)!=null?ei:0,cursor:y?"pointer":"default",position:j},W=()=>{let ut=$.left+(Y=="left"?-pe:24);return Math.min(Math.max(ut,20),window.innerWidth-pe-20)},J=()=>{if(j==="fixed")return $.top;let ne=$.top+K,ut=20;return ne>window.innerHeight-ut?$.top+-K:$.top},fe=()=>{y&&(h(new Date),D(!q))};return G.createElement(Fc,null,G.createElement(kc,{style:$,zIndex:le,className:a("tourHighlightContainer",c)},n&&e[s].showHighlight!==!1&&B!=="static"&&G.createElement(G.Fragment,null,G.createElement(Tc,{style:{position:j},onClick:fe,primaryColor:c.theme.colorPrimary,className:a("tourHighlightInnerCircle",c)}),G.createElement(wc,{style:{position:"absolute"},onClick:fe,primaryColor:c.theme.colorPrimary,className:a("tourHighlightOuterCircle",c)}))),G.createElement(yl,{style:_(w({},$),{left:W(),top:J()}),zIndex:le+1,className:a("tooltipContainerWrapper",c)},q&&G.createElement(G.Fragment,null,G.createElement(Eo,{ref:b,layoutId:"tooltip-container",style:w({position:"relative",width:"max-content",right:0,top:B!=="static"?12:0},d),appearance:c,className:a("tooltipContainer",c),maxWidth:hl,zIndex:le+10},G.createElement(U,null)),x&&G.createElement(bi,{className:a("poweredByFrigadeTooltipRibbon",c),appearance:c,zIndex:le+10},G.createElement(Ao,{appearance:c})))))},_r=Pc;import{Portal as Ec}from"react-portal";var Ac=S=>{var x=S,{flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:n,showTooltipsSimultaneously:r=!1,onDismiss:l,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:s=!1,dismissBehavior:m="complete-flow",onComplete:c,skipIfNotFound:g=!1,cssPosition:y="absolute"}=x,T=Ie(x,["flowId","customVariables","appearance","onStepCompletion","onButtonClick","showTooltipsSimultaneously","onDismiss","dismissible","tooltipPosition","showHighlightOnly","dismissBehavior","onComplete","skipIfNotFound","cssPosition"]);let{getFlow:B,getFlowSteps:v,isLoading:F,targetingLogicShouldHideFlow:A,markStepCompleted:O,markStepStarted:h,markFlowCompleted:b,updateCustomVariables:u,getCurrentStepIndex:P,getStepStatus:N,isStepBlocked:L,getFlowStatus:I,getNumberOfStepsCompleted:q}=R(),{isLoadingUserFlowStateData:D}=De(),{primaryCTAClickSideEffects:j,secondaryCTAClickSideEffects:le}=ae(),{hasOpenModals:pe}=Be(),K=P(e),{openFlowStates:se}=vc(Q),{mergeAppearanceWithDefault:de}=te();if(o=de(o),Bc(()=>{u(t)},[t,F]),D)return null;let be=B(e);if(!be||A(be)||I(e)==Z||pe())return null;let V=v(e);if(Object.keys(se).length>0){let U=Object.keys(se).find($=>se[$]===!0);if(U!==void 0&&U!==e)return It.createElement(It.Fragment,null)}function Y(U){return M(this,null,function*(){if(yield O(e,U.id),V.map($=>N(e,$.id)).every($=>$===Ke)){yield b(e);return}if(!s&&K+1<V.length&&!r){if(L(e,V[K+1].id))return;yield h(e,V[K+1].id)}})}function ee(U,$,W){let J=K+1<V.length?V[K+1]:null;n&&n(U,K,$,J),i&&i(U,W,J)}function Ve(){return V.map(U=>_(w({},U),{handleSecondaryButtonClick:()=>M(this,null,function*(){le(U),U.skippable===!0&&(yield O(e,U.id,{skipped:!0})),ee(U,"secondary",K)}),handlePrimaryButtonClick:()=>M(this,null,function*(){(!U.completionCriteria&&(U.autoMarkCompleted||U.autoMarkCompleted===void 0)||U.completionCriteria&&U.autoMarkCompleted===!0)&&(yield Y(U)),ee(U,"primary",K),j(U)})}))}function Le(U){return M(this,null,function*(){l&&l(),m==="complete-flow"?yield b(e):yield O(e,U.id)})}function X(){c&&c()}let ue=!document.querySelector(V[K].selector);function Oe(){let U=V.findIndex($=>!!document.querySelector($.selector));return V.map(($,W)=>ue&&!r&&W!==U&&g||!r&&W!==K?null:It.createElement(_r,w({key:$.id,appearance:o,steps:Ve(),selectedStep:W,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>Le($),tooltipPosition:d,showHighlightOnly:s,completedStepsCount:q(e),onComplete:X,cssPosition:y},T)))}function we(){return It.createElement(It.Fragment,null,It.createElement(ie,{appearance:o}),Oe())}return y==="static"?we():It.createElement(Ec,null,we())};import _e,{useEffect as Oc,useRef as Ic,useState as Nc}from"react";import{Portal as Lc}from"react-portal";import Nt from"styled-components";var Sl=Nt.button`
|
|
1468
|
+
${e=>E(e)} {
|
|
1469
1469
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1470
1470
|
|
|
1471
1471
|
display: flex;
|
|
@@ -1483,12 +1483,12 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1483
1483
|
}
|
|
1484
1484
|
}
|
|
1485
1485
|
`,bl=Nt.span`
|
|
1486
|
-
${e=>
|
|
1486
|
+
${e=>E(e)} {
|
|
1487
1487
|
font-size: 12px;
|
|
1488
1488
|
display: inline-block;
|
|
1489
1489
|
}
|
|
1490
1490
|
`,wl=Nt.span`
|
|
1491
|
-
${e=>
|
|
1491
|
+
${e=>E(e)} {
|
|
1492
1492
|
font-size: 12px;
|
|
1493
1493
|
display: inline-block;
|
|
1494
1494
|
}
|
|
@@ -1503,7 +1503,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1503
1503
|
align-items: flex-end;
|
|
1504
1504
|
z-index: 50;
|
|
1505
1505
|
`,Fl=Nt.button`
|
|
1506
|
-
${e=>
|
|
1506
|
+
${e=>E(e)} {
|
|
1507
1507
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1508
1508
|
background-color: #ffffff;
|
|
1509
1509
|
border: 1px solid #f5f5f5;
|
|
@@ -1519,7 +1519,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1519
1519
|
border-radius: 45px;
|
|
1520
1520
|
cursor: pointer;
|
|
1521
1521
|
`,kl=Nt.div`
|
|
1522
|
-
${e=>
|
|
1522
|
+
${e=>E(e)} {
|
|
1523
1523
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1524
1524
|
background: #ffffff;
|
|
1525
1525
|
}
|
|
@@ -1536,7 +1536,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1536
1536
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1537
1537
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1538
1538
|
`,Pl=Nt.button`
|
|
1539
|
-
${e=>
|
|
1539
|
+
${e=>E(e)} {
|
|
1540
1540
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1541
1541
|
color: #434343;
|
|
1542
1542
|
:hover {
|
|
@@ -1552,8 +1552,8 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1552
1552
|
font-size: 14px;
|
|
1553
1553
|
|
|
1554
1554
|
padding: 8px 12px;
|
|
1555
|
-
`;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
|
|
1556
|
-
${e=>
|
|
1555
|
+
`;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 $c=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:n="inline",title:r="Help",appearance:l})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:s,getStepStatus:m,getNumberOfStepsCompleted:c,isLoading:g,targetingLogicShouldHideFlow:y}=R(),{primaryCTAClickSideEffects:T}=ae(),S=Ic(null),[x,B]=Nc(!1),{mergeAppearanceWithDefault:v}=te();l=v(l),Oc(()=>(document.addEventListener("click",F,!1),()=>{document.removeEventListener("click",F,!1)}),[]);let F=u=>{S.current&&!S.current.contains(u.target)&&B(!1)};if(g)return null;let A=p(e);if(!A||y(A))return null;let O=d(e);if(!O||!i)return null;function h(u,P){!u.completionCriteria&&(u.autoMarkCompleted||u.autoMarkCompleted===void 0)&&s(e,u.id),T(u),o&&o(u,P),B(!1)}function b(){return x&&_e.createElement(kl,{className:a("floatingWidgetMenu",l),initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:n},O.map((u,P)=>_e.createElement(Pl,{className:a("floatingWidgetMenuItem",l),key:P,onClick:()=>h(u,P)},u.title)))}return n=="inline"?_e.createElement("span",{ref:S},_e.createElement(Sl,{style:t,onClick:()=>{B(!x)},className:a("supportButton",l)},_e.createElement(wl,{className:a("supportIconContainer",l)},_e.createElement(Al,{className:a("supportIcon",l),style:{width:"18px",height:"18px"}})),_e.createElement(bl,{className:a("supportButtonTitle",l)},r)),_e.createElement(b,null)):_e.createElement(Lc,null,_e.createElement(Tl,{style:t,ref:S},_e.createElement(b,null),_e.createElement(Fl,{onClick:()=>{B(!x)},whileHover:{scale:1.1},className:a("floatingWidgetButton",l)},_e.createElement(Bl,{className:a("floatingWidgetButtonIcon",l),style:{display:"flex",width:"20px",height:"20px"}}))))};import ot,{useEffect as Mc}from"react";import tr from"styled-components";var Ol=tr.div`
|
|
1556
|
+
${e=>E(e)} {
|
|
1557
1557
|
display: flex;
|
|
1558
1558
|
flex-direction: column;
|
|
1559
1559
|
width: 100%;
|
|
@@ -1578,7 +1578,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1578
1578
|
align-items: flex-start;
|
|
1579
1579
|
margin-top: 16px;
|
|
1580
1580
|
`,Ll=tr.div`
|
|
1581
|
-
${e=>
|
|
1581
|
+
${e=>E(e)} {
|
|
1582
1582
|
position: absolute;
|
|
1583
1583
|
top: 16px;
|
|
1584
1584
|
right: 16px;
|
|
@@ -1588,9 +1588,9 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1588
1588
|
opacity: 0.8;
|
|
1589
1589
|
}
|
|
1590
1590
|
}
|
|
1591
|
-
`;var
|
|
1591
|
+
`;var Dc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:l,dismissible:p})=>{let{getFlow:d,markFlowCompleted:s,markStepCompleted:m,isLoading:c,targetingLogicShouldHideFlow:g,updateCustomVariables:y,getFlowSteps:T,getFlowStatus:S,getCurrentStepIndex:x}=R(),{primaryCTAClickSideEffects:B}=ae(),{mergeAppearanceWithDefault:v}=te();if(n=v(n),Mc(()=>{y(o)},[o,c]),c)return null;let F=d(e);if(!F||g(F)||S(e)===Z)return null;let O=T(e)[x(e)];return ot.createElement(ot.Fragment,null,ot.createElement(ie,{appearance:n}),ot.createElement(Ol,{appearance:n,className:Te(a("embeddedTipContainer",n),r),style:l},(p===!0||O.dismissible)&&ot.createElement(Ll,{onClick:()=>M(void 0,null,function*(){yield s(e),t&&t()}),className:a("embeddedTipDismissButton",n)},ot.createElement(Ee,null)),ot.createElement(Il,null,ot.createElement(Ae,{size:"small",appearance:n,title:O.title,subtitle:O.subtitle})),O.primaryButtonTitle&&ot.createElement(Nl,{className:a("embeddedTipCallToActionContainer",n)},ot.createElement(oe,{classPrefix:"embeddedTip",title:O.primaryButtonTitle,appearance:n,withMargin:!1,size:"medium",type:"inline",onClick:()=>M(void 0,null,function*(){O.handlePrimaryButtonClick(),B(O),!(i&&i(O,x(e),"primary")===!1)&&(yield m(e,O.id),yield s(e))})}))))};import Pe,{useEffect as Uc}from"react";import oo from"styled-components";var $l=oo.div`
|
|
1592
1592
|
// use the :not annotation
|
|
1593
|
-
${e=>
|
|
1593
|
+
${e=>E(e)} {
|
|
1594
1594
|
display: flex;
|
|
1595
1595
|
flex-direction: ${e=>e.type==="square"?"column":"row"};
|
|
1596
1596
|
width: 100%;
|
|
@@ -1600,13 +1600,13 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1600
1600
|
background-color: ${e=>e.appearance.theme.colorBackground};
|
|
1601
1601
|
border-radius: 12px;
|
|
1602
1602
|
}
|
|
1603
|
-
|
|
1604
|
-
${e=>
|
|
1603
|
+
`,Ml=oo.div`
|
|
1604
|
+
${e=>E(e)} {
|
|
1605
1605
|
display: flex;
|
|
1606
1606
|
width: 46px;
|
|
1607
1607
|
height: 46px;
|
|
1608
1608
|
}
|
|
1609
|
-
`,
|
|
1609
|
+
`,Dl=oo.div`
|
|
1610
1610
|
display: flex;
|
|
1611
1611
|
flex-direction: column;
|
|
1612
1612
|
flex: 1;
|
|
@@ -1630,7 +1630,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1630
1630
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1631
1631
|
align-items: flex-end;
|
|
1632
1632
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1633
|
-
`;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 Wc=({flowId:e,title:t,subtitle:o,onDismiss:
|
|
1633
|
+
`;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 Wc=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:n,onButtonClick:r,appearance:l,type:p="full-width",icon:d})=>{let{getFlow:s,markFlowCompleted:m,isLoading:c,targetingLogicShouldHideFlow:g,updateCustomVariables:y,getFlowMetadata:T,getFlowStatus:S,getFlowSteps:x,getCurrentStepIndex:B}=R(),{primaryCTAClickSideEffects:v}=ae(),{mergeAppearanceWithDefault:F}=te();if(l=F(l),Uc(()=>{y(n)},[n,c]),c)return null;let A=s(e);if(!A||g(A)||S(e)===Z)return null;let O=x(e),h=O.length>0?O[B(e)]:T(e);return h!=null&&h.title&&(t=h.title),h!=null&&h.subtitle&&(o=h.subtitle),Pe.createElement(Pe.Fragment,null,Pe.createElement(ie,{appearance:l}),Pe.createElement($l,{type:p,appearance:l,className:a("bannerContainer",l)},p!="square"&&Pe.createElement(Ml,{className:a("bannerIconContainer",l)},d||Pe.createElement(Wl,null)),p==="square"&&h.dismissible&&Pe.createElement(jr,{type:p,className:a("bannerDismissButtonContainer",l)},Pe.createElement(Hr,{type:p,onClick:()=>M(void 0,null,function*(){yield m(e),i&&i()}),className:a("bannerDismissButton",l)},Pe.createElement(Ee,null))),Pe.createElement(Dl,{type:p},Pe.createElement(Ae,{appearance:l,title:t,subtitle:o,classPrefix:"banner"})),(h==null?void 0:h.primaryButtonTitle)&&Pe.createElement(Ul,{type:p,className:a("bannerCallToActionContainer",l)},Pe.createElement(oe,{title:h==null?void 0:h.primaryButtonTitle,appearance:l,onClick:()=>{v(h),r&&r(h,0,"primary")},classPrefix:"banner"})),p!=="square"&&h.dismissible&&Pe.createElement(jr,{type:p,className:a("bannerDismissButtonContainer",l)},Pe.createElement(Hr,{type:p,onClick:()=>M(void 0,null,function*(){yield m(e),i&&i()}),className:a("bannerDismissButton",l)},Pe.createElement(Ee,null)))))};import re,{useEffect as zc}from"react";import{Portal as _c}from"react-portal";import mt from"styled-components";var zl=mt.div`
|
|
1634
1634
|
display: flex;
|
|
1635
1635
|
flex-direction: column;
|
|
1636
1636
|
width: 100%;
|
|
@@ -1697,7 +1697,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1697
1697
|
align-items: flex-start;
|
|
1698
1698
|
margin-top: 16px;
|
|
1699
1699
|
`,jl=mt.textarea`
|
|
1700
|
-
${e=>
|
|
1700
|
+
${e=>E(e)} {
|
|
1701
1701
|
margin-top: 16px;
|
|
1702
1702
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1703
1703
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
@@ -1708,7 +1708,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1708
1708
|
height: 100px;
|
|
1709
1709
|
}
|
|
1710
1710
|
`,Vl=mt.div`
|
|
1711
|
-
${e=>
|
|
1711
|
+
${e=>E(e)} {
|
|
1712
1712
|
position: absolute;
|
|
1713
1713
|
top: 16px;
|
|
1714
1714
|
right: 16px;
|
|
@@ -1718,8 +1718,8 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1718
1718
|
opacity: 0.8;
|
|
1719
1719
|
}
|
|
1720
1720
|
}
|
|
1721
|
-
`;var Hc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:
|
|
1722
|
-
${e=>
|
|
1721
|
+
`;var Hc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:l,type:p="modal"})=>{let{getFlow:d,markFlowCompleted:s,markStepCompleted:m,getNumberOfStepsCompleted:c,isLoading:g,targetingLogicShouldHideFlow:y,updateCustomVariables:T,getFlowSteps:S,getFlowStatus:x,getFlowMetadata:B}=R(),{primaryCTAClickSideEffects:v}=ae(),{mergeAppearanceWithDefault:F}=te(),[A,O]=re.useState(null),[h,b]=re.useState(""),u=B(e),{hasOpenModals:P,setKeepCompletedFlowOpenDuringSession:N,shouldKeepCompletedFlowOpenDuringSession:L}=Be();if(n=F(n),zc(()=>{T(o)},[o,g]),g)return null;let I=d(e);if(!I||y(I)||x(e)===Z||c(e)===1&&!L(e)||P())return null;let D=S(e)[c(e)];function j(){var K,se;return re.createElement(re.Fragment,null,re.createElement(qr,null,re.createElement(Ae,{size:"large",appearance:n,title:D.title,subtitle:D.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:()=>M(this,null,function*(){N(e),O(de+1),yield m(e,D.id,{score:de+1})}),appearance:n},de+1))),re.createElement(Hl,{appearance:n},re.createElement(Kr,{appearance:n},(K=u==null?void 0:u.negativeLabel)!=null?K:"Not likely at all"),re.createElement(Kr,{appearance:n},(se=u==null?void 0:u.positiveLabel)!=null?se:"Extremely likely")))}function le(){var K;return re.createElement(re.Fragment,null,re.createElement(qr,null,re.createElement(Ae,{appearance:n,title:(K=D.title)!=null?K:"Why did you choose this score?",size:"large"})),re.createElement(jl,{appearance:n,value:h,onChange:se=>{b(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:()=>M(this,null,function*(){yield s(e),i&&i(D,1,"primary")}),appearance:n,title:D.secondaryButtonTitle||"Skip",secondary:!0}),re.createElement(oe,{size:"large",withMargin:!1,onClick:()=>M(this,null,function*(){yield m(e,D.id,{feedbackText:h}),yield s(e),i&&i(D,1,"primary")}),appearance:n,title:D.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:l,type:p},re.createElement(Vl,{onClick:()=>M(this,null,function*(){yield s(e),t&&t()}),className:a("npsSurveyDismissButton",n)},re.createElement(Ee,null)),c(e)==0&&j(),c(e)==1&&le()))}return p==="inline"?pe():re.createElement(_c,null,pe())};import ve,{useEffect as Gc}from"react";import Lt from"styled-components";var Gl=Lt.div`
|
|
1722
|
+
${e=>E(e)} {
|
|
1723
1723
|
display: flex;
|
|
1724
1724
|
flex-direction: column;
|
|
1725
1725
|
width: 100%;
|
|
@@ -1744,7 +1744,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1744
1744
|
margin-top: 16px;
|
|
1745
1745
|
margin-bottom: 16px;
|
|
1746
1746
|
`,Xl=Lt.div`
|
|
1747
|
-
${e=>
|
|
1747
|
+
${e=>E(e)} {
|
|
1748
1748
|
position: absolute;
|
|
1749
1749
|
top: -16px;
|
|
1750
1750
|
right: -16px;
|
|
@@ -1755,7 +1755,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
1757
|
`,Jl=Lt.h1`
|
|
1758
|
-
${e=>
|
|
1758
|
+
${e=>E(e)} {
|
|
1759
1759
|
font-style: normal;
|
|
1760
1760
|
justify-content: center;
|
|
1761
1761
|
text-align: center;
|
|
@@ -1769,7 +1769,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1769
1769
|
margin-bottom: 8px;
|
|
1770
1770
|
}
|
|
1771
1771
|
`,Ql=Lt.h2`
|
|
1772
|
-
${e=>
|
|
1772
|
+
${e=>E(e)} {
|
|
1773
1773
|
font-style: normal;
|
|
1774
1774
|
justify-content: center;
|
|
1775
1775
|
text-align: center;
|
|
@@ -1785,5 +1785,5 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${lo}${t}.${lo}${t} { ${Object.entries(o).map
|
|
|
1785
1785
|
height: 100%;
|
|
1786
1786
|
min-height: 200px;
|
|
1787
1787
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1788
|
-
`;function Rl({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?Zl.createElement(Re,{appearance:t,videoUri:e.videoUri}):e.imageUri?Zl.createElement(Vc,{className:a(`${o}image`,t),appearance:t,src:e.imageUri}):null}var Kc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:
|
|
1788
|
+
`;function Rl({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?Zl.createElement(Re,{appearance:t,videoUri:e.videoUri}):e.imageUri?Zl.createElement(Vc,{className:a(`${o}image`,t),appearance:t,src:e.imageUri}):null}var Kc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:l,dismissible:p=!0,modalPosition:d="center"})=>{let{getFlow:s,markFlowCompleted:m,markStepCompleted:c,isLoading:g,targetingLogicShouldHideFlow:y,updateCustomVariables:T,getFlowSteps:S,getFlowStatus:x,getCurrentStepIndex:B}=R(),{primaryCTAClickSideEffects:v,secondaryCTAClickSideEffects:F}=ae(),{mergeAppearanceWithDefault:A}=te(),{setOpenFlowState:O,getOpenFlowState:h,hasOpenModals:b}=Be(),[u,P]=[h(e,!0),le=>O(e,le)];if(n=A(n),Gc(()=>{T(o)},[o,g]),g)return null;let N=s(e);if(!N||y(N)||x(e)===Z||b())return null;let I=S(e)[B(e)],q=()=>{P(!1),t&&t(),m(e)};function D(){return ve.createElement(ve.Fragment,null,ve.createElement(ie,{appearance:n}),ve.createElement(Gl,{appearance:n,className:Te(a("announcementContainer",n),r),style:l},(p===!0||I.dismissible)&&d=="inline"&&ve.createElement(Xl,{onClick:()=>M(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(I.title)}),I.subtitle&&ve.createElement(Ql,{appearance:n,className:a("announcementSubtitle",n),dangerouslySetInnerHTML:ce(I.subtitle)})),(I.imageUri||I.videoUri)&&ve.createElement(Yl,{className:a("announcementMediaContainer",n)},ve.createElement(Rl,{appearance:n,stepData:I})),(I.primaryButtonTitle||I.secondaryButtonTitle)&&ve.createElement(ql,{className:a("announcementCTAContainer",n)},I.secondaryButtonTitle&&ve.createElement(oe,{classPrefix:"announcement",title:I.secondaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"full-width",onClick:()=>M(this,null,function*(){I.handleSecondaryButtonClick(),F(I),i&&i(I,B(e),"secondary")}),secondary:!0}),I.primaryButtonTitle&&ve.createElement(oe,{classPrefix:"announcement",title:I.primaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"full-width",onClick:()=>M(this,null,function*(){I.handlePrimaryButtonClick(),v(I),!(i&&i(I,B(e),"primary")===!1)&&(yield c(e,I.id),yield m(e))})}))))}let j={padding:"24px",maxWidth:"400px"};return d==="inline"?D():d!=="center"?ve.createElement(No,{modalPosition:d,onClose:q,visible:u,dismissible:p,appearance:n},D()):ve.createElement(Qe,{appearance:n,onClose:q,visible:u,style:j,dismissible:p},D())};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)},qc=Object.fromEntries(Object.keys(Go).map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=i=>ea.createElement(ta,_(w({as:t},i),{variant:e}),i.children);return o.displayName=`Text.${e}`,[e,o]})),Yr=Object.assign(ta,qc);var oa=l=>{var p=l,{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=yo[n])==null?void 0:d.color,fontWeight:"semibold"},i))},Yc=Object.fromEntries(Object.keys(yo).map(e=>{let t=o=>or.createElement(oa,_(w({},o),{variant:e}));return t.displayName=`Button.${e}`,[e,t]})),Xc=Object.assign(oa,Yc);export{Co as Box,Xc as Button,nt as CheckBox,sr as FlowType,gt as FormLabel,Cr as FormTextField,Kc as FrigadeAnnouncement,Wc as FrigadeBanner,Wr as FrigadeChecklist,it as FrigadeDefaultAppearance,Dc as FrigadeEmbeddedTip,fn as FrigadeForm,fc as FrigadeGuide,dc as FrigadeHeroChecklist,Hc as FrigadeNPSSurvey,mc as FrigadeProgressBadge,bd as FrigadeProvider,$c as FrigadeSupportWidget,Ac as FrigadeTour,We as ProgressBar,Ht as ProgressRing,Yr as Text,Ar as tokens,Be as useFlowOpens,no as useFlowResponses,R as useFlows,Er as useOrganization,so as useUser,De as useUserFlowStates};
|
|
1789
1789
|
//# sourceMappingURL=index.mjs.map
|