@frigade/react 1.32.23 → 1.32.24
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.d.ts +12 -0
- package/lib/index.js +96 -96
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +84 -84
- 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
|
-
import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import{ThemeProvider as sa}from"styled-components";import lt,{useContext as ra,useEffect as lo,useState as $o}from"react";import{useCallback as rt,useContext as Bs,useEffect as As}from"react";import wo,{useMemo as ys}from"react";var Qo="1.32.23 ";var ge="https://api.frigade.com/v1/public/",be="NOT_STARTED_STEP",R="COMPLETED_FLOW",Yt="ABORTED_FLOW",ot="STARTED_FLOW",Ae="NOT_STARTED_FLOW",Fe="COMPLETED_STEP",Xt="STARTED_STEP";function Ne(){let{publicApiKey:e,userId:t}=wo.useContext(G);return{config:ys(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Qo,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}function ft(){let{shouldGracefullyDegrade:e}=wo.useContext(G);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),Kt();let n;try{n=await fetch(t,o)}catch(i){return Kt(i)}return n?n.ok?n:Kt(n.statusText):Kt()}}function Kt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function gt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=wo.useContext(G);function o(){if(t){console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize");return}e||console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider")}return{verifySDKInitiated:o}}import{useContext as vs,useState as Zo}from"react";import{useContext as ws,useEffect as Ts,useState as Fs}from"react";import ks from"swr";import{useContext as bs}from"react";function ke(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o}=bs(G);function n(p,d=!1){return e[p]??d}function i(p,d){t(l=>({...l,[p]:d}))}function r(p){t(d=>{let{[p]:l,...f}=d;return{...f}})}function s(){return Object.values(e).some(p=>p)||o}return{getOpenFlowState:n,setOpenFlowState:i,resetOpenFlowState:r,hasOpenModals:s}}var Ps="unknown";function we(){let{config:e}=Ne(),{publicApiKey:t,userId:o,flows:n,setShouldGracefullyDegrade:i}=ws(G),{resetOpenFlowState:r}=ke(),[s,p]=Fs(!1),d={data:n.map(k=>({flowId:k.id,flowState:R,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},l=k=>fetch(k,e).then(c=>{if(c.ok)return c.json();throw new Error("Failed to fetch user flow states")}).catch(c=>(console.log(`Error fetching ${k}: ${c}. Will gracefully degrade and hide Frigade`),i(!0),d)),{data:f,isLoading:u,mutate:g,error:F}=ks(t&&n&&o?`${ge}userFlowStates?foreignUserId=${encodeURIComponent(o)}`:null,l,{keepPreviousData:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),b=f==null?void 0:f.data;Ts(()=>{!s&&!u&&b&&p(!0)},[b,s,u]);async function C(k){if(b){let c=b.find(h=>h.flowId===k);c&&c.flowState!==R&&(c.flowState=R),await g(Promise.resolve({...f,data:b}),{optimisticData:{...f,data:b},revalidate:!1,rollbackOnError:!1})}}async function m(k,c,h){if(b){let y=b.find(E=>E.flowId===k);y&&(y.stepStates[c]=h,y.flowState=ot),await g(Promise.resolve({...f,data:b}),{optimisticData:{...f,data:b},revalidate:!1,rollbackOnError:!1})}}async function v(k,c,h){if(b){let y=b.find(E=>E.flowId===k);y&&(y.lastStepId=c,y.stepStates[c]=h,y.flowState=ot),await g({...f,data:b},{optimisticData:{...f,data:b},revalidate:!1,rollbackOnError:!1})}}async function w(k){if(b){let c=b.find(h=>h.flowId===k);c&&c.flowState!==Ae&&(c.flowState=Ae,c.lastStepId=Ps,Object.keys(c.stepStates).forEach(h=>{c.stepStates[h].actionType=be,c.stepStates[h].createdAt=new Date().toISOString()}),await g({...f,data:b},{optimisticData:{...f,data:b},revalidate:!1,rollbackOnError:!1}),r(k))}}async function B(k,c){if(b){let h=b.find(y=>y.flowId===k);h&&h.stepStates[c]!==be&&(h.stepStates[c]=be),await g({...f,data:b},{optimisticData:{...f,data:b},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:b,isLoadingUserFlowStateData:!s,mutateUserFlowState:g,optimisticallyMarkFlowCompleted:C,optimisticallyMarkFlowNotStarted:w,optimisticallyMarkStepCompleted:m,optimisticallyMarkStepNotStarted:B,optimisticallyMarkStepStarted:v,error:F}}function At(){let{config:e}=Ne(),{userFlowStatesData:t,mutateUserFlowState:o}=we(),{failedFlowResponses:n,setFailedFlowResponses:i,flowResponses:r,setFlowResponses:s}=vs(G),[p,d]=Zo(new Set),[l,f]=Zo(new Set),u=ft();function g(C){let m=JSON.stringify(C);if(p.has(m))return null;p.add(m),d(p),l.add(C),f(l);let v=r==null?void 0:r.find(w=>w.flowSlug===C.flowSlug&&w.stepId===C.stepId&&w.actionType===C.actionType&&w.createdAt===C.createdAt);return u(`${ge}flowResponses`,{...e,method:"POST",body:m}).then(w=>{w.status!==200&&w.status!==201?(console.log("Failed to send flow response for step "+C.stepId+". Will retry again later."),i([...n,C])):v||s(B=>[...B??[],C])})}async function F(C){C.foreignUserId&&(C.actionType===ot||C.actionType===Ae?await g(C):C.actionType===R?await g(C):C.actionType===Xt?await g(C):C.actionType===Fe?await g(C):C.actionType===Yt?await g(C):C.actionType===be&&await g(C))}function b(){let C=[];return t==null||t.forEach(m=>{if(m&&m.stepStates&&Object.keys(m.stepStates).length!==0)for(let v in m.stepStates){let w=m.stepStates[v];C.push({foreignUserId:m.foreignUserId,flowSlug:m.flowId,stepId:w.stepId,actionType:w.actionType,data:{},createdAt:new Date(w.createdAt),blocked:w.blocked,hidden:w.hidden})}}),[...C,...r]}return{addResponse:F,setFlowResponses:s,getFlowResponses:b}}import Ns from"swr";var Is=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Ro=e=>{let t=Is.exec(e);if(t===null)return null;let o=null;return t.forEach((n,i)=>{let r=Es(n,"'","");r.startsWith("flow_")&&(o=r)}),o},Es=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function X(){let{config:e}=Ne(),{flows:t,setFlows:o,userId:n,publicApiKey:i,customVariables:r,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,setFlowResponses:l,setShouldGracefullyDegrade:f}=Bs(G),u={data:[]},{verifySDKInitiated:g}=gt(),{addResponse:F,getFlowResponses:b}=At(),C=x=>fetch(x,e).then(S=>S.ok?S.json():(console.log(`Error fetching ${x} (${S.status}): ${S.statusText}. .Will gracefully degrade and hide Frigade`),f(!0),u)).catch(S=>(console.log(`Error fetching ${x}: ${S}. Will gracefully degrade and hide Frigade`),f(!0),u)),{userFlowStatesData:m,isLoadingUserFlowStateData:v,optimisticallyMarkFlowCompleted:w,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:k,optimisticallyMarkStepNotStarted:c,optimisticallyMarkStepStarted:h}=we(),{data:y,error:E,isLoading:U}=Ns(i?`${ge}flows`:null,C,{keepPreviousData:!0});As(()=>{if(E){console.error(E);return}y&&y.data&&(y.data=o(y.data))},[y,E]);function M(x){if(U)return null;let S=t.find(P=>P.slug===x);return!S&&t.length>0&&!v&&!U?(console.log(`Flow with slug ${x} not found`),null):(S==null?void 0:S.active)===!1?null:S}function _(x){var I;if(!M(x))return[];let S=M(x).data;return S?(S=O(S),(((I=JSON.parse(S))==null?void 0:I.data)??[]).map(Y=>{let tt=_e(Y);return{handleSecondaryButtonClick:()=>{Y.skippable===!0&&z(x,Y.id,{skipped:!0})},...Y,complete:A(x,Y.id)===Fe||tt>=1,blocked:q(x,Y.id),hidden:Ue(x,Y.id),handlePrimaryButtonClick:()=>{(!Y.completionCriteria&&(Y.autoMarkCompleted||Y.autoMarkCompleted===void 0)||Y.completionCriteria&&Y.autoMarkCompleted===!0)&&z(x,Y.id)},progress:tt}}).filter(Y=>Y.hidden!==!0)):[]}function O(x){return x.replace(/\${(.*?)}/g,(S,P)=>r[P]!==void 0?String(r[P]):"")}function H(x){if(!M(x))return[];let S=M(x).data;return S?(S=O(S),JSON.parse(S)??{}):[]}function N(x,S){s(P=>({...P,[x]:S}))}function j(x){!v&&!U&&x&&JSON.stringify(r)!=JSON.stringify({...r,...x})&&Object.keys(x).forEach(S=>{N(S,x[S])})}let K=rt(async(x,S,P)=>{g();let I={foreignUserId:n,flowSlug:x,stepId:S,actionType:Xt,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(I)&&(await h(x,S,I),F(I))},[n,m]),V=rt(async(x,S,P)=>{g();let I={foreignUserId:n,flowSlug:x,stepId:S,actionType:be,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(I)&&(await c(x,S),F(I))},[n,m]),z=rt(async(x,S,P)=>{g();let I={foreignUserId:n,flowSlug:x,stepId:S,actionType:Fe,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(I)&&(await k(x,S,I),F(I))},[n,m]),te=rt(async(x,S)=>{g();let P={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:Ae,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};await B(x),J(P)&&F(P)},[n,m]),oe=rt(async(x,S)=>{g();let P={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:ot,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&F(P)},[n,m]),Z=rt(async(x,S)=>{g();let P={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:R,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&(await w(x),F(P))},[n,m]),$=rt(async(x,S)=>{g();let P={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:Yt,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&(await w(x),F(P))},[n,m]);function J(x){var S;if(!m&&x.actionType===be)return!1;if(m){let P=m.find(I=>I.flowId===x.flowSlug);if(x.actionType===be&&(!(P!=null&&P.stepStates[x.stepId])||P.stepStates[x.stepId].actionType===be)||P&&((S=P.stepStates[x.stepId])==null?void 0:S.actionType)===x.actionType)return!1}return!0}function A(x,S){let P=xe(x,S);return v?null:P?P.actionType:be}function q(x,S){let P=xe(x,S);return P?P.blocked:!1}function Ue(x,S){let P=xe(x,S);return P?P.hidden:!1}function xe(x,S){if(v)return null;let P=m==null?void 0:m.find(I=>I.flowId===x);return!P||!P.stepStates[S]?null:P.stepStates[S]??null}function ye(x){var P;if(v||!m)return null;if(We(x)===Ae)return _(x)[0]??null;let S=(P=m.find(I=>I.flowId===x))==null?void 0:P.lastStepId;return S?_(x).find(I=>I.id===S):null}function me(x){let S=ye(x);if(!S)return 0;let P=_(x).findIndex(I=>I.id===S.id)??0;return A(x,S.id)===Fe&&P<_(x).length-1?P+1:P}function _e(x){if(!x.completionCriteria)return;let S=Ro(x.completionCriteria);if(S===null)return;let P=et(S),I=W(S);return I===0?void 0:P/I}function We(x){let S=m==null?void 0:m.find(P=>P.flowId===x);return S?S.flowState:null}function et(x){let S=_(x);return S.length===0?0:S.filter(I=>A(x,I.id)===Fe).length}function W(x){return _(x).length}function Ee(x){return JSON.parse(t.find(S=>S.slug===x).data)}function Be(x){if(v)return!0;if(x!=null&&x.targetingLogic&&m){let S=m.find(P=>P.flowId===x.slug);if(S)return S.shouldTrigger===!1}return!!(x!=null&&x.targetingLogic&&n&&n.startsWith("guest_"))}function bo(x){return!Be(M(x))}return{getFlow:M,getFlowData:Ee,isLoading:v||U,getStepStatus:A,getFlowSteps:_,getCurrentStepIndex:me,markStepStarted:K,markStepCompleted:z,markFlowNotStarted:te,markFlowStarted:oe,markFlowCompleted:Z,markFlowAborted:$,markStepNotStarted:V,getFlowStatus:We,getNumberOfStepsCompleted:et,getNumberOfSteps:W,targetingLogicShouldHideFlow:Be,setCustomVariable:N,updateCustomVariables:j,customVariables:r,getStepOptionalProgress:_e,getFlowMetadata:H,isStepBlocked:q,isStepHidden:Ue,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,isFlowAvailableToUser:bo}}import{useCallback as er,useContext as Os,useEffect as Ls}from"react";var ht="guest_";function To(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:i}=Os(G),{config:r}=Ne(),{mutateUserFlowState:s}=we(),p=ft(),{verifySDKInitiated:d}=gt();Ls(()=>{if(e&&!t){if(e.startsWith(ht))return;let u=`frigade-user-registered-${e}`;localStorage.getItem(u)||(p(`${ge}users`,{...r,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(u,"true"))}},[e,i,t]);let l=er(async u=>{d();let g={foreignId:e,properties:u};await p(`${ge}users`,{...r,method:"POST",body:JSON.stringify(g)}),n(F=>({...F,...u})),s()},[e,r,i,s]),f=er(async(u,g)=>{d();let b={foreignId:e,events:[{event:u,properties:g}]};await p(`${ge}users`,{...r,method:"POST",body:JSON.stringify(b)}),s()},[e,r,s]);return{userId:e,setUserId:o,addPropertiesToUser:l,trackEventForUser:f}}import{v4 as ia}from"uuid";import Oe,{useEffect as Rl,useState as ea}from"react";import He,{useEffect as Ws}from"react";import Qt from"styled-components";import Ds from"react";import Ms from"styled-components";var tr="fr-",Nt="cfr-";function a(e,t){let o=`${tr}${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+" "+Nt+e}return o}function T(e){if(!e.className||e.className.indexOf(Nt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(tr)?"":`:not(${o.map(n=>`.${n}`).join(", ")})`}function Fo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function it(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Fo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Ce(...e){return e.filter(Boolean).join(" ")}function or(e){return e.charAt(0).toUpperCase()+e.slice(1)}var $s=Ms.div`
|
|
2
|
+
import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import{ThemeProvider as sa}from"styled-components";import lt,{useContext as ra,useEffect as lo,useState as $o}from"react";import{useCallback as rt,useContext as Bs,useEffect as As}from"react";import wo,{useMemo as Ss}from"react";var Qo="1.32.24 ";var ge="https://api.frigade.com/v1/public/",be="NOT_STARTED_STEP",R="COMPLETED_FLOW",Yt="ABORTED_FLOW",ot="STARTED_FLOW",Ae="NOT_STARTED_FLOW",Fe="COMPLETED_STEP",Xt="STARTED_STEP";function Ne(){let{publicApiKey:e,userId:t}=wo.useContext(G);return{config:Ss(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Qo,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}function ft(){let{shouldGracefullyDegrade:e}=wo.useContext(G);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),Kt();let n;try{n=await fetch(t,o)}catch(i){return Kt(i)}return n?n.ok?n:Kt(n.statusText):Kt()}}function Kt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function gt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=wo.useContext(G);function o(){if(t){console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize");return}e||console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider")}return{verifySDKInitiated:o}}import{useContext as vs,useState as Zo}from"react";import{useContext as ws,useEffect as Ts,useState as Fs}from"react";import ks from"swr";import{useContext as bs}from"react";function ke(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o}=bs(G);function n(p,d=!1){return e[p]??d}function i(p,d){t(l=>({...l,[p]:d}))}function r(p){t(d=>{let{[p]:l,...f}=d;return{...f}})}function s(){return Object.values(e).some(p=>p)||o}return{getOpenFlowState:n,setOpenFlowState:i,resetOpenFlowState:r,hasOpenModals:s}}var Ps="unknown";function we(){let{config:e}=Ne(),{publicApiKey:t,userId:o,flows:n,setShouldGracefullyDegrade:i}=ws(G),{resetOpenFlowState:r}=ke(),[s,p]=Fs(!1),d={data:n.map(k=>({flowId:k.id,flowState:R,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},l=k=>fetch(k,e).then(c=>{if(c.ok)return c.json();throw new Error("Failed to fetch user flow states")}).catch(c=>(console.log(`Error fetching ${k}: ${c}. Will gracefully degrade and hide Frigade`),i(!0),d)),{data:f,isLoading:u,mutate:h,error:w}=ks(t&&n&&o?`${ge}userFlowStates?foreignUserId=${encodeURIComponent(o)}`:null,l,{keepPreviousData:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),b=f==null?void 0:f.data;Ts(()=>{!s&&!u&&b&&p(!0)},[b,s,u]);async function C(k){if(b){let c=b.find(g=>g.flowId===k);c&&c.flowState!==R&&(c.flowState=R),await h(Promise.resolve({...f,data:b}),{optimisticData:{...f,data:b},revalidate:!1,rollbackOnError:!1})}}async function m(k,c,g){if(b){let S=b.find(E=>E.flowId===k);S&&(S.stepStates[c]=g,S.flowState=ot),await h(Promise.resolve({...f,data:b}),{optimisticData:{...f,data:b},revalidate:!1,rollbackOnError:!1})}}async function v(k,c,g){if(b){let S=b.find(E=>E.flowId===k);S&&(S.lastStepId=c,S.stepStates[c]=g,S.flowState=ot),await h({...f,data:b},{optimisticData:{...f,data:b},revalidate:!1,rollbackOnError:!1})}}async function T(k){if(b){let c=b.find(g=>g.flowId===k);c&&c.flowState!==Ae&&(c.flowState=Ae,c.lastStepId=Ps,Object.keys(c.stepStates).forEach(g=>{c.stepStates[g].actionType=be,c.stepStates[g].createdAt=new Date().toISOString()}),await h({...f,data:b},{optimisticData:{...f,data:b},revalidate:!1,rollbackOnError:!1}),r(k))}}async function B(k,c){if(b){let g=b.find(S=>S.flowId===k);g&&g.stepStates[c]!==be&&(g.stepStates[c]=be),await h({...f,data:b},{optimisticData:{...f,data:b},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:b,isLoadingUserFlowStateData:!s,mutateUserFlowState:h,optimisticallyMarkFlowCompleted:C,optimisticallyMarkFlowNotStarted:T,optimisticallyMarkStepCompleted:m,optimisticallyMarkStepNotStarted:B,optimisticallyMarkStepStarted:v,error:w}}function At(){let{config:e}=Ne(),{userFlowStatesData:t,mutateUserFlowState:o}=we(),{failedFlowResponses:n,setFailedFlowResponses:i,flowResponses:r,setFlowResponses:s}=vs(G),[p,d]=Zo(new Set),[l,f]=Zo(new Set),u=ft();function h(C){let m=JSON.stringify(C);if(p.has(m))return null;p.add(m),d(p),l.add(C),f(l);let v=r==null?void 0:r.find(T=>T.flowSlug===C.flowSlug&&T.stepId===C.stepId&&T.actionType===C.actionType&&T.createdAt===C.createdAt);return u(`${ge}flowResponses`,{...e,method:"POST",body:m}).then(T=>{T.status!==200&&T.status!==201?(console.log("Failed to send flow response for step "+C.stepId+". Will retry again later."),i([...n,C])):v||s(B=>[...B??[],C])})}async function w(C){C.foreignUserId&&(C.actionType===ot||C.actionType===Ae?await h(C):C.actionType===R?await h(C):C.actionType===Xt?await h(C):C.actionType===Fe?await h(C):C.actionType===Yt?await h(C):C.actionType===be&&await h(C))}function b(){let C=[];return t==null||t.forEach(m=>{if(m&&m.stepStates&&Object.keys(m.stepStates).length!==0)for(let v in m.stepStates){let T=m.stepStates[v];C.push({foreignUserId:m.foreignUserId,flowSlug:m.flowId,stepId:T.stepId,actionType:T.actionType,data:{},createdAt:new Date(T.createdAt),blocked:T.blocked,hidden:T.hidden})}}),[...C,...r]}return{addResponse:w,setFlowResponses:s,getFlowResponses:b}}import Ns from"swr";var Is=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Ro=e=>{let t=Is.exec(e);if(t===null)return null;let o=null;return t.forEach((n,i)=>{let r=Es(n,"'","");r.startsWith("flow_")&&(o=r)}),o},Es=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function X(){let{config:e}=Ne(),{flows:t,setFlows:o,userId:n,publicApiKey:i,customVariables:r,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,setFlowResponses:l,setShouldGracefullyDegrade:f}=Bs(G),u={data:[]},{verifySDKInitiated:h}=gt(),{addResponse:w,getFlowResponses:b}=At(),C=x=>fetch(x,e).then(y=>y.ok?y.json():(console.log(`Error fetching ${x} (${y.status}): ${y.statusText}. .Will gracefully degrade and hide Frigade`),f(!0),u)).catch(y=>(console.log(`Error fetching ${x}: ${y}. Will gracefully degrade and hide Frigade`),f(!0),u)),{userFlowStatesData:m,isLoadingUserFlowStateData:v,optimisticallyMarkFlowCompleted:T,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:k,optimisticallyMarkStepNotStarted:c,optimisticallyMarkStepStarted:g}=we(),{data:S,error:E,isLoading:U}=Ns(i?`${ge}flows`:null,C,{keepPreviousData:!0});As(()=>{if(E){console.error(E);return}S&&S.data&&(S.data=o(S.data))},[S,E]);function M(x){if(U)return null;let y=t.find(P=>P.slug===x);return!y&&t.length>0&&!v&&!U?(console.log(`Flow with slug ${x} not found`),null):(y==null?void 0:y.active)===!1?null:y}function _(x){var I;if(!M(x))return[];let y=M(x).data;return y?(y=O(y),(((I=JSON.parse(y))==null?void 0:I.data)??[]).map(Y=>{let tt=_e(Y);return{handleSecondaryButtonClick:()=>{Y.skippable===!0&&z(x,Y.id,{skipped:!0})},...Y,complete:A(x,Y.id)===Fe||tt>=1,blocked:q(x,Y.id),hidden:Ue(x,Y.id),handlePrimaryButtonClick:()=>{(!Y.completionCriteria&&(Y.autoMarkCompleted||Y.autoMarkCompleted===void 0)||Y.completionCriteria&&Y.autoMarkCompleted===!0)&&z(x,Y.id)},progress:tt}}).filter(Y=>Y.hidden!==!0)):[]}function O(x){return x.replace(/\${(.*?)}/g,(y,P)=>r[P]!==void 0?String(r[P]):"")}function H(x){if(!M(x))return[];let y=M(x).data;return y?(y=O(y),JSON.parse(y)??{}):[]}function N(x,y){s(P=>({...P,[x]:y}))}function j(x){!v&&!U&&x&&JSON.stringify(r)!=JSON.stringify({...r,...x})&&Object.keys(x).forEach(y=>{N(y,x[y])})}let K=rt(async(x,y,P)=>{h();let I={foreignUserId:n,flowSlug:x,stepId:y,actionType:Xt,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(I)&&(await g(x,y,I),w(I))},[n,m]),V=rt(async(x,y,P)=>{h();let I={foreignUserId:n,flowSlug:x,stepId:y,actionType:be,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(I)&&(await c(x,y),w(I))},[n,m]),z=rt(async(x,y,P)=>{h();let I={foreignUserId:n,flowSlug:x,stepId:y,actionType:Fe,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(I)&&(await k(x,y,I),w(I))},[n,m]),te=rt(async(x,y)=>{h();let P={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:Ae,data:y??{},createdAt:new Date,blocked:!1,hidden:!1};await B(x),J(P)&&w(P)},[n,m]),oe=rt(async(x,y)=>{h();let P={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:ot,data:y??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&w(P)},[n,m]),Z=rt(async(x,y)=>{h();let P={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:R,data:y??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&(await T(x),w(P))},[n,m]),$=rt(async(x,y)=>{h();let P={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:Yt,data:y??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&(await T(x),w(P))},[n,m]);function J(x){var y;if(!m&&x.actionType===be)return!1;if(m){let P=m.find(I=>I.flowId===x.flowSlug);if(x.actionType===be&&(!(P!=null&&P.stepStates[x.stepId])||P.stepStates[x.stepId].actionType===be)||P&&((y=P.stepStates[x.stepId])==null?void 0:y.actionType)===x.actionType)return!1}return!0}function A(x,y){let P=xe(x,y);return v?null:P?P.actionType:be}function q(x,y){let P=xe(x,y);return P?P.blocked:!1}function Ue(x,y){let P=xe(x,y);return P?P.hidden:!1}function xe(x,y){if(v)return null;let P=m==null?void 0:m.find(I=>I.flowId===x);return!P||!P.stepStates[y]?null:P.stepStates[y]??null}function Se(x){var P;if(v||!m)return null;if(We(x)===Ae)return _(x)[0]??null;let y=(P=m.find(I=>I.flowId===x))==null?void 0:P.lastStepId;return y?_(x).find(I=>I.id===y):null}function me(x){let y=Se(x);if(!y)return 0;let P=_(x).findIndex(I=>I.id===y.id)??0;return A(x,y.id)===Fe&&P<_(x).length-1?P+1:P}function _e(x){if(!x.completionCriteria)return;let y=Ro(x.completionCriteria);if(y===null)return;let P=et(y),I=W(y);return I===0?void 0:P/I}function We(x){let y=m==null?void 0:m.find(P=>P.flowId===x);return y?y.flowState:null}function et(x){let y=_(x);return y.length===0?0:y.filter(I=>A(x,I.id)===Fe).length}function W(x){return _(x).length}function Ee(x){return JSON.parse(t.find(y=>y.slug===x).data)}function Be(x){if(v)return!0;if(x!=null&&x.targetingLogic&&m){let y=m.find(P=>P.flowId===x.slug);if(y)return y.shouldTrigger===!1}return!!(x!=null&&x.targetingLogic&&n&&n.startsWith("guest_"))}function bo(x){return!Be(M(x))}return{getFlow:M,getFlowData:Ee,isLoading:v||U,getStepStatus:A,getFlowSteps:_,getCurrentStepIndex:me,markStepStarted:K,markStepCompleted:z,markFlowNotStarted:te,markFlowStarted:oe,markFlowCompleted:Z,markFlowAborted:$,markStepNotStarted:V,getFlowStatus:We,getNumberOfStepsCompleted:et,getNumberOfSteps:W,targetingLogicShouldHideFlow:Be,setCustomVariable:N,updateCustomVariables:j,customVariables:r,getStepOptionalProgress:_e,getFlowMetadata:H,isStepBlocked:q,isStepHidden:Ue,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,isFlowAvailableToUser:bo}}import{useCallback as er,useContext as Os,useEffect as Ls}from"react";var ht="guest_";function To(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:i}=Os(G),{config:r}=Ne(),{mutateUserFlowState:s}=we(),p=ft(),{verifySDKInitiated:d}=gt();Ls(()=>{if(e&&!t){if(e.startsWith(ht))return;let u=`frigade-user-registered-${e}`;localStorage.getItem(u)||(p(`${ge}users`,{...r,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(u,"true"))}},[e,i,t]);let l=er(async u=>{d();let h={foreignId:e,properties:u};await p(`${ge}users`,{...r,method:"POST",body:JSON.stringify(h)}),n(w=>({...w,...u})),s()},[e,r,i,s]),f=er(async(u,h)=>{d();let b={foreignId:e,events:[{event:u,properties:h}]};await p(`${ge}users`,{...r,method:"POST",body:JSON.stringify(b)}),s()},[e,r,s]);return{userId:e,setUserId:o,addPropertiesToUser:l,trackEventForUser:f}}import{v4 as ia}from"uuid";import Oe,{useEffect as Rl,useState as ea}from"react";import He,{useEffect as Ws}from"react";import Qt from"styled-components";import Ds from"react";import Ms from"styled-components";var tr="fr-",Nt="cfr-";function a(e,t){let o=`${tr}${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+" "+Nt+e}return o}function F(e){if(!e.className||e.className.indexOf(Nt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(tr)?"":`:not(${o.map(n=>`.${n}`).join(", ")})`}function Fo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function it(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Fo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Ce(...e){return e.filter(Boolean).join(" ")}function or(e){return e.charAt(0).toUpperCase()+e.slice(1)}var $s=Ms.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -7,7 +7,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
7
7
|
left: 0;
|
|
8
8
|
bottom: 0;
|
|
9
9
|
right: 0;
|
|
10
|
-
${e=>
|
|
10
|
+
${e=>F(e)} {
|
|
11
11
|
background-color: rgba(0, 0, 0, 0.6);
|
|
12
12
|
z-index: 1400;
|
|
13
13
|
}
|
|
@@ -28,7 +28,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
30
|
`,Pe=()=>Jt.createElement(_s,null,Jt.createElement("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Jt.createElement("rect",{y:"1.39844",width:"1.97669",height:"17.8213",rx:"0.988346",transform:"rotate(-45 0 1.39844)",fill:"currentColor"}),Jt.createElement("rect",{x:"12.6023",width:"1.97669",height:"17.8213",rx:"0.988346",transform:"rotate(45 12.6023 0)",fill:"currentColor"})));import{Portal as Hs}from"react-portal";var zs=Qt.div`
|
|
31
|
-
${e=>
|
|
31
|
+
${e=>F(e)} {
|
|
32
32
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
33
33
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
34
34
|
/* Mobile */
|
|
@@ -80,7 +80,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
80
80
|
right: 24px;
|
|
81
81
|
cursor: pointer;
|
|
82
82
|
z-index: 1501;
|
|
83
|
-
${e=>
|
|
83
|
+
${e=>F(e)} {
|
|
84
84
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
85
85
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
86
86
|
}
|
|
@@ -92,7 +92,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
92
92
|
display: none;
|
|
93
93
|
}
|
|
94
94
|
`,Ye=({onClose:e,visible:t,headerContent:o=null,style:n=null,children:i,appearance:r,dismissible:s=!0})=>(Ws(()=>{let p=d=>{d.key==="Escape"&&e()};return document.addEventListener("keydown",p),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",p)}},[e,t]),t?He.createElement(Hs,null,He.createElement(rr,{appearance:r,onClose:()=>{s&&e()}}),He.createElement(zs,{appearance:r,className:a("modalContainer",r),styleOverrides:n},s&&He.createElement(js,{className:a("modalClose",r),onClick:()=>e(),appearance:r},He.createElement(Pe,null)),o&&He.createElement(Gs,null,o),He.createElement(Vs,null,i))):He.createElement(He.Fragment,null));import Xe,{useEffect as qs}from"react";import Zt from"styled-components";import{Portal as Ks}from"react-portal";var Ys=Zt.div`
|
|
95
|
-
${e=>
|
|
95
|
+
${e=>F(e)} {
|
|
96
96
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
97
97
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
98
98
|
position: fixed;
|
|
@@ -118,7 +118,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
118
118
|
right: 24px;
|
|
119
119
|
cursor: pointer;
|
|
120
120
|
z-index: 1501;
|
|
121
|
-
${e=>
|
|
121
|
+
${e=>F(e)} {
|
|
122
122
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
123
123
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
124
124
|
}
|
|
@@ -128,8 +128,8 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
128
128
|
::-webkit-scrollbar {
|
|
129
129
|
display: none;
|
|
130
130
|
}
|
|
131
|
-
`,ir=({onClose:e,visible:t,headerContent:o=null,children:n,appearance:i})=>(qs(()=>{let r=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",r),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",r)}},[e,t]),t?Xe.createElement(Ks,null,Xe.createElement(Ys,{appearance:i,className:a("cornerModalContainer",i)},Xe.createElement(Js,{className:a("cornerModalClose",i),onClick:()=>e()},Xe.createElement(Pe,null)),o&&Xe.createElement(Xs,null,o),Xe.createElement(Qs,null,n))):Xe.createElement(Xe.Fragment,null));import{useContext as Zs}from"react";function Q(){let{defaultAppearance:e}=Zs(G);function t(o){let n=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(n.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(n.theme,o.theme??{})}:n}return{mergeAppearanceWithDefault:t}}import to,{useEffect as pl,useState as
|
|
132
|
-
${e=>
|
|
131
|
+
`,ir=({onClose:e,visible:t,headerContent:o=null,children:n,appearance:i})=>(qs(()=>{let r=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",r),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",r)}},[e,t]),t?Xe.createElement(Ks,null,Xe.createElement(Ys,{appearance:i,className:a("cornerModalContainer",i)},Xe.createElement(Js,{className:a("cornerModalClose",i),onClick:()=>e()},Xe.createElement(Pe,null)),o&&Xe.createElement(Xs,null,o),Xe.createElement(Qs,null,n))):Xe.createElement(Xe.Fragment,null));import{useContext as Zs}from"react";function Q(){let{defaultAppearance:e}=Zs(G);function t(o){let n=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(n.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(n.theme,o.theme??{})}:n}return{mergeAppearanceWithDefault:t}}import to,{useEffect as pl,useState as yr}from"react";import Sr from"styled-components";import vo,{useEffect as Rs,useState as ar}from"react";import Io from"styled-components";import ko from"styled-components";var nr=ko.label`
|
|
132
|
+
${e=>F(e)} {
|
|
133
133
|
font-size: 14px;
|
|
134
134
|
line-height: 20px;
|
|
135
135
|
margin-bottom: 5px;
|
|
@@ -154,7 +154,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
154
154
|
flex-direction: column;
|
|
155
155
|
width: 100%;
|
|
156
156
|
`,Eo=Io.input`
|
|
157
|
-
${e=>
|
|
157
|
+
${e=>F(e)} {
|
|
158
158
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
159
159
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
160
160
|
font-size: 14px;
|
|
@@ -170,7 +170,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
170
170
|
padding: 0 10px;
|
|
171
171
|
margin-bottom: 10px;
|
|
172
172
|
`,tl=Io.textarea`
|
|
173
|
-
${e=>
|
|
173
|
+
${e=>F(e)} {
|
|
174
174
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
175
175
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
176
176
|
font-size: 14px;
|
|
@@ -185,14 +185,14 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
185
185
|
min-height: 70px;
|
|
186
186
|
box-sizing: border-box;
|
|
187
187
|
margin-bottom: 10px;
|
|
188
|
-
`;function pr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:n,inputData:i}){let r=e,[s,p]=ar((i==null?void 0:i.text)||""),[d,l]=ar(!1),f=Eo;Rs(()=>{s===""&&!d&&(l(!0),u(""))},[]);function u(
|
|
188
|
+
`;function pr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:n,inputData:i}){let r=e,[s,p]=ar((i==null?void 0:i.text)||""),[d,l]=ar(!1),f=Eo;Rs(()=>{s===""&&!d&&(l(!0),u(""))},[]);function u(w){if(p(w),r.required===!0&&w.trim()===""){n([{id:r.id,message:`${r.title} is required`}]);return}n([]),o({text:w})}r.multiline&&(f=tl);function h(){var w;switch((w=r==null?void 0:r.validation)==null?void 0:w.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return vo.createElement(el,null,vo.createElement(nt,{title:r.title,required:r.required,appearance:t.appearance}),vo.createElement(f,{className:a("inputComponent",t.appearance),value:s,onChange:w=>{u(w.target.value)},appearance:t.appearance,placeholder:r.placeholder,type:h()}))}import ze,{useEffect as dr,useState as cr}from"react";import mr from"styled-components";var ol=mr.div`
|
|
189
189
|
display: flex;
|
|
190
190
|
flex-direction: column;
|
|
191
191
|
width: 100%;
|
|
192
192
|
-webkit-appearance: none;
|
|
193
193
|
appearance: none;
|
|
194
194
|
`,rl=mr.select`
|
|
195
|
-
${e=>
|
|
195
|
+
${e=>F(e)} {
|
|
196
196
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
197
197
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
198
198
|
font-size: 14px;
|
|
@@ -215,14 +215,14 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
215
215
|
background-repeat: no-repeat;
|
|
216
216
|
background-size: 1.5em 1.5em;
|
|
217
217
|
-webkit-print-color-adjust: exact;
|
|
218
|
-
`,Rt="null";function ur({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n,setFormValidationErrors:i}){var f,u,
|
|
218
|
+
`,Rt="null";function ur({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n,setFormValidationErrors:i}){var f,u,h,w,b,C;let r=e,[s,p]=cr(((f=n==null?void 0:n.choice)==null?void 0:f[0])||""),[d,l]=cr(!1);return dr(()=>{var m,v,T,B;if(s===""&&!d){if(l(!0),r.requireSelection){p(Rt);return}if(r.defaultValue&&((m=r.props.options)!=null&&m.find(k=>k.id===r.defaultValue))){let k=(v=r.props.options)==null?void 0:v.find(c=>c.id===r.defaultValue);p(k.id),o({choice:[k.id]})}else p(((T=r.props.options)==null?void 0:T[0].id)||""),o({choice:[((B=r.props.options)==null?void 0:B[0].id)||""]})}},[]),dr(()=>{r.requireSelection&&s===Rt?i([{message:"Please select an option",id:r.id}]):i([])},[s]),ze.createElement(ol,null,ze.createElement(nt,{title:r.title,required:!1,appearance:t.appearance}),ze.createElement(rl,{value:s,onChange:m=>{p(m.target.value),o({choice:[m.target.value]})},placeholder:r.placeholder,appearance:t.appearance,className:a("multipleChoiceSelect",t.appearance)},r.requireSelection&&ze.createElement("option",{key:Rt,value:Rt},"Select an option"),(u=r.props.options)==null?void 0:u.map(m=>ze.createElement("option",{key:m.id,value:m.id},m.title))),((w=(h=r.props.options)==null?void 0:h.find(m=>m.id===s))==null?void 0:w.isOpenEnded)&&ze.createElement(ze.Fragment,null,ze.createElement(nt,{title:((C=(b=r.props.options)==null?void 0:b.find(m=>m.id===s))==null?void 0:C.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),ze.createElement(Eo,{type:"text",placeholder:"Enter your answer here",onChange:m=>{o({choice:[m.target.value]})},appearance:t.appearance})))}import Bo,{useEffect as fr,useState as gr}from"react";import hr from"styled-components";var il=hr.div`
|
|
219
219
|
display: flex;
|
|
220
220
|
flex-direction: column;
|
|
221
221
|
width: 100%;
|
|
222
222
|
-webkit-appearance: none;
|
|
223
223
|
appearance: none;
|
|
224
224
|
`,nl=hr.button`
|
|
225
|
-
${e=>
|
|
225
|
+
${e=>F(e)} {
|
|
226
226
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
227
227
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
228
228
|
font-size: 14px;
|
|
@@ -244,7 +244,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
244
244
|
padding: 0 18px;
|
|
245
245
|
margin-bottom: 10px;
|
|
246
246
|
`;function xr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n}){var l;let i=e,[r,s]=gr(n.choice||[]),[p,d]=gr(!1);return fr(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[]),fr(()=>{o({choice:r})},[r]),Bo.createElement(il,null,Bo.createElement(nt,{title:i.title,required:i.required,appearance:t.appearance}),(l=i.props.options)==null?void 0:l.map(f=>Bo.createElement(nl,{appearance:t.appearance,key:f.id,value:f.id,"data-selected":r.includes(f.id),onClick:()=>{if(r.includes(f.id)){s(r.filter(u=>u!==f.id));return}r.length<i.props.maxChoices?s([...r,f.id]):r.length==1&&i.props.maxChoices==1&&s([f.id])}},f.title)))}import eo from"react";import Cr from"styled-components";import sl from"dompurify";function se(e){return{__html:sl.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var ll=Cr.h1`
|
|
247
|
-
${e=>
|
|
247
|
+
${e=>F(e)} {
|
|
248
248
|
font-style: normal;
|
|
249
249
|
font-weight: 600;
|
|
250
250
|
font-size: ${e=>e.size=="small"?"15px":"18px"};
|
|
@@ -255,23 +255,23 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
255
255
|
color: ${e=>e.appearance.theme.colorText};
|
|
256
256
|
}
|
|
257
257
|
`,al=Cr.h2`
|
|
258
|
-
${e=>
|
|
258
|
+
${e=>F(e)} {
|
|
259
259
|
font-style: normal;
|
|
260
260
|
font-weight: 400;
|
|
261
261
|
font-size: 15px;
|
|
262
262
|
line-height: 20px;
|
|
263
263
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
264
264
|
}
|
|
265
|
-
`;function Te({appearance:e,title:t,subtitle:o,size:n="medium"}){return eo.createElement(eo.Fragment,null,eo.createElement(ll,{appearance:e,className:a(`${n}Title`,e),dangerouslySetInnerHTML:se(t),size:n}),eo.createElement(al,{appearance:e,className:a(`${n}Subtitle`,e),dangerouslySetInnerHTML:se(o),size:n}))}var dl=
|
|
265
|
+
`;function Te({appearance:e,title:t,subtitle:o,size:n="medium"}){return eo.createElement(eo.Fragment,null,eo.createElement(ll,{appearance:e,className:a(`${n}Title`,e),dangerouslySetInnerHTML:se(t),size:n}),eo.createElement(al,{appearance:e,className:a(`${n}Subtitle`,e),dangerouslySetInnerHTML:se(o),size:n}))}var dl=Sr.div`
|
|
266
266
|
display: flex;
|
|
267
267
|
flex-direction: column;
|
|
268
268
|
justify-content: flex-end;
|
|
269
269
|
padding-bottom: 14px;
|
|
270
270
|
overflow: visible;
|
|
271
|
-
`,cl=
|
|
271
|
+
`,cl=Sr.div`
|
|
272
272
|
padding-left: 1px;
|
|
273
273
|
padding-right: 1px;
|
|
274
|
-
`,ml={text:pr,multipleChoice:ur,multipleChoiceList:xr};function br({stepData:e,canContinue:t,setCanContinue:o,onSaveData:n,appearance:i,customFormElements:r}){var C;let s=e.props,[p,d]=
|
|
274
|
+
`,ml={text:pr,multipleChoice:ur,multipleChoiceList:xr};function br({stepData:e,canContinue:t,setCanContinue:o,onSaveData:n,appearance:i,customFormElements:r}){var C;let s=e.props,[p,d]=yr(w()||{}),[l,f]=yr([]),u={...ml,...r};pl(()=>{o(l.length===0)},[l,o]);function h(m,v){let T={...p,[m.id]:v};d(T),n(T),window&&window.localStorage&&window.localStorage.setItem(b(),JSON.stringify(T))}function w(){if(window&&window.localStorage){let m=window.localStorage.getItem(b());if(m)return JSON.parse(m)}return{}}function b(){return`frigade-multiInputStepTypeData-${e.id}`}return to.createElement(cl,{className:a("multiInput",i)},to.createElement(Te,{appearance:i,title:e.title,subtitle:e.subtitle}),to.createElement(dl,{className:a("multiInputContainer",i)},(C=s.data)==null?void 0:C.map(m=>u[m.type]?to.createElement("span",{key:m.id},u[m.type]({formInput:m,customFormTypeProps:{stepData:e,canContinue:t,setCanContinue:o,onSaveData:n,appearance:i},onSaveInputData:v=>{h(m,v)},inputData:p[m.id],setFormValidationErrors:v=>{f(T=>v.length===0?T.filter(B=>B.id!==m.id):[...T,...v])}})):null)))}import xt from"styled-components";var wr=xt.div`
|
|
275
275
|
align-items: center;
|
|
276
276
|
display: flex;
|
|
277
277
|
justify-content: space-between;
|
|
@@ -310,7 +310,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
310
310
|
`;import Ot from"react";import ul from"react";import Ir from"styled-components";var fl=Ir.button`
|
|
311
311
|
justify-content: center;
|
|
312
312
|
align-content: center;
|
|
313
|
-
${e=>
|
|
313
|
+
${e=>F(e)} {
|
|
314
314
|
display: flex;
|
|
315
315
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
316
316
|
width: ${e=>e.type==="full-width"?"100%":"auto"};
|
|
@@ -338,7 +338,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
338
338
|
cursor: not-allowed;
|
|
339
339
|
}
|
|
340
340
|
`,oo=Ir.div`
|
|
341
|
-
${e=>
|
|
341
|
+
${e=>F(e)} {
|
|
342
342
|
display: flex;
|
|
343
343
|
flex-direction: row;
|
|
344
344
|
justify-content: flex-start;
|
|
@@ -354,7 +354,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
354
354
|
flex-wrap: wrap;
|
|
355
355
|
align-content: center;
|
|
356
356
|
justify-content: center;
|
|
357
|
-
`,
|
|
357
|
+
`,yl=Ct.div`
|
|
358
358
|
align-content: center;
|
|
359
359
|
align-items: center;
|
|
360
360
|
display: flex;
|
|
@@ -368,7 +368,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
368
368
|
flex-basis: 255px;
|
|
369
369
|
flex-grow: 0;
|
|
370
370
|
flex-shrink: 0;
|
|
371
|
-
`,
|
|
371
|
+
`,Sl=Ct.img`
|
|
372
372
|
width: 78px;
|
|
373
373
|
height: auto;
|
|
374
374
|
`,bl=Ct.button`
|
|
@@ -397,7 +397,7 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
397
397
|
margin-top: 12px;
|
|
398
398
|
margin-bottom: 16px;
|
|
399
399
|
max-width: 70%;
|
|
400
|
-
`;function Ar({stepData:e,appearance:t}){var n,i;let{handleUrl:o}=le();return st.createElement("div",null,st.createElement(wl,null,e.title),st.createElement(Tl,null,e.subtitle),st.createElement(Cl,null,(i=(n=e.props)==null?void 0:n.links)==null?void 0:i.map(r=>st.createElement(
|
|
400
|
+
`;function Ar({stepData:e,appearance:t}){var n,i;let{handleUrl:o}=le();return st.createElement("div",null,st.createElement(wl,null,e.title),st.createElement(Tl,null,e.subtitle),st.createElement(Cl,null,(i=(n=e.props)==null?void 0:n.links)==null?void 0:i.map(r=>st.createElement(yl,{key:r.title},st.createElement(Sl,{src:r.imageUri}),st.createElement(bl,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{r.uri&&o(r.uri,r.uriTarget??"_blank")}},r.title)))))}import St,{useEffect as Bl}from"react";import no from"styled-components";import No from"react";var ro=({style:e,className:t})=>No.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},No.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),No.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 Lt,{useRef as Fl,useState as kl}from"react";import io from"styled-components";var Pl=io.div`
|
|
401
401
|
display: flex;
|
|
402
402
|
align-items: center;
|
|
403
403
|
justify-content: flex-start;
|
|
@@ -434,31 +434,31 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
434
434
|
height: 100%;
|
|
435
435
|
min-height: 200px;
|
|
436
436
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
437
|
-
`;function
|
|
438
|
-
${e=>
|
|
437
|
+
`;function yt({appearance:e,videoUri:t}){let o=Fl(),[n,i]=kl(!1);if(t.includes("youtube")){let r=t.split("v=")[1],s=r.indexOf("&");return s!==-1&&(r=r.substring(0,s)),Lt.createElement(El,{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 Lt.createElement(Pl,{appearance:e},!n&&Lt.createElement(vl,{onClick:()=>{i(!0),o.current.play()},appearance:e},Lt.createElement(ro,null)),Lt.createElement(Il,{appearance:e,controls:n,ref:o,play:n,src:t}))}var Al=no.div`
|
|
438
|
+
${e=>F(e)} {
|
|
439
439
|
display: flex;
|
|
440
440
|
flex-direction: column;
|
|
441
441
|
justify-content: center;
|
|
442
442
|
}
|
|
443
443
|
`,Nl=no.img`
|
|
444
|
-
${e=>
|
|
444
|
+
${e=>F(e)} {
|
|
445
445
|
width: 100%;
|
|
446
446
|
height: auto;
|
|
447
447
|
max-height: 250px;
|
|
448
448
|
margin-bottom: 24px;
|
|
449
449
|
}
|
|
450
450
|
`,Ol=no.div`
|
|
451
|
-
${e=>
|
|
451
|
+
${e=>F(e)} {
|
|
452
452
|
margin-bottom: 24px;
|
|
453
453
|
}
|
|
454
454
|
`,Ll=no.div`
|
|
455
|
-
${e=>
|
|
455
|
+
${e=>F(e)} {
|
|
456
456
|
width: 100%;
|
|
457
457
|
height: auto;
|
|
458
458
|
max-height: 250px;
|
|
459
459
|
margin-bottom: 24px;
|
|
460
460
|
}
|
|
461
|
-
`;function Nr({stepData:e,appearance:t,setCanContinue:o}){return Bl(()=>{o(!0)},[]),
|
|
461
|
+
`;function Nr({stepData:e,appearance:t,setCanContinue:o}){return Bl(()=>{o(!0)},[]),St.createElement(Al,{className:a("callToActionContainer",t)},St.createElement(Ol,{className:a("callToActionTextContainer",t)},St.createElement(Te,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&St.createElement(Nl,{className:a("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&St.createElement(Ll,{appearance:t,className:a("callToActionVideo",t)},St.createElement(yt,{appearance:t,videoUri:e.videoUri})))}import Ge,{useEffect as Oo,useState as Lo}from"react";import $t from"react";import Dt from"react";import{motion as Dl}from"framer-motion";var Or=({color:e,percentage:t,size:o})=>{let n=o*.5-2,i=2*Math.PI*n,r=(1-t)*i,s={duration:.3,delay:0,ease:"easeIn"},p={hidden:{strokeDashoffset:i,transition:s},show:{strokeDashoffset:r,transition:s}};return Dt.createElement(Dl.circle,{r:n,cx:o*.5,cy:o*.5,fill:"transparent",stroke:r!==i?e:"",strokeWidth:"3px",strokeDasharray:i,strokeDashoffset:t?r:0,variants:p,transition:s,initial:"hidden",animate:"show"})},Ml=({fillColor:e,size:t,percentage:o,children:n,bgColor:i="#D9D9D9"})=>Dt.createElement("svg",{width:t,height:t,overflow:"visible"},Dt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},Dt.createElement(Or,{color:i,size:t}),Dt.createElement(Or,{color:e,percentage:o,size:t})),n),Mt=Ml;import $l from"styled-components";var Ul=({color:e="#FFFFFF"})=>$t.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},$t.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),_l={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},Wl={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},Hl={border:"1px solid #000000",color:"#FFFFFF"},zl={border:"1px solid #E6E6E6"},Gl={color:"#FFFFFF"},jl={border:"3px solid #D9D9D9"},Vl=e=>e==="square"?_l:Wl,ql=(e,t)=>e==="square"?t?Hl:zl:t?Gl:jl,Kl=$l.div`
|
|
462
462
|
${e=>it(e)}
|
|
463
463
|
`,bt=({value:e,type:t="square",primaryColor:o="#000000",progress:n,appearance:i})=>{let r=Vl(t),s=ql(t,e);return e===!0?r={...r,...s,backgroundColor:o,borderColor:t==="square"?o:"none"}:r={...r,...s},e!==!0&&t==="round"&&n!==void 0&&n!==1?$t.createElement(Mt,{fillColor:o,percentage:n,size:22}):$t.createElement(Kl,{styleOverrides:r,role:"checkbox",className:Ce(a("checkIconContainer",i),e?"checkIconContainerChecked":"checkIconContainerUnchecked")},e&&$t.createElement(Ul,{color:"#FFFFFF"}))};import Je from"styled-components";var Lr=Je.div`
|
|
464
464
|
width: auto;
|
|
@@ -513,8 +513,8 @@ import at,{createContext as na,useEffect as Uo,useState as ve}from"react";import
|
|
|
513
513
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
514
514
|
display: flex;
|
|
515
515
|
align-self: center;
|
|
516
|
-
`;var zr=({stepData:e,setCanContinue:t,onSaveData:o,appearance:n})=>{let i=e.props,[r,s]=Lo([]),[p,d]=Lo(!1),[l,f]=Lo(e.id);return Oo(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),Oo(()=>{l!==e.id&&(f(e.id),s([]))},[e]),Oo(()=>{o({choice:r}),r.length>=i.minChoices?t(!0):t(!1)},[r]),Ge.createElement(Lr,{className:a("selectListContainer",n)},Ge.createElement(Dr,null,Ge.createElement(Mr,{className:a("selectListTitle",n)},e.title),Ge.createElement($r,{appearance:n,className:a("selectListSubtitle",n)},e.subtitle)),i.options.map((u,
|
|
517
|
-
${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map(([s,p])=>`${Fo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Ut.createElement(o,{inlineStyles:t})}var Gr=({flowId:e,customStepTypes:t={},type:o="inline",visible:n,setVisible:i,customVariables:r,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:l=!0,onStepCompletion:f,onButtonClick:u,dismissible:
|
|
516
|
+
`;var zr=({stepData:e,setCanContinue:t,onSaveData:o,appearance:n})=>{let i=e.props,[r,s]=Lo([]),[p,d]=Lo(!1),[l,f]=Lo(e.id);return Oo(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),Oo(()=>{l!==e.id&&(f(e.id),s([]))},[e]),Oo(()=>{o({choice:r}),r.length>=i.minChoices?t(!0):t(!1)},[r]),Ge.createElement(Lr,{className:a("selectListContainer",n)},Ge.createElement(Dr,null,Ge.createElement(Mr,{className:a("selectListTitle",n)},e.title),Ge.createElement($r,{appearance:n,className:a("selectListSubtitle",n)},e.subtitle)),i.options.map((u,h)=>{let w=r.includes(u.id);return Ge.createElement(Ur,{key:`select-item-${h}`,onClick:()=>{if(r.includes(u.id)){s(r.filter(b=>b!==u.id));return}r.length<i.maxChoices?s([...r,u.id]):r.length==1&&i.maxChoices==1&&s([u.id])},hideBottomBorder:h===i.options.length-1,className:a("selectListSelectItem",n)},Ge.createElement(_r,{className:a("selectListItemImage",n)},u.imageUri&&Ge.createElement(Wr,{src:u.imageUri,alt:`select-icon-${h}`}),Ge.createElement(Hr,{appearance:n,className:a("selectListSelectItemText",n)},u.title)),Ge.createElement(bt,{appearance:n,value:w,primaryColor:n.theme.colorPrimary}))}))};import ue,{useEffect as Yl,useState as Do}from"react";import{AnimatePresence as Xl,motion as Jl}from"framer-motion";var Ql=({children:e,id:t,shouldWrap:o=!1})=>ue.createElement(ue.Fragment,null,o?ue.createElement(Xl,{initial:!1},ue.createElement(Jl.div,{key:t,initial:{opacity:1,y:"100%"},animate:{opacity:1,y:0},exit:{opacity:0,y:"-100%"},transition:{duration:.5,ease:"easeInOut"},style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e)):e),so=({appearance:e,steps:t,selectedStep:o,customStepTypes:n,customVariables:i,onButtonClick:r,onStepCompletion:s,flowId:p,type:d,hideOnFlowCompletion:l,onComplete:f,setVisible:u,setShowModal:h,onDismiss:w,showPagination:b=!1,customFormElements:C,allowBackNavigation:m})=>{let T={...{linkCollection:Ar,multiInput:br,callToAction:Nr,selectList:zr},...n},{primaryCTAClickSideEffects:B,secondaryCTAClickSideEffects:k}=le(),[c,g]=Do(!1),[S,E]=Do({}),[U,M]=Do(!1),_=t[o]??null,{markStepCompleted:O,markStepStarted:H,isLoading:N,updateCustomVariables:j,markFlowCompleted:K}=X();Yl(()=>{j(i)},[i,N]);function V(){return{data:S[t[o].id]??{},stepId:t[o].id,customVariables:i}}function z($,J,A){let q=o+1<t.length?t[o+1]:null;r&&r($,o,J,q),s&&s($,A,q,S,V())}function te($,J){E(A=>{let q={};return q[$.id]=J,{...A,...q}})}function oe($){return $.selectedStep.imageUri?ue.createElement(vr,{image:$.selectedStep.imageUri,appearance:e,className:a("formContainerSidebarImage",e)}):null}let Z=ue.createElement(Er,{step:t[o],canContinue:c||!U,formType:d,selectedStep:o,appearance:e,onPrimaryClick:async()=>{M(!0);let $={...V()};await O(p,t[o].id,$),o+1<t.length&&await H(p,t[o+1].id),z(t[o],"primary",o),o+1>=t.length&&(f&&f(),w&&w(),l&&(u&&u(!1),h(!1)),await K(p)),B(t[o]),M(!1)},onSecondaryClick:()=>{z(t[o],"secondary",o),k(t[o])},onBack:async()=>{o-1>=0&&(M(!0),await H(p,t[o-1].id),M(!1))},steps:t,allowBackNavigation:m});return ue.createElement(ue.Fragment,null,ue.createElement(Fr,{className:a("formContainer",e)},ue.createElement(kr,null,ue.createElement(Ql,{id:o,shouldWrap:d==="large-modal"},ue.createElement(Pr,{key:_.id,type:d,className:a("formContent",e)},t.map($=>{let J=T[$.type];return _.id!==$.id?null:ue.createElement(J,{key:$.id,stepData:$,canContinue:c,setCanContinue:g,onSaveData:A=>{te($,A)},appearance:e,customFormElements:C})}),b&&ue.createElement(Br,{className:a("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),Z))),d=="large-modal"&&ue.createElement(oe,{selectedStep:t[o]})))};import Ut from"react";import{createGlobalStyle as Zl}from"styled-components";function pe({appearance:e}){if(!e||!e.styleOverrides)return Ut.createElement(Ut.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([n,i])=>typeof i=="object");if(t.length===0)return Ut.createElement(Ut.Fragment,null);let o=Zl`
|
|
517
|
+
${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map(([s,p])=>`${Fo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Ut.createElement(o,{inlineStyles:t})}var Gr=({flowId:e,customStepTypes:t={},type:o="inline",visible:n,setVisible:i,customVariables:r,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:l=!0,onStepCompletion:f,onButtonClick:u,dismissible:h=!0,endFlowOnDismiss:w=!1,modalPosition:b="center",repeatable:C=!1,onDismiss:m,showPagination:v=!1,allowBackNavigation:T=!1})=>{let{getFlow:B,getFlowSteps:k,isLoading:c,targetingLogicShouldHideFlow:g,getFlowStatus:S,getCurrentStepIndex:E,markFlowCompleted:U,markFlowNotStarted:M}=X(),_=E(e),{mergeAppearanceWithDefault:O}=Q(),[H,N]=ea(!1),{setOpenFlowState:j,getOpenFlowState:K}=ke();d=O(d);let[V,z]=n!==void 0&&i!==void 0?[n,i]:[K(e,!0),$=>j(e,$)];if(Rl(()=>{!H&&!c&&(N(!0),S(e)===R&&C&&M(e),N(!0))},[H,N,c]),c)return null;let te=B(e);if(!te||g(te))return null;let oe=k(e);if(!oe||n!==void 0&&n===!1||S(e)===R&&l)return null;let Z=()=>{z(!1),m&&m(),w===!0&&U(e)};if(b=="center"&&o==="modal"||o==="large-modal"){let $={padding:"24px"};return o==="large-modal"?($.width="85%",$.height="90%",$.maxHeight="800px",$.minHeight="500px",$.padding="0"):$.width="400px",Oe.createElement(Ye,{appearance:d,onClose:Z,visible:V,style:$,dismissible:h},Oe.createElement(pe,{appearance:d}),Oe.createElement(so,{appearance:d,steps:oe,selectedStep:_,customStepTypes:t,customVariables:r,onButtonClick:u,onStepCompletion:f,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:i,setShowModal:z,onDismiss:m,showPagination:v,customFormElements:s,allowBackNavigation:T}))}return o==="modal"&&b!=="center"?Oe.createElement(ir,{appearance:d,onClose:Z,visible:V},Oe.createElement(pe,{appearance:d}),Oe.createElement(so,{appearance:d,steps:oe,selectedStep:_,customStepTypes:t,customVariables:r,onButtonClick:u,onStepCompletion:f,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:i,setShowModal:z,onDismiss:m,showPagination:v,customFormElements:s,allowBackNavigation:T})):Oe.createElement(Oe.Fragment,null,Oe.createElement(pe,{appearance:d}),Oe.createElement(so,{appearance:d,steps:oe,selectedStep:_,customStepTypes:t,customVariables:r,onButtonClick:u,onStepCompletion:f,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:i,setShowModal:z,onDismiss:m,showPagination:v,customFormElements:s,allowBackNavigation:T}))},jr=Gr;import{useCallback as Vr,useContext as ta,useEffect as oa}from"react";function Mo(){let{organizationId:e,userId:t,setOrganizationId:o}=ta(G),{mutateUserFlowState:n}=we(),{config:i}=Ne(),r=ft(),{verifySDKInitiated:s}=gt();oa(()=>{if(t&&e){if(t.startsWith(ht))return;let l=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(l)||(r(`${ge}userGroups`,{...i,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(l,"true"))}},[t,e]);let p=Vr(async l=>{if(s(),!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let f={foreignUserId:t,foreignUserGroupId:e,properties:l};await r(`${ge}userGroups`,{...i,method:"POST",body:JSON.stringify(f)}),n()},[e,t,i,n]),d=Vr(async(l,f)=>{if(s(),!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let h={foreignUserId:t,foreignUserGroupId:e,events:[{event:l,properties:f}]};await r(`${ge}userGroups`,{...i,method:"POST",body:JSON.stringify(h)}),n()},[e,t,i,n]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:p,trackEventForOrganization:d}}var qr="xFrigade_guestUserId",Kr="xFrigade_userId",Yr=({})=>{let{setFlowResponses:e}=At(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:n}=we(),{userId:i,setUserId:r}=To(),[s,p]=$o(null),{getFlowStatus:d}=X(),{flows:l,userProperties:f,setIsNewGuestUser:u,flowResponses:h}=ra(G),[w,b]=$o([]),[C,m]=$o([]),{organizationId:v}=Mo();lo(()=>{if(!o&&t)for(let c=0;c<t.length;c++){let g=t[c],S=l.find(E=>E.slug===(g==null?void 0:g.flowId));if(S&&g&&g.shouldTrigger===!0&&S.type=="FORM"&&S.triggerType==="AUTOMATIC"&&!C.includes(S.slug)){setTimeout(()=>{T(g.flowId)},500);break}}},[o,t]),lo(()=>{h.length>0&&n()},[h]);function T(c){let g=l.find(S=>S.slug===c);g&&g.triggerType==="AUTOMATIC"&&!C.includes(g.slug)&&(m([...C,g.slug]),b([g]))}function B(){if(!i){let c=localStorage.getItem(Kr);if(c){r(c);return}let g=localStorage.getItem(qr);if(g){r(g);return}u(!0);let S=ht+ia();try{localStorage.setItem(qr,S)}catch(E){console.log("Failed to save guest user id locally: Local storage unavailable",E)}r(E=>E||S)}}lo(()=>{try{if(l){let c=[];l.forEach(g=>{if(g.data){let S=g.data.match(/"imageUri":"(.*?)"/g);S&&S.forEach(E=>{let U=E.replace('"imageUri":"',"").replace('"',"");if(c.includes(U))return;let M=new Image;M.src=U,c.push(U)})}})}}catch{}},[l]),lo(()=>{if(i!==s&&e([]),p(i),i&&!i.startsWith(ht))try{localStorage.setItem(Kr,i)}catch(c){console.log("Failed to save user id locally: Local storage available",c)}i===null&&setTimeout(()=>{i===null&&B()},50)},[i,l,f]);function k(){return lt.createElement(lt.Fragment,null,w.map(c=>d(c.slug)!==Ae?null:lt.createElement("span",{key:c.slug},lt.createElement(jr,{flowId:c.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return lt.createElement(lt.Fragment,null,lt.createElement(k,null))};var ao={theme:{colorPrimary:"#000000",colorText:"#000000",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#505050",colorTextDisabled:"#999999",colorBorder:"#E5E5E5",borderRadius:20}};import{ErrorBoundary as la}from"react-error-boundary";var G=na({publicApiKey:"",setUserId:()=>{},flows:[],setFlows:()=>{},failedFlowResponses:[],setFailedFlowResponses:()=>{},flowResponses:[],setFlowResponses:()=>{},userProperties:{},setUserProperties:()=>{},openFlowStates:{},setOpenFlowStates:()=>{},customVariables:{},setCustomVariables:()=>{},isNewGuestUser:!1,setIsNewGuestUser:()=>{},hasActiveFullPageFlow:!1,setHasActiveFullPageFlow:()=>{},organizationId:"",setOrganizationId:()=>{},navigate:()=>{},defaultAppearance:ao,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{}}),aa=({publicApiKey:e,userId:t,organizationId:o,config:n,children:i})=>{var N,j;let[r,s]=ve(t||null),[p,d]=ve(o||null),[l,f]=ve([]),[u,h]=ve([]),[w,b]=ve([]),[C,m]=ve({}),[v,T]=ve({}),[B,k]=ve({}),[c,g]=ve(!1),[S,E]=ve(!1),[U,M]=ve(!H(e)),_=(K,V)=>{if(V==="_blank"){window.open(K,"_blank");return}setTimeout(()=>{window.location.href=K},50)},O={theme:{...ao.theme,...((N=n==null?void 0:n.defaultAppearance)==null?void 0:N.theme)??{}},styleOverrides:{...ao.styleOverrides,...((j=n==null?void 0:n.defaultAppearance)==null?void 0:j.styleOverrides)??{}}};function H(K){return!!(K&&K.length>10&&K.substring(0,10)==="api_public")}return Uo(()=>{t&&s(t)},[t]),Uo(()=>{o&&d(o)},[o]),Uo(()=>{if(H(e))M(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),M(!0);return}},[e,M]),U?at.createElement(G.Provider,{value:{publicApiKey:e,userId:r,setUserId:s,setFlows:f,flows:l,failedFlowResponses:u,setFailedFlowResponses:h,flowResponses:w,setFlowResponses:b,userProperties:C,setUserProperties:m,openFlowStates:v,setOpenFlowStates:T,customVariables:B,setCustomVariables:k,isNewGuestUser:c,setIsNewGuestUser:g,hasActiveFullPageFlow:S,setHasActiveFullPageFlow:E,organizationId:p,setOrganizationId:d,navigate:n&&n.navigate?n.navigate:_,defaultAppearance:O,shouldGracefullyDegrade:U,setShouldGracefullyDegrade:M}},i):at.createElement(la,{fallback:at.createElement(at.Fragment,null,i)},at.createElement(G.Provider,{value:{publicApiKey:e,userId:r,setUserId:s,setFlows:f,flows:l,failedFlowResponses:u,setFailedFlowResponses:h,flowResponses:w,setFlowResponses:b,userProperties:C,setUserProperties:m,openFlowStates:v,setOpenFlowStates:T,customVariables:B,setCustomVariables:k,isNewGuestUser:c,setIsNewGuestUser:g,hasActiveFullPageFlow:S,setHasActiveFullPageFlow:E,organizationId:p,setOrganizationId:d,navigate:n&&n.navigate?n.navigate:_,defaultAppearance:O,shouldGracefullyDegrade:U,setShouldGracefullyDegrade:M}},at.createElement(sa,{theme:O.theme},i,at.createElement(Yr,null))))};import np from"react";import ne,{useEffect as kn,useState as Pn}from"react";import Ie,{useState as Ba}from"react";import dt from"styled-components";import uo from"react";import po from"react";import Jr from"styled-components";var Xr=Jr.span`
|
|
518
518
|
font-weight: 400;
|
|
519
519
|
font-size: 15px;
|
|
520
520
|
line-height: 20px;
|
|
@@ -578,11 +578,11 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
578
578
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
579
579
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
580
580
|
${e=>it(e)}
|
|
581
|
-
`,ha={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},xa={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},Le=({count:e,total:t,fillColor:o,bgColor:n=ma.backgroundColor,display:i="count",textLocation:r="left",style:s={},textStyle:p={},appearance:d})=>{var b,C;if(t===0)return pt.createElement(pt.Fragment,null);let l=e===0?"10px":`${e/t*100}%`,f=i==="compact"?"5px":"10px",u=Math.round(e/t*100),
|
|
581
|
+
`,ha={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},xa={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},Le=({count:e,total:t,fillColor:o,bgColor:n=ma.backgroundColor,display:i="count",textLocation:r="left",style:s={},textStyle:p={},appearance:d})=>{var b,C;if(t===0)return pt.createElement(pt.Fragment,null);let l=e===0?"10px":`${e/t*100}%`,f=i==="compact"?"5px":"10px",u=Math.round(e/t*100),h=i==="compact"?"5px":"20px",w;return i==="count"?w=`${e} of ${t}`:i==="compact"?w=`${u}%`:i==="percent"&&(w=`${u}% complete`),r==="top"&&(h="0px"),pt.createElement(ua,{className:a("progressBarContainer",d),textLocation:r,styleOverrides:s},pt.createElement(ga,{className:a("progressBarStepText",d),style:{...p,fontSize:i==="compact"?12:15,fontWeight:i==="compact"?400:500},appearance:d,padding:h,textLocation:r},w),pt.createElement(fa,{textLocation:r,className:a("progressBar",d)},pt.createElement(ca.div,{style:{...xa,width:l,height:f,backgroundColor:((b=d==null?void 0:d.theme)==null?void 0:b.colorPrimary)??o,zIndex:i=="compact"?1:5},className:a("progressBarFill",d)}),pt.createElement("div",{className:a("progressBarBackground",d),style:{...ha,height:f,backgroundColor:((C=d==null?void 0:d.theme)==null?void 0:C.colorSecondary)??n}})))};import Ht from"react";import Ca from"styled-components";import go from"react";import fo from"react";var wt=({stepData:e,appearance:t})=>fo.createElement(fo.Fragment,null,fo.createElement(Zr,{appearance:t,className:a("checklistStepTitle",t),dangerouslySetInnerHTML:se(e.title)}),fo.createElement(Rr,{appearance:t,className:a("checklistStepSubtitle",t),dangerouslySetInnerHTML:se(e.subtitle)}));import Wt from"react";var Tt=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},n=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return Wt.createElement(Wt.Fragment,null,Wt.createElement(oo,null,e.secondaryButtonTitle&&Wt.createElement(ee,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:n,style:{width:"auto",marginRight:"12px"}}),Wt.createElement(ee,{appearance:t,title:e.primaryButtonTitle,onClick:o})))};var Ft=({stepData:e,appearance:t})=>go.createElement(go.Fragment,null,go.createElement(wt,{stepData:e,appearance:t}),go.createElement(Tt,{stepData:e,appearance:t}));import oi from"react";function ri(e){if(e.videoUri.includes("youtube")){let t=e.videoUri.split("v=")[1],o=t.indexOf("&");return o!==-1&&(t=t.substring(0,o)),oi.createElement("iframe",{width:"480",height:"260",src:`https://www.youtube.com/embed/${t}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:a("checklistStepVideo",e.appearance)})}else return oi.createElement("video",{width:"480",height:"260",controls:!0,src:e.videoUri})}var Wo="default",ya=Ca.img`
|
|
582
582
|
border-radius: 4px;
|
|
583
583
|
max-height: 260px;
|
|
584
584
|
min-height: 200px;
|
|
585
|
-
`,ii=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Ht.createElement("div",null,o)}return Ht.createElement(Qr,{className:a("checklistStepContent",t)},e.imageUri?Ht.createElement(
|
|
585
|
+
`,ii=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Ht.createElement("div",null,o)}return Ht.createElement(Qr,{className:a("checklistStepContent",t)},e.imageUri?Ht.createElement(ya,{className:a("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Ht.createElement(ri,{videoUri:e.videoUri,appearance:t}):null,Ht.createElement(Ft,{stepData:e,appearance:t}))};import ye,{useRef as Sa,useState as ba}from"react";import kt from"styled-components";var ni=kt.div`
|
|
586
586
|
display: block;
|
|
587
587
|
`,wa=kt.div`
|
|
588
588
|
display: flex;
|
|
@@ -627,7 +627,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
627
627
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
628
628
|
border-radius: 50%;
|
|
629
629
|
}
|
|
630
|
-
`,si="videoCarousel",li=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.videos))return
|
|
630
|
+
`,si="videoCarousel",li=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.videos))return ye.createElement(ni,null,ye.createElement(Ft,{stepData:e,appearance:t}));function o({video:r}){let s=Sa(),[p,d]=ba(!1);return ye.createElement(Ta,null,!p&&ye.createElement(Pa,{onClick:()=>{d(!0),s.current.play()},appearance:t},ye.createElement(ro,null)),ye.createElement(Fa,{controls:p,ref:s,play:p,src:r.uri}),ye.createElement(ka,null,r.title))}let n=e.props;return n.videos?ye.createElement(ni,null,ye.createElement(wt,{stepData:e,appearance:t}),ye.createElement(wa,null,n.videos.map((r,s)=>ye.createElement("span",{key:`${r.uri}-${s}`},ye.createElement(o,{video:r})))),ye.createElement(Tt,{stepData:e,appearance:t})):null};import je from"react";import ho from"styled-components";var ai=ho.div`
|
|
631
631
|
display: block;
|
|
632
632
|
`,va=ho.pre`
|
|
633
633
|
display: block;
|
|
@@ -683,7 +683,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
683
683
|
`,Ma=dt.div`
|
|
684
684
|
flex: 2;
|
|
685
685
|
padding: 2rem;
|
|
686
|
-
`,$a=({title:e,subtitle:t,steps:o=[],style:n={},selectedStep:i,setSelectedStep:r,className:s="",customStepTypes:p=new Map,appearance:d,type:l})=>{let{mergeAppearanceWithDefault:f}=Q();d=f(d);let
|
|
686
|
+
`,$a=({title:e,subtitle:t,steps:o=[],style:n={},selectedStep:i,setSelectedStep:r,className:s="",customStepTypes:p=new Map,appearance:d,type:l})=>{let{mergeAppearanceWithDefault:f}=Q();d=f(d);let h={...{[Wo]:ii,[si]:li,[pi]:di},...p},[w,b]=Ba(0),C=i??w,m=r??b,v=o.filter(B=>B.complete===!0).length,T=()=>{var B;return!((B=o[C])!=null&&B.type)||!h[o[C].type]?h[Wo]({stepData:o[C],appearance:d}):h[o[C].type]({stepData:o[C],appearance:d})};return Ie.createElement(Aa,{type:l,style:n,className:s,appearance:d},Ie.createElement(ci,{style:{flex:1}},Ie.createElement(ci,{style:{padding:"30px 0px 30px 30px",borderBottom:"none"}},Ie.createElement(Na,{className:a("checklistTitle",d),appearance:d},e),Ie.createElement(Oa,{className:a("checklistSubtitle",d),appearance:d},t),Ie.createElement(Le,{total:o.length,count:v,fillColor:d.theme.colorPrimary,style:{marginTop:"24px"},appearance:d})),Ie.createElement(La,{className:a("checklistStepsContainer",d)},o.map((B,k)=>Ie.createElement(ti,{data:B,index:k,key:k,listLength:o.length,isSelected:k===C,primaryColor:d.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{m(k)}})))),Ie.createElement(Da,{appearance:d,className:a("checklistDivider",d)}),Ie.createElement(Ma,null,Ie.createElement(T,null)))},Ho=$a;import L,{useState as Ga}from"react";import mi from"react";import Ua from"styled-components";var _a=Ua.svg`
|
|
687
687
|
transition: 'transform 0.35s ease-in-out';
|
|
688
688
|
`,Pt=({color:e="#323232",style:t,className:o})=>mi.createElement(_a,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},mi.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as ja}from"framer-motion";import ae from"styled-components";var zo={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},ui=ae.div`
|
|
689
689
|
max-height: 350px;
|
|
@@ -707,7 +707,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
707
707
|
padding-left: 1px;
|
|
708
708
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
709
709
|
`,xi=ae.div`
|
|
710
|
-
${e=>
|
|
710
|
+
${e=>F(e)} {
|
|
711
711
|
border: 1px solid #fafafa;
|
|
712
712
|
}
|
|
713
713
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
@@ -720,8 +720,8 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
720
720
|
display: flex;
|
|
721
721
|
flex-direction: row;
|
|
722
722
|
justify-content: space-between;
|
|
723
|
-
`,
|
|
724
|
-
${e=>
|
|
723
|
+
`,yi=ae.p`
|
|
724
|
+
${e=>F(e)} {
|
|
725
725
|
font-weight: 400;
|
|
726
726
|
font-size: 10px;
|
|
727
727
|
line-height: 12px;
|
|
@@ -729,13 +729,13 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
729
729
|
color: #8c8c8c;
|
|
730
730
|
margin: 20px;
|
|
731
731
|
}
|
|
732
|
-
`,
|
|
732
|
+
`,Si=ae.div`
|
|
733
733
|
display: flex;
|
|
734
734
|
flex-direction: row;
|
|
735
735
|
`,bi=ae.div`
|
|
736
736
|
flex: 1;
|
|
737
737
|
`,wi=ae.div`
|
|
738
|
-
${e=>
|
|
738
|
+
${e=>F(e)} {
|
|
739
739
|
display: flex;
|
|
740
740
|
justify-content: center;
|
|
741
741
|
align-content: center;
|
|
@@ -745,7 +745,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
745
745
|
padding-right: 8px;
|
|
746
746
|
}
|
|
747
747
|
`,Ti=ae.p`
|
|
748
|
-
${e=>
|
|
748
|
+
${e=>F(e)} {
|
|
749
749
|
font-style: normal;
|
|
750
750
|
font-weight: 600;
|
|
751
751
|
font-size: 22px;
|
|
@@ -757,7 +757,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
757
757
|
margin-bottom: 16px;
|
|
758
758
|
}
|
|
759
759
|
`,Fi=ae.p`
|
|
760
|
-
${e=>
|
|
760
|
+
${e=>F(e)} {
|
|
761
761
|
font-weight: 400;
|
|
762
762
|
font-size: 14px;
|
|
763
763
|
line-height: 18px;
|
|
@@ -766,14 +766,14 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
766
766
|
margin-bottom: 8px;
|
|
767
767
|
}
|
|
768
768
|
`,ki=ae.div`
|
|
769
|
-
${e=>
|
|
769
|
+
${e=>F(e)} {
|
|
770
770
|
display: flex;
|
|
771
771
|
flex-direction: row;
|
|
772
772
|
justify-content: center;
|
|
773
773
|
gap: 8px;
|
|
774
774
|
}
|
|
775
775
|
`,Pi=ae.div`
|
|
776
|
-
${e=>
|
|
776
|
+
${e=>F(e)} {
|
|
777
777
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
778
778
|
background-color: ${e=>e.selected?"#FAFAFA":"#FFFFFF"};
|
|
779
779
|
:hover {
|
|
@@ -793,7 +793,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
793
793
|
position: relative;
|
|
794
794
|
cursor: pointer;
|
|
795
795
|
`,vi=ae.p`
|
|
796
|
-
${e=>
|
|
796
|
+
${e=>F(e)} {
|
|
797
797
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
798
798
|
color: ${e=>e.selected?"#434343":"#BFBFBF"};
|
|
799
799
|
}
|
|
@@ -836,7 +836,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
836
836
|
overflow: hidden;
|
|
837
837
|
row-gap: 10px;
|
|
838
838
|
`,Li=Ve.div`
|
|
839
|
-
${e=>
|
|
839
|
+
${e=>F(e)} {
|
|
840
840
|
color: #595959;
|
|
841
841
|
}
|
|
842
842
|
text-transform: uppercase;
|
|
@@ -846,7 +846,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
846
846
|
letter-spacing: 0.09em;
|
|
847
847
|
margin-bottom: 12px;
|
|
848
848
|
`,Di=Ve.div`
|
|
849
|
-
${e=>
|
|
849
|
+
${e=>F(e)} {
|
|
850
850
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
851
851
|
background: #ffffff;
|
|
852
852
|
border: 1px solid #fafafa;
|
|
@@ -859,7 +859,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
859
859
|
max-width: 150px;
|
|
860
860
|
min-width: 200px;
|
|
861
861
|
`,Mi=Ve.div`
|
|
862
|
-
${e=>
|
|
862
|
+
${e=>F(e)} {
|
|
863
863
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
864
864
|
}
|
|
865
865
|
width: 40px;
|
|
@@ -877,7 +877,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
877
877
|
width: 20px;
|
|
878
878
|
height: 20px;
|
|
879
879
|
`,Ui=Ve.div`
|
|
880
|
-
${e=>
|
|
880
|
+
${e=>F(e)} {
|
|
881
881
|
color: #434343;
|
|
882
882
|
}
|
|
883
883
|
font-weight: 600;
|
|
@@ -886,7 +886,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
886
886
|
margin-top: 12px;
|
|
887
887
|
margin-bottom: 8px;
|
|
888
888
|
`,_i=Ve.div`
|
|
889
|
-
${e=>
|
|
889
|
+
${e=>F(e)} {
|
|
890
890
|
color: #8c8c8c;
|
|
891
891
|
}
|
|
892
892
|
font-weight: 400;
|
|
@@ -898,7 +898,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
898
898
|
line-height: 14px;
|
|
899
899
|
font-weight: 400;
|
|
900
900
|
cursor: pointer;
|
|
901
|
-
`;var za=({steps:e,style:t,title:o,primaryColor:n,appearance:i,onButtonClick:r})=>{let{primaryCTAClickSideEffects:s}=le();return qe.createElement(Ni,{style:t,className:a("guideContainer",i)},qe.createElement(Li,{className:a("guideTitle",i)},o),qe.createElement(Oi,{className:a("guideItemContainer",i)},e.map((p,d)=>qe.createElement(Di,{key:`guide-${p.id??d}`,as:Ha.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:a("guideItem",i)},p.icon&&qe.createElement(Mi,{className:a("guideIcon",i)},qe.createElement($i,null,p.icon)),qe.createElement(Ui,{className:a("guideItemTitle",i),dangerouslySetInnerHTML:se(p.title)}),qe.createElement(_i,{className:a("guideItemSubtitle",i),dangerouslySetInnerHTML:se(p.subtitle)}),qe.createElement(Wi,{className:a("guideItemLink",i),color:n,onClick:()=>{p.primaryButtonUri&&s(p),r&&r(p)}},p.primaryButtonTitle)))))},zt=za;var Va=({steps:e,title:t,subtitle:o,stepsTitle:n,visible:i,onClose:r,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:l,guideData:f,guideTitle:u,onGuideButtonClick:
|
|
901
|
+
`;var za=({steps:e,style:t,title:o,primaryColor:n,appearance:i,onButtonClick:r})=>{let{primaryCTAClickSideEffects:s}=le();return qe.createElement(Ni,{style:t,className:a("guideContainer",i)},qe.createElement(Li,{className:a("guideTitle",i)},o),qe.createElement(Oi,{className:a("guideItemContainer",i)},e.map((p,d)=>qe.createElement(Di,{key:`guide-${p.id??d}`,as:Ha.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:a("guideItem",i)},p.icon&&qe.createElement(Mi,{className:a("guideIcon",i)},qe.createElement($i,null,p.icon)),qe.createElement(Ui,{className:a("guideItemTitle",i),dangerouslySetInnerHTML:se(p.title)}),qe.createElement(_i,{className:a("guideItemSubtitle",i),dangerouslySetInnerHTML:se(p.subtitle)}),qe.createElement(Wi,{className:a("guideItemLink",i),color:n,onClick:()=>{p.primaryButtonUri&&s(p),r&&r(p)}},p.primaryButtonTitle)))))},zt=za;var Va=({steps:e,title:t,subtitle:o,stepsTitle:n,visible:i,onClose:r,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:l,guideData:f,guideTitle:u,onGuideButtonClick:h})=>{let w=({stepData:g,handleSecondaryCTAClick:S,handleCTAClick:E})=>g?L.createElement(wi,{className:a("checklistStepContainer",l),"data-testid":"checklistStepContainer"},L.createElement(Ti,{appearance:l,className:a("checklistStepTitle",l),dangerouslySetInnerHTML:se(g.title)}),L.createElement(Fi,{appearance:l,className:a("checklistStepSubtitle",l),dangerouslySetInnerHTML:se(g.subtitle)}),L.createElement(ki,{className:a("checklistCTAContainer",l)},g.secondaryButtonTitle&&L.createElement(ee,{title:g.secondaryButtonTitle,onClick:S,appearance:l,secondary:!0}),L.createElement(ee,{title:g.primaryButtonTitle,onClick:E,appearance:l}))):L.createElement(L.Fragment,null),C={...{default:g=>{var M;if((M=e[T])!=null&&M.StepContent){let _=e[T].StepContent;return L.createElement("div",null,_)}let S=e[T];return L.createElement(w,{stepData:g,handleCTAClick:()=>{S.handlePrimaryButtonClick&&S.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{S.handleSecondaryButtonClick&&S.handleSecondaryButtonClick()}})}},...d},[m,v]=Ga(0),T=s??m,B=p??v,k=()=>{var g;return e?!((g=e[T])!=null&&g.type)||!C[e[T].type]?C.default(e[T]):C[e[T].type]({stepData:e[T],primaryColor:l.theme.colorPrimary}):L.createElement(L.Fragment,null)},c=e.filter(g=>g.complete).length;return i?(l.theme.modalContainer||(l.theme.borderRadius&&(zo.borderRadius=l.theme.borderRadius+"px"),l.theme.modalContainer=zo),L.createElement(Ye,{onClose:r,visible:i,appearance:l},L.createElement(Bi,null,L.createElement(fi,null,L.createElement(gi,{appearance:l,className:a("checklistTitle",l)},t),L.createElement(hi,{appearance:l,className:a("checklistSubtitle",l)},o)),L.createElement(ui,null,e&&e.length>0&&L.createElement(xi,{className:a("stepsContainer",l)},L.createElement(Ci,null,L.createElement("div",{style:{flex:3}},L.createElement(yi,{className:a("stepsTitle",l)},n)),L.createElement(Ei,null,L.createElement(Le,{fillColor:l.theme.colorPrimary,style:{width:"100%"},count:c,total:e.length,appearance:l}))),L.createElement(Si,null,L.createElement(bi,{className:a("checklistStepListContainer",l),appearance:l},e.map((g,S)=>{let E=T===S;return L.createElement(Pi,{selected:E,className:a(`checklistStepListItem${E?"Selected":""}`,l),key:`checklist-guide-step-${g.id??S}`,disabled:g.blocked,onClick:()=>{g.blocked||B(S)},title:g.blocked?"Finish remaining steps to continue":void 0},E&&L.createElement(mo,{className:a("checklistStepItemSelectedIndicator",l),as:ja.div,layoutId:"checklist-step-selected",style:{backgroundColor:l.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),L.createElement(vi,{selected:E,className:a(`checklistStepListStepName${E?"Selected":""}`,l)},g.stepName),L.createElement(Ii,null,L.createElement(bt,{value:g.complete,type:"round",primaryColor:l.theme.colorPrimary,progress:g.progress,appearance:l}),L.createElement(Ai,null,L.createElement(Pt,{style:{marginLeft:"10px"},color:l.theme.colorBackgroundSecondary}))))})),L.createElement(k,null))),f&&f.length>0&&L.createElement(zt,{steps:f,title:u,primaryColor:l.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:l,onButtonClick:g=>(h&&h(g),!0)}))))):L.createElement(L.Fragment,null)},Go=Va;import{useEffect as qa,useState as Ka}from"react";var Hi=()=>{let e={isSmall:"(max-width: 480px)",isMedium:"(min-width: 481px) AND (max-width: 1023px)",isLarge:"(min-width: 1025px)"},t=Object.fromEntries(Object.entries(e).map(([p])=>[p,!1])),[o,n]=Ka(t),i=null,r=()=>{i!==null?clearTimeout(i):s(),i=setTimeout(()=>{s()},16)},s=()=>{let p=Object.fromEntries(Object.entries(e).map(([d,l])=>{if(!window)return[d,!1];let f=window.matchMedia(l);return f.addEventListener("change",r),[d,f.matches]}));n(p)};return qa(()=>{s()},[]),o};import he,{useEffect as on,useState as Ja}from"react";import de from"react";import{AnimatePresence as Ya,motion as Xa}from"framer-motion";import Ke from"styled-components";var zi=Ke.div`
|
|
902
902
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
903
903
|
border: 1px solid;
|
|
904
904
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -945,7 +945,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
945
945
|
flex-direction: row;
|
|
946
946
|
justify-content: flex-start;
|
|
947
947
|
align-items: center;
|
|
948
|
-
`;var Ji=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:n,onSecondaryButtonClick:i,appearance:r})=>{var p,d;let s=t?{}:{transform:"rotate(90deg)"};return de.createElement(zi,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:a("checklistStepContainer",r),appearance:r},de.createElement(Vi,{className:a("stepHeader",r)},de.createElement(Xi,null,de.createElement(co,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(p=r==null?void 0:r.theme)==null?void 0:p.colorPrimary,appearance:r}),de.createElement(qi,{appearance:r,className:a("stepTitle",r),dangerouslySetInnerHTML:se(e.title)})),de.createElement(Ki,{className:a("stepChevronContainer",r),onClick:()=>o()},de.createElement(Pt,{style:{...s,transition:"transform 0.1s ease-in-out"},color:(d=r==null?void 0:r.theme)==null?void 0:d.colorTextSecondary}))),de.createElement(Ya,null,!t&&de.createElement(Xa.div,{initial:{opacity:1,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:0},key:e.id,style:{overflow:"hidden"}},e.imageUri||e.videoUri&&de.createElement(Gi,{className:a("stepMediaContainer",r)},e.imageUri?de.createElement(ji,{className:a("stepImage",r),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?de.createElement(
|
|
948
|
+
`;var Ji=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:n,onSecondaryButtonClick:i,appearance:r})=>{var p,d;let s=t?{}:{transform:"rotate(90deg)"};return de.createElement(zi,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:a("checklistStepContainer",r),appearance:r},de.createElement(Vi,{className:a("stepHeader",r)},de.createElement(Xi,null,de.createElement(co,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(p=r==null?void 0:r.theme)==null?void 0:p.colorPrimary,appearance:r}),de.createElement(qi,{appearance:r,className:a("stepTitle",r),dangerouslySetInnerHTML:se(e.title)})),de.createElement(Ki,{className:a("stepChevronContainer",r),onClick:()=>o()},de.createElement(Pt,{style:{...s,transition:"transform 0.1s ease-in-out"},color:(d=r==null?void 0:r.theme)==null?void 0:d.colorTextSecondary}))),de.createElement(Ya,null,!t&&de.createElement(Xa.div,{initial:{opacity:1,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:0},key:e.id,style:{overflow:"hidden"}},e.imageUri||e.videoUri&&de.createElement(Gi,{className:a("stepMediaContainer",r)},e.imageUri?de.createElement(ji,{className:a("stepImage",r),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?de.createElement(yt,{appearance:r,videoUri:e.videoUri}):null),de.createElement(Yi,{className:a("stepSubtitle",r),appearance:r,dangerouslySetInnerHTML:se(e.subtitle)}),de.createElement(oo,{className:a("checklistCTAContainer",r)},e.secondaryButtonTitle?de.createElement(ee,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>i(),appearance:r}):null,de.createElement(ee,{title:e.primaryButtonTitle??"Continue",onClick:()=>n(),appearance:r})))))};import vt from"styled-components";var gh=vt.div`
|
|
949
949
|
background: #ffffff;
|
|
950
950
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
951
951
|
border-radius: 6px;
|
|
@@ -985,7 +985,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
985
985
|
justify-content: space-between;
|
|
986
986
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
987
987
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
988
|
-
`;var Qa=({title:e,subtitle:t,steps:o,onClose:n,visible:i,onCompleteStep:r,autoExpandFirstIncompleteStep:s=!0,autoCollapse:p=!0,autoExpandNextStep:d=!0,primaryColor:l="#000000",selectedStep:f,setSelectedStep:u,appearance:
|
|
988
|
+
`;var Qa=({title:e,subtitle:t,steps:o,onClose:n,visible:i,onCompleteStep:r,autoExpandFirstIncompleteStep:s=!0,autoCollapse:p=!0,autoExpandNextStep:d=!0,primaryColor:l="#000000",selectedStep:f,setSelectedStep:u,appearance:h,type:w,className:b})=>{let C=o.filter(c=>c.complete).length,[m,v]=Ja(Array(o.length).fill(!0));on(()=>{let c=[...m];if(s){for(let g=0;g<o.length;g++)if(!o[g].complete){c[g]=!1;break}v(c)}},[]),on(()=>{T(f)},[f]);let T=c=>{let g=[...m];if(p)for(let S=0;S<m.length;++S)S!==c&&(g[S]=!0);g[c]=!g[c],v(g)};if(!i&&w=="modal")return he.createElement(he.Fragment,null);let B=he.createElement(he.Fragment,null,he.createElement(Qi,null,he.createElement(Zi,{appearance:h,className:a("checklistTitle",h),dangerouslySetInnerHTML:se(e)}),he.createElement(Ri,{appearance:h,className:a("checklistSubtitle",h),dangerouslySetInnerHTML:se(t)})),he.createElement(Le,{display:"percent",count:C,total:o.length,fillColor:l,style:{margin:"14px 0px 8px 0px"},appearance:h})),k=he.createElement(en,{className:Ce(a("checklistContainer",h),b)},o.map((c,g)=>{let S=m[g];return he.createElement(Ji,{appearance:h,stepData:c,collapsed:S,key:`modal-checklist-${c.id??g}`,onClick:()=>{if(f===g){T(g);return}u(g)},onPrimaryButtonClick:()=>{r&&r(g,c),c.handlePrimaryButtonClick&&c.handlePrimaryButtonClick(),d&&!c.completionCriteria&&g<m.length-1&&m[g+1]&&u(g+1)},onSecondaryButtonClick:()=>{c.handleSecondaryButtonClick&&c.handleSecondaryButtonClick()}})}));return w==="inline"?he.createElement(tn,{appearance:h,className:Ce(a("checklistInlineContainer",h),b)},B,k):he.createElement(he.Fragment,null,he.createElement(Ye,{onClose:n,visible:i,appearance:h,style:{maxWidth:"600px"},headerContent:B},k))},jo=Qa;import ie,{useEffect as Vo,useRef as rp,useState as mt}from"react";import ct from"react";import re,{css as rn,keyframes as nn}from"styled-components";var sn=rn`
|
|
989
989
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
990
990
|
`,Za=rn`
|
|
991
991
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
@@ -1066,7 +1066,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1066
1066
|
margin-bottom: 12px;
|
|
1067
1067
|
width: 40px;
|
|
1068
1068
|
`,fn=re(cn)`
|
|
1069
|
-
${e=>
|
|
1069
|
+
${e=>F(e)} {
|
|
1070
1070
|
${Za}
|
|
1071
1071
|
|
|
1072
1072
|
background: ${({theme:e})=>e.colorBackground};
|
|
@@ -1098,7 +1098,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1098
1098
|
line-height: 20px;
|
|
1099
1099
|
letter-spacing: calc(16px * -0.01);
|
|
1100
1100
|
margin: 0;
|
|
1101
|
-
`,
|
|
1101
|
+
`,yn=re(op)`
|
|
1102
1102
|
margin-bottom: 4px;
|
|
1103
1103
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1104
1104
|
`}
|
|
@@ -1108,7 +1108,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1108
1108
|
font-size: 14px;
|
|
1109
1109
|
line-height: 22px;
|
|
1110
1110
|
margin: 0;
|
|
1111
|
-
`,
|
|
1111
|
+
`,Sn=re.p`
|
|
1112
1112
|
color: ${({theme:e})=>e.colorText};
|
|
1113
1113
|
font-weight: 600;
|
|
1114
1114
|
font-size: 12px;
|
|
@@ -1120,7 +1120,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1120
1120
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1121
1121
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1122
1122
|
`}
|
|
1123
|
-
`;var bn=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:n}=Q(),{primaryCTAClickSideEffects:i}=le(),{theme:r,styleOverrides:s}=n(o),{imageUri:p=null,subtitle:d=null,title:l=null,complete:f=!1,blocked:u=!1}=e,
|
|
1123
|
+
`;var bn=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:n}=Q(),{primaryCTAClickSideEffects:i}=le(),{theme:r,styleOverrides:s}=n(o),{imageUri:p=null,subtitle:d=null,title:l=null,complete:f=!1,blocked:u=!1}=e,h=()=>{i(e)};return ct.createElement(mn,{className:a("carouselCard",o),onClick:u?null:h,style:t,blocked:u,complete:f},ct.createElement("div",{style:{alignItems:"flex-start",display:"flex",justifyContent:"space-between"}},p&&ct.createElement(un,{className:a("carouselCardImage",o),src:p,alt:l,style:{opacity:f||u?.4:1}}),f&&ct.createElement(xn,{className:a("carouselCompletedPill",o)},ct.createElement(Sn,{style:{color:"#108E0B"}},"Complete"))),l&&ct.createElement(yn,{blocked:u,complete:f,className:a("carouselCardTitle",o)},l),d&&ct.createElement(De.Quiet,{blocked:u,complete:f,className:a("carouselCardSubtitle",o)},d))};import Gt from"react";var wn=({numberOfStepsCompleted:e,numberOfSteps:t,appearance:o})=>{let n=t>0?e/t:0,i=200,r=Math.min(i,Math.max(10,Math.round(i*n)));return Gt.createElement(gn,{className:a("carouselProgressBar",o)},Gt.createElement(hn,{as:De.Loud,style:{marginRight:8}},e," of ",t),Gt.createElement("svg",{height:10,width:i},Gt.createElement("rect",{x:0,y:0,rx:5,width:i,height:10,fill:"#E6E6E6"}),Gt.createElement("rect",{x:0,y:0,rx:5,width:r,height:10,fill:"currentColor"})))};var ip=()=>ie.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),ie.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),ie.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),Tn=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[n,i]=mt(!1),[r,s]=mt(!1);Vo(()=>{t===!0&&n===!1?i(!0):t===!1&&n===!0&&s(!0)},[t]);let p=()=>{i(!1),s(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return n?ie.createElement(pn,{style:d,reversed:r,onAnimationEnd:r?p:null},ie.createElement(dn,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},ie.createElement(ip,null))):null},Fn=({flowId:e,appearance:t,customVariables:o,className:n})=>{let i=rp(null),[r,s]=mt(!1),[p,d]=mt(!1),[l,f]=mt(null),[u,h]=mt([]),[w,b]=mt(0),{getFlowMetadata:C,getFlowSteps:m,getNumberOfStepsCompleted:v,updateCustomVariables:T,getFlowStatus:B,isLoading:k,targetingLogicShouldHideFlow:c,getFlow:g}=X();Vo(()=>{T(o)},[o,k]),Vo(()=>{if(k)return;let O=C(e),H=v(e),N=m(e);f(O),O.data!==null&&(h(N.sort((j,K)=>Number(j.complete)-Number(K.complete))),d(N.length>3),b(H))},[k]);let S=[];for(let O=0;O<u.length;O+=3)S.push(u.slice(O,O+3));let E=O=>{let H=O.target,N=H.scrollWidth-H.clientWidth,j=Math.ceil(H.scrollLeft);j>0&&r===!1&&s(!0),j===0&&r===!0&&s(!1),j<N&&p===!1&&d(!0),j===N&&p===!0&&d(!1)},U=(O=!0)=>{let H=O?1:-1;i.current!==null&&i.current.scrollBy({left:i.current.clientWidth*H,behavior:"smooth"})},M=null,_=O=>{M!==null?clearTimeout(M):E(O),M=setTimeout(()=>{E(O)},16)};return k?null:ie.createElement(fn,{className:Ce(a("carouselContainer",t),n)},ie.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:20}},ie.createElement("div",null,ie.createElement(Cn,{className:a("carouselTitle",t)},l==null?void 0:l.title),ie.createElement(De.Quiet,{className:a("carouselSubtitle",t)},l==null?void 0:l.subtitle)),ie.createElement(wn,{numberOfStepsCompleted:w,numberOfSteps:u.length})),ie.createElement("div",{style:{position:"relative"}},ie.createElement(Tn,{show:r,onClick:()=>U(!1)}),ie.createElement(Tn,{side:"right",show:p,onClick:U}),ie.createElement(ln,{ref:i,onScroll:_},S.map((O,H)=>ie.createElement(an,{key:H,style:{flex:`0 0 calc(100% - ${u.length>3?36:0}px)`}},O.map((N,j)=>ie.createElement(bn,{key:j,stepData:N,style:{flex:u.length>3?"0 1 calc(33% - 16px * 2 / 3)":1},appearance:t})))))))};var qo=({flowId:e,title:t,subtitle:o,style:n,initialSelectedStep:i,className:r,type:s="inline",onDismiss:p,visible:d,customVariables:l,onStepCompletion:f,onButtonClick:u,appearance:h,hideOnFlowCompletion:w,setVisible:b,customStepTypes:C,checklistStyle:m="default",...v})=>{let{getFlow:T,getFlowSteps:B,markStepCompleted:k,getStepStatus:c,getNumberOfStepsCompleted:g,isLoading:S,targetingLogicShouldHideFlow:E,updateCustomVariables:U,getFlowMetadata:M,isStepBlocked:_,getFlowStatus:O,hasActiveFullPageFlow:H,setHasActiveFullPageFlow:N}=X(),{primaryCTAClickSideEffects:j,secondaryCTAClickSideEffects:K}=le(),{getOpenFlowState:V,setOpenFlowState:z}=ke(),[te,oe]=Pn(i||0),[Z,$]=Pn(!1),J=d===void 0?V(e):d,A=s==="modal",{mergeAppearanceWithDefault:q}=Q(),{isLarge:Ue}=Hi();if(h=q(h),kn(()=>{U(l)},[l,S]),kn(()=>{d!==void 0&&(A&&d===!0?N(!0):A&&d===!1&&N(!1))},[d,b,H]),S)return null;let xe=T(e);if(!xe||E(xe))return null;let Se=B(e);if(!Se||w===!0&&O(e)===R)return null;let me=M(e);if(me!=null&&me.title&&(t=me.title),me!=null&&me.subtitle&&(o=me.subtitle),!Z&&i===void 0&&g(e)>0){let I=Math.min(g(e),Se.length-1);oe(I),$(!0)}function _e(){if(te+1>=Se.length){A&&z(e,!1);return}_(e,Se[te+1].id)||oe(te+1)}function We(I,Y,tt){let Jo=te+1<Se.length?Se[te+1]:null;u&&u(I,te,Y,Jo)===!0&&A&&Be(),f&&f(I,tt,Jo),!f&&!u&&(I.primaryButtonUri||I.secondaryButtonUri)&&A&&Be()}function et(){return Se.map((I,Y)=>({...I,handleSecondaryButtonClick:()=>{_e(),K(I),I.skippable===!0&&k(e,I.id,{skipped:!0}),We(I,"secondary",Y)},handlePrimaryButtonClick:()=>{(!I.completionCriteria&&(I.autoMarkCompleted||I.autoMarkCompleted===void 0)||I.completionCriteria&&I.autoMarkCompleted===!0)&&(k(e,I.id),_e()),We(I,"primary",Y),j(I),c(e,I.id)===Fe&&_e()}}))}function W(){return ne.createElement(pe,{appearance:h})}let Ee={steps:et(),title:t,subtitle:o,primaryColor:h.theme.colorPrimary,appearance:h,customStepTypes:C,type:s,className:r};function Be(){z(e,!1),p&&p(),b&&b(!1)}function bo(){return ne.createElement(ne.Fragment,null,ne.createElement(W,null),ne.createElement(Fn,{flowId:e,appearance:h,customVariables:l,className:r}))}function x(){return ne.createElement(ne.Fragment,null,ne.createElement(W,null),ne.createElement(jo,{visible:J,onClose:()=>{Be()},selectedStep:te,setSelectedStep:oe,autoExpandNextStep:!0,appearance:h,...Ee}))}function y(){if(!Ue)return x();let I=v.guideFlowId,Y;return I&&T(I)&&(Y=B(I)),ne.createElement(ne.Fragment,null,ne.createElement(W,null),ne.createElement(Go,{visible:J,stepsTitle:me.stepsTitle?me.stepsTitle:"Your quick start guide",onClose:()=>{Be()},selectedStep:te,setSelectedStep:oe,guideData:Y,guideTitle:v.guideTitle??"Guide",appearance:h,title:t,subtitle:o,onGuideButtonClick:tt=>{We(tt,"link",0)},...Ee}))}function P(){if(!Ue)return x();let I=ne.createElement(Ho,{flowId:e,style:n,selectedStep:te,setSelectedStep:oe,appearance:h,type:s,...Ee});return A?ne.createElement(Ye,{onClose:()=>{Be()},visible:J,appearance:h,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},ne.createElement(W,null),I):ne.createElement(ne.Fragment,null,ne.createElement(W,null),I)}switch(m){case"condensed":return x();case"with-guide":return y();case"default":return P();case"carousel":return bo();default:return P()}};var sp=e=>np.createElement(qo,{type:"inline",...e});import Ze,{useEffect as ap}from"react";import Me from"react";import xo from"styled-components";var vn=xo.div`
|
|
1124
1124
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1125
1125
|
border-radius: 8px;
|
|
1126
1126
|
padding: 6px 10px 6px 10px;
|
|
@@ -1159,7 +1159,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1159
1159
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1160
1160
|
border-radius: 12px;
|
|
1161
1161
|
`,On=jt.div`
|
|
1162
|
-
${e=>
|
|
1162
|
+
${e=>F(e)} {
|
|
1163
1163
|
display: flex;
|
|
1164
1164
|
justify-content: center;
|
|
1165
1165
|
align-items: center;
|
|
@@ -1185,8 +1185,8 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1185
1185
|
:hover {
|
|
1186
1186
|
opacity: 0.8;
|
|
1187
1187
|
}
|
|
1188
|
-
`;var Mn=({title:e,subtitle:t,icon:o,appearance:n,count:i,total:r,className:s,style:p})=>Qe.createElement(Qe.Fragment,null,Qe.createElement(Nn,{appearance:n,className:Ce(a("fullWidthProgressBadgeContainer",n),s??""),style:p},o&&Qe.createElement(On,{className:a("fullWidthProgressBadgeIcon",n)},o),Qe.createElement(Ln,null,Qe.createElement(Te,{size:"small",appearance:n,title:e,subtitle:t})),Qe.createElement(Dn,{className:a("fullWidthProgressBadgeProgressContainer",n)},Qe.createElement(Le,{count:i,total:r,display:"percent",textLocation:"top",fillColor:n.theme.colorPrimary}))));var pp=({flowId:e,title:t,subtitle:o,icon:n,style:i,onClick:r,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:l,type:f="default"})=>{let{getFlow:u,getFlowSteps:
|
|
1189
|
-
${e=>
|
|
1188
|
+
`;var Mn=({title:e,subtitle:t,icon:o,appearance:n,count:i,total:r,className:s,style:p})=>Qe.createElement(Qe.Fragment,null,Qe.createElement(Nn,{appearance:n,className:Ce(a("fullWidthProgressBadgeContainer",n),s??""),style:p},o&&Qe.createElement(On,{className:a("fullWidthProgressBadgeIcon",n)},o),Qe.createElement(Ln,null,Qe.createElement(Te,{size:"small",appearance:n,title:e,subtitle:t})),Qe.createElement(Dn,{className:a("fullWidthProgressBadgeProgressContainer",n)},Qe.createElement(Le,{count:i,total:r,display:"percent",textLocation:"top",fillColor:n.theme.colorPrimary}))));var pp=({flowId:e,title:t,subtitle:o,icon:n,style:i,onClick:r,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:l,type:f="default"})=>{let{getFlow:u,getFlowSteps:h,getFlowStatus:w,getNumberOfStepsCompleted:b,isLoading:C,targetingLogicShouldHideFlow:m,updateCustomVariables:v}=X(),{mergeAppearanceWithDefault:T}=Q();l=T(l);let{setOpenFlowState:B,getOpenFlowState:k}=ke();if(ap(()=>{v(p)},[p,C]),C)return null;let c=u(e);if(!c||m(c)||d===!0&&w(e)===R)return null;let g=h(e),S=b(e);return f==="full-width"?Ze.createElement(Ze.Fragment,null,Ze.createElement(pe,{appearance:l}),Ze.createElement(Mn,{title:t,subtitle:o,count:S,total:g.length,style:i,className:s,appearance:l,icon:n,onClick:()=>{}})):Ze.createElement(Ze.Fragment,null,Ze.createElement(pe,{appearance:l}),Ze.createElement(An,{count:S,total:g.length,title:t,style:i,onClick:()=>{B(e,!0),r&&r()},type:f,className:s,appearance:l}))};import dp from"react";var cp=({flowId:e,style:t,appearance:o,...n})=>{let{getFlow:i,targetingLogicShouldHideFlow:r,getFlowSteps:s}=X(),{mergeAppearanceWithDefault:p}=Q();o=p(o);let d=i(e);if(!d||r(d))return null;let l=s(e);return dp.createElement(zt,{steps:l,style:t,appearance:o,...n})};import Et,{useContext as Tp,useEffect as Fp}from"react";import D,{useEffect as Co,useLayoutEffect as Kn,useRef as hp,useState as Vt}from"react";import qt from"styled-components";import{useCallback as mp,useEffect as up,useState as fp}from"react";var Ko=(e,t,o,n={x:20,y:20},i)=>{let r=i=="fixed"?0:window.scrollY,s=i=="fixed"?0:window.scrollX;return!e||!e.left||!e.top?{x:0,y:0}:t==="left"?{x:e.left-o+n.x+s,y:e.top-n.y+r}:t==="right"?{x:e.left+e.width+n.x+s,y:e.top-n.y+r}:{x:0,y:0}},$n={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function gp(e){let t=$n;return e&&(t=e.getBoundingClientRect()),t}function Un(e,t){let[o,n]=fp($n),i=mp(()=>{e&&n(gp(e))},[e]);return up(()=>(i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)),[e,t]),o}import Re from"styled-components";var _n=Re.div`
|
|
1189
|
+
${e=>F(e)} {
|
|
1190
1190
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
1191
1191
|
}
|
|
1192
1192
|
|
|
@@ -1203,7 +1203,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1203
1203
|
top: 25px;
|
|
1204
1204
|
right: 22px;
|
|
1205
1205
|
`,Hn=Re.img`
|
|
1206
|
-
${e=>
|
|
1206
|
+
${e=>F(e)} {
|
|
1207
1207
|
display: block;
|
|
1208
1208
|
width: 100%;
|
|
1209
1209
|
height: auto;
|
|
@@ -1212,7 +1212,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1212
1212
|
margin-bottom: 16px;
|
|
1213
1213
|
}
|
|
1214
1214
|
`,zn=Re.div`
|
|
1215
|
-
${e=>
|
|
1215
|
+
${e=>F(e)} {
|
|
1216
1216
|
display: block;
|
|
1217
1217
|
width: 100%;
|
|
1218
1218
|
height: auto;
|
|
@@ -1236,14 +1236,14 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1236
1236
|
flex-shrink: 1;
|
|
1237
1237
|
gap: 8px;
|
|
1238
1238
|
height: 64px;
|
|
1239
|
-
${e=>
|
|
1239
|
+
${e=>F(e)} {
|
|
1240
1240
|
flex-direction: row;
|
|
1241
1241
|
justify-content: ${e=>e.showStepCount?"flex-end":"flex-start"};
|
|
1242
1242
|
align-content: center;
|
|
1243
1243
|
align-items: center;
|
|
1244
1244
|
}
|
|
1245
1245
|
`,qn=Re.p`
|
|
1246
|
-
${e=>
|
|
1246
|
+
${e=>F(e)} {
|
|
1247
1247
|
font-style: normal;
|
|
1248
1248
|
font-weight: 600;
|
|
1249
1249
|
font-size: 15px;
|
|
@@ -1274,14 +1274,14 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1274
1274
|
opacity: 0;
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
|
-
`,
|
|
1277
|
+
`,yp=qt.div`
|
|
1278
1278
|
width: ${It}px;
|
|
1279
1279
|
height: ${It}px;
|
|
1280
1280
|
border-radius: 100px;
|
|
1281
1281
|
background-color: ${e=>e.primaryColor};
|
|
1282
1282
|
z-index: 20;
|
|
1283
1283
|
opacity: 1;
|
|
1284
|
-
`,
|
|
1284
|
+
`,Sp=qt.div`
|
|
1285
1285
|
pointer-events: all;
|
|
1286
1286
|
`,Jn=qt.div`
|
|
1287
1287
|
display: flex;
|
|
@@ -1292,8 +1292,8 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1292
1292
|
`,bp=qt(Jn)`
|
|
1293
1293
|
width: ${It+12}px;
|
|
1294
1294
|
height: ${It+12}px;
|
|
1295
|
-
`,wp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:n="auto",showHighlight:i=!0,primaryColor:r="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:l=0,customStepTypes:f,appearance:u,dismissible:
|
|
1296
|
-
${e=>
|
|
1295
|
+
`,wp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:n="auto",showHighlight:i=!0,primaryColor:r="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:l=0,customStepTypes:f,appearance:u,dismissible:h=!1,showHighlightOnly:w,showStepCount:b=!0,completedStepsCount:C=0})=>{var me,_e,We,et;let[m,v]=Vt(),[T,B]=Vt(new Date),k=hp(null),[c,g]=Vt(document.querySelector(e[l].selector)),S=Un(c,T),[E,U]=Vt(),[M,_]=Vt(!w),O=(_e=(me=e[l])==null?void 0:me.props)!=null&&_e.position?e[l].props.position:"absolute",H=((et=(We=e[l])==null?void 0:We.props)==null?void 0:et.zIndex)??90,N=(m==null?void 0:m.width)??Yn,j=(m==null?void 0:m.height)??Xn;Kn(()=>{k.current&&v({width:k.current.clientWidth,height:k.current.clientHeight})},[l,T,O]),Co(()=>{w||_(!0)},[l]);let K=n==="auto"?"right":n,V=Ko(S,K,N,s,O),z=S.right+N>(window.innerWidth||document.documentElement.clientWidth),te=S.bottom+Xn>(window.innerHeight||document.documentElement.clientHeight);z&&n==="auto"&&(V=Ko(S,"left",N,s,O),K="left");let oe=window.location.pathname.split("/").pop(),Z=()=>{let W=document.querySelector(e[l].selector);E&&E===JSON.stringify(W==null?void 0:W.getBoundingClientRect())||(g(W),B(new Date),W&&U(JSON.stringify(W.getBoundingClientRect())))};if(Co(()=>{let W=new MutationObserver(Z);return W.observe(document.body,{subtree:!0,childList:!0}),()=>W.disconnect()},[Z]),Co(()=>{let W=new MutationObserver(Z);return W.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>W.disconnect()},[Z]),Co(()=>{let W=setInterval(()=>{Z()},10);return()=>clearInterval(W)},[Z]),Kn(()=>{setTimeout(()=>{Z()},xp),Z()},[l,oe]),c===null)return D.createElement(D.Fragment,null);if(V.x==0&&V.y==0)return D.createElement(D.Fragment,null);if(!p)return D.createElement(D.Fragment,null);let $=()=>{let W=()=>{if(e[l].handlePrimaryButtonClick&&(e[l].handlePrimaryButtonClick(),_(!1),setTimeout(()=>{Z()},30)),C===e.length-1)return o()},Ee=()=>{e[l].handleSecondaryButtonClick&&(e[l].handleSecondaryButtonClick(),w&&_(!1))};return D.createElement(D.Fragment,null,b&&D.createElement(jn,null,D.createElement(qn,{className:a("tooltipStepCounter",u)},l+1," of ",e.length)),D.createElement(Vn,{showStepCount:b,className:a("tooltipCTAContainer",u)},e[l].secondaryButtonTitle&&D.createElement(ee,{title:e[l].secondaryButtonTitle,appearance:u,onClick:Ee,size:"small",withMargin:!1,secondary:!0}),e[l].primaryButtonTitle&&D.createElement(ee,{title:e[l].primaryButtonTitle,appearance:u,onClick:W,withMargin:!1,size:"small"})))},J=()=>D.createElement(D.Fragment,null,h&&D.createElement(Wn,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:a("tooltipClose",u)},D.createElement(Pe,null)),e[l].imageUri&&D.createElement(Hn,{dismissible:h,appearance:u,src:e[l].imageUri,className:a("tooltipImageContainer",u)}),e[l].videoUri&&!e[l].imageUri&&D.createElement(zn,{dismissible:h,appearance:u,className:a("tooltipVideoContainer",u)},D.createElement(yt,{appearance:u,videoUri:e[l].videoUri})),D.createElement(Te,{appearance:u,title:e[l].title,subtitle:e[l].subtitle,size:"small"}),D.createElement(Gn,{className:a("tooltipFooter",u)},D.createElement($,null))),q={...{default:W=>{var Ee;if((Ee=e[l])!=null&&Ee.StepContent){let Be=e[l].StepContent;return D.createElement("div",null,Be)}return D.createElement(J,null)}},...f},Ue=()=>{var W;return e?!((W=e[l])!=null&&W.type)||!q[e[l].type]?q.default(e[l]):q[e[l].type]({stepData:e[l],primaryColor:r}):D.createElement(D.Fragment,null)};if(w&&e[l].complete===!0)return null;let xe={top:(V==null?void 0:V.y)-It,left:(K=="left"?S.x+s.x:(V==null?void 0:V.x)-It)??0,cursor:w?"pointer":"default",position:O},Se=()=>{w&&(B(new Date),_(!M))};return D.createElement(Sp,null,D.createElement(bp,{style:xe,zIndex:H,className:a("tourHighlightContainer",u)},i&&e[l].showHighlight!==!1&&D.createElement(D.Fragment,null,D.createElement(yp,{style:{position:O},onClick:Se,primaryColor:u.theme.colorPrimary}),D.createElement(Cp,{style:{position:"absolute"},onClick:Se,primaryColor:u.theme.colorPrimary}))),D.createElement(Jn,{style:{...xe,left:xe.left+(K=="left"?-N:24)},zIndex:H+1,className:a("tooltipContainerWrapper",u)},M&&D.createElement(_n,{ref:k,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:12,...d},appearance:u,className:a("tooltipContainer",u),maxWidth:Yn,zIndex:H+10},D.createElement(Ue,null))))},yo=wp;import{Portal as kp}from"react-portal";var Pp=({flowId:e,customVariables:t,appearance:o,onStepCompletion:n,onButtonClick:i,showTooltipsSimultaneously:r=!1,onDismiss:s,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:l=!1,dismissBehavior:f="complete-flow",onComplete:u,...h})=>{let{getFlow:w,getFlowSteps:b,isLoading:C,targetingLogicShouldHideFlow:m,markStepCompleted:v,markStepStarted:T,markFlowCompleted:B,updateCustomVariables:k,getCurrentStepIndex:c,getStepStatus:g,isStepBlocked:S,getFlowStatus:E,getNumberOfStepsCompleted:U}=X(),{isLoadingUserFlowStateData:M}=we(),{primaryCTAClickSideEffects:_,secondaryCTAClickSideEffects:O}=le(),{hasOpenModals:H}=ke(),N=c(e),{openFlowStates:j}=Tp(G),{mergeAppearanceWithDefault:K}=Q();if(o=K(o),Fp(()=>{k(t)},[t,C]),M)return null;let V=w(e);if(!V||m(V)||E(e)==R||H())return null;let z=b(e);if(Object.keys(j).length>0){let A=Object.keys(j).find(q=>j[q]===!0);if(A!==void 0&&A!==e)return Et.createElement(Et.Fragment,null)}async function te(A){if(await v(e,A.id),z.map(q=>g(e,q.id)).every(q=>q===Fe)){await B(e);return}if(!l&&N+1<z.length){if(S(e,z[N+1].id))return;await T(e,z[N+1].id)}}function oe(A,q,Ue){let xe=N+1<z.length?z[N+1]:null;i&&i(A,N,q,xe),n&&n(A,Ue,xe)}function Z(){return z.map(A=>({...A,handleSecondaryButtonClick:async()=>{O(A),A.skippable===!0&&await v(e,A.id,{skipped:!0}),oe(A,"secondary",N)},handlePrimaryButtonClick:async()=>{(!A.completionCriteria&&(A.autoMarkCompleted||A.autoMarkCompleted===void 0)||A.completionCriteria&&A.autoMarkCompleted===!0)&&await te(A),oe(A,"primary",N),_(A)}}))}async function $(A){s&&s(),f==="complete-flow"?await B(e):await v(e,A.id)}function J(){u&&u()}return Et.createElement(kp,null,Et.createElement(pe,{appearance:o}),r?z.map((A,q)=>Et.createElement(yo,{key:A.id,appearance:o,steps:Z(),selectedStep:q,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>$(A),tooltipPosition:d,showHighlightOnly:l,completedStepsCount:U(e),onComplete:J,...h})):Et.createElement(yo,{appearance:o,steps:Z(),selectedStep:N,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>$(z[N]),tooltipPosition:d,completedStepsCount:U(e),showHighlightOnly:l,onComplete:J,...h}))};import fe,{useEffect as vp,useRef as Ip,useState as Ep}from"react";import{Portal as Bp}from"react-portal";import ut from"styled-components";var Qn=ut.button`
|
|
1296
|
+
${e=>F(e)} {
|
|
1297
1297
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1298
1298
|
|
|
1299
1299
|
display: flex;
|
|
@@ -1311,12 +1311,12 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1311
1311
|
}
|
|
1312
1312
|
}
|
|
1313
1313
|
`,Zn=ut.span`
|
|
1314
|
-
${e=>
|
|
1314
|
+
${e=>F(e)} {
|
|
1315
1315
|
font-size: 12px;
|
|
1316
1316
|
display: inline-block;
|
|
1317
1317
|
}
|
|
1318
1318
|
`,Rn=ut.span`
|
|
1319
|
-
${e=>
|
|
1319
|
+
${e=>F(e)} {
|
|
1320
1320
|
font-size: 12px;
|
|
1321
1321
|
display: inline-block;
|
|
1322
1322
|
}
|
|
@@ -1331,7 +1331,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1331
1331
|
align-items: flex-end;
|
|
1332
1332
|
z-index: 50;
|
|
1333
1333
|
`,ts=ut.button`
|
|
1334
|
-
${e=>
|
|
1334
|
+
${e=>F(e)} {
|
|
1335
1335
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1336
1336
|
background-color: #ffffff;
|
|
1337
1337
|
border: 1px solid #f5f5f5;
|
|
@@ -1347,7 +1347,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1347
1347
|
border-radius: 45px;
|
|
1348
1348
|
cursor: pointer;
|
|
1349
1349
|
`,os=ut.div`
|
|
1350
|
-
${e=>
|
|
1350
|
+
${e=>F(e)} {
|
|
1351
1351
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1352
1352
|
background: #ffffff;
|
|
1353
1353
|
}
|
|
@@ -1364,7 +1364,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1364
1364
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1365
1365
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1366
1366
|
`,rs=ut.button`
|
|
1367
|
-
${e=>
|
|
1367
|
+
${e=>F(e)} {
|
|
1368
1368
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1369
1369
|
color: #434343;
|
|
1370
1370
|
:hover {
|
|
@@ -1380,8 +1380,8 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1380
1380
|
font-size: 14px;
|
|
1381
1381
|
|
|
1382
1382
|
padding: 8px 12px;
|
|
1383
|
-
`;import{AnimatePresence as as,motion as ps}from"framer-motion";import is from"react";var ns=({style:e,className:t})=>is.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},is.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 ss from"react";var ls=({style:e,className:t})=>ss.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"},ss.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 Ap=({flowId:e,style:t,onStepCompletion:o,visible:n=!0,type:i="inline",title:r="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:l,getStepStatus:f,getNumberOfStepsCompleted:u,isLoading:
|
|
1384
|
-
${e=>
|
|
1383
|
+
`;import{AnimatePresence as as,motion as ps}from"framer-motion";import is from"react";var ns=({style:e,className:t})=>is.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},is.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 ss from"react";var ls=({style:e,className:t})=>ss.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"},ss.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 Ap=({flowId:e,style:t,onStepCompletion:o,visible:n=!0,type:i="inline",title:r="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:l,getStepStatus:f,getNumberOfStepsCompleted:u,isLoading:h,targetingLogicShouldHideFlow:w}=X(),{primaryCTAClickSideEffects:b}=le(),C=Ip(null),[m,v]=Ep(!1),{mergeAppearanceWithDefault:T}=Q();s=T(s),vp(()=>(document.addEventListener("click",B,!1),()=>{document.removeEventListener("click",B,!1)}),[]);let B=E=>{C.current&&!C.current.contains(E.target)&&v(!1)};if(h)return null;let k=p(e);if(!k||w(k))return null;let c=d(e);if(!c||!n)return null;function g(E,U){!E.completionCriteria&&(E.autoMarkCompleted||E.autoMarkCompleted===void 0)&&l(e,E.id),b(E),o&&o(E,U),v(!1)}function S(){return m&&fe.createElement(os,{className:a("floatingWidgetMenu",s),as:ps.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:i},c.map((E,U)=>fe.createElement(rs,{className:a("floatingWidgetMenuItem",s),key:U,onClick:()=>g(E,U)},E.title)))}return i=="inline"?fe.createElement("span",{ref:C},fe.createElement(Qn,{style:t,onClick:()=>{v(!m)},className:a("supportButton",s)},fe.createElement(Rn,{className:a("supportIconContainer",s)},fe.createElement(ls,{className:a("supportIcon",s),style:{width:"18px",height:"18px"}})),fe.createElement(Zn,{className:a("supportButtonTitle",s)},r)),fe.createElement(as,null,fe.createElement(S,null))):fe.createElement(Bp,null,fe.createElement(es,{style:t,ref:C},fe.createElement(as,null,fe.createElement(S,null)),fe.createElement(ts,{onClick:()=>{v(!m)},as:ps.button,whileHover:{scale:1.1},className:a("floatingWidgetButton",s)},fe.createElement(ns,{className:a("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import $e,{useEffect as Np}from"react";import So from"styled-components";var ds=So.div`
|
|
1384
|
+
${e=>F(e)} {
|
|
1385
1385
|
display: flex;
|
|
1386
1386
|
flex-direction: column;
|
|
1387
1387
|
width: 100%;
|
|
@@ -1395,18 +1395,18 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1395
1395
|
border-radius: 12px;
|
|
1396
1396
|
position: relative;
|
|
1397
1397
|
}
|
|
1398
|
-
`,cs=
|
|
1398
|
+
`,cs=So.div`
|
|
1399
1399
|
display: flex;
|
|
1400
1400
|
flex-direction: column;
|
|
1401
1401
|
flex: 1;
|
|
1402
|
-
`,ms=
|
|
1402
|
+
`,ms=So.div`
|
|
1403
1403
|
display: flex;
|
|
1404
1404
|
flex-direction: column;
|
|
1405
1405
|
justify-content: center;
|
|
1406
1406
|
align-items: flex-start;
|
|
1407
1407
|
margin-top: 16px;
|
|
1408
|
-
`,us=
|
|
1409
|
-
${e=>
|
|
1408
|
+
`,us=So.div`
|
|
1409
|
+
${e=>F(e)} {
|
|
1410
1410
|
position: absolute;
|
|
1411
1411
|
top: 16px;
|
|
1412
1412
|
right: 16px;
|
|
@@ -1416,9 +1416,9 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1416
1416
|
opacity: 0.8;
|
|
1417
1417
|
}
|
|
1418
1418
|
}
|
|
1419
|
-
`;var Op=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:i,className:r,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:f,isLoading:u,targetingLogicShouldHideFlow:
|
|
1419
|
+
`;var Op=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:i,className:r,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:f,isLoading:u,targetingLogicShouldHideFlow:h,updateCustomVariables:w,getFlowSteps:b,getFlowStatus:C,getCurrentStepIndex:m}=X(),{primaryCTAClickSideEffects:v}=le(),{mergeAppearanceWithDefault:T}=Q();if(i=T(i),Np(()=>{w(o)},[o,u]),u)return null;let B=d(e);if(!B||h(B)||C(e)===R)return null;let c=b(e)[m(e)];return $e.createElement($e.Fragment,null,$e.createElement(pe,{appearance:i}),$e.createElement(ds,{appearance:i,className:Ce(a("embeddedTipContainer",i),r),style:s},(p===!0||c.dismissible)&&$e.createElement(us,{onClick:async()=>{await l(e),t&&t()},className:a("embeddedTipDismissButton",i)},$e.createElement(Pe,null)),$e.createElement(cs,null,$e.createElement(Te,{size:"small",appearance:i,title:c.title,subtitle:c.subtitle})),c.primaryButtonTitle&&$e.createElement(ms,{className:a("embeddedTipCallToActionContainer",i)},$e.createElement(ee,{classPrefix:"embeddedTip",title:c.primaryButtonTitle,appearance:i,withMargin:!1,size:"small",type:"inline",onClick:async()=>{c.handlePrimaryButtonClick(),v(c),!(n&&n(c,m(e),"primary")===!1)&&(await f(e,c.id),await l(e))}}))))};import ce,{useEffect as Lp}from"react";import Bt from"styled-components";var fs=Bt.div`
|
|
1420
1420
|
// use the :not annotation
|
|
1421
|
-
${e=>
|
|
1421
|
+
${e=>F(e)} {
|
|
1422
1422
|
display: flex;
|
|
1423
1423
|
flex-direction: ${e=>e.type==="square"?"column":"row"};
|
|
1424
1424
|
width: 100%;
|
|
@@ -1431,7 +1431,7 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1431
1431
|
border-radius: 12px;
|
|
1432
1432
|
}
|
|
1433
1433
|
`,gs=Bt.div`
|
|
1434
|
-
${e=>
|
|
1434
|
+
${e=>F(e)} {
|
|
1435
1435
|
display: flex;
|
|
1436
1436
|
width: 36px;
|
|
1437
1437
|
height: 36px;
|
|
@@ -1461,5 +1461,5 @@ ${n=>n.inlineStyles.map(([i,r])=>`.${Nt}${i}.${Nt}${i} { ${Object.entries(r).map
|
|
|
1461
1461
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1462
1462
|
align-items: flex-end;
|
|
1463
1463
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1464
|
-
`;import Cs from"react";var
|
|
1464
|
+
`;import Cs from"react";var ys=({style:e,className:t})=>Cs.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"},Cs.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"}));var Dp=({flowId:e,title:t,subtitle:o,onDismiss:n,customVariables:i,onButtonClick:r,appearance:s,type:p="full-width"})=>{let{getFlow:d,markFlowCompleted:l,isLoading:f,targetingLogicShouldHideFlow:u,updateCustomVariables:h,getFlowMetadata:w,getFlowStatus:b,getFlowSteps:C,getCurrentStepIndex:m}=X(),{primaryCTAClickSideEffects:v}=le(),{mergeAppearanceWithDefault:T}=Q();if(s=T(s),Lp(()=>{h(i)},[i,f]),f)return null;let B=d(e);if(!B||u(B)||b(e)===R)return null;let k=C(e),c=k.length>0?k[m(e)]:w(e);return c!=null&&c.title&&(t=c.title),c!=null&&c.subtitle&&(o=c.subtitle),ce.createElement(ce.Fragment,null,ce.createElement(pe,{appearance:s}),ce.createElement(fs,{type:p,appearance:s,className:a("bannerContainer",s)},p!="square"&&ce.createElement(gs,null,ce.createElement(ys,null)),p==="square"&&c.dismissible&&ce.createElement(Xo,{type:p,className:a("bannerDismissButtonContainer",s)},ce.createElement(Yo,{type:p,onClick:async()=>{await l(e),n&&n()},className:a("bannerDismissButton",s)},ce.createElement(Pe,null))),ce.createElement(hs,{type:p},ce.createElement(Te,{appearance:s,title:t,subtitle:o})),ce.createElement(xs,{type:p,className:a("bannerCallToActionContainer",s)},ce.createElement(ee,{title:(c==null?void 0:c.primaryButtonTitle)??"Get started",appearance:s,onClick:()=>{v(c),r&&r(c,0,"primary")}})),p!=="square"&&c.dismissible&&ce.createElement(Xo,{type:p,className:a("bannerDismissButtonContainer",s)},ce.createElement(Yo,{type:p,onClick:async()=>{await l(e),n&&n()},className:a("bannerDismissButton",s)},ce.createElement(Pe,null)))))};export{Dp as FrigadeBanner,qo as FrigadeChecklist,Op as FrigadeEmbeddedTip,Gr as FrigadeForm,cp as FrigadeGuide,sp as FrigadeHeroChecklist,pp as FrigadeProgressBadge,aa as FrigadeProvider,Ap as FrigadeSupportWidget,Pp as FrigadeTour,ke as useFlowOpens,At as useFlowResponses,X as useFlows,Mo as useOrganization,To as useUser};
|
|
1465
1465
|
//# sourceMappingURL=index.mjs.map
|