@frigade/react 1.32.20 → 1.32.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +61 -61
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +78 -78
- 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 ia,useEffect as $o,useState as ve}from"react";import{ThemeProvider as na}from"styled-components";import lt,{useContext as oa,useEffect as so,useState as Mo}from"react";import{useCallback as rt,useContext as Is,useEffect as As}from"react";import bo,{useMemo as Ss}from"react";var Jo="1.32.20 ";var ge="https://api.frigade.com/v1/public/",be="NOT_STARTED_STEP",Q="COMPLETED_FLOW",Kt="ABORTED_FLOW",ot="STARTED_FLOW",Be="NOT_STARTED_FLOW",Fe="COMPLETED_STEP",Yt="STARTED_STEP";function Oe(){let{publicApiKey:e,userId:t}=bo.useContext(G);return{config:Ss(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Jo,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}function ft(){let{shouldGracefullyDegrade:e}=bo.useContext(G);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),qt();let i;try{i=await fetch(t,o)}catch(r){return qt(r)}return i?i.ok?i:qt(i.statusText):qt()}}function qt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function gt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=bo.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 Ps,useState as Qo}from"react";import{useContext as bs,useEffect as Ts,useState as ws}from"react";import Fs from"swr";import{useContext as ys}from"react";function ke(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o}=ys(G);function i(p,d=!1){return e[p]??d}function r(p,d){t(l=>({...l,[p]:d}))}function n(p){t(d=>{let{[p]:l,...h}=d;return{...h}})}function s(){return Object.values(e).some(p=>p)||o}return{getOpenFlowState:i,setOpenFlowState:r,resetOpenFlowState:n,hasOpenModals:s}}var ks="unknown";function Te(){let{config:e}=Oe(),{publicApiKey:t,userId:o,flows:i,setShouldGracefullyDegrade:r}=bs(G),{resetOpenFlowState:n}=ke(),[s,p]=ws(!1),d={data:i.map(k=>({flowId:k.id,flowState:Q,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`),r(!0),d)),{data:h,isLoading:m,mutate:g,error:w}=Fs(t&&i&&o?`${ge}userFlowStates?foreignUserId=${encodeURIComponent(o)}`:null,l,{keepPreviousData:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),x=h==null?void 0:h.data;Ts(()=>{!s&&!m&&x&&p(!0)},[x,s,m]);async function S(k){if(x){let c=x.find(u=>u.flowId===k);c&&c.flowState!==Q&&(c.flowState=Q),await g(Promise.resolve({...h,data:x}),{optimisticData:{...h,data:x},revalidate:!1,rollbackOnError:!1})}}async function C(k,c,u){if(x){let b=x.find(I=>I.flowId===k);b&&(b.stepStates[c]=u,b.flowState=ot),await g(Promise.resolve({...h,data:x}),{optimisticData:{...h,data:x},revalidate:!1,rollbackOnError:!1})}}async function v(k,c,u){if(x){let b=x.find(I=>I.flowId===k);b&&(b.lastStepId=c,b.stepStates[c]=u,b.flowState=ot),await g({...h,data:x},{optimisticData:{...h,data:x},revalidate:!1,rollbackOnError:!1})}}async function F(k){if(x){let c=x.find(u=>u.flowId===k);c&&c.flowState!==Be&&(c.flowState=Be,c.lastStepId=ks,Object.keys(c.stepStates).forEach(u=>{c.stepStates[u].actionType=be,c.stepStates[u].createdAt=new Date().toISOString()}),await g({...h,data:x},{optimisticData:{...h,data:x},revalidate:!1,rollbackOnError:!1}),n(k))}}async function A(k,c){if(x){let u=x.find(b=>b.flowId===k);u&&u.stepStates[c]!==be&&(u.stepStates[c]=be),await g({...h,data:x},{optimisticData:{...h,data:x},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:x,isLoadingUserFlowStateData:!s,mutateUserFlowState:g,optimisticallyMarkFlowCompleted:S,optimisticallyMarkFlowNotStarted:F,optimisticallyMarkStepCompleted:C,optimisticallyMarkStepNotStarted:A,optimisticallyMarkStepStarted:v,error:w}}function At(){let{config:e}=Oe(),{userFlowStatesData:t,mutateUserFlowState:o}=Te(),{failedFlowResponses:i,setFailedFlowResponses:r,flowResponses:n,setFlowResponses:s}=Ps(G),[p,d]=Qo(new Set),[l,h]=Qo(new Set),m=ft();function g(S){let C=JSON.stringify(S);if(p.has(C))return null;p.add(C),d(p),l.add(S),h(l);let v=n==null?void 0:n.find(F=>F.flowSlug===S.flowSlug&&F.stepId===S.stepId&&F.actionType===S.actionType&&F.createdAt===S.createdAt);return m(`${ge}flowResponses`,{...e,method:"POST",body:C}).then(F=>{F.status!==200&&F.status!==201?(console.log("Failed to send flow response for step "+S.stepId+". Will retry again later."),r([...i,S])):v||s(A=>[...A??[],S])})}async function w(S){S.foreignUserId&&(S.actionType===ot||S.actionType===Be?await g(S):S.actionType===Q?await g(S):S.actionType===Yt?await g(S):S.actionType===Fe?await g(S):S.actionType===Kt?await g(S):S.actionType===be&&await g(S))}function x(){let S=[];return t==null||t.forEach(C=>{if(C&&C.stepStates&&Object.keys(C.stepStates).length!==0)for(let v in C.stepStates){let F=C.stepStates[v];S.push({foreignUserId:C.foreignUserId,flowSlug:C.flowId,stepId:F.stepId,actionType:F.actionType,data:{},createdAt:new Date(F.createdAt),blocked:F.blocked,hidden:F.hidden})}}),[...S,...n]}return{addResponse:w,setFlowResponses:s,getFlowResponses:x}}import Bs from"swr";var vs=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Zo=e=>{let t=vs.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=Es(i,"'","");n.startsWith("flow_")&&(o=n)}),o},Es=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function X(){let{config:e}=Oe(),{flows:t,setFlows:o,userId:i,publicApiKey:r,customVariables:n,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,setFlowResponses:l,setShouldGracefullyDegrade:h}=Is(G),m={data:[]},{verifySDKInitiated:g}=gt(),{addResponse:w,getFlowResponses:x}=At(),S=f=>fetch(f,e).then(y=>y.ok?y.json():(console.log(`Error fetching ${f} (${y.status}): ${y.statusText}. .Will gracefully degrade and hide Frigade`),h(!0),m)).catch(y=>(console.log(`Error fetching ${f}: ${y}. Will gracefully degrade and hide Frigade`),h(!0),m)),{userFlowStatesData:C,isLoadingUserFlowStateData:v,optimisticallyMarkFlowCompleted:F,optimisticallyMarkFlowNotStarted:A,optimisticallyMarkStepCompleted:k,optimisticallyMarkStepNotStarted:c,optimisticallyMarkStepStarted:u}=Te(),{data:b,error:I,isLoading:U}=Bs(r?`${ge}flows`:null,S,{keepPreviousData:!0});As(()=>{if(I){console.error(I);return}b&&b.data&&(b.data=o(b.data))},[b,I]);function M(f){if(U)return null;let y=t.find(P=>P.slug===f);return!y&&t.length>0&&!v&&!U?(console.log(`Flow with slug ${f} not found`),null):(y==null?void 0:y.active)===!1?null:y}function z(f){var E;if(!M(f))return[];let y=M(f).data;return y?(y=O(y),(((E=JSON.parse(y))==null?void 0:E.data)??[]).map(Y=>{let tt=_e(Y);return{handleSecondaryButtonClick:()=>{Y.skippable===!0&&K(f,Y.id,{skipped:!0})},...Y,complete:B(f,Y.id)===Fe||tt>=1,blocked:re(f,Y.id),hidden:Ue(f,Y.id),handlePrimaryButtonClick:()=>{(!Y.completionCriteria&&(Y.autoMarkCompleted||Y.autoMarkCompleted===void 0)||Y.completionCriteria&&Y.autoMarkCompleted===!0)&&K(f,Y.id)},progress:tt}}).filter(Y=>Y.hidden!==!0)):[]}function O(f){return f.replace(/\${(.*?)}/g,(y,P)=>n[P]!==void 0?String(n[P]):"")}function H(f){if(!M(f))return[];let y=M(f).data;return y?(y=O(y),JSON.parse(y)??{}):[]}function L(f,y){s(P=>({...P,[f]:y}))}function j(f){!v&&!U&&f&&JSON.stringify(n)!=JSON.stringify({...n,...f})&&Object.keys(f).forEach(y=>{L(y,f[y])})}let q=rt(async(f,y,P)=>{g();let E={foreignUserId:i,flowSlug:f,stepId:y,actionType:Yt,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};pe(E)&&(await u(f,y,E),w(E))},[i,C]),V=rt(async(f,y,P)=>{g();let E={foreignUserId:i,flowSlug:f,stepId:y,actionType:be,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};pe(E)&&(await c(f,y),w(E))},[i,C]),K=rt(async(f,y,P)=>{g();let E={foreignUserId:i,flowSlug:f,stepId:y,actionType:Fe,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};pe(E)&&(await k(f,y,E),w(E))},[i,C]),$=rt(async(f,y)=>{g();let P={foreignUserId:i,flowSlug:f,stepId:"unknown",actionType:Be,data:y??{},createdAt:new Date,blocked:!1,hidden:!1};await A(f),pe(P)&&w(P)},[i,C]),Z=rt(async(f,y)=>{g();let P={foreignUserId:i,flowSlug:f,stepId:"unknown",actionType:ot,data:y??{},createdAt:new Date,blocked:!1,hidden:!1};pe(P)&&w(P)},[i,C]),_=rt(async(f,y)=>{g();let P={foreignUserId:i,flowSlug:f,stepId:"unknown",actionType:Q,data:y??{},createdAt:new Date,blocked:!1,hidden:!1};pe(P)&&(await F(f),w(P))},[i,C]),ae=rt(async(f,y)=>{g();let P={foreignUserId:i,flowSlug:f,stepId:"unknown",actionType:Kt,data:y??{},createdAt:new Date,blocked:!1,hidden:!1};pe(P)&&(await F(f),w(P))},[i,C]);function pe(f){var y;if(!C&&f.actionType===be)return!1;if(C){let P=C.find(E=>E.flowId===f.flowSlug);if(f.actionType===be&&(!(P!=null&&P.stepStates[f.stepId])||P.stepStates[f.stepId].actionType===be)||P&&((y=P.stepStates[f.stepId])==null?void 0:y.actionType)===f.actionType)return!1}return!0}function B(f,y){let P=xe(f,y);return v?null:P?P.actionType:be}function re(f,y){let P=xe(f,y);return P?P.blocked:!1}function Ue(f,y){let P=xe(f,y);return P?P.hidden:!1}function xe(f,y){if(v)return null;let P=C==null?void 0:C.find(E=>E.flowId===f);return!P||!P.stepStates[y]?null:P.stepStates[y]??null}function ye(f){var P;if(v||!C)return null;if(We(f)===Be)return z(f)[0]??null;let y=(P=C.find(E=>E.flowId===f))==null?void 0:P.lastStepId;return y?z(f).find(E=>E.id===y):null}function me(f){let y=ye(f);if(!y)return 0;let P=z(f).findIndex(E=>E.id===y.id)??0;return B(f,y.id)===Fe&&P<z(f).length-1?P+1:P}function _e(f){if(!f.completionCriteria)return;let y=Zo(f.completionCriteria);if(y===null)return;let P=et(y),E=W(y);return E===0?void 0:P/E}function We(f){let y=C==null?void 0:C.find(P=>P.flowId===f);return y?y.flowState:null}function et(f){let y=z(f);return y.length===0?0:y.filter(E=>B(f,E.id)===Fe).length}function W(f){return z(f).length}function Ie(f){return JSON.parse(t.find(y=>y.slug===f).data)}function Ae(f){if(v)return!0;if(f!=null&&f.targetingLogic&&C){let y=C.find(P=>P.flowId===f.slug);if(y)return y.shouldTrigger===!1}return!!(f!=null&&f.targetingLogic&&i&&i.startsWith("guest_"))}function yo(f){return!Ae(M(f))}return{getFlow:M,getFlowData:Ie,isLoading:v||U,getStepStatus:B,getFlowSteps:z,getCurrentStepIndex:me,markStepStarted:q,markStepCompleted:K,markFlowNotStarted:$,markFlowStarted:Z,markFlowCompleted:_,markFlowAborted:ae,markStepNotStarted:V,getFlowStatus:We,getNumberOfStepsCompleted:et,getNumberOfSteps:W,targetingLogicShouldHideFlow:Ae,setCustomVariable:L,updateCustomVariables:j,customVariables:n,getStepOptionalProgress:_e,getFlowMetadata:H,isStepBlocked:re,isStepHidden:Ue,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,isFlowAvailableToUser:yo}}import{useCallback as Ro,useContext as Os,useEffect as Ls}from"react";var ht="guest_";function To(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=Os(G),{config:n}=Oe(),{mutateUserFlowState:s}=Te(),p=ft(),{verifySDKInitiated:d}=gt();Ls(()=>{if(e&&!t){if(e.startsWith(ht))return;let m=`frigade-user-registered-${e}`;localStorage.getItem(m)||(p(`${ge}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(m,"true"))}},[e,r,t]);let l=Ro(async m=>{d();let g={foreignId:e,properties:m};await p(`${ge}users`,{...n,method:"POST",body:JSON.stringify(g)}),i(w=>({...w,...m})),s()},[e,n,r,s]),h=Ro(async(m,g)=>{d();let x={foreignId:e,events:[{event:m,properties:g}]};await p(`${ge}users`,{...n,method:"POST",body:JSON.stringify(x)}),s()},[e,n,s]);return{userId:e,setUserId:o,addPropertiesToUser:l,trackEventForUser:h}}import{v4 as ra}from"uuid";import Le,{useEffect as Zl,useState as Rl}from"react";import He,{useEffect as _s}from"react";import Jt from"styled-components";import Ns from"react";import Ds from"styled-components";var er="fr-",Bt="cfr-";function a(e,t){let o=`${er}${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+" "+Bt+e}return o}function T(e){if(!e.className||e.className.indexOf(Bt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(er)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function wo(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=>`${wo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Ce(...e){return e.filter(Boolean).join(" ")}function tr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ms=Ds.div`
|
|
2
|
+
import at,{createContext as ia,useEffect as Uo,useState as ve}from"react";import{ThemeProvider as na}from"styled-components";import lt,{useContext as oa,useEffect as lo,useState as $o}from"react";import{useCallback as rt,useContext as Is,useEffect as As}from"react";import To,{useMemo as ys}from"react";var Qo="1.32.21 ";var ge="https://api.frigade.com/v1/public/",be="NOT_STARTED_STEP",Z="COMPLETED_FLOW",Kt="ABORTED_FLOW",ot="STARTED_FLOW",Be="NOT_STARTED_FLOW",Fe="COMPLETED_STEP",Yt="STARTED_STEP";function Oe(){let{publicApiKey:e,userId:t}=To.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}=To.useContext(G);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),qt();let i;try{i=await fetch(t,o)}catch(r){return qt(r)}return i?i.ok?i:qt(i.statusText):qt()}}function qt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function gt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=To.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 Ps,useState as Zo}from"react";import{useContext as bs,useEffect as Ts,useState as ws}from"react";import Fs from"swr";import{useContext as Ss}from"react";function ke(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o}=Ss(G);function i(p,d=!1){return e[p]??d}function r(p,d){t(l=>({...l,[p]:d}))}function n(p){t(d=>{let{[p]:l,...h}=d;return{...h}})}function s(){return Object.values(e).some(p=>p)||o}return{getOpenFlowState:i,setOpenFlowState:r,resetOpenFlowState:n,hasOpenModals:s}}var ks="unknown";function Te(){let{config:e}=Oe(),{publicApiKey:t,userId:o,flows:i,setShouldGracefullyDegrade:r}=bs(G),{resetOpenFlowState:n}=ke(),[s,p]=ws(!1),d={data:i.map(k=>({flowId:k.id,flowState:Z,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`),r(!0),d)),{data:h,isLoading:m,mutate:g,error:w}=Fs(t&&i&&o?`${ge}userFlowStates?foreignUserId=${encodeURIComponent(o)}`:null,l,{keepPreviousData:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),x=h==null?void 0:h.data;Ts(()=>{!s&&!m&&x&&p(!0)},[x,s,m]);async function y(k){if(x){let c=x.find(u=>u.flowId===k);c&&c.flowState!==Z&&(c.flowState=Z),await g(Promise.resolve({...h,data:x}),{optimisticData:{...h,data:x},revalidate:!1,rollbackOnError:!1})}}async function C(k,c,u){if(x){let b=x.find(I=>I.flowId===k);b&&(b.stepStates[c]=u,b.flowState=ot),await g(Promise.resolve({...h,data:x}),{optimisticData:{...h,data:x},revalidate:!1,rollbackOnError:!1})}}async function v(k,c,u){if(x){let b=x.find(I=>I.flowId===k);b&&(b.lastStepId=c,b.stepStates[c]=u,b.flowState=ot),await g({...h,data:x},{optimisticData:{...h,data:x},revalidate:!1,rollbackOnError:!1})}}async function F(k){if(x){let c=x.find(u=>u.flowId===k);c&&c.flowState!==Be&&(c.flowState=Be,c.lastStepId=ks,Object.keys(c.stepStates).forEach(u=>{c.stepStates[u].actionType=be,c.stepStates[u].createdAt=new Date().toISOString()}),await g({...h,data:x},{optimisticData:{...h,data:x},revalidate:!1,rollbackOnError:!1}),n(k))}}async function A(k,c){if(x){let u=x.find(b=>b.flowId===k);u&&u.stepStates[c]!==be&&(u.stepStates[c]=be),await g({...h,data:x},{optimisticData:{...h,data:x},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:x,isLoadingUserFlowStateData:!s,mutateUserFlowState:g,optimisticallyMarkFlowCompleted:y,optimisticallyMarkFlowNotStarted:F,optimisticallyMarkStepCompleted:C,optimisticallyMarkStepNotStarted:A,optimisticallyMarkStepStarted:v,error:w}}function At(){let{config:e}=Oe(),{userFlowStatesData:t,mutateUserFlowState:o}=Te(),{failedFlowResponses:i,setFailedFlowResponses:r,flowResponses:n,setFlowResponses:s}=Ps(G),[p,d]=Zo(new Set),[l,h]=Zo(new Set),m=ft();function g(y){let C=JSON.stringify(y);if(p.has(C))return null;p.add(C),d(p),l.add(y),h(l);let v=n==null?void 0:n.find(F=>F.flowSlug===y.flowSlug&&F.stepId===y.stepId&&F.actionType===y.actionType&&F.createdAt===y.createdAt);return m(`${ge}flowResponses`,{...e,method:"POST",body:C}).then(F=>{F.status!==200&&F.status!==201?(console.log("Failed to send flow response for step "+y.stepId+". Will retry again later."),r([...i,y])):v||s(A=>[...A??[],y])})}async function w(y){y.foreignUserId&&(y.actionType===ot||y.actionType===Be?await g(y):y.actionType===Z?await g(y):y.actionType===Yt?await g(y):y.actionType===Fe?await g(y):y.actionType===Kt?await g(y):y.actionType===be&&await g(y))}function x(){let y=[];return t==null||t.forEach(C=>{if(C&&C.stepStates&&Object.keys(C.stepStates).length!==0)for(let v in C.stepStates){let F=C.stepStates[v];y.push({foreignUserId:C.foreignUserId,flowSlug:C.flowId,stepId:F.stepId,actionType:F.actionType,data:{},createdAt:new Date(F.createdAt),blocked:F.blocked,hidden:F.hidden})}}),[...y,...n]}return{addResponse:w,setFlowResponses:s,getFlowResponses:x}}import Bs from"swr";var vs=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Ro=e=>{let t=vs.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=Es(i,"'","");n.startsWith("flow_")&&(o=n)}),o},Es=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Y(){let{config:e}=Oe(),{flows:t,setFlows:o,userId:i,publicApiKey:r,customVariables:n,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,setFlowResponses:l,setShouldGracefullyDegrade:h}=Is(G),m={data:[]},{verifySDKInitiated:g}=gt(),{addResponse:w,getFlowResponses:x}=At(),y=f=>fetch(f,e).then(S=>S.ok?S.json():(console.log(`Error fetching ${f} (${S.status}): ${S.statusText}. .Will gracefully degrade and hide Frigade`),h(!0),m)).catch(S=>(console.log(`Error fetching ${f}: ${S}. Will gracefully degrade and hide Frigade`),h(!0),m)),{userFlowStatesData:C,isLoadingUserFlowStateData:v,optimisticallyMarkFlowCompleted:F,optimisticallyMarkFlowNotStarted:A,optimisticallyMarkStepCompleted:k,optimisticallyMarkStepNotStarted:c,optimisticallyMarkStepStarted:u}=Te(),{data:b,error:I,isLoading:$}=Bs(r?`${ge}flows`:null,y,{keepPreviousData:!0});As(()=>{if(I){console.error(I);return}b&&b.data&&(b.data=o(b.data))},[b,I]);function U(f){if($)return null;let S=t.find(P=>P.slug===f);return!S&&t.length>0&&!v&&!$?(console.log(`Flow with slug ${f} not found`),null):(S==null?void 0:S.active)===!1?null:S}function H(f){var E;if(!U(f))return[];let S=U(f).data;return S?(S=L(S),(((E=JSON.parse(S))==null?void 0:E.data)??[]).map(K=>{let tt=_e(K);return{handleSecondaryButtonClick:()=>{K.skippable===!0&&q(f,K.id,{skipped:!0})},...K,complete:B(f,K.id)===Fe||tt>=1,blocked:re(f,K.id),hidden:Ue(f,K.id),handlePrimaryButtonClick:()=>{(!K.completionCriteria&&(K.autoMarkCompleted||K.autoMarkCompleted===void 0)||K.completionCriteria&&K.autoMarkCompleted===!0)&&q(f,K.id)},progress:tt}}).filter(K=>K.hidden!==!0)):[]}function L(f){return f.replace(/\${(.*?)}/g,(S,P)=>n[P]!==void 0?String(n[P]):"")}function W(f){if(!U(f))return[];let S=U(f).data;return S?(S=L(S),JSON.parse(S)??{}):[]}function D(f,S){s(P=>({...P,[f]:S}))}function V(f){!v&&!$&&f&&JSON.stringify(n)!=JSON.stringify({...n,...f})&&Object.keys(f).forEach(S=>{D(S,f[S])})}let j=rt(async(f,S,P)=>{g();let E={foreignUserId:i,flowSlug:f,stepId:S,actionType:Yt,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};X(E)&&(await u(f,S,E),w(E))},[i,C]),z=rt(async(f,S,P)=>{g();let E={foreignUserId:i,flowSlug:f,stepId:S,actionType:be,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};X(E)&&(await c(f,S),w(E))},[i,C]),q=rt(async(f,S,P)=>{g();let E={foreignUserId:i,flowSlug:f,stepId:S,actionType:Fe,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};X(E)&&(await k(f,S,E),w(E))},[i,C]),Q=rt(async(f,S)=>{g();let P={foreignUserId:i,flowSlug:f,stepId:"unknown",actionType:Be,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};await A(f),X(P)&&w(P)},[i,C]),le=rt(async(f,S)=>{g();let P={foreignUserId:i,flowSlug:f,stepId:"unknown",actionType:ot,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};X(P)&&w(P)},[i,C]),O=rt(async(f,S)=>{g();let P={foreignUserId:i,flowSlug:f,stepId:"unknown",actionType:Z,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};X(P)&&(await F(f),w(P))},[i,C]),fe=rt(async(f,S)=>{g();let P={foreignUserId:i,flowSlug:f,stepId:"unknown",actionType:Kt,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};X(P)&&(await F(f),w(P))},[i,C]);function X(f){var S;if(!C&&f.actionType===be)return!1;if(C){let P=C.find(E=>E.flowId===f.flowSlug);if(f.actionType===be&&(!(P!=null&&P.stepStates[f.stepId])||P.stepStates[f.stepId].actionType===be)||P&&((S=P.stepStates[f.stepId])==null?void 0:S.actionType)===f.actionType)return!1}return!0}function B(f,S){let P=xe(f,S);return v?null:P?P.actionType:be}function re(f,S){let P=xe(f,S);return P?P.blocked:!1}function Ue(f,S){let P=xe(f,S);return P?P.hidden:!1}function xe(f,S){if(v)return null;let P=C==null?void 0:C.find(E=>E.flowId===f);return!P||!P.stepStates[S]?null:P.stepStates[S]??null}function Se(f){var P;if(v||!C)return null;if(We(f)===Be)return H(f)[0]??null;let S=(P=C.find(E=>E.flowId===f))==null?void 0:P.lastStepId;return S?H(f).find(E=>E.id===S):null}function ce(f){let S=Se(f);if(!S)return 0;let P=H(f).findIndex(E=>E.id===S.id)??0;return B(f,S.id)===Fe&&P<H(f).length-1?P+1:P}function _e(f){if(!f.completionCriteria)return;let S=Ro(f.completionCriteria);if(S===null)return;let P=et(S),E=_(S);return E===0?void 0:P/E}function We(f){let S=C==null?void 0:C.find(P=>P.flowId===f);return S?S.flowState:null}function et(f){let S=H(f);return S.length===0?0:S.filter(E=>B(f,E.id)===Fe).length}function _(f){return H(f).length}function Ie(f){return JSON.parse(t.find(S=>S.slug===f).data)}function Ae(f){if(v)return!0;if(f!=null&&f.targetingLogic&&C){let S=C.find(P=>P.flowId===f.slug);if(S)return S.shouldTrigger===!1}return!!(f!=null&&f.targetingLogic&&i&&i.startsWith("guest_"))}function bo(f){return!Ae(U(f))}return{getFlow:U,getFlowData:Ie,isLoading:v||$,getStepStatus:B,getFlowSteps:H,getCurrentStepIndex:ce,markStepStarted:j,markStepCompleted:q,markFlowNotStarted:Q,markFlowStarted:le,markFlowCompleted:O,markFlowAborted:fe,markStepNotStarted:z,getFlowStatus:We,getNumberOfStepsCompleted:et,getNumberOfSteps:_,targetingLogicShouldHideFlow:Ae,setCustomVariable:D,updateCustomVariables:V,customVariables:n,getStepOptionalProgress:_e,getFlowMetadata:W,isStepBlocked:re,isStepHidden:Ue,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,isFlowAvailableToUser:bo}}import{useCallback as er,useContext as Os,useEffect as Ls}from"react";var ht="guest_";function wo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=Os(G),{config:n}=Oe(),{mutateUserFlowState:s}=Te(),p=ft(),{verifySDKInitiated:d}=gt();Ls(()=>{if(e&&!t){if(e.startsWith(ht))return;let m=`frigade-user-registered-${e}`;localStorage.getItem(m)||(p(`${ge}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(m,"true"))}},[e,r,t]);let l=er(async m=>{d();let g={foreignId:e,properties:m};await p(`${ge}users`,{...n,method:"POST",body:JSON.stringify(g)}),i(w=>({...w,...m})),s()},[e,n,r,s]),h=er(async(m,g)=>{d();let x={foreignId:e,events:[{event:m,properties:g}]};await p(`${ge}users`,{...n,method:"POST",body:JSON.stringify(x)}),s()},[e,n,s]);return{userId:e,setUserId:o,addPropertiesToUser:l,trackEventForUser:h}}import{v4 as ra}from"uuid";import Le,{useEffect as Zl,useState as Rl}from"react";import He,{useEffect as _s}from"react";import Jt from"styled-components";import Ns from"react";import Ds from"styled-components";var tr="fr-",Bt="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+" "+Bt+e}return o}function T(e){if(!e.className||e.className.indexOf(Bt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(tr)?"":`:not(${o.map(i=>`.${i}`).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 Ms=Ds.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -23,7 +23,7 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,
|
|
26
|
+
`,rr=({onClose:e,appearance:t})=>Ns.createElement(Ms,{className:a("modalBackground",t),onClick:()=>e()});import Xt from"react";import $s from"styled-components";var Us=$s.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
@@ -91,7 +91,7 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
91
91
|
::-webkit-scrollbar {
|
|
92
92
|
display: none;
|
|
93
93
|
}
|
|
94
|
-
`,Ye=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:r,appearance:n,dismissible:s=!0})=>(_s(()=>{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(Ws,null,He.createElement(
|
|
94
|
+
`,Ye=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:r,appearance:n,dismissible:s=!0})=>(_s(()=>{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(Ws,null,He.createElement(rr,{appearance:n,onClose:()=>{s&&e()}}),He.createElement(Hs,{appearance:n,className:a("modalContainer",n),styleOverrides:i},s&&He.createElement(Gs,{className:a("modalClose",n),onClick:()=>e(),appearance:n},He.createElement(Pe,null)),o&&He.createElement(zs,null,o),He.createElement(js,null,r))):He.createElement(He.Fragment,null));import Xe,{useEffect as Vs}from"react";import Qt from"styled-components";import{Portal as qs}from"react-portal";var Ks=Qt.div`
|
|
95
95
|
${e=>T(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}};
|
|
@@ -128,7 +128,7 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
128
128
|
::-webkit-scrollbar {
|
|
129
129
|
display: none;
|
|
130
130
|
}
|
|
131
|
-
`,
|
|
131
|
+
`,ir=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:r})=>(Vs(()=>{let n=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",n),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",n)}},[e,t]),t?Xe.createElement(qs,null,Xe.createElement(Ks,{appearance:r,className:a("cornerModalContainer",r)},Xe.createElement(Xs,{className:a("cornerModalClose",r),onClick:()=>e()},Xe.createElement(Pe,null)),o&&Xe.createElement(Ys,null,o),Xe.createElement(Js,null,i))):Xe.createElement(Xe.Fragment,null));import{useContext as Qs}from"react";function J(){let{defaultAppearance:e}=Qs(G);function t(o){let i=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(i.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(i.theme,o.theme??{})}:i}return{mergeAppearanceWithDefault:t}}import eo,{useEffect as al,useState as yr}from"react";import Sr from"styled-components";import vo,{useEffect as Zs,useState as ar}from"react";import Eo from"styled-components";import ko from"styled-components";var nr=ko.label`
|
|
132
132
|
${e=>T(e)} {
|
|
133
133
|
font-size: 14px;
|
|
134
134
|
line-height: 20px;
|
|
@@ -136,7 +136,7 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
136
136
|
margin-top: 10px;
|
|
137
137
|
}
|
|
138
138
|
display: flex;
|
|
139
|
-
`,
|
|
139
|
+
`,sr=ko.span`
|
|
140
140
|
font-weight: 400;
|
|
141
141
|
font-size: 14px;
|
|
142
142
|
line-height: 22px;
|
|
@@ -144,16 +144,16 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
144
144
|
display: flex;
|
|
145
145
|
margin-right: 5px;
|
|
146
146
|
margin-top: 10px;
|
|
147
|
-
`,
|
|
147
|
+
`,lr=ko.div`
|
|
148
148
|
display: flex;
|
|
149
149
|
align-items: flex-start;
|
|
150
150
|
justify-content: left;
|
|
151
151
|
margin-bottom: 10px;
|
|
152
|
-
`;import
|
|
152
|
+
`;import Po from"react";function nt({title:e,required:t,appearance:o}){return Po.createElement(lr,null,t?Po.createElement(sr,null,"*"):null,Po.createElement(nr,{className:a("formLabel",o)},e))}var Rs=Eo.div`
|
|
153
153
|
display: flex;
|
|
154
154
|
flex-direction: column;
|
|
155
155
|
width: 100%;
|
|
156
|
-
`,Eo
|
|
156
|
+
`,Io=Eo.input`
|
|
157
157
|
${e=>T(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}};
|
|
@@ -169,7 +169,7 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
169
169
|
box-sizing: border-box;
|
|
170
170
|
padding: 0 10px;
|
|
171
171
|
margin-bottom: 10px;
|
|
172
|
-
`,el=
|
|
172
|
+
`,el=Eo.textarea`
|
|
173
173
|
${e=>T(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}};
|
|
@@ -185,13 +185,13 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
185
185
|
min-height: 70px;
|
|
186
186
|
box-sizing: border-box;
|
|
187
187
|
margin-bottom: 10px;
|
|
188
|
-
`;function
|
|
188
|
+
`;function pr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i}){let r=e,[n,s]=ar(""),[p,d]=ar(!1),l=Io;Zs(()=>{n===""&&!p&&(d(!0),h(""))},[]);function h(m){if(s(m),r.required===!0&&m.trim()===""){i([{id:r.id,message:`${r.title} is required`}]);return}i([]),o({text:m})}return r.multiline&&(l=el),vo.createElement(Rs,null,vo.createElement(nt,{title:r.title,required:r.required,appearance:t.appearance}),vo.createElement(l,{className:a("inputComponent",t.appearance),value:n,onChange:m=>{h(m.target.value)},appearance:t.appearance,placeholder:r.placeholder}))}import ze,{useEffect as dr,useState as cr}from"react";import mr from"styled-components";var tl=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
|
-
`,ol=
|
|
194
|
+
`,ol=mr.select`
|
|
195
195
|
${e=>T(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}};
|
|
@@ -215,13 +215,13 @@ import at,{createContext as ia,useEffect as $o,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
|
-
`,Zt="null";function
|
|
218
|
+
`,Zt="null";function ur({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i}){var l,h,m,g,w;let r=e,[n,s]=cr(""),[p,d]=cr(!1);return dr(()=>{var x,y,C,v;if(n===""&&!p){if(d(!0),r.requireSelection){s(Zt);return}if(r.defaultValue&&((x=r.props.options)!=null&&x.find(F=>F.id===r.defaultValue))){let F=(y=r.props.options)==null?void 0:y.find(A=>A.id===r.defaultValue);s(F.id),o({choice:[F.id]})}else s(((C=r.props.options)==null?void 0:C[0].id)||""),o({choice:[((v=r.props.options)==null?void 0:v[0].id)||""]})}},[]),dr(()=>{r.requireSelection&&n===Zt?i([{message:"Please select an option",id:r.id}]):i([])},[n]),ze.createElement(tl,null,ze.createElement(nt,{title:r.title,required:!1,appearance:t.appearance}),ze.createElement(ol,{value:n,onChange:x=>{s(x.target.value),o({choice:[x.target.value]})},placeholder:r.placeholder,appearance:t.appearance,className:a("multipleChoiceSelect",t.appearance)},r.requireSelection&&ze.createElement("option",{key:Zt,value:Zt},"Select an option"),(l=r.props.options)==null?void 0:l.map(x=>ze.createElement("option",{key:x.id,value:x.id},x.title))),((m=(h=r.props.options)==null?void 0:h.find(x=>x.id===n))==null?void 0:m.isOpenEnded)&&ze.createElement(ze.Fragment,null,ze.createElement(nt,{title:((w=(g=r.props.options)==null?void 0:g.find(x=>x.id===n))==null?void 0:w.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),ze.createElement(Io,{type:"text",placeholder:"Enter your answer here",onChange:x=>{o({choice:[x.target.value]})},appearance:t.appearance})))}import Ao,{useEffect as fr,useState as gr}from"react";import hr from"styled-components";var rl=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
|
-
`,il=
|
|
224
|
+
`,il=hr.button`
|
|
225
225
|
${e=>T(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}};
|
|
@@ -243,7 +243,7 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
243
243
|
height: 60px;
|
|
244
244
|
padding: 0 18px;
|
|
245
245
|
margin-bottom: 10px;
|
|
246
|
-
`;function
|
|
246
|
+
`;function xr({formInput:e,customFormTypeProps:t,onSaveInputData:o}){var d;let i=e,[r,n]=gr([]),[s,p]=gr(!1);return fr(()=>{r.length==0&&!s&&(p(!0),o({choice:[]}))},[]),fr(()=>{o({choice:r})},[r]),Ao.createElement(rl,null,Ao.createElement(nt,{title:i.title,required:i.required,appearance:t.appearance}),(d=i.props.options)==null?void 0:d.map(l=>Ao.createElement(il,{appearance:t.appearance,key:l.id,value:l.id,"data-selected":r.includes(l.id),onClick:()=>{if(r.includes(l.id)){n(r.filter(h=>h!==l.id));return}r.length<i.props.maxChoices?n([...r,l.id]):r.length==1&&i.props.maxChoices==1&&n([l.id])}},l.title)))}import Rt from"react";import Cr from"styled-components";import nl from"dompurify";function ie(e){return{__html:nl.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var sl=Cr.h1`
|
|
247
247
|
${e=>T(e)} {
|
|
248
248
|
font-style: normal;
|
|
249
249
|
font-weight: 600;
|
|
@@ -254,7 +254,7 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
254
254
|
margin-bottom: 4px;
|
|
255
255
|
color: ${e=>e.appearance.theme.colorText};
|
|
256
256
|
}
|
|
257
|
-
`,ll=
|
|
257
|
+
`,ll=Cr.h2`
|
|
258
258
|
${e=>T(e)} {
|
|
259
259
|
font-style: normal;
|
|
260
260
|
font-weight: 400;
|
|
@@ -271,15 +271,15 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
271
271
|
`,dl=Sr.div`
|
|
272
272
|
padding-left: 1px;
|
|
273
273
|
padding-right: 1px;
|
|
274
|
-
`,cl={text:
|
|
274
|
+
`,cl={text:pr,multipleChoice:ur,multipleChoiceList:xr};function br({stepData:e,canContinue:t,setCanContinue:o,onSaveData:i,appearance:r,customFormElements:n}){var w;let s=e.props,[p,d]=yr({}),[l,h]=yr([]),m={...cl,...n};al(()=>{o(l.length===0)},[l,o]);function g(x,y){let C={...p,[x.id]:y};d(C),i(C)}return eo.createElement(dl,{className:a("multiInput",r)},eo.createElement(we,{appearance:r,title:e.title,subtitle:e.subtitle}),eo.createElement(pl,{className:a("multiInputContainer",r)},(w=s.data)==null?void 0:w.map(x=>m[x.type]?eo.createElement("span",{key:x.id},m[x.type]({formInput:x,customFormTypeProps:{stepData:e,canContinue:t,setCanContinue:o,onSaveData:i,appearance:r},onSaveInputData:y=>{g(x,y)},setFormValidationErrors:y=>{h(C=>y.length===0?C.filter(v=>v.id!==x.id):[...C,...y])}})):null)))}import Ot from"styled-components";var Tr=Ot.div`
|
|
275
275
|
align-content: flex-end;
|
|
276
276
|
text-align: right;
|
|
277
277
|
padding-top: 14px;
|
|
278
|
-
`,
|
|
278
|
+
`,wr=Ot.div`
|
|
279
279
|
display: flex;
|
|
280
280
|
flex-direction: row;
|
|
281
281
|
flex: 1 1;
|
|
282
|
-
`,
|
|
282
|
+
`,Fr=Ot.div`
|
|
283
283
|
display: flex;
|
|
284
284
|
// If type is set to large-modal, use padding 60px horizontal, 80px vertical
|
|
285
285
|
// Otherwise, use 4px padding
|
|
@@ -287,11 +287,11 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
287
287
|
flex-grow: 1;
|
|
288
288
|
flex-basis: 0;
|
|
289
289
|
position: relative;
|
|
290
|
-
`,
|
|
290
|
+
`,kr=Ot.div`
|
|
291
291
|
padding: ${e=>e.type==="large-modal"?"50px":"0px"};
|
|
292
292
|
position: relative;
|
|
293
293
|
overflow-y: auto;
|
|
294
|
-
`,
|
|
294
|
+
`,Pr=Ot.div`
|
|
295
295
|
display: flex;
|
|
296
296
|
align-self: stretch;
|
|
297
297
|
flex-grow: 1;
|
|
@@ -303,7 +303,7 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
303
303
|
background-position: center;
|
|
304
304
|
border-top-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
305
305
|
border-bottom-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
306
|
-
`;import
|
|
306
|
+
`;import oo from"react";import ml from"react";import vr from"styled-components";var ul=vr.button`
|
|
307
307
|
justify-content: center;
|
|
308
308
|
align-content: center;
|
|
309
309
|
${e=>T(e)} {
|
|
@@ -333,7 +333,7 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
333
333
|
opacity: 0.3;
|
|
334
334
|
cursor: not-allowed;
|
|
335
335
|
}
|
|
336
|
-
`,to=
|
|
336
|
+
`,to=vr.div`
|
|
337
337
|
${e=>T(e)} {
|
|
338
338
|
display: flex;
|
|
339
339
|
flex-direction: row;
|
|
@@ -343,9 +343,9 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
343
343
|
margin-right: 8px;
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
`,R=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:l=""})=>{function h(){let m=s?"buttonSecondary":"button";return l===""?m:`${l}${
|
|
346
|
+
`,R=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:l=""})=>{function h(){let m=s?"buttonSecondary":"button";return l===""?m:`${l}${or(m)}`}return ml.createElement(ul,{secondary:s,appearance:p,disabled:i,onClick:e,style:o,type:r,withMargin:d,size:n,className:a(h(),p)},t)};var Er=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:r,formType:n,selectedStep:s,steps:p,onBack:d})=>{let l=n==="inline"?"inline":"full-width";return oo.createElement(Tr,{className:a("formCTAContainer",o)},p.length>1&&s!=0&&oo.createElement(R,{title:"\u2190",onClick:d,secondary:!0,type:l,style:{display:"inline-block"},appearance:o}),e.secondaryButtonTitle?oo.createElement(R,{title:e.secondaryButtonTitle,onClick:r,secondary:!0,withMargin:!1,type:l,appearance:o}):null," ",e.primaryButtonTitle?oo.createElement(R,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:l,appearance:o}):null)};import Bo from"react";import fl from"styled-components";var gl=fl.div`
|
|
347
347
|
text-align: center;
|
|
348
|
-
`,
|
|
348
|
+
`,Ir=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:r}=J().mergeAppearanceWithDefault(i);return Bo.createElement(gl,{className:o},Bo.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((n,s)=>Bo.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?r.colorPrimary:"#E6E6E6"}))))};import st from"react";import xt from"styled-components";import{useContext as hl}from"react";function ne(){let e=hl(G);function t(r){i(r.primaryButtonUri,r.primaryButtonUriTarget)}function o(r){i(r.secondaryButtonUri,r.secondaryButtonUriTarget)}function i(r,n){if(!r)return;let s=r.startsWith("http")?"_blank":"_self";n&&n!=="_blank"&&(s="_self"),e.navigate(r,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:i}}var xl=xt.div`
|
|
349
349
|
display: flex;
|
|
350
350
|
flex-wrap: wrap;
|
|
351
351
|
align-content: center;
|
|
@@ -364,10 +364,10 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
364
364
|
flex-basis: 255px;
|
|
365
365
|
flex-grow: 0;
|
|
366
366
|
flex-shrink: 0;
|
|
367
|
-
`,
|
|
367
|
+
`,yl=xt.img`
|
|
368
368
|
width: 78px;
|
|
369
369
|
height: auto;
|
|
370
|
-
`,
|
|
370
|
+
`,Sl=xt.button`
|
|
371
371
|
font-style: normal;
|
|
372
372
|
font-weight: 600;
|
|
373
373
|
font-size: 13px;
|
|
@@ -393,7 +393,7 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
393
393
|
margin-top: 12px;
|
|
394
394
|
margin-bottom: 16px;
|
|
395
395
|
max-width: 70%;
|
|
396
|
-
`;function
|
|
396
|
+
`;function Ar({stepData:e,appearance:t}){var i,r;let{handleUrl:o}=ne();return st.createElement("div",null,st.createElement(bl,null,e.title),st.createElement(Tl,null,e.subtitle),st.createElement(xl,null,(r=(i=e.props)==null?void 0:i.links)==null?void 0:r.map(n=>st.createElement(Cl,{key:n.title},st.createElement(yl,{src:n.imageUri}),st.createElement(Sl,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{n.uri&&o(n.uri,n.uriTarget??"_blank")}},n.title)))))}import yt,{useEffect as Il}from"react";import no from"styled-components";import Oo from"react";var ro=({style:e,className:t})=>Oo.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},Oo.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),Oo.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 wl,useState as Fl}from"react";import io from"styled-components";var kl=io.div`
|
|
397
397
|
display: flex;
|
|
398
398
|
align-items: center;
|
|
399
399
|
justify-content: flex-start;
|
|
@@ -401,7 +401,7 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
401
401
|
width: 100%;
|
|
402
402
|
height: 100%;
|
|
403
403
|
position: relative;
|
|
404
|
-
`,Pl=
|
|
404
|
+
`,Pl=io.div`
|
|
405
405
|
position: absolute;
|
|
406
406
|
display: flex;
|
|
407
407
|
align-items: center;
|
|
@@ -420,59 +420,59 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
420
420
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
421
421
|
border-radius: 50%;
|
|
422
422
|
}
|
|
423
|
-
`,vl=
|
|
423
|
+
`,vl=io.video`
|
|
424
424
|
width: 100%;
|
|
425
425
|
height: 100%;
|
|
426
426
|
min-height: 200px;
|
|
427
427
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
428
|
-
`,El=
|
|
428
|
+
`,El=io.iframe`
|
|
429
429
|
width: 100%;
|
|
430
430
|
height: 100%;
|
|
431
431
|
min-height: 200px;
|
|
432
432
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
433
|
-
`;function Ct({appearance:e,videoUri:t}){let o=wl(),[i,r]=Fl(!1);if(t.includes("youtube")){let n=t.split("v=")[1],s=n.indexOf("&");return s!==-1&&(n=n.substring(0,s)),Lt.createElement(El,{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${n}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,appearance:e})}return Lt.createElement(kl,{appearance:e},!i&&Lt.createElement(Pl,{onClick:()=>{r(!0),o.current.play()},appearance:e},Lt.createElement(
|
|
433
|
+
`;function Ct({appearance:e,videoUri:t}){let o=wl(),[i,r]=Fl(!1);if(t.includes("youtube")){let n=t.split("v=")[1],s=n.indexOf("&");return s!==-1&&(n=n.substring(0,s)),Lt.createElement(El,{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${n}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,appearance:e})}return Lt.createElement(kl,{appearance:e},!i&&Lt.createElement(Pl,{onClick:()=>{r(!0),o.current.play()},appearance:e},Lt.createElement(ro,null)),Lt.createElement(vl,{appearance:e,controls:i,ref:o,play:i,src:t}))}var Al=no.div`
|
|
434
434
|
${e=>T(e)} {
|
|
435
435
|
display: flex;
|
|
436
436
|
flex-direction: column;
|
|
437
437
|
justify-content: center;
|
|
438
438
|
}
|
|
439
|
-
`,Bl=
|
|
439
|
+
`,Bl=no.img`
|
|
440
440
|
${e=>T(e)} {
|
|
441
441
|
width: 100%;
|
|
442
442
|
height: auto;
|
|
443
443
|
max-height: 250px;
|
|
444
444
|
margin-bottom: 24px;
|
|
445
445
|
}
|
|
446
|
-
`,Ol=
|
|
446
|
+
`,Ol=no.div`
|
|
447
447
|
${e=>T(e)} {
|
|
448
448
|
margin-bottom: 24px;
|
|
449
449
|
}
|
|
450
|
-
`,Ll=
|
|
450
|
+
`,Ll=no.div`
|
|
451
451
|
${e=>T(e)} {
|
|
452
452
|
width: 100%;
|
|
453
453
|
height: auto;
|
|
454
454
|
max-height: 250px;
|
|
455
455
|
margin-bottom: 24px;
|
|
456
456
|
}
|
|
457
|
-
`;function
|
|
457
|
+
`;function Br({stepData:e,appearance:t,setCanContinue:o}){return Il(()=>{o(!0)},[]),yt.createElement(Al,{className:a("callToActionContainer",t)},yt.createElement(Ol,{className:a("callToActionTextContainer",t)},yt.createElement(we,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&yt.createElement(Bl,{className:a("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&yt.createElement(Ll,{appearance:t,className:a("callToActionVideo",t)},yt.createElement(Ct,{appearance:t,videoUri:e.videoUri})))}import Ge,{useEffect as Lo,useState as No}from"react";import Mt from"react";import Nt from"react";import{motion as Nl}from"framer-motion";var Or=({color:e,percentage:t,size:o})=>{let i=o*.5-2,r=2*Math.PI*i,n=(1-t)*r,s={duration:.3,delay:0,ease:"easeIn"},p={hidden:{strokeDashoffset:r,transition:s},show:{strokeDashoffset:n,transition:s}};return Nt.createElement(Nl.circle,{r:i,cx:o*.5,cy:o*.5,fill:"transparent",stroke:n!==r?e:"",strokeWidth:"3px",strokeDasharray:r,strokeDashoffset:t?n:0,variants:p,transition:s,initial:"hidden",animate:"show"})},Dl=({fillColor:e,size:t,percentage:o,children:i,bgColor:r="#D9D9D9"})=>Nt.createElement("svg",{width:t,height:t,overflow:"visible"},Nt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},Nt.createElement(Or,{color:r,size:t}),Nt.createElement(Or,{color:e,percentage:o,size:t})),i),Dt=Dl;import Ml from"styled-components";var $l=({color:e="#FFFFFF"})=>Mt.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Mt.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),Ul={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},_l={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},Wl={border:"1px solid #000000",color:"#FFFFFF"},Hl={border:"1px solid #E6E6E6"},zl={color:"#FFFFFF"},Gl={border:"3px solid #D9D9D9"},jl=e=>e==="square"?Ul:_l,Vl=(e,t)=>e==="square"?t?Wl:Hl:t?zl:Gl,ql=Ml.div`
|
|
458
458
|
${e=>it(e)}
|
|
459
|
-
`,
|
|
459
|
+
`,St=({value:e,type:t="square",primaryColor:o="#000000",progress:i,appearance:r})=>{let n=jl(t),s=Vl(t,e);return e===!0?n={...n,...s,backgroundColor:o,borderColor:t==="square"?o:"none"}:n={...n,...s},e!==!0&&t==="round"&&i!==void 0&&i!==1?Mt.createElement(Dt,{fillColor:o,percentage:i,size:22}):Mt.createElement(ql,{styleOverrides:n,role:"checkbox",className:Ce(a("checkIconContainer",r),e?"checkIconContainerChecked":"checkIconContainerUnchecked")},e&&Mt.createElement($l,{color:"#FFFFFF"}))};import Je from"styled-components";var Lr=Je.div`
|
|
460
460
|
width: auto;
|
|
461
461
|
display: flex;
|
|
462
462
|
flex-direction: column;
|
|
463
463
|
justify-content: center;
|
|
464
464
|
align-items: center;
|
|
465
465
|
padding: 4px;
|
|
466
|
-
`,
|
|
466
|
+
`,Nr=Je.div`
|
|
467
467
|
width: 100%;
|
|
468
468
|
text-align: left;
|
|
469
|
-
`,
|
|
469
|
+
`,Dr=Je.h1`
|
|
470
470
|
font-style: normal;
|
|
471
471
|
font-weight: 700;
|
|
472
472
|
font-size: 32px;
|
|
473
473
|
line-height: 38px;
|
|
474
474
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
475
|
-
`,
|
|
475
|
+
`,Mr=Je.h1`
|
|
476
476
|
font-style: normal;
|
|
477
477
|
font-weight: 400;
|
|
478
478
|
font-size: 16px;
|
|
@@ -480,7 +480,7 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
480
480
|
margin-top: 16px;
|
|
481
481
|
margin-bottom: 16px;
|
|
482
482
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
483
|
-
|
|
483
|
+
`,$r=Je.div`
|
|
484
484
|
padding-top: 12px;
|
|
485
485
|
padding-bottom: 12px;
|
|
486
486
|
flex-direction: row;
|
|
@@ -491,17 +491,17 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
491
491
|
cursor: pointer;
|
|
492
492
|
border-bottom: ${e=>e.hideBottomBorder?"none":"1px solid #D8D8D8"};
|
|
493
493
|
width: 100%;
|
|
494
|
-
|
|
494
|
+
`,Ur=Je.div`
|
|
495
495
|
padding-top: 10px;
|
|
496
496
|
padding-bottom: 10px;
|
|
497
497
|
flex-direction: row;
|
|
498
498
|
display: flex;
|
|
499
499
|
justify-content: flex-start;
|
|
500
|
-
`,
|
|
500
|
+
`,_r=Je.img`
|
|
501
501
|
width: 42px;
|
|
502
502
|
height: 42px;
|
|
503
503
|
margin-right: 12px;
|
|
504
|
-
`,
|
|
504
|
+
`,Wr=Je.p`
|
|
505
505
|
font-style: normal;
|
|
506
506
|
font-weight: 500;
|
|
507
507
|
font-size: 17px;
|
|
@@ -509,8 +509,8 @@ import at,{createContext as ia,useEffect as $o,useState as ve}from"react";import
|
|
|
509
509
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
510
510
|
display: flex;
|
|
511
511
|
align-self: center;
|
|
512
|
-
`;var
|
|
513
|
-
${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map(([s,p])=>`${
|
|
512
|
+
`;var Hr=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=No([]),[p,d]=No(!1),[l,h]=No(e.id);return Lo(()=>{n.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),Lo(()=>{l!==e.id&&(h(e.id),s([]))},[e]),Lo(()=>{o({choice:n}),n.length>=r.minChoices?t(!0):t(!1)},[n]),Ge.createElement(Lr,{className:a("selectListContainer",i)},Ge.createElement(Nr,null,Ge.createElement(Dr,{className:a("selectListTitle",i)},e.title),Ge.createElement(Mr,{appearance:i,className:a("selectListSubtitle",i)},e.subtitle)),r.options.map((m,g)=>{let w=n.includes(m.id);return Ge.createElement($r,{key:`select-item-${g}`,onClick:()=>{if(n.includes(m.id)){s(n.filter(x=>x!==m.id));return}n.length<r.maxChoices?s([...n,m.id]):n.length==1&&r.maxChoices==1&&s([m.id])},hideBottomBorder:g===r.options.length-1,className:a("selectListSelectItem",i)},Ge.createElement(Ur,{className:a("selectListItemImage",i)},m.imageUri&&Ge.createElement(_r,{src:m.imageUri,alt:`select-icon-${g}`}),Ge.createElement(Wr,{appearance:i,className:a("selectListSelectItemText",i)},m.title)),Ge.createElement(St,{appearance:i,value:w,primaryColor:i.theme.colorPrimary}))}))};import me,{useEffect as Kl,useState as Do}from"react";import{AnimatePresence as Yl,motion as Xl}from"framer-motion";var Jl=({children:e,id:t,shouldWrap:o=!1})=>me.createElement(me.Fragment,null,o?me.createElement(Yl,{initial:!1},me.createElement(Xl.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:i,customVariables:r,onButtonClick:n,onStepCompletion:s,flowId:p,type:d,hideOnFlowCompletion:l,onComplete:h,setVisible:m,setShowModal:g,onDismiss:w,showPagination:x=!1,customFormElements:y})=>{let v={...{linkCollection:Ar,multiInput:br,callToAction:Br,selectList:Hr},...i},{primaryCTAClickSideEffects:F,secondaryCTAClickSideEffects:A}=ne(),[k,c]=Do(!1),[u,b]=Do({}),[I,$]=Do(!1),U=t[o]??null,{markStepCompleted:H,markStepStarted:L,isLoading:W,updateCustomVariables:D,markFlowCompleted:V}=Y();Kl(()=>{D(r)},[r,W]);function j(){return{data:u[t[o].id]??{},stepId:t[o].id,customVariables:r}}function z(O,fe,X){let B=o+1<t.length?t[o+1]:null;n&&n(O,o,fe,B),s&&s(O,X,B,u,j())}function q(O,fe){b(X=>{let B={};return B[O.id]=fe,{...X,...B}})}function Q(O){return O.selectedStep.imageUri?me.createElement(Pr,{image:O.selectedStep.imageUri,appearance:e,className:a("formContainerSidebarImage",e)}):null}let le=me.createElement(Er,{step:t[o],canContinue:k||!I,formType:d,selectedStep:o,appearance:e,onPrimaryClick:async()=>{$(!0);let O={...j()};await H(p,t[o].id,O),o+1<t.length&&await L(p,t[o+1].id),z(t[o],"primary",o),o+1>=t.length&&(h&&h(),w&&w(),l&&(m&&m(!1),g(!1)),await V(p)),F(t[o]),$(!1)},onSecondaryClick:()=>{z(t[o],"secondary",o),A(t[o])},onBack:async()=>{o-1>=0&&($(!0),await L(p,t[o-1].id),$(!1))},steps:t});return me.createElement(me.Fragment,null,me.createElement(wr,{className:a("formContainer",e)},me.createElement(Fr,null,me.createElement(Jl,{id:o,shouldWrap:d==="large-modal"},me.createElement(kr,{key:U.id,type:d,className:a("formContent",e)},t.map(O=>{let fe=v[O.type];return U.id!==O.id?null:me.createElement(fe,{key:O.id,stepData:O,canContinue:k,setCanContinue:c,onSaveData:X=>{q(O,X)},appearance:e,customFormElements:y})}),x&&me.createElement(Ir,{className:a("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),le))),d=="large-modal"&&me.createElement(Q,{selectedStep:t[o]})))};import $t from"react";import{createGlobalStyle as Ql}from"styled-components";function ae({appearance:e}){if(!e||!e.styleOverrides)return $t.createElement($t.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([i,r])=>typeof r=="object");if(t.length===0)return $t.createElement($t.Fragment,null);let o=Ql`
|
|
513
|
+
${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map(([s,p])=>`${Fo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return $t.createElement(o,{inlineStyles:t})}var zr=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:l=!0,onStepCompletion:h,onButtonClick:m,dismissible:g=!0,endFlowOnDismiss:w=!1,modalPosition:x="center",repeatable:y=!1,onDismiss:C,showPagination:v=!1})=>{let{getFlow:F,getFlowSteps:A,isLoading:k,targetingLogicShouldHideFlow:c,getFlowStatus:u,getCurrentStepIndex:b,markFlowCompleted:I,markFlowNotStarted:$}=Y(),U=b(e),{mergeAppearanceWithDefault:H}=J(),[L,W]=Rl(!1),{setOpenFlowState:D,getOpenFlowState:V}=ke();d=H(d);let[j,z]=i!==void 0&&r!==void 0?[i,r]:[V(e,!0),O=>D(e,O)];if(Zl(()=>{!L&&!k&&(W(!0),u(e)===Z&&y&&$(e),W(!0))},[L,W,k]),k)return null;let q=F(e);if(!q||c(q))return null;let Q=A(e);if(!Q||i!==void 0&&i===!1||u(e)===Z&&l)return null;let le=()=>{z(!1),C&&C(),w===!0&&I(e)};if(x=="center"&&o==="modal"||o==="large-modal"){let O={padding:"24px"};return o==="large-modal"?(O.width="85%",O.height="90%",O.maxHeight="800px",O.minHeight="500px",O.padding="0"):O.width="400px",Le.createElement(Ye,{appearance:d,onClose:le,visible:j,style:O,dismissible:g},Le.createElement(ae,{appearance:d}),Le.createElement(so,{appearance:d,steps:Q,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:m,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:r,setShowModal:z,onDismiss:C,showPagination:v,customFormElements:s}))}return o==="modal"&&x!=="center"?Le.createElement(ir,{appearance:d,onClose:le,visible:j},Le.createElement(ae,{appearance:d}),Le.createElement(so,{appearance:d,steps:Q,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:m,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:r,setShowModal:z,onDismiss:C,showPagination:v,customFormElements:s})):Le.createElement(Le.Fragment,null,Le.createElement(ae,{appearance:d}),Le.createElement(so,{appearance:d,steps:Q,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:m,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:r,setShowModal:z,onDismiss:C,showPagination:v,customFormElements:s}))},Gr=zr;import{useCallback as jr,useContext as ea,useEffect as ta}from"react";function Mo(){let{organizationId:e,userId:t,setOrganizationId:o}=ea(G),{mutateUserFlowState:i}=Te(),{config:r}=Oe(),n=ft(),{verifySDKInitiated:s}=gt();ta(()=>{if(t&&e){if(t.startsWith(ht))return;let l=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(l)||(n(`${ge}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(l,"true"))}},[t,e]);let p=jr(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 h={foreignUserId:t,foreignUserGroupId:e,properties:l};await n(`${ge}userGroups`,{...r,method:"POST",body:JSON.stringify(h)}),i()},[e,t,r,i]),d=jr(async(l,h)=>{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 g={foreignUserId:t,foreignUserGroupId:e,events:[{event:l,properties:h}]};await n(`${ge}userGroups`,{...r,method:"POST",body:JSON.stringify(g)}),i()},[e,t,r,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:p,trackEventForOrganization:d}}var Vr="xFrigade_guestUserId",qr="xFrigade_userId",Kr=({})=>{let{setFlowResponses:e}=At(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Te(),{userId:r,setUserId:n}=wo(),[s,p]=$o(null),{getFlowStatus:d}=Y(),{flows:l,userProperties:h,setIsNewGuestUser:m,flowResponses:g}=oa(G),[w,x]=$o([]),[y,C]=$o([]),{organizationId:v}=Mo();lo(()=>{if(!o&&t)for(let c=0;c<t.length;c++){let u=t[c],b=l.find(I=>I.slug===(u==null?void 0:u.flowId));if(b&&u&&u.shouldTrigger===!0&&b.type=="FORM"&&b.triggerType==="AUTOMATIC"&&!y.includes(b.slug)){setTimeout(()=>{F(u.flowId)},500);break}}},[o,t]),lo(()=>{g.length>0&&i()},[g]);function F(c){let u=l.find(b=>b.slug===c);u&&u.triggerType==="AUTOMATIC"&&!y.includes(u.slug)&&(C([...y,u.slug]),x([u]))}function A(){if(!r){let c=localStorage.getItem(qr);if(c){n(c);return}let u=localStorage.getItem(Vr);if(u){n(u);return}m(!0);let b=ht+ra();try{localStorage.setItem(Vr,b)}catch(I){console.log("Failed to save guest user id locally: Local storage unavailable",I)}n(I=>I||b)}}lo(()=>{try{if(l){let c=[];l.forEach(u=>{if(u.data){let b=u.data.match(/"imageUri":"(.*?)"/g);b&&b.forEach(I=>{let $=I.replace('"imageUri":"',"").replace('"',"");if(c.includes($))return;let U=new Image;U.src=$,c.push($)})}})}}catch{}},[l]),lo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(ht))try{localStorage.setItem(qr,r)}catch(c){console.log("Failed to save user id locally: Local storage available",c)}r===null&&setTimeout(()=>{r===null&&A()},50)},[r,l,h]);function k(){return lt.createElement(lt.Fragment,null,w.map(c=>d(c.slug)!==Be?null:lt.createElement("span",{key:c.slug},lt.createElement(Gr,{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 sa}from"react-error-boundary";var G=ia({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:()=>{}}),la=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var D,V;let[n,s]=ve(t||null),[p,d]=ve(o||null),[l,h]=ve([]),[m,g]=ve([]),[w,x]=ve([]),[y,C]=ve({}),[v,F]=ve({}),[A,k]=ve({}),[c,u]=ve(!1),[b,I]=ve(!1),[$,U]=ve(!W(e)),H=(j,z)=>{if(z==="_blank"){window.open(j,"_blank");return}setTimeout(()=>{window.location.href=j},50)},L={theme:{...ao.theme,...((D=i==null?void 0:i.defaultAppearance)==null?void 0:D.theme)??{}},styleOverrides:{...ao.styleOverrides,...((V=i==null?void 0:i.defaultAppearance)==null?void 0:V.styleOverrides)??{}}};function W(j){return!!(j&&j.length>10&&j.substring(0,10)==="api_public")}return Uo(()=>{t&&s(t)},[t]),Uo(()=>{o&&d(o)},[o]),Uo(()=>{if(W(e))U(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),U(!0);return}},[e,U]),$?at.createElement(G.Provider,{value:{publicApiKey:e,userId:n,setUserId:s,setFlows:h,flows:l,failedFlowResponses:m,setFailedFlowResponses:g,flowResponses:w,setFlowResponses:x,userProperties:y,setUserProperties:C,openFlowStates:v,setOpenFlowStates:F,customVariables:A,setCustomVariables:k,isNewGuestUser:c,setIsNewGuestUser:u,hasActiveFullPageFlow:b,setHasActiveFullPageFlow:I,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:H,defaultAppearance:L,shouldGracefullyDegrade:$,setShouldGracefullyDegrade:U}},r):at.createElement(sa,{fallback:at.createElement(at.Fragment,null,r)},at.createElement(G.Provider,{value:{publicApiKey:e,userId:n,setUserId:s,setFlows:h,flows:l,failedFlowResponses:m,setFailedFlowResponses:g,flowResponses:w,setFlowResponses:x,userProperties:y,setUserProperties:C,openFlowStates:v,setOpenFlowStates:F,customVariables:A,setCustomVariables:k,isNewGuestUser:c,setIsNewGuestUser:u,hasActiveFullPageFlow:b,setHasActiveFullPageFlow:I,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:H,defaultAppearance:L,shouldGracefullyDegrade:$,setShouldGracefullyDegrade:U}},at.createElement(na,{theme:L.theme},r,at.createElement(Kr,null))))};import ip from"react";import oe,{useEffect as Fn,useState as kn}from"react";import Ee,{useState as Ia}from"react";import dt from"styled-components";import uo from"react";import po from"react";import Xr from"styled-components";var Yr=Xr.span`
|
|
514
514
|
font-weight: 400;
|
|
515
515
|
font-size: 15px;
|
|
516
516
|
line-height: 20px;
|
|
@@ -527,7 +527,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
527
527
|
padding-bottom: 20px;
|
|
528
528
|
border-top: 1px solid ${e=>e.theme.colorBorder};
|
|
529
529
|
width: 100%;
|
|
530
|
-
`,
|
|
530
|
+
`,co=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:r,primaryColor:n="#000000",checkBoxType:s="square",appearance:p})=>po.createElement(aa,{className:a("checklistStepsContainer",p),appearance:p,style:{...r}},i==="left"&&e&&po.createElement(Yr,{className:a("checklistStepLabel",p),style:o},e),po.createElement(St,{appearance:p,value:t,type:s,primaryColor:n}),i==="right"&&e&&po.createElement(Yr,{className:a("checklistStepLabel",p),style:o},e));import{motion as pa}from"framer-motion";import Ut from"styled-components";var Jr=Ut.div`
|
|
531
531
|
font-weight: 700;
|
|
532
532
|
font-size: 18px;
|
|
533
533
|
line-height: 22px;
|
|
@@ -544,7 +544,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
544
544
|
max-width: 540px;
|
|
545
545
|
margin: 8px 0px 0px 0px;
|
|
546
546
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
547
|
-
`,
|
|
547
|
+
`,mo=Ut.div`
|
|
548
548
|
width: 4px;
|
|
549
549
|
position: absolute;
|
|
550
550
|
left: 0;
|
|
@@ -555,18 +555,18 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
555
555
|
`,Rr=Ut.div`
|
|
556
556
|
flex-direction: row;
|
|
557
557
|
justify-content: flex-start;
|
|
558
|
-
`;var ei=({data:e,index:t,isSelected:o,primaryColor:i,style:r,onClick:n,appearance:s})=>{var p,d;return
|
|
558
|
+
`;var ei=({data:e,index:t,isSelected:o,primaryColor:i,style:r,onClick:n,appearance:s})=>{var p,d;return uo.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{n()}},o&&uo.createElement(mo,{className:a("checklistStepItemSelectedIndicator",s),as:pa.div,layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??i}}),uo.createElement(Rr,{className:a("checklistStepItem",s),key:`hero-checklist-step-${t}`,role:"listitem"},uo.createElement(co,{value:e.complete,labelPosition:"left",label:e.stepName,style:r,primaryColor:((d=s==null?void 0:s.theme)==null?void 0:d.colorPrimary)??i,appearance:s})))};import pt from"react";import{motion as da}from"framer-motion";import _o from"styled-components";var ca={backgroundColor:"#E6E6E6"},ma=_o.div`
|
|
559
559
|
display: flex;
|
|
560
560
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
561
561
|
justify-content: flex-start;
|
|
562
562
|
align-items: ${e=>e.textLocation=="top"?"flex-end":"center"};
|
|
563
563
|
|
|
564
564
|
${e=>it(e)}
|
|
565
|
-
`,ua=
|
|
565
|
+
`,ua=_o.div`
|
|
566
566
|
flex-grow: 1;
|
|
567
567
|
position: relative;
|
|
568
568
|
${e=>e.textLocation=="top"?"width: 100%;":""}
|
|
569
|
-
`,fa=
|
|
569
|
+
`,fa=_o.span`
|
|
570
570
|
font-weight: 500;
|
|
571
571
|
font-size: 15px;
|
|
572
572
|
line-height: 18px;
|
|
@@ -574,11 +574,11 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
574
574
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
575
575
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
576
576
|
${e=>it(e)}
|
|
577
|
-
`,ga={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},ha={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},Ne=({count:e,total:t,fillColor:o,bgColor:i=ca.backgroundColor,display:r="count",textLocation:n="left",style:s={},textStyle:p={},appearance:d})=>{var x,
|
|
577
|
+
`,ga={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},ha={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},Ne=({count:e,total:t,fillColor:o,bgColor:i=ca.backgroundColor,display:r="count",textLocation:n="left",style:s={},textStyle:p={},appearance:d})=>{var x,y;if(t===0)return pt.createElement(pt.Fragment,null);let l=e===0?"10px":`${e/t*100}%`,h=r==="compact"?"5px":"10px",m=Math.round(e/t*100),g=r==="compact"?"5px":"20px",w;return r==="count"?w=`${e} of ${t}`:r==="compact"?w=`${m}%`:r==="percent"&&(w=`${m}% complete`),n==="top"&&(g="0px"),pt.createElement(ma,{className:a("progressBarContainer",d),textLocation:n,styleOverrides:s},pt.createElement(fa,{className:a("progressBarStepText",d),style:{...p,fontSize:r==="compact"?12:15,fontWeight:r==="compact"?400:500},appearance:d,padding:g,textLocation:n},w),pt.createElement(ua,{textLocation:n,className:a("progressBar",d)},pt.createElement(da.div,{style:{...ha,width:l,height:h,backgroundColor:((x=d==null?void 0:d.theme)==null?void 0:x.colorPrimary)??o,zIndex:r=="compact"?1:5},className:a("progressBarFill",d)}),pt.createElement("div",{className:a("progressBarBackground",d),style:{...ga,height:h,backgroundColor:((y=d==null?void 0:d.theme)==null?void 0:y.colorSecondary)??i}})))};import Wt from"react";import xa from"styled-components";import go from"react";import fo from"react";var bt=({stepData:e,appearance:t})=>fo.createElement(fo.Fragment,null,fo.createElement(Qr,{appearance:t,className:a("checklistStepTitle",t),dangerouslySetInnerHTML:ie(e.title)}),fo.createElement(Zr,{appearance:t,className:a("checklistStepSubtitle",t),dangerouslySetInnerHTML:ie(e.subtitle)}));import _t from"react";var Tt=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return _t.createElement(_t.Fragment,null,_t.createElement(to,null,e.secondaryButtonTitle&&_t.createElement(R,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}),_t.createElement(R,{appearance:t,title:e.primaryButtonTitle,onClick:o})))};var wt=({stepData:e,appearance:t})=>go.createElement(go.Fragment,null,go.createElement(bt,{stepData:e,appearance:t}),go.createElement(Tt,{stepData:e,appearance:t}));import ti from"react";function oi(e){if(e.videoUri.includes("youtube")){let t=e.videoUri.split("v=")[1],o=t.indexOf("&");return o!==-1&&(t=t.substring(0,o)),ti.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 ti.createElement("video",{width:"480",height:"260",controls:!0,src:e.videoUri})}var Wo="default",Ca=xa.img`
|
|
578
578
|
border-radius: 4px;
|
|
579
579
|
max-height: 260px;
|
|
580
580
|
min-height: 200px;
|
|
581
|
-
`,ri=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Wt.createElement("div",null,o)}return Wt.createElement(Jr,{className:a("checklistStepContent",t)},e.imageUri?Wt.createElement(Ca,{className:a("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Wt.createElement(oi,{videoUri:e.videoUri,appearance:t}):null,Wt.createElement(wt,{stepData:e,appearance:t}))};import
|
|
581
|
+
`,ri=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Wt.createElement("div",null,o)}return Wt.createElement(Jr,{className:a("checklistStepContent",t)},e.imageUri?Wt.createElement(Ca,{className:a("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Wt.createElement(oi,{videoUri:e.videoUri,appearance:t}):null,Wt.createElement(wt,{stepData:e,appearance:t}))};import ye,{useRef as ya,useState as Sa}from"react";import Ft from"styled-components";var ii=Ft.div`
|
|
582
582
|
display: block;
|
|
583
583
|
`,ba=Ft.div`
|
|
584
584
|
display: flex;
|
|
@@ -623,9 +623,9 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
623
623
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
624
624
|
border-radius: 50%;
|
|
625
625
|
}
|
|
626
|
-
`,ni="videoCarousel",si=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return
|
|
626
|
+
`,ni="videoCarousel",si=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return ye.createElement(ii,null,ye.createElement(wt,{stepData:e,appearance:t}));function o({video:n}){let s=ya(),[p,d]=Sa(!1);return ye.createElement(Ta,null,!p&&ye.createElement(ka,{onClick:()=>{d(!0),s.current.play()},appearance:t},ye.createElement(ro,null)),ye.createElement(wa,{controls:p,ref:s,play:p,src:n.uri}),ye.createElement(Fa,null,n.title))}let i=e.props;return i.videos?ye.createElement(ii,null,ye.createElement(bt,{stepData:e,appearance:t}),ye.createElement(ba,null,i.videos.map((n,s)=>ye.createElement("span",{key:`${n.uri}-${s}`},ye.createElement(o,{video:n})))),ye.createElement(Tt,{stepData:e,appearance:t})):null};import je from"react";import ho from"styled-components";var li=ho.div`
|
|
627
627
|
display: block;
|
|
628
|
-
`,Pa=
|
|
628
|
+
`,Pa=ho.pre`
|
|
629
629
|
display: block;
|
|
630
630
|
background-color: #2a2a2a;
|
|
631
631
|
color: #f8f8f8;
|
|
@@ -641,12 +641,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
641
641
|
white-space: -o-pre-wrap; /* Opera 7 */
|
|
642
642
|
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
|
643
643
|
margin-bottom: 24px;
|
|
644
|
-
`,va=
|
|
644
|
+
`,va=ho.div`
|
|
645
645
|
font-size: 15px;
|
|
646
646
|
line-height: 20px;
|
|
647
647
|
margin-bottom: 12px;
|
|
648
648
|
margin-top: 12px;
|
|
649
|
-
`,Ea=
|
|
649
|
+
`,Ea=ho.div`
|
|
650
650
|
margin-top: 24px;
|
|
651
651
|
`,ai="codeSnippet",pi=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return je.createElement(li,null,je.createElement(wt,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?je.createElement(li,null,je.createElement(bt,{stepData:e,appearance:t}),je.createElement(Ea,null,o.codeSnippets.map((r,n)=>je.createElement("div",{key:n},r.title?je.createElement(va,null,r.title):null,r.code?je.createElement(Pa,null,r.code):null))),je.createElement(Tt,{stepData:e,appearance:t})):null};var Aa=dt.div`
|
|
652
652
|
display: flex;
|
|
@@ -679,9 +679,9 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
679
679
|
`,Da=dt.div`
|
|
680
680
|
flex: 2;
|
|
681
681
|
padding: 2rem;
|
|
682
|
-
`,Ma=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:d,type:l})=>{let{mergeAppearanceWithDefault:h}=J();d=h(d);let g={...{[
|
|
682
|
+
`,Ma=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:d,type:l})=>{let{mergeAppearanceWithDefault:h}=J();d=h(d);let g={...{[Wo]:ri,[ni]:si,[ai]:pi},...p},[w,x]=Ia(0),y=r??w,C=n??x,v=o.filter(A=>A.complete===!0).length,F=()=>{var A;return!((A=o[y])!=null&&A.type)||!g[o[y].type]?g[Wo]({stepData:o[y],appearance:d}):g[o[y].type]({stepData:o[y],appearance:d})};return Ee.createElement(Aa,{type:l,style:i,className:s,appearance:d},Ee.createElement(di,{style:{flex:1}},Ee.createElement(di,{style:{padding:"30px 0px 30px 30px",borderBottom:"none"}},Ee.createElement(Ba,{className:a("checklistTitle",d),appearance:d},e),Ee.createElement(Oa,{className:a("checklistSubtitle",d),appearance:d},t),Ee.createElement(Ne,{total:o.length,count:v,fillColor:d.theme.colorPrimary,style:{marginTop:"24px"},appearance:d})),Ee.createElement(La,{className:a("checklistStepsContainer",d)},o.map((A,k)=>Ee.createElement(ei,{data:A,index:k,key:k,listLength:o.length,isSelected:k===y,primaryColor:d.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{C(k)}})))),Ee.createElement(Na,{appearance:d,className:a("checklistDivider",d)}),Ee.createElement(Da,null,Ee.createElement(F,null)))},Ho=Ma;import N,{useState as za}from"react";import ci from"react";import $a from"styled-components";var Ua=$a.svg`
|
|
683
683
|
transition: 'transform 0.35s ease-in-out';
|
|
684
|
-
`,kt=({color:e="#323232",style:t,className:o})=>ci.createElement(Ua,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},ci.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as Ga}from"framer-motion";import se from"styled-components";var
|
|
684
|
+
`,kt=({color:e="#323232",style:t,className:o})=>ci.createElement(Ua,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},ci.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as Ga}from"framer-motion";import se 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"},mi=se.div`
|
|
685
685
|
max-height: 350px;
|
|
686
686
|
padding-bottom: 40px;
|
|
687
687
|
`,ui=se.div`
|
|
@@ -725,10 +725,10 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
725
725
|
color: #8c8c8c;
|
|
726
726
|
margin: 20px;
|
|
727
727
|
}
|
|
728
|
-
`,
|
|
728
|
+
`,yi=se.div`
|
|
729
729
|
display: flex;
|
|
730
730
|
flex-direction: row;
|
|
731
|
-
`,
|
|
731
|
+
`,Si=se.div`
|
|
732
732
|
flex: 1;
|
|
733
733
|
`,bi=se.div`
|
|
734
734
|
${e=>T(e)} {
|
|
@@ -894,7 +894,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
894
894
|
line-height: 14px;
|
|
895
895
|
font-weight: 400;
|
|
896
896
|
cursor: pointer;
|
|
897
|
-
`;var Ha=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ne();return qe.createElement(Bi,{style:t,className:a("guideContainer",r)},qe.createElement(Li,{className:a("guideTitle",r)},o),qe.createElement(Oi,{className:a("guideItemContainer",r)},e.map((p,d)=>qe.createElement(Ni,{key:`guide-${p.id??d}`,as:Wa.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:a("guideItem",r)},p.icon&&qe.createElement(Di,{className:a("guideIcon",r)},qe.createElement(Mi,null,p.icon)),qe.createElement($i,{className:a("guideItemTitle",r),dangerouslySetInnerHTML:ie(p.title)}),qe.createElement(Ui,{className:a("guideItemSubtitle",r),dangerouslySetInnerHTML:ie(p.subtitle)}),qe.createElement(_i,{className:a("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},Ht=Ha;var ja=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:r,onClose:n,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:l,guideData:h,guideTitle:m,onGuideButtonClick:g})=>{let w=({stepData:u,handleSecondaryCTAClick:b,handleCTAClick:I})=>u?N.createElement(bi,{className:a("checklistStepContainer",l),"data-testid":"checklistStepContainer"},N.createElement(Ti,{appearance:l,className:a("checklistStepTitle",l),dangerouslySetInnerHTML:ie(u.title)}),N.createElement(wi,{appearance:l,className:a("checklistStepSubtitle",l),dangerouslySetInnerHTML:ie(u.subtitle)}),N.createElement(Fi,{className:a("checklistCTAContainer",l)},u.secondaryButtonTitle&&N.createElement(R,{title:u.secondaryButtonTitle,onClick:b,appearance:l,secondary:!0}),N.createElement(R,{title:u.primaryButtonTitle,onClick:I,appearance:l}))):N.createElement(N.Fragment,null),
|
|
897
|
+
`;var Ha=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ne();return qe.createElement(Bi,{style:t,className:a("guideContainer",r)},qe.createElement(Li,{className:a("guideTitle",r)},o),qe.createElement(Oi,{className:a("guideItemContainer",r)},e.map((p,d)=>qe.createElement(Ni,{key:`guide-${p.id??d}`,as:Wa.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:a("guideItem",r)},p.icon&&qe.createElement(Di,{className:a("guideIcon",r)},qe.createElement(Mi,null,p.icon)),qe.createElement($i,{className:a("guideItemTitle",r),dangerouslySetInnerHTML:ie(p.title)}),qe.createElement(Ui,{className:a("guideItemSubtitle",r),dangerouslySetInnerHTML:ie(p.subtitle)}),qe.createElement(_i,{className:a("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},Ht=Ha;var ja=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:r,onClose:n,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:l,guideData:h,guideTitle:m,onGuideButtonClick:g})=>{let w=({stepData:u,handleSecondaryCTAClick:b,handleCTAClick:I})=>u?N.createElement(bi,{className:a("checklistStepContainer",l),"data-testid":"checklistStepContainer"},N.createElement(Ti,{appearance:l,className:a("checklistStepTitle",l),dangerouslySetInnerHTML:ie(u.title)}),N.createElement(wi,{appearance:l,className:a("checklistStepSubtitle",l),dangerouslySetInnerHTML:ie(u.subtitle)}),N.createElement(Fi,{className:a("checklistCTAContainer",l)},u.secondaryButtonTitle&&N.createElement(R,{title:u.secondaryButtonTitle,onClick:b,appearance:l,secondary:!0}),N.createElement(R,{title:u.primaryButtonTitle,onClick:I,appearance:l}))):N.createElement(N.Fragment,null),y={...{default:u=>{var U;if((U=e[F])!=null&&U.StepContent){let H=e[F].StepContent;return N.createElement("div",null,H)}let b=e[F];return N.createElement(w,{stepData:u,handleCTAClick:()=>{b.handlePrimaryButtonClick&&b.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{b.handleSecondaryButtonClick&&b.handleSecondaryButtonClick()}})}},...d},[C,v]=za(0),F=s??C,A=p??v,k=()=>{var u;return e?!((u=e[F])!=null&&u.type)||!y[e[F].type]?y.default(e[F]):y[e[F].type]({stepData:e[F],primaryColor:l.theme.colorPrimary}):N.createElement(N.Fragment,null)},c=e.filter(u=>u.complete).length;return r?(l.theme.modalContainer||(l.theme.borderRadius&&(zo.borderRadius=l.theme.borderRadius+"px"),l.theme.modalContainer=zo),N.createElement(Ye,{onClose:n,visible:r,appearance:l},N.createElement(Ii,null,N.createElement(ui,null,N.createElement(fi,{appearance:l,className:a("checklistTitle",l)},t),N.createElement(gi,{appearance:l,className:a("checklistSubtitle",l)},o)),N.createElement(mi,null,e&&e.length>0&&N.createElement(hi,{className:a("stepsContainer",l)},N.createElement(xi,null,N.createElement("div",{style:{flex:3}},N.createElement(Ci,{className:a("stepsTitle",l)},i)),N.createElement(Ei,null,N.createElement(Ne,{fillColor:l.theme.colorPrimary,style:{width:"100%"},count:c,total:e.length,appearance:l}))),N.createElement(yi,null,N.createElement(Si,{className:a("checklistStepListContainer",l),appearance:l},e.map((u,b)=>{let I=F===b;return N.createElement(ki,{selected:I,className:a(`checklistStepListItem${I?"Selected":""}`,l),key:`checklist-guide-step-${u.id??b}`,disabled:u.blocked,onClick:()=>{u.blocked||A(b)},title:u.blocked?"Finish remaining steps to continue":void 0},I&&N.createElement(mo,{className:a("checklistStepItemSelectedIndicator",l),as:Ga.div,layoutId:"checklist-step-selected",style:{backgroundColor:l.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),N.createElement(Pi,{selected:I,className:a(`checklistStepListStepName${I?"Selected":""}`,l)},u.stepName),N.createElement(vi,null,N.createElement(St,{value:u.complete,type:"round",primaryColor:l.theme.colorPrimary,progress:u.progress,appearance:l}),N.createElement(Ai,null,N.createElement(kt,{style:{marginLeft:"10px"},color:l.theme.colorBackgroundSecondary}))))})),N.createElement(k,null))),h&&h.length>0&&N.createElement(Ht,{steps:h,title:m,primaryColor:l.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:l,onButtonClick:u=>(g&&g(u),!0)}))))):N.createElement(N.Fragment,null)},Go=ja;import{useEffect as Va,useState as qa}from"react";var Wi=()=>{let e={isSmall:"(max-width: 480px)",isMedium:"(min-width: 481px) AND (max-width: 1023px)",isLarge:"(min-width: 1025px)"},t=Object.fromEntries(Object.entries(e).map(([p])=>[p,!1])),[o,i]=qa(t),r=null,n=()=>{r!==null?clearTimeout(r):s(),r=setTimeout(()=>{s()},16)},s=()=>{let p=Object.fromEntries(Object.entries(e).map(([d,l])=>{if(!window)return[d,!1];let h=window.matchMedia(l);return h.addEventListener("change",n),[d,h.matches]}));i(p)};return Va(()=>{s()},[]),o};import he,{useEffect as tn,useState as Xa}from"react";import pe from"react";import{AnimatePresence as Ka,motion as Ya}from"framer-motion";import Ke from"styled-components";var Hi=Ke.div`
|
|
898
898
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
899
899
|
border: 1px solid;
|
|
900
900
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -941,7 +941,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
941
941
|
flex-direction: row;
|
|
942
942
|
justify-content: flex-start;
|
|
943
943
|
align-items: center;
|
|
944
|
-
`;var Xi=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:r,appearance:n})=>{var p,d;let s=t?{}:{transform:"rotate(90deg)"};return
|
|
944
|
+
`;var Xi=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:r,appearance:n})=>{var p,d;let s=t?{}:{transform:"rotate(90deg)"};return pe.createElement(Hi,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:a("checklistStepContainer",n),appearance:n},pe.createElement(ji,{className:a("stepHeader",n)},pe.createElement(Yi,null,pe.createElement(co,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(p=n==null?void 0:n.theme)==null?void 0:p.colorPrimary,appearance:n}),pe.createElement(Vi,{appearance:n,className:a("stepTitle",n),dangerouslySetInnerHTML:ie(e.title)})),pe.createElement(qi,{className:a("stepChevronContainer",n),onClick:()=>o()},pe.createElement(kt,{style:{...s,transition:"transform 0.1s ease-in-out"},color:(d=n==null?void 0:n.theme)==null?void 0:d.colorTextSecondary}))),pe.createElement(Ka,null,!t&&pe.createElement(Ya.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&&pe.createElement(zi,{className:a("stepMediaContainer",n)},e.imageUri?pe.createElement(Gi,{className:a("stepImage",n),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?pe.createElement(Ct,{appearance:n,videoUri:e.videoUri}):null),pe.createElement(Ki,{className:a("stepSubtitle",n),appearance:n,dangerouslySetInnerHTML:ie(e.subtitle)}),pe.createElement(to,{className:a("checklistCTAContainer",n)},e.secondaryButtonTitle?pe.createElement(R,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>r(),appearance:n}):null,pe.createElement(R,{title:e.primaryButtonTitle??"Continue",onClick:()=>i(),appearance:n})))))};import Pt from"styled-components";var fh=Pt.div`
|
|
945
945
|
background: #ffffff;
|
|
946
946
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
947
947
|
border-radius: 6px;
|
|
@@ -981,7 +981,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
981
981
|
justify-content: space-between;
|
|
982
982
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
983
983
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
984
|
-
`;var Ja=({title:e,subtitle:t,steps:o,onClose:i,visible:r,onCompleteStep:n,autoExpandFirstIncompleteStep:s=!0,autoCollapse:p=!0,autoExpandNextStep:d=!0,primaryColor:l="#000000",selectedStep:h,setSelectedStep:m,appearance:g,type:w,className:x})=>{let
|
|
984
|
+
`;var Ja=({title:e,subtitle:t,steps:o,onClose:i,visible:r,onCompleteStep:n,autoExpandFirstIncompleteStep:s=!0,autoCollapse:p=!0,autoExpandNextStep:d=!0,primaryColor:l="#000000",selectedStep:h,setSelectedStep:m,appearance:g,type:w,className:x})=>{let y=o.filter(c=>c.complete).length,[C,v]=Xa(Array(o.length).fill(!0));tn(()=>{let c=[...C];if(s){for(let u=0;u<o.length;u++)if(!o[u].complete){c[u]=!1;break}v(c)}},[]),tn(()=>{F(h)},[h]);let F=c=>{let u=[...C];if(p)for(let b=0;b<C.length;++b)b!==c&&(u[b]=!0);u[c]=!u[c],v(u)};if(!r&&w=="modal")return he.createElement(he.Fragment,null);let A=he.createElement(he.Fragment,null,he.createElement(Ji,null,he.createElement(Qi,{appearance:g,className:a("checklistTitle",g),dangerouslySetInnerHTML:ie(e)}),he.createElement(Zi,{appearance:g,className:a("checklistSubtitle",g),dangerouslySetInnerHTML:ie(t)})),he.createElement(Ne,{display:"percent",count:y,total:o.length,fillColor:l,style:{margin:"14px 0px 8px 0px"},appearance:g})),k=he.createElement(Ri,{className:Ce(a("checklistContainer",g),x)},o.map((c,u)=>{let b=C[u];return he.createElement(Xi,{appearance:g,stepData:c,collapsed:b,key:`modal-checklist-${c.id??u}`,onClick:()=>{if(h===u){F(u);return}m(u)},onPrimaryButtonClick:()=>{n&&n(u,c),c.handlePrimaryButtonClick&&c.handlePrimaryButtonClick(),d&&!c.completionCriteria&&u<C.length-1&&C[u+1]&&m(u+1)},onSecondaryButtonClick:()=>{c.handleSecondaryButtonClick&&c.handleSecondaryButtonClick()}})}));return w==="inline"?he.createElement(en,{appearance:g,className:Ce(a("checklistInlineContainer",g),x)},A,k):he.createElement(he.Fragment,null,he.createElement(Ye,{onClose:i,visible:r,appearance:g,style:{maxWidth:"600px"},headerContent:A},k))},jo=Ja;import te,{useEffect as Vo,useRef as op,useState as mt}from"react";import ct from"react";import ee,{css as on,keyframes as rn}from"styled-components";var nn=on`
|
|
985
985
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
986
986
|
`,Qa=on`
|
|
987
987
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
@@ -1104,7 +1104,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
1104
1104
|
font-size: 14px;
|
|
1105
1105
|
line-height: 22px;
|
|
1106
1106
|
margin: 0;
|
|
1107
|
-
`,
|
|
1107
|
+
`,yn=ee.p`
|
|
1108
1108
|
color: ${({theme:e})=>e.colorText};
|
|
1109
1109
|
font-weight: 600;
|
|
1110
1110
|
font-size: 12px;
|
|
@@ -1116,34 +1116,34 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
1116
1116
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1117
1117
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1118
1118
|
`}
|
|
1119
|
-
`;var
|
|
1119
|
+
`;var Sn=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=J(),{primaryCTAClickSideEffects:r}=ne(),{theme:n,styleOverrides:s}=i(o),{imageUri:p=null,subtitle:d=null,title:l=null,complete:h=!1,blocked:m=!1}=e,g=()=>{r(e)};return ct.createElement(cn,{className:a("carouselCard",o),onClick:m?null:g,style:t,blocked:m,complete:h},ct.createElement("div",{style:{alignItems:"flex-start",display:"flex",justifyContent:"space-between"}},p&&ct.createElement(mn,{className:a("carouselCardImage",o),src:p,alt:l,style:{opacity:h||m?.4:1}}),h&&ct.createElement(hn,{className:a("carouselCompletedPill",o)},ct.createElement(yn,{style:{color:"#108E0B"}},"Complete"))),l&&ct.createElement(Cn,{blocked:m,complete:h,className:a("carouselCardTitle",o)},l),d&&ct.createElement(De.Quiet,{blocked:m,complete:h,className:a("carouselCardSubtitle",o)},d))};import zt from"react";var bn=({numberOfStepsCompleted:e,numberOfSteps:t,appearance:o})=>{let i=t>0?e/t:0,r=200,n=Math.min(r,Math.max(10,Math.round(r*i)));return zt.createElement(fn,{className:a("carouselProgressBar",o)},zt.createElement(gn,{as:De.Loud,style:{marginRight:8}},e," of ",t),zt.createElement("svg",{height:10,width:r},zt.createElement("rect",{x:0,y:0,rx:5,width:r,height:10,fill:"#E6E6E6"}),zt.createElement("rect",{x:0,y:0,rx:5,width:n,height:10,fill:"currentColor"})))};var rp=()=>te.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},te.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),te.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),te.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),Tn=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,r]=mt(!1),[n,s]=mt(!1);Vo(()=>{t===!0&&i===!1?r(!0):t===!1&&i===!0&&s(!0)},[t]);let p=()=>{r(!1),s(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?te.createElement(an,{style:d,reversed:n,onAnimationEnd:n?p:null},te.createElement(pn,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},te.createElement(rp,null))):null},wn=({flowId:e,appearance:t,customVariables:o,className:i})=>{let r=op(null),[n,s]=mt(!1),[p,d]=mt(!1),[l,h]=mt(null),[m,g]=mt([]),[w,x]=mt(0),{getFlowMetadata:y,getFlowSteps:C,getNumberOfStepsCompleted:v,updateCustomVariables:F,getFlowStatus:A,isLoading:k,targetingLogicShouldHideFlow:c,getFlow:u}=Y();Vo(()=>{F(o)},[o,k]),Vo(()=>{if(k)return;let L=y(e),W=v(e),D=C(e);h(L),L.data!==null&&(g(D.sort((V,j)=>Number(V.complete)-Number(j.complete))),d(D.length>3),x(W))},[k]);let b=[];for(let L=0;L<m.length;L+=3)b.push(m.slice(L,L+3));let I=L=>{let W=L.target,D=W.scrollWidth-W.clientWidth,V=Math.ceil(W.scrollLeft);V>0&&n===!1&&s(!0),V===0&&n===!0&&s(!1),V<D&&p===!1&&d(!0),V===D&&p===!0&&d(!1)},$=(L=!0)=>{let W=L?1:-1;r.current!==null&&r.current.scrollBy({left:r.current.clientWidth*W,behavior:"smooth"})},U=null,H=L=>{U!==null?clearTimeout(U):I(L),U=setTimeout(()=>{I(L)},16)};return k?null:te.createElement(un,{className:Ce(a("carouselContainer",t),i)},te.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:20}},te.createElement("div",null,te.createElement(xn,{className:a("carouselTitle",t)},l==null?void 0:l.title),te.createElement(De.Quiet,{className:a("carouselSubtitle",t)},l==null?void 0:l.subtitle)),te.createElement(bn,{numberOfStepsCompleted:w,numberOfSteps:m.length})),te.createElement("div",{style:{position:"relative"}},te.createElement(Tn,{show:n,onClick:()=>$(!1)}),te.createElement(Tn,{side:"right",show:p,onClick:$}),te.createElement(sn,{ref:r,onScroll:H},b.map((L,W)=>te.createElement(ln,{key:W,style:{flex:`0 0 calc(100% - ${m.length>3?36:0}px)`}},L.map((D,V)=>te.createElement(Sn,{key:V,stepData:D,style:{flex:m.length>3?"0 1 calc(33% - 16px * 2 / 3)":1},appearance:t})))))))};var qo=({flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:r,className:n,type:s="inline",onDismiss:p,visible:d,customVariables:l,onStepCompletion:h,onButtonClick:m,appearance:g,hideOnFlowCompletion:w,setVisible:x,customStepTypes:y,checklistStyle:C="default",...v})=>{let{getFlow:F,getFlowSteps:A,markStepCompleted:k,getStepStatus:c,getNumberOfStepsCompleted:u,isLoading:b,targetingLogicShouldHideFlow:I,updateCustomVariables:$,getFlowMetadata:U,isStepBlocked:H,getFlowStatus:L,hasActiveFullPageFlow:W,setHasActiveFullPageFlow:D}=Y(),{primaryCTAClickSideEffects:V,secondaryCTAClickSideEffects:j}=ne(),{getOpenFlowState:z,setOpenFlowState:q}=ke(),[Q,le]=kn(r||0),[O,fe]=kn(!1),X=d===void 0?z(e):d,B=s==="modal",{mergeAppearanceWithDefault:re}=J(),{isLarge:Ue}=Wi();if(g=re(g),Fn(()=>{$(l)},[l,b]),Fn(()=>{d!==void 0&&(B&&d===!0?D(!0):B&&d===!1&&D(!1))},[d,x,W]),b)return null;let xe=F(e);if(!xe||I(xe))return null;let Se=A(e);if(!Se||w===!0&&L(e)===Z)return null;let ce=U(e);if(ce!=null&&ce.title&&(t=ce.title),ce!=null&&ce.subtitle&&(o=ce.subtitle),!O&&r===void 0&&u(e)>0){let E=Math.min(u(e),Se.length-1);le(E),fe(!0)}function _e(){if(Q+1>=Se.length){B&&q(e,!1);return}H(e,Se[Q+1].id)||le(Q+1)}function We(E,K,tt){let Jo=Q+1<Se.length?Se[Q+1]:null;m&&m(E,Q,K,Jo)===!0&&B&&Ae(),h&&h(E,tt,Jo),!h&&!m&&(E.primaryButtonUri||E.secondaryButtonUri)&&B&&Ae()}function et(){return Se.map((E,K)=>({...E,handleSecondaryButtonClick:()=>{_e(),j(E),E.skippable===!0&&k(e,E.id,{skipped:!0}),We(E,"secondary",K)},handlePrimaryButtonClick:()=>{(!E.completionCriteria&&(E.autoMarkCompleted||E.autoMarkCompleted===void 0)||E.completionCriteria&&E.autoMarkCompleted===!0)&&(k(e,E.id),_e()),We(E,"primary",K),V(E),c(e,E.id)===Fe&&_e()}}))}function _(){return oe.createElement(ae,{appearance:g})}let Ie={steps:et(),title:t,subtitle:o,primaryColor:g.theme.colorPrimary,appearance:g,customStepTypes:y,type:s,className:n};function Ae(){q(e,!1),p&&p(),x&&x(!1)}function bo(){return oe.createElement(oe.Fragment,null,oe.createElement(_,null),oe.createElement(wn,{flowId:e,appearance:g,customVariables:l,className:n}))}function f(){return oe.createElement(oe.Fragment,null,oe.createElement(_,null),oe.createElement(jo,{visible:X,onClose:()=>{Ae()},selectedStep:Q,setSelectedStep:le,autoExpandNextStep:!0,appearance:g,...Ie}))}function S(){if(!Ue)return f();let E=v.guideFlowId,K;return E&&F(E)&&(K=A(E)),oe.createElement(oe.Fragment,null,oe.createElement(_,null),oe.createElement(Go,{visible:X,stepsTitle:ce.stepsTitle?ce.stepsTitle:"Your quick start guide",onClose:()=>{Ae()},selectedStep:Q,setSelectedStep:le,guideData:K,guideTitle:v.guideTitle??"Guide",appearance:g,title:t,subtitle:o,onGuideButtonClick:tt=>{We(tt,"link",0)},...Ie}))}function P(){if(!Ue)return f();let E=oe.createElement(Ho,{flowId:e,style:i,selectedStep:Q,setSelectedStep:le,appearance:g,type:s,...Ie});return B?oe.createElement(Ye,{onClose:()=>{Ae()},visible:X,appearance:g,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},oe.createElement(_,null),E):oe.createElement(oe.Fragment,null,oe.createElement(_,null),E)}switch(C){case"condensed":return f();case"with-guide":return S();case"default":return P();case"carousel":return bo();default:return P()}};var np=e=>ip.createElement(qo,{type:"inline",...e});import Ze,{useEffect as lp}from"react";import Me from"react";import xo from"styled-components";var Pn=xo.div`
|
|
1120
1120
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1121
1121
|
border-radius: 8px;
|
|
1122
1122
|
padding: 6px 10px 6px 10px;
|
|
1123
1123
|
min-width: 160px;
|
|
1124
1124
|
cursor: pointer;
|
|
1125
1125
|
background-color: ${e=>e.appearance.theme.colorBackground}};
|
|
1126
|
-
`,vn=
|
|
1126
|
+
`,vn=xo.div`
|
|
1127
1127
|
display: flex;
|
|
1128
1128
|
flex-direction: row;
|
|
1129
1129
|
justify-content: space-between;
|
|
1130
1130
|
align-items: center;
|
|
1131
1131
|
margin-bottom: 2px;
|
|
1132
1132
|
flex-grow: 2;
|
|
1133
|
-
`,En=
|
|
1133
|
+
`,En=xo.div`
|
|
1134
1134
|
text-overflow: ellipsis;
|
|
1135
1135
|
font-weight: 600;
|
|
1136
1136
|
font-size: 12px;
|
|
1137
1137
|
line-height: 15px;
|
|
1138
1138
|
text-align: ${e=>e.type==="condensed"?"left":"right"};
|
|
1139
1139
|
color: ${e=>e.appearance.theme.colorPrimary};
|
|
1140
|
-
`,In=
|
|
1140
|
+
`,In=xo.div`
|
|
1141
1141
|
width: 20px;
|
|
1142
1142
|
margin-right: 8px;
|
|
1143
1143
|
display: flex;
|
|
1144
1144
|
height: 100%;
|
|
1145
1145
|
align-items: center;
|
|
1146
|
-
`;import{motion as sp}from"framer-motion";var An=({title:e,count:t,total:o,onClick:i,style:r={},className:n,appearance:s,type:p="default"})=>Me.createElement(Me.Fragment,null,Me.createElement(
|
|
1146
|
+
`;import{motion as sp}from"framer-motion";var An=({title:e,count:t,total:o,onClick:i,style:r={},className:n,appearance:s,type:p="default"})=>Me.createElement(Me.Fragment,null,Me.createElement(ae,{appearance:s}),Me.createElement(Pn,{as:sp.div,whileHover:{opacity:.9},whileTap:{scale:.98},onClick:()=>i!==void 0&&i(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...r},className:Ce(n??"",a("progressRingContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&Me.createElement(In,{className:a("progressRingContainer",s)},Me.createElement(Dt,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),Me.createElement(vn,{type:p,className:a("badgeTitleContainer",s)},Me.createElement(En,{type:p,appearance:s,className:a("badgeTitle",s)},e),i!==void 0&&Me.createElement(kt,{className:a("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&Me.createElement(Ne,{display:"compact",count:t,total:o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s})));import Qe from"react";import Gt from"styled-components";var Bn=Gt.div`
|
|
1147
1147
|
display: flex;
|
|
1148
1148
|
flex-direction: row;
|
|
1149
1149
|
width: 100%;
|
|
@@ -1181,7 +1181,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
1181
1181
|
:hover {
|
|
1182
1182
|
opacity: 0.8;
|
|
1183
1183
|
}
|
|
1184
|
-
`;var Dn=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>Qe.createElement(Qe.Fragment,null,Qe.createElement(Bn,{appearance:i,className:Ce(a("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&Qe.createElement(On,{className:a("fullWidthProgressBadgeIcon",i)},o),Qe.createElement(Ln,null,Qe.createElement(we,{size:"small",appearance:i,title:e,subtitle:t})),Qe.createElement(Nn,{className:a("fullWidthProgressBadgeProgressContainer",i)},Qe.createElement(Ne,{count:r,total:n,display:"percent",textLocation:"top",fillColor:i.theme.colorPrimary}))));var ap=({flowId:e,title:t,subtitle:o,icon:i,style:r,onClick:n,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:l,type:h="default"})=>{let{getFlow:m,getFlowSteps:g,getFlowStatus:w,getNumberOfStepsCompleted:x,isLoading:
|
|
1184
|
+
`;var Dn=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>Qe.createElement(Qe.Fragment,null,Qe.createElement(Bn,{appearance:i,className:Ce(a("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&Qe.createElement(On,{className:a("fullWidthProgressBadgeIcon",i)},o),Qe.createElement(Ln,null,Qe.createElement(we,{size:"small",appearance:i,title:e,subtitle:t})),Qe.createElement(Nn,{className:a("fullWidthProgressBadgeProgressContainer",i)},Qe.createElement(Ne,{count:r,total:n,display:"percent",textLocation:"top",fillColor:i.theme.colorPrimary}))));var ap=({flowId:e,title:t,subtitle:o,icon:i,style:r,onClick:n,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:l,type:h="default"})=>{let{getFlow:m,getFlowSteps:g,getFlowStatus:w,getNumberOfStepsCompleted:x,isLoading:y,targetingLogicShouldHideFlow:C,updateCustomVariables:v}=Y(),{mergeAppearanceWithDefault:F}=J();l=F(l);let{setOpenFlowState:A,getOpenFlowState:k}=ke();if(lp(()=>{v(p)},[p,y]),y)return null;let c=m(e);if(!c||C(c)||d===!0&&w(e)===Z)return null;let u=g(e),b=x(e);return h==="full-width"?Ze.createElement(Ze.Fragment,null,Ze.createElement(ae,{appearance:l}),Ze.createElement(Dn,{title:t,subtitle:o,count:b,total:u.length,style:r,className:s,appearance:l,icon:i,onClick:()=>{}})):Ze.createElement(Ze.Fragment,null,Ze.createElement(ae,{appearance:l}),Ze.createElement(An,{count:b,total:u.length,title:t,style:r,onClick:()=>{A(e,!0),n&&n()},type:h,className:s,appearance:l}))};import pp from"react";var dp=({flowId:e,style:t,appearance:o,...i})=>{let{getFlow:r,targetingLogicShouldHideFlow:n,getFlowSteps:s}=Y(),{mergeAppearanceWithDefault:p}=J();o=p(o);let d=r(e);if(!d||n(d))return null;let l=s(e);return pp.createElement(Ht,{steps:l,style:t,appearance:o,...i})};import Et,{useContext as Tp,useEffect as wp}from"react";import M,{useEffect as Co,useLayoutEffect as qn,useRef as gp,useState as jt}from"react";import Vt from"styled-components";import{useCallback as cp,useEffect as mp,useState as up}from"react";var Ko=(e,t,o,i={x:20,y:20},r)=>{let n=r=="fixed"?0:window.scrollY,s=r=="fixed"?0:window.scrollX;return!e||!e.left||!e.top?{x:0,y:0}:t==="left"?{x:e.left-o+i.x+s,y:e.top-i.y+n}:t==="right"?{x:e.left+e.width+i.x+s,y:e.top-i.y+n}:{x:0,y:0}},Mn={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function fp(e){let t=Mn;return e&&(t=e.getBoundingClientRect()),t}function $n(e,t){let[o,i]=up(Mn),r=cp(()=>{e&&i(fp(e))},[e]);return mp(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[e,t]),o}import Re from"styled-components";var Un=Re.div`
|
|
1185
1185
|
${e=>T(e)} {
|
|
1186
1186
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
1187
1187
|
}
|
|
@@ -1277,7 +1277,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
1277
1277
|
background-color: ${e=>e.primaryColor};
|
|
1278
1278
|
z-index: 20;
|
|
1279
1279
|
opacity: 1;
|
|
1280
|
-
`,
|
|
1280
|
+
`,yp=Vt.div`
|
|
1281
1281
|
pointer-events: all;
|
|
1282
1282
|
`,Xn=Vt.div`
|
|
1283
1283
|
display: flex;
|
|
@@ -1285,10 +1285,10 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
1285
1285
|
justify-content: center;
|
|
1286
1286
|
align-items: center;
|
|
1287
1287
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1288
|
-
`,
|
|
1288
|
+
`,Sp=Vt(Xn)`
|
|
1289
1289
|
width: ${vt+12}px;
|
|
1290
1290
|
height: ${vt+12}px;
|
|
1291
|
-
`,bp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:l=0,customStepTypes:h,appearance:m,dismissible:g=!1,showHighlightOnly:w,showStepCount:x=!0,completedStepsCount:
|
|
1291
|
+
`,bp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:l=0,customStepTypes:h,appearance:m,dismissible:g=!1,showHighlightOnly:w,showStepCount:x=!0,completedStepsCount:y=0})=>{var ce,_e,We,et;let[C,v]=jt(),[F,A]=jt(new Date),k=gp(null),[c,u]=jt(document.querySelector(e[l].selector)),b=$n(c,F),[I,$]=jt(),[U,H]=jt(!w),L=(_e=(ce=e[l])==null?void 0:ce.props)!=null&&_e.position?e[l].props.position:"absolute",W=((et=(We=e[l])==null?void 0:We.props)==null?void 0:et.zIndex)??90,D=(C==null?void 0:C.width)??Kn,V=(C==null?void 0:C.height)??Yn;qn(()=>{k.current&&v({width:k.current.clientWidth,height:k.current.clientHeight})},[l,F,L]),Co(()=>{w||H(!0)},[l]);let j=i==="auto"?"right":i,z=Ko(b,j,D,s,L),q=b.right+D>(window.innerWidth||document.documentElement.clientWidth),Q=b.bottom+Yn>(window.innerHeight||document.documentElement.clientHeight);q&&i==="auto"&&(z=Ko(b,"left",D,s,L),j="left");let le=window.location.pathname.split("/").pop(),O=()=>{let _=document.querySelector(e[l].selector);I&&I===JSON.stringify(_==null?void 0:_.getBoundingClientRect())||(u(_),A(new Date),_&&$(JSON.stringify(_.getBoundingClientRect())))};if(Co(()=>{let _=new MutationObserver(O);return _.observe(document.body,{subtree:!0,childList:!0}),()=>_.disconnect()},[O]),Co(()=>{let _=new MutationObserver(O);return _.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>_.disconnect()},[O]),Co(()=>{let _=setInterval(()=>{O()},10);return()=>clearInterval(_)},[O]),qn(()=>{setTimeout(()=>{O()},hp),O()},[l,le]),c===null)return M.createElement(M.Fragment,null);if(z.x==0&&z.y==0)return M.createElement(M.Fragment,null);if(!p)return M.createElement(M.Fragment,null);let fe=()=>{let _=()=>{if(e[l].handlePrimaryButtonClick&&(e[l].handlePrimaryButtonClick(),H(!1),setTimeout(()=>{O()},30)),y===e.length-1)return o()},Ie=()=>{e[l].handleSecondaryButtonClick&&(e[l].handleSecondaryButtonClick(),w&&H(!1))};return M.createElement(M.Fragment,null,x&&M.createElement(Gn,null,M.createElement(Vn,{className:a("tooltipStepCounter",m)},l+1," of ",e.length)),M.createElement(jn,{showStepCount:x,className:a("tooltipCTAContainer",m)},e[l].secondaryButtonTitle&&M.createElement(R,{title:e[l].secondaryButtonTitle,appearance:m,onClick:Ie,size:"small",withMargin:!1,secondary:!0}),e[l].primaryButtonTitle&&M.createElement(R,{title:e[l].primaryButtonTitle,appearance:m,onClick:_,withMargin:!1,size:"small"})))},X=()=>M.createElement(M.Fragment,null,g&&M.createElement(_n,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:a("tooltipClose",m)},M.createElement(Pe,null)),e[l].imageUri&&M.createElement(Wn,{dismissible:g,appearance:m,src:e[l].imageUri,className:a("tooltipImageContainer",m)}),e[l].videoUri&&!e[l].imageUri&&M.createElement(Hn,{dismissible:g,appearance:m,className:a("tooltipVideoContainer",m)},M.createElement(Ct,{appearance:m,videoUri:e[l].videoUri})),M.createElement(we,{appearance:m,title:e[l].title,subtitle:e[l].subtitle,size:"small"}),M.createElement(zn,{className:a("tooltipFooter",m)},M.createElement(fe,null))),re={...{default:_=>{var Ie;if((Ie=e[l])!=null&&Ie.StepContent){let Ae=e[l].StepContent;return M.createElement("div",null,Ae)}return M.createElement(X,null)}},...h},Ue=()=>{var _;return e?!((_=e[l])!=null&&_.type)||!re[e[l].type]?re.default(e[l]):re[e[l].type]({stepData:e[l],primaryColor:n}):M.createElement(M.Fragment,null)};if(w&&e[l].complete===!0)return null;let xe={top:(z==null?void 0:z.y)-vt,left:(j=="left"?b.x+s.x:(z==null?void 0:z.x)-vt)??0,cursor:w?"pointer":"default",position:L},Se=()=>{w&&(A(new Date),H(!U))};return M.createElement(yp,null,M.createElement(Sp,{style:xe,zIndex:W,className:a("tourHighlightContainer",m)},r&&e[l].showHighlight!==!1&&M.createElement(M.Fragment,null,M.createElement(Cp,{style:{position:L},onClick:Se,primaryColor:m.theme.colorPrimary}),M.createElement(xp,{style:{position:"absolute"},onClick:Se,primaryColor:m.theme.colorPrimary}))),M.createElement(Xn,{style:{...xe,left:xe.left+(j=="left"?-D:24)},zIndex:W+1,className:a("tooltipContainerWrapper",m)},U&&M.createElement(Un,{ref:k,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:12,...d},appearance:m,className:a("tooltipContainer",m),maxWidth:Kn,zIndex:W+10},M.createElement(Ue,null))))},yo=bp;import{Portal as Fp}from"react-portal";var kp=({flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:r,showTooltipsSimultaneously:n=!1,onDismiss:s,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:l=!1,dismissBehavior:h="complete-flow",onComplete:m,...g})=>{let{getFlow:w,getFlowSteps:x,isLoading:y,targetingLogicShouldHideFlow:C,markStepCompleted:v,markStepStarted:F,markFlowCompleted:A,updateCustomVariables:k,getCurrentStepIndex:c,getStepStatus:u,isStepBlocked:b,getFlowStatus:I,getNumberOfStepsCompleted:$}=Y(),{isLoadingUserFlowStateData:U}=Te(),{primaryCTAClickSideEffects:H,secondaryCTAClickSideEffects:L}=ne(),{hasOpenModals:W}=ke(),D=c(e),{openFlowStates:V}=Tp(G),{mergeAppearanceWithDefault:j}=J();if(o=j(o),wp(()=>{k(t)},[t,y]),U)return null;let z=w(e);if(!z||C(z)||I(e)==Z||W())return null;let q=x(e);if(Object.keys(V).length>0){let B=Object.keys(V).find(re=>V[re]===!0);if(B!==void 0&&B!==e)return Et.createElement(Et.Fragment,null)}async function Q(B){if(await v(e,B.id),q.map(re=>u(e,re.id)).every(re=>re===Fe)){await A(e);return}if(!l&&D+1<q.length){if(b(e,q[D+1].id))return;await F(e,q[D+1].id)}}function le(B,re,Ue){let xe=D+1<q.length?q[D+1]:null;r&&r(B,D,re,xe),i&&i(B,Ue,xe)}function O(){return q.map(B=>({...B,handleSecondaryButtonClick:async()=>{L(B),B.skippable===!0&&await v(e,B.id,{skipped:!0}),le(B,"secondary",D)},handlePrimaryButtonClick:async()=>{(!B.completionCriteria&&(B.autoMarkCompleted||B.autoMarkCompleted===void 0)||B.completionCriteria&&B.autoMarkCompleted===!0)&&await Q(B),le(B,"primary",D),H(B)}}))}async function fe(B){s&&s(),h==="complete-flow"?await A(e):await v(e,B.id)}function X(){m&&m()}return Et.createElement(Fp,null,Et.createElement(ae,{appearance:o}),n?q.map((B,re)=>Et.createElement(yo,{key:B.id,appearance:o,steps:O(),selectedStep:re,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>fe(B),tooltipPosition:d,showHighlightOnly:l,completedStepsCount:$(e),onComplete:X,...g})):Et.createElement(yo,{appearance:o,steps:O(),selectedStep:D,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>fe(q[D]),tooltipPosition:d,completedStepsCount:$(e),showHighlightOnly:l,onComplete:X,...g}))};import ue,{useEffect as Pp,useRef as vp,useState as Ep}from"react";import{Portal as Ip}from"react-portal";import ut from"styled-components";var Jn=ut.button`
|
|
1292
1292
|
${e=>T(e)} {
|
|
1293
1293
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1294
1294
|
|
|
@@ -1376,7 +1376,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
1376
1376
|
font-size: 14px;
|
|
1377
1377
|
|
|
1378
1378
|
padding: 8px 12px;
|
|
1379
|
-
`;import{AnimatePresence as ls,motion as as}from"framer-motion";import rs from"react";var is=({style:e,className:t})=>rs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},rs.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 ns from"react";var ss=({style:e,className:t})=>ns.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"},ns.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:i=!0,type:r="inline",title:n="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:l,getStepStatus:h,getNumberOfStepsCompleted:m,isLoading:g,targetingLogicShouldHideFlow:w}=
|
|
1379
|
+
`;import{AnimatePresence as ls,motion as as}from"framer-motion";import rs from"react";var is=({style:e,className:t})=>rs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},rs.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 ns from"react";var ss=({style:e,className:t})=>ns.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"},ns.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:i=!0,type:r="inline",title:n="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:l,getStepStatus:h,getNumberOfStepsCompleted:m,isLoading:g,targetingLogicShouldHideFlow:w}=Y(),{primaryCTAClickSideEffects:x}=ne(),y=vp(null),[C,v]=Ep(!1),{mergeAppearanceWithDefault:F}=J();s=F(s),Pp(()=>(document.addEventListener("click",A,!1),()=>{document.removeEventListener("click",A,!1)}),[]);let A=I=>{y.current&&!y.current.contains(I.target)&&v(!1)};if(g)return null;let k=p(e);if(!k||w(k))return null;let c=d(e);if(!c||!i)return null;function u(I,$){!I.completionCriteria&&(I.autoMarkCompleted||I.autoMarkCompleted===void 0)&&l(e,I.id),x(I),o&&o(I,$),v(!1)}function b(){return C&&ue.createElement(ts,{className:a("floatingWidgetMenu",s),as:as.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:r},c.map((I,$)=>ue.createElement(os,{className:a("floatingWidgetMenuItem",s),key:$,onClick:()=>u(I,$)},I.title)))}return r=="inline"?ue.createElement("span",{ref:y},ue.createElement(Jn,{style:t,onClick:()=>{v(!C)},className:a("supportButton",s)},ue.createElement(Zn,{className:a("supportIconContainer",s)},ue.createElement(ss,{className:a("supportIcon",s),style:{width:"18px",height:"18px"}})),ue.createElement(Qn,{className:a("supportButtonTitle",s)},n)),ue.createElement(ls,null,ue.createElement(b,null))):ue.createElement(Ip,null,ue.createElement(Rn,{style:t,ref:y},ue.createElement(ls,null,ue.createElement(b,null)),ue.createElement(es,{onClick:()=>{v(!C)},as:as.button,whileHover:{scale:1.1},className:a("floatingWidgetButton",s)},ue.createElement(is,{className:a("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import $e,{useEffect as Bp}from"react";import So from"styled-components";var ps=So.div`
|
|
1380
1380
|
${e=>T(e)} {
|
|
1381
1381
|
display: flex;
|
|
1382
1382
|
flex-direction: column;
|
|
@@ -1412,7 +1412,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
1412
1412
|
opacity: 0.8;
|
|
1413
1413
|
}
|
|
1414
1414
|
}
|
|
1415
|
-
`;var Op=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:h,isLoading:m,targetingLogicShouldHideFlow:g,updateCustomVariables:w,getFlowSteps:x,getFlowStatus:
|
|
1415
|
+
`;var Op=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:h,isLoading:m,targetingLogicShouldHideFlow:g,updateCustomVariables:w,getFlowSteps:x,getFlowStatus:y,getCurrentStepIndex:C}=Y(),{primaryCTAClickSideEffects:v}=ne(),{mergeAppearanceWithDefault:F}=J();if(r=F(r),Bp(()=>{w(o)},[o,m]),m)return null;let A=d(e);if(!A||g(A)||y(e)===Z)return null;let c=x(e)[C(e)];return $e.createElement($e.Fragment,null,$e.createElement(ae,{appearance:r}),$e.createElement(ps,{appearance:r,className:Ce(a("embeddedTipContainer",r),n),style:s},(p===!0||c.dismissible)&&$e.createElement(ms,{onClick:async()=>{await l(e),t&&t()},className:a("embeddedTipDismissButton",r)},$e.createElement(Pe,null)),$e.createElement(ds,null,$e.createElement(we,{size:"small",appearance:r,title:c.title,subtitle:c.subtitle})),c.primaryButtonTitle&&$e.createElement(cs,{className:a("embeddedTipCallToActionContainer",r)},$e.createElement(R,{classPrefix:"embeddedTip",title:c.primaryButtonTitle,appearance:r,withMargin:!1,size:"small",type:"inline",onClick:async()=>{c.handlePrimaryButtonClick(),v(c),!(i&&i(c,C(e),"primary")===!1)&&(await h(e,c.id),await l(e))}}))))};import de,{useEffect as Lp}from"react";import It from"styled-components";var us=It.div`
|
|
1416
1416
|
// use the :not annotation
|
|
1417
1417
|
${e=>T(e)} {
|
|
1418
1418
|
display: flex;
|
|
@@ -1443,7 +1443,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
1443
1443
|
flex-direction: column;
|
|
1444
1444
|
justify-content: center;
|
|
1445
1445
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1446
|
-
`,
|
|
1446
|
+
`,Yo=It.div`
|
|
1447
1447
|
display: flex;
|
|
1448
1448
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1449
1449
|
align-items: flex-end;
|
|
@@ -1452,10 +1452,10 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Bt}${r}.${Bt}${r} { ${Object.entries(n).map
|
|
|
1452
1452
|
:hover {
|
|
1453
1453
|
opacity: 0.8;
|
|
1454
1454
|
}
|
|
1455
|
-
`,
|
|
1455
|
+
`,Xo=It.div`
|
|
1456
1456
|
display: flex;
|
|
1457
1457
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1458
1458
|
align-items: flex-end;
|
|
1459
1459
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1460
|
-
`;import xs from"react";var Cs=({style:e,className:t})=>xs.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"},xs.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 Np=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:r,onButtonClick:n,appearance:s,type:p="full-width"})=>{let{getFlow:d,markFlowCompleted:l,isLoading:h,targetingLogicShouldHideFlow:m,updateCustomVariables:g,getFlowMetadata:w,getFlowStatus:x,getFlowSteps:
|
|
1460
|
+
`;import xs from"react";var Cs=({style:e,className:t})=>xs.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"},xs.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 Np=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:r,onButtonClick:n,appearance:s,type:p="full-width"})=>{let{getFlow:d,markFlowCompleted:l,isLoading:h,targetingLogicShouldHideFlow:m,updateCustomVariables:g,getFlowMetadata:w,getFlowStatus:x,getFlowSteps:y,getCurrentStepIndex:C}=Y(),{primaryCTAClickSideEffects:v}=ne(),{mergeAppearanceWithDefault:F}=J();if(s=F(s),Lp(()=>{g(r)},[r,h]),h)return null;let A=d(e);if(!A||m(A)||x(e)===Z)return null;let k=y(e),c=k.length>0?k[C(e)]:w(e);return c!=null&&c.title&&(t=c.title),c!=null&&c.subtitle&&(o=c.subtitle),de.createElement(de.Fragment,null,de.createElement(ae,{appearance:s}),de.createElement(us,{type:p,appearance:s,className:a("bannerContainer",s)},p!="square"&&de.createElement(fs,null,de.createElement(Cs,null)),p==="square"&&c.dismissible&&de.createElement(Xo,{type:p,className:a("bannerDismissButtonContainer",s)},de.createElement(Yo,{type:p,onClick:async()=>{await l(e),i&&i()},className:a("bannerDismissButton",s)},de.createElement(Pe,null))),de.createElement(gs,{type:p},de.createElement(we,{appearance:s,title:t,subtitle:o})),de.createElement(hs,{type:p,className:a("bannerCallToActionContainer",s)},de.createElement(R,{title:(c==null?void 0:c.primaryButtonTitle)??"Get started",appearance:s,onClick:()=>{v(c),n&&n(c,0,"primary")}})),p!=="square"&&c.dismissible&&de.createElement(Xo,{type:p,className:a("bannerDismissButtonContainer",s)},de.createElement(Yo,{type:p,onClick:async()=>{await l(e),i&&i()},className:a("bannerDismissButton",s)},de.createElement(Pe,null)))))};export{Np as FrigadeBanner,qo as FrigadeChecklist,Op as FrigadeEmbeddedTip,zr as FrigadeForm,dp as FrigadeGuide,np as FrigadeHeroChecklist,ap as FrigadeProgressBadge,la as FrigadeProvider,Ap as FrigadeSupportWidget,kp as FrigadeTour,ke as useFlowOpens,At as useFlowResponses,Y as useFlows,Mo as useOrganization,wo as useUser};
|
|
1461
1461
|
//# sourceMappingURL=index.mjs.map
|