@frigade/react 1.32.80 → 1.32.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +43 -5
- package/lib/index.js +5 -5
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +5 -5
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -116,6 +116,9 @@ interface DefaultFrigadeFlowProps {
|
|
|
116
116
|
flowId: string;
|
|
117
117
|
style?: CSSProperties;
|
|
118
118
|
className?: string;
|
|
119
|
+
/**
|
|
120
|
+
* The appearance of the flow. See https://docs.frigade.com/sdk/styling
|
|
121
|
+
*/
|
|
119
122
|
appearance?: Appearance;
|
|
120
123
|
/**
|
|
121
124
|
* Dynamic variables to use in flow-data.yml. See https://docs.frigade.com/flows/dynamic-variables
|
|
@@ -128,6 +131,9 @@ interface DefaultFrigadeFlowProps {
|
|
|
128
131
|
* Handler for when a step is completed.
|
|
129
132
|
* @param step
|
|
130
133
|
* @param index
|
|
134
|
+
* @param nextStep
|
|
135
|
+
* @param allFormData All form data collected so far (only applicable to FrigadeForms)
|
|
136
|
+
* @param stepSpecificFormData Form data collected for the finished step (only applicable to FrigadeForms)
|
|
131
137
|
*/
|
|
132
138
|
onStepCompletion?: (step: StepData, index: number, nextStep?: StepData, allFormData?: any, stepSpecificFormData?: any) => boolean;
|
|
133
139
|
/**
|
|
@@ -364,8 +370,6 @@ interface FrigadeProgressBadgeProps extends DefaultFrigadeFlowProps {
|
|
|
364
370
|
}
|
|
365
371
|
declare const FrigadeProgressBadge: React__default.FC<FrigadeProgressBadgeProps>;
|
|
366
372
|
|
|
367
|
-
type ModalPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
|
|
368
|
-
|
|
369
373
|
interface FormInputType {
|
|
370
374
|
id: string;
|
|
371
375
|
title?: string;
|
|
@@ -414,25 +418,59 @@ interface StepContentProps {
|
|
|
414
418
|
type EntityProperties = Record<string, string | boolean | number | null>;
|
|
415
419
|
|
|
416
420
|
type FrigadeFormType = 'inline' | 'modal' | 'large-modal' | 'corner-modal';
|
|
417
|
-
interface
|
|
421
|
+
interface FrigadeFormProps extends DefaultFrigadeFlowProps {
|
|
422
|
+
/**
|
|
423
|
+
* @ignore
|
|
424
|
+
*/
|
|
418
425
|
title?: string;
|
|
426
|
+
/**
|
|
427
|
+
* @ignore
|
|
428
|
+
*/
|
|
419
429
|
subtitle?: string;
|
|
420
430
|
type?: FrigadeFormType;
|
|
431
|
+
/**
|
|
432
|
+
* Map of custom components. The key must match the `type` property of the step defined in `flow-data.yml`
|
|
433
|
+
*/
|
|
421
434
|
customStepTypes?: {
|
|
422
435
|
[key: string]: (params: CustomFormTypeProps) => React__default.ReactNode;
|
|
423
436
|
};
|
|
437
|
+
/**
|
|
438
|
+
* Map of custom form components. Can only be used with a step of type `multiInput` (defined in `flow-data.yml`).
|
|
439
|
+
* The key must match the `type` property of the input defined in `flow-data.yml`
|
|
440
|
+
*/
|
|
424
441
|
customFormElements?: {
|
|
425
442
|
[key: string]: (params: FormInputProps) => React__default.ReactNode;
|
|
426
443
|
};
|
|
427
444
|
visible?: boolean;
|
|
428
445
|
setVisible?: (visible: boolean) => void;
|
|
429
446
|
onComplete?: () => void;
|
|
447
|
+
/**
|
|
448
|
+
* Whether to show a dismiss button to exit out of the form. Applicable only for modal forms.
|
|
449
|
+
*/
|
|
430
450
|
dismissible?: boolean;
|
|
451
|
+
/**
|
|
452
|
+
* If true, the form can be repeated multiple times. Default is false. Useful for e.g. contact/support forms.
|
|
453
|
+
*/
|
|
431
454
|
repeatable?: boolean;
|
|
455
|
+
/**
|
|
456
|
+
* If true, the user will be excited from the flow when the form is dismissed. Default is false.
|
|
457
|
+
*/
|
|
432
458
|
endFlowOnDismiss?: boolean;
|
|
433
|
-
|
|
459
|
+
/**
|
|
460
|
+
* Indicates the position of the modal if the form type is a modal. Default is center.
|
|
461
|
+
*/
|
|
462
|
+
modalPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
|
|
463
|
+
/**
|
|
464
|
+
* Show a pagination indicator at the bottom of the form. Default is false.
|
|
465
|
+
*/
|
|
434
466
|
showPagination?: boolean;
|
|
467
|
+
/**
|
|
468
|
+
* Whether to allow the user to navigate back to previous steps. Default is false.
|
|
469
|
+
*/
|
|
435
470
|
allowBackNavigation?: boolean;
|
|
471
|
+
/**
|
|
472
|
+
* @ignore
|
|
473
|
+
*/
|
|
436
474
|
showFrigadeBranding?: boolean;
|
|
437
475
|
/**
|
|
438
476
|
* This function is called when the user submits data in a step.
|
|
@@ -440,7 +478,7 @@ interface FormProps extends DefaultFrigadeFlowProps {
|
|
|
440
478
|
*/
|
|
441
479
|
validationHandler?: (step: StepData, index: number, nextStep?: StepData, allFormData?: any, stepSpecificFormData?: object) => Promise<string | null | undefined>;
|
|
442
480
|
}
|
|
443
|
-
declare const FrigadeForm: FC<
|
|
481
|
+
declare const FrigadeForm: FC<FrigadeFormProps>;
|
|
444
482
|
|
|
445
483
|
interface FrigadeGuideProps extends DefaultFrigadeFlowProps {
|
|
446
484
|
title: string;
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var yl=Object.create;var ko=Object.defineProperty;var bl=Object.getOwnPropertyDescriptor;var wl=Object.getOwnPropertyNames;var Tl=Object.getPrototypeOf,Fl=Object.prototype.hasOwnProperty;var kl=(e,t)=>{for(var o in t)ko(e,o,{get:t[o],enumerable:!0})},Ar=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of wl(t))!Fl.call(e,r)&&r!==o&&ko(e,r,{get:()=>t[r],enumerable:!(n=bl(t,r))||n.enumerable});return e};var g=(e,t,o)=>(o=e!=null?yl(Tl(e)):{},Ar(t||!e||!e.__esModule?ko(o,"default",{value:e,enumerable:!0}):o,e)),Pl=e=>Ar(ko({},"__esModule",{value:!0}),e);var xp={};kl(xp,{CheckBox:()=>Re,FormLabel:()=>mt,FormTextField:()=>Mo,FrigadeBanner:()=>ml,FrigadeChecklist:()=>Zo,FrigadeDefaultAppearance:()=>Qe,FrigadeEmbeddedTip:()=>sl,FrigadeForm:()=>dr,FrigadeGuide:()=>Ms,FrigadeHeroChecklist:()=>Ts,FrigadeNPSSurvey:()=>Sl,FrigadeProgressBadge:()=>Ds,FrigadeProvider:()=>ji,FrigadeSupportWidget:()=>tl,FrigadeTour:()=>js,ProgressRing:()=>Bt,useFlowOpens:()=>Ie,useFlowResponses:()=>Ut,useFlows:()=>Z,useOrganization:()=>Go,useUser:()=>zt});module.exports=Pl(xp);var Y=g(require("react")),Hi=require("styled-components");var he=g(require("react"));var He=require("react");var kt=g(require("react"));var Ir="1.32.80 ";var ze="NOT_STARTED_STEP",re="COMPLETED_FLOW",Po="ABORTED_FLOW",Pt="STARTED_FLOW",Ve="NOT_STARTED_FLOW",je="COMPLETED_STEP",vo="STARTED_STEP";function Xe(){let{publicApiKey:e,userId:t,apiUrl:o}=kt.default.useContext(Q);return{config:(0,kt.useMemo)(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Ir,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:(0,kt.useMemo)(()=>`${o}/v1/public/`,[o])}}var vl="frigade-last-call-at-",Bl="frigade-last-call-data-";function Dt(){let{shouldGracefullyDegrade:e}=kt.default.useContext(Q);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),io();let n=vl+t,r=Bl+t;if(window&&window.localStorage&&o&&o.body&&o.method==="POST"){let s=window.localStorage.getItem(n),p=window.localStorage.getItem(r);if(s&&p&&p==o.body){let d=new Date(s);if(new Date().getTime()-d.getTime()<1e3)return io()}window.localStorage.setItem(n,new Date().toISOString()),window.localStorage.setItem(r,o.body)}let i;try{i=await fetch(t,o)}catch(s){return io(s)}return i?i.ok?i:io(i.statusText):io()}}function io(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function $t(){let{publicApiKey:e,shouldGracefullyDegrade:t}=kt.default.useContext(Q);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}}var no=require("react");var Mt=require("react");var Lr=g(require("swr"));var Nr=require("react");function Ie(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:n,completedFlowsToKeepOpenDuringSession:r}=(0,Nr.useContext)(Q);function i(c,f=!1){return e[c]??f}function s(c,f){t(S=>({...S,[c]:f}))}function p(c){t(f=>{let{[c]:S,...P}=f;return{...P}})}function d(c){r.includes(c)||n(f=>[...f,c])}function a(c){return r.includes(c)}function C(c){return Object.entries(e).some(([f,S])=>S&&f!=c)||o}return{getOpenFlowState:i,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:a}}var El="unknown";function We(){let{config:e,apiUrl:t}=Xe(),{publicApiKey:o,userId:n,organizationId:r,flows:i,setShouldGracefullyDegrade:s}=(0,Mt.useContext)(Q),{resetOpenFlowState:p}=Ie(),[d,a]=(0,Mt.useState)(!1),C={data:i.map(m=>({flowId:m.id,flowState:re,lastStepId:null,userId:n,foreignUserId:n,stepStates:{},shouldTrigger:!1}))},c=m=>fetch(m,e).then(x=>{if(x.ok)return x.json();throw new Error("Failed to fetch user flow states")}).catch(x=>(console.log(`Error fetching ${m}: ${x}. Will gracefully degrade and hide Frigade`),s(!0),C)),{data:f,isLoading:S,mutate:P,error:A}=(0,Lr.default)(o&&i&&n?`${t}userFlowStates?foreignUserId=${encodeURIComponent(n)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,c,{revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>C,onLoadingSlow:()=>C}),u=f==null?void 0:f.data;(0,Mt.useEffect)(()=>{!d&&!S&&u&&a(!0)},[u,d,S]);async function w(m){if(u){let x=u.find(T=>T.flowId===m);x&&x.flowState!==re&&(x.flowState=re),await P(Promise.resolve({...f,data:u}),{optimisticData:{...f,data:u},revalidate:!1,rollbackOnError:!1})}}async function B(m,x,T){if(u){let O=u.find(z=>z.flowId===m);O&&(O.stepStates[x]=T,O.flowState=Pt),await P(Promise.resolve({...f,data:u}),{optimisticData:{...f,data:u},revalidate:!1,rollbackOnError:!1})}}async function v(m,x,T){if(u){let O=u.find(z=>z.flowId===m);O&&(O.lastStepId=x,O.stepStates[x]=T,O.flowState=Pt),await P({...f,data:u},{optimisticData:{...f,data:u},revalidate:!1,rollbackOnError:!1})}}async function F(m){if(u){let x=u.find(T=>T.flowId===m);x&&x.flowState!==Ve&&(x.flowState=Ve,x.lastStepId=El,Object.keys(x.stepStates).forEach(T=>{x.stepStates[T].actionType=ze,x.stepStates[T].createdAt=new Date().toISOString()}),await P({...f,data:u},{optimisticData:{...f,data:u},revalidate:!1,rollbackOnError:!1}),p(m))}}async function y(m,x){if(u){let T=u.find(O=>O.flowId===m);T&&T.stepStates[x]!==ze&&(T.stepStates[x]=ze),await P({...f,data:u},{optimisticData:{...f,data:u},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:u,isLoadingUserFlowStateData:!d,mutateUserFlowState:P,optimisticallyMarkFlowCompleted:w,optimisticallyMarkFlowNotStarted:F,optimisticallyMarkStepCompleted:B,optimisticallyMarkStepNotStarted:y,optimisticallyMarkStepStarted:v,error:A}}function Ut(){let{config:e,apiUrl:t}=Xe(),{userFlowStatesData:o,mutateUserFlowState:n}=We(),{failedFlowResponses:r,setFailedFlowResponses:i,flowResponses:s,setFlowResponses:p}=(0,no.useContext)(Q),[d,a]=(0,no.useState)(new Set),[C,c]=(0,no.useState)(new Set),f=Dt();function S(u){let w=JSON.stringify(u);if(d.has(w))return null;d.add(w),a(d),C.add(u),c(C);let B=s==null?void 0:s.find(v=>v.flowSlug===u.flowSlug&&v.stepId===u.stepId&&v.actionType===u.actionType&&v.createdAt===u.createdAt);return f(`${t}flowResponses`,{...e,method:"POST",body:w}).then(v=>{v.status!==200&&v.status!==201?(console.log("Failed to send flow response for step "+u.stepId+". Will retry again later."),i([...r,u])):B||p(F=>[...F??[],u])})}async function P(u){u.foreignUserId&&(u.actionType===Pt||u.actionType===Ve?await S(u):u.actionType===re?await S(u):u.actionType===vo?await S(u):u.actionType===je?await S(u):u.actionType===Po?await S(u):u.actionType===ze&&await S(u))}function A(){let u=[];return o==null||o.forEach(w=>{if(w&&w.stepStates&&Object.keys(w.stepStates).length!==0)for(let B in w.stepStates){let v=w.stepStates[B];u.push({foreignUserId:w.foreignUserId,flowSlug:w.flowId,stepId:v.stepId,actionType:v.actionType,data:{},createdAt:new Date(v.createdAt),blocked:v.blocked,hidden:v.hidden})}}),[...u,...s]}return{addResponse:P,setFlowResponses:p,getFlowResponses:A}}var Dr=g(require("swr"));var Al=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Or=e=>{let t=Al.exec(e);if(t===null)return null;let o=null;return t.forEach((n,r)=>{let i=Il(n,"'","");i.startsWith("flow_")&&(o=i)}),o},Il=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Z(){let{config:e,apiUrl:t}=Xe(),{flows:o,setFlows:n,userId:r,publicApiKey:i,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,setFlowResponses:C,setShouldGracefullyDegrade:c}=(0,He.useContext)(Q),f={data:[]},{verifySDKInitiated:S}=$t(),{addResponse:P,getFlowResponses:A}=Ut(),u=h=>fetch(h,e).then(b=>b.ok?b.json():(console.log(`Error fetching ${h} (${b.status}): ${b.statusText}. .Will gracefully degrade and hide Frigade`),c(!0),f)).catch(b=>(console.log(`Error fetching ${h}: ${b}. Will gracefully degrade and hide Frigade`),c(!0),f)),{userFlowStatesData:w,isLoadingUserFlowStateData:B,optimisticallyMarkFlowCompleted:v,optimisticallyMarkFlowNotStarted:F,optimisticallyMarkStepCompleted:y,optimisticallyMarkStepNotStarted:m,optimisticallyMarkStepStarted:x}=We(),{data:T,error:O,isLoading:z}=(0,Dr.default)(i?`${t}flows`:null,u,{keepPreviousData:!0});(0,He.useEffect)(()=>{if(O){console.error(O);return}T&&T.data&&(T.data=n(T.data))},[T,O]);function V(h){if(z)return null;let b=o.find(E=>E.slug===h);return!b&&o.length>0&&!B&&!z?(console.log(`Flow with slug ${h} not found`),null):(b==null?void 0:b.active)===!1?null:b}function N(h){var H;if(!V(h))return[];let b=V(h).data;return b?(b=W(b),(((H=JSON.parse(b))==null?void 0:H.data)??[]).map(D=>{let _e=ne(D);return{handleSecondaryButtonClick:()=>{D.skippable===!0&&oe(h,D.id,{skipped:!0})},...D,complete:ie(h,D.id)===je||_e>=1,blocked:Fe(h,D.id),hidden:U(h,D.id),handlePrimaryButtonClick:()=>{(!D.completionCriteria&&(D.autoMarkCompleted||D.autoMarkCompleted===void 0)||D.completionCriteria&&D.autoMarkCompleted===!0)&&oe(h,D.id)},progress:_e}}).filter(D=>D.hidden!==!0)):[]}function W(h){return h.replaceAll(/\${(.*?)}/g,(b,E)=>s[E]===void 0?"":String(s[E]).replace(/[\u00A0-\u9999<>\&]/g,function(H){return"&#"+H.charCodeAt(0)+";"}).replaceAll(/[\\]/g,"\\\\").replaceAll(/[\"]/g,'\\"').replaceAll(/[\/]/g,"\\/").replaceAll(/[\b]/g,"\\b").replaceAll(/[\f]/g,"\\f").replaceAll(/[\n]/g,"\\n").replaceAll(/[\r]/g,"\\r").replaceAll(/[\t]/g,"\\t"))}function q(h){if(!V(h))return[];let b=V(h).data;return b?(b=W(b),JSON.parse(b)??{}):[]}function L(h,b){p(E=>({...E,[h]:b}))}function ce(h){!B&&!z&&h&&JSON.stringify(s)!=JSON.stringify({...s,...h})&&Object.keys(h).forEach(b=>{L(b,h[b])})}let Te=(0,He.useCallback)(async(h,b,E)=>{S();let H={foreignUserId:r,flowSlug:h,stepId:b,actionType:vo,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};ge(H)&&(await x(h,b,H),P(H))},[r,w]),j=(0,He.useCallback)(async(h,b,E)=>{S();let H={foreignUserId:r,flowSlug:h,stepId:b,actionType:ze,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};ge(H)&&(await m(h,b),P(H))},[r,w]),oe=(0,He.useCallback)(async(h,b,E)=>{S();let H={foreignUserId:r,flowSlug:h,stepId:b,actionType:je,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};ge(H)&&(await y(h,b,H),P(H))},[r,w]),Ue=(0,He.useCallback)(async(h,b)=>{if(S(),Je(h)===Ve)return;let E={foreignUserId:r,flowSlug:h,stepId:"unknown",actionType:Ve,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};await F(h),ge(E)&&P(E)},[r,w]),le=(0,He.useCallback)(async(h,b)=>{S();let E={foreignUserId:r,flowSlug:h,stepId:"unknown",actionType:Pt,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};ge(E)&&P(E)},[r,w]),J=(0,He.useCallback)(async(h,b)=>{S();let E={foreignUserId:r,flowSlug:h,stepId:"unknown",actionType:re,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};ge(E)&&(await v(h),P(E))},[r,w]),Pe=(0,He.useCallback)(async(h,b)=>{S();let E={foreignUserId:r,flowSlug:h,stepId:"unknown",actionType:Po,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};ge(E)&&(await v(h),P(E))},[r,w]);function ge(h){var b;if(!w&&h.actionType===ze)return!1;if(w){let E=w.find(H=>H.flowId===h.flowSlug);if(h.actionType===ze&&(!(E!=null&&E.stepStates[h.stepId])||E.stepStates[h.stepId].actionType===ze)||E&&((b=E.stepStates[h.stepId])==null?void 0:b.actionType)===h.actionType||E&&E.flowState===re&&h.actionType===re)return!1}return!0}function ie(h,b){let E=$(h,b);return B?null:E?E.actionType:ze}function Fe(h,b){let E=$(h,b);return E?E.blocked:!1}function U(h,b){let E=$(h,b);return E?E.hidden:!1}function $(h,b){if(B)return null;let E=w==null?void 0:w.find(H=>H.flowId===h);return!E||!E.stepStates[b]?null:E.stepStates[b]??null}function me(h){var E;if(B||!w)return null;if(Je(h)===Ve)return N(h)[0]??null;let b=(E=w.find(H=>H.flowId===h))==null?void 0:E.lastStepId;return b?N(h).find(H=>H.id===b):null}function K(h){let b=me(h);if(!b)return 0;let E=N(h).findIndex(H=>H.id===b.id)??0;return ie(h,b.id)===je&&E<N(h).length-1?E+1:E}function ne(h){if(!h.completionCriteria)return;let b=Or(h.completionCriteria);if(b===null)return;let E=at(b),H=Ft(b);return H===0?void 0:E/H}function Je(h){let b=w==null?void 0:w.find(E=>E.flowId===h);return b?b.flowState:null}function at(h){let b=N(h);return b.length===0?0:b.filter(H=>ie(h,H.id)===je).length}function Ft(h){return N(h).length}function G(h){return JSON.parse(o.find(b=>b.slug===h).data)}function Oe(h){if(B)return!0;if(h!=null&&h.targetingLogic&&w){let b=w.find(E=>E.flowId===h.slug);if(b)return b.shouldTrigger===!1}return!!(h!=null&&h.targetingLogic&&r&&r.startsWith("guest_"))}function pt(h){return!Oe(V(h))}return{getFlow:V,getFlowData:G,isLoading:B||z,getStepStatus:ie,getFlowSteps:N,getCurrentStepIndex:K,markStepStarted:Te,markStepCompleted:oe,markFlowNotStarted:Ue,markFlowStarted:le,markFlowCompleted:J,markFlowAborted:Pe,markStepNotStarted:j,getFlowStatus:Je,getNumberOfStepsCompleted:at,getNumberOfSteps:Ft,targetingLogicShouldHideFlow:Oe,setCustomVariable:L,updateCustomVariables:ce,customVariables:s,getStepOptionalProgress:ne,getFlowMetadata:q,isStepBlocked:Fe,isStepHidden:U,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,isFlowAvailableToUser:pt}}var vt=require("react");var _t="guest_";function zt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:r}=(0,vt.useContext)(Q),{config:i,apiUrl:s}=Xe(),{mutateUserFlowState:p}=We(),d=Dt(),{verifySDKInitiated:a}=$t();(0,vt.useEffect)(()=>{if(e&&!t){if(e.startsWith(_t))return;let f=`frigade-user-registered-${e}`;localStorage.getItem(f)||(d(`${s}users`,{...i,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(f,"true"))}},[e,r,t]);let C=(0,vt.useCallback)(async f=>{a();let S={foreignId:e,properties:f};await d(`${s}users`,{...i,method:"POST",body:JSON.stringify(S)}),n(P=>({...P,...f})),p()},[e,i,r,p]),c=(0,vt.useCallback)(async(f,S)=>{a();let A={foreignId:e,events:[{event:f,properties:S}]};await d(`${s}users`,{...i,method:"POST",body:JSON.stringify(A)}),p()},[e,i,p]);return{userId:e,setUserId:o,addPropertiesToUser:C,trackEventForUser:c}}var zi=require("uuid");var Ae=g(require("react"));var Ne=g(require("react")),ao=g(require("styled-components"));var Mr=g(require("react")),Ur=g(require("styled-components"));var $r="fr-",so="cfr-";function l(e,t){let o=`${$r}${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+" "+so+e}return o}function k(e){if(!e.className||e.className.indexOf(so)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith($r)?"":`:not(${o.map(n=>`.${n}`).join(", ")})`}function er(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function dt(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${er(t)}: ${e.styleOverrides[t]};`).join(" "):""}function ve(...e){return e.filter(Boolean).join(" ")}function lo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Nl=Ur.default.div`
|
|
2
|
+
var yl=Object.create;var ko=Object.defineProperty;var bl=Object.getOwnPropertyDescriptor;var wl=Object.getOwnPropertyNames;var Tl=Object.getPrototypeOf,Fl=Object.prototype.hasOwnProperty;var kl=(e,t)=>{for(var o in t)ko(e,o,{get:t[o],enumerable:!0})},Ar=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of wl(t))!Fl.call(e,r)&&r!==o&&ko(e,r,{get:()=>t[r],enumerable:!(n=bl(t,r))||n.enumerable});return e};var g=(e,t,o)=>(o=e!=null?yl(Tl(e)):{},Ar(t||!e||!e.__esModule?ko(o,"default",{value:e,enumerable:!0}):o,e)),Pl=e=>Ar(ko({},"__esModule",{value:!0}),e);var xp={};kl(xp,{CheckBox:()=>Re,FormLabel:()=>mt,FormTextField:()=>Mo,FrigadeBanner:()=>ml,FrigadeChecklist:()=>Zo,FrigadeDefaultAppearance:()=>Qe,FrigadeEmbeddedTip:()=>sl,FrigadeForm:()=>dr,FrigadeGuide:()=>Ms,FrigadeHeroChecklist:()=>Ts,FrigadeNPSSurvey:()=>Sl,FrigadeProgressBadge:()=>Ds,FrigadeProvider:()=>ji,FrigadeSupportWidget:()=>tl,FrigadeTour:()=>js,ProgressRing:()=>Bt,useFlowOpens:()=>Ie,useFlowResponses:()=>Ut,useFlows:()=>Z,useOrganization:()=>Go,useUser:()=>zt});module.exports=Pl(xp);var Y=g(require("react")),Hi=require("styled-components");var he=g(require("react"));var He=require("react");var kt=g(require("react"));var Ir="1.32.81 ";var ze="NOT_STARTED_STEP",re="COMPLETED_FLOW",Po="ABORTED_FLOW",Pt="STARTED_FLOW",Ve="NOT_STARTED_FLOW",je="COMPLETED_STEP",vo="STARTED_STEP";function Xe(){let{publicApiKey:e,userId:t,apiUrl:o}=kt.default.useContext(Q);return{config:(0,kt.useMemo)(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Ir,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:(0,kt.useMemo)(()=>`${o}/v1/public/`,[o])}}var vl="frigade-last-call-at-",Bl="frigade-last-call-data-";function Dt(){let{shouldGracefullyDegrade:e}=kt.default.useContext(Q);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),io();let n=vl+t,r=Bl+t;if(window&&window.localStorage&&o&&o.body&&o.method==="POST"){let s=window.localStorage.getItem(n),p=window.localStorage.getItem(r);if(s&&p&&p==o.body){let d=new Date(s);if(new Date().getTime()-d.getTime()<1e3)return io()}window.localStorage.setItem(n,new Date().toISOString()),window.localStorage.setItem(r,o.body)}let i;try{i=await fetch(t,o)}catch(s){return io(s)}return i?i.ok?i:io(i.statusText):io()}}function io(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function $t(){let{publicApiKey:e,shouldGracefullyDegrade:t}=kt.default.useContext(Q);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}}var no=require("react");var Mt=require("react");var Lr=g(require("swr"));var Nr=require("react");function Ie(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:n,completedFlowsToKeepOpenDuringSession:r}=(0,Nr.useContext)(Q);function i(c,f=!1){return e[c]??f}function s(c,f){t(S=>({...S,[c]:f}))}function p(c){t(f=>{let{[c]:S,...P}=f;return{...P}})}function d(c){r.includes(c)||n(f=>[...f,c])}function a(c){return r.includes(c)}function C(c){return Object.entries(e).some(([f,S])=>S&&f!=c)||o}return{getOpenFlowState:i,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:a}}var El="unknown";function We(){let{config:e,apiUrl:t}=Xe(),{publicApiKey:o,userId:n,organizationId:r,flows:i,setShouldGracefullyDegrade:s}=(0,Mt.useContext)(Q),{resetOpenFlowState:p}=Ie(),[d,a]=(0,Mt.useState)(!1),C={data:i.map(m=>({flowId:m.id,flowState:re,lastStepId:null,userId:n,foreignUserId:n,stepStates:{},shouldTrigger:!1}))},c=m=>fetch(m,e).then(x=>{if(x.ok)return x.json();throw new Error("Failed to fetch user flow states")}).catch(x=>(console.log(`Error fetching ${m}: ${x}. Will gracefully degrade and hide Frigade`),s(!0),C)),{data:f,isLoading:S,mutate:P,error:A}=(0,Lr.default)(o&&i&&n?`${t}userFlowStates?foreignUserId=${encodeURIComponent(n)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,c,{revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>C,onLoadingSlow:()=>C}),u=f==null?void 0:f.data;(0,Mt.useEffect)(()=>{!d&&!S&&u&&a(!0)},[u,d,S]);async function w(m){if(u){let x=u.find(T=>T.flowId===m);x&&x.flowState!==re&&(x.flowState=re),await P(Promise.resolve({...f,data:u}),{optimisticData:{...f,data:u},revalidate:!1,rollbackOnError:!1})}}async function B(m,x,T){if(u){let O=u.find(z=>z.flowId===m);O&&(O.stepStates[x]=T,O.flowState=Pt),await P(Promise.resolve({...f,data:u}),{optimisticData:{...f,data:u},revalidate:!1,rollbackOnError:!1})}}async function v(m,x,T){if(u){let O=u.find(z=>z.flowId===m);O&&(O.lastStepId=x,O.stepStates[x]=T,O.flowState=Pt),await P({...f,data:u},{optimisticData:{...f,data:u},revalidate:!1,rollbackOnError:!1})}}async function F(m){if(u){let x=u.find(T=>T.flowId===m);x&&x.flowState!==Ve&&(x.flowState=Ve,x.lastStepId=El,Object.keys(x.stepStates).forEach(T=>{x.stepStates[T].actionType=ze,x.stepStates[T].createdAt=new Date().toISOString()}),await P({...f,data:u},{optimisticData:{...f,data:u},revalidate:!1,rollbackOnError:!1}),p(m))}}async function y(m,x){if(u){let T=u.find(O=>O.flowId===m);T&&T.stepStates[x]!==ze&&(T.stepStates[x]=ze),await P({...f,data:u},{optimisticData:{...f,data:u},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:u,isLoadingUserFlowStateData:!d,mutateUserFlowState:P,optimisticallyMarkFlowCompleted:w,optimisticallyMarkFlowNotStarted:F,optimisticallyMarkStepCompleted:B,optimisticallyMarkStepNotStarted:y,optimisticallyMarkStepStarted:v,error:A}}function Ut(){let{config:e,apiUrl:t}=Xe(),{userFlowStatesData:o,mutateUserFlowState:n}=We(),{failedFlowResponses:r,setFailedFlowResponses:i,flowResponses:s,setFlowResponses:p}=(0,no.useContext)(Q),[d,a]=(0,no.useState)(new Set),[C,c]=(0,no.useState)(new Set),f=Dt();function S(u){let w=JSON.stringify(u);if(d.has(w))return null;d.add(w),a(d),C.add(u),c(C);let B=s==null?void 0:s.find(v=>v.flowSlug===u.flowSlug&&v.stepId===u.stepId&&v.actionType===u.actionType&&v.createdAt===u.createdAt);return f(`${t}flowResponses`,{...e,method:"POST",body:w}).then(v=>{v.status!==200&&v.status!==201?(console.log("Failed to send flow response for step "+u.stepId+". Will retry again later."),i([...r,u])):B||p(F=>[...F??[],u])})}async function P(u){u.foreignUserId&&(u.actionType===Pt||u.actionType===Ve?await S(u):u.actionType===re?await S(u):u.actionType===vo?await S(u):u.actionType===je?await S(u):u.actionType===Po?await S(u):u.actionType===ze&&await S(u))}function A(){let u=[];return o==null||o.forEach(w=>{if(w&&w.stepStates&&Object.keys(w.stepStates).length!==0)for(let B in w.stepStates){let v=w.stepStates[B];u.push({foreignUserId:w.foreignUserId,flowSlug:w.flowId,stepId:v.stepId,actionType:v.actionType,data:{},createdAt:new Date(v.createdAt),blocked:v.blocked,hidden:v.hidden})}}),[...u,...s]}return{addResponse:P,setFlowResponses:p,getFlowResponses:A}}var Dr=g(require("swr"));var Al=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Or=e=>{let t=Al.exec(e);if(t===null)return null;let o=null;return t.forEach((n,r)=>{let i=Il(n,"'","");i.startsWith("flow_")&&(o=i)}),o},Il=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Z(){let{config:e,apiUrl:t}=Xe(),{flows:o,setFlows:n,userId:r,publicApiKey:i,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,setFlowResponses:C,setShouldGracefullyDegrade:c}=(0,He.useContext)(Q),f={data:[]},{verifySDKInitiated:S}=$t(),{addResponse:P,getFlowResponses:A}=Ut(),u=h=>fetch(h,e).then(b=>b.ok?b.json():(console.log(`Error fetching ${h} (${b.status}): ${b.statusText}. .Will gracefully degrade and hide Frigade`),c(!0),f)).catch(b=>(console.log(`Error fetching ${h}: ${b}. Will gracefully degrade and hide Frigade`),c(!0),f)),{userFlowStatesData:w,isLoadingUserFlowStateData:B,optimisticallyMarkFlowCompleted:v,optimisticallyMarkFlowNotStarted:F,optimisticallyMarkStepCompleted:y,optimisticallyMarkStepNotStarted:m,optimisticallyMarkStepStarted:x}=We(),{data:T,error:O,isLoading:z}=(0,Dr.default)(i?`${t}flows`:null,u,{keepPreviousData:!0});(0,He.useEffect)(()=>{if(O){console.error(O);return}T&&T.data&&(T.data=n(T.data))},[T,O]);function V(h){if(z)return null;let b=o.find(E=>E.slug===h);return!b&&o.length>0&&!B&&!z?(console.log(`Flow with slug ${h} not found`),null):(b==null?void 0:b.active)===!1?null:b}function N(h){var H;if(!V(h))return[];let b=V(h).data;return b?(b=W(b),(((H=JSON.parse(b))==null?void 0:H.data)??[]).map(D=>{let _e=ne(D);return{handleSecondaryButtonClick:()=>{D.skippable===!0&&oe(h,D.id,{skipped:!0})},...D,complete:ie(h,D.id)===je||_e>=1,blocked:Fe(h,D.id),hidden:U(h,D.id),handlePrimaryButtonClick:()=>{(!D.completionCriteria&&(D.autoMarkCompleted||D.autoMarkCompleted===void 0)||D.completionCriteria&&D.autoMarkCompleted===!0)&&oe(h,D.id)},progress:_e}}).filter(D=>D.hidden!==!0)):[]}function W(h){return h.replaceAll(/\${(.*?)}/g,(b,E)=>s[E]===void 0?"":String(s[E]).replace(/[\u00A0-\u9999<>\&]/g,function(H){return"&#"+H.charCodeAt(0)+";"}).replaceAll(/[\\]/g,"\\\\").replaceAll(/[\"]/g,'\\"').replaceAll(/[\/]/g,"\\/").replaceAll(/[\b]/g,"\\b").replaceAll(/[\f]/g,"\\f").replaceAll(/[\n]/g,"\\n").replaceAll(/[\r]/g,"\\r").replaceAll(/[\t]/g,"\\t"))}function q(h){if(!V(h))return[];let b=V(h).data;return b?(b=W(b),JSON.parse(b)??{}):[]}function L(h,b){p(E=>({...E,[h]:b}))}function ce(h){!B&&!z&&h&&JSON.stringify(s)!=JSON.stringify({...s,...h})&&Object.keys(h).forEach(b=>{L(b,h[b])})}let Te=(0,He.useCallback)(async(h,b,E)=>{S();let H={foreignUserId:r,flowSlug:h,stepId:b,actionType:vo,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};ge(H)&&(await x(h,b,H),P(H))},[r,w]),j=(0,He.useCallback)(async(h,b,E)=>{S();let H={foreignUserId:r,flowSlug:h,stepId:b,actionType:ze,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};ge(H)&&(await m(h,b),P(H))},[r,w]),oe=(0,He.useCallback)(async(h,b,E)=>{S();let H={foreignUserId:r,flowSlug:h,stepId:b,actionType:je,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};ge(H)&&(await y(h,b,H),P(H))},[r,w]),Ue=(0,He.useCallback)(async(h,b)=>{if(S(),Je(h)===Ve)return;let E={foreignUserId:r,flowSlug:h,stepId:"unknown",actionType:Ve,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};await F(h),ge(E)&&P(E)},[r,w]),le=(0,He.useCallback)(async(h,b)=>{S();let E={foreignUserId:r,flowSlug:h,stepId:"unknown",actionType:Pt,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};ge(E)&&P(E)},[r,w]),J=(0,He.useCallback)(async(h,b)=>{S();let E={foreignUserId:r,flowSlug:h,stepId:"unknown",actionType:re,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};ge(E)&&(await v(h),P(E))},[r,w]),Pe=(0,He.useCallback)(async(h,b)=>{S();let E={foreignUserId:r,flowSlug:h,stepId:"unknown",actionType:Po,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};ge(E)&&(await v(h),P(E))},[r,w]);function ge(h){var b;if(!w&&h.actionType===ze)return!1;if(w){let E=w.find(H=>H.flowId===h.flowSlug);if(h.actionType===ze&&(!(E!=null&&E.stepStates[h.stepId])||E.stepStates[h.stepId].actionType===ze)||E&&((b=E.stepStates[h.stepId])==null?void 0:b.actionType)===h.actionType||E&&E.flowState===re&&h.actionType===re)return!1}return!0}function ie(h,b){let E=$(h,b);return B?null:E?E.actionType:ze}function Fe(h,b){let E=$(h,b);return E?E.blocked:!1}function U(h,b){let E=$(h,b);return E?E.hidden:!1}function $(h,b){if(B)return null;let E=w==null?void 0:w.find(H=>H.flowId===h);return!E||!E.stepStates[b]?null:E.stepStates[b]??null}function me(h){var E;if(B||!w)return null;if(Je(h)===Ve)return N(h)[0]??null;let b=(E=w.find(H=>H.flowId===h))==null?void 0:E.lastStepId;return b?N(h).find(H=>H.id===b):null}function K(h){let b=me(h);if(!b)return 0;let E=N(h).findIndex(H=>H.id===b.id)??0;return ie(h,b.id)===je&&E<N(h).length-1?E+1:E}function ne(h){if(!h.completionCriteria)return;let b=Or(h.completionCriteria);if(b===null)return;let E=at(b),H=Ft(b);return H===0?void 0:E/H}function Je(h){let b=w==null?void 0:w.find(E=>E.flowId===h);return b?b.flowState:null}function at(h){let b=N(h);return b.length===0?0:b.filter(H=>ie(h,H.id)===je).length}function Ft(h){return N(h).length}function G(h){return JSON.parse(o.find(b=>b.slug===h).data)}function Oe(h){if(B)return!0;if(h!=null&&h.targetingLogic&&w){let b=w.find(E=>E.flowId===h.slug);if(b)return b.shouldTrigger===!1}return!!(h!=null&&h.targetingLogic&&r&&r.startsWith("guest_"))}function pt(h){return!Oe(V(h))}return{getFlow:V,getFlowData:G,isLoading:B||z,getStepStatus:ie,getFlowSteps:N,getCurrentStepIndex:K,markStepStarted:Te,markStepCompleted:oe,markFlowNotStarted:Ue,markFlowStarted:le,markFlowCompleted:J,markFlowAborted:Pe,markStepNotStarted:j,getFlowStatus:Je,getNumberOfStepsCompleted:at,getNumberOfSteps:Ft,targetingLogicShouldHideFlow:Oe,setCustomVariable:L,updateCustomVariables:ce,customVariables:s,getStepOptionalProgress:ne,getFlowMetadata:q,isStepBlocked:Fe,isStepHidden:U,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,isFlowAvailableToUser:pt}}var vt=require("react");var _t="guest_";function zt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:r}=(0,vt.useContext)(Q),{config:i,apiUrl:s}=Xe(),{mutateUserFlowState:p}=We(),d=Dt(),{verifySDKInitiated:a}=$t();(0,vt.useEffect)(()=>{if(e&&!t){if(e.startsWith(_t))return;let f=`frigade-user-registered-${e}`;localStorage.getItem(f)||(d(`${s}users`,{...i,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(f,"true"))}},[e,r,t]);let C=(0,vt.useCallback)(async f=>{a();let S={foreignId:e,properties:f};await d(`${s}users`,{...i,method:"POST",body:JSON.stringify(S)}),n(P=>({...P,...f})),p()},[e,i,r,p]),c=(0,vt.useCallback)(async(f,S)=>{a();let A={foreignId:e,events:[{event:f,properties:S}]};await d(`${s}users`,{...i,method:"POST",body:JSON.stringify(A)}),p()},[e,i,p]);return{userId:e,setUserId:o,addPropertiesToUser:C,trackEventForUser:c}}var zi=require("uuid");var Ae=g(require("react"));var Ne=g(require("react")),ao=g(require("styled-components"));var Mr=g(require("react")),Ur=g(require("styled-components"));var $r="fr-",so="cfr-";function l(e,t){let o=`${$r}${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+" "+so+e}return o}function k(e){if(!e.className||e.className.indexOf(so)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith($r)?"":`:not(${o.map(n=>`.${n}`).join(", ")})`}function er(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function dt(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${er(t)}: ${e.styleOverrides[t]};`).join(" "):""}function ve(...e){return e.filter(Boolean).join(" ")}function lo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Nl=Ur.default.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -1052,7 +1052,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${so}${r}.${so}${r} { ${Object.entries(i).map
|
|
|
1052
1052
|
:hover {
|
|
1053
1053
|
opacity: 0.8;
|
|
1054
1054
|
}
|
|
1055
|
-
`,
|
|
1055
|
+
`,vf=nt.default.div``,Jn=nt.default.p`
|
|
1056
1056
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1057
1057
|
font-weight: 400;
|
|
1058
1058
|
font-size: 14px;
|
|
@@ -1062,7 +1062,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${so}${r}.${so}${r} { ${Object.entries(i).map
|
|
|
1062
1062
|
flex-direction: row;
|
|
1063
1063
|
justify-content: flex-start;
|
|
1064
1064
|
align-items: center;
|
|
1065
|
-
`;var Qn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:n,onSecondaryButtonClick:r,appearance:i,customStepTypes:s})=>{var C,c;let p=t?{}:{transform:"rotate(90deg)"};function d(){return Ce.default.createElement(Ce.default.Fragment,null,e.imageUri||e.videoUri?Ce.default.createElement(jn,{className:l("stepMediaContainer",i)},e.imageUri?Ce.default.createElement(Gn,{className:l("stepImage",i),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Ce.default.createElement(jt,{appearance:i,videoUri:e.videoUri}):null):null,Ce.default.createElement(Jn,{className:l("stepSubtitle",i),appearance:i,dangerouslySetInnerHTML:ye(e.subtitle)}),Ce.default.createElement(_o,{className:l("checklistCTAContainer",i)},e.secondaryButtonTitle?Ce.default.createElement(ae,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>r(),appearance:i}):null,Ce.default.createElement(ae,{title:e.primaryButtonTitle??"Continue",onClick:()=>n(),appearance:i})))}function a(){if(!s)return null;let f=s[e.type];return f?f(e,i):null}return Ce.default.createElement(Vn,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",i),appearance:i},Ce.default.createElement(qn,{className:l("stepHeader",i)},Ce.default.createElement(Xn,null,Ce.default.createElement(qo,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(C=i==null?void 0:i.theme)==null?void 0:C.colorPrimary,appearance:i}),Ce.default.createElement(Kn,{appearance:i,className:l("stepTitle",i),dangerouslySetInnerHTML:ye(e.title)})),Ce.default.createElement(Yn,{className:l("stepChevronContainer",i),onClick:()=>o()},Ce.default.createElement(Qt,{style:{...p,transition:"transform 0.1s ease-in-out"},color:(c=i==null?void 0:i.theme)==null?void 0:c.colorTextSecondary}))),Ce.default.createElement(Qo.AnimatePresence,null,!t&&Ce.default.createElement(Qo.motion.div,{initial:{opacity:1,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:0},key:e.id,style:{overflow:"hidden"}},a()??d())))};var Nt=g(require("styled-components")),
|
|
1065
|
+
`;var Qn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:n,onSecondaryButtonClick:r,appearance:i,customStepTypes:s})=>{var C,c;let p=t?{}:{transform:"rotate(90deg)"};function d(){return Ce.default.createElement(Ce.default.Fragment,null,e.imageUri||e.videoUri?Ce.default.createElement(jn,{className:l("stepMediaContainer",i)},e.imageUri?Ce.default.createElement(Gn,{className:l("stepImage",i),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Ce.default.createElement(jt,{appearance:i,videoUri:e.videoUri}):null):null,Ce.default.createElement(Jn,{className:l("stepSubtitle",i),appearance:i,dangerouslySetInnerHTML:ye(e.subtitle)}),Ce.default.createElement(_o,{className:l("checklistCTAContainer",i)},e.secondaryButtonTitle?Ce.default.createElement(ae,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>r(),appearance:i}):null,Ce.default.createElement(ae,{title:e.primaryButtonTitle??"Continue",onClick:()=>n(),appearance:i})))}function a(){if(!s)return null;let f=s[e.type];return f?f(e,i):null}return Ce.default.createElement(Vn,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",i),appearance:i},Ce.default.createElement(qn,{className:l("stepHeader",i)},Ce.default.createElement(Xn,null,Ce.default.createElement(qo,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(C=i==null?void 0:i.theme)==null?void 0:C.colorPrimary,appearance:i}),Ce.default.createElement(Kn,{appearance:i,className:l("stepTitle",i),dangerouslySetInnerHTML:ye(e.title)})),Ce.default.createElement(Yn,{className:l("stepChevronContainer",i),onClick:()=>o()},Ce.default.createElement(Qt,{style:{...p,transition:"transform 0.1s ease-in-out"},color:(c=i==null?void 0:i.theme)==null?void 0:c.colorTextSecondary}))),Ce.default.createElement(Qo.AnimatePresence,null,!t&&Ce.default.createElement(Qo.motion.div,{initial:{opacity:1,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:0},key:e.id,style:{overflow:"hidden"}},a()??d())))};var Nt=g(require("styled-components")),Uf=Nt.default.div`
|
|
1066
1066
|
background: #ffffff;
|
|
1067
1067
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1068
1068
|
border-radius: 6px;
|
|
@@ -1296,7 +1296,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${so}${r}.${so}${r} { ${Object.entries(i).map
|
|
|
1296
1296
|
justify-content: center;
|
|
1297
1297
|
margin-left: 16px;
|
|
1298
1298
|
min-width: 200px;
|
|
1299
|
-
`,
|
|
1299
|
+
`,jg=Rt.default.div`
|
|
1300
1300
|
display: flex;
|
|
1301
1301
|
justify-content: center;
|
|
1302
1302
|
align-items: flex-end;
|
|
@@ -1574,7 +1574,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${so}${r}.${so}${r} { ${Object.entries(i).map
|
|
|
1574
1574
|
display: flex;
|
|
1575
1575
|
flex-direction: column;
|
|
1576
1576
|
flex: 1;
|
|
1577
|
-
|
|
1577
|
+
`,Dx=lt.default.div`
|
|
1578
1578
|
display: flex;
|
|
1579
1579
|
flex-direction: column;
|
|
1580
1580
|
justify-content: center;
|