@frigade/react 1.38.47 → 1.38.49
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/dist/index.js +124 -124
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -113
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/FrigadeProvider/index.tsx","../src/components/DataFetcher/index.tsx","../src/api/flows.ts","../src/api/common.ts","../src/api/version.ts","../src/api/flow-responses.ts","../src/api/user-flow-states.ts","../src/api/flow-opens.ts","../src/shared/deepmerge.ts","../src/shared/parse.ts","../src/shared/completion-util.ts","../src/api/users.tsx","../src/FrigadeForm/index.tsx","../src/components/Modal/index.tsx","../src/components/Modal/ModalBackground.tsx","../src/shared/appearance.ts","../src/components/Icons/Close.tsx","../src/components/branding/PoweredByFrigade.tsx","../src/components/Icons/FrigadeLogo.tsx","../src/components/branding/styled.ts","../src/components/Tooltips/styled.ts","../src/components/CornerModal/index.tsx","../src/hooks/useTheme.ts","../src/components/Forms/MultiInputStepType/MultiInputStepType.tsx","../src/components/Forms/MultiInputStepType/form-components/TextField/index.tsx","../src/components/Forms/MultiInputStepType/form-components/shared/styled.tsx","../src/components/Forms/MultiInputStepType/form-components/shared/Label.tsx","../src/types/index.tsx","../src/components/Forms/MultiInputStepType/form-components/shared/SubLabel.tsx","../src/components/Forms/MultiInputStepType/form-components/shared/validation.ts","../src/components/Forms/MultiInputStepType/form-components/MultipleChoice/index.tsx","../src/components/Forms/MultiInputStepType/form-components/MultipleChoiceList/index.tsx","../src/components/CheckBox/index.tsx","../src/components/Progress/ProgressRing/ProgressRing.tsx","../src/shared/sanitizer.ts","../src/components/TitleSubtitle/TitleSubtitle.tsx","../src/components/Icons/Warning.tsx","../src/FrigadeForm/styled.ts","../src/FrigadeForm/FormFooter.tsx","../src/components/Button/index.tsx","../src/components/Spinner/index.tsx","../src/FrigadeForm/FormPagination.tsx","../src/components/Forms/LinkCollectionStepType/index.tsx","../src/hooks/useCTAClickSideEffects.ts","../src/components/Forms/CallToActionStepType/CallToActionStepType.tsx","../src/components/Icons/Play.tsx","../src/components/Video/VideoCard.tsx","../src/components/Forms/SelectListStepType/SelectListStepType.tsx","../src/components/Forms/SelectListStepType/styled.ts","../src/FrigadeForm/FormContent.tsx","../src/components/RenderInlineStyles.tsx","../src/hooks/useFlowImpressions.ts","../src/api/organizations.tsx","../src/shared/appearanceToOverrides.ts","../src/components/Button/Button.styles.ts","../src/components/Box/index.tsx","../src/components/Text/Text.styles.ts","../src/shared/theme.ts","../src/components/HeroChecklist/index.tsx","../src/FrigadeChecklist/index.tsx","../src/components/Checklists/HeroChecklist/HeroChecklist.tsx","../src/components/Checklists/HeroChecklist/StepChecklistItem.tsx","../src/components/CheckBoxRow/index.tsx","../src/components/Checklists/HeroChecklist/styled.ts","../src/components/Checklists/Checklist/ProgressBar.tsx","../src/components/Checklists/Checklist/styled.ts","../src/components/checklist-step-content/HeroStepContent.tsx","../src/components/checklist-step-content/shared/TitleSubtitleWithCTA.tsx","../src/components/checklist-step-content/shared/TitleSubtitle.tsx","../src/components/checklist-step-content/shared/CTA.tsx","../src/components/Video/VideoPlayer.tsx","../src/components/checklist-step-content/VideoCarousel.tsx","../src/components/checklist-step-content/CodeSnippetContent.tsx","../src/components/Checklists/ChecklistWithGuide/ChecklistWithGuide.tsx","../src/components/Icons/Chevron.tsx","../src/components/Checklists/ChecklistWithGuide/styled.ts","../src/components/styled.ts","../src/components/Guides/Guide.tsx","../src/components/Guides/styled.ts","../src/components/Checklists/CondensedChecklist/CondensedChecklist.tsx","../src/components/Checklists/CondensedChecklist/CollapsibleStep/index.tsx","../src/components/Checklists/CondensedChecklist/CollapsibleStep/styled.ts","../src/components/Checklists/CondensedChecklist/styled.ts","../src/components/Checklists/CarouselChecklist/index.tsx","../src/hooks/useMediaQuery.ts","../src/components/Checklists/CarouselChecklist/CarouselCard.tsx","../src/components/Checklists/CarouselChecklist/styled.ts","../src/FrigadeProgressBadge/index.tsx","../src/components/Checklists/MiniProgressBadge/index.tsx","../src/components/Checklists/MiniProgressBadge/styled.ts","../src/components/Checklists/FullWidthProgressBadge/index.tsx","../src/components/Checklists/FullWidthProgressBadge/styled.ts","../src/FrigadeGuide/FrigadeGuide.tsx","../src/FrigadeTour/index.tsx","../src/components/Tooltips/Tooltips.tsx","../src/components/Tooltips/position.ts","../src/hooks/useDebug.ts","../src/FrigadeSupportWidget/index.tsx","../src/FrigadeSupportWidget/styled.ts","../src/components/Icons/Question.tsx","../src/components/Icons/QuestionCircle.tsx","../src/FrigadeEmbeddedTip/index.tsx","../src/FrigadeEmbeddedTip/styled.ts","../src/FrigadeAnnouncement/styled.ts","../src/components/Media/index.tsx","../src/FrigadeBanner/index.tsx","../src/FrigadeBanner/styled.ts","../src/components/Icons/Info.tsx","../src/FrigadeNPSSurvey/index.tsx","../src/FrigadeNPSSurvey/styled.ts","../src/FrigadeAnnouncement/index.tsx","../src/components/Button/TEMP_index.tsx","../src/components/Text/index.tsx","../src/index.ts"],"names":["React","createContext","useEffect","useState","ThemeProvider","useContext","useCallback","useMemo","VERSION_NUMBER","NOT_STARTED_STEP","COMPLETED_FLOW","SKIPPED_FLOW","STARTED_FLOW","NOT_STARTED_FLOW","COMPLETED_STEP","STARTED_STEP","useConfig","publicApiKey","userId","apiUrl","FrigadeContext","LAST_POST_CALL_AT","LAST_POST_CALL_DATA","useGracefulFetch","shouldGracefullyDegrade","readonly","url","options","__async","getEmptyResponse","lastCallAtKey","lastCallDataKey","lastCall","lastCallData","lastCallDate","response","error","useCheckHasInitiatedAPI","verifySDKInitiated","wait","delay","resolve","fetchRetry","delayMS","tries","fetchOptions","onError","err","triesLeft","useSWR","useFlowOpens","openFlowStates","setOpenFlowStates","hasActiveFullPageFlow","setCompletedFlowsToKeepOpenDuringSession","completedFlowsToKeepOpenDuringSession","getOpenFlowState","flowId","defaultValue","_a","setOpenFlowState","isOpen","prev","__spreadProps","__spreadValues","resetOpenFlowState","_","rest","__objRest","__restKey","setKeepCompletedFlowOpenDuringSession","shouldKeepCompletedFlowOpenDuringSession","hasOpenModals","currentFlowId","useSWRImmutable","structuredClone","isObject","obj","deepmerge","args","target","source","result","key","value","safeParse","stringified","e","UNKNOWN_STEP_ID","useUserFlowStates","config","organizationId","flows","setShouldGracefullyDegrade","hasFinishedInitialLoad","setHasFinishedInitialLoad","emptyResponse","flow","fetcher","data","isLoadingUserFlowStateData","mutateUserFlowState","userFlowStatesData","optimisticallyMarkFlowCompleted","flowState","state","optimisticallyMarkFlowSkipped","optimisticallyMarkStepCompleted","stepId","flowResponse","_b","_c","steps","currentStepIndex","step","nextStep","optimisticallyMarkStepStarted","optimisticallyMarkFlowNotStarted","optimisticallyMarkStepNotStarted","useFlowResponses","failedFlowResponses","setFailedFlowResponses","flowResponses","setFlowResponses","successfulFlowResponsesStrings","setSuccessfulFlowResponsesStrings","successfulFlowResponses","setSuccessfulFlowResponses","gracefullyFetch","postFlowResponse","flowResponseString","existingFlowResponse","r","addResponse","getFlowResponses","apiFlowResponses","stepSlug","stepState","regex","getSubFlowFromCompletionCriteria","completionCriteria","flowMatch","match","trimmed","replaceAll","search","replacement","FlowType","useFlows","setFlows","customVariables","setCustomVariables","setHasActiveFullPageFlow","flowDataOverrides","debug","flowData","isLoadingFlows","getFlow","f","getFlowSteps","_d","_e","substituteVariables","autoCalculatedProgress","getStepOptionalProgress","returnData","markStepCompleted","getStepStatus","isStepBlocked","isStepHidden","variableName","i","getFlowMetadata","slug","setCustomVariable","updateCustomVariables","newCustomVariables","markStepStarted","shouldSendServerSideCall","markStepNotStarted","markFlowNotStarted","getFlowStatus","markFlowStarted","markFlowCompleted","markFlowSkipped","sortedStepStates","a","b","aDate","bDate","maybeFlowResponse","getStepStateForFlow","getCurrentStep","lastStep","s","getCurrentStepIndex","currentStep","index","stepSubFlowSlug","completed","getNumberOfStepsCompleted","total","getNumberOfSteps","userFlowState","getFlowData","maybeFlow","targetingLogicShouldHideFlow","matchingUserFlowState","ufs","isFlowAvailableToUser","refresh","getAllFlows","GUEST_PREFIX","useUser","userIdInternal","setUserId","setUserProperties","getUserIdKey","id","userRegisteredKey","addPropertiesToUser","properties","userProperties","trackEventForUser","event","setUserIdWithProperties","linkExistingGuestSessionToUser","existingGuestId","guestUserIdField","uuidv4","styled","CSS_CLASS_PREFIX","CUSTOM_CSS_STYLES_PREFIX","getClassName","className","appearance","defaultClass","getCustomClassOverrides","props","customClassesArray","toKebabKey","styleOverridesToCSS","mergeClasses","classes","ucFirst","str","Background","ModalBackground","onClose","CloseContainer","Close","Portal","FrigadeLogo","style","FrigadeLogo_default","TooltipContainer","dismissWithImageStyle","dismissWithoutImageStyle","TooltipDismissButton","TooltipImageContainer","TooltipVideoContainer","TooltipFooter","TooltipContentContainer","TooltipStepCountContainer","TooltipCTAContainer","TooltipStepCounter","PoweredByFrigadeModalRibbon","PoweredByFrigadeTooltipRibbon","PoweredByFrigadeContainer","PoweredByFrigade","ModalContainer","ModalHeader","ModalClose","Body","Modal","visible","headerContent","children","dismissible","showFrigadeBranding","initialBodyOverflow","setInitialBodyOverflow","initialOverflow","handleEscape","bodyStyle","getModalPosition","modalPosition","CornerModalContainer","CornerModalHeader","CornerModalClose","CornerModal","handleDismiss","useTheme","defaultAppearance","mergeAppearanceWithDefault","_appearance","FormLabel","FormSubLabel","RequiredSymbol","LabelWrapper","DefaultAppearance","Label","title","required","SubLabel","z","getErrorsFromValidationResult","validation","_f","_g","validator","validationProp","TextInputWrapper","TextInput","TextArea","TextField","formInput","customFormTypeProps","onSaveInputData","setFormValidationErrors","inputData","input","setData","hasLoaded","setHasLoaded","hasGivenFocus","setHasGivenFocus","InputComponent","handleDataChange","validationError","getType","NULL_VALUE","MultipleChoiceWrapper","MultipleChoiceSelect","MultipleChoice","_h","_i","hasSelected","setHasSelected","otherValue","setOtherValue","option","Circle","color","percentage","size","circum","strokePct","ProgressRing","fillColor","bgColor","ProgressRing_default","CheckIcon","BASE_CHECKBOX_STYLES_SQUARE","BASE_CHECKBOX_STYLES_ROUND","BASE_CHECKBOX_STYLES_SQUARE__CHECKED","BASE_CHECKBOX_STYLES_SQUARE__UNCHECKED","BASE_CHECKBOX_STYLES_ROUND__CHECKED","BASE_CHECKBOX_STYLES_ROUND__UNCHECKED","getBaseStyle","type","getStateStyle","checked","CheckIconContainer","CheckBox","primaryColor","progress","label","checkBoxStyle","stateStyle","DOMPurify","sanitize","dirty","removeHTMLChars","encoded","dec","MultipleChoiceListWrapper","MultipleChoiceListItem","MultipleChoiceList","selectedIds","setSelectedIds","HeaderTitle","HeaderSubtitle","TitleSubtitle","subtitle","classPrefix","ariaPrefix","Warning","MultiInputContainer","MultiInputValidationError","MultiInputValidationErrorIcon","MultiInput","DEFAULT_INPUT_TYPES","FORM_DATA_KEY_PREFIX","MultiInputStepType","stepData","canContinue","setCanContinue","onSaveData","customFormElements","prefillData","formElements","formValidationErrors","touchedInputs","setTouchedInputs","allFormData","setAllFormData","loadFromLocalStorage","mergedInputTypes","saveDataFromInputs","prevData","newData","getLocalStorageKey","errors","FormCTAContainer","FormCTAError","CTAWrapper","FormContainer","FormContainerWrapper","FormContainerSidebarImage","Spinner","ButtonContainer","MultipleButtonContainer","Button","onClick","disabled","secondary","withMargin","loading","getClassNameWithPrefix","name","commonProps","FormFooter","onPrimaryClick","onSecondaryClick","selectedStep","onBack","allowBackNavigation","errorMessage","isSaving","showBackButton","buttonType","Wrapper","FormPagination","stepCount","theme","idx","useCTAClickSideEffects","context","primaryCTAClickSideEffects","handleUrl","secondaryCTAClickSideEffects","updatedTarget","LinkContainer","Link","LinkIcon","LinkTitle","LinkCollectionStepType","link","Play","useRef","VideoPlayerWrapper","PlayIconWrapper","Video","YouTubeVideoSource","VimeoVideoSource","WistiaVideoSource","VideoCard","videoUri","autoplay","loop","hideControls","ref","isPlaying","setIsPlaying","videoId","ampersandPosition","CallToActionStepContainer","CallToActionImage","CallToActionTextContainer","CallToActionVideo","CallToActionStepType","SelectListSelectionContainer","SelectListHeader","SelectListTitle","SelectListSubtitle","SelectItem","SelectItemLeft","ItemIcon","SelectItemText","SelectListStepType","multipleChoiceProps","lastStepId","setLastStepId","isSelected","AnimationWrapper","shouldWrap","FormContent","customStepTypes","onButtonClick","onStepCompletion","hideOnFlowCompletion","onComplete","setVisible","setShowModal","onDismiss","showPagination","validationHandler","onFormDataChange","showFooter","updateUrlOnPageChange","repeatable","mergedCustomStepTypes","formData","setFormData","setIsSaving","setErrorMessage","isLoading","getDataPayload","handleStepCompletionHandlers","cta","maybeNextStep","updateData","prevState","newObj","FormContainerSidebar","formFooter","payload","shouldClose","StepComponent","createGlobalStyle","GlobalStyleComponent","nestedKey","nestedValue","RenderInlineStyles","inlineStyles","useFlowImpressions","hasMarkedFlowStarted","setHasMarkedFlowStarted","markFlowStartedIfNeeded","FrigadeForm","endFlowOnDismiss","lastHashNavigationStepId","setLastHashNavigationStepId","showModal","hash","stepIdFromHash","newStepIndex","stepIdToGoTo","handleClose","overrideStyle","FrigadeForm_default","useOrganization","organizationIdInternal","setOrganizationId","getUserGroupKey","uId","oId","addPropertiesToOrganization","trackEventForOrganization","setOrganizationIdWithProperties","realUserIdField","DataFetcher","lastUserId","setLastUserId","setIsNewGuestUser","disableImagePreloading","automaticFlowIdsToTrigger","setAutomaticFlowIdsToTrigger","triggeredFlows","setTriggeredFlows","lastOrganizationId","setLastOrganizationId","triggerFlow","generateGuestUserId","realUserId","guestUserId","newGuestUserId","loadedImageUrls","imageUrls","imageUrl","img","AutomaticFlowIdsToTrigger","THEME_MAP","themeToTokens","overrides","levels","currentLevel","nextLevel","styleOverrides","copiedOverrides","css","oldSelector","newSelector","appearanceToOverrides","compose","variant","border","get","shadow","space","system","typography","layoutWithoutSize","n","scale","StyledBox","Box","as","styleResetProps","renderBox","newTheme","buttonVariants","buttonSizes","StyledButton","textVariants","StyledText","SPACE_VALUE","SPACE_UNIT","SPACE_SCALE_EXTENT","spaceScale","palette","tokens","DEFAULT_API_URL","clearLocalStorage","FrigadeProvider","guestId","userIdValue","setUserIdValue","organizationIdValue","setOrganizationIdValue","isNewGuestUser","isValidApiKey","internalNavigate","apiKey","contextParams","CheckBoxRowContainer","CheckBoxRow","labelStyle","labelPosition","checkBoxType","HeroChecklistStepContent","HeroChecklistStepTitle","HeroChecklistStepSubtitle","StepItemSelectedIndicator","ChecklistStepItem","StepChecklistItem","ChecklistTitle","ChecklistSubtitle","ProgressBarFill","ProgressBarBackground","ProgressContainer","ProgressProgressBar","StepText","ProgressBar","count","display","textLocation","textStyle","fgWidth","barHeight","percentComplete","padding","stepText","CTA","handlePrimaryButtonClick","handleSecondaryButtonClick","TitleSubtitleWithCTA","VideoPlayer","HERO_STEP_CONTENT_TYPE","StepImage","HeroStepContent","Content","VideoCarouselContainer","VideoList","VideoSource","VideoTitle","VIDEO_CAROUSEL_TYPE","VideoCarousel","video","videoProps","CodeSnippetContainer","CodeSnippet","CodeSnippetTitle","CodeSnippets","CODE_SNIPPET_CONTENT_TYPE","CodeSnippetContent","codeProps","codeSnippet","HeroChecklistContainer","HeroChecklistTitle","HeroChecklistSubtitle","ChecklistHeader","ChecklistHeaderContainer","ChecklistStepsContainer","Divider","HeroChecklistStepContentContainer","HeroChecklist","setSelectedStep","DEFAULT_CUSTOM_STEP_TYPES","selectedStepInternal","setSelectedStepInternal","selectedStepValue","setSelectedStepValue","completeCount","StepContent","HeroChecklist_default","ChevronSVG","Chevron","ContainerStyle","ScrollContainer","HeaderContent","StepsContainer","StepsHeader","StepsTitle","StepsBody","StepListContainer","StepContainer","StepTitle","StepSubtitle","StepListItem","StepListStepName","StepListItemRight","ProgressBarContainer","ChecklistContainer","CenterVertical","GuideContainer","GuideItems","GuideTitle","GuideItem","GuideIconWrapper","GuideIcon","GuideItemTitle","GuideItemSubtitle","GuideItemLink","Guide","Guide_default","ChecklistWithGuide","stepsTitle","guideData","guideTitle","onGuideButtonClick","DefaultStepContent","handleSecondaryCTAClick","handleCTAClick","ChecklistWithGuide_default","StepMediaContainer","StepHeader","CollapseChevronContainer","ExpandedContentContainer","HeaderLeft","CollapsibleStep","collapsed","onPrimaryButtonClick","onSecondaryButtonClick","iconStyle","stepContentStyle","getDefaultStepContent","getCustomStep","customStep","ModalChecklistContainer","ModalChecklistTitle","ModalChecklistSubtitle","CondensedInlineChecklistContainer","CondensedChecklist","autoExpandFirstIncompleteStep","autoCollapse","autoExpandNextStep","collapsedSteps","setCollapsedSteps","initCollapsedState","handleStepClick","newCollapsedState","checklistContent","isCollapsed","CondensedChecklist_default","useMediaQuery","queries","defaultMatches","matches","setMatches","updateTimeout","throttledUpdate","updateMatches","freshMatches","query","mediaQuery","keyframes","defaultBorder","defaultShadow","fadeIn","fadeOut","CarouselScroll","CarouselScrollGroup","StyledCarouselFade","StyledScrollButton","Card","StyledCarouselCard","StyledCarouselCardImage","CarouselContainer","CarouselProgressBar","ProgressBarLabel","CompletedPill","H3","CarouselTitle","ProgressWrapper","H4","CardTitle","Small","CarouselCard","imageUri","complete","blocked","hasCTA","handleClick","RightArrow","CarouselFade","side","show","mounted","setMounted","reversed","setReversed","handleFadeOutEnd","CarouselChecklist","scrollContainerRef","showLeftFade","setShowLeftFade","showRightFade","setShowRightFade","flowMetadata","setFlowMetadata","flowSteps","setFlowSteps","numberOfStepsCompleted","setNumberOfStepsCompleted","isSmall","pageSize","metadata","completedStepCount","scrollGroups","handleScroll","maxScroll","currentScroll","handleScrollByPage","forward","direction","scrollTimeout","throttledScroll","group","j","FrigadeChecklist","initialSelectedStep","checklistStyle","guideProps","finishedInitialLoad","setFinishedInitialLoad","isModal","initialCompleteState","setInitialCompleteState","flowStatus","metaData","firstIncompleteStep","goToNextStepIfPossible","getSteps","CommonDom","getCarouselChecklist","getCondensedChecklist","getChecklistWithGuide","guideFlowId","guideFlowSteps","getDefaultChecklist","checklist","FrigadeHeroChecklist","BadgeContainer","BadgeRow","BadgeTitle","ProgressRingContainer","MiniProgressBadge","FullWidthProgressBadgeContainer","IconContainer","TextContainer","DismissButton","FullWidthProgressBadge","icon","FrigadeProgressBadge","completedCount","FrigadeGuide","useLayoutEffect","getPosition","boundingRect","position","cardWidth","offset","positionStyle","scrollY","scrollX","useElemRect","elem","refresher","initialRect","dimensions","setDimensions","handleResize","useDebug","logMessages","setLogMessages","logIfDebugMode","message","m","logErrorIfDebugMode","DEFAULT_CARD_WIDTH","DEFAULT_CARD_HEIGHT","DEFAULT_REFRESH_DELAY","HIGHLIGHT_RADIUS","HighlightOuter","HighlightInner","TooltipWrapper","PositionWrapper","HighlightContainer","Tooltips","tooltipPosition","showHighlight","containerStyle","showHighlightOnly","showStepCount","completedStepsCount","cssPosition","onViewTooltip","_j","_k","_l","_m","_n","_o","_p","_q","_r","_s","selfBounds","setSelfBounds","needsUpdate","setNeedsUpdate","selfRef","setElem","lastBoundingRect","setLastBoundingRect","showTooltipContainer","setShowTooltipContainer","zIndex","cardHeight","renderTime","setRenderTime","handleRefreshPosition","observer","intervalId","tooltipPositionValue","rightSideIsCropped","bottomIsCropped","DefaultFooterContent","handleOnCTAClick","handleOnSecondaryCTAClick","DefaultTooltipStepContent","cssPos","getBoundedLeftPosition","leftOffset","getBoundedTopPosition","tooltipBottom","spaceFromEdge","Tooltips_default","FrigadeTour","showTooltipsSimultaneously","dismissBehavior","skipIfNotFound","otherFlowId","_flowID","markTooltipCompleted","status","onDismissTooltip","handleComplete","handleViewTooltip","isCurrentSelectorMissing","renderMultipleToolTips","firstVisibleIndex","getTooltips","SupportButton","SupportTitle","SupportIconContainer","FloatingWidgetContainer","FloatingWidgetButton","FloatingWidgetMenu","FlowWidgetMenuItem","Question","QuestionCircle","FrigadeSupportWidget","wrapperRef","showMenu","setShowMenu","handleClickOutside","Menu","EmbeddedTipContainer","CallToActionContainer","AnnouncementContainer","PaginationContainer","MediaContainer","Image","Media","FrigadeEmbeddedTip","BannerContainer","DismissButtonContainer","Info","FrigadeBanner","NPSSurveyContainer","NPSNumberButton","NPSNumberButtonContainer","NPSLabelContainer","NPSLabel","NPSCTAContainer","FrigadeNPSSurvey","score","setScore","feedbackText","setFeedbackText","getScoreChooser","getScoreReason","getContent","FrigadeAnnouncement","totalSteps","BaseText","textVariantComponents","asProp","component","Text","BaseButton","buttonVariantComponents","newStr"],"mappings":"i1BAAA,OAAOA,IAAS,iBAAAC,GAAmB,aAAAC,GAAW,YAAAC,OAAgB,QAC9D,OAAS,iBAAAC,OAAqB,oBCD9B,OAAOJ,IAAa,cAAAK,GAAY,aAAAH,GAAW,YAAAC,OAAgB,QCA3D,OAAS,eAAAG,GAAa,cAAAD,GAAY,aAAAH,OAAiB,QCAnD,OAAOF,IAAS,WAAAO,OAAe,QCAxB,IAAMC,GAAiB,UDIvB,IAAMC,GAAmB,mBACnBC,GAAiB,iBACjBC,GAAe,eACfC,GAAe,eACfC,GAAmB,mBACnBC,GAAiB,iBACjBC,GAAe,eAIrB,SAASC,IAAY,CAC1B,GAAM,CAAE,aAAAC,EAAc,OAAAC,EAAQ,OAAAC,CAAO,EAAInB,GAAM,WAAWoB,EAAc,EAExE,MAAO,CACL,OAAQb,GACN,KAAO,CACL,QAAS,CACP,cAAe,UAAUU,IACzB,eAAgB,mBAChB,wBAAyBT,GACzB,yBAA0B,OAC5B,CACF,GACA,CAACS,EAAcC,CAAM,CACvB,EACA,OAAQX,GAAQ,IAAM,GAAGY,eAAqB,CAACA,CAAM,CAAC,CACxD,CACF,CAEA,IAAME,GAAoB,wBACpBC,GAAsB,0BACrB,SAASC,IAAmB,CACjC,GAAM,CAAE,wBAAAC,EAAyB,SAAAC,CAAS,EAAIzB,GAAM,WAAWoB,EAAc,EAE7E,MAAO,CAAOM,EAAaC,IAAiBC,EAAA,sBAC1C,GACEH,IACCE,EAAQ,SAAW,QAAUA,EAAQ,SAAW,OAASA,EAAQ,SAAW,UAE7E,OAAOE,GAAiB,EAE1B,GAAIL,EACF,eAAQ,IAAI,YAAYE,gCAAkC,EACnDG,GAAiB,EAE1B,IAAMC,EAAgBT,GA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Ac,QAAQnb,IAEzB,CAACA,EAASmb,CAAS,CAC5B,CAAC,CACH,EAEaC,GAAO,OAAO,OAAOJ,GAAUC,EAAqB,ED/BjE,IAAMI,GAAqC98B,GAOrC,CAPqC,IAAAmD,EAAAnD,EACzC,IAAAqiB,EAAK,SACL,UAAAtX,EACA,KAAA+G,EAAO,KACP,MAAA3C,EACA,QAAAsS,EAAU,SAlBZ,EAa2Cte,EAMtC3C,EAAAC,GANsC0C,EAMtC,CALH,KACA,YACA,OACA,QACA,YAlBF,IAAAnD,EAqBE,OACE,iBAAC2iB,GAAAtiB,EAAA,CACC,UAAW,aAAaohB,EAAQ,YAAY,IAAI1W,EAAY,IAAIA,IAAc,KAC9E,YAAasX,EACb,QAASZ,EACT,KAAM3P,EACN,aAAa,MACTtR,GAEJ,iBAACq8B,GAAA,CAAK,OAAO78B,EAAAyiB,GAAehB,CAAO,IAAtB,YAAAzhB,EAAyB,MAAO,WAAW,YACrDmP,CACH,CACF,CAEJ,EAEM4tB,GAA0B,OAAO,YACrC,OAAO,KAAKta,EAAc,EAAE,IAAKhB,GAAY,CAC3C,IAAMmb,EAAazxB,GAAuB,iBAAC2xB,GAAA18B,EAAAC,EAAA,GAAe8K,GAAf,CAAsB,QAASsW,GAAS,EAEnF,OAAAmb,EAAU,YAAc,UAAUnb,IAE3B,CAACA,EAASmb,CAAS,CAC5B,CAAC,CACH,EAEahmB,GAAS,OAAO,OAAOkmB,GAAYC,EAAuB,EEelE,OAAO,UAAU,aACpB,OAAO,UAAU,WAAa,SAAUrxB,EAAUsxB,EAAa,CAE7D,OAAI,OAAO,UAAU,SAAS,KAAKtxB,CAAG,EAAE,YAAY,IAAM,kBACjD,KAAK,QAAQA,EAAKsxB,CAAM,EAI1B,KAAK,QAAQ,IAAI,OAAOtxB,EAAK,GAAG,EAAGsxB,CAAM,CAClD","sourcesContent":["import React, { createContext, FC, useEffect, useState } from 'react'\nimport { ThemeProvider } from 'styled-components'\nimport { DataFetcher, guestUserIdField, realUserIdField } from '../components/DataFetcher'\nimport { Flow } from '../api/flows'\nimport { FlowResponse } from '../api/flow-responses'\nimport { Appearance, DefaultAppearance } from '../types'\nimport { deepmerge } from '../shared/deepmerge'\nimport { appearanceToOverrides } from '../shared/appearanceToOverrides'\n\nimport { tokens } from '../shared/theme'\n\nexport interface IFrigadeContext {\n publicApiKey: string\n userId?: string | null\n setUserId: React.Dispatch<React.SetStateAction<string | null>>\n flows: Flow[]\n setFlows: React.Dispatch<React.SetStateAction<Flow[]>>\n failedFlowResponses: FlowResponse[]\n setFailedFlowResponses: React.Dispatch<React.SetStateAction<FlowResponse[]>>\n flowResponses?: FlowResponse[]\n setFlowResponses?: React.Dispatch<React.SetStateAction<FlowResponse[]>>\n children?: React.ReactNode\n userProperties?: { [key: string]: string | boolean | number | null }\n setUserProperties?: React.Dispatch<\n React.SetStateAction<{ [key: string]: string | boolean | number | null }>\n >\n openFlowStates: { [key: string]: boolean }\n setOpenFlowStates: React.Dispatch<React.SetStateAction<{ [key: string]: boolean }>>\n completedFlowsToKeepOpenDuringSession: string[]\n setCompletedFlowsToKeepOpenDuringSession: React.Dispatch<React.SetStateAction<string[]>>\n customVariables?: { [key: string]: string | boolean | number | null }\n setCustomVariables?: React.Dispatch<\n React.SetStateAction<{ [key: string]: string | boolean | number | null }>\n >\n isNewGuestUser: boolean\n setIsNewGuestUser: React.Dispatch<React.SetStateAction<boolean>>\n hasActiveFullPageFlow: boolean\n setHasActiveFullPageFlow: React.Dispatch<React.SetStateAction<boolean>>\n organizationId?: string\n setOrganizationId?: React.Dispatch<React.SetStateAction<string | null>>\n navigate: (url: string, target: string) => void\n defaultAppearance: Appearance\n shouldGracefullyDegrade: boolean\n setShouldGracefullyDegrade: React.Dispatch<React.SetStateAction<boolean>>\n apiUrl: string\n readonly: boolean\n debug: boolean\n flowDataOverrides?: { [key: string]: string }\n disableImagePreloading: boolean\n}\n\nexport interface FrigadeProviderProps {\n publicApiKey: string\n /**\n * The user id of the user that is currently logged in.\n */\n userId?: string\n /**\n * The organization id of the organization that is currently logged in.\n */\n organizationId?: string\n config?: FrigadeConfig\n children?: React.ReactNode\n}\n\nconst DEFAULT_API_URL = 'https://api.frigade.com'\nexport const FrigadeContext = createContext<IFrigadeContext>({\n publicApiKey: '',\n setUserId: () => {},\n flows: [],\n setFlows: () => {},\n failedFlowResponses: [],\n setFailedFlowResponses: () => {},\n flowResponses: [],\n setFlowResponses: () => {},\n userProperties: {},\n setUserProperties: () => {},\n openFlowStates: {},\n setOpenFlowStates: () => {},\n completedFlowsToKeepOpenDuringSession: [],\n setCompletedFlowsToKeepOpenDuringSession: () => {},\n customVariables: {},\n setCustomVariables: () => {},\n isNewGuestUser: false,\n setIsNewGuestUser: () => {},\n hasActiveFullPageFlow: false,\n setHasActiveFullPageFlow: () => {},\n organizationId: '',\n setOrganizationId: () => {},\n navigate: () => {},\n defaultAppearance: DefaultAppearance,\n shouldGracefullyDegrade: false,\n setShouldGracefullyDegrade: () => {},\n apiUrl: DEFAULT_API_URL,\n readonly: false,\n debug: false,\n disableImagePreloading: false,\n})\n\ninterface FrigadeConfig {\n /**\n * Override the default router used by Frigade.\n * This is useful if you are using a router and want to avoid doing a full page refresh on navigation.\n * @param url The url to navigate to.\n */\n navigate?: (url: string, target: string) => void\n /**\n * Default Appearance for all flows.\n */\n defaultAppearance?: Appearance\n /**\n * API url to use for all requests. Defaults to https://api.frigade.com\n */\n apiUrl?: string\n /**\n * When true, Frigade will be in read-only mode and state will not be updated. Default false.\n * Used mostly for demo purposes.\n */\n readonly?: boolean\n\n theme?: Record<string, any>\n /**\n * Flag to turn on debug mode which will log all events to the console. Default false.\n * Default false.\n */\n debug?: boolean\n /**\n * Flag to disable preloading images. Default false.\n */\n disableImagePreloading?: boolean\n\n /**\n * @ignore\n */\n __internal__?: { [key: string]: string }\n}\n\nfunction clearLocalStorage() {\n Object.keys(localStorage).forEach((key) => {\n if (key.startsWith('frigade-')) {\n localStorage.removeItem(key)\n }\n })\n}\n\nexport const FrigadeProvider: FC<FrigadeProviderProps> = ({\n publicApiKey,\n userId,\n organizationId,\n config,\n children,\n}) => {\n const guestId = typeof window !== 'undefined' ? localStorage.getItem(guestUserIdField) : null\n const [userIdValue, setUserIdValue] = useState<string | null>(!userId ? guestId : userId)\n const [organizationIdValue, setOrganizationIdValue] = useState<string | null>(\n !organizationId ? null : organizationId\n )\n const [flows, setFlows] = useState<Flow[]>([])\n const [failedFlowResponses, setFailedFlowResponses] = useState<FlowResponse[]>([])\n const [flowResponses, setFlowResponses] = useState<FlowResponse[]>([])\n const [userProperties, setUserProperties] = useState<{\n [key: string]: string | boolean | number | null\n }>({})\n const [openFlowStates, setOpenFlowStates] = useState<{ [key: string]: boolean }>({})\n const [completedFlowsToKeepOpenDuringSession, setCompletedFlowsToKeepOpenDuringSession] =\n useState<string[]>([])\n const [customVariables, setCustomVariables] = useState<{\n [key: string]: string | boolean | number | null\n }>({})\n const [isNewGuestUser, setIsNewGuestUser] = useState(false)\n const [hasActiveFullPageFlow, setHasActiveFullPageFlow] = useState(false)\n const [shouldGracefullyDegrade, setShouldGracefullyDegrade] = useState(\n !isValidApiKey(publicApiKey)\n )\n const internalNavigate = (url: string, target: string) => {\n if (target === '_blank') {\n window.open(url, '_blank')\n return\n }\n setTimeout(() => {\n window.location.href = url\n }, 50)\n }\n\n const appearance: Appearance = {\n theme: { ...DefaultAppearance.theme, ...(config?.defaultAppearance?.theme ?? {}) },\n styleOverrides: {\n ...DefaultAppearance.styleOverrides,\n ...(config?.defaultAppearance?.styleOverrides ?? {}),\n },\n }\n\n function isValidApiKey(apiKey: string): boolean {\n return Boolean(apiKey && apiKey.length > 10 && apiKey.substring(0, 10) === 'api_public')\n }\n\n useEffect(() => {\n if (userId) {\n setUserIdValue(userId)\n }\n }, [userId])\n\n useEffect(() => {\n if (userIdValue) {\n if (\n typeof window !== 'undefined' &&\n window.localStorage &&\n window.localStorage.getItem(realUserIdField)\n ) {\n if (window.localStorage.getItem(realUserIdField) !== userIdValue) {\n clearLocalStorage()\n }\n }\n }\n }, [userIdValue])\n\n useEffect(() => {\n if (organizationId) {\n setOrganizationIdValue(organizationId)\n }\n }, [organizationId])\n\n useEffect(() => {\n if (!isValidApiKey(publicApiKey)) {\n console.error(\n 'Frigade SDK failed to initialize. API key provided is either missing or invalid.'\n )\n setShouldGracefullyDegrade(true)\n return\n } else {\n setShouldGracefullyDegrade(false)\n }\n }, [publicApiKey, setShouldGracefullyDegrade])\n\n const contextParams = {\n publicApiKey,\n userId: userIdValue,\n setUserId: setUserIdValue,\n setFlows,\n flows: flows,\n failedFlowResponses,\n setFailedFlowResponses,\n flowResponses,\n setFlowResponses,\n userProperties,\n setUserProperties,\n openFlowStates,\n setOpenFlowStates,\n completedFlowsToKeepOpenDuringSession,\n setCompletedFlowsToKeepOpenDuringSession,\n customVariables,\n setCustomVariables,\n isNewGuestUser,\n setIsNewGuestUser,\n hasActiveFullPageFlow,\n setHasActiveFullPageFlow,\n organizationId: organizationIdValue,\n setOrganizationId: setOrganizationIdValue,\n navigate: config && config.navigate ? config.navigate : internalNavigate,\n defaultAppearance: appearance,\n shouldGracefullyDegrade,\n setShouldGracefullyDegrade,\n apiUrl: config && config.apiUrl ? config.apiUrl : DEFAULT_API_URL,\n readonly: config && config.readonly ? config.readonly : false,\n debug: config && config.debug ? config.debug : false,\n flowDataOverrides: config && config.__internal__ ? config.__internal__ : undefined,\n disableImagePreloading:\n config && config.disableImagePreloading ? config.disableImagePreloading : false,\n } as IFrigadeContext\n\n // Forward-port appearance.theme into theme tokens\n const { overrides } = appearanceToOverrides(appearance)\n\n if (shouldGracefullyDegrade) {\n return (\n <FrigadeContext.Provider value={contextParams}>\n <ThemeProvider\n theme={deepmerge(appearance.theme, tokens, overrides ?? {}, config?.theme ?? {})}\n >\n {children}\n </ThemeProvider>\n </FrigadeContext.Provider>\n )\n }\n\n return (\n <FrigadeContext.Provider value={contextParams}>\n {/* TEMP: Merge old appearance.theme vars in for backwards compatibility */}\n <ThemeProvider\n theme={deepmerge(appearance.theme, tokens, overrides ?? {}, config?.theme ?? {})}\n >\n {children}\n <DataFetcher />\n </ThemeProvider>\n </FrigadeContext.Provider>\n )\n}\n","import React, { FC, useContext, useEffect, useState } from 'react'\nimport { Flow, FlowType, TriggerType, useFlows } from '../../api/flows'\nimport { FrigadeContext } from '../../FrigadeProvider'\nimport { GUEST_PREFIX, useUser } from '../../api/users'\nimport { v4 as uuidv4 } from 'uuid'\nimport { useFlowResponses } from '../../api/flow-responses'\nimport { useUserFlowStates } from '../../api/user-flow-states'\nimport FrigadeForm from '../../FrigadeForm'\nimport { NOT_STARTED_FLOW } from '../../api/common'\nimport { useOrganization } from '../../api/organizations'\n\ninterface DataFetcherProps {}\n\nexport const guestUserIdField = 'frigade-xFrigade_guestUserId'\nexport const realUserIdField = 'frigade-xFrigade_userId'\n\nexport const DataFetcher: FC<DataFetcherProps> = ({}) => {\n const { setFlowResponses } = useFlowResponses()\n const { userFlowStatesData, isLoadingUserFlowStateData, mutateUserFlowState } =\n useUserFlowStates()\n const { userId, setUserId } = useUser()\n const [lastUserId, setLastUserId] = useState<string | null>(userId)\n const { getFlowStatus } = useFlows()\n const { flows, userProperties, setIsNewGuestUser, flowResponses, disableImagePreloading } =\n useContext(FrigadeContext)\n const [automaticFlowIdsToTrigger, setAutomaticFlowIdsToTrigger] = useState<Flow[]>([])\n // Add list of flows already triggered\n const [triggeredFlows, setTriggeredFlows] = useState<string[]>([])\n const { organizationId } = useOrganization()\n const [lastOrganizationId, setLastOrganizationId] = useState<string | null>(organizationId)\n const [hasFinishedInitialLoad, setHasFinishedInitialLoad] = useState(false)\n\n useEffect(() => {\n if (!isLoadingUserFlowStateData) {\n if (userFlowStatesData) {\n for (let i = 0; i < userFlowStatesData.length; i++) {\n const flowState = userFlowStatesData[i]\n const flow = flows.find((flow) => flow.slug === flowState?.flowId)\n if (\n flow &&\n flowState &&\n flowState.shouldTrigger === true &&\n flow.type == FlowType.FORM &&\n flow.triggerType === TriggerType.AUTOMATIC &&\n !triggeredFlows.includes(flow.slug)\n ) {\n // If the flow should be triggered, trigger it\n // Give a small grace period before triggering the flow\n setTimeout(() => {\n triggerFlow(flowState.flowId)\n }, 500)\n\n // We only want to trigger one at a time\n break\n }\n }\n }\n }\n }, [isLoadingUserFlowStateData, userFlowStatesData])\n\n useEffect(() => {\n if (flowResponses.length > 0) {\n mutateUserFlowState()\n }\n }, [flowResponses])\n\n useEffect(() => {\n if (!hasFinishedInitialLoad) {\n setHasFinishedInitialLoad(true)\n mutateUserFlowState()\n }\n }, [isLoadingUserFlowStateData, setHasFinishedInitialLoad])\n\n function triggerFlow(flowId: string) {\n const flow = flows.find((flow) => flow.slug === flowId)\n if (flow && flow.triggerType === TriggerType.AUTOMATIC && !triggeredFlows.includes(flow.slug)) {\n // We only trigger one at a time\n setTriggeredFlows([...triggeredFlows, flow.slug])\n setAutomaticFlowIdsToTrigger([flow])\n }\n }\n\n function generateGuestUserId() {\n // If userId is null, generate a guest user id using uuid\n if (!userId) {\n // Check if a real user id exists in local storage\n const realUserId = localStorage.getItem(realUserIdField)\n if (realUserId) {\n setUserId(realUserId)\n return\n }\n\n // Call local storage to see if we already have a guest user id\n const guestUserId = localStorage.getItem(guestUserIdField)\n if (guestUserId) {\n setUserId(guestUserId)\n return\n }\n\n // If we don't have a guest user id, generate one and save it to local storage\n setIsNewGuestUser(true)\n const newGuestUserId = GUEST_PREFIX + uuidv4()\n try {\n localStorage.setItem(guestUserIdField, newGuestUserId)\n } catch (e) {\n console.log('Failed to save guest user id locally: Local storage unavailable', e)\n }\n setUserId((userId) => (userId ? userId : newGuestUserId))\n }\n }\n\n useEffect(() => {\n try {\n // Parse all image urls from flows (contained in flow.data) and asynchronously load them\n if (!disableImagePreloading && flows) {\n const loadedImageUrls: string[] = []\n flows.forEach((flow) => {\n if (flow.data && flow.active) {\n // Find all image urls in flow data. All image urls are in the json data as \"imageUri\" fields\n const imageUrls = flow.data.match(/\"imageUri\":\"(.*?)\"/g)\n if (imageUrls) {\n imageUrls.forEach((imageUrl) => {\n // Remove the \"imageUri\" and \" from the url\n const url = imageUrl.replace('\"imageUri\":\"', '').replace('\"', '')\n // If the url has already been loaded, skip it\n if (loadedImageUrls.includes(url)) {\n return\n }\n // Create an image element and set the src to the url\n const img = new Image()\n img.src = url\n loadedImageUrls.push(url)\n })\n }\n }\n })\n }\n } catch (e) {}\n }, [flows])\n\n useEffect(() => {\n if (userId !== lastUserId) {\n // Reset responses\n setFlowResponses([])\n mutateUserFlowState()\n }\n\n setLastUserId(userId)\n // if user id isn't null and doesn't begin with GUEST_PREFIX , save it to local storage\n if (userId && !userId.startsWith(GUEST_PREFIX)) {\n try {\n localStorage.setItem(realUserIdField, userId)\n } catch (e) {\n console.log('Failed to save user id locally: Local storage available', e)\n }\n }\n // If the user ID is null, give a grace period of 50ms to set the real user id\n if (userId === null) {\n setTimeout(() => {\n if (userId === null) {\n generateGuestUserId()\n }\n }, 50)\n }\n }, [userId, flows, userProperties])\n\n useEffect(() => {\n if (organizationId != lastOrganizationId) {\n setLastOrganizationId(organizationId)\n setFlowResponses([])\n mutateUserFlowState()\n }\n }, [organizationId, lastOrganizationId, setLastOrganizationId])\n\n function AutomaticFlowIdsToTrigger() {\n return (\n <>\n {automaticFlowIdsToTrigger.map((flow) => {\n if (getFlowStatus(flow.slug) !== NOT_STARTED_FLOW) {\n return null\n }\n\n return (\n <span key={flow.slug}>\n <FrigadeForm\n flowId={flow.slug}\n type={'modal'}\n modalPosition={'center'}\n endFlowOnDismiss={true}\n />\n </span>\n )\n })}\n </>\n )\n }\n\n return (\n <>\n <AutomaticFlowIdsToTrigger />\n </>\n )\n}\n","import { useCallback, useContext, useEffect } from 'react'\nimport {\n COMPLETED_FLOW,\n COMPLETED_STEP,\n fetchRetry,\n NOT_STARTED_FLOW,\n NOT_STARTED_STEP,\n SKIPPED_FLOW,\n STARTED_FLOW,\n STARTED_STEP,\n StepActionType,\n useCheckHasInitiatedAPI,\n useConfig,\n} from './common'\n\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { FlowResponse, useFlowResponses } from './flow-responses'\nimport useSWR from 'swr'\nimport { useUserFlowStates } from './user-flow-states'\nimport { StepData } from '../types'\nimport { getSubFlowFromCompletionCriteria } from '../shared/completion-util'\nimport { safeParse } from '../shared/parse'\n\nexport interface Flow {\n id: number\n name: string\n description: string\n data: string\n createdAt: string\n modifiedAt: string\n slug: string\n type: FlowType\n triggerType: TriggerType\n targetingLogic?: string\n active: boolean\n}\n\nexport enum FlowType {\n CHECKLIST = 'CHECKLIST',\n FORM = 'FORM',\n TOUR = 'TOUR',\n SUPPORT = 'SUPPORT',\n CUSTOM = 'CUSTOM',\n BANNER = 'BANNER',\n EMBEDDED_TIP = 'EMBEDDED_TIP',\n NPS_SURVEY = 'NPS_SURVEY',\n ANNOUNCEMENT = 'ANNOUNCEMENT',\n}\n\nexport enum TriggerType {\n MANUAL = 'MANUAL',\n AUTOMATIC = 'AUTOMATIC',\n}\n\nexport function useFlows() {\n const { config, apiUrl } = useConfig()\n const {\n flows,\n setFlows,\n userId,\n organizationId,\n publicApiKey,\n customVariables,\n setCustomVariables,\n hasActiveFullPageFlow,\n setHasActiveFullPageFlow,\n setFlowResponses,\n setShouldGracefullyDegrade,\n shouldGracefullyDegrade,\n readonly,\n flowDataOverrides,\n debug,\n } = useContext(FrigadeContext)\n\n const emptyResponse = {\n data: [],\n }\n const { verifySDKInitiated } = useCheckHasInitiatedAPI()\n const { addResponse, getFlowResponses } = useFlowResponses()\n const fetcher = (url) =>\n fetchRetry(url, 100, 2, config)\n .then((response) => {\n if (response.ok) {\n return response.json()\n }\n console.log(\n `Error fetching ${url} (${response.status}): ${response.statusText}. Will gracefully degrade and hide Frigade`\n )\n setShouldGracefullyDegrade(true)\n return emptyResponse\n })\n .catch((error) => {\n console.log(`Error fetching ${url}: ${error}. Will gracefully degrade and hide Frigade`)\n setShouldGracefullyDegrade(true)\n return emptyResponse\n })\n const {\n mutateUserFlowState,\n userFlowStatesData,\n isLoadingUserFlowStateData,\n optimisticallyMarkFlowCompleted,\n optimisticallyMarkFlowSkipped,\n optimisticallyMarkFlowNotStarted,\n optimisticallyMarkStepCompleted,\n optimisticallyMarkStepNotStarted,\n optimisticallyMarkStepStarted,\n } = useUserFlowStates()\n\n const {\n data: flowData,\n error,\n isLoading: isLoadingFlows,\n } = useSWR(publicApiKey ? `${apiUrl}flows${readonly ? `?readonly=true` : ''}` : null, fetcher, {\n keepPreviousData: true,\n })\n\n useEffect(() => {\n if (error) {\n console.error(error)\n return\n }\n if (flowData && flowData.data) {\n setFlows(flowData.data)\n }\n }, [flowData, error])\n\n function getFlow(flowId: string): Flow {\n if (isLoadingFlows) {\n return null\n }\n const flow = flows.find((f) => f.slug === flowId)\n if (!flow && flows.length > 0 && !isLoadingUserFlowStateData && !isLoadingFlows) {\n if (debug) {\n console.log(`Flow with id ${flowId} not found`)\n }\n return null\n }\n if (flow && flowDataOverrides && flowDataOverrides[flowId]) {\n flow.data = flowDataOverrides[flowId]\n }\n if (flow?.active === false && !readonly) {\n return null\n }\n return flow\n }\n\n function getFlowSteps(flowId: string): StepData[] {\n if (!getFlow(flowId)) {\n return []\n }\n let flowData = getFlow(flowId)?.data\n if (!flowData) {\n return []\n }\n\n flowData = substituteVariables(flowData)\n\n const steps = safeParse<any>(flowData)?.data ?? safeParse<any>(flowData)?.steps ?? []\n\n return steps\n .map((step: StepData) => {\n const autoCalculatedProgress = getStepOptionalProgress(step)\n let returnData = {\n handleSecondaryButtonClick: () => {\n if (step.skippable === true) {\n markStepCompleted(flowId, step.id, { skipped: true })\n }\n },\n ...step,\n complete:\n getStepStatus(flowId, step.id) === COMPLETED_STEP || autoCalculatedProgress >= 1,\n started:\n getStepStatus(flowId, step.id) === STARTED_STEP ||\n getStepStatus(flowId, step.id) === COMPLETED_STEP,\n currentlyActive: userFlowStatesData?.some(\n (data) => data.flowId == flowId && data.lastStepId === step.id\n ),\n blocked: isStepBlocked(flowId, step.id),\n hidden: isStepHidden(flowId, step.id),\n handlePrimaryButtonClick: () => {\n if (\n (!step.completionCriteria &&\n (step.autoMarkCompleted || step.autoMarkCompleted === undefined)) ||\n (step.completionCriteria && step.autoMarkCompleted === true)\n ) {\n markStepCompleted(flowId, step.id)\n }\n },\n progress: autoCalculatedProgress,\n }\n\n if (step.primaryButton && step.primaryButton.title) {\n returnData = {\n ...returnData,\n primaryButtonTitle: step.primaryButton.title,\n }\n }\n if (step.primaryButton && step.primaryButton.uri) {\n returnData = {\n ...returnData,\n primaryButtonUri: step.primaryButton.uri,\n }\n }\n if (step.primaryButton && step.primaryButton.target) {\n returnData = {\n ...returnData,\n primaryButtonUriTarget: step.primaryButton.target,\n }\n }\n\n if (step.secondaryButton && step.secondaryButton.title) {\n returnData = {\n ...returnData,\n secondaryButtonTitle: step.secondaryButton.title,\n }\n }\n if (step.secondaryButton && step.secondaryButton.uri) {\n returnData = {\n ...returnData,\n secondaryButtonUri: step.secondaryButton.uri,\n }\n }\n if (step.secondaryButton && step.secondaryButton.target) {\n returnData = {\n ...returnData,\n secondaryButtonUriTarget: step.secondaryButton.target,\n }\n }\n\n return returnData\n })\n .filter((step: StepData) => !(step.hidden === true))\n }\n\n function substituteVariables(flowData: string) {\n try {\n return flowData.replaceAll(/\\${(.*?)}/g, (_, variableName) => {\n if (customVariables[variableName] === undefined) {\n return ''\n }\n\n return String(customVariables[variableName])\n .replace(/[\\u00A0-\\u9999<>\\&]/g, function (i) {\n return '&#' + i.charCodeAt(0) + ';'\n })\n .replaceAll(/[\\\\]/g, '\\\\\\\\')\n .replaceAll(/[\\\"]/g, '\\\\\"')\n .replaceAll(/[\\/]/g, '\\\\/')\n .replaceAll(/[\\b]/g, '\\\\b')\n .replaceAll(/[\\f]/g, '\\\\f')\n .replaceAll(/[\\n]/g, '\\\\n')\n .replaceAll(/[\\r]/g, '\\\\r')\n .replaceAll(/[\\t]/g, '\\\\t')\n })\n } catch (e) {\n console.debug('Error substituting variables', e)\n return flowData\n }\n }\n\n /**\n * Get high-level props for a flow such as title and subtitle\n * @param slug\n */\n function getFlowMetadata(slug: string): any {\n if (!getFlow(slug)) {\n return []\n }\n let flowData = getFlow(slug).data\n if (!flowData) {\n return []\n }\n\n flowData = substituteVariables(flowData)\n\n return JSON.parse(flowData) ?? {}\n }\n\n function setCustomVariable(key: string, value: string | number | boolean) {\n setCustomVariables((prev) => ({ ...prev, [key]: value }))\n }\n\n function updateCustomVariables(newCustomVariables?: {\n [key: string]: string | number | boolean\n }) {\n if (\n !isLoadingUserFlowStateData &&\n !isLoadingFlows &&\n newCustomVariables &&\n JSON.stringify(customVariables) !=\n JSON.stringify({ ...customVariables, ...newCustomVariables })\n ) {\n Object.keys(newCustomVariables).forEach((key) => {\n setCustomVariable(key, newCustomVariables[key])\n })\n }\n }\n\n const markStepStarted = useCallback(\n async (flowId: string, stepId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId,\n actionType: STARTED_STEP,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n\n await optimisticallyMarkStepStarted(flowId, stepId, flowResponse)\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n const markStepNotStarted = useCallback(\n async (flowId: string, stepId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId,\n actionType: NOT_STARTED_STEP,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n await optimisticallyMarkStepNotStarted(flowId, stepId, flowResponse)\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n const markStepCompleted = useCallback(\n async (flowId: string, stepId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId,\n actionType: COMPLETED_STEP,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n await optimisticallyMarkStepCompleted(flowId, stepId, flowResponse)\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n const markFlowNotStarted = useCallback(\n async (flowId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n if (getFlowStatus(flowId) === NOT_STARTED_FLOW) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId: 'unknown',\n actionType: NOT_STARTED_FLOW,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n\n await optimisticallyMarkFlowNotStarted(flowId)\n\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n const markFlowStarted = useCallback(\n async (flowId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId: 'unknown',\n actionType: STARTED_FLOW,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n const markFlowCompleted = useCallback(\n async (flowId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId: 'unknown',\n actionType: COMPLETED_FLOW,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n\n await optimisticallyMarkFlowCompleted(flowId)\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n const markFlowSkipped = useCallback(\n async (flowId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId: 'unknown',\n actionType: SKIPPED_FLOW,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n await optimisticallyMarkFlowSkipped(flowId)\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n function shouldSendServerSideCall(flowResponse: FlowResponse) {\n if (userFlowStatesData === undefined) {\n return false\n }\n if (userFlowStatesData) {\n const flowState = userFlowStatesData.find((state) => state.flowId === flowResponse.flowSlug)\n\n if (\n flowResponse.actionType === NOT_STARTED_STEP &&\n (!flowState?.stepStates[flowResponse.stepId] ||\n flowState.stepStates[flowResponse.stepId].actionType === NOT_STARTED_STEP)\n ) {\n return false\n }\n if (\n flowState &&\n flowState.stepStates[flowResponse.stepId]?.actionType === flowResponse.actionType\n ) {\n if (\n flowResponse.actionType === COMPLETED_STEP &&\n (!flowResponse.data || JSON.stringify(flowResponse.data) === JSON.stringify({}))\n ) {\n return false\n }\n // Sort flowState.stepDates by createdAt date\n const sortedStepStates = Object.keys(flowState.stepStates).sort((a, b) => {\n const aDate = new Date(flowState.stepStates[a].createdAt)\n const bDate = new Date(flowState.stepStates[b].createdAt)\n return aDate.getTime() - bDate.getTime()\n })\n\n // Only return false if the newest stepState is the same as the flowResponse\n if (\n flowState.stepStates[sortedStepStates[sortedStepStates.length - 1]].actionType ===\n flowResponse.actionType &&\n flowResponse.stepId === sortedStepStates[sortedStepStates.length - 1]\n ) {\n return false\n }\n }\n if (\n flowState &&\n flowState.flowState === COMPLETED_FLOW &&\n flowResponse.actionType === COMPLETED_FLOW\n ) {\n return false\n }\n }\n\n return true\n }\n\n function getStepStatus(flowId: string, stepId: string): StepActionType | null {\n const maybeFlowResponse = getStepStateForFlow(flowId, stepId)\n\n if (isLoadingUserFlowStateData) {\n return null\n }\n\n return (maybeFlowResponse ? maybeFlowResponse.actionType : NOT_STARTED_STEP) as StepActionType\n }\n\n function isStepBlocked(flowId: string, stepId: string): boolean {\n const maybeFlowResponse = getStepStateForFlow(flowId, stepId)\n\n if (!maybeFlowResponse) {\n return false\n }\n\n return maybeFlowResponse.blocked\n }\n\n function isStepHidden(flowId: string, stepId: string): boolean {\n const maybeFlowResponse = getStepStateForFlow(flowId, stepId)\n\n if (!maybeFlowResponse) {\n return false\n }\n\n return maybeFlowResponse.hidden\n }\n\n function getStepStateForFlow(flowId: string, stepId: string): FlowResponse | null {\n if (isLoadingUserFlowStateData) {\n return null\n }\n\n const flowState = userFlowStatesData?.find((state) => state.flowId === flowId)\n if (!flowState || !flowState.stepStates[stepId]) {\n return null\n }\n\n return flowState.stepStates[stepId] ?? null\n }\n\n function getCurrentStep(flowId: string): StepData | null {\n if (isLoadingUserFlowStateData || !userFlowStatesData) {\n return null\n }\n if (getFlowStatus(flowId) === NOT_STARTED_FLOW) {\n return getFlowSteps(flowId)[0] ?? null\n }\n\n const lastStep = userFlowStatesData.find((f) => f.flowId === flowId)?.lastStepId\n if (lastStep) {\n return getFlowSteps(flowId).find((s) => s.id === lastStep)\n }\n return null\n }\n\n function getCurrentStepIndex(flowId: string): number {\n const currentStep = getCurrentStep(flowId)\n if (!currentStep) {\n return 0\n }\n const index = getFlowSteps(flowId).findIndex((s) => s.id === currentStep.id) ?? 0\n if (\n getStepStatus(flowId, currentStep.id) === COMPLETED_STEP &&\n index < getFlowSteps(flowId).length - 1\n ) {\n return index + 1\n }\n return index\n }\n\n function getStepOptionalProgress(step: StepData) {\n if (!step.completionCriteria) return undefined\n\n const stepSubFlowSlug = getSubFlowFromCompletionCriteria(step.completionCriteria)\n if (stepSubFlowSlug === null) return undefined\n\n const completed = getNumberOfStepsCompleted(stepSubFlowSlug)\n const total = getNumberOfSteps(stepSubFlowSlug)\n\n return total === 0 ? undefined : completed / total\n }\n\n function getFlowStatus(flowId: string) {\n const userFlowState = userFlowStatesData?.find((f) => f.flowId === flowId)\n if (!userFlowState) {\n return null\n }\n return userFlowState.flowState\n }\n\n function getNumberOfStepsCompleted(flowId: string): number {\n const steps = getFlowSteps(flowId)\n if (steps.length === 0) {\n return 0\n }\n\n const completedSteps = steps.filter((s) => getStepStatus(flowId, s.id) === COMPLETED_STEP)\n\n return completedSteps.length\n }\n\n function getNumberOfSteps(flowId: string) {\n return getFlowSteps(flowId).length\n }\n\n /**\n * Generic method for getting the raw Flow data as a Javascript object.\n * For typescript, pass in T to get the correct type.\n * @param flowId\n */\n function getFlowData<T>(flowId: string): T | null {\n const maybeFlow = flows.find((f) => f.slug === flowId)\n if (!maybeFlow) {\n return null\n }\n if (flowDataOverrides && flowDataOverrides[flowId]) {\n maybeFlow.data = flowDataOverrides[flowId]\n }\n return safeParse<T>(maybeFlow.data)\n }\n\n function targetingLogicShouldHideFlow(flow: Flow) {\n if (readonly) {\n return false\n }\n if (isLoadingUserFlowStateData) {\n return true\n }\n if (shouldGracefullyDegrade) {\n return true\n }\n if (flow?.targetingLogic && userFlowStatesData) {\n // Iterate through matching userFlowState for the flow and if shouldTrigger is true, return false\n const matchingUserFlowState = userFlowStatesData.find((ufs) => ufs.flowId === flow.slug)\n if (matchingUserFlowState) {\n return matchingUserFlowState.shouldTrigger === false\n }\n }\n if (flow?.targetingLogic && userId && userId.startsWith('guest_')) {\n return true\n }\n\n return false\n }\n\n function isFlowAvailableToUser(flowId: string) {\n const flow = getFlow(flowId)\n if (!flow) {\n return false\n }\n if (flow.active === false) {\n return false\n }\n return !targetingLogicShouldHideFlow(getFlow(flowId))\n }\n\n function refresh() {\n if (userId) {\n mutateUserFlowState()\n }\n }\n\n function getAllFlows() {\n return flows\n }\n\n return {\n getAllFlows,\n getFlow,\n getFlowData,\n isLoading: isLoadingUserFlowStateData || isLoadingFlows,\n getStepStatus,\n getFlowSteps,\n getCurrentStepIndex,\n markStepStarted,\n markStepCompleted,\n markFlowNotStarted,\n markFlowStarted,\n markFlowCompleted,\n markFlowSkipped,\n markStepNotStarted,\n getFlowStatus,\n getNumberOfStepsCompleted,\n getNumberOfSteps,\n targetingLogicShouldHideFlow,\n setCustomVariable,\n updateCustomVariables,\n customVariables,\n getStepOptionalProgress,\n getFlowMetadata,\n isStepBlocked,\n isStepHidden,\n hasActiveFullPageFlow,\n setHasActiveFullPageFlow,\n isFlowAvailableToUser,\n refresh,\n isDegraded: shouldGracefullyDegrade,\n }\n}\n","import React, { useMemo } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { VERSION_NUMBER } from './version'\n\nexport const NOT_STARTED_STEP = 'NOT_STARTED_STEP'\nexport const COMPLETED_FLOW = 'COMPLETED_FLOW'\nexport const SKIPPED_FLOW = 'SKIPPED_FLOW'\nexport const STARTED_FLOW = 'STARTED_FLOW'\nexport const NOT_STARTED_FLOW = 'NOT_STARTED_FLOW'\nexport const COMPLETED_STEP = 'COMPLETED_STEP'\nexport const STARTED_STEP = 'STARTED_STEP'\n// Define a string type that is either STARTED_STEP or COMPLETED_STEP\nexport type StepActionType = 'STARTED_STEP' | 'COMPLETED_STEP' | 'NOT_STARTED_STEP'\n\nexport function useConfig() {\n const { publicApiKey, userId, apiUrl } = React.useContext(FrigadeContext)\n\n return {\n config: useMemo(\n () => ({\n headers: {\n Authorization: `Bearer ${publicApiKey}`,\n 'Content-Type': 'application/json',\n 'X-Frigade-SDK-Version': VERSION_NUMBER,\n 'X-Frigade-SDK-Platform': 'React',\n },\n }),\n [publicApiKey, userId]\n ),\n apiUrl: useMemo(() => `${apiUrl}/v1/public/`, [apiUrl]),\n }\n}\n\nconst LAST_POST_CALL_AT = 'frigade-last-call-at-'\nconst LAST_POST_CALL_DATA = 'frigade-last-call-data-'\nexport function useGracefulFetch() {\n const { shouldGracefullyDegrade, readonly } = React.useContext(FrigadeContext)\n\n return async (url: string, options: any) => {\n if (\n readonly &&\n (options.method === 'POST' || options.method === 'PUT' || options.method === 'DELETE')\n ) {\n return getEmptyResponse()\n }\n if (shouldGracefullyDegrade) {\n console.log(`Skipping ${url} call to Frigade due to error`)\n return getEmptyResponse()\n }\n const lastCallAtKey = LAST_POST_CALL_AT + url\n const lastCallDataKey = LAST_POST_CALL_DATA + url\n if (\n typeof window !== 'undefined' &&\n window.localStorage &&\n options &&\n options.body &&\n options.method === 'POST'\n ) {\n const lastCall = window.localStorage.getItem(lastCallAtKey)\n const lastCallData = window.localStorage.getItem(lastCallDataKey)\n if (lastCall && lastCallData && lastCallData == options.body) {\n const lastCallDate = new Date(lastCall)\n const now = new Date()\n const diff = now.getTime() - lastCallDate.getTime()\n // Throttle consecutive POST calls to 1 second\n if (diff < 1000) {\n return getEmptyResponse()\n }\n }\n if (typeof window !== 'undefined') {\n window.localStorage.setItem(lastCallAtKey, new Date().toISOString())\n window.localStorage.setItem(lastCallDataKey, options.body)\n }\n }\n\n let response\n try {\n response = await fetch(url, options)\n } catch (error) {\n return getEmptyResponse(error)\n }\n\n if (!response) {\n return getEmptyResponse()\n }\n\n if (!response.ok) {\n return getEmptyResponse(response.statusText)\n }\n\n return response\n }\n}\n\nfunction getEmptyResponse(error?: any) {\n if (error) {\n console.log('Call to Frigade failed', error)\n }\n\n // Create empty response that contains the .json method and returns an empty object\n return {\n json: () => ({}),\n }\n}\n\nexport interface PaginatedResult<T> {\n data: T[]\n offset: number\n limit: number\n}\n\nexport function useCheckHasInitiatedAPI() {\n const { publicApiKey, shouldGracefullyDegrade } = React.useContext(FrigadeContext)\n\n function verifySDKInitiated() {\n if (shouldGracefullyDegrade) {\n return false\n }\n if (!publicApiKey) {\n console.error('Frigade hooks cannot be used outside the scope of FrigadeProvider')\n return false\n }\n return true\n }\n\n return {\n verifySDKInitiated,\n }\n}\n\nfunction wait(delay: number) {\n return new Promise((resolve) => setTimeout(resolve, delay))\n}\n\nexport function fetchRetry(url: string, delayMS: number, tries: number, fetchOptions = {}) {\n function onError(err) {\n let triesLeft = tries - 1\n if (!triesLeft) {\n throw err\n }\n return wait(delayMS).then(() => fetchRetry(url, delayMS, triesLeft, fetchOptions))\n }\n return fetch(url, fetchOptions).catch(onError)\n}\n","export const VERSION_NUMBER = '1.38.11'\n","import { useContext, useState } from 'react'\nimport {\n COMPLETED_FLOW,\n COMPLETED_STEP,\n NOT_STARTED_FLOW,\n NOT_STARTED_STEP,\n SKIPPED_FLOW,\n STARTED_FLOW,\n STARTED_STEP,\n useConfig,\n useGracefulFetch,\n} from './common'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { useUserFlowStates } from './user-flow-states'\n\nexport interface FlowResponse {\n foreignUserId: string\n foreignUserGroupId?: string\n flowSlug: string\n stepId: string\n actionType: string\n data: object\n createdAt: Date\n blocked: boolean\n hidden: boolean\n}\n\nexport interface PublicStepState {\n stepId: string\n actionType: 'COMPLETED_STEP' | 'STARTED_STEP' | 'NOT_STARTED_STEP'\n blocked: boolean\n hidden: boolean\n createdAt: Date\n}\n\nexport function useFlowResponses() {\n const { config, apiUrl } = useConfig()\n const { userFlowStatesData, mutateUserFlowState } = useUserFlowStates()\n const { failedFlowResponses, setFailedFlowResponses, flowResponses, setFlowResponses } =\n useContext(FrigadeContext)\n const [successfulFlowResponsesStrings, setSuccessfulFlowResponsesStrings] = useState<Set<String>>(\n new Set()\n )\n const [successfulFlowResponses, setSuccessfulFlowResponses] = useState<Set<FlowResponse>>(\n new Set()\n )\n\n const gracefullyFetch = useGracefulFetch()\n\n function postFlowResponse(flowResponse: FlowResponse) {\n const flowResponseString = JSON.stringify(flowResponse)\n\n if (successfulFlowResponsesStrings.has(flowResponseString)) {\n return null\n }\n // For steps that are already in the same state, do not update the API.\n successfulFlowResponsesStrings.add(flowResponseString)\n setSuccessfulFlowResponsesStrings(successfulFlowResponsesStrings)\n successfulFlowResponses.add(flowResponse)\n setSuccessfulFlowResponses(successfulFlowResponses)\n // Only update flow responses if there is not already an entry for this step.\n // Check for flow id, step id, and action type, and date\n const existingFlowResponse = flowResponses?.find(\n (r) =>\n r.flowSlug === flowResponse.flowSlug &&\n r.stepId === flowResponse.stepId &&\n r.actionType === flowResponse.actionType &&\n r.createdAt === flowResponse.createdAt\n )\n\n return gracefullyFetch(`${apiUrl}flowResponses`, {\n ...config,\n method: 'POST',\n body: flowResponseString,\n }).then((r) => {\n if (r.status !== 200 && r.status !== 201) {\n console.log(\n 'Failed to send flow response for step ' +\n flowResponse.stepId +\n '. Will retry again later.'\n )\n setFailedFlowResponses([...failedFlowResponses, flowResponse])\n } else {\n if (!existingFlowResponse) {\n setFlowResponses((prev) => [...(prev ?? []), flowResponse])\n }\n }\n })\n }\n\n async function addResponse(flowResponse: FlowResponse) {\n if (!flowResponse.foreignUserId) {\n return\n }\n\n if (flowResponse.actionType === STARTED_FLOW || flowResponse.actionType === NOT_STARTED_FLOW) {\n await postFlowResponse(flowResponse)\n } else if (flowResponse.actionType === COMPLETED_FLOW) {\n await postFlowResponse(flowResponse)\n } else if (flowResponse.actionType === STARTED_STEP) {\n await postFlowResponse(flowResponse)\n } else if (flowResponse.actionType === COMPLETED_STEP) {\n await postFlowResponse(flowResponse)\n } else if (flowResponse.actionType === SKIPPED_FLOW) {\n await postFlowResponse(flowResponse)\n } else if (flowResponse.actionType === NOT_STARTED_STEP) {\n await postFlowResponse(flowResponse)\n }\n }\n\n function getFlowResponses() {\n const apiFlowResponses: FlowResponse[] = []\n\n userFlowStatesData?.forEach((flowState) => {\n if (flowState && flowState.stepStates && Object.keys(flowState.stepStates).length !== 0) {\n // Convert flowState.stepStates map to flowResponses\n\n for (const stepSlug in flowState.stepStates) {\n const stepState = flowState.stepStates[stepSlug] as PublicStepState\n\n apiFlowResponses.push({\n foreignUserId: flowState.foreignUserId,\n flowSlug: flowState.flowId,\n stepId: stepState.stepId,\n actionType: stepState.actionType,\n data: {},\n createdAt: new Date(stepState.createdAt),\n blocked: stepState.blocked,\n hidden: stepState.hidden,\n } as FlowResponse)\n }\n }\n })\n\n return [...apiFlowResponses, ...flowResponses]\n }\n\n return {\n addResponse,\n setFlowResponses,\n getFlowResponses,\n }\n}\n","import {\n COMPLETED_FLOW,\n fetchRetry,\n NOT_STARTED_FLOW,\n NOT_STARTED_STEP,\n SKIPPED_FLOW,\n STARTED_FLOW,\n useConfig,\n} from './common'\nimport { useContext, useEffect, useState } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport useSWR from 'swr'\nimport { useFlowOpens } from './flow-opens'\nimport { FlowResponse } from './flow-responses'\nimport useSWRImmutable from 'swr/immutable'\nimport { deepmerge } from '../shared/deepmerge'\nimport { safeParse } from '../shared/parse'\n\nexport interface PublicUserFlowState {\n flowId: string\n flowState: 'COMPLETED_FLOW' | 'STARTED_FLOW' | 'NOT_STARTED_FLOW'\n lastStepId: string\n userId: string\n foreignUserId: string\n stepStates: object\n shouldTrigger: boolean\n}\n\nconst UNKNOWN_STEP_ID = 'unknown'\n\nexport function useUserFlowStates(): {\n userFlowStatesData: PublicUserFlowState[]\n isLoadingUserFlowStateData: boolean\n mutateUserFlowState: () => any\n optimisticallyMarkFlowCompleted: (flowId: string) => void\n optimisticallyMarkFlowSkipped: (flowId: string) => void\n optimisticallyMarkFlowNotStarted: (flowId: string) => void\n optimisticallyMarkStepCompleted: (\n flowId: string,\n stepId: string,\n flowResponse: FlowResponse\n ) => void\n optimisticallyMarkStepNotStarted: (\n flowId: string,\n stepId: string,\n flowResponse: FlowResponse\n ) => void\n optimisticallyMarkStepStarted: (\n flowId: string,\n stepId: string,\n flowResponse: FlowResponse\n ) => void\n error: any\n} {\n const { config, apiUrl } = useConfig()\n const { publicApiKey, userId, organizationId, flows, setShouldGracefullyDegrade, readonly } =\n useContext(FrigadeContext)\n const { resetOpenFlowState } = useFlowOpens()\n const [hasFinishedInitialLoad, setHasFinishedInitialLoad] = useState(false)\n const emptyResponse = {\n data: flows.map((flow) => ({\n flowId: flow.id,\n flowState: COMPLETED_FLOW,\n lastStepId: null,\n userId,\n foreignUserId: userId,\n stepStates: {},\n shouldTrigger: false,\n })),\n }\n const fetcher = (url) =>\n fetchRetry(url, 100, 2, config)\n .then((response) => {\n if (response.ok) {\n return response.json()\n }\n throw new Error('Failed to fetch user flow states')\n })\n .catch((error) => {\n console.error(`Error fetching ${url}: ${error}. Will gracefully degrade and hide Frigade`)\n setShouldGracefullyDegrade(true)\n return emptyResponse\n })\n\n const key =\n publicApiKey && flows && userId\n ? `${apiUrl}userFlowStates?foreignUserId=${encodeURIComponent(userId)}${\n organizationId ? `&foreignUserGroupId=${encodeURIComponent(organizationId)}` : ''\n }`\n : null\n\n const {\n data,\n isLoading: isLoadingUserFlowStateData,\n mutate: mutateUserFlowState,\n error,\n } = readonly\n ? useSWRImmutable(key, fetcher)\n : useSWR(key, fetcher, {\n revalidateOnFocus: true,\n revalidateIfStale: true,\n keepPreviousData: true,\n revalidateOnMount: false,\n errorRetryInterval: 10000,\n errorRetryCount: 3,\n onError: () => {\n // In case of errors fetching the user flow states, hide all Frigade flow by setting shouldTrigger to false\n return emptyResponse\n },\n onLoadingSlow: () => {\n return emptyResponse\n },\n })\n const userFlowStatesData = data?.data\n\n useEffect(() => {\n if (!hasFinishedInitialLoad && !isLoadingUserFlowStateData && userFlowStatesData) {\n setHasFinishedInitialLoad(true)\n }\n }, [userFlowStatesData, hasFinishedInitialLoad, isLoadingUserFlowStateData])\n\n async function optimisticallyMarkFlowCompleted(flowId: string) {\n if (userFlowStatesData && !readonly) {\n const flowState = userFlowStatesData.find((state) => state.flowId === flowId)\n if (flowState && flowState.flowState !== COMPLETED_FLOW) {\n flowState.flowState = COMPLETED_FLOW\n }\n await mutateUserFlowState(Promise.resolve(deepmerge(data, { data: userFlowStatesData })), {\n optimisticData: deepmerge(data, { data: userFlowStatesData }),\n revalidate: false,\n rollbackOnError: false,\n })\n }\n }\n\n async function optimisticallyMarkFlowSkipped(flowId: string) {\n if (userFlowStatesData && !readonly) {\n const flowState = userFlowStatesData.find((state) => state.flowId === flowId)\n if (flowState && flowState.flowState !== SKIPPED_FLOW) {\n flowState.flowState = SKIPPED_FLOW\n }\n await mutateUserFlowState(Promise.resolve(deepmerge(data, { data: userFlowStatesData })), {\n optimisticData: deepmerge(data, { data: userFlowStatesData }),\n revalidate: false,\n rollbackOnError: false,\n })\n }\n }\n\n async function optimisticallyMarkStepCompleted(\n flowId: string,\n stepId: string,\n flowResponse: FlowResponse\n ) {\n if (userFlowStatesData) {\n const flowState = userFlowStatesData.find(\n (state) => state.flowId === flowId\n ) as PublicUserFlowState\n if (flowState) {\n const flow = flows.find((flow) => flow.slug === flowId)\n const data = safeParse<any>(flow?.data)\n const steps = data?.steps ?? data?.data ?? []\n const currentStepIndex = steps.findIndex((step) => step.id === stepId)\n const nextStep =\n steps && steps.length > currentStepIndex + 1 ? steps[currentStepIndex + 1] : null\n if (nextStep) {\n // Check that next step is not hidden\n if (!flowState.stepStates[nextStep.id]?.hidden) {\n flowState.lastStepId = nextStep.id\n }\n }\n flowState.stepStates[stepId] = flowResponse\n flowState.flowState = STARTED_FLOW\n }\n if (!readonly) {\n await mutateUserFlowState(Promise.resolve(deepmerge(data, { data: userFlowStatesData })), {\n optimisticData: deepmerge(data, { data: userFlowStatesData }),\n revalidate: false,\n rollbackOnError: false,\n })\n }\n }\n }\n\n async function optimisticallyMarkStepStarted(\n flowId: string,\n stepId: string,\n flowResponse: FlowResponse\n ) {\n if (userFlowStatesData) {\n const flowState = userFlowStatesData.find(\n (state) => state.flowId === flowId\n ) as PublicUserFlowState\n if (flowState) {\n flowState.lastStepId = stepId\n flowState.stepStates[stepId] = flowResponse\n flowState.flowState = STARTED_FLOW\n }\n if (!readonly) {\n await mutateUserFlowState(deepmerge(data, { data: userFlowStatesData }), {\n optimisticData: deepmerge(data, { data: userFlowStatesData }),\n revalidate: false,\n rollbackOnError: false,\n })\n }\n }\n }\n\n async function optimisticallyMarkFlowNotStarted(flowId: string) {\n if (userFlowStatesData) {\n const flowState = userFlowStatesData.find((state) => state.flowId === flowId)\n if (flowState && flowState.flowState !== NOT_STARTED_FLOW) {\n flowState.flowState = NOT_STARTED_FLOW\n flowState.lastStepId = UNKNOWN_STEP_ID\n // Update all sets to NOT_STARTED_STEP\n Object.keys(flowState.stepStates).forEach((stepId) => {\n flowState.stepStates[stepId].actionType = NOT_STARTED_STEP\n flowState.stepStates[stepId].createdAt = new Date().toISOString()\n })\n await mutateUserFlowState(deepmerge(data, { data: userFlowStatesData }), {\n optimisticData: deepmerge(data, { data: userFlowStatesData }),\n revalidate: false,\n rollbackOnError: false,\n })\n resetOpenFlowState(flowId)\n }\n }\n }\n\n async function optimisticallyMarkStepNotStarted(\n flowId: string,\n stepId: string,\n flowResponse: FlowResponse\n ) {\n if (userFlowStatesData) {\n const flowState = userFlowStatesData.find(\n (state) => state.flowId === flowId\n ) as PublicUserFlowState\n if (flowState) {\n flowState.stepStates[stepId] = flowResponse\n }\n await mutateUserFlowState(Promise.resolve(deepmerge(data, { data: userFlowStatesData })), {\n optimisticData: deepmerge(data, { data: userFlowStatesData }),\n revalidate: false,\n rollbackOnError: false,\n })\n }\n }\n\n return {\n userFlowStatesData,\n isLoadingUserFlowStateData: !hasFinishedInitialLoad,\n mutateUserFlowState,\n optimisticallyMarkFlowCompleted,\n optimisticallyMarkFlowSkipped,\n optimisticallyMarkFlowNotStarted,\n optimisticallyMarkStepCompleted,\n optimisticallyMarkStepNotStarted,\n optimisticallyMarkStepStarted,\n error,\n }\n}\n","import { useContext } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\n\nexport function useFlowOpens() {\n const {\n openFlowStates,\n setOpenFlowStates,\n hasActiveFullPageFlow,\n setCompletedFlowsToKeepOpenDuringSession,\n completedFlowsToKeepOpenDuringSession,\n } = useContext(FrigadeContext)\n\n function getOpenFlowState(flowId: string, defaultValue = false) {\n return openFlowStates[flowId] ?? defaultValue\n }\n\n function setOpenFlowState(flowId: string, isOpen: boolean) {\n setOpenFlowStates((prev) => ({ ...prev, [flowId]: isOpen }))\n }\n\n function resetOpenFlowState(flowId: string) {\n setOpenFlowStates((prev) => {\n const { [flowId]: _, ...rest } = prev\n return { ...rest }\n })\n }\n\n function setKeepCompletedFlowOpenDuringSession(flowId: string) {\n if (completedFlowsToKeepOpenDuringSession.includes(flowId)) {\n return\n }\n setCompletedFlowsToKeepOpenDuringSession((prev) => [...prev, flowId])\n }\n\n function shouldKeepCompletedFlowOpenDuringSession(flowId: string): boolean {\n return completedFlowsToKeepOpenDuringSession.includes(flowId)\n }\n\n function hasOpenModals(currentFlowId?: string) {\n return (\n Object.entries(openFlowStates).some(\n ([flowId, isOpen]) => isOpen && flowId != currentFlowId\n ) || hasActiveFullPageFlow\n )\n }\n\n return {\n getOpenFlowState,\n setOpenFlowState,\n resetOpenFlowState,\n hasOpenModals,\n setKeepCompletedFlowOpenDuringSession,\n shouldKeepCompletedFlowOpenDuringSession,\n }\n}\n","import structuredClone from 'core-js-pure/actual/structured-clone'\n\nfunction isObject(obj) {\n return typeof obj === 'object' && obj !== null && !Array.isArray(obj)\n}\n\nexport function deepmerge(...args) {\n const target = args.shift()\n\n // Recurse to the right until we've merged all the way back to a single target and source\n const source = args.length === 1 ? args[0] : deepmerge(...args)\n\n if (!isObject(target) || !isObject(source)) {\n throw new Error('deepmerge can only merge Objects')\n }\n\n const result = structuredClone(target)\n\n Object.entries(source).forEach(([key, value]) => {\n // Is value an Object, i.e. are we at risk of passing by reference?\n if (isObject(value)) {\n // Does key already exist in result?\n if (result[key] !== undefined) {\n // Deepmerge it on\n Object.assign(result, { [key]: deepmerge(result[key], structuredClone(value)) })\n } else {\n // Else clone value onto result\n Object.assign(result, { [key]: structuredClone(value) })\n }\n } else if (Array.isArray(value)) {\n // Does key already exist in result?\n if (result[key] !== undefined) {\n // Clone and spread onto existing\n // TODO: This only shallow-merges arrays. Add ability to deep merge here, so nested structures aren't overwritten\n Object.assign(result, { [key]: [...result[key], ...structuredClone(value)] })\n } else {\n // Else spread array onto result\n Object.assign(result, { [key]: structuredClone(value) })\n }\n } else {\n // Assign value onto result\n Object.assign(result, { [key]: value })\n }\n })\n\n return result\n}\n","/**\n * Safely parse a stringified JSON object.\n *\n * @param stringified A stringified JSON object (or other value)\n * @returns The parsed object or null if the stringified value is not a valid JSON object\n */\nexport function safeParse<R>(stringified: string): R | null {\n try {\n return JSON.parse(stringified) as R\n } catch (e) {\n console.error('Failed to parse Frigade config.yml to JSON', e)\n return null\n }\n}\n","const regex = /user.flow\\(([^\\)]+)\\) == '?COMPLETED_FLOW'?/gm\n\nexport const getSubFlowFromCompletionCriteria = (completionCriteria: string) => {\n const flowMatch = regex.exec(completionCriteria)\n if (flowMatch === null) return null\n\n /**\n * Use the grouped regex match to\n * - match on full completion criteria for a 'Flow' completion\n * - get the flowId slug from within the completion criteria\n */\n let flow = null\n flowMatch.forEach((match, _) => {\n let trimmed = replaceAll(match, \"'\", '')\n if (trimmed.startsWith('flow_')) {\n flow = trimmed\n }\n })\n return flow\n}\n\nexport const replaceAll = function (target, search, replacement) {\n return target.replace(new RegExp(search, 'g'), replacement)\n}\n","import React, { useCallback, useContext, useEffect } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { useCheckHasInitiatedAPI, useConfig, useGracefulFetch } from './common'\nimport { useUserFlowStates } from './user-flow-states'\nimport { EntityProperties } from '../FrigadeForm/types'\nimport { guestUserIdField } from '../components/DataFetcher'\n\ninterface AddPropertyToUserDTO {\n readonly foreignId: string\n readonly properties?: { [key: string]: string | boolean | number | null }\n readonly events?: UserEvent[]\n readonly linkGuestId?: string\n}\n\ninterface UserEvent {\n readonly event: string\n readonly properties?: { [key: string]: string | boolean | number | null }\n}\n\nexport const GUEST_PREFIX = 'guest_'\n\nexport function useUser(): {\n readonly userId: string | null\n readonly setUserId: React.Dispatch<React.SetStateAction<string | null>>\n readonly setUserIdWithProperties: (userId: string, properties?: EntityProperties) => Promise<void>\n readonly addPropertiesToUser: (properties: EntityProperties) => Promise<void>\n readonly trackEventForUser: (event: string, properties?: EntityProperties) => Promise<void>\n readonly linkExistingGuestSessionToUser: (userId: string) => Promise<void>\n} {\n const {\n userId: userIdInternal,\n organizationId,\n setUserId,\n setUserProperties,\n shouldGracefullyDegrade,\n } = useContext(FrigadeContext)\n const { config, apiUrl } = useConfig()\n const { mutateUserFlowState } = useUserFlowStates()\n const gracefullyFetch = useGracefulFetch()\n const { verifySDKInitiated } = useCheckHasInitiatedAPI()\n\n function getUserIdKey(id?: string) {\n return `frigade-user-registered-${id}`\n }\n\n // Use local storage to mark if user has already been registered in frigade\n useEffect(() => {\n // Check if user is not a guest\n if (userIdInternal && !organizationId) {\n // Check if userid begins with the guest prefix\n if (userIdInternal.startsWith(GUEST_PREFIX)) {\n return\n }\n const userRegisteredKey = getUserIdKey(userIdInternal)\n // Check if user has already been registered in frigade\n if (!localStorage.getItem(userRegisteredKey)) {\n // Register user in frigade\n gracefullyFetch(`${apiUrl}users`, {\n ...config,\n method: 'POST',\n body: JSON.stringify({ foreignId: userIdInternal }),\n })\n // Mark user as registered in frigade\n localStorage.setItem(userRegisteredKey, 'true')\n }\n }\n }, [userIdInternal, shouldGracefullyDegrade, organizationId])\n\n const addPropertiesToUser = useCallback(\n async (properties: EntityProperties) => {\n if (!verifySDKInitiated()) {\n return\n }\n const data: AddPropertyToUserDTO = {\n foreignId: userIdInternal,\n properties,\n }\n await gracefullyFetch(`${apiUrl}users`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n setUserProperties((userProperties) => ({ ...userProperties, ...properties }))\n mutateUserFlowState()\n },\n [userIdInternal, config, shouldGracefullyDegrade, mutateUserFlowState]\n )\n\n const trackEventForUser = useCallback(\n async (event: string, properties?: EntityProperties) => {\n if (!verifySDKInitiated()) {\n return\n }\n const eventData: UserEvent = {\n event,\n properties,\n }\n const data: AddPropertyToUserDTO = {\n foreignId: userIdInternal,\n events: [eventData],\n }\n await gracefullyFetch(`${apiUrl}users`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n mutateUserFlowState()\n },\n [userIdInternal, config, mutateUserFlowState]\n )\n\n const setUserIdWithProperties = useCallback(\n async (userId: string, properties?: EntityProperties) => {\n if (!verifySDKInitiated()) {\n return\n }\n if (properties && Object.keys(properties).length > 0) {\n const userRegisteredKey = getUserIdKey(userId)\n localStorage.setItem(userRegisteredKey, 'true')\n setUserId(userId)\n const data: AddPropertyToUserDTO = {\n foreignId: userId,\n properties,\n }\n await gracefullyFetch(`${apiUrl}users`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n setUserProperties((userProperties) => ({ ...userProperties, ...properties }))\n mutateUserFlowState()\n } else {\n setUserId(userId)\n }\n },\n [config, shouldGracefullyDegrade, mutateUserFlowState]\n )\n\n const linkExistingGuestSessionToUser = useCallback(\n async (userId: string) => {\n if (!verifySDKInitiated()) {\n return\n }\n const existingGuestId =\n typeof window !== 'undefined' ? localStorage.getItem(guestUserIdField) : null\n\n if (!existingGuestId) {\n return\n }\n\n const data: AddPropertyToUserDTO = {\n foreignId: userId,\n linkGuestId: existingGuestId,\n }\n await gracefullyFetch(`${apiUrl}users`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n mutateUserFlowState()\n },\n [config, shouldGracefullyDegrade, mutateUserFlowState]\n )\n\n return {\n userId: userIdInternal,\n setUserId,\n setUserIdWithProperties,\n addPropertiesToUser,\n trackEventForUser,\n linkExistingGuestSessionToUser,\n }\n}\n","import React, { CSSProperties, FC, useEffect, useState } from 'react'\n\nimport { Appearance, DefaultFrigadeFlowProps, StepData } from '../types'\nimport { useFlows } from '../api/flows'\nimport { COMPLETED_FLOW } from '../api/common'\nimport { Modal } from '../components/Modal'\nimport { CornerModal } from '../components/CornerModal'\nimport { FormInputProps } from './types'\nimport { useTheme } from '../hooks/useTheme'\nimport { FormContent } from './FormContent'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport { useFlowOpens } from '../api/flow-opens'\nimport { useFlowImpressions } from '../hooks/useFlowImpressions'\n\nexport type FrigadeFormType = 'inline' | 'modal' | 'large-modal' | 'corner-modal'\n\nexport interface FrigadeFormProps extends DefaultFrigadeFlowProps {\n /**\n * @ignore\n */\n title?: string\n /**\n * @ignore\n */\n subtitle?: string\n type?: FrigadeFormType\n /**\n * Map of custom components. The key must match the `type` property of the step defined in `config.yml`\n */\n customStepTypes?: {\n [key: string]:\n | ((params: {\n flowId: string\n stepData: StepData\n canContinue: boolean\n setCanContinue: (canContinue: boolean) => void\n onSaveData: (data: object) => void\n appearance?: Appearance\n prefillData?: Record<string, any>\n customFormElements?: { [key: string]: (params: FormInputProps) => React.ReactNode }\n }) => React.ReactNode)\n | React.ReactNode\n }\n /**\n * Map of custom form components. Can only be used with a step of type `multiInput` (defined in `config.yml`).\n * The key must match the `type` property of the input defined in `config.yml`\n */\n customFormElements?: { [key: string]: (params: FormInputProps) => React.ReactNode }\n visible?: boolean\n setVisible?: (visible: boolean) => void\n onComplete?: () => void\n /**\n * Whether to show a dismiss button to exit out of the form. Applicable only for modal forms.\n */\n dismissible?: boolean\n /**\n * If true, the form can be repeated multiple times. Default is false. Useful for e.g. contact/support forms.\n */\n repeatable?: boolean\n /**\n * If true, the user will be excited from the flow when the form is dismissed. The flow will be marked as dismissed. Default is false.\n */\n endFlowOnDismiss?: boolean\n /**\n * Indicates the position of the modal if the form type is a modal. Default is center.\n */\n modalPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center'\n /**\n * Show a pagination indicator at the bottom of the form. Default is false.\n */\n showPagination?: boolean\n /**\n * Whether to allow the user to navigate back to previous steps. Default is false.\n * The title of the button can be controlled by the `backButtonTitle` prop on the step.\n */\n allowBackNavigation?: boolean\n /**\n * @ignore\n */\n showFrigadeBranding?: boolean\n /**\n * Async function resolved when the user submits data in a step.\n * If the promise evaluates to a string or `false`, the flow will not proceed to the next step. The string will be displayed as an error message if passed.\n * If the promise evaluates to `true`, the flow will proceed to the next step.\n */\n validationHandler?: (\n step: StepData,\n index: number,\n nextStep?: StepData,\n allFormData?: any,\n stepSpecificFormData?: any\n ) => Promise<string | null | boolean | undefined>\n /**\n * Handler that is called when the form data changes.\n */\n onFormDataChange?: (\n allFormData: any,\n stepSpecificFormData: any,\n step: StepData,\n index: number\n ) => void\n /**\n * Show or hide the form footer\n */\n showFooter?: boolean\n /**\n * Data to use for prefilling forms with data.\n * Useful when you want to prefill a form with data from another source.\n * The format of the data maps a step id to the prefill data. Depending on the implementation of the given step type,\n * the value of the data will follow a different structure.\n *\n * For `type` multiInputStep, the value contains another map similar to the structure returned from `onFormDataChange`\n */\n prefillData?: Record<string, any>\n /**\n * Whether to update the url when the page changes in multi-page forms. If enabled, the current url will be updated with the\n * current step id in the following format: <my_url>?p=<current_step_id>\n *\n * This is useful when wanting to capture URL changes with third-party tracking tools.\n *\n * Default is false.\n */\n updateUrlOnPageChange?: boolean\n}\n\nexport const FrigadeForm: FC<FrigadeFormProps> = ({\n flowId,\n customStepTypes = {},\n type = 'inline',\n visible,\n setVisible,\n customVariables,\n customFormElements,\n onComplete,\n appearance,\n hideOnFlowCompletion = true,\n onStepCompletion,\n onButtonClick,\n dismissible = true,\n endFlowOnDismiss = false,\n modalPosition = 'center',\n repeatable = false,\n onDismiss,\n showPagination = false,\n allowBackNavigation = false,\n validationHandler,\n showFrigadeBranding = false,\n onFormDataChange,\n showFooter = true,\n prefillData = {},\n updateUrlOnPageChange = false,\n}) => {\n const {\n getFlow,\n getFlowSteps,\n isLoading,\n targetingLogicShouldHideFlow,\n getFlowStatus,\n getCurrentStepIndex,\n markFlowSkipped,\n markFlowNotStarted,\n markStepStarted,\n } = useFlows()\n const selectedStep = getCurrentStepIndex(flowId)\n const { mergeAppearanceWithDefault } = useTheme()\n const [lastHashNavigationStepId, setLastHashNavigationStepId] = useState(null)\n const { setOpenFlowState, getOpenFlowState, hasOpenModals } = useFlowOpens()\n useFlowImpressions(flowId, visible)\n const steps = getFlowSteps(flowId)\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n const [showModal, setShowModal] =\n visible !== undefined && setVisible !== undefined\n ? [visible, setVisible]\n : [getOpenFlowState(flowId, true), (value) => setOpenFlowState(flowId, value)]\n\n const hash = typeof window !== 'undefined' ? window.location.hash : null\n useEffect(() => {\n if (steps && steps.length > 0 && allowBackNavigation) {\n const stepIdFromHash =\n typeof window !== 'undefined' && window?.location?.hash\n ? window.location.hash.replace('#', '')\n : ''\n if (steps && steps?.length > 0) {\n let newStepIndex = -1\n if (stepIdFromHash) {\n const stepIdToGoTo = stepIdFromHash\n newStepIndex = steps.findIndex((step) => step.id === stepIdToGoTo)\n if (lastHashNavigationStepId === stepIdFromHash) {\n newStepIndex = -1\n }\n }\n if (newStepIndex !== -1) {\n setLastHashNavigationStepId(stepIdFromHash)\n markStepStarted(flowId, steps[newStepIndex].id)\n }\n }\n }\n }, [hash])\n\n useEffect(() => {\n if (\n !isLoading &&\n steps &&\n steps.length &&\n typeof window !== 'undefined' &&\n allowBackNavigation\n ) {\n setLastHashNavigationStepId(steps[selectedStep].id)\n window.location.hash = steps[selectedStep].id\n }\n }, [isLoading, selectedStep, steps])\n\n if (isLoading) {\n return null\n }\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (!steps) {\n return null\n }\n\n if (visible !== undefined && visible === false) {\n return null\n }\n\n if (getFlowStatus(flowId) === COMPLETED_FLOW && hideOnFlowCompletion && !repeatable) {\n return null\n }\n\n if ((type == 'modal' || type == 'corner-modal') && hasOpenModals(flowId)) {\n return null\n }\n\n const handleClose = () => {\n setShowModal(false)\n if (onDismiss) {\n onDismiss()\n }\n if (endFlowOnDismiss === true) {\n markFlowSkipped(flowId)\n }\n }\n\n if ((modalPosition == 'center' && type === 'modal') || type === 'large-modal') {\n const overrideStyle: CSSProperties = {\n padding: '24px',\n }\n if (type === 'large-modal') {\n overrideStyle.width = '85%'\n overrideStyle.height = '90%'\n overrideStyle.maxHeight = '800px'\n overrideStyle.minHeight = '500px'\n overrideStyle.padding = '0'\n } else {\n overrideStyle.width = '400px'\n }\n return (\n <Modal\n appearance={appearance}\n onClose={handleClose}\n visible={showModal}\n style={overrideStyle}\n dismissible={dismissible}\n showFrigadeBranding={showFrigadeBranding}\n >\n <RenderInlineStyles appearance={appearance} />\n <FormContent\n appearance={appearance}\n steps={steps}\n selectedStep={selectedStep}\n customStepTypes={customStepTypes}\n customVariables={customVariables}\n onButtonClick={onButtonClick}\n onStepCompletion={onStepCompletion}\n flowId={flowId}\n type={type}\n hideOnFlowCompletion={hideOnFlowCompletion}\n onComplete={onComplete}\n setVisible={setVisible}\n setShowModal={setShowModal}\n onDismiss={onDismiss}\n showPagination={showPagination}\n customFormElements={customFormElements}\n allowBackNavigation={allowBackNavigation}\n validationHandler={validationHandler}\n onFormDataChange={onFormDataChange}\n showFooter={showFooter}\n prefillData={prefillData}\n updateUrlOnPageChange={updateUrlOnPageChange}\n repeatable={repeatable}\n />\n </Modal>\n )\n }\n\n if (type === 'modal' && modalPosition !== 'center') {\n return (\n <CornerModal\n appearance={appearance}\n onClose={handleClose}\n visible={showModal}\n modalPosition={modalPosition}\n >\n <RenderInlineStyles appearance={appearance} />\n <FormContent\n appearance={appearance}\n steps={steps}\n selectedStep={selectedStep}\n customStepTypes={customStepTypes}\n customVariables={customVariables}\n onButtonClick={onButtonClick}\n onStepCompletion={onStepCompletion}\n flowId={flowId}\n type={type}\n hideOnFlowCompletion={hideOnFlowCompletion}\n onComplete={onComplete}\n setVisible={setVisible}\n setShowModal={setShowModal}\n onDismiss={onDismiss}\n showPagination={showPagination}\n customFormElements={customFormElements}\n allowBackNavigation={allowBackNavigation}\n validationHandler={validationHandler}\n onFormDataChange={onFormDataChange}\n showFooter={showFooter}\n prefillData={prefillData}\n updateUrlOnPageChange={updateUrlOnPageChange}\n repeatable={repeatable}\n />\n </CornerModal>\n )\n }\n\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <FormContent\n appearance={appearance}\n steps={steps}\n selectedStep={selectedStep}\n customStepTypes={customStepTypes}\n customVariables={customVariables}\n onButtonClick={onButtonClick}\n onStepCompletion={onStepCompletion}\n flowId={flowId}\n type={type}\n hideOnFlowCompletion={hideOnFlowCompletion}\n onComplete={onComplete}\n setVisible={setVisible}\n setShowModal={setShowModal}\n onDismiss={onDismiss}\n showPagination={showPagination}\n customFormElements={customFormElements}\n allowBackNavigation={allowBackNavigation}\n validationHandler={validationHandler}\n onFormDataChange={onFormDataChange}\n showFooter={showFooter}\n prefillData={prefillData}\n updateUrlOnPageChange={updateUrlOnPageChange}\n repeatable={repeatable}\n />\n </>\n )\n}\n\nexport default FrigadeForm\n","import React, { FC, useEffect, useState } from 'react'\nimport styled from 'styled-components'\n\nimport { ModalBackground } from './ModalBackground'\nimport { Close } from '../Icons/Close'\nimport { getClassName, getCustomClassOverrides, styleOverridesToCSS } from '../../shared/appearance'\nimport { Appearance } from '../../types'\nimport { Portal } from 'react-portal'\nimport { PoweredByFrigade } from '../branding/PoweredByFrigade'\nimport { PoweredByFrigadeModalRibbon } from '../branding/styled'\n\nconst ModalContainer = styled.div<{ appearance; maxWidth }>`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n background-color: ${(props) => props.appearance?.theme?.colorBackground};\n /* Mobile */\n @media (max-width: 500px) {\n width: 90%;\n height: 90%;\n top: 50%;\n left: 50%;\n }\n\n width: ${(props) => props.width ?? '1000px'};\n z-index: 1500;\n border-radius: ${(props) => props.appearance?.theme?.borderRadius ?? 8}px;\n ${(props) => styleOverridesToCSS(props)}\n }\n\n padding: 32px;\n\n position: fixed;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n max-height: 90%;\n\n display: flex;\n flex-direction: column;\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);\n animation-duration: 0.15s;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n animation-name: fadeIn;\n box-sizing: border-box;\n\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n`\n\nconst ModalHeader = styled.div`\n position: relative;\n flex: 0 1 auto;\n`\n\nconst ModalClose = styled.div<{ appearance }>`\n position: absolute;\n top: 16px;\n right: 16px;\n cursor: pointer;\n z-index: 1501;\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n color: ${(props) => props.appearance?.theme?.colorText};\n }\n`\n\nconst Body = styled.div`\n overflow: scroll;\n flex: 1 1;\n display: flex;\n ::-webkit-scrollbar {\n display: none;\n }\n`\n\ninterface ModalProps {\n onClose: () => void\n visible: boolean\n headerContent?: React.ReactNode\n children: React.ReactNode\n style?: React.CSSProperties\n appearance?: Appearance\n dismissible?: boolean // defaults to true\n showFrigadeBranding?: boolean\n}\n\nexport const Modal: FC<ModalProps> = ({\n onClose,\n visible,\n headerContent = null,\n style = null,\n children,\n appearance,\n dismissible = true,\n showFrigadeBranding = false,\n}) => {\n const [initialBodyOverflow, setInitialBodyOverflow] = useState('')\n\n useEffect(() => {\n const initialOverflow = getComputedStyle(document.body).getPropertyValue('overflow')\n setInitialBodyOverflow(initialOverflow)\n }, [])\n\n // If user presses escape key, close modal\n useEffect(() => {\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n onClose()\n }\n }\n document.addEventListener('keydown', handleEscape)\n\n return () => {\n document.removeEventListener('keydown', handleEscape)\n }\n }, [onClose])\n\n useEffect(() => {\n const bodyStyle = document.body.style\n\n if (visible) {\n bodyStyle.setProperty('overflow', 'hidden')\n } else {\n bodyStyle.setProperty('overflow', initialBodyOverflow)\n }\n\n return () => {\n bodyStyle.setProperty('overflow', initialBodyOverflow)\n }\n }, [visible])\n\n if (!visible) return <></>\n\n return (\n <Portal>\n <ModalBackground\n appearance={appearance}\n onClose={() => {\n if (dismissible) {\n onClose()\n }\n }}\n />\n <ModalContainer\n appearance={appearance}\n className={getClassName('modalContainer', appearance)}\n styleOverrides={style}\n >\n {dismissible && (\n <ModalClose\n className={getClassName('modalClose', appearance)}\n onClick={() => onClose()}\n appearance={appearance}\n >\n <Close />\n </ModalClose>\n )}\n {headerContent && <ModalHeader>{headerContent}</ModalHeader>}\n <Body className={getClassName('modalBody', appearance)}>{children}</Body>\n\n {showFrigadeBranding && (\n <PoweredByFrigadeModalRibbon\n appearance={appearance}\n className={getClassName('poweredByFrigadeRibbon', appearance)}\n >\n <PoweredByFrigade appearance={appearance} />\n </PoweredByFrigadeModalRibbon>\n )}\n </ModalContainer>\n </Portal>\n )\n}\n","import React from 'react'\nimport styled from 'styled-components'\nimport { getClassName, getCustomClassOverrides } from '../../shared/appearance'\n\nconst Background = styled.div`\n display: flex;\n justify-content: center;\n position: fixed;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n ${(props) => getCustomClassOverrides(props)} {\n background-color: rgba(0, 0, 0, 0.6);\n z-index: 1400;\n }\n animation-duration: 0.15s;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n animation-name: fadeIn;\n\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n`\n\nexport const ModalBackground = ({ onClose, appearance }) => {\n return (\n <Background\n className={getClassName('modalBackground', appearance)}\n onClick={() => onClose()}\n ></Background>\n )\n}\n","import { Appearance } from '../types'\n\nexport const CSS_CLASS_PREFIX = 'fr-'\nexport const CUSTOM_CSS_STYLES_PREFIX = 'cfr-'\nconst defaultClass = '.fr-element'\n\nexport function getClassName(className: string, appearance?: Appearance) {\n const defaultClass = `${CSS_CLASS_PREFIX}${className}`\n if (!appearance) {\n return defaultClass\n }\n\n if (appearance.styleOverrides && appearance.styleOverrides[className]) {\n if (typeof appearance.styleOverrides[className] === 'string') {\n // It's a class name\n return defaultClass + ' ' + appearance.styleOverrides[className]\n } else if (typeof appearance.styleOverrides[className] === 'object') {\n // It's a style object\n return defaultClass + ' ' + CUSTOM_CSS_STYLES_PREFIX + className\n }\n }\n\n return defaultClass\n}\n\nexport function getCustomClassOverrides(props: any) {\n if (!props.className) {\n return ''\n }\n if (props.className.indexOf(CUSTOM_CSS_STYLES_PREFIX) !== -1) {\n return ''\n }\n\n // Remove any extra spaces from props.customClasses. Only allow one space per class.\n const customClasses = props.className.replace(/\\s+/g, ' ')\n const customClassesArray = customClasses.split(' ')\n if (customClassesArray.length == 1 && customClassesArray[0].startsWith(CSS_CLASS_PREFIX)) {\n return ''\n }\n return `:not(${customClassesArray\n .map((className: string) => {\n return `.${className}`\n })\n .join(', ')})`\n}\n\nexport function toKebabKey(key: string) {\n return key.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase()\n}\n\nexport function styleOverridesToCSS(props: any) {\n return props?.styleOverrides\n ? Object.keys(props.styleOverrides)\n .map((key) => `${toKebabKey(key)}: ${props.styleOverrides[key]};`)\n .join(' ')\n : ''\n}\n\nexport function mergeClasses(...classes: string[]) {\n return classes.filter(Boolean).join(' ')\n}\n\nexport function ucFirst(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1)\n}\n","import React from 'react'\nimport styled from 'styled-components'\n\nconst CloseContainer = styled.div`\n :hover {\n opacity: 0.8;\n }\n`\n\nexport const Close = () => (\n <CloseContainer>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\" viewBox=\"0 0 20 20\">\n <path\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n d=\"M5 15L15 5M5 5l10 10\"\n ></path>\n </svg>\n </CloseContainer>\n)\n","import React from 'react'\nimport FrigadeLogo from '../Icons/FrigadeLogo'\nimport { Appearance } from '../../types'\nimport { PoweredByFrigadeContainer } from './styled'\nimport { getClassName } from '../../shared/appearance'\n\nexport function PoweredByFrigade({ appearance }: { appearance: Appearance }) {\n return (\n <PoweredByFrigadeContainer\n className={getClassName('poweredByFrigadeContainer', appearance)}\n appearance={appearance}\n >\n Powered by \n <FrigadeLogo />\n </PoweredByFrigadeContainer>\n )\n}\n","import React, { CSSProperties } from 'react'\n\nfunction FrigadeLogo({ style, className }: { style?: CSSProperties; className?: string }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"54\"\n height=\"14\"\n fill=\"none\"\n viewBox=\"0 0 54 14\"\n style={style}\n className={className}\n >\n <path\n fill=\"currentColor\"\n d=\"M16.293 3.476v1.036h1.593v1.256h-1.593v5.098h-1.41V5.768H14V4.512h.883V3.244c0-.67.294-1.744 1.777-1.744.515 0 .969.049 1.361.146l-.233 1.232a5.939 5.939 0 00-.833-.073c-.442 0-.662.22-.662.67zm6.534.975V5.83c-.846 0-1.63.159-2.342.476v4.56h-1.41V4.513h1.263l.086.61c.846-.451 1.655-.67 2.403-.67zm2.505-.951c-.331.33-.944.33-1.287 0a.93.93 0 01-.246-.659c0-.268.086-.487.246-.646.343-.33.956-.33 1.287 0 .343.33.343.964 0 1.305zm.061 7.366h-1.41V4.512h1.41v6.354zm6.928-5.756c.246.146.368.402.368.756v4.976c0 1.804-.858 2.658-2.672 2.658-.92 0-1.753-.146-2.514-.439l.417-1.073c.674.22 1.336.33 1.974.33.98 0 1.385-.379 1.385-1.403v-.171c-.588.134-1.09.207-1.52.207-.907 0-1.655-.305-2.231-.902-.576-.598-.87-1.39-.87-2.354 0-.963.294-1.756.87-2.354.576-.61 1.324-.914 2.231-.914 1.005 0 1.864.232 2.562.683zm-2.488 4.634a5.15 5.15 0 001.446-.22V5.951a3.695 3.695 0 00-1.446-.292c-1.08 0-1.778.841-1.778 2.048 0 1.22.699 2.037 1.778 2.037zm7.34-5.317c1.52 0 2.28.878 2.28 2.634v3.805h-1.275l-.073-.524c-.601.414-1.288.621-2.084.621-1.263 0-2.06-.658-2.06-1.731 0-1.269 1.25-2.025 3.408-2.025.135 0 .503.013.662.013v-.171c0-1.012-.343-1.451-1.115-1.451-.675 0-1.435.158-2.256.475l-.466-1.012c1.017-.427 2.01-.634 2.979-.634zm-1.839 4.756c0 .427.343.695 1.017.695.528 0 1.251-.22 1.68-.512V8.22h-.441c-1.508 0-2.256.317-2.256.963zm9.953-4.549v-2.83h1.41v7.72c0 .354-.123.598-.368.757-.71.45-1.57.67-2.562.67-.907 0-1.655-.305-2.231-.902-.577-.61-.87-1.39-.87-2.354 0-.963.293-1.756.87-2.354.576-.61 1.324-.914 2.23-.914.43 0 .933.073 1.521.207zM43.84 9.72c.503 0 .981-.098 1.447-.293V5.854a5.15 5.15 0 00-1.447-.22c-1.078 0-1.777.817-1.777 2.037s.699 2.049 1.777 2.049zM54 7.866v.439h-4.573c.184.963.858 1.512 1.827 1.512.613 0 1.275-.146 1.986-.451l.466 1.024c-.87.378-1.729.573-2.575.573-.931 0-1.692-.304-2.268-.902-.576-.61-.87-1.402-.87-2.366 0-.975.294-1.768.87-2.366.576-.597 1.324-.902 2.244-.902.968 0 1.691.33 2.17.975.478.647.723 1.464.723 2.464zm-4.61-.586h3.298c-.086-1.073-.613-1.731-1.581-1.731-.969 0-1.582.695-1.717 1.731z\"\n ></path>\n <path\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n d=\"M1.196 1.229A4.009 4.009 0 014.08 0l4.092.027C9.183.027 10 .867 10 1.904c0 .6-.273 1.133-.7 1.478-.31.25-.7.399-1.126.4h-.001l-4.09-.027h-.002a4.804 4.804 0 00-2.614.77A4.986 4.986 0 000 5.974v-1.78C0 3.036.456 1.988 1.196 1.23zm4.525 4.65a4.282 4.282 0 00-1.184 2.513l3.637.023c.131 0 .259-.015.382-.042h.002c.81-.178 1.42-.908 1.44-1.788v-.046a1.9 1.9 0 00-.533-1.328 1.813 1.813 0 00-.908-.508h-.002l-.002-.001a1.68 1.68 0 00-.366-.042A4.084 4.084 0 005.72 5.88zm-4.525-.016A4.235 4.235 0 000 8.829C0 10.997 1.601 12.78 3.654 13V9.265h-.005l.005-.439v-.437h.023a5.175 5.175 0 011.439-3.13 5.05 5.05 0 01.72-.614l-1.754-.011H4.08c-.787 0-1.521.229-2.144.625a4.11 4.11 0 00-.74.603z\"\n clipRule=\"evenodd\"\n ></path>\n </svg>\n )\n}\n\nexport default FrigadeLogo\n","import styled from 'styled-components'\nimport { TooltipContainer } from '../Tooltips/styled'\n\nexport const PoweredByFrigadeModalRibbon = styled.div`\n background-color: ${(props) => props.appearance?.theme.colorBackground};\n position: absolute;\n bottom: -47px;\n left: 0;\n width: 100%;\n height: 40px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: ${(props) => props.appearance?.theme.borderRadius}px;\n`\n\nexport const PoweredByFrigadeTooltipRibbon = styled(TooltipContainer)`\n background-color: ${(props) => props.appearance?.theme.colorBackground};\n position: absolute;\n bottom: -60px;\n left: 0;\n width: 100%;\n height: 40px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: ${(props) => props.appearance?.theme.borderRadius}px;\n padding: 0;\n z-index: ${(props) => props.zIndex};\n`\n\nexport const PoweredByFrigadeContainer = styled.div`\n display: flex;\n justify-content: center;\n align-items: center;\n font-style: normal;\n font-weight: 500;\n font-size: 12px;\n line-height: 18px;\n color: ${(props) => props.appearance?.theme?.colorTextSecondary};\n`\n","import styled from 'styled-components'\nimport { Appearance } from '../../types'\nimport { getCustomClassOverrides } from '../../shared/appearance'\n\nexport const TooltipContainer = styled.div<{ maxWidth: number; appearance: Appearance }>`\n ${(props) => getCustomClassOverrides(props)} {\n background: ${(props) => props.appearance.theme.colorBackground};\n }\n\n box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n max-width: ${(props) => props.maxWidth}px;\n min-width: 300px;\n z-index: ${(props) => props.zIndex};\n overflow: hidden;\n`\nconst dismissWithImageStyle = `\n display: block;\n cursor: pointer;\n position: absolute;\n background-color: rgba(0, 0, 0, 0.2);\n color: #ffffff;\n padding: 4px;\n border-radius: 100px;\n border-width: 0px;\n top: 12px;\n right: 12px;\n box-sizing: border-box;\n :hover {\n opacity: 0.8;\n }`\n\nconst dismissWithoutImageStyle = `\n display: block;\n cursor: pointer;\n position: absolute;\n top: 12px;\n right: 12px;\n background-color: transparent;\n border: none;\n `\n\nexport const TooltipDismissButton = styled.button`\n ${(props) => getCustomClassOverrides(props)} {\n ${(props) => (props.hasImage ? dismissWithImageStyle : dismissWithoutImageStyle)};\n }\n`\n\nexport const TooltipImageContainer = styled.img`\n ${(props) => getCustomClassOverrides(props)} {\n display: block;\n width: 100%;\n height: auto;\n min-height: 200px;\n object-fit: cover;\n }\n`\n\nexport const TooltipVideoContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: block;\n width: 100%;\n height: auto;\n margin-top: ${(props) => (props.dismissible ? '24px' : '0px')};\n object-fit: cover;\n }\n`\n\nexport const TooltipFooter = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-content: center;\n`\n\nexport const TooltipContentContainer = styled.div`\n padding: 22px 22px 12px;\n`\n\nexport const TooltipStepCountContainer = styled.div`\n display: flex;\n flex: 1;\n flex-direction: column;\n justify-content: center;\n`\n\nexport const TooltipCTAContainer = styled.div`\n display: flex;\n flex: 2;\n flex-shrink: 1;\n gap: 8px;\n height: 64px;\n ${(props) => getCustomClassOverrides(props)} {\n flex-direction: row;\n justify-content: ${(props) => (props.showStepCount ? 'flex-end' : 'flex-start')};\n align-content: center;\n align-items: center;\n }\n`\n\nexport const TooltipStepCounter = styled.p`\n ${(props) => getCustomClassOverrides(props)} {\n font-style: normal;\n font-weight: 600;\n font-size: 15px;\n line-height: 22px;\n color: #808080;\n }\n margin: 0;\n`\n","import React, { FC, useEffect, useState } from 'react'\nimport styled from 'styled-components'\nimport { Portal } from 'react-portal'\nimport { Appearance } from '../../types'\nimport { getClassName, getCustomClassOverrides } from '../../shared/appearance'\nimport { Close } from '../Icons/Close'\n\nfunction getModalPosition(\n modalPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n) {\n switch (modalPosition) {\n case 'top-left':\n return `\n top: 0;\n left: 0;\n `\n case 'top-right':\n return `\n top: 0;\n right: 0;\n `\n case 'bottom-left':\n return `\n bottom: 0;\n left: 0;\n `\n }\n\n return `right: 0; bottom: 0;`\n}\n\nconst CornerModalContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n background: ${(props) => props.appearance?.theme?.colorBackground};\n position: fixed;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n z-index: 1500;\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);\n border-radius: 12px;\n width: 350px;\n padding: 24px;\n }\n ${(props) => getModalPosition(props.modalPosition)}\n margin: 28px;\n`\n\nconst CornerModalHeader = styled.div`\n position: relative;\n flex: 1;\n`\n\nconst CornerModalClose = styled.div`\n position: absolute;\n top: 16px;\n right: 16px;\n cursor: pointer;\n z-index: 1501;\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n color: ${(props) => props.appearance?.theme?.colorText};\n }\n`\n\nconst Body = styled.div`\n overflow: scroll;\n flex: 5;\n ::-webkit-scrollbar {\n display: none;\n }\n`\n\ninterface CornerModalProps {\n onClose: () => void\n visible: boolean\n headerContent?: React.ReactNode\n children: React.ReactNode\n style?: React.CSSProperties\n appearance?: Appearance\n modalPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n dismissible?: boolean\n}\n\nexport const CornerModal: FC<CornerModalProps> = ({\n onClose,\n visible,\n headerContent = null,\n children,\n appearance,\n modalPosition = 'bottom-right',\n dismissible = true,\n}) => {\n const [initialBodyOverflow, setInitialBodyOverflow] = useState('')\n\n function handleDismiss() {\n const bodyStyle = document.body.style\n bodyStyle.setProperty('overflow', initialBodyOverflow)\n onClose()\n }\n\n useEffect(() => {\n const initialOverflow = getComputedStyle(document.body).getPropertyValue('overflow')\n setInitialBodyOverflow(initialOverflow)\n }, [])\n\n // If user presses escape key, close modal\n useEffect(() => {\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n handleDismiss()\n }\n }\n document.addEventListener('keydown', handleEscape)\n\n return () => {\n document.removeEventListener('keydown', handleEscape)\n }\n }, [onClose])\n\n useEffect(() => {\n const bodyStyle = document.body.style\n\n if (visible) {\n bodyStyle.setProperty('overflow', 'hidden')\n } else {\n bodyStyle.setProperty('overflow', initialBodyOverflow)\n }\n\n return () => {\n bodyStyle.setProperty('overflow', initialBodyOverflow)\n }\n }, [visible])\n\n if (!visible) return <></>\n\n return (\n <Portal>\n <CornerModalContainer\n appearance={appearance}\n className={getClassName('cornerModalContainer', appearance)}\n modalPosition={modalPosition}\n >\n {dismissible && (\n <CornerModalClose\n className={getClassName('cornerModalClose', appearance)}\n onClick={handleDismiss}\n >\n <Close />\n </CornerModalClose>\n )}\n {headerContent && <CornerModalHeader>{headerContent}</CornerModalHeader>}\n <Body>{children}</Body>\n </CornerModalContainer>\n </Portal>\n )\n}\n","import { useContext } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { Appearance } from '../types'\n\nexport function useTheme() {\n const { defaultAppearance } = useContext(FrigadeContext)\n\n function mergeAppearanceWithDefault(appearance?: Appearance): Appearance {\n const _appearance = JSON.parse(JSON.stringify(defaultAppearance))\n\n if (!appearance) {\n return _appearance\n }\n\n return {\n styleOverrides: Object.assign(\n _appearance.styleOverrides ?? {},\n appearance.styleOverrides ?? {}\n ),\n theme: Object.assign(_appearance.theme, appearance.theme ?? {}),\n }\n }\n\n return { mergeAppearanceWithDefault }\n}\n","import React, { useContext, useEffect, useState } from 'react'\nimport styled from 'styled-components'\nimport {\n CustomFormTypeProps,\n FormInputProps,\n FormInputType,\n FormValidationError,\n} from '../../../FrigadeForm/types'\nimport { TextField } from './form-components/TextField'\nimport { MultipleChoice } from './form-components/MultipleChoice'\nimport { MultipleChoiceList } from './form-components/MultipleChoiceList'\nimport { TitleSubtitle } from '../../TitleSubtitle/TitleSubtitle'\nimport { getClassName } from '../../../shared/appearance'\nimport { useUser } from '../../../api/users'\nimport { Warning } from '../../Icons/Warning'\nimport { FrigadeContext } from '../../../FrigadeProvider'\n\ninterface MultiInputStepProps {\n data?: FormInputType[]\n}\n\nconst MultiInputContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n overflow: visible;\n padding-top: 14px;\n`\n\nconst MultiInputValidationError = styled.div`\n color: ${(props) => props.appearance?.theme?.colorTextError};\n font-size: 12px;\n margin-bottom: 12px;\n display: flex;\n align-items: center;\n`\n\nconst MultiInputValidationErrorIcon = styled.div`\n margin-right: 4px;\n display: inline-flex;\n`\n\nconst MultiInput = styled.div`\n padding-left: 1px;\n padding-right: 1px;\n`\n\nconst DEFAULT_INPUT_TYPES: { [key: string]: (params: FormInputProps) => React.ReactNode } = {\n text: TextField,\n multipleChoice: MultipleChoice,\n multipleChoiceList: MultipleChoiceList,\n}\n\nexport const FORM_DATA_KEY_PREFIX = `frigade-multiInputStepTypeData`\n\nexport function MultiInputStepType({\n flowId,\n stepData,\n canContinue,\n setCanContinue,\n onSaveData,\n appearance,\n customFormElements,\n prefillData,\n}: CustomFormTypeProps) {\n const formElements = stepData.props as MultiInputStepProps\n const [formValidationErrors, setFormValidationErrors] = useState<FormValidationError[]>([])\n const [touchedInputs, setTouchedInputs] = useState<string[]>([])\n const { userId } = useUser()\n const [allFormData, setAllFormData] = useState(\n loadFromLocalStorage() || (prefillData ? prefillData[stepData.id] : null) || {}\n )\n const { readonly } = useContext(FrigadeContext)\n const mergedInputTypes = { ...DEFAULT_INPUT_TYPES, ...customFormElements }\n\n useEffect(() => {\n setCanContinue(formValidationErrors.length === 0)\n }, [formValidationErrors, setCanContinue])\n\n useEffect(() => {\n onSaveData(allFormData)\n }, [allFormData])\n\n function saveDataFromInputs(input: FormInputType, data: object) {\n setAllFormData((prevData) => {\n const newData = { ...prevData, [input.id]: data }\n if (typeof window !== 'undefined' && window.localStorage && !readonly) {\n window.localStorage.setItem(getLocalStorageKey(), JSON.stringify(newData))\n }\n return newData\n })\n }\n\n function loadFromLocalStorage() {\n if (typeof window !== 'undefined' && window.localStorage) {\n const data = window.localStorage.getItem(getLocalStorageKey())\n if (data) {\n return JSON.parse(data)\n }\n }\n return null\n }\n\n function getLocalStorageKey() {\n return `${FORM_DATA_KEY_PREFIX}-${flowId}-${stepData.id}-${userId}`\n }\n\n return (\n <MultiInput className={getClassName('multiInput', appearance)}>\n <TitleSubtitle appearance={appearance} title={stepData.title} subtitle={stepData.subtitle} />\n <MultiInputContainer className={getClassName('multiInputContainer', appearance)}>\n {formElements?.data?.map((input: FormInputType) => {\n const err = formValidationErrors.reverse().find((error) => error.id === input.id)\n return mergedInputTypes[input.type] ? (\n <span\n key={input.id}\n data-field-id={input.id}\n className={getClassName('multiInputField', appearance)}\n >\n {mergedInputTypes[input.type]({\n formInput: input,\n customFormTypeProps: {\n flowId,\n stepData,\n canContinue,\n setCanContinue,\n onSaveData,\n appearance,\n },\n onSaveInputData: (data) => {\n if (\n !touchedInputs.includes(input.id) &&\n // Ensure not empty string\n data &&\n data?.text !== ''\n ) {\n setTouchedInputs((prev) => [...prev, input.id])\n }\n saveDataFromInputs(input, data)\n },\n inputData: allFormData[input.id],\n allInputData: allFormData,\n setFormValidationErrors: (errors) => {\n if (errors.length === 0 && formValidationErrors.length === 0) {\n return\n }\n setFormValidationErrors((prev) => {\n if (errors.length === 0) {\n return prev.filter((error) => error.id !== input.id)\n }\n return [...prev, ...errors]\n })\n },\n })}\n {err && err.message && touchedInputs.includes(input.id) && err.hidden !== true && (\n <MultiInputValidationError\n key={input.id}\n style={{ overflow: 'hidden' }}\n appearance={appearance}\n className={getClassName('multiInputValidationError', appearance)}\n >\n <MultiInputValidationErrorIcon\n appearance={appearance}\n className={getClassName('multiInputValidationErrorIcon', appearance)}\n >\n <Warning />\n </MultiInputValidationErrorIcon>\n {err.message}\n </MultiInputValidationError>\n )}\n </span>\n ) : null\n })}\n </MultiInputContainer>\n </MultiInput>\n )\n}\n","import React, { useEffect, useState } from 'react'\n\nimport styled from 'styled-components'\nimport { FormInputProps, FormInputType } from '../../../../../FrigadeForm/types'\nimport { getClassName, getCustomClassOverrides } from '../../../../../shared/appearance'\nimport { Label } from '../shared/Label'\nimport { SubLabel } from '../shared/SubLabel'\nimport { getErrorsFromValidationResult } from '../shared/validation'\n\ninterface TextFieldProps extends FormInputType {\n id: string\n title?: string\n placeholder?: string\n multiline?: boolean\n}\n\nconst TextInputWrapper = styled.div`\n display: flex;\n flex-direction: column;\n width: 100%;\n`\n\nexport const TextInput = styled.input`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n border: 1px solid ${(props) => props.appearance?.theme?.colorBorder};\n font-size: 14px;\n ::placeholder {\n color: ${(props) => props.appearance?.theme?.colorTextDisabled};\n font-size: 14px;\n }\n border-radius: 6px;\n }\n width: 100%;\n height: 40px;\n box-sizing: border-box;\n padding: 0 10px;\n margin-bottom: 10px;\n`\nconst TextArea = styled.textarea`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n border: 1px solid ${(props) => props.appearance?.theme?.colorBorder};\n font-size: 14px;\n padding: 10px;\n ::placeholder {\n color: #c7c7c7;\n font-size: 14px;\n }\n border-radius: 6px;\n }\n width: 100%;\n min-height: 70px;\n box-sizing: border-box;\n margin-bottom: 10px;\n resize: none;\n`\n\nexport function TextField({\n formInput,\n customFormTypeProps,\n onSaveInputData,\n setFormValidationErrors,\n inputData,\n}: FormInputProps) {\n const input = formInput as TextFieldProps\n const [data, setData] = useState(inputData?.text || '')\n const [hasLoaded, setHasLoaded] = useState(false)\n const [hasGivenFocus, setHasGivenFocus] = useState(false)\n let InputComponent = TextInput\n useEffect(() => {\n if (data === '' && !hasLoaded) {\n setHasLoaded(true)\n handleDataChange('')\n }\n }, [])\n\n useEffect(() => {\n if (hasGivenFocus) {\n handleDataChange(data)\n return\n }\n }, [hasGivenFocus])\n\n function handleDataChange(value: string) {\n setData(value)\n onSaveInputData({ text: value })\n if (input.required === true && value.trim() === '') {\n setFormValidationErrors([\n {\n id: input.id,\n message: `${input.title ?? `Field`} is required`,\n hidden: !hasGivenFocus,\n },\n ])\n return\n }\n const validationError = getErrorsFromValidationResult(value, input.validation)\n if (validationError && (value.trim() !== '' || input.required === true)) {\n setFormValidationErrors([\n {\n id: input.id,\n message: validationError,\n hidden: !hasGivenFocus,\n },\n ])\n return\n }\n setFormValidationErrors([])\n }\n\n if (input.multiline) {\n InputComponent = TextArea\n }\n\n function getType() {\n switch (input?.validation?.type) {\n case 'email':\n return 'email'\n case 'number':\n return 'number'\n case 'password':\n return 'password'\n }\n\n return null\n }\n\n return (\n <TextInputWrapper>\n <Label\n title={input.title}\n required={input.required}\n appearance={customFormTypeProps.appearance}\n />\n <InputComponent\n className={getClassName('inputComponent', customFormTypeProps.appearance)}\n value={data}\n onChange={(e) => {\n handleDataChange(e.target.value)\n }}\n appearance={customFormTypeProps.appearance}\n placeholder={input.placeholder}\n type={getType()}\n onBlur={() => {\n setHasGivenFocus(true)\n }}\n ></InputComponent>\n <SubLabel title={input.subtitle} appearance={customFormTypeProps.appearance} />\n </TextInputWrapper>\n )\n}\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../../../../../shared/appearance'\n\nexport const FormLabel = styled.label`\n ${(props) => getCustomClassOverrides(props)} {\n font-size: 12px;\n line-height: 18px;\n margin-bottom: 5px;\n margin-top: 10px;\n font-style: normal;\n font-weight: 600;\n letter-spacing: 0.24px;\n }\n display: flex;\n`\n\nexport const FormSubLabel = styled.label`\n ${(props) => getCustomClassOverrides(props)} {\n font-size: 12px;\n line-height: 20px;\n margin-bottom: 5px;\n }\n display: flex;\n`\n\nexport const RequiredSymbol = styled.span`\n font-weight: 400;\n font-size: 14px;\n line-height: 22px;\n color: ${(props) => props.appearance?.theme?.colorTextError};\n display: flex;\n margin-right: 5px;\n margin-top: 10px;\n`\n\nexport const LabelWrapper = styled.div`\n display: flex;\n align-items: flex-start;\n justify-content: left;\n margin-bottom: 10px;\n`\n","import { FormLabel, LabelWrapper, RequiredSymbol } from './styled'\nimport { getClassName } from '../../../../../shared/appearance'\nimport React from 'react'\nimport { Appearance, DefaultAppearance } from '../../../../../types'\n\nexport function Label({\n title,\n required,\n appearance = DefaultAppearance,\n}: {\n title?: string\n required: boolean\n appearance?: Appearance\n}) {\n if (!title) {\n return null\n }\n\n return (\n <LabelWrapper className={getClassName('formLabelWrapper', appearance)}>\n {required ? (\n <RequiredSymbol\n className={getClassName('formLabelRequired', appearance)}\n appearance={appearance}\n >\n *\n </RequiredSymbol>\n ) : null}\n <FormLabel className={getClassName('formLabel', appearance)}>{title}</FormLabel>\n </LabelWrapper>\n )\n}\n","import React, { CSSProperties } from 'react'\n\nexport interface StepData {\n /**\n * Unique identifier for the step.\n */\n id: string\n /**\n * Name of the step when shown in a list view\n */\n stepName?: string\n /**\n * Title of the step\n */\n title?: string\n /**\n * Subtitle of the step\n */\n subtitle?: string\n /**\n * Primary button title. If omitted, the primary button will not be shown.\n */\n primaryButtonTitle?: string\n /**\n * Primary button URI.\n */\n primaryButtonUri?: string\n /**\n * Primary button URI target (either _blank or _self)\n */\n primaryButtonUriTarget?: string\n /**\n * Secondary button title. If omitted, the secondary button will not be shown.\n */\n secondaryButtonTitle?: string\n /**\n * Secondary button URI.\n */\n secondaryButtonUri?: string\n /**\n * Secondary button URI target (either _blank or _self)\n */\n secondaryButtonUriTarget?: string\n /**\n * Text on button if a back button is present\n */\n backButtonTitle?: string\n /**\n * If true, the step will be marked as completed when the secondary button is clicked.\n */\n skippable?: boolean\n /**\n * @deprecated use primaryButtonUri instead\n */\n url?: string\n /**\n * @deprecated use primaryButtonUriTarget instead\n */\n urlTarget?: string\n type?: string\n /**\n * Video url to be shown for components supporting video.\n */\n videoUri?: string\n /**\n * Image url to be shown for components supporting image.\n */\n imageUri?: string | null\n /**\n * Automatically mark the step as completed when the primary button is clicked. Default is false.\n */\n autoMarkCompleted?: boolean\n /**\n * Whether the step is completed.\n */\n complete: boolean\n /**\n * Whether the step has been started by the user. True if either the step was marked started or completed.\n */\n started: boolean\n /**\n * Whether the step is currently active/the flow is currently on this step. Can only be true for on step at a time.\n */\n currentlyActive: boolean\n /**\n * Whether the step is blocked (can't be accessed yet)\n */\n blocked?: boolean\n /**\n * Whether the step is hidden (not shown in the list view)\n */\n hidden?: boolean\n StepContent?: React.ReactNode\n /**\n * Handler for when the primary button is clicked.\n */\n handlePrimaryButtonClick?: () => void\n /**\n * Handler for when the secondary button is clicked.\n */\n handleSecondaryButtonClick?: () => void\n ctaActionType?: 'complete'\n props?: any\n /**\n * Criteria that needs to be met for the step to complete\n */\n completionCriteria?: string\n /**\n * Criteria that needs to be met for the step to start\n */\n startCriteria?: string\n progress?: number\n /**\n * Whether the step is dismissible (for instance, tooltips or other non-essential steps)\n */\n dismissible?: boolean\n /**\n * Whether to show a highlight in the page where the step is shown. Typically used in tooltips for creating small pings.\n */\n showHighlight?: boolean\n\n /**\n * Config for the primary button in this step\n */\n primaryButton?: {\n /**\n * Primary button URI target (defaults to _self).\n */\n target?: string\n\n /**\n * Primary button title. If omitted, the primary button will not be shown.\n */\n title?: string\n\n /**\n * Primary button URI.\n */\n uri?: string\n }\n\n /**\n * Config for the secondary button in this step\n */\n secondaryButton?: {\n /**\n * Secondary button URI target (defaults to _self).\n */\n target?: string\n\n /**\n * Secondary button title. If omitted, the secondary button will not be shown.\n */\n title?: string\n\n /**\n * Secondary button URI.\n */\n uri?: string\n }\n\n /**\n * Any other additional props defined in config.yml\n */\n [x: string | number | symbol]: unknown\n}\n\nexport interface DefaultFrigadeFlowProps {\n flowId: string\n style?: CSSProperties\n className?: string\n /**\n * The appearance of the flow. See https://docs.frigade.com/sdk/styling\n */\n appearance?: Appearance\n /**\n * Dynamic variables to use in config.yml. See https://docs.frigade.com/flows/dynamic-variables\n */\n customVariables?: { [key: string]: string | number | boolean }\n hideOnFlowCompletion?: boolean\n /**\n * Handler for when a step is completed.\n * @param step\n * @param index\n * @param nextStep\n * @param allFormData All form data collected so far (only applicable to FrigadeForms)\n * @param stepSpecificFormData Form data collected for the finished step (only applicable to FrigadeForms)\n */\n onStepCompletion?: (\n step: StepData,\n index: number,\n nextStep?: StepData,\n allFormData?: any,\n stepSpecificFormData?: any\n ) => boolean\n /**\n * Handler for when a primary or secondary CTA is clicked (regardless if step is completed or not).\n * Return true if your app performs an action (e.g. open other modal or page transition).\n * @param step\n * @param index\n * @param cta\n */\n onButtonClick?: (\n step: StepData,\n index?: number,\n cta?: 'primary' | 'secondary' | 'link' | 'back' | 'collapse' | 'expand',\n nextStep?: StepData\n ) => boolean\n\n onDismiss?: () => void\n onComplete?: () => void\n}\n\nexport interface Appearance {\n /**\n * Overrides of individual components and classes.\n * This map can either be className(s) or CSSProperties.\n */\n styleOverrides?: {\n [key: string]: CSSProperties | string\n }\n /**\n * The base theme to use with Frigade components.\n */\n theme?: BaseTheme\n}\n\nexport interface BaseTheme {\n /**\n * The base theme color used on CTAs and other primary elements.\n */\n colorPrimary?: string\n /**\n * Secondary color, used for CTAs and other secondary elements.\n */\n colorSecondary?: string\n\n colorBackground?: string\n colorBackgroundSecondary?: string\n colorText?: string\n colorTextOnPrimaryBackground?: string\n colorTextSecondary?: string\n colorTextDisabled?: string\n colorTextError?: string\n colorTextSuccess?: string\n colorBorder?: string\n fontSize?: string | number\n fontSmoothing?: string\n fontWeight?: string | number\n borderRadius?: number\n modalContainer?: CSSProperties\n}\n\nexport const DefaultAppearance: Appearance = {\n theme: {\n colorPrimary: '#0171F8',\n colorSecondary: '#2E343D',\n colorText: '#0F1114',\n colorBackground: '#ffffff',\n colorBackgroundSecondary: '#d2d2d2',\n colorTextOnPrimaryBackground: '#ffffff',\n colorTextSecondary: '#2E343D',\n colorTextDisabled: '#5A6472',\n colorBorder: '#E5E5E5',\n colorTextError: '#c00000',\n colorTextSuccess: '#00D149',\n borderRadius: 10,\n },\n}\n","import { FormSubLabel, LabelWrapper } from './styled'\nimport { getClassName } from '../../../../../shared/appearance'\nimport React from 'react'\nimport { Appearance } from '../../../../../types'\n\nexport function SubLabel({ title, appearance }: { title?: string; appearance: Appearance }) {\n if (!title) {\n return null\n }\n\n return (\n <LabelWrapper>\n <FormSubLabel className={getClassName('formSubLabel', appearance)}>{title}</FormSubLabel>\n </LabelWrapper>\n )\n}\n","import { InputValidation } from '../../../../../FrigadeForm/types'\nimport { z } from 'zod'\n\nexport function getErrorsFromValidationResult(\n value?: string,\n validation?: InputValidation\n): string | null {\n try {\n if (validation) {\n if (validation.type == 'number') {\n let validator = z.number()\n if (validation.props) {\n for (const validationProp of validation.props) {\n if (validationProp.requirement == 'min') {\n validator = validator.min(\n Number(validationProp.value),\n validationProp.message ?? 'Value is too small'\n )\n } else if (validationProp.requirement == 'max') {\n validator = validator.max(\n Number(validationProp.value),\n validationProp.message ?? 'Value is too large'\n )\n } else if (validationProp.requirement == 'positive') {\n validator = validator.positive(validationProp.message ?? 'Value must be positive')\n } else if (validationProp.requirement == 'negative') {\n validator = validator.nonpositive(validationProp.message ?? 'Value must be negative')\n }\n }\n }\n validator.parse(Number(value))\n }\n if (validation.type == 'string') {\n let validator = z.string()\n if (validation.props) {\n for (const validationProp of validation.props) {\n if (validationProp.requirement == 'min') {\n validator = validator.min(\n Number(validationProp.value),\n validationProp.message ?? 'Value is too short'\n )\n } else if (validationProp.requirement == 'max') {\n validator = validator.max(\n Number(validationProp.value),\n validationProp.message ?? 'Value is too long'\n )\n } else if (validationProp.requirement == 'regex') {\n validator = validator.regex(\n new RegExp(String(validationProp.value)),\n validationProp.message ?? 'Value does not match requirements'\n )\n }\n }\n }\n validator.parse(value)\n }\n\n return\n }\n } catch (e) {\n if (e instanceof z.ZodError) {\n if (e.issues && e.issues.length > 0) {\n return e.issues[0].message\n }\n return null\n }\n console.error('Frigade Form validation failed for rule ', validation, e)\n }\n\n return null\n}\n","import React, { useEffect, useState } from 'react'\n\nimport styled from 'styled-components'\nimport { FormInputProps, FormInputType } from '../../../../../FrigadeForm/types'\nimport { getClassName, getCustomClassOverrides } from '../../../../../shared/appearance'\nimport { Label } from '../shared/Label'\nimport { TextInput } from '../TextField'\nimport { SubLabel } from '../shared/SubLabel'\n\nconst NULL_VALUE = ''\n\nexport interface MultipleChoiceProps extends FormInputType {\n id: string\n title?: string\n placeholder?: string\n defaultValue?: string\n requireSelection?: boolean\n props: {\n options?: MultipleChoiceOption[]\n }\n}\n\nexport interface MultipleChoiceOption {\n id: string\n title: string\n isOpenEnded?: boolean\n openEndedLabel?: string\n}\n\nconst MultipleChoiceWrapper = styled.div`\n display: flex;\n flex-direction: column;\n width: 100%;\n -webkit-appearance: none;\n appearance: none;\n`\n\nconst MultipleChoiceSelect = styled.select`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n border: 1px solid ${(props) => props.appearance?.theme?.colorBorder};\n font-size: 14px;\n border-radius: 6px;\n }\n width: 100%;\n height: 40px;\n box-sizing: border-box;\n\n padding: 0 10px;\n margin-bottom: 10px;\n color: ${(props) =>\n props.value == ''\n ? props.appearance?.theme?.colorTextDisabled\n : props.appearance?.theme?.colorText};\n\n appearance: none;\n background-image: url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'><path stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/></svg>\");\n background-position: right 0.5rem center;\n background-repeat: no-repeat;\n background-size: 1.5em 1.5em;\n -webkit-print-color-adjust: exact;\n`\n\nexport function MultipleChoice({\n formInput,\n customFormTypeProps,\n onSaveInputData,\n inputData,\n setFormValidationErrors,\n}: FormInputProps) {\n const input = formInput as MultipleChoiceProps\n const [hasLoaded, setHasLoaded] = useState(false)\n const [hasSelected, setHasSelected] = useState(false)\n const [otherValue, setOtherValue] = useState('')\n\n useEffect(() => {\n if (!inputData?.choice?.[0] && !hasLoaded) {\n setHasLoaded(true)\n if (input.requireSelection) {\n onSaveInputData({ choice: [NULL_VALUE] })\n return\n }\n if (\n input.defaultValue &&\n input.props.options?.find((option) => option.id === input.defaultValue)\n ) {\n // Find input.props.options with id == defaultValue\n const defaultValue = input.props.options?.find((option) => option.id === input.defaultValue)\n onSaveInputData({ choice: [defaultValue.id], label: [defaultValue.title] })\n } else {\n onSaveInputData({\n choice: [input.props.options?.[0].id || ''],\n label: [input.props.options?.[0].title],\n })\n }\n }\n }, [])\n\n useEffect(() => {\n if (input.requireSelection && inputData?.choice?.[0] === NULL_VALUE) {\n setFormValidationErrors([\n {\n message: 'Please select an option',\n id: input.id,\n hidden: true,\n },\n ])\n } else {\n setFormValidationErrors([])\n }\n }, [inputData?.choice?.[0], hasSelected])\n\n return (\n <MultipleChoiceWrapper>\n <Label\n title={input.title}\n required={input.required}\n appearance={customFormTypeProps.appearance}\n />\n <MultipleChoiceSelect\n value={inputData?.choice?.[0]}\n onChange={(e) => {\n setHasSelected(true)\n onSaveInputData({ choice: [e.target.value], label: [e.target.selectedOptions[0].text] })\n }}\n placeholder={input.placeholder}\n appearance={customFormTypeProps.appearance}\n className={getClassName('multipleChoiceSelect', customFormTypeProps.appearance)}\n >\n {input.requireSelection && (\n <option key=\"null-value\" value={NULL_VALUE} disabled>\n {input.placeholder ?? `Select an option`}\n </option>\n )}\n {input.props.options?.map((option) => {\n return (\n <option key={option.id} value={option.id}>\n {option.title}\n </option>\n )\n })}\n </MultipleChoiceSelect>\n {/*// If selected data is option.isOpenEnded is true, render an input field*/}\n {input.props.options?.find((option) => option.id === inputData?.choice?.[0])?.isOpenEnded && (\n <>\n <Label\n title={\n input.props.options?.find((option) => option.id === inputData?.choice?.[0])\n ?.openEndedLabel ?? `Please specify`\n }\n required={false}\n appearance={customFormTypeProps.appearance}\n />\n <TextInput\n type=\"text\"\n placeholder=\"Enter your answer here\"\n onChange={(e) => {\n onSaveInputData({\n choice: [\n input.props.options?.find((option) => option.id === inputData?.choice?.[0])?.id,\n ],\n label: [e.target.value],\n isOpenEnded: true,\n })\n }}\n appearance={customFormTypeProps.appearance}\n />\n </>\n )}\n <SubLabel title={input.subtitle} appearance={customFormTypeProps.appearance} />\n </MultipleChoiceWrapper>\n )\n}\n","import React, { useEffect, useState } from 'react'\n\nimport styled from 'styled-components'\nimport { FormInputProps, MultipleChoiceListProps } from '../../../../../FrigadeForm/types'\nimport { getClassName, getCustomClassOverrides } from '../../../../../shared/appearance'\nimport { Label } from '../shared/Label'\nimport { SubLabel } from '../shared/SubLabel'\nimport { CheckBox } from '../../../../CheckBox'\nimport { sanitize } from '../../../../../shared/sanitizer'\n\nconst MultipleChoiceListWrapper = styled.div`\n display: flex;\n flex-direction: column;\n width: 100%;\n -webkit-appearance: none;\n appearance: none;\n`\n\nconst MultipleChoiceListItem = styled.button`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n border: 1px solid ${(props) => props.appearance?.theme?.colorBorder};\n font-size: 14px;\n // Selector for when selected=true\n &[data-selected='true'] {\n border: 1px solid ${(props) => props.appearance.theme.colorPrimary};\n background-color: ${(props) => props.appearance.theme.colorPrimary}1a;\n }\n\n :hover {\n border: 1px solid ${(props) => props.appearance.theme.colorPrimary};\n }\n text-align: left;\n border-radius: 10px;\n }\n display: inline-flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n width: 100%;\n line-height: 18px;\n padding: 18px;\n margin-bottom: 10px;\n`\n\nexport function MultipleChoiceList({\n formInput,\n customFormTypeProps,\n onSaveInputData,\n inputData,\n setFormValidationErrors,\n}: FormInputProps) {\n const input = formInput as MultipleChoiceListProps\n const [selectedIds, setSelectedIds] = useState<string[]>(inputData?.choice || [])\n const [hasLoaded, setHasLoaded] = useState(false)\n\n useEffect(() => {\n if (selectedIds.length == 0 && !hasLoaded) {\n setHasLoaded(true)\n onSaveInputData({ choice: [] })\n }\n }, [])\n\n useEffect(() => {\n onSaveInputData({ choice: selectedIds })\n }, [selectedIds])\n\n useEffect(() => {\n // Set errors if inputData does not meet min/max requirements and if field is required\n if (\n input.required &&\n (selectedIds.length < input.props.minChoices || selectedIds.length > input.props.maxChoices)\n ) {\n setFormValidationErrors([\n {\n message: ``,\n id: input.id,\n },\n ])\n } else {\n setFormValidationErrors([])\n }\n }, [selectedIds])\n\n return (\n <MultipleChoiceListWrapper>\n <Label\n title={input.title}\n required={input.required}\n appearance={customFormTypeProps.appearance}\n />\n {input.props.options?.map((option) => {\n return (\n <MultipleChoiceListItem\n appearance={customFormTypeProps.appearance}\n className={getClassName(\n selectedIds.includes(option.id)\n ? 'multipleChoiceListItemSelected'\n : 'multipleChoiceListItem',\n customFormTypeProps.appearance\n )}\n key={option.id}\n value={option.id}\n data-selected={selectedIds.includes(option.id)}\n onClick={() => {\n // If the option is already selected, remove it from the selectedIds\n if (selectedIds.includes(option.id)) {\n setSelectedIds(selectedIds.filter((id) => id !== option.id))\n return\n }\n // Select the input if we are still under maxChoices\n if (selectedIds.length < input.props.maxChoices) {\n setSelectedIds([...selectedIds, option.id])\n } else {\n if (selectedIds.length == 1 && input.props.maxChoices == 1) {\n // deselect the input if we are at maxChoices and minChoices is 1\n setSelectedIds([option.id])\n }\n }\n }}\n >\n <span dangerouslySetInnerHTML={sanitize(option.title)} />\n <CheckBox\n type=\"round\"\n primaryColor={customFormTypeProps.appearance.theme.colorPrimary}\n value={selectedIds.includes(option.id)}\n appearance={customFormTypeProps.appearance}\n />\n </MultipleChoiceListItem>\n )\n })}\n <SubLabel title={input.subtitle} appearance={customFormTypeProps.appearance} />\n </MultipleChoiceListWrapper>\n )\n}\n","import React, { CSSProperties, FC } from 'react'\nimport { ProgressRing } from '../Progress/ProgressRing'\nimport { getClassName, mergeClasses, styleOverridesToCSS } from '../../shared/appearance'\nimport { Appearance, DefaultAppearance } from '../../types'\nimport styled from 'styled-components'\n\nconst CheckIcon = ({ color = '#FFFFFF' }) => (\n <svg width={10} height={8} viewBox=\"0 0 10 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M1 4.34815L3.4618 7L3.4459 6.98287L9 1\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n)\n\nconst BASE_CHECKBOX_STYLES_SQUARE: CSSProperties = {\n width: '22px',\n height: '22px',\n borderRadius: '8px',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n}\n\nconst BASE_CHECKBOX_STYLES_ROUND: CSSProperties = {\n width: '22px',\n height: '22px',\n borderRadius: '40px',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n}\n\nconst BASE_CHECKBOX_STYLES_SQUARE__CHECKED = {\n border: '1px solid #000000',\n color: '#FFFFFF',\n}\n\nconst BASE_CHECKBOX_STYLES_SQUARE__UNCHECKED = {\n border: '1px solid #C5CBD3',\n}\n\nconst BASE_CHECKBOX_STYLES_ROUND__CHECKED = {\n color: '#FFFFFF',\n}\n\nconst BASE_CHECKBOX_STYLES_ROUND__UNCHECKED = {\n border: '1px solid #C5CBD3',\n}\n\nconst getBaseStyle = (type: CheckBoxType): CSSProperties => {\n if (type === 'square') return BASE_CHECKBOX_STYLES_SQUARE\n else return BASE_CHECKBOX_STYLES_ROUND\n}\n\nconst getStateStyle = (type: CheckBoxType, checked: boolean): CSSProperties => {\n if (type === 'square')\n return checked ? BASE_CHECKBOX_STYLES_SQUARE__CHECKED : BASE_CHECKBOX_STYLES_SQUARE__UNCHECKED\n return checked ? BASE_CHECKBOX_STYLES_ROUND__CHECKED : BASE_CHECKBOX_STYLES_ROUND__UNCHECKED\n}\n\nexport type CheckBoxType = 'square' | 'round'\n\nexport interface CheckBoxProps {\n value: boolean\n type?: CheckBoxType\n primaryColor?: string\n progress?: number // progress percentage our of 1. e.g. 0.5\n appearance?: Appearance\n className?: string\n style?: React.CSSProperties\n label?: string\n}\n\nconst CheckIconContainer = styled.div`\n ${(props) => styleOverridesToCSS(props)}\n flex-shrink: 0;\n`\n\nexport const CheckBox: FC<CheckBoxProps> = ({\n value,\n type = 'round',\n primaryColor = '#000000',\n progress,\n appearance = DefaultAppearance,\n style,\n className,\n label,\n}) => {\n let checkBoxStyle = getBaseStyle(type as CheckBoxType)\n let stateStyle = getStateStyle(type as CheckBoxType, value)\n\n if (value === true) {\n checkBoxStyle = {\n ...checkBoxStyle,\n ...stateStyle,\n backgroundColor: appearance.theme.colorTextSuccess,\n borderColor: type === 'square' ? primaryColor : 'none',\n }\n } else {\n checkBoxStyle = {\n ...checkBoxStyle,\n ...stateStyle,\n }\n }\n\n if (value !== true && type === 'round' && progress !== undefined && progress !== 1) {\n return <ProgressRing fillColor={primaryColor} percentage={progress} size={22} />\n }\n\n return (\n <CheckIconContainer\n styleOverrides={checkBoxStyle}\n style={style}\n role=\"checkbox\"\n aria-checked={value === true}\n aria-label={label}\n className={mergeClasses(\n getClassName('checkIconContainer', appearance),\n getClassName(\n value ? 'checkIconContainerChecked' : 'checkIconContainerUnchecked',\n appearance\n ),\n value ? 'checkIconContainerChecked' : 'checkIconContainerUnchecked',\n className\n )}\n >\n {value && <CheckIcon color={'#FFFFFF'} />}\n </CheckIconContainer>\n )\n}\n","import React, { FC } from 'react'\n\nconst Circle: FC<{ color: string; percentage?: number; size: number }> = ({\n color,\n percentage,\n size,\n}) => {\n const r = size * 0.5 - 2\n const circum = 2 * Math.PI * r\n const strokePct = (1 - percentage) * circum // where stroke will start, e.g. from 15% to 100%.\n\n return (\n <circle\n r={r}\n cx={size * 0.5}\n cy={size * 0.5}\n fill=\"transparent\"\n stroke={strokePct !== circum ? color : ''}\n strokeWidth={'3px'}\n strokeDasharray={circum}\n strokeDashoffset={percentage ? strokePct : 0}\n ></circle>\n )\n}\n\ninterface ProgressRingProps {\n fillColor: string\n size: number\n bgColor?: string\n percentage: number\n className?: string\n style?: React.CSSProperties\n children?: React.ReactNode\n}\n\nconst ProgressRing: FC<ProgressRingProps> = ({\n fillColor,\n size,\n percentage,\n children,\n bgColor = '#D9D9D9',\n className,\n style,\n}) => {\n return (\n <svg style={style} className={className} width={size} height={size} overflow=\"visible\">\n <g transform={`rotate(-90 ${`${size * 0.5} ${size * 0.5}`})`}>\n <Circle color={bgColor} size={size} />\n <Circle color={fillColor} percentage={Math.max(percentage, 0.1)} size={size} />\n </g>\n {children}\n </svg>\n )\n}\n\nexport default ProgressRing\n","import DOMPurify from 'dompurify'\n\nexport function sanitize(dirty?: string) {\n if (!dirty) {\n return { __html: '' }\n }\n return {\n __html: DOMPurify.sanitize(dirty, {\n ALLOWED_TAGS: [\n 'b',\n 'i',\n 'a',\n 'span',\n 'div',\n 'p',\n 'pre',\n 'u',\n 'br',\n 'img',\n 'code',\n 'li',\n 'ul',\n 'table',\n 'tbody',\n 'thead',\n 'tr',\n 'td',\n 'th',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'video',\n ],\n ALLOWED_ATTR: [\n 'style',\n 'class',\n 'target',\n 'id',\n 'href',\n 'alt',\n 'src',\n 'controls',\n 'autoplay',\n 'loop',\n 'muted',\n 'playsinline',\n ],\n }),\n }\n}\n\nexport function removeHTMLChars(encoded?: string | unknown) {\n if (!encoded) {\n return ''\n }\n\n if (typeof encoded !== 'string') {\n return encoded\n }\n\n return encoded.replace(/&#(\\d+);/g, function (_, dec) {\n return String.fromCharCode(dec)\n })\n}\n","import React from 'react'\n\nimport { Appearance } from '../../types'\nimport { getClassName, getCustomClassOverrides, ucFirst } from '../../shared/appearance'\nimport styled from 'styled-components'\nimport { sanitize } from '../../shared/sanitizer'\n\nconst HeaderTitle = styled.h1`\n ${(props) => getCustomClassOverrides(props)} {\n font-style: normal;\n font-weight: 700;\n font-size: ${(props) => (props.size == 'small' ? '15px' : '18px')};\n line-height: ${(props) => (props.size == 'small' ? '22px' : '24px')};\n letter-spacing: 0.36px;\n display: flex;\n align-items: center;\n margin-bottom: 4px;\n color: ${(props) => props.appearance.theme.colorText};\n }\n`\n\nconst HeaderSubtitle = styled.h2`\n ${(props) => getCustomClassOverrides(props)} {\n font-style: normal;\n font-weight: 400;\n font-size: 14px;\n line-height: 22px;\n letter-spacing: 0.28px;\n color: ${(props) => props.appearance.theme.colorTextSecondary};\n }\n`\n\nexport function TitleSubtitle({\n appearance,\n title,\n subtitle,\n size = 'medium',\n classPrefix = '',\n ariaPrefix = '',\n}: {\n appearance: Appearance\n title: string\n subtitle?: string\n size?: 'small' | 'medium' | 'large'\n classPrefix?: string\n ariaPrefix?: string\n}) {\n return (\n <>\n <HeaderTitle\n appearance={appearance}\n id={ariaPrefix ? `frigade${ariaPrefix}Title` : 'frigadeTitle'}\n className={getClassName(\n `${classPrefix}${classPrefix ? ucFirst(size) : size}Title`,\n appearance\n )}\n dangerouslySetInnerHTML={sanitize(title)}\n size={size}\n />\n {subtitle && (\n <HeaderSubtitle\n id={ariaPrefix ? `frigade${ariaPrefix}Subtitle` : 'frigadeSubtitle'}\n appearance={appearance}\n className={getClassName(\n `${classPrefix}${classPrefix ? ucFirst(size) : size}Subtitle`,\n appearance\n )}\n dangerouslySetInnerHTML={sanitize(subtitle)}\n size={size}\n />\n )}\n </>\n )\n}\n","import * as React from 'react'\n\nexport const Warning = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={12}\n height={12}\n aria-hidden=\"true\"\n viewBox=\"0 0 16 16\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n d=\"m10.115 1.308 5.635 11.269A2.365 2.365 0 0 1 13.634 16H2.365A2.365 2.365 0 0 1 .25 12.577L5.884 1.308a2.365 2.365 0 0 1 4.231 0zM8 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM8 9c.552 0 1-.32 1-.714V4.714C9 4.32 8.552 4 8 4s-1 .32-1 .714v3.572C7 8.68 7.448 9 8 9z\"\n />\n </svg>\n)\n","import styled from 'styled-components'\n\nexport const FormCTAContainer = styled.div`\n align-items: center;\n display: flex;\n justify-content: ${(props) => (props.showBackButton ? 'space-between' : 'flex-end')};\n padding-top: 14px;\n`\n\nexport const FormCTAError = styled.div`\n color: ${(props) => props.appearance.theme.colorTextError};\n font-size: 12px;\n`\n\nexport const CTAWrapper = styled.div`\n display: flex;\n gap: 12px;\n width: 100%;\n justify-content: flex-end;\n`\nexport const FormContainer = styled.div`\n display: flex;\n // If type is set to large-modal, use padding 60px horizontal, 80px vertical\n // Otherwise, use 4px padding\n flex-direction: column;\n flex-grow: 1;\n flex-basis: 0;\n position: relative;\n`\n\nexport const FormContainerWrapper = styled.div`\n padding: ${(props) => (props.type === 'large-modal' ? '50px' : '0px')};\n position: relative;\n overflow-y: auto;\n`\n\nexport const FormContainerSidebarImage = styled.div`\n display: flex;\n align-self: stretch;\n flex-grow: 1;\n flex-basis: 0;\n // If props.image is set, use it as the background image\n background-image: ${(props) => (props.image ? `url(${props.image})` : 'none')};\n // scale background image to fit\n background-size: contain;\n background-position: center;\n border-top-right-radius: ${(props) => props.appearance.theme.borderRadius}px;\n border-bottom-right-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\n","import React, { FC } from 'react'\nimport { FrigadeFormType } from './index'\nimport { Button } from '../components/Button'\nimport { getClassName } from '../shared/appearance'\nimport { Appearance, StepData } from '../types'\nimport { CTAWrapper, FormCTAContainer, FormCTAError } from './styled'\n\ninterface FormFooterProps {\n step: StepData\n canContinue: boolean\n appearance: Appearance\n onPrimaryClick: () => void\n onSecondaryClick: () => void\n onBack: () => void\n formType: FrigadeFormType\n steps: StepData[]\n selectedStep: number\n allowBackNavigation: boolean\n errorMessage?: string\n isSaving?: boolean\n}\n\nexport const FormFooter: FC<FormFooterProps> = ({\n step,\n canContinue,\n appearance,\n onPrimaryClick,\n onSecondaryClick,\n selectedStep,\n steps,\n onBack,\n allowBackNavigation,\n errorMessage,\n isSaving,\n}) => {\n const showBackButton = steps.length > 1 && selectedStep != 0 && allowBackNavigation\n const buttonType =\n (step.primaryButtonTitle && step.secondaryButtonTitle) || showBackButton\n ? 'inline'\n : 'full-width'\n\n return (\n <>\n {errorMessage !== null && errorMessage != undefined && (\n <FormCTAError appearance={appearance} className={getClassName('formCTAError', appearance)}>\n {errorMessage}\n </FormCTAError>\n )}\n <FormCTAContainer\n showBackButton={showBackButton}\n className={getClassName('formCTAContainer', appearance)}\n >\n {showBackButton && (\n <Button\n title={step.backButtonTitle ?? 'Back'}\n onClick={onBack}\n secondary={true}\n withMargin={false}\n type={buttonType}\n appearance={appearance}\n style={{ width: '90px', maxWidth: '90px' }}\n classPrefix=\"back\"\n />\n )}\n <CTAWrapper className={getClassName('ctaWrapper', appearance)}>\n {step.secondaryButtonTitle ? (\n <Button\n title={step.secondaryButtonTitle}\n onClick={onSecondaryClick}\n secondary={true}\n withMargin={false}\n type={buttonType}\n appearance={appearance}\n disabled={isSaving}\n />\n ) : null}{' '}\n {step.primaryButtonTitle ? (\n <Button\n disabled={!canContinue}\n withMargin={false}\n title={step.primaryButtonTitle}\n onClick={onPrimaryClick}\n type={buttonType}\n appearance={appearance}\n loading={isSaving}\n />\n ) : null}\n </CTAWrapper>\n </FormCTAContainer>\n </>\n )\n}\n","import React, { CSSProperties, FC } from 'react'\nimport styled from 'styled-components'\nimport { Appearance } from '../../types'\nimport {\n getClassName,\n getCustomClassOverrides,\n styleOverridesToCSS,\n ucFirst,\n} from '../../shared/appearance'\nimport { Spinner } from '../Spinner'\nimport { sanitize } from '../../shared/sanitizer'\n\ninterface ButtonProps {\n onClick?: () => void\n title?: string\n style?: CSSProperties\n textStyle?: CSSProperties\n disabled?: boolean\n type?: 'full-width' | 'inline'\n secondary?: boolean\n appearance?: Appearance\n withMargin?: boolean\n size?: 'small' | 'medium' | 'large'\n classPrefix?: string\n loading?: boolean\n autoFocus?: boolean\n}\n\nconst ButtonContainer = styled.button`\n justify-content: center;\n align-content: center;\n align-items: center;\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n // Anything inside this block will be ignored if the user provides a custom class\n width: ${(props) => (props.type === 'full-width' ? '100%' : 'auto')};\n // Only add margin if prop withMargin is true\n ${(props) => (props.withMargin ? 'margin: 16px 0px 16px 0px;' : '')}\n\n border: 1px solid ${(props) =>\n props.secondary ? '#C5CBD3' : props?.appearance?.theme?.colorPrimary};\n color: ${(props) =>\n props.secondary\n ? props.appearance?.theme?.colorText\n : props.appearance?.theme?.colorTextOnPrimaryBackground};\n background-color: ${(props) =>\n props.secondary\n ? props.appearance?.theme?.colorBackground\n : props?.appearance?.theme?.colorPrimary};\n border-radius: ${(props) => props.appearance?.theme?.borderRadius}px;\n padding: ${(props) => (props.size == 'small' ? '6px 14px 6px 14px' : '8px 20px 8px 20px')};\n font-size: ${(props) => (props.size == 'small' ? '14px' : '15px')};\n line-height: 20px;\n font-weight: 500;\n ${(props) => styleOverridesToCSS(props)}\n }\n\n font-family: inherit;\n\n cursor: pointer;\n :hover {\n opacity: ${(props) => (props.loading == 'true' ? '1.0' : '0.8')};\n }\n\n :disabled {\n opacity: ${(props) => (props.loading == 'true' ? '1.0' : '0.3')};\n cursor: not-allowed;\n }\n`\n\nexport const MultipleButtonContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n margin-top: 8px;\n\n & > * {\n margin-right: 8px;\n }\n }\n`\n\nexport const Button: FC<ButtonProps> = ({\n onClick,\n title,\n style,\n disabled,\n type = 'inline',\n size = 'medium',\n secondary = false,\n appearance,\n withMargin = true,\n classPrefix = '',\n loading = false,\n}) => {\n function getClassNameWithPrefix() {\n const name = secondary ? 'buttonSecondary' : 'button'\n if (classPrefix === '') {\n return name\n }\n\n return `${classPrefix}${ucFirst(name)}`\n }\n\n const commonProps = {\n tabindex: secondary ? '0' : '1',\n secondary,\n appearance,\n disabled: disabled || loading,\n loading: loading?.toString() ?? '',\n onClick,\n styleOverrides: style,\n type,\n withMargin,\n size,\n className: getClassName(getClassNameWithPrefix(), appearance),\n }\n\n if (!loading) {\n return (\n <ButtonContainer {...commonProps} dangerouslySetInnerHTML={sanitize(title ?? `Continue`)} />\n )\n }\n\n return (\n <ButtonContainer {...commonProps}>\n <Spinner className={getClassName('buttonLoader', appearance)} />\n </ButtonContainer>\n )\n}\n","import styled from 'styled-components'\n\nexport const Spinner = styled.div`\n width: 24px;\n height: 24px;\n border: 3px solid rgba(255, 255, 255, 0.25);\n border-bottom-color: #fff;\n border-radius: 50%;\n display: inline-block;\n box-sizing: border-box;\n animation: rotation 0.75s linear infinite;\n\n @keyframes rotation {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n`\n","import React, { FC } from 'react'\nimport styled from 'styled-components'\n\nimport { useTheme } from '../hooks/useTheme'\nimport { Appearance } from '../types'\n\nconst Wrapper = styled.div`\n text-align: center;\n color: #e6e6e6;\n`\n\ninterface FormPaginationProps {\n stepCount: number\n currentStep: number\n appearance: Appearance\n className?: string\n}\n\nexport const FormPagination: FC<FormPaginationProps> = ({\n stepCount = 0,\n currentStep = 0,\n className,\n appearance,\n}) => {\n const { theme } = useTheme().mergeAppearanceWithDefault(appearance)\n\n return (\n <Wrapper className={className}>\n <svg\n width={16 * stepCount - 8}\n height={8}\n viewBox={`0 0 ${16 * stepCount - 8} 8`}\n fill=\"none\"\n >\n {Array(stepCount)\n .fill(null)\n .map((_, idx) => (\n <rect\n key={idx}\n x={16 * idx}\n y={0}\n width={8}\n height={8}\n rx={4}\n fill={currentStep === idx ? theme.colorPrimary : 'currentColor'}\n />\n ))}\n </svg>\n </Wrapper>\n )\n}\n","import React from 'react'\nimport styled from 'styled-components'\nimport { CustomFormTypeProps } from '../../../FrigadeForm/types'\nimport { useCTAClickSideEffects } from '../../../hooks/useCTAClickSideEffects'\nimport { sanitize } from '../../../shared/sanitizer'\n\ninterface Link {\n title?: string\n uri?: string\n uriTarget?: string\n imageUri?: string\n}\n\n// create flex that wraps if not enoug space\nconst LinkContainer = styled.div`\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n`\n\nconst Link = styled.div`\n align-content: center;\n align-items: center;\n display: flex;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n margin: 15px;\n padding: 20px;\n flex-basis: 255px;\n flex-grow: 0;\n flex-shrink: 0;\n`\n\nconst LinkIcon = styled.img`\n width: 78px;\n height: auto;\n`\n\nconst LinkTitle = styled.button`\n font-style: normal;\n font-weight: 600;\n font-size: 13px;\n line-height: 16px;\n\n display: flex;\n align-items: center;\n text-align: center;\n border: 1px solid;\n border-radius: 100px;\n padding: 8px 12px;\n margin-top: 16px;\n`\n\nconst HeaderTitle = styled.h1`\n font-weight: 700;\n font-size: 28px;\n line-height: 34px;\n`\n\nconst HeaderSubtitle = styled.h2`\n font-style: normal;\n font-weight: 400;\n font-size: 16px;\n line-height: 24px;\n color: #7e7e7e;\n margin-top: 12px;\n margin-bottom: 16px;\n max-width: 70%;\n`\n\nexport function LinkCollectionStepType({ stepData, appearance }: CustomFormTypeProps) {\n const { handleUrl } = useCTAClickSideEffects()\n\n return (\n <div>\n <HeaderTitle dangerouslySetInnerHTML={sanitize(stepData.title)} />\n <HeaderSubtitle dangerouslySetInnerHTML={sanitize(stepData.subtitle)} />\n <LinkContainer>\n {stepData.props?.links?.map((link: Link) => (\n <Link key={link.title}>\n <LinkIcon src={link.imageUri} />\n <LinkTitle\n style={{\n borderColor: appearance.theme.colorPrimary,\n color: appearance.theme.colorPrimary,\n }}\n onClick={() => {\n if (link.uri) {\n handleUrl(link.uri, link.uriTarget ?? '_blank')\n }\n }}\n >\n {link.title}\n </LinkTitle>\n </Link>\n ))}\n </LinkContainer>\n </div>\n )\n}\n","import { StepData } from '../types'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { useContext } from 'react'\n\nexport function useCTAClickSideEffects() {\n const context = useContext(FrigadeContext)\n\n function primaryCTAClickSideEffects(step: StepData) {\n handleUrl(step.primaryButtonUri, step.primaryButtonUriTarget)\n }\n\n function secondaryCTAClickSideEffects(step: StepData) {\n handleUrl(step.secondaryButtonUri, step.secondaryButtonUriTarget)\n }\n\n function handleUrl(url?: string, target?: string) {\n if (!url) {\n return\n }\n // Check if url starts with http -- if so, default to _blank otherwise default to _self\n let updatedTarget = url.startsWith('http') ? '_blank' : '_self'\n\n if (target && target !== '_blank') {\n updatedTarget = '_self'\n }\n context.navigate(url, updatedTarget)\n }\n\n return {\n primaryCTAClickSideEffects,\n secondaryCTAClickSideEffects,\n handleUrl,\n }\n}\n","import React, { useEffect } from 'react'\nimport styled from 'styled-components'\nimport { CustomFormTypeProps, FormInputType } from '../../../FrigadeForm/types'\nimport { getClassName, getCustomClassOverrides } from '../../../shared/appearance'\nimport { TitleSubtitle } from '../../TitleSubtitle/TitleSubtitle'\nimport { VideoCard } from '../../Video/VideoCard'\n\ninterface CallToActionStepProps {\n data?: FormInputType[]\n}\n\n// create flex that wraps if not enoug space\nconst CallToActionStepContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n`\n\nconst CallToActionImage = styled.img`\n ${(props) => getCustomClassOverrides(props)} {\n width: 100%;\n height: auto;\n max-height: 250px;\n margin-bottom: 24px;\n }\n`\n\nconst CallToActionTextContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n margin-bottom: 24px;\n }\n`\n\nconst CallToActionVideo = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n width: 100%;\n height: auto;\n max-height: 250px;\n margin-bottom: 24px;\n }\n`\n\nexport function CallToActionStepType({\n stepData,\n appearance,\n setCanContinue,\n}: CustomFormTypeProps) {\n useEffect(() => {\n setCanContinue(true)\n }, [])\n\n return (\n <CallToActionStepContainer className={getClassName('callToActionContainer', appearance)}>\n <CallToActionTextContainer className={getClassName('callToActionTextContainer', appearance)}>\n <TitleSubtitle\n appearance={appearance}\n title={stepData.title}\n subtitle={stepData.subtitle}\n />\n </CallToActionTextContainer>\n {stepData.imageUri && (\n <CallToActionImage\n className={getClassName('callToActionImage', appearance)}\n src={stepData.imageUri}\n />\n )}\n {!stepData.imageUri && stepData.videoUri && (\n <CallToActionVideo\n appearance={appearance}\n className={getClassName('callToActionVideo', appearance)}\n >\n <VideoCard\n appearance={appearance}\n videoUri={stepData.videoUri}\n autoplay={stepData.props?.autoplayVideo}\n loop={stepData.props?.loopVideo}\n hideControls={stepData.props?.hideVideoControls}\n />\n </CallToActionVideo>\n )}\n </CallToActionStepContainer>\n )\n}\n","import React, { CSSProperties } from 'react'\n\nexport const Play = ({\n style,\n className,\n}: {\n color?: string\n style?: CSSProperties\n className?: string\n}) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={1.5}\n stroke=\"currentColor\"\n className={className}\n style={style}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" />\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n)\n","import { Play } from '../Icons/Play'\nimport { Appearance } from '../../types'\nimport React, { useRef, useState } from 'react'\nimport styled from 'styled-components'\nimport { getClassName } from '../../shared/appearance'\n\nconst VideoPlayerWrapper = styled.div`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n`\n\nconst PlayIconWrapper = styled.div`\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n cursor: pointer;\n :hover {\n opacity: 0.6;\n }\n z-index: 10;\n\n > svg {\n width: 40px;\n height: 40px;\n color: ${(props) => props.appearance.theme.colorBackground};\n box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);\n border-radius: 50%;\n }\n`\nconst Video = styled.video`\n width: 100%;\n height: 100%;\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\nconst YouTubeVideoSource = styled.iframe`\n width: 100%;\n height: 100%;\n min-height: 260px;\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\n\nconst VimeoVideoSource = styled.iframe`\n width: 100%;\n height: 100%;\n min-height: 400px;\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\nconst WistiaVideoSource = styled.iframe`\n width: 100%;\n height: 100%;\n min-height: 400px;\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\n\nexport function VideoCard({\n appearance,\n videoUri,\n autoplay = false,\n loop = false,\n hideControls = false,\n}: {\n appearance: Appearance\n videoUri: string\n autoplay?: boolean\n loop?: boolean\n hideControls?: boolean\n}) {\n // Create ref to use with videoplayer\n\n const ref = useRef<any>()\n\n const [isPlaying, setIsPlaying] = useState(autoplay)\n\n if (videoUri.includes('youtube')) {\n let videoId = videoUri.split('v=')[1]\n const ampersandPosition = videoId.indexOf('&')\n if (ampersandPosition !== -1) {\n videoId = videoId.substring(0, ampersandPosition)\n }\n return (\n <YouTubeVideoSource\n width=\"100%\"\n height=\"100%\"\n src={`https://www.youtube.com/embed/${videoId}`}\n frameBorder=\"0\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n appearance={appearance}\n className={getClassName('youtubePlayer', appearance)}\n />\n )\n }\n // Check if vimeo\n if (videoUri.includes('vimeo')) {\n let videoId = videoUri.split('vimeo.com/')[1]\n const ampersandPosition = videoId.indexOf('&')\n if (ampersandPosition !== -1) {\n videoId = videoId.substring(0, ampersandPosition)\n }\n return (\n <VimeoVideoSource\n width=\"100%\"\n height=\"100%\"\n src={`https://player.vimeo.com/video/${videoId}`}\n frameBorder=\"0\"\n allow=\"autoplay; fullscreen; picture-in-picture\"\n allowFullScreen\n appearance={appearance}\n className={getClassName('vimeoPlayer', appearance)}\n />\n )\n }\n // Check if wistia\n if (videoUri.includes('wistia')) {\n let videoId = videoUri.split('wistia.com/medias/')[1]\n const ampersandPosition = videoId.indexOf('&')\n if (ampersandPosition !== -1) {\n videoId = videoId.substring(0, ampersandPosition)\n }\n return (\n <WistiaVideoSource\n width=\"100%\"\n height=\"100%\"\n src={`https://fast.wistia.net/embed/iframe/${videoId}`}\n frameBorder=\"0\"\n allow=\"autoplay; fullscreen; picture-in-picture\"\n allowFullScreen\n appearance={appearance}\n className={getClassName('wistiaPlayer', appearance)}\n />\n )\n }\n\n return (\n <VideoPlayerWrapper\n className={getClassName('videoPlayerWrapper', appearance)}\n appearance={appearance}\n >\n {!isPlaying && (\n <PlayIconWrapper\n onClick={() => {\n setIsPlaying(true)\n ref.current.play()\n }}\n appearance={appearance}\n className={getClassName('playIconWrapper', appearance)}\n >\n <Play />\n </PlayIconWrapper>\n )}\n <Video\n appearance={appearance}\n controls={isPlaying && !hideControls}\n ref={ref}\n play={isPlaying}\n src={videoUri}\n autoPlay={autoplay}\n muted={autoplay}\n loop={loop}\n />\n </VideoPlayerWrapper>\n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { CheckBox } from '../../CheckBox'\nimport { getClassName } from '../../../shared/appearance'\nimport {\n ItemIcon,\n SelectItem,\n SelectItemLeft,\n SelectItemText,\n SelectListHeader,\n SelectListSelectionContainer,\n SelectListSubtitle,\n SelectListTitle,\n} from './styled'\nimport { CustomFormTypeProps, MultipleChoiceProps } from '../../../FrigadeForm/types'\n\nexport const SelectListStepType = ({\n stepData,\n setCanContinue,\n onSaveData,\n appearance,\n}: CustomFormTypeProps) => {\n const multipleChoiceProps = stepData.props as MultipleChoiceProps\n const [selectedIds, setSelectedIds] = useState<string[]>([])\n const [hasLoaded, setHasLoaded] = useState(false)\n const [lastStepId, setLastStepId] = useState(stepData.id)\n\n useEffect(() => {\n if (selectedIds.length == 0 && !hasLoaded) {\n setHasLoaded(true)\n onSaveData({ choice: [] })\n }\n }, [hasLoaded])\n\n useEffect(() => {\n if (lastStepId !== stepData.id) {\n setLastStepId(stepData.id)\n setSelectedIds([])\n }\n }, [stepData])\n\n useEffect(() => {\n onSaveData({ choice: selectedIds })\n if (selectedIds.length >= multipleChoiceProps.minChoices) {\n setCanContinue(true)\n } else {\n setCanContinue(false)\n }\n }, [selectedIds])\n\n return (\n <SelectListSelectionContainer className={getClassName('selectListContainer', appearance)}>\n <SelectListHeader>\n <SelectListTitle className={getClassName('selectListTitle', appearance)}>\n {stepData.title}\n </SelectListTitle>\n <SelectListSubtitle\n appearance={appearance}\n className={getClassName('selectListSubtitle', appearance)}\n >\n {stepData.subtitle}\n </SelectListSubtitle>\n </SelectListHeader>\n {multipleChoiceProps.options.map((option, idx) => {\n const isSelected = selectedIds.includes(option.id)\n return (\n <SelectItem\n key={`select-item-${idx}`}\n onClick={() => {\n // If the option is already selected, remove it from the selectedIds\n if (selectedIds.includes(option.id)) {\n setSelectedIds(selectedIds.filter((id) => id !== option.id))\n return\n }\n // Select the input if we are still under maxChoices\n if (selectedIds.length < multipleChoiceProps.maxChoices) {\n setSelectedIds([...selectedIds, option.id])\n } else {\n if (selectedIds.length == 1 && multipleChoiceProps.maxChoices == 1) {\n // deselect the input if we are at maxChoices and minChoices is 1\n setSelectedIds([option.id])\n }\n }\n }}\n hideBottomBorder={idx === multipleChoiceProps.options.length - 1}\n className={getClassName('selectListSelectItem', appearance)}\n >\n <SelectItemLeft className={getClassName('selectListItemImage', appearance)}>\n {option.imageUri && <ItemIcon src={option.imageUri} alt={`select-icon-${idx}`} />}\n <SelectItemText\n appearance={appearance}\n className={getClassName('selectListSelectItemText', appearance)}\n >\n {option.title}\n </SelectItemText>\n </SelectItemLeft>\n <CheckBox\n appearance={appearance}\n value={isSelected}\n primaryColor={appearance.theme.colorPrimary}\n />\n </SelectItem>\n )\n })}\n </SelectListSelectionContainer>\n )\n}\n","import styled from 'styled-components'\n\nexport const SelectListSelectionContainer = styled.div`\n width: auto;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 4px;\n`\n\nexport const SelectListHeader = styled.div`\n width: 100%;\n text-align: left;\n`\n\nexport const SelectListTitle = styled.h1<{ appearance }>`\n font-style: normal;\n font-weight: 700;\n font-size: 32px;\n line-height: 38px;\n color: ${(props) => props.appearance?.theme?.colorText};\n`\n\nexport const SelectListSubtitle = styled.h1<{ appearance }>`\n font-style: normal;\n font-weight: 400;\n font-size: 16px;\n line-height: 27px;\n margin-top: 16px;\n margin-bottom: 16px;\n color: ${(props) => props.appearance?.theme?.colorTextSecondary};\n`\n\nexport const SelectItem = styled.div<{ hideBottomBorder }>`\n padding-top: 12px;\n padding-bottom: 12px;\n flex-direction: row;\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n cursor: pointer;\n border-bottom: ${(props) => (props.hideBottomBorder ? 'none' : '1px solid #D8D8D8')};\n width: 100%;\n`\n\nexport const SelectItemLeft = styled.div`\n padding-top: 10px;\n padding-bottom: 10px;\n flex-direction: row;\n display: flex;\n justify-content: flex-start;\n`\n\nexport const ItemIcon = styled.img`\n width: 42px;\n height: 42px;\n margin-right: 12px;\n`\n\nexport const SelectItemText = styled.p`\n font-style: normal;\n font-weight: 500;\n font-size: 17px;\n line-height: 21px;\n color: ${(props) => props.appearance?.theme?.colorText};\n display: flex;\n align-self: center;\n`\n","import {\n FORM_DATA_KEY_PREFIX,\n MultiInputStepType,\n} from '../components/Forms/MultiInputStepType/MultiInputStepType'\nimport { Appearance, StepData } from '../types'\nimport { FormContainer, FormContainerSidebarImage, FormContainerWrapper } from './styled'\nimport { getClassName } from '../shared/appearance'\nimport { FormFooter } from './FormFooter'\nimport { FormPagination } from './FormPagination'\nimport { LinkCollectionStepType } from '../components/Forms/LinkCollectionStepType'\nimport { CallToActionStepType } from '../components/Forms/CallToActionStepType/CallToActionStepType'\nimport { SelectListStepType } from '../components/Forms/SelectListStepType/SelectListStepType'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { FrigadeFormProps, FrigadeFormType } from './index'\nimport React, { FC, useEffect, useState } from 'react'\nimport { CustomFormTypeProps, FormInputProps } from './types'\nimport { useFlows } from '../api/flows'\n\nconst AnimationWrapper = ({ children, id, shouldWrap = false }) => {\n return (\n <>\n {shouldWrap ? (\n <div\n key={id}\n style={{\n width: '100%',\n height: '100%',\n position: 'absolute',\n top: 0,\n left: 0,\n zIndex: 1,\n overflowY: 'auto',\n }}\n >\n {children}\n </div>\n ) : (\n children\n )}\n </>\n )\n}\n\ninterface FormContentProps extends FrigadeFormProps {\n appearance: Appearance\n steps: StepData[]\n selectedStep: number\n customStepTypes?: {\n [key: string]: ((params: CustomFormTypeProps) => React.ReactNode) | React.ReactNode\n }\n type: FrigadeFormType\n setShowModal: (showModal: boolean) => void\n setVisible?: (visible: boolean) => void\n showPagination?: boolean\n customFormElements?: { [key: string]: (params: FormInputProps) => React.ReactNode }\n allowBackNavigation: boolean\n}\nexport const FormContent: FC<FormContentProps> = ({\n appearance,\n steps,\n selectedStep,\n customStepTypes,\n customVariables,\n onButtonClick,\n onStepCompletion,\n flowId,\n type,\n hideOnFlowCompletion,\n onComplete,\n setVisible,\n setShowModal,\n onDismiss,\n showPagination = false,\n customFormElements,\n allowBackNavigation,\n validationHandler,\n onFormDataChange,\n showFooter,\n prefillData,\n updateUrlOnPageChange,\n repeatable,\n}) => {\n const DEFAULT_CUSTOM_STEP_TYPES = {\n linkCollection: LinkCollectionStepType,\n multiInput: MultiInputStepType,\n callToAction: CallToActionStepType,\n selectList: SelectListStepType,\n }\n\n const mergedCustomStepTypes = { ...DEFAULT_CUSTOM_STEP_TYPES, ...customStepTypes }\n const { primaryCTAClickSideEffects, secondaryCTAClickSideEffects } = useCTAClickSideEffects()\n\n const [canContinue, setCanContinue] = useState(false)\n const [formData, setFormData] = useState({})\n const [isSaving, setIsSaving] = useState(false)\n const [errorMessage, setErrorMessage] = useState<string | null | undefined>(null)\n\n const currentStep = steps[selectedStep] ?? null\n const {\n markStepCompleted,\n markStepStarted,\n isLoading,\n updateCustomVariables,\n markFlowCompleted,\n } = useFlows()\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n useEffect(() => {\n if (onFormDataChange) {\n onFormDataChange(formData, getDataPayload(), steps[selectedStep], selectedStep)\n }\n }, [formData])\n\n function getDataPayload() {\n const data = formData[steps[selectedStep].id] ?? {}\n return {\n data: data,\n stepId: steps[selectedStep].id,\n customVariables: customVariables,\n }\n }\n\n function handleStepCompletionHandlers(step: StepData, cta: 'primary' | 'secondary', idx: number) {\n const maybeNextStep = selectedStep + 1 < steps.length ? steps[selectedStep + 1] : null\n if (onStepCompletion) {\n onStepCompletion(step, idx, maybeNextStep, formData, getDataPayload())\n }\n if (onButtonClick) {\n return onButtonClick(step, selectedStep, cta, maybeNextStep)\n }\n return true\n }\n\n function updateData(step: StepData, data: object) {\n setFormData((prevState) => {\n let newObj = {}\n newObj[step.id] = data\n return {\n ...prevState,\n ...newObj,\n }\n })\n }\n\n function FormContainerSidebar(props: { selectedStep: StepData }) {\n if (props.selectedStep.imageUri) {\n return (\n <FormContainerSidebarImage\n image={props.selectedStep.imageUri}\n appearance={appearance}\n className={getClassName('formContainerSidebarImage', appearance)}\n />\n )\n }\n return null\n }\n\n const formFooter = showFooter && (\n <FormFooter\n step={steps[selectedStep]}\n canContinue={canContinue && !isSaving}\n formType={type}\n selectedStep={selectedStep}\n appearance={appearance}\n onPrimaryClick={async () => {\n setIsSaving(true)\n if (validationHandler) {\n const validationError = await validationHandler(\n steps[selectedStep],\n selectedStep,\n steps[selectedStep + 1],\n formData,\n getDataPayload()\n )\n if (validationError !== true) {\n // check if validation error is a string\n if (typeof validationError === 'string') {\n setErrorMessage(validationError)\n } else {\n setErrorMessage(null)\n }\n setIsSaving(false)\n return\n } else {\n setErrorMessage(null)\n }\n }\n const payload = { ...getDataPayload() }\n await markStepCompleted(flowId, steps[selectedStep].id, payload)\n if (\n selectedStep + 1 < steps.length &&\n // the url hash will control current step if allowBackNavigation is true\n !allowBackNavigation\n ) {\n await markStepStarted(flowId, steps[selectedStep + 1].id)\n }\n const shouldClose = handleStepCompletionHandlers(\n steps[selectedStep],\n 'primary',\n selectedStep\n )\n if (selectedStep + 1 >= steps.length) {\n if (onComplete) {\n onComplete()\n }\n if (onDismiss) {\n onDismiss()\n }\n if (hideOnFlowCompletion && shouldClose) {\n if (setVisible) {\n setVisible(false)\n }\n setShowModal(false)\n }\n await markFlowCompleted(flowId)\n if (repeatable) {\n // Set index back to 0\n await markStepStarted(flowId, steps[0].id)\n // Clear all cached form fill data\n if (typeof window !== 'undefined' && window.localStorage) {\n const localStorageKeys = Object.keys(window.localStorage)\n localStorageKeys.forEach((key) => {\n if (key.startsWith(FORM_DATA_KEY_PREFIX)) {\n window.localStorage.removeItem(key)\n }\n })\n }\n }\n }\n primaryCTAClickSideEffects(steps[selectedStep])\n setIsSaving(false)\n if (\n typeof window !== 'undefined' &&\n !allowBackNavigation &&\n updateUrlOnPageChange &&\n selectedStep + 1 < steps.length\n ) {\n // Update the current url with a query param p=stepId -- only use when allowbacknavigation is false\n const url = new URL(window.location.href)\n url.searchParams.set('p', steps[selectedStep + 1].id)\n window.history.pushState({}, '', url.toString())\n }\n }}\n onSecondaryClick={() => {\n handleStepCompletionHandlers(steps[selectedStep], 'secondary', selectedStep)\n secondaryCTAClickSideEffects(steps[selectedStep])\n }}\n onBack={async () => {\n if (selectedStep - 1 >= 0) {\n setIsSaving(true)\n await markStepStarted(flowId, steps[selectedStep - 1].id)\n setIsSaving(false)\n }\n }}\n steps={steps}\n allowBackNavigation={allowBackNavigation}\n errorMessage={errorMessage}\n isSaving={isSaving}\n />\n )\n\n return (\n <>\n <FormContainer className={getClassName('formContainer', appearance)}>\n <AnimationWrapper id={selectedStep} shouldWrap={type === 'large-modal'}>\n <FormContainerWrapper\n key={currentStep.id}\n type={type}\n className={getClassName('formContent', appearance)}\n >\n {steps.map((step) => {\n const StepComponent = mergedCustomStepTypes[step.type ?? 'multiInput']\n\n if (currentStep.id !== step.id) {\n return null\n }\n\n // Check if StepComponent is a function\n if (typeof StepComponent !== 'function') {\n return StepComponent\n }\n\n return (\n <StepComponent\n key={step.id}\n stepData={step}\n canContinue={canContinue}\n setCanContinue={setCanContinue}\n onSaveData={(data) => {\n updateData(step, data)\n }}\n appearance={appearance}\n customFormElements={customFormElements}\n flowId={flowId}\n prefillData={prefillData}\n />\n )\n })}\n {showPagination && (\n <FormPagination\n className={getClassName('formPagination', appearance)}\n appearance={appearance}\n stepCount={steps.length}\n currentStep={selectedStep}\n />\n )}\n {formFooter}\n </FormContainerWrapper>\n </AnimationWrapper>\n {type == 'large-modal' && <FormContainerSidebar selectedStep={steps[selectedStep]} />}\n </FormContainer>\n </>\n )\n}\n","import React from 'react'\nimport { Appearance } from '../types'\nimport { createGlobalStyle } from 'styled-components'\nimport { CUSTOM_CSS_STYLES_PREFIX, toKebabKey } from '../shared/appearance'\n\nconst GlobalStyleComponent = createGlobalStyle`\n${(props) =>\n props.inlineStyles\n .map(([key, value]) => {\n return `.${CUSTOM_CSS_STYLES_PREFIX}${key}.${CUSTOM_CSS_STYLES_PREFIX}${key} { ${Object.entries(\n value\n )\n .map(([key, value]) => {\n if (typeof value === 'object') {\n // This is a selector. Render it.\n return `${key} { ${Object.entries(value)\n .map(([nestedKey, nestedValue]) => {\n let kebabKey = toKebabKey(nestedKey)\n\n return `${kebabKey}: ${nestedValue};`\n })\n .join(' ')} }`\n }\n\n let kebabKey = toKebabKey(key)\n\n return `${kebabKey}: ${value};`\n })\n .join(' ')} }`\n })\n .join(' ')}`\n\nexport function RenderInlineStyles({ appearance }: { appearance?: Appearance }) {\n if (!appearance || !appearance.styleOverrides) {\n return <></>\n }\n const inlineStyles = Object.entries(appearance.styleOverrides).filter(([_, value]) => {\n return typeof value === 'object'\n })\n\n if (inlineStyles.length === 0) {\n return <></>\n }\n\n return <GlobalStyleComponent inlineStyles={inlineStyles} />\n}\n","import { useEffect, useState } from 'react'\nimport { NOT_STARTED_FLOW } from '../api/common'\nimport { useFlows } from '../api/flows'\n\nexport function useFlowImpressions(flowId: string, visible: boolean = true) {\n const [hasMarkedFlowStarted, setHasMarkedFlowStarted] = useState(false)\n const {\n markStepStarted,\n isLoading,\n getFlowStatus,\n getFlowSteps,\n getCurrentStepIndex,\n targetingLogicShouldHideFlow,\n getFlow,\n } = useFlows()\n const steps = getFlowSteps(flowId)\n\n async function markFlowStartedIfNeeded() {\n if (\n !hasMarkedFlowStarted &&\n !isLoading &&\n getFlowStatus(flowId) === NOT_STARTED_FLOW &&\n targetingLogicShouldHideFlow(getFlow(flowId)) === false &&\n visible &&\n steps &&\n steps.length > 0\n ) {\n setHasMarkedFlowStarted(true)\n await markStepStarted(flowId, steps[getCurrentStepIndex(flowId)].id)\n }\n }\n\n useEffect(() => {\n markFlowStartedIfNeeded()\n }, [isLoading, flowId, visible])\n\n return {}\n}\n","import React, { useCallback, useContext, useEffect } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { useCheckHasInitiatedAPI, useConfig, useGracefulFetch } from './common'\nimport { useUserFlowStates } from './user-flow-states'\nimport { GUEST_PREFIX } from './users'\nimport { EntityProperties } from '../FrigadeForm/types'\n\ninterface AddPropertyToOrganizationDTO {\n readonly foreignUserId: string\n readonly foreignUserGroupId: string\n readonly properties?: { [key: string]: string | boolean | number | null }\n readonly events?: OrganizationEvent[]\n}\n\ninterface OrganizationEvent {\n readonly event: string\n readonly properties?: { [key: string]: string | boolean | number | null }\n}\n\nexport function useOrganization(): {\n readonly organizationId: string | null\n readonly setOrganizationId: React.Dispatch<React.SetStateAction<string | null>>\n readonly setOrganizationIdWithProperties: (\n organizationId: string,\n properties?: EntityProperties\n ) => Promise<void>\n readonly addPropertiesToOrganization: (properties: EntityProperties) => Promise<void>\n readonly trackEventForOrganization: (\n event: string,\n properties?: EntityProperties\n ) => Promise<void>\n} {\n const {\n organizationId: organizationIdInternal,\n userId,\n setOrganizationId,\n } = useContext(FrigadeContext)\n const { mutateUserFlowState } = useUserFlowStates()\n const { config, apiUrl } = useConfig()\n const gracefullyFetch = useGracefulFetch()\n const { verifySDKInitiated } = useCheckHasInitiatedAPI()\n\n function getUserGroupKey(uId?: string, oId?: string) {\n return `frigade-user-group-registered-${uId}-${oId}`\n }\n\n useEffect(() => {\n // Check if user is not a guest\n\n if (userId && organizationIdInternal) {\n // Check if userid begins with the guest prefix\n if (userId.startsWith(GUEST_PREFIX)) {\n return\n }\n const userRegisteredKey = getUserGroupKey(userId, organizationIdInternal)\n // Check if user has already been registered in frigade\n if (!localStorage.getItem(userRegisteredKey)) {\n // Register user in frigade\n gracefullyFetch(`${apiUrl}userGroups`, {\n ...config,\n method: 'POST',\n body: JSON.stringify({\n foreignUserId: userId,\n foreignUserGroupId: organizationIdInternal,\n }),\n })\n // Mark user as registered in frigade\n localStorage.setItem(userRegisteredKey, 'true')\n }\n }\n }, [userId, organizationIdInternal])\n\n const addPropertiesToOrganization = useCallback(\n async (properties: EntityProperties) => {\n if (!verifySDKInitiated()) {\n return\n }\n if (!organizationIdInternal || !userId) {\n console.error(\n 'Cannot add properties to organization: Organization ID and User ID must both be set.',\n { organizationIdInternal, userId }\n )\n return\n }\n\n const data: AddPropertyToOrganizationDTO = {\n foreignUserId: userId,\n foreignUserGroupId: organizationIdInternal,\n properties,\n }\n await gracefullyFetch(`${apiUrl}userGroups`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n mutateUserFlowState()\n },\n [organizationIdInternal, userId, config, mutateUserFlowState]\n )\n\n const trackEventForOrganization = useCallback(\n async (event: string, properties?: EntityProperties) => {\n if (!verifySDKInitiated()) {\n return\n }\n if (!organizationIdInternal || !userId) {\n console.error(\n 'Cannot track event for organization: Organization ID and User ID must both be set.',\n { organizationIdInternal, userId }\n )\n return\n }\n const eventData: OrganizationEvent = {\n event,\n properties,\n }\n const data: AddPropertyToOrganizationDTO = {\n foreignUserId: userId,\n foreignUserGroupId: organizationIdInternal,\n events: [eventData],\n }\n await gracefullyFetch(`${apiUrl}userGroups`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n mutateUserFlowState()\n },\n [organizationIdInternal, userId, config, mutateUserFlowState]\n )\n\n const setOrganizationIdWithProperties = useCallback(\n async (organizationId: string, properties?: EntityProperties) => {\n if (!verifySDKInitiated()) {\n return\n }\n if (properties) {\n const userRegisteredKey = getUserGroupKey(userId, organizationId)\n localStorage.setItem(userRegisteredKey, 'true')\n setOrganizationId(organizationId)\n const data: AddPropertyToOrganizationDTO = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId,\n properties,\n }\n await gracefullyFetch(`${apiUrl}userGroups`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n mutateUserFlowState()\n } else {\n setOrganizationId(organizationId)\n }\n },\n [userId, config, mutateUserFlowState]\n )\n\n return {\n organizationId: organizationIdInternal,\n setOrganizationId,\n setOrganizationIdWithProperties,\n addPropertiesToOrganization,\n trackEventForOrganization,\n }\n}\n","import { deepmerge } from './deepmerge'\n\nconst THEME_MAP = {\n // { oldThemeKey: 'path.to.new.theme.token' }\n colorPrimary: 'colors.primary.background',\n colorText: 'colors.neutral.foreground',\n colorBackground: 'colors.neutral.background',\n colorBackgroundSecondary: 'colors.secondary.background',\n colorTextOnPrimaryBackground: 'colors.primary.foreground',\n colorTextSecondary: 'colors.secondary.foreground',\n colorTextDisabled: 'colors.gray700',\n colorBorder: 'colors.gray800',\n colorTextError: 'colors.negative.foreground',\n borderRadius: 'radii.lg',\n}\n\n// Convert appearance.theme prop (old) to theme tokens for overrides prop (new)\nfunction themeToTokens(theme) {\n if (!theme) return undefined\n\n const overrides = {}\n\n Object.entries(theme).forEach(([key, value]) => {\n if (THEME_MAP[key]) {\n // Step 1: 'foo.bar.baz' -> ['foo', 'bar', 'baz']\n const levels = THEME_MAP[key].split('.')\n\n // Step 2: ['foo', 'bar', 'baz'] -> { foo: { bar: { baz: value } } }\n let currentLevel = overrides\n levels.forEach((nextLevel, i) => {\n if (!currentLevel[nextLevel]) {\n currentLevel[nextLevel] = i === levels.length - 1 ? value : {}\n }\n\n currentLevel = currentLevel[nextLevel]\n })\n }\n })\n\n return overrides\n}\n\nfunction styleOverridesToCSS(styleOverrides) {\n // Walk overrides and convert them to CSS descendent selectors\n // ...that's pretty much it?\n if (!styleOverrides) return undefined\n\n // We don't want to reference the original object\n const copiedOverrides = deepmerge({}, styleOverrides)\n\n const css = {}\n\n Object.keys(copiedOverrides).forEach((oldSelector) => {\n const newSelector = `.fr-${oldSelector}`\n\n css[newSelector] = copiedOverrides[oldSelector]\n })\n\n return css\n}\n\nexport function appearanceToOverrides(appearance) {\n const { theme, styleOverrides } = appearance\n\n const overrides = themeToTokens(theme)\n const css = styleOverridesToCSS(styleOverrides)\n\n return {\n overrides,\n css,\n }\n}\n","import styled from 'styled-components'\nimport { compose, variant } from 'styled-system'\n\nimport { Box } from '../Box'\n\nexport const buttonVariants = {\n Primary: {\n backgroundColor: 'primary.background',\n color: 'primary.foreground',\n\n '&:hover': {\n backgroundColor: 'blue400',\n },\n },\n Secondary: {\n backgroundColor: 'white',\n border: '1px solid',\n borderColor: 'gray800',\n color: 'neutral.foreground',\n\n '&:hover': {\n backgroundColor: 'blue900',\n },\n },\n Link: {\n backgroundColor: 'transparent',\n color: 'primary.inverted',\n },\n Plain: {\n backgroundColor: 'transparent',\n color: 'neutral.foreground',\n },\n} as const\n\nexport const buttonSizes = {\n sm: {\n paddingX: 4,\n paddingY: 1,\n },\n md: {\n paddingX: 6,\n paddingY: 2,\n },\n}\n\nexport const StyledButton = styled(Box)(\n () => ({\n whiteSpace: 'nowrap',\n }),\n compose(\n variant({\n scale: 'components.Button',\n variants: 'components.Button',\n }),\n variant({\n prop: 'size',\n variants: buttonSizes,\n })\n )\n)\n\n// export type ButtonVariant = keyof typeof buttonVariants\n// export type ButtonSize = keyof typeof buttonSizes\n","import React, { ComponentPropsWithoutRef, CSSProperties, ElementType, ReactNode } from 'react'\nimport styled, { ThemeProvider, useTheme } from 'styled-components'\nimport {\n border,\n BorderProps,\n color,\n ColorProps,\n compose,\n get,\n LayoutProps,\n shadow,\n ShadowProps,\n space,\n SpaceProps,\n system,\n typography,\n TypographyProps,\n} from 'styled-system'\nimport { deepmerge } from '../../shared/deepmerge'\n\ninterface Overrides extends Record<string, Overrides | CSSProperties> {}\n\n// Drop the size property from layout props, it conflicts with our own size prop\n// SEE: https://github.com/styled-system/styled-system/blob/master/packages/layout/src/index.js\nconst layoutWithoutSize = {\n width: {\n property: 'width',\n scale: 'sizes',\n transform: (n, scale) =>\n get(scale, n, !(typeof n === 'number' && !isNaN(n)) || n > 1 ? n : n * 100 + '%'),\n },\n height: {\n property: 'height',\n scale: 'sizes',\n },\n minWidth: {\n property: 'minWidth',\n scale: 'sizes',\n },\n minHeight: {\n property: 'minHeight',\n scale: 'sizes',\n },\n maxWidth: {\n property: 'maxWidth',\n scale: 'sizes',\n },\n maxHeight: {\n property: 'maxHeight',\n scale: 'sizes',\n },\n overflow: true,\n overflowX: true,\n overflowY: true,\n display: true,\n verticalAlign: true,\n}\n\nexport type BoxProps<T extends ElementType = 'div'> = {\n as?: T\n css?: Record<string, any> // TODO: Fix any\n children?: ReactNode\n overrides?: Overrides\n} & BorderProps &\n ColorProps &\n Exclude<LayoutProps, 'size'> &\n ShadowProps &\n SpaceProps &\n TypographyProps &\n ComponentPropsWithoutRef<T>\n\nconst StyledBox = styled('div')(\n ({ css }) => css,\n compose(border, color, shadow, space, typography, system(layoutWithoutSize))\n)\n\nexport const Box = <T extends React.ElementType = 'div'>({\n as,\n children,\n overrides,\n ...rest\n}: BoxProps<T>) => {\n const theme = useTheme()\n\n const styleResetProps = {\n border: 'none',\n boxSizing: 'border-box',\n m: 0,\n p: 0,\n }\n\n const renderBox = () => (\n <StyledBox as={as} {...styleResetProps} {...rest}>\n {children}\n </StyledBox>\n )\n\n if (overrides !== undefined) {\n const newTheme = deepmerge(theme, overrides)\n\n return <ThemeProvider theme={newTheme}>{renderBox()}</ThemeProvider>\n }\n\n return renderBox()\n}\n","import styled from 'styled-components'\nimport { variant, system } from 'styled-system'\n\nimport { Box } from '../Box'\n\nexport const textVariants = {\n Display1: {\n fontSize: '5xl',\n fontWeight: 'bold',\n letterSpacing: 'md',\n lineHeight: '4xl',\n },\n Display2: {\n fontSize: '4xl',\n fontWeight: 'bold',\n letterSpacing: 'md',\n lineHeight: '3xl',\n },\n H1: {\n fontSize: '3xl',\n fontWeight: 'bold',\n letterSpacing: 'md',\n lineHeight: '2xl',\n },\n H2: {\n fontSize: '2xl',\n fontWeight: 'bold',\n letterSpacing: 'md',\n lineHeight: 'xl',\n },\n H3: {\n fontSize: 'xl',\n fontWeight: 'bold',\n letterSpacing: 'md',\n lineHeight: 'lg',\n },\n H4: {\n fontSize: 'lg',\n fontWeight: 'bold',\n letterSpacing: 'md',\n lineHeight: 'md',\n },\n Body1: {\n fontSize: 'md',\n fontWeight: 'regular',\n letterSpacing: 'md',\n lineHeight: 'md',\n },\n Body2: {\n fontSize: 'sm',\n fontWeight: 'regular',\n letterSpacing: 'md',\n lineHeight: 'md',\n },\n Caption: {\n fontSize: 'xs',\n fontWeight: 'regular',\n letterSpacing: 'md',\n lineHeight: 'sm',\n },\n} as const\n\nexport const fontWeights = {\n regular: 400,\n semibold: 600,\n bold: 700,\n}\n\nexport const StyledText = styled(Box)(\n variant({\n scale: 'components.Text',\n variants: 'components.Text',\n }),\n system({\n fontWeight: {\n property: 'fontWeight',\n scale: 'fontWeights',\n },\n })\n)\n","import { buttonVariants } from '../components/Button/Button.styles'\nimport { textVariants } from '../components/Text/Text.styles'\n\nconst SPACE_VALUE = 4\nconst SPACE_UNIT = 'px'\nconst SPACE_SCALE_EXTENT = 20\n\n// Fill an array with SPACE_SCALE_EXTENT multiples of SPACE_VALUE\nconst spaceScale = Object.fromEntries(\n Array.from(Array(SPACE_SCALE_EXTENT + 1), (_, i) => {\n // Just a cute lil' 0.5 space would you look at this tiny guy over here\n if (i === 0) {\n return [0.5, `${0.5 * SPACE_VALUE}${SPACE_UNIT}`]\n }\n\n return [i, `${i * SPACE_VALUE}${SPACE_UNIT}`]\n })\n)\n\nconst palette = {\n black: '#000000',\n gray100: '#14161A',\n gray200: '#181B20',\n gray300: '#1F2329',\n gray400: '#2E343D',\n gray500: '#4C5766',\n gray600: '#5A6472',\n gray700: '#C5CBD3',\n gray800: '#E2E5E9',\n gray900: '#F1F2F4',\n white: '#ffffff',\n blue400: '#015AC6',\n blue500: '#0171F8',\n blue800: '#DBECFF',\n blue900: '#F5F9FF',\n green400: '#009E37',\n green500: '#00D149',\n green800: '#DBFFE8',\n transparent: '#FFFFFF00',\n\n // This color isn't in the Design System yet, but it's used in old components\n red500: '#c00000',\n}\n\nexport const tokens = {\n colors: {\n ...palette,\n\n neutral: {\n foreground: palette.gray300,\n },\n primary: {\n background: palette.blue500,\n foreground: palette.white,\n inverted: palette.blue500,\n },\n negative: {\n foreground: palette.red500,\n },\n },\n fonts: {\n default: 'TT Interphases Pro, sans-serif',\n },\n fontSizes: {\n xs: '12px',\n sm: '14px',\n md: '16px',\n lg: '18px',\n xl: '20px',\n '2xl': '24px',\n '3xl': '30px',\n '4xl': '36px',\n '5xl': '48px',\n },\n fontWeights: {\n regular: 400,\n semibold: 500,\n bold: 700,\n },\n letterSpacings: {\n md: '0.02em',\n },\n lineHeights: {\n xs: '18px',\n sm: '22px',\n md: '24px',\n lg: '26px',\n xl: '30px',\n '2xl': '38px',\n '3xl': '46px',\n '4xl': '60px',\n },\n radii: {\n md: '8px',\n lg: '20px',\n round: '50%',\n },\n shadows: {\n md: '0px 4px 20px rgba(0, 0, 0, 0.06)',\n },\n space: spaceScale,\n components: {\n Button: buttonVariants,\n Text: textVariants,\n },\n}\n","import React, { CSSProperties } from 'react'\nimport { FrigadeChecklist } from '../../FrigadeChecklist'\nimport { HeroChecklistProps } from '../Checklists/HeroChecklist'\nimport { StepData } from '../../types'\n\nexport interface FrigadeHeroChecklistProps extends HeroChecklistProps {\n flowId: string\n title?: string\n subtitle?: string\n primaryColor?: string\n\n onCompleteStep?: (index: number, stepData: StepData) => void\n style?: CSSProperties\n // Optional props\n initialSelectedStep?: number\n\n className?: string\n}\n\nexport const FrigadeHeroChecklist: React.FC<FrigadeHeroChecklistProps> = (props) => {\n return <FrigadeChecklist type=\"inline\" {...props} />\n}\n","import React, { CSSProperties, useEffect, useState } from 'react'\n\nimport { useFlows } from '../api/flows'\nimport { HeroChecklist, HeroChecklistProps } from '../components/Checklists/HeroChecklist'\nimport { StepData } from '../types'\nimport { COMPLETED_FLOW, COMPLETED_STEP } from '../api/common'\nimport { useFlowOpens } from '../api/flow-opens'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\n\nimport { ChecklistWithGuide } from '../components/Checklists/ChecklistWithGuide'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { useTheme } from '../hooks/useTheme'\nimport { CondensedChecklist } from '../components/Checklists/CondensedChecklist'\nimport { Modal } from '../components/Modal'\nimport { CarouselChecklist } from '../components/Checklists/CarouselChecklist'\nimport { useFlowImpressions } from '../hooks/useFlowImpressions'\n\nexport interface FrigadeChecklistProps extends HeroChecklistProps {\n flowId: string\n title?: string\n subtitle?: string\n\n style?: CSSProperties\n // Optional props\n /** @ignore */\n initialSelectedStep?: number\n\n className?: string\n type?: 'inline' | 'modal'\n checklistStyle?: 'with-guide' | 'default' | 'condensed' | 'carousel'\n\n visible?: boolean\n setVisible?: (visible: boolean) => void\n\n onDismiss?: () => void\n\n /**\n * See https://docs.frigade.com/flows/dynamic-variables\n */\n customVariables?: { [key: string]: string | number | boolean }\n\n /** @ignore */\n guideFlowId?: string\n /** @ignore */\n guideTitle?: string\n\n autoExpandFirstIncompleteStep?: boolean\n autoExpandNextStep?: boolean\n}\n\nexport const FrigadeChecklist: React.FC<FrigadeChecklistProps> = ({\n flowId,\n title,\n subtitle,\n style,\n initialSelectedStep,\n className,\n type = 'inline',\n onDismiss,\n visible,\n customVariables,\n onStepCompletion,\n onButtonClick,\n appearance,\n hideOnFlowCompletion,\n setVisible,\n customStepTypes,\n checklistStyle = 'default',\n autoExpandFirstIncompleteStep,\n autoExpandNextStep,\n onComplete,\n ...guideProps\n}) => {\n const {\n getFlow,\n getFlowSteps,\n markStepCompleted,\n getStepStatus,\n getNumberOfStepsCompleted,\n isLoading,\n targetingLogicShouldHideFlow,\n updateCustomVariables,\n getFlowMetadata,\n isStepBlocked,\n getFlowStatus,\n hasActiveFullPageFlow,\n setHasActiveFullPageFlow,\n markStepStarted,\n getCurrentStepIndex,\n } = useFlows()\n const { primaryCTAClickSideEffects, secondaryCTAClickSideEffects } = useCTAClickSideEffects()\n const { getOpenFlowState, setOpenFlowState } = useFlowOpens()\n const [selectedStep, setSelectedStep] = useState(initialSelectedStep || 0)\n const [finishedInitialLoad, setFinishedInitialLoad] = useState(false)\n const showModal = visible === undefined ? getOpenFlowState(flowId) : visible\n const isModal = type === 'modal'\n const { mergeAppearanceWithDefault } = useTheme()\n const [initialCompleteState, setInitialCompleteState] = useState<string>(COMPLETED_FLOW)\n const flowStatus = getFlowStatus(flowId)\n\n useFlowImpressions(flowId, visible)\n\n const steps = getFlowSteps(flowId)\n const index = getCurrentStepIndex(flowId)\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n useEffect(() => {\n if (flowStatus && flowStatus !== initialCompleteState && flowStatus !== COMPLETED_FLOW) {\n setInitialCompleteState(flowStatus)\n }\n if (flowStatus && flowStatus === COMPLETED_FLOW && initialCompleteState !== COMPLETED_FLOW) {\n if (onComplete) {\n setInitialCompleteState(flowStatus)\n onComplete()\n }\n }\n }, [flowStatus])\n\n useEffect(() => {\n if (visible !== undefined) {\n if (isModal && visible === true) {\n setHasActiveFullPageFlow(true)\n } else if (isModal && visible === false) {\n setHasActiveFullPageFlow(false)\n }\n }\n }, [visible, setVisible, hasActiveFullPageFlow])\n\n useEffect(() => {\n if (selectedStep === index) {\n return\n }\n setSelectedStep(index)\n }, [index])\n\n if (isLoading) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (!steps || !steps.length) {\n return null\n }\n\n if (hideOnFlowCompletion === true && getFlowStatus(flowId) === COMPLETED_FLOW) {\n return null\n }\n\n const metaData = getFlowMetadata(flowId)\n if (metaData?.title) {\n title = metaData.title\n }\n if (metaData?.subtitle) {\n subtitle = metaData.subtitle\n }\n\n if (\n !finishedInitialLoad &&\n initialSelectedStep === undefined &&\n getNumberOfStepsCompleted(flowId) > 0\n ) {\n const firstIncompleteStep = steps.findIndex((step) => step.complete === false)\n setSelectedStep(firstIncompleteStep > -1 ? firstIncompleteStep : steps.length - 1)\n setFinishedInitialLoad(true)\n }\n\n function goToNextStepIfPossible() {\n if (selectedStep + 1 >= steps.length) {\n // If modal, close it\n if (isModal) {\n setOpenFlowState(flowId, false)\n }\n return\n }\n // Double check next step is not blocked\n if (isStepBlocked(flowId, steps[selectedStep + 1].id)) {\n return\n }\n\n setSelectedStep(selectedStep + 1)\n }\n\n function handleStepCompletionHandlers(\n step: StepData,\n cta: 'primary' | 'secondary' | 'link',\n idx: number\n ) {\n const maybeNextStep = selectedStep + 1 < steps.length ? steps[selectedStep + 1] : null\n if (onButtonClick) {\n const completion = onButtonClick(step, selectedStep, cta, maybeNextStep)\n if (completion === true && isModal) {\n handleClose()\n }\n }\n if (onStepCompletion) {\n onStepCompletion(step, idx, maybeNextStep)\n }\n if (!onStepCompletion && !onButtonClick && (step.primaryButtonUri || step.secondaryButtonUri)) {\n if (isModal) {\n handleClose()\n }\n }\n }\n\n function getSteps() {\n return steps.map((step: StepData, idx: number) => {\n return {\n ...step,\n handleSecondaryButtonClick: () => {\n // Default to skip behavior for secondary click but allow for override\n goToNextStepIfPossible()\n secondaryCTAClickSideEffects(step)\n if (step.skippable === true) {\n markStepCompleted(flowId, step.id, { skipped: true })\n }\n handleStepCompletionHandlers(step, 'secondary', idx)\n },\n handlePrimaryButtonClick: () => {\n if (\n (!step.completionCriteria &&\n (step.autoMarkCompleted || step.autoMarkCompleted === undefined)) ||\n (step.completionCriteria && step.autoMarkCompleted === true)\n ) {\n markStepCompleted(flowId, step.id)\n goToNextStepIfPossible()\n }\n handleStepCompletionHandlers(step, 'primary', idx)\n primaryCTAClickSideEffects(step)\n // If step is done, try to go to next step\n if (getStepStatus(flowId, step.id) === COMPLETED_STEP) {\n goToNextStepIfPossible()\n }\n },\n }\n })\n }\n\n function CommonDom() {\n return <RenderInlineStyles appearance={appearance} />\n }\n\n const commonProps = {\n steps: getSteps(),\n title,\n subtitle,\n primaryColor: appearance.theme.colorPrimary,\n appearance,\n customStepTypes,\n type,\n className,\n autoExpandFirstIncompleteStep,\n autoExpandNextStep,\n }\n\n function handleClose() {\n setOpenFlowState(flowId, false)\n if (onDismiss) {\n onDismiss()\n }\n if (setVisible) {\n setVisible(false)\n }\n }\n\n function getCarouselChecklist() {\n return (\n <>\n <CommonDom />\n <CarouselChecklist\n flowId={flowId}\n appearance={appearance}\n customVariables={customVariables}\n className={className}\n />\n </>\n )\n }\n\n function getCondensedChecklist() {\n return (\n <>\n <CommonDom />\n <CondensedChecklist\n visible={showModal}\n onClose={() => {\n handleClose()\n }}\n selectedStep={selectedStep}\n setSelectedStep={setSelectedStep}\n autoExpandNextStep={true}\n appearance={appearance}\n onButtonClick={onButtonClick}\n {...commonProps}\n />\n </>\n )\n }\n\n function getChecklistWithGuide() {\n const guideFlowId = guideProps.guideFlowId\n let guideFlowSteps\n if (guideFlowId) {\n const guideFlow = getFlow(guideFlowId)\n if (guideFlow) {\n guideFlowSteps = getFlowSteps(guideFlowId)\n }\n }\n\n return (\n <>\n <CommonDom />\n <ChecklistWithGuide\n visible={showModal}\n stepsTitle={metaData.stepsTitle ? metaData.stepsTitle : 'Your quick start guide'}\n onClose={() => {\n handleClose()\n }}\n selectedStep={selectedStep}\n setSelectedStep={setSelectedStep}\n guideData={guideFlowSteps}\n guideTitle={guideProps.guideTitle ?? 'Guide'}\n appearance={appearance}\n title={title}\n subtitle={subtitle}\n onGuideButtonClick={(step) => {\n handleStepCompletionHandlers(step, 'link', 0)\n }}\n customStepTypes={customStepTypes}\n {...commonProps}\n />\n </>\n )\n }\n\n function getDefaultChecklist() {\n const checklist = (\n <HeroChecklist\n flowId={flowId}\n style={style}\n selectedStep={selectedStep}\n setSelectedStep={setSelectedStep}\n appearance={appearance}\n type={type}\n {...commonProps}\n />\n )\n\n if (!isModal) {\n return (\n <>\n <CommonDom />\n {checklist}\n </>\n )\n }\n\n return (\n <Modal\n onClose={() => {\n handleClose()\n }}\n visible={showModal}\n appearance={appearance}\n style={{\n paddingTop: '0px',\n padding: '12px',\n paddingLeft: 0,\n }}\n >\n <CommonDom />\n {checklist}\n </Modal>\n )\n }\n\n switch (checklistStyle) {\n case 'condensed':\n return getCondensedChecklist()\n case 'with-guide':\n return getChecklistWithGuide()\n case 'default':\n return getDefaultChecklist()\n case 'carousel':\n return getCarouselChecklist()\n default:\n return getDefaultChecklist()\n }\n}\n","import React, { FC, useMemo, useState } from 'react'\n\nimport styled from 'styled-components'\nimport { StepChecklistItem } from './StepChecklistItem'\nimport { ProgressBar } from '../Checklist/ProgressBar'\nimport { Appearance, DefaultFrigadeFlowProps, StepData } from '../../../types'\nimport {\n HERO_STEP_CONTENT_TYPE,\n HeroStepContent,\n} from '../../checklist-step-content/HeroStepContent'\nimport { VIDEO_CAROUSEL_TYPE, VideoCarousel } from '../../checklist-step-content/VideoCarousel'\nimport {\n CODE_SNIPPET_CONTENT_TYPE,\n CodeSnippetContent,\n} from '../../checklist-step-content/CodeSnippetContent'\nimport { useTheme } from '../../../hooks/useTheme'\nimport { FrigadeChecklistProps } from '../../../FrigadeChecklist'\nimport { getClassName, styleOverridesToCSS } from '../../../shared/appearance'\nimport { sanitize } from '../../../shared/sanitizer'\n\nexport interface HeroChecklistProps extends Omit<DefaultFrigadeFlowProps, 'flowId'> {\n title?: string\n subtitle?: string\n /**\n * @deprecated Use `appearance` instead\n * @ignore\n */\n primaryColor?: string\n /** @ignore */\n steps?: StepData[]\n\n /** @ignore */\n selectedStep?: number\n /** @ignore */\n setSelectedStep?: (index: number) => void\n\n /**\n * Map of custom step types that the checklist supports. To use a custom steps in your checklist, see [Component Customization](/component/customization#customizing-frigade-components)\n */\n customStepTypes?: Record<\n string,\n ((stepData: StepData, appearance: Appearance) => React.ReactNode) | React.ReactNode\n >\n}\n\nconst HeroChecklistContainer = styled.div<{ appearance }>`\n display: flex;\n flex-direction: row;\n overflow: hidden;\n min-width: ${(props) => (props.type != 'modal' ? '600px' : '100%')};\n background: ${(props) => props.appearance?.theme.colorBackground};\n border-radius: ${(props) => props.appearance?.theme.borderRadius}px;\n ${(props) => styleOverridesToCSS(props)}\n`\n\nconst HeroChecklistTitle = styled.h1<{ appearance }>`\n font-size: 18px;\n font-style: normal;\n font-weight: 700;\n line-height: 24px;\n letter-spacing: 0.36px;\n color: ${(props) => props.appearance?.theme?.colorText};\n`\n\nconst HeroChecklistSubtitle = styled.h2`\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 22px;\n letter-spacing: 0.28px;\n color: ${(props) => props.appearance?.theme?.colorTextSecondary};\n margin: 10px 0px 0px 0px;\n`\n\nconst ChecklistHeader = styled.div`\n padding: 28px 0px 28px 28px;\n border-bottom: 1px solid ${(props) => props.appearance?.theme?.colorBorder};\n`\n\nconst ChecklistHeaderContainer = styled.div`\n flex: 1;\n`\n\nconst ChecklistStepsContainer = styled.div`\n list-style: none;\n padding: 0;\n margin: 0;\n cursor: pointer;\n min-width: 300px;\n`\n\nconst Divider = styled.div`\n width: 1px;\n margin-right: 40px;\n background: ${(props) => props.appearance?.theme?.colorBorder};\n`\n\nconst HeroChecklistStepContentContainer = styled.div`\n flex: 2;\n padding: 40px 40px 40px 0px;\n`\n\nconst HeroChecklist: FC<FrigadeChecklistProps> = ({\n title,\n subtitle,\n steps = [],\n style = {},\n selectedStep,\n setSelectedStep,\n className = '',\n customStepTypes = new Map(),\n appearance,\n type,\n}) => {\n const { mergeAppearanceWithDefault } = useTheme()\n appearance = mergeAppearanceWithDefault(appearance)\n\n const DEFAULT_CUSTOM_STEP_TYPES = {\n [HERO_STEP_CONTENT_TYPE]: HeroStepContent,\n [VIDEO_CAROUSEL_TYPE]: VideoCarousel,\n [CODE_SNIPPET_CONTENT_TYPE]: CodeSnippetContent,\n }\n\n const mergedCustomStepTypes = {\n ...DEFAULT_CUSTOM_STEP_TYPES,\n ...customStepTypes,\n }\n\n const [selectedStepInternal, setSelectedStepInternal] = useState(0)\n\n const selectedStepValue = selectedStep ?? selectedStepInternal\n const setSelectedStepValue = setSelectedStep ?? setSelectedStepInternal\n\n const completeCount = steps.filter((s) => s.complete === true).length\n\n const StepContent = useMemo(() => {\n if (!steps[selectedStepValue]?.type || !mergedCustomStepTypes[steps[selectedStepValue].type]) {\n return mergedCustomStepTypes[HERO_STEP_CONTENT_TYPE]\n }\n return mergedCustomStepTypes[steps[selectedStepValue].type]\n }, [selectedStepValue])\n\n return (\n <HeroChecklistContainer\n type={type}\n styleOverrides={style}\n className={className}\n appearance={appearance}\n >\n <ChecklistHeaderContainer\n className={getClassName('checklistHeaderContainer', appearance)}\n appearance={appearance}\n >\n <ChecklistHeader\n className={getClassName('checklistHeader', appearance)}\n appearance={appearance}\n >\n <HeroChecklistTitle\n className={getClassName('checklistTitle', appearance)}\n appearance={appearance}\n dangerouslySetInnerHTML={sanitize(title)}\n />\n <HeroChecklistSubtitle\n className={getClassName('checklistSubtitle', appearance)}\n appearance={appearance}\n dangerouslySetInnerHTML={sanitize(subtitle)}\n />\n <ProgressBar\n total={steps.length}\n count={completeCount}\n style={{ marginTop: '24px', paddingRight: `40px` }}\n appearance={appearance}\n />\n </ChecklistHeader>\n <ChecklistStepsContainer\n role=\"list\"\n className={getClassName('checklistStepsContainer', appearance)}\n >\n {steps.map((s: StepData, idx: number) => {\n return (\n <StepChecklistItem\n data={s}\n index={idx}\n key={s.id}\n listLength={steps.length}\n isSelected={idx === selectedStepValue}\n primaryColor={appearance.theme.colorPrimary}\n style={{ justifyContent: 'space-between' }}\n onClick={() => {\n setSelectedStepValue(idx)\n }}\n appearance={appearance}\n />\n )\n })}\n </ChecklistStepsContainer>\n </ChecklistHeaderContainer>\n <Divider appearance={appearance} className={getClassName('checklistDivider', appearance)} />\n <HeroChecklistStepContentContainer data-stepid={`${steps[selectedStepValue].id}`}>\n <StepContent appearance={appearance} stepData={steps[selectedStepValue]} />\n </HeroChecklistStepContentContainer>\n </HeroChecklistContainer>\n )\n}\n\nexport default HeroChecklist\n","import React, { CSSProperties, FC } from 'react'\nimport { CheckBoxRow } from '../../CheckBoxRow'\nimport { Appearance, StepData } from '../../../types'\nimport { ChecklistStepItem, StepItemSelectedIndicator } from './styled'\nimport { getClassName } from '../../../shared/appearance'\n\ninterface StepItemProps {\n data: StepData\n index: number\n listLength: number\n isSelected: boolean\n primaryColor: string\n style: CSSProperties\n onClick: () => void\n appearance: Appearance\n}\n\nexport const StepChecklistItem: FC<StepItemProps> = ({\n data,\n index,\n isSelected,\n primaryColor,\n style,\n onClick,\n appearance,\n}) => {\n return (\n <div\n style={{ position: 'relative', paddingLeft: '0px' }}\n onClick={() => {\n onClick()\n }}\n >\n {isSelected && (\n <StepItemSelectedIndicator\n className={getClassName('checklistStepItemSelectedIndicator', appearance)}\n layoutId=\"checklist-step-selected\"\n style={{ backgroundColor: appearance?.theme?.colorPrimary ?? primaryColor }}\n ></StepItemSelectedIndicator>\n )}\n <ChecklistStepItem\n className={getClassName('checklistStepItem', appearance)}\n key={`hero-checklist-step-${index}`}\n appearance={appearance}\n role=\"listitem\"\n >\n <CheckBoxRow\n value={data.complete}\n labelPosition=\"left\"\n label={data.stepName ?? data.title}\n style={style}\n primaryColor={appearance?.theme?.colorPrimary ?? primaryColor}\n appearance={appearance}\n />\n </ChecklistStepItem>\n </div>\n )\n}\n","import React, { CSSProperties, FC } from 'react'\nimport styled from 'styled-components'\nimport { CheckBox, CheckBoxType } from '../CheckBox'\nimport { Appearance } from '../../types'\nimport { getClassName, styleOverridesToCSS } from '../../shared/appearance'\nimport { RenderInlineStyles } from '../RenderInlineStyles'\nimport { sanitize } from '../../shared/sanitizer'\n\ninterface CheckBoxRowProps {\n label?: string\n value: boolean\n labelStyle?: CSSProperties\n labelPosition?: 'left' | 'right'\n style?: CSSProperties\n primaryColor?: string\n secondaryColor?: string\n checkBoxType?: CheckBoxType\n appearance?: Appearance\n}\n\nconst Label = styled.span`\n font-weight: 600;\n font-size: 14px;\n font-style: normal;\n line-height: 22px;\n letter-spacing: 0.28px;\n color: #4d4d4d;\n display: inline-block;\n vertical-align: middle;\n margin-left: 32px;\n padding-right: 12px;\n ${(props) => styleOverridesToCSS(props)}\n`\n\nconst CheckBoxRowContainer = styled.div`\n flex-direction: row;\n justify-content: space-between;\n display: flex;\n padding-top: 20px;\n padding-bottom: 20px;\n padding-right: 8px;\n width: 100%;\n ${(props) => styleOverridesToCSS(props)}\n`\n\nexport const CheckBoxRow: FC<CheckBoxRowProps> = ({\n label,\n value,\n labelStyle = {},\n labelPosition = 'right',\n style,\n primaryColor = '#000000',\n checkBoxType = 'round',\n appearance,\n}) => {\n return (\n <>\n <CheckBoxRowContainer\n className={getClassName('checklistStepsContainer', appearance)}\n appearance={appearance}\n styleOverrides={{ ...style }}\n >\n {labelPosition === 'left' && label && (\n <Label\n className={getClassName('checklistStepLabel', appearance)}\n styleOverrides={labelStyle}\n appearnace={appearance}\n dangerouslySetInnerHTML={sanitize(label)}\n />\n )}\n <CheckBox\n appearance={appearance}\n value={value}\n type={checkBoxType}\n label={label}\n primaryColor={primaryColor}\n />\n {labelPosition === 'right' && label && (\n <Label\n className={getClassName('checklistStepLabel', appearance)}\n styleOverrides={labelStyle}\n appearance={appearance}\n dangerouslySetInnerHTML={sanitize(label)}\n />\n )}\n </CheckBoxRowContainer>\n <RenderInlineStyles appearance={appearance} />\n </>\n )\n}\n","import styled from 'styled-components'\n\nexport const HeroChecklistStepContent = styled.div`\n font-weight: 700;\n font-size: 18px;\n line-height: 22px;\n`\n\nexport const HeroChecklistStepTitle = styled.p<{ appearance }>`\n font-weight: 600;\n font-size: 16px;\n line-height: 24px;\n margin: 20px 0px 0px 0px;\n letter-spacing: 0.32px;\n font-style: normal;\n color: ${(props) => props.appearance?.theme?.colorText};\n`\n\nexport const HeroChecklistStepSubtitle = styled.p<{ appearance }>`\n font-weight: 400;\n font-size: 14px;\n font-style: normal;\n line-height: 22px;\n max-width: 540px;\n letter-spacing: 0.28px;\n margin: 8px 0px 0px 0px;\n color: ${(props) => props.appearance?.theme?.colorTextSecondary};\n`\n\nexport const StepItemSelectedIndicator = styled.div`\n width: 6px;\n position: absolute;\n left: 0;\n height: 100%;\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n`\n\nexport const ChecklistStepItem = styled.div`\n flex-direction: row;\n justify-content: flex-start;\n border-bottom: 1px solid ${(props) => props.theme.colorBorder};\n padding-right: 16px;\n`\n","import React, { CSSProperties } from 'react'\nimport styled from 'styled-components'\nimport { Appearance } from '../../../types'\nimport { getClassName, styleOverridesToCSS } from '../../../shared/appearance'\nimport { ProgressBarBackground, ProgressBarFill } from './styled'\n\n// TODO: remove once secondary color is passed from theme\nconst PROGRESS_BAR_COLOR_STYLES = {\n backgroundColor: '#E6E6E6',\n}\n\nconst ProgressContainer = styled.div`\n display: flex;\n flex-direction: ${(props) => (props.textLocation == 'top' ? 'column' : 'row')};\n justify-content: flex-start;\n align-items: ${(props) => (props.textLocation == 'top' ? 'flex-end' : 'center')};\n width: 100%;\n\n ${(props) => styleOverridesToCSS(props)}\n`\nconst ProgressProgressBar = styled.div`\n flex-grow: 1;\n position: relative;\n ${(props) => (props.textLocation == 'top' ? `width: 100%;` : ``)}\n`\n\nconst StepText = styled.span<{ padding; appearance }>`\n font-weight: 600;\n font-size: 14px;\n line-height: 18px;\n padding-right: ${(props) => props.padding};\n margin-bottom: ${(props) => (props.textLocation == 'top' ? '8px' : '0px')};\n ${(props) => styleOverridesToCSS(props)}\n`\n\nconst progressBgStyle: CSSProperties = {\n position: 'relative',\n left: 0,\n top: 0,\n width: '100%',\n minWidth: '40px',\n height: '10px',\n borderRadius: '20px',\n}\n\nexport const ProgressBar = ({\n count,\n total,\n display = 'count',\n textLocation = 'left',\n style = {},\n textStyle = {},\n appearance,\n}: {\n count: number\n total: number\n bgColor?: string\n display?: 'count' | 'percent' | 'compact'\n textLocation?: 'top' | 'left'\n style?: CSSProperties\n textStyle?: CSSProperties\n appearance?: Appearance\n}) => {\n if (total === 0) {\n return <></>\n }\n\n if (Object.keys(textStyle).length === 0 && textStyle.constructor === Object) {\n textStyle = {\n color: appearance?.theme?.colorText,\n }\n }\n\n const fgWidth = count === 0 ? '10px' : `${(count / total) * 100}%`\n const barHeight = display === 'compact' ? '8px' : '10px'\n const percentComplete = Math.round((count / total) * 100)\n let padding = display === 'compact' ? '10px' : '14px'\n\n let stepText\n if (display === 'count' || display === 'compact') {\n stepText = `${count}/${total}`\n } else if (display === 'percent') {\n stepText = `${percentComplete}% complete`\n }\n if (textLocation === 'top') {\n padding = '0px'\n }\n\n return (\n <ProgressContainer\n className={getClassName('progressBarContainer', appearance)}\n textLocation={textLocation}\n styleOverrides={style}\n >\n <StepText\n className={getClassName('progressBarStepText', appearance)}\n styleOverrides={{\n ...textStyle,\n fontSize: display === 'compact' ? 12 : 14,\n fontWeight: 600,\n }}\n appearance={appearance}\n padding={padding}\n textLocation={textLocation}\n >\n {stepText}\n </StepText>\n <ProgressProgressBar\n textLocation={textLocation}\n className={getClassName('progressBar', appearance)}\n >\n <ProgressBarFill\n style={{\n zIndex: display == 'compact' ? 1 : 5,\n }}\n fgWidth={fgWidth}\n barHeight={barHeight}\n appearance={appearance}\n className={getClassName('progressBarFill', appearance)}\n />\n <ProgressBarBackground\n className={getClassName('progressBarBackground', appearance)}\n barHeight={barHeight}\n appearance={appearance}\n />\n </ProgressProgressBar>\n </ProgressContainer>\n )\n}\n","import styled from 'styled-components'\n\nexport const ChecklistTitle = styled.h1`\n display: flex;\n margin: 0;\n font-size: 18px;\n`\n\nexport const ChecklistSubtitle = styled.h2`\n font-size: 15px;\n color: #4d4d4d;\n`\n\nexport const ProgressBarFill = styled.div`\n position: absolute;\n left: 0;\n top: 0;\n height: ${(props) => props.barHeight};\n width: ${(props) => props.fgWidth};\n border-radius: 20px;\n background-color: ${(props) => props.theme.colorPrimary};\n transition: width 0.5s;\n`\nexport const ProgressBarBackground = styled.div`\n position: relative;\n left: 0;\n top: 0;\n width: 100%;\n min-width: 40px;\n height: ${(props) => props.barHeight};\n border-radius: 20px;\n background-color: ${(props) => props.theme.colorPrimary};\n opacity: 0.12;\n`\n","import { HeroChecklistStepContent } from '../Checklists/HeroChecklist/styled'\n\nimport React, { FC } from 'react'\nimport { StepContentProps } from '../../FrigadeForm/types'\nimport styled from 'styled-components'\nimport { TitleSubtitleWithCTA } from './shared/TitleSubtitleWithCTA'\nimport { VideoPlayer } from '../Video/VideoPlayer'\nimport { getClassName } from '../../shared/appearance'\n\nexport const HERO_STEP_CONTENT_TYPE = 'default'\nconst StepImage = styled.img`\n border-radius: ${(props) => props.appearance?.theme.borderRadius}px;\n width: 100%;\n height: auto;\n min-height: 200px;\n`\nexport const HeroStepContent: FC<StepContentProps> = ({ stepData, appearance }) => {\n if (stepData?.StepContent) {\n const Content: React.ReactNode = stepData.StepContent\n return <div>{Content}</div>\n }\n\n return (\n <HeroChecklistStepContent className={getClassName('checklistStepContent', appearance)}>\n {stepData.imageUri ? (\n <StepImage\n className={getClassName('checklistStepImage', appearance)}\n src={stepData.imageUri}\n appearance={appearance}\n />\n ) : null}\n {stepData.videoUri ? (\n <VideoPlayer\n videoUri={stepData.videoUri}\n appearance={appearance}\n autoplay={stepData.props?.autoplayVideo}\n loop={stepData.props?.loopVideo}\n hideControls={stepData.props?.hideVideoControls}\n />\n ) : null}\n <TitleSubtitleWithCTA stepData={stepData} appearance={appearance} />\n </HeroChecklistStepContent>\n )\n}\n","import React, { FC } from 'react'\nimport { StepContentProps } from '../../../FrigadeForm/types'\nimport { TitleSubtitle } from './TitleSubtitle'\nimport { CTA } from './CTA'\n\nexport const TitleSubtitleWithCTA: FC<StepContentProps> = ({ stepData, appearance }) => {\n return (\n <>\n <TitleSubtitle stepData={stepData} appearance={appearance} />\n <CTA stepData={stepData} appearance={appearance} />\n </>\n )\n}\n","import React, { FC } from 'react'\n\nimport {\n HeroChecklistStepSubtitle,\n HeroChecklistStepTitle,\n} from '../../Checklists/HeroChecklist/styled'\nimport { StepContentProps } from '../../../FrigadeForm/types'\nimport { sanitize } from '../../../shared/sanitizer'\nimport { getClassName } from '../../../shared/appearance'\n\nexport const TitleSubtitle: FC<StepContentProps> = ({ stepData, appearance }) => {\n return (\n <>\n <HeroChecklistStepTitle\n appearance={appearance}\n className={getClassName('checklistStepTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.title)}\n />\n <HeroChecklistStepSubtitle\n appearance={appearance}\n className={getClassName('checklistStepSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.subtitle)}\n />\n </>\n )\n}\n","import React, { FC } from 'react'\nimport { Button, MultipleButtonContainer } from '../../Button'\nimport { StepContentProps } from '../../../FrigadeForm/types'\nimport { getClassName } from '../../../shared/appearance'\n\nexport const CTA: FC<StepContentProps> = ({ stepData, appearance }) => {\n const handlePrimaryButtonClick = () => {\n if (stepData.handlePrimaryButtonClick) {\n stepData.handlePrimaryButtonClick()\n }\n }\n\n const handleSecondaryButtonClick = () => {\n if (stepData.handleSecondaryButtonClick) {\n stepData.handleSecondaryButtonClick()\n }\n }\n\n return (\n <MultipleButtonContainer className={getClassName('ctaContainer', appearance)}>\n <Button\n appearance={appearance}\n title={stepData.primaryButtonTitle}\n onClick={handlePrimaryButtonClick}\n />\n {stepData.secondaryButtonTitle && (\n <Button\n appearance={appearance}\n secondary\n title={stepData.secondaryButtonTitle}\n onClick={handleSecondaryButtonClick}\n style={{\n width: 'auto',\n marginRight: '12px',\n }}\n />\n )}\n </MultipleButtonContainer>\n )\n}\n","import React from 'react'\nimport { Appearance } from '../../types'\nimport { VideoCard } from './VideoCard'\n\nexport function VideoPlayer(props: {\n videoUri: string\n autoplay: boolean\n appearance?: Appearance\n loop?: boolean\n hideControls?: boolean\n}) {\n return (\n <VideoCard\n appearance={props.appearance}\n videoUri={props.videoUri}\n autoplay={props.autoplay}\n loop={props.loop}\n hideControls={props.hideControls}\n />\n )\n}\n","import React, { FC, useRef, useState } from 'react'\nimport styled from 'styled-components'\nimport { TitleSubtitleWithCTA } from './shared/TitleSubtitleWithCTA'\nimport { StepContentProps } from '../../FrigadeForm/types'\nimport { Play } from '../Icons/Play'\nimport { TitleSubtitle } from './shared/TitleSubtitle'\nimport { CTA } from './shared/CTA'\n\nconst VideoCarouselContainer = styled.div`\n display: block;\n`\n\nconst VideoList = styled.div`\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: flex-start;\n gap: 0px;\n align-items: center;\n align-content: center;\n margin-top: 24px;\n margin-bottom: 24px;\n`\n\nconst Video = styled.div`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n flex-direction: column;\n margin-right: 16px;\n`\n\nconst VideoSource = styled.video`\n width: 200px;\n height: 120px;\n`\n\nconst VideoTitle = styled.div`\n font-size: 14px;\n line-height: 20px;\n text-align: center;\n`\n\nconst PlayIconWrapper = styled.div`\n position: absolute;\n width: 200px;\n height: 120px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n :hover {\n opacity: 0.6;\n }\n z-index: 10;\n\n > svg {\n width: 40px;\n height: 40px;\n color: ${(props) => props.appearance.theme.colorBackground};\n box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);\n border-radius: 50%;\n }\n`\n\ninterface VideoMetadata {\n uri: string\n thumbnailUri?: string\n title?: string\n}\n\ninterface VideoCarouselProps {\n videos: VideoMetadata[]\n}\n\nexport const VIDEO_CAROUSEL_TYPE = 'videoCarousel'\n\nexport const VideoCarousel: FC<StepContentProps> = ({ stepData, appearance }) => {\n if (!stepData.props?.videos) {\n return (\n <VideoCarouselContainer>\n <TitleSubtitleWithCTA stepData={stepData} appearance={appearance} />\n </VideoCarouselContainer>\n )\n }\n\n function VideoCard({ video }: { video: VideoMetadata }) {\n // Create ref to use with videoplayer\n\n const ref = useRef<any>()\n\n const [isPlaying, setIsPlaying] = useState(false)\n\n return (\n <Video>\n {!isPlaying && (\n <PlayIconWrapper\n onClick={() => {\n setIsPlaying(true)\n ref.current.play()\n }}\n appearance={appearance}\n >\n <Play />\n </PlayIconWrapper>\n )}\n <VideoSource controls={isPlaying} ref={ref} play={isPlaying} src={video.uri} />\n <VideoTitle>{video.title}</VideoTitle>\n </Video>\n )\n }\n\n const videoProps = stepData.props as VideoCarouselProps\n\n if (videoProps.videos) {\n return (\n <VideoCarouselContainer>\n <TitleSubtitle stepData={stepData} appearance={appearance} />\n <VideoList>\n {videoProps.videos.map((video: VideoMetadata, idx: number) => (\n <span key={`${video.uri}-${idx}`}>\n <VideoCard video={video} />\n </span>\n ))}\n </VideoList>\n <CTA stepData={stepData} appearance={appearance} />\n </VideoCarouselContainer>\n )\n }\n return null\n}\n","import React, { FC } from 'react'\nimport styled from 'styled-components'\nimport { TitleSubtitleWithCTA } from './shared/TitleSubtitleWithCTA'\nimport { StepContentProps } from '../../FrigadeForm/types'\nimport { CTA } from './shared/CTA'\nimport { TitleSubtitle } from './shared/TitleSubtitle'\nimport { sanitize } from '../../shared/sanitizer'\nimport { getClassName } from '../../shared/appearance'\n\nconst CodeSnippetContainer = styled.div`\n display: block;\n`\n\n// Create a cool code snippet style that is dark background white text\nconst CodeSnippet = styled.pre`\n display: block;\n background-color: #2a2a2a;\n color: #f8f8f8;\n padding: 16px;\n border-radius: 6px;\n font-size: 14px;\n line-height: 20px;\n font-family: 'Source Code Pro', monospace;\n width: 600px;\n white-space: pre-wrap; /* css-3 */\n white-space: -moz-pre-wrap; /* Mozilla, since 1999 */\n white-space: -pre-wrap; /* Opera 4-6 */\n white-space: -o-pre-wrap; /* Opera 7 */\n word-wrap: break-word; /* Internet Explorer 5.5+ */\n margin-bottom: 24px;\n`\nconst CodeSnippetTitle = styled.div`\n font-size: 15px;\n line-height: 20px;\n margin-bottom: 12px;\n margin-top: 12px;\n`\n\nconst CodeSnippets = styled.div`\n margin-top: 24px;\n`\n\ninterface CodeSnippetMetadata {\n code?: string\n title?: string\n}\n\ninterface CodeSnippetProps {\n codeSnippets: CodeSnippetMetadata[]\n}\n\nexport const CODE_SNIPPET_CONTENT_TYPE = 'codeSnippet'\n\nexport const CodeSnippetContent: FC<StepContentProps> = ({ stepData, appearance }) => {\n if (!stepData.props?.codeSnippets) {\n return (\n <CodeSnippetContainer>\n <TitleSubtitleWithCTA stepData={stepData} appearance={appearance} />\n </CodeSnippetContainer>\n )\n }\n\n const codeProps = stepData.props as CodeSnippetProps\n\n if (codeProps.codeSnippets) {\n return (\n <CodeSnippetContainer className={getClassName('codeSnippetContainer', appearance)}>\n <TitleSubtitle stepData={stepData} appearance={appearance} />\n <CodeSnippets>\n {codeProps.codeSnippets.map((codeSnippet, index) => {\n return (\n <div key={index}>\n {codeSnippet.title ? (\n <CodeSnippetTitle dangerouslySetInnerHTML={sanitize(codeSnippet.title)} />\n ) : null}\n {codeSnippet.code ? <CodeSnippet>{codeSnippet.code}</CodeSnippet> : null}\n </div>\n )\n })}\n </CodeSnippets>\n <CTA stepData={stepData} appearance={appearance} />\n </CodeSnippetContainer>\n )\n }\n return null\n}\n","import React, { FC, useState } from 'react'\nimport { Button } from '../../Button'\nimport { CheckBox } from '../../CheckBox'\nimport { Chevron } from '../../Icons/Chevron'\nimport { StepData } from '../../../types'\nimport { ProgressBar } from '../Checklist/ProgressBar'\nimport { StepItemSelectedIndicator } from '../HeroChecklist/styled'\nimport {\n ChecklistContainer,\n ChecklistSubtitle,\n ChecklistTitle,\n ContainerStyle,\n HeaderContent,\n MultipleButtonContainer,\n ProgressBarContainer,\n ScrollContainer,\n StepContainer,\n StepListContainer,\n StepListItem,\n StepListItemRight,\n StepListStepName,\n StepsBody,\n StepsContainer,\n StepsHeader,\n StepsTitle,\n StepSubtitle,\n StepTitle,\n} from './styled'\nimport { CenterVertical } from '../../styled'\nimport { Modal } from '../../Modal'\nimport Guide, { GuideStepData } from '../../Guides/Guide'\nimport { getClassName } from '../../../shared/appearance'\nimport { ChecklistProps } from '../index'\nimport { sanitize } from '../../../shared/sanitizer'\n\nexport interface ChecklistWithGuideProps extends ChecklistProps {\n // Map from string to function with StepData returning React.ReactNode\n visible: boolean\n stepsTitle: string\n\n guideData?: GuideStepData[]\n guideTitle?: string\n\n onGuideButtonClick?: (stepData: StepData) => void\n}\n\nconst ChecklistWithGuide: FC<ChecklistWithGuideProps> = ({\n steps,\n title,\n subtitle,\n stepsTitle,\n\n visible,\n onClose,\n\n selectedStep,\n setSelectedStep,\n customStepTypes,\n\n appearance,\n\n guideData,\n guideTitle,\n\n onGuideButtonClick,\n}) => {\n const DefaultStepContent = ({ stepData, handleSecondaryCTAClick, handleCTAClick }) => {\n if (!stepData) return <></>\n\n return (\n <StepContainer\n className={getClassName('checklistStepContainer', appearance)}\n data-testid=\"checklistStepContainer\"\n >\n <StepTitle\n appearance={appearance}\n className={getClassName('checklistStepTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.title)}\n />\n <StepSubtitle\n appearance={appearance}\n className={getClassName('checklistStepSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.subtitle)}\n />\n <MultipleButtonContainer className={getClassName('checklistCTAContainer', appearance)}>\n {stepData.secondaryButtonTitle && (\n <Button\n title={stepData.secondaryButtonTitle}\n onClick={handleSecondaryCTAClick}\n appearance={appearance}\n secondary\n />\n )}\n <Button\n title={stepData.primaryButtonTitle}\n onClick={handleCTAClick}\n appearance={appearance}\n />\n </MultipleButtonContainer>\n </StepContainer>\n )\n }\n\n const DEFAULT_CUSTOM_STEP_TYPES = {\n default: (stepData: StepData) => {\n if (steps[selectedStepValue]?.StepContent) {\n const Content: React.ReactNode = steps[selectedStepValue].StepContent\n return <div>{Content}</div>\n }\n const currentStep = steps[selectedStepValue]\n\n const handleCTAClick = () => {\n if (currentStep.handlePrimaryButtonClick) {\n currentStep.handlePrimaryButtonClick()\n }\n }\n\n const handleSecondaryCTAClick = () => {\n if (currentStep.handleSecondaryButtonClick) {\n currentStep.handleSecondaryButtonClick()\n }\n }\n\n return (\n <DefaultStepContent\n stepData={stepData}\n handleCTAClick={handleCTAClick}\n handleSecondaryCTAClick={handleSecondaryCTAClick}\n />\n )\n },\n }\n\n const mergedCustomStepTypes = { ...DEFAULT_CUSTOM_STEP_TYPES, ...customStepTypes }\n\n const [selectedStepInternal, setSelectedStepInternal] = useState(0)\n\n const selectedStepValue = selectedStep ?? selectedStepInternal\n const setSelectedStepValue = setSelectedStep ?? setSelectedStepInternal\n\n const StepContent = () => {\n if (!steps) return <></>\n if (!steps[selectedStepValue]?.type || !mergedCustomStepTypes[steps[selectedStepValue].type]) {\n return mergedCustomStepTypes['default'](steps[selectedStepValue])\n }\n\n // check if mergedCustomStepTypes[steps[selectedStepValue].type] is a function\n if (typeof mergedCustomStepTypes[steps[selectedStepValue].type] !== 'function') {\n return mergedCustomStepTypes[steps[selectedStepValue].type]\n }\n\n return mergedCustomStepTypes[steps[selectedStepValue].type]({\n stepData: steps[selectedStepValue],\n primaryColor: appearance.theme.colorPrimary,\n })\n }\n\n const completeCount = steps.filter((s) => s.complete).length\n\n if (!visible) return <></>\n\n if (!appearance.theme.modalContainer) {\n if (appearance.theme.borderRadius) {\n ContainerStyle.borderRadius = appearance.theme.borderRadius + 'px'\n }\n appearance.theme.modalContainer = ContainerStyle\n }\n\n return (\n <Modal onClose={onClose} visible={visible} appearance={appearance}>\n <ChecklistContainer>\n <HeaderContent>\n <ChecklistTitle\n appearance={appearance}\n className={getClassName('checklistTitle', appearance)}\n >\n {title}\n </ChecklistTitle>\n <ChecklistSubtitle\n appearance={appearance}\n className={getClassName('checklistSubtitle', appearance)}\n >\n {subtitle}\n </ChecklistSubtitle>\n </HeaderContent>\n\n <ScrollContainer>\n {steps && steps.length > 0 && (\n <StepsContainer className={getClassName('stepsContainer', appearance)}>\n <StepsHeader>\n <div style={{ flex: 3 }}>\n <StepsTitle className={getClassName('stepsTitle', appearance)}>\n {stepsTitle}\n </StepsTitle>\n </div>\n <ProgressBarContainer>\n <ProgressBar\n style={{ width: '100%' }}\n count={completeCount}\n total={steps.length}\n appearance={appearance}\n />\n </ProgressBarContainer>\n </StepsHeader>\n <StepsBody>\n <StepListContainer\n className={getClassName('checklistStepListContainer', appearance)}\n appearance={appearance}\n >\n {steps.map((stepData: StepData, idx: number) => {\n const isSelected = selectedStepValue === idx\n return (\n <StepListItem\n selected={isSelected}\n className={getClassName(\n `checklistStepListItem${isSelected ? 'Selected' : ''}`,\n appearance\n )}\n key={`checklist-guide-step-${stepData.id ?? idx}`}\n disabled={stepData.blocked}\n onClick={() => {\n if (stepData.blocked) {\n return\n }\n setSelectedStepValue(idx)\n }}\n title={stepData.blocked ? 'Finish remaining steps to continue' : undefined}\n >\n {isSelected && (\n <StepItemSelectedIndicator\n className={getClassName(\n 'checklistStepItemSelectedIndicator',\n appearance\n )}\n layoutId=\"checklist-step-selected\"\n style={{\n backgroundColor: appearance.theme.colorPrimary,\n borderRadius: 0,\n height: '100%',\n top: '0%',\n width: '2px',\n }}\n ></StepItemSelectedIndicator>\n )}\n <StepListStepName\n selected={isSelected}\n className={getClassName(\n `checklistStepListStepName${isSelected ? 'Selected' : ''}`,\n appearance\n )}\n >\n {stepData.stepName}\n </StepListStepName>\n <StepListItemRight>\n <CheckBox\n value={stepData.complete}\n type=\"round\"\n primaryColor={appearance.theme.colorPrimary}\n progress={stepData.progress}\n appearance={appearance}\n />\n <CenterVertical>\n <Chevron\n style={{ marginLeft: '10px' }}\n color={appearance.theme.colorBackgroundSecondary}\n />\n </CenterVertical>\n </StepListItemRight>\n </StepListItem>\n )\n })}\n </StepListContainer>\n\n <StepContent />\n </StepsBody>\n </StepsContainer>\n )}\n {guideData && guideData.length > 0 && (\n <Guide\n steps={guideData}\n title={guideTitle}\n primaryColor={appearance.theme.colorPrimary}\n style={{\n border: 'none',\n boxShadow: 'none',\n }}\n appearance={appearance}\n onButtonClick={(step) => {\n if (onGuideButtonClick) {\n onGuideButtonClick(step)\n }\n\n return true\n }}\n />\n )}\n </ScrollContainer>\n </ChecklistContainer>\n </Modal>\n )\n}\n\nexport default ChecklistWithGuide\n","import React, { CSSProperties } from 'react'\nimport styled from 'styled-components'\n\nconst ChevronSVG = styled.svg`\n transition: 'transform 0.35s ease-in-out';\n`\n\nexport const Chevron = ({\n style,\n className,\n}: {\n color?: string\n style?: CSSProperties\n className?: string\n}) => (\n <ChevronSVG\n width=\"7\"\n height=\"10\"\n viewBox=\"0 0 9 15\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n style={style}\n className={className}\n >\n <path\n d=\"M1 13L7.5 7L0.999999 1\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </ChevronSVG>\n)\n","import { CSSProperties } from 'react'\nimport styled from 'styled-components'\nimport { getCustomClassOverrides } from '../../../shared/appearance'\n\n// Styles for top level container and text\n\nexport const ContainerStyle: CSSProperties = {\n boxShadow: '0px 6px 25px rgba(0, 0, 0, 0.06)',\n padding: '32px',\n maxHeight: '700px',\n msOverflowStyle: 'none' /* IE and Edge */,\n scrollbarWidth: 'none' /* Firefox */,\n paddingBottom: '12px',\n minHeight: '610px',\n}\n\nexport const ScrollContainer = styled.div`\n max-height: 350px;\n padding-bottom: 40px;\n`\n\nexport const HeaderContent = styled.div`\n display: flex;\n flex-direction: column;\n margin-top: 20px;\n`\n\nexport const ChecklistTitle = styled.h1<{ appearance }>`\n font-style: normal;\n font-weight: 600;\n font-size: 30px;\n line-height: 36px;\n margin-bottom: 16px;\n color: ${(props) => props.appearance?.theme?.colorText};\n`\nexport const ChecklistSubtitle = styled.h2<{ appearance }>`\n font-weight: 400;\n font-size: 16px;\n line-height: 20px;\n margin-bottom: 16px;\n padding-left: 1px;\n color: ${(props) => props.appearance?.theme?.colorTextSecondary};\n`\n\nexport const StepsContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n border: 1px solid #fafafa;\n }\n box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);\n border-radius: 14px;\n display: flex;\n flex-direction: column;\n min-height: 240px;\n overflow: hidden;\n`\n\nexport const StepsHeader = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n`\n\nexport const StepsTitle = styled.p`\n ${(props) => getCustomClassOverrides(props)} {\n font-weight: 400;\n font-size: 10px;\n line-height: 12px;\n text-transform: uppercase;\n color: #8c8c8c;\n margin: 20px;\n }\n`\n\nexport const StepsBody = styled.div`\n display: flex;\n flex-direction: row;\n`\n\nexport const StepListContainer = styled.div`\n flex: 1;\n`\n\n// Styles for Step content\n\nexport const StepContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n flex: 1;\n padding-left: 8px;\n padding-right: 8px;\n }\n`\n\nexport const StepTitle = styled.p`\n ${(props) => getCustomClassOverrides(props)} {\n font-style: normal;\n font-weight: 600;\n font-size: 22px;\n line-height: 26px;\n\n text-align: center;\n color: ${(props) => props.appearance.theme.colorText};\n margin-top: 20px;\n margin-bottom: 16px;\n }\n`\n\nexport const StepSubtitle = styled.p`\n ${(props) => getCustomClassOverrides(props)} {\n font-weight: 400;\n font-size: 14px;\n line-height: 18px;\n text-align: center;\n color: ${(props) => props.appearance.theme.colorTextSecondary};\n margin-bottom: 8px;\n }\n`\n\nexport const MultipleButtonContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 8px;\n }\n`\n\nexport const StepListItem = styled.div<{ selected: boolean }>`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n background-color: ${(props) => (props.selected ? '#FAFAFA' : '#FFFFFF')};\n :hover {\n background-color: #fafafa;\n }\n }\n //Check if attr disabled is true\n &[disabled] {\n opacity: 0.3;\n cursor: not-allowed;\n }\n\n padding: 20px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n position: relative;\n cursor: pointer;\n`\n\nexport const StepListStepName = styled.p<{ selected: boolean }>`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n color: ${(props) => (props.selected ? '#434343' : '#BFBFBF')};\n }\n font-weight: ${(props) => (props.selected ? 500 : 400)};\n font-size: 14px;\n line-height: 22px;\n margin: 0;\n`\n\nexport const StepListItemRight = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-content: center;\n`\n\nexport const ProgressBarContainer = styled.div`\n display: flex;\n flex: 1;\n flex-direction: row;\n justify-content: flex-end;\n align-content: center;\n align-items: center;\n margin-right: 20px;\n`\n\nexport const ChecklistContainer = styled.div`\n display: block;\n width: 100%;\n`\n","import styled from 'styled-components'\n\nexport const CenterVertical = styled.div`\n flex-direction: column;\n justify-content: center;\n display: flex;\n`","import React, { CSSProperties, FC } from 'react'\nimport { Appearance, DefaultFrigadeFlowProps, StepData } from '../../types'\n\nimport {\n GuideContainer,\n GuideIcon,\n GuideIconWrapper,\n GuideItem,\n GuideItemLink,\n GuideItems,\n GuideItemSubtitle,\n GuideItemTitle,\n GuideTitle,\n} from './styled'\nimport { getClassName } from '../../shared/appearance'\nimport { useCTAClickSideEffects } from '../../hooks/useCTAClickSideEffects'\nimport { sanitize } from '../../shared/sanitizer'\n\nexport interface GuideStepData extends StepData {\n icon?: string\n}\n\ninterface GuideProps extends Pick<DefaultFrigadeFlowProps, 'onButtonClick'> {\n steps: GuideStepData[]\n title: string\n style?: CSSProperties\n primaryColor?: string\n appearance: Appearance\n}\n\n/**\n * A guide is essentially a list of links that does not have a state\n */\nconst Guide: FC<GuideProps> = ({\n steps,\n style,\n title,\n primaryColor,\n appearance,\n onButtonClick,\n}) => {\n const { primaryCTAClickSideEffects } = useCTAClickSideEffects()\n\n return (\n <GuideContainer style={style} className={getClassName('guideContainer', appearance)}>\n <GuideTitle className={getClassName('guideTitle', appearance)}>{title}</GuideTitle>\n <GuideItems className={getClassName('guideItemContainer', appearance)}>\n {steps.map((stepData: GuideStepData, idx) => {\n return (\n <GuideItem\n key={`guide-${stepData.id ?? idx}`}\n className={getClassName('guideItem', appearance)}\n >\n {stepData.icon && (\n <GuideIconWrapper className={getClassName('guideIcon', appearance)}>\n <GuideIcon>{stepData.icon}</GuideIcon>\n </GuideIconWrapper>\n )}\n\n <GuideItemTitle\n className={getClassName('guideItemTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.title)}\n />\n <GuideItemSubtitle\n className={getClassName('guideItemSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.subtitle)}\n />\n <GuideItemLink\n className={getClassName('guideItemLink', appearance)}\n color={primaryColor}\n onClick={() => {\n if (stepData.primaryButtonUri) {\n primaryCTAClickSideEffects(stepData)\n }\n if (onButtonClick) {\n onButtonClick(stepData)\n }\n }}\n >\n {stepData.primaryButtonTitle}\n </GuideItemLink>\n </GuideItem>\n )\n })}\n </GuideItems>\n </GuideContainer>\n )\n}\n\nexport default Guide\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../../shared/appearance'\n\nexport const GuideContainer = styled.div`\n border: 1px solid #fafafa;\n box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);\n border-radius: 14px;\n padding-top: 20px;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n`\n\nexport const GuideItems = styled.div`\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n overflow: hidden;\n row-gap: 10px;\n`\n\nexport const GuideTitle = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n color: #595959;\n }\n text-transform: uppercase;\n font-weight: 400;\n font-size: 10px;\n line-height: 12px;\n letter-spacing: 0.09em;\n margin-bottom: 12px;\n`\n\nexport const GuideItem = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n background: #ffffff;\n border: 1px solid #fafafa;\n }\n border-radius: 14px;\n padding: 20px;\n flex-direction: column;\n align-content: center;\n\n max-width: 150px;\n min-width: 200px;\n`\n\nexport const GuideIconWrapper = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);\n }\n width: 40px;\n height: 40px;\n\n border-radius: 7px;\n display: flex;\n justify-content: center;\n align-content: center;\n align-items: center;\n`\n\nexport const GuideIcon = styled.div`\n font-weight: 600;\n font-size: 20px;\n line-height: 24px;\n width: 20px;\n height: 20px;\n`\n\nexport const GuideItemTitle = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n color: #434343;\n }\n font-weight: 600;\n font-size: 14px;\n line-height: 17px;\n margin-top: 12px;\n margin-bottom: 8px;\n`\n\nexport const GuideItemSubtitle = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n color: #8c8c8c;\n }\n font-weight: 400;\n font-size: 12px;\n line-height: 14px;\n`\n\nexport const GuideItemLink = styled.a<{ color: string }>`\n color: ${(props) => props.color};\n font-size: 12px;\n line-height: 14px;\n font-weight: 400;\n cursor: pointer;\n`\n","import React, { FC, useEffect, useState } from 'react'\nimport { StepData } from '../../../types'\nimport { Modal } from '../../Modal'\nimport { ProgressBar } from '../Checklist/ProgressBar'\nimport { CollapsibleStep } from './CollapsibleStep'\n\nimport {\n ChecklistContainer,\n CondensedInlineChecklistContainer,\n HeaderContent,\n ModalChecklistSubtitle,\n ModalChecklistTitle,\n} from './styled'\nimport { sanitize } from '../../../shared/sanitizer'\nimport { getClassName, mergeClasses } from '../../../shared/appearance'\nimport { FrigadeChecklistProps } from '../../../FrigadeChecklist'\n\nexport interface CondensedChecklistProps extends Omit<FrigadeChecklistProps, 'flowId'> {\n autoCollapse?: boolean\n onClose: () => void\n}\n\nconst CondensedChecklist: FC<CondensedChecklistProps> = ({\n title,\n subtitle,\n steps,\n onClose,\n visible,\n autoExpandFirstIncompleteStep = true,\n autoCollapse = true,\n autoExpandNextStep = true,\n setSelectedStep,\n appearance,\n type,\n className,\n customStepTypes,\n style,\n onButtonClick,\n}) => {\n const completeCount = steps.filter((s) => s.complete).length\n const [collapsedSteps, setCollapsedSteps] = useState<boolean[]>(Array(steps.length).fill(true))\n\n useEffect(() => {\n const initCollapsedState = [...collapsedSteps]\n if (!autoExpandFirstIncompleteStep) return\n for (let i = 0; i < steps.length; i++) {\n if (!steps[i].complete) {\n initCollapsedState[i] = false\n break\n }\n }\n setCollapsedSteps(initCollapsedState)\n }, [])\n\n const handleStepClick = (idx: number) => {\n const newCollapsedState = [...collapsedSteps]\n if (autoCollapse) {\n for (let i = 0; i < collapsedSteps.length; ++i) {\n if (i != idx && newCollapsedState[idx]) {\n newCollapsedState[i] = true\n }\n }\n }\n newCollapsedState[idx] = !collapsedSteps[idx]\n setCollapsedSteps(newCollapsedState)\n }\n\n if (!visible && type == 'modal') return <></>\n\n const headerContent = (\n <>\n <HeaderContent>\n <ModalChecklistTitle\n appearance={appearance}\n className={getClassName('checklistTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(title)}\n />\n <ModalChecklistSubtitle\n appearance={appearance}\n className={getClassName('checklistSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(subtitle)}\n />\n </HeaderContent>\n <ProgressBar\n display=\"percent\"\n count={completeCount}\n total={steps.length}\n style={{ margin: '14px 0px 8px 0px' }}\n appearance={appearance}\n />\n </>\n )\n\n const checklistContent = (\n <ChecklistContainer\n className={mergeClasses(getClassName('checklistContainer', appearance), className)}\n >\n {steps.map((step: StepData, idx: number) => {\n const isCollapsed = collapsedSteps[idx]\n return (\n <CollapsibleStep\n appearance={appearance}\n stepData={step}\n collapsed={isCollapsed}\n key={`modal-checklist-${step.id ?? idx}`}\n onClick={() => {\n handleStepClick(idx)\n setSelectedStep(idx)\n if (onButtonClick) {\n onButtonClick(steps[idx], idx, collapsedSteps[idx] ? 'expand' : 'collapse')\n }\n }}\n onPrimaryButtonClick={() => {\n handleStepClick(idx)\n if (autoExpandNextStep && idx < steps.length - 1) {\n setSelectedStep(idx + 1)\n }\n if (step.handlePrimaryButtonClick) {\n step.handlePrimaryButtonClick()\n }\n if (autoExpandNextStep && idx < steps.length - 1) {\n handleStepClick(idx + 1)\n }\n }}\n onSecondaryButtonClick={() => {\n if (step.handleSecondaryButtonClick) {\n step.handleSecondaryButtonClick()\n }\n if (autoExpandNextStep && idx < steps.length - 1) {\n handleStepClick(idx + 1)\n }\n }}\n customStepTypes={customStepTypes}\n />\n )\n })}\n </ChecklistContainer>\n )\n\n if (type === 'inline') {\n return (\n <CondensedInlineChecklistContainer\n appearance={appearance}\n className={mergeClasses(getClassName('checklistInlineContainer', appearance), className)}\n style={style}\n >\n {headerContent}\n {checklistContent}\n </CondensedInlineChecklistContainer>\n )\n }\n\n return (\n <>\n <Modal\n onClose={onClose}\n visible={visible}\n appearance={appearance}\n style={{ maxWidth: '600px' }}\n headerContent={headerContent}\n >\n {checklistContent}\n </Modal>\n </>\n )\n}\n\nexport default CondensedChecklist\n","import React, { FC } from 'react'\nimport { Appearance, StepData } from '../../../../types'\nimport { CheckBoxRow } from '../../../CheckBoxRow'\nimport { Chevron } from '../../../Icons/Chevron'\nimport { Button, MultipleButtonContainer } from '../../../Button'\n\nimport {\n CollapseChevronContainer,\n HeaderLeft,\n StepContainer,\n StepHeader,\n StepImage,\n StepMediaContainer,\n StepSubtitle,\n StepTitle,\n} from './styled'\nimport { sanitize } from '../../../../shared/sanitizer'\nimport { getClassName } from '../../../../shared/appearance'\nimport { VideoCard } from '../../../Video/VideoCard'\n\ninterface CollapsibleStepProps {\n stepData: StepData\n collapsed: boolean\n onClick: () => void\n onSecondaryButtonClick: () => void\n onPrimaryButtonClick: () => void\n appearance?: Appearance\n /**\n * Map of custom step types that the checklist supports. To use a custom steps in your checklist, see [Component Customization](/component/customization#customizing-frigade-components)\n */\n customStepTypes?: Record<\n string,\n ((stepData: StepData, appearance: Appearance) => React.ReactNode) | React.ReactNode\n >\n}\n\nexport const CollapsibleStep: FC<CollapsibleStepProps> = ({\n stepData,\n collapsed,\n onClick,\n onPrimaryButtonClick,\n onSecondaryButtonClick,\n appearance,\n customStepTypes,\n}) => {\n const iconStyle = collapsed ? {} : { transform: 'rotate(90deg)' }\n const stepContentStyle = collapsed\n ? {\n overflow: 'hidden',\n maxHeight: '0px',\n transition: 'max-height 0.35s ease-out',\n }\n : {\n overflow: 'hidden',\n maxHeight: '1000px',\n transition: 'max-height 0.7s ease-out',\n }\n\n function getDefaultStepContent() {\n return (\n <>\n {stepData.imageUri || stepData.videoUri ? (\n <StepMediaContainer className={getClassName('stepMediaContainer', appearance)}>\n {stepData.imageUri ? (\n <StepImage\n className={getClassName('stepImage', appearance)}\n src={stepData.imageUri}\n />\n ) : null}\n {stepData.videoUri ? (\n <VideoCard\n appearance={appearance}\n videoUri={stepData.videoUri}\n autoplay={stepData.props?.autoplayVideo}\n loop={stepData.props?.loopVideo}\n hideControls={stepData.props?.hideVideoControls}\n />\n ) : null}\n </StepMediaContainer>\n ) : null}\n <StepSubtitle\n className={getClassName('stepSubtitle', appearance)}\n appearance={appearance}\n dangerouslySetInnerHTML={sanitize(stepData.subtitle)}\n />\n <MultipleButtonContainer className={getClassName('checklistCTAContainer', appearance)}>\n {stepData.secondaryButtonTitle ? (\n <Button\n secondary\n title={stepData.secondaryButtonTitle}\n onClick={() => onSecondaryButtonClick()}\n appearance={appearance}\n />\n ) : null}\n <Button\n title={stepData.primaryButtonTitle ?? 'Continue'}\n onClick={() => onPrimaryButtonClick()}\n appearance={appearance}\n />\n </MultipleButtonContainer>\n </>\n )\n }\n\n function getCustomStep() {\n if (!customStepTypes) {\n return null\n }\n const customStep = customStepTypes[stepData.type]\n if (!customStep) {\n return null\n }\n // Check if not a function\n if (typeof customStep !== 'function') {\n return customStep\n }\n\n return customStep(stepData, appearance)\n }\n\n return (\n <StepContainer\n data-testid={`step-${stepData.id}`}\n data-stepid={`${stepData.id}`}\n className={getClassName('checklistStepContainer', appearance)}\n appearance={appearance}\n >\n <StepHeader className={getClassName('stepHeader', appearance)} onClick={() => onClick()}>\n <HeaderLeft className={getClassName('stepHeaderContent', appearance)}>\n <CheckBoxRow\n value={stepData.complete}\n style={{ width: 'auto', borderTop: 0 }}\n primaryColor={appearance?.theme?.colorPrimary}\n appearance={appearance}\n />\n <StepTitle\n appearance={appearance}\n className={getClassName('stepTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.title)}\n />\n </HeaderLeft>\n\n <CollapseChevronContainer\n className={getClassName('stepChevronContainer', appearance)}\n appearance={appearance}\n >\n <Chevron style={{ ...iconStyle, transition: 'transform 0.2s ease-in-out' }} />\n </CollapseChevronContainer>\n </StepHeader>\n\n <div\n key={stepData.id}\n style={{\n ...stepContentStyle,\n }}\n className={getClassName('stepContent', appearance)}\n >\n {getCustomStep() ?? getDefaultStepContent()}\n </div>\n </StepContainer>\n )\n}\n","import styled from 'styled-components'\n\nexport const StepContainer = styled.div<{ appearance }>`\n background-color: ${(props) => props.appearance?.theme?.colorBackground};\n border: 1px solid;\n border-color: ${(props) => props.appearance?.theme?.colorBorder};\n border-radius: 6px;\n padding: 2px 20px 2px 20px;\n display: flex;\n margin-top: 14px;\n margin-bottom: 14px;\n display: flex;\n flex-direction: column;\n transition: max-height 0.25s;\n`\n\nexport const StepMediaContainer = styled.div`\n display: flex;\n margin-bottom: 20px;\n`\n\nexport const StepImage = styled.img`\n border-radius: 4px;\n max-height: 260px;\n min-height: 200px;\n`\nexport const StepHeader = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n :hover {\n opacity: 0.8;\n }\n`\n\nexport const StepTitle = styled.p<{ appearance }>`\n color: ${(props) => props.appearance?.theme?.colorText};\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 18px;\n margin-left: 8px;\n cursor: pointer;\n :hover {\n opacity: 0.8;\n }\n`\n\nexport const CollapseChevronContainer = styled.div`\n cursor: pointer;\n color: ${(props) => props.appearance.theme.colorTextSecondary};\n :hover {\n opacity: 0.8;\n }\n`\n\nexport const ExpandedContentContainer = styled.div``\n\nexport const StepSubtitle = styled.p<{ appearance }>`\n color: ${(props) => props.appearance?.theme?.colorText};\n font-weight: 400;\n font-size: 14px;\n line-height: 22px;\n`\n\nexport const HeaderLeft = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n`\n","import styled from 'styled-components'\n\nexport const ModalChecklistContainer = styled.div`\n background: #ffffff;\n box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);\n border-radius: 6px;\n z-index: 10;\n padding: 32px;\n\n position: absolute;\n width: 80%;\n top: 20%;\n left: 20%;\n\n max-width: 800px;\n min-width: 350px;\n`\n\nexport const HeaderContent = styled.div`\n display: flex;\n flex-direction: column;\n`\n\nexport const ModalChecklistTitle = styled.h1<{ appearance }>`\n color: ${(props) => props.appearance?.theme?.colorText};\n font-style: normal;\n font-weight: 700;\n font-size: 20px;\n line-height: 24px;\n margin-bottom: 8px;\n`\nexport const ModalChecklistSubtitle = styled.h2<{ appearance }>`\n color: ${(props) => props.appearance?.theme?.colorTextSecondary};\n font-weight: 400;\n font-size: 14px;\n line-height: 23px;\n margin: 2px 0 0 0;\n`\nexport const ChecklistContainer = styled.div`\n display: block;\n width: 100%;\n`\nexport const CondensedInlineChecklistContainer = styled.div`\n display: flex;\n width: 100%;\n flex-direction: column;\n justify-content: space-between;\n padding: 24px;\n border-radius: ${(props) => props.appearance?.theme?.borderRadius}px;\n background-color: ${(props) => props.appearance?.theme?.colorBackground};\n`\n","import React, { useEffect, useRef, useState } from 'react'\nimport { useFlows } from '../../../api/flows'\nimport { useMediaQuery } from '../../../hooks/useMediaQuery'\n\nimport { CarouselCard } from './CarouselCard'\n\nimport {\n Body,\n CarouselContainer,\n CarouselScroll,\n CarouselScrollGroup,\n CarouselTitle,\n ProgressWrapper,\n StyledCarouselFade,\n StyledScrollButton,\n} from './styled'\nimport { DefaultFrigadeFlowProps } from '../../../types'\nimport { getClassName, mergeClasses } from '../../../shared/appearance'\nimport { RenderInlineStyles } from '../../RenderInlineStyles'\nimport { ProgressBar } from '../Checklist/ProgressBar'\nimport { sanitize } from '../../../shared/sanitizer'\n\nconst RightArrow = () => (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M14 6L20 12\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" />\n <path d=\"M14 18L20 12\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" />\n <path d=\"M4 12H20\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" />\n </svg>\n)\n\nconst CarouselFade: React.FC<{ side?: string; show?: boolean; onClick?: any }> = ({\n side = 'left',\n show = false,\n onClick = () => {},\n}) => {\n const [mounted, setMounted] = useState(false)\n const [reversed, setReversed] = useState(false)\n\n useEffect(() => {\n if (show === true && mounted === false) {\n setMounted(true)\n } else if (show === false && mounted === true) {\n setReversed(true)\n }\n }, [show])\n\n const handleFadeOutEnd = () => {\n setMounted(false)\n setReversed(false)\n }\n\n const style: React.CSSProperties =\n side == 'left'\n ? { top: 0, bottom: 0, left: -20, transform: 'rotate(180deg)' }\n : { top: 0, bottom: 0, right: -20 }\n\n return mounted ? (\n <StyledCarouselFade\n style={style}\n reversed={reversed}\n onAnimationEnd={reversed ? handleFadeOutEnd : null}\n >\n <StyledScrollButton onClick={() => onClick()} style={{ right: 16, top: 'calc(50% - 24px)' }}>\n <RightArrow />\n </StyledScrollButton>\n </StyledCarouselFade>\n ) : null\n}\n\nexport interface CarouselChecklistProps extends DefaultFrigadeFlowProps {\n flowId: string\n}\n\nexport const CarouselChecklist: React.FC<CarouselChecklistProps> = ({\n flowId,\n appearance,\n customVariables,\n className,\n}) => {\n const scrollContainerRef = useRef<HTMLDivElement>(null)\n const [showLeftFade, setShowLeftFade] = useState(false)\n const [showRightFade, setShowRightFade] = useState(false)\n const [flowMetadata, setFlowMetadata] = useState(null)\n const [flowSteps, setFlowSteps] = useState([])\n const [numberOfStepsCompleted, setNumberOfStepsCompleted] = useState(0)\n const { isSmall } = useMediaQuery()\n\n const pageSize = isSmall ? 1 : 3\n\n const {\n getFlowMetadata,\n getFlowSteps,\n getNumberOfStepsCompleted,\n updateCustomVariables,\n isLoading,\n } = useFlows()\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n useEffect(() => {\n if (isLoading) return\n\n const metadata = getFlowMetadata(flowId)\n const completedStepCount = getNumberOfStepsCompleted(flowId)\n const steps = getFlowSteps(flowId)\n\n setFlowMetadata(metadata)\n if (metadata.data !== null || metadata.steps !== null) {\n setFlowSteps(steps.sort((a, b) => Number(a.complete) - Number(b.complete)))\n setShowRightFade(steps.length > pageSize)\n setNumberOfStepsCompleted(completedStepCount)\n }\n }, [isLoading])\n\n const scrollGroups: any[][] = []\n for (let i = 0; i < flowSteps.length; i += pageSize) {\n scrollGroups.push(flowSteps.slice(i, i + pageSize))\n }\n\n const handleScroll = (e: React.UIEvent<HTMLElement>) => {\n const target = e.target as HTMLElement\n const maxScroll = target.scrollWidth - target.clientWidth\n // Round up to avoid issues with fractional pixels\n const currentScroll = Math.ceil(target.scrollLeft)\n\n if (currentScroll > 0 && showLeftFade === false) {\n setShowLeftFade(true)\n }\n\n if (currentScroll === 0 && showLeftFade === true) {\n setShowLeftFade(false)\n }\n\n if (currentScroll < maxScroll && showRightFade === false) {\n setShowRightFade(true)\n }\n\n if (currentScroll === maxScroll && showRightFade === true) {\n setShowRightFade(false)\n }\n }\n\n const handleScrollByPage = (forward = true) => {\n const direction = forward ? 1 : -1\n\n if (scrollContainerRef.current === null) return\n\n scrollContainerRef.current.scrollBy({\n left: scrollContainerRef.current.clientWidth * direction,\n behavior: 'smooth',\n })\n }\n\n let scrollTimeout = null\n const throttledScroll = (e: React.UIEvent<HTMLElement>) => {\n if (scrollTimeout !== null) {\n clearTimeout(scrollTimeout)\n } else {\n // Invoke once before starting to throttle\n handleScroll(e)\n }\n\n scrollTimeout = setTimeout(() => {\n handleScroll(e)\n }, 16)\n }\n\n if (isLoading) {\n return null\n }\n\n return (\n <CarouselContainer\n className={mergeClasses(getClassName('carouselContainer', appearance), className)}\n >\n <div\n style={{\n display: 'flex',\n justifyContent: isSmall ? 'center' : 'space-between',\n marginBottom: 20,\n flexWrap: isSmall ? 'wrap' : 'nowrap',\n gap: isSmall ? 16 : 20,\n }}\n >\n <div>\n <CarouselTitle\n className={getClassName('carouselTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(flowMetadata?.title)}\n />\n <Body.Quiet\n className={getClassName('carouselSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(flowMetadata?.subtitle)}\n />\n </div>\n <ProgressWrapper className={getClassName('progressWrapper', appearance)}>\n <ProgressBar\n count={numberOfStepsCompleted}\n total={flowSteps.length}\n appearance={appearance}\n />\n </ProgressWrapper>\n </div>\n\n <div style={{ position: 'relative' }}>\n <CarouselFade show={showLeftFade} onClick={() => handleScrollByPage(false)} />\n <CarouselFade side=\"right\" show={showRightFade} onClick={handleScrollByPage} />\n\n <CarouselScroll ref={scrollContainerRef} onScroll={throttledScroll}>\n {scrollGroups.map((group, i) => (\n <CarouselScrollGroup\n key={i}\n style={{\n flex: `0 0 calc(100% - ${flowSteps.length > pageSize ? 36 : 0}px)`,\n }}\n >\n {group.map((stepData, j) => (\n <CarouselCard\n key={j}\n stepData={stepData}\n style={{\n flex:\n flowSteps.length > pageSize\n ? `0 1 calc(100% / ${pageSize} - 16px * 2 / ${pageSize})`\n : 1,\n }}\n appearance={appearance}\n />\n ))}\n </CarouselScrollGroup>\n ))}\n </CarouselScroll>\n </div>\n <RenderInlineStyles appearance={appearance} />\n </CarouselContainer>\n )\n}\n","import { useEffect, useState } from 'react'\n\nexport const useMediaQuery = () => {\n const queries = {\n isSmall: '(max-width: 480px)',\n isMedium: '(min-width: 481px) AND (max-width: 1023px)',\n isLarge: '(min-width: 1025px)',\n }\n\n const defaultMatches = Object.fromEntries(Object.entries(queries).map(([key]) => [key, false]))\n\n const [matches, setMatches] = useState(defaultMatches)\n\n let updateTimeout = null\n const throttledUpdate = () => {\n if (updateTimeout !== null) {\n clearTimeout(updateTimeout)\n } else {\n updateMatches()\n }\n\n updateTimeout = setTimeout(() => {\n updateMatches()\n }, 16)\n }\n\n const updateMatches = () => {\n const freshMatches = Object.fromEntries(\n Object.entries(queries).map(([key, query]) => {\n if (!window) {\n return [key, false]\n }\n\n const mediaQuery = window.matchMedia(query)\n\n mediaQuery.addEventListener('change', throttledUpdate)\n\n return [key, mediaQuery.matches]\n })\n )\n\n setMatches(freshMatches)\n }\n\n useEffect(() => {\n updateMatches()\n }, [])\n\n return matches\n}\n","import React, { FC } from 'react'\nimport { Appearance, StepData } from '../../../types'\nimport { useCTAClickSideEffects } from '../../../hooks/useCTAClickSideEffects'\n\nimport {\n Body,\n CardTitle,\n CompletedPill,\n Small,\n StyledCarouselCard,\n StyledCarouselCardImage,\n} from './styled'\nimport { useTheme } from '../../../hooks/useTheme'\nimport { getClassName } from '../../../shared/appearance'\nimport { sanitize } from '../../../shared/sanitizer'\n\ninterface CarouselCardProps {\n stepData: StepData\n style?: React.CSSProperties\n appearance?: Appearance\n}\n\nexport const CarouselCard: FC<CarouselCardProps> = ({ stepData, style = {}, appearance }) => {\n const { mergeAppearanceWithDefault } = useTheme()\n const { primaryCTAClickSideEffects } = useCTAClickSideEffects()\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n const {\n imageUri = null,\n subtitle = null,\n title = null,\n complete = false,\n blocked = false,\n } = stepData\n\n const hasCTA = stepData.primaryButtonTitle || stepData.secondaryButtonTitle\n\n const handleClick = () => {\n primaryCTAClickSideEffects(stepData)\n }\n\n return (\n <StyledCarouselCard\n className={getClassName('carouselCard', appearance)}\n onClick={blocked ? null : handleClick}\n style={style}\n blocked={blocked}\n complete={complete}\n >\n {imageUri && (\n <StyledCarouselCardImage\n className={getClassName('carouselCardImage', appearance)}\n src={imageUri}\n alt={title}\n style={{ opacity: complete || blocked ? 0.4 : 1 }}\n />\n )}\n {complete && (\n <CompletedPill className={getClassName('carouselCompletedPill', appearance)}>\n <Small style={{ color: '#108E0B' }}>Complete</Small>\n </CompletedPill>\n )}\n {title && (\n <CardTitle\n blocked={blocked}\n complete={complete}\n className={getClassName('carouselCardTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(title)}\n />\n )}\n {subtitle && (\n <Body.Quiet\n blocked={blocked}\n complete={complete}\n className={getClassName('carouselCardSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(subtitle)}\n />\n )}\n {/* !(complete || blocked) && hasCTA && <CTA stepData={stepData} appearance={appearance} /> */}\n </StyledCarouselCard>\n )\n}\n","import styled, { css, keyframes } from 'styled-components'\nimport { getCustomClassOverrides } from '../../../shared/appearance'\n\nconst defaultBorder = css`\n border: 1px solid ${({ theme }) => theme.colorBorder};\n`\n\nconst defaultShadow = css`\n box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);\n`\n\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n } to {\n opacity: 1;\n }\n`\n\nconst fadeOut = keyframes`\n from {\n opacity: 1;\n } to {\n opacity: 0;\n }\n`\n\nexport const CarouselScroll = styled.div`\n margin: 0 -20px;\n overflow-x: auto;\n padding-left: 20px;\n padding-right: 20px;\n scroll-snap-type: x mandatory;\n\n display: flex;\n flex-flow: row nowrap;\n gap: 0 16px;\n\n -ms-overflow-style: none;\n scrollbar-width: none;\n\n ::-webkit-scrollbar {\n display: none;\n }\n`\n\nexport const CarouselScrollGroup = styled.div`\n display: flex;\n flex-flow: row nowrap;\n gap: 0 16px;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n`\n\nexport const StyledCarouselFade = styled.div`\n animation: ${(props) => (props.reversed ? fadeOut : fadeIn)} 0.25s ease-out;\n background: linear-gradient(\n to right,\n ${({ theme }) => theme.colorBackground}00,\n ${({ theme }) => theme.colorBackground} 100%\n );\n position: absolute;\n width: 64px;\n z-index: 10;\n`\n\nexport const StyledScrollButton = styled.button`\n ${defaultBorder}\n box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.1);\n align-items: center;\n border-radius: 50%;\n background: ${({ theme }) => theme.colorBackground};\n color: ${({ theme }) => theme.colorPrimary};\n display: flex;\n height: 48px;\n justify-content: center;\n position: absolute;\n width: 48px;\n`\n\nexport const Card = styled.div`\n border-radius: ${({ theme }) => theme.borderRadius}px;\n padding: 20px;\n`\n\nexport const StyledCarouselCard = styled(Card)`\n ${defaultBorder}\n background: ${({ theme }) => theme.colorBackground};\n position: relative;\n\n &:active {\n ${(props) => (!props.blocked ? `background: ${props.theme.colorBackgroundSecondary};` : ``)}\n }\n\n &:hover {\n ${(props) => (!props.blocked ? `border: 1px solid ${props.theme.colorPrimary};` : ``)}\n ${(props) => (!props.blocked ? `cursor: pointer` : `cursor: default`)}\n }\n`\n\nexport const StyledCarouselCardImage = styled.img`\n border-radius: 50%;\n height: 40px;\n margin-bottom: 12px;\n width: 40px;\n`\n\nexport const CarouselContainer = styled(Card)`\n ${(props) => getCustomClassOverrides(props)} {\n ${defaultShadow}\n\n background: ${({ theme }) => theme.colorBackground};\n }\n`\n\nexport const CarouselProgressBar = styled.div`\n color: ${({ theme }) => theme.colorPrimary};\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n`\n\nexport const ProgressBarLabel = styled.div`\n white-space: nowrap;\n`\n\nexport const CompletedPill = styled.div`\n background: #d8fed8;\n border-radius: 6px;\n float: right;\n margin-bottom: 12px;\n padding: 4px 10px;\n`\n\nexport const H3 = styled.p`\n font-weight: bold;\n font-size: 18px;\n line-height: 22px;\n letter-spacing: calc(18px * -0.01);\n margin: 0;\n`\n\nexport const CarouselTitle = styled(H3)`\n margin-bottom: 4px;\n`\n\nexport const ProgressWrapper = styled.div`\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n min-width: 50%;\n`\n\nexport const H4 = styled.p`\n font-weight: bold;\n font-size: 16px;\n line-height: 20px;\n letter-spacing: calc(16px * -0.01);\n margin: 0;\n`\n\nexport const CardTitle = styled(H4)`\n margin-bottom: 4px;\n ${(props) =>\n props.blocked || props.complete\n ? `opacity: 0.4;`\n : `\n `}\n`\n\nexport const Body = styled.p`\n color: ${({ theme }) => theme.colorText};\n font-weight: normal;\n font-size: 14px;\n line-height: 22px;\n margin: 0;\n`\n\nexport const Small = styled.p`\n color: ${({ theme }) => theme.colorText};\n font-weight: 600;\n font-size: 12px;\n line-height: 16px;\n margin: 0;\n`\n\nBody.Loud = styled(Body)`\n font-weight: 600;\n`\n\nBody.Quiet = styled(Body)`\n color: ${({ theme }) => theme.colorTextSecondary};\n ${(props) =>\n props.blocked || props.complete\n ? `opacity: 0.4;`\n : `\n `}\n`\n","import React, { CSSProperties, useEffect } from 'react'\nimport { useFlows } from '../api/flows'\nimport { MiniProgressBadge, ProgressBadgeType } from '../components/Checklists/MiniProgressBadge'\nimport { useFlowOpens } from '../api/flow-opens'\nimport { DefaultFrigadeFlowProps } from '../types'\nimport { COMPLETED_FLOW } from '../api/common'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport { useTheme } from '../hooks/useTheme'\nimport { FullWidthProgressBadge } from '../components/Checklists/FullWidthProgressBadge'\n\nexport interface FrigadeProgressBadgeProps extends DefaultFrigadeFlowProps {\n title: string\n subtitle?: string\n icon?: React.ReactNode\n textStyle?: CSSProperties\n onClick?: () => void\n hideOnFlowCompletion?: boolean\n type?: ProgressBadgeType\n}\n\nexport const FrigadeProgressBadge: React.FC<FrigadeProgressBadgeProps> = ({\n flowId,\n title,\n subtitle,\n icon,\n style,\n onClick,\n className,\n customVariables,\n hideOnFlowCompletion,\n appearance,\n type = 'default',\n}) => {\n const {\n getFlow,\n getFlowSteps,\n getFlowStatus,\n getNumberOfStepsCompleted,\n isLoading,\n targetingLogicShouldHideFlow,\n updateCustomVariables,\n } = useFlows()\n const { mergeAppearanceWithDefault } = useTheme()\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n const { setOpenFlowState, getOpenFlowState } = useFlowOpens()\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n if (isLoading) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (hideOnFlowCompletion === true && getFlowStatus(flowId) === COMPLETED_FLOW) {\n return null\n }\n\n const steps = getFlowSteps(flowId)\n const completedCount = getNumberOfStepsCompleted(flowId)\n\n if (type === 'full-width') {\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <FullWidthProgressBadge\n title={title}\n subtitle={subtitle}\n count={completedCount}\n total={steps.length}\n style={style}\n className={className}\n appearance={appearance}\n icon={icon}\n onClick={onClick}\n />\n </>\n )\n }\n\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <MiniProgressBadge\n count={completedCount}\n total={steps.length}\n title={title}\n style={style}\n onClick={() => {\n setOpenFlowState(flowId, true)\n if (onClick) {\n onClick()\n }\n }}\n type={type}\n className={className}\n appearance={appearance}\n />\n </>\n )\n}\n","import React, { CSSProperties, FC } from 'react'\nimport { Chevron } from '../../Icons/Chevron'\nimport { ProgressBar } from '../Checklist/ProgressBar'\nimport { BadgeContainer, BadgeRow, BadgeTitle, ProgressRingContainer } from './styled'\nimport { Appearance } from '../../../types'\nimport ProgressRing from '../../Progress/ProgressRing/ProgressRing'\nimport { getClassName, mergeClasses } from '../../../shared/appearance'\nimport { RenderInlineStyles } from '../../RenderInlineStyles'\n\nexport type ProgressBadgeType = 'condensed' | 'default' | 'full-width'\n\nexport interface ProgressBadgeProps {\n title: string\n subtitle?: string\n icon?: React.ReactNode\n count: number\n total: number\n style?: CSSProperties\n onClick: () => void\n className?: string\n type?: ProgressBadgeType\n appearance?: Appearance\n}\n\nexport const MiniProgressBadge: FC<ProgressBadgeProps> = ({\n title,\n count,\n total,\n onClick,\n style = {},\n className,\n appearance,\n type = 'default',\n}) => {\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <BadgeContainer\n onClick={() => onClick !== undefined && onClick()}\n styleOverrides={{\n ...(type == 'condensed' ? { display: 'flex', justifyContent: 'space-between' } : {}),\n ...style,\n }}\n className={mergeClasses(\n className ?? '',\n getClassName('progressBadgeContainer', appearance)\n )}\n appearance={appearance}\n >\n {type == 'condensed' && total && total !== 0 && (\n <ProgressRingContainer className={getClassName('progressRingContainer', appearance)}>\n <ProgressRing\n size={19}\n percentage={count / total}\n fillColor={appearance.theme.colorPrimary}\n bgColor={appearance.theme.colorBackgroundSecondary}\n />\n </ProgressRingContainer>\n )}\n <BadgeRow type={type} className={getClassName('badgeTitleContainer', appearance)}>\n <BadgeTitle\n type={type}\n appearance={appearance}\n className={getClassName('badgeTitle', appearance)}\n >\n {title}\n </BadgeTitle>\n {onClick !== undefined && (\n <Chevron\n className={getClassName('badgeChevron', appearance)}\n color={appearance.theme.colorPrimary}\n />\n )}\n </BadgeRow>\n {type == 'default' && total && total !== 0 && (\n <ProgressBar\n display=\"compact\"\n count={count}\n total={total}\n bgColor={appearance.theme.colorBackgroundSecondary}\n style={{ width: '100%' }}\n appearance={appearance}\n textStyle={{\n color: '#818898',\n }}\n />\n )}\n </BadgeContainer>\n </>\n )\n}\n","import styled from 'styled-components'\nimport { styleOverridesToCSS } from '../../../shared/appearance'\n\nexport const BadgeContainer = styled.div`\n border: 1px solid ${(props) => props.appearance.theme.colorBorder};\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n padding: 10px 12px 10px 12px;\n min-width: 160px;\n cursor: pointer;\n background-color: ${(props) => props.appearance.theme.colorBackground}};\n ${(props) => styleOverridesToCSS(props)}\n \n &:hover {\n filter: brightness(.99);\n }\n`\n\nexport const BadgeRow = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n margin-bottom: ${(props) => (props.type === 'condensed' ? '0' : '6px')};\n flex-grow: 2;\n`\n\nexport const BadgeTitle = styled.div<{ color; type }>`\n text-overflow: ellipsis;\n font-weight: 600;\n font-size: 14px;\n line-height: 16px;\n margin-right: ${(props) => (props.type === 'condensed' ? '8px' : '0')};\n text-align: ${(props) => (props.type === 'condensed' ? 'left' : 'right')};\n`\nexport const ProgressRingContainer = styled.div`\n width: 20px;\n margin-right: 8px;\n display: flex;\n height: 100%;\n align-items: center;\n`\n","import React from 'react'\n\nimport {\n FullWidthProgressBadgeContainer,\n IconContainer,\n ProgressBarContainer,\n TextContainer,\n} from './styled'\nimport { ProgressBadgeProps } from '../MiniProgressBadge'\nimport { TitleSubtitle } from '../../TitleSubtitle/TitleSubtitle'\nimport { getClassName, mergeClasses } from '../../../shared/appearance'\nimport { ProgressBar } from '../Checklist/ProgressBar'\n\nexport const FullWidthProgressBadge: React.FC<ProgressBadgeProps> = ({\n title,\n subtitle,\n icon,\n appearance,\n count,\n total,\n className,\n style,\n onClick,\n}) => {\n return (\n <>\n <FullWidthProgressBadgeContainer\n appearance={appearance}\n className={mergeClasses(\n getClassName('fullWidthProgressBadgeContainer', appearance),\n className ?? ''\n )}\n style={style}\n onClick={() => onClick !== undefined && onClick()}\n >\n {icon && (\n <IconContainer className={getClassName('fullWidthProgressBadgeIcon', appearance)}>\n {icon}\n </IconContainer>\n )}\n <TextContainer>\n <TitleSubtitle size={'small'} appearance={appearance} title={title} subtitle={subtitle} />\n </TextContainer>\n <ProgressBarContainer\n className={getClassName('fullWidthProgressBadgeProgressContainer', appearance)}\n >\n <ProgressBar count={count} total={total} display=\"percent\" textLocation=\"top\" />\n </ProgressBarContainer>\n </FullWidthProgressBadgeContainer>\n </>\n )\n}\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../../../shared/appearance'\n\nexport const FullWidthProgressBadgeContainer = styled.div`\n display: flex;\n flex-direction: row;\n width: 100%;\n padding: 16px;\n box-sizing: border-box;\n align-items: center;\n background-color: ${(props) => props.appearance.theme.colorBackground};\n border: 1px solid ${(props) => props.appearance.theme.colorBorder};\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\n\nexport const IconContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n justify-content: center;\n align-items: center;\n margin-right: 16px;\n }\n`\n\nexport const TextContainer = styled.div`\n display: flex;\n flex-direction: column;\n flex: 1;\n margin-top: 0;\n`\nexport const ProgressBarContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-left: 16px;\n min-width: 200px;\n`\n\nexport const DismissButton = styled.div`\n display: flex;\n justify-content: center;\n align-items: flex-end;\n margin-left: 16px;\n cursor: pointer;\n :hover {\n opacity: 0.8;\n }\n`\n","import React, { FC } from 'react'\nimport { useFlows } from '../api/flows'\nimport { Guide } from '../components/Guides'\nimport { DefaultFrigadeFlowProps } from '../types'\nimport { useTheme } from '../hooks/useTheme'\n\nexport interface FrigadeGuideProps extends DefaultFrigadeFlowProps {\n title: string\n primaryColor?: string\n}\n\nexport const FrigadeGuide: FC<FrigadeGuideProps> = ({ flowId, style, appearance, ...props }) => {\n const { getFlow, targetingLogicShouldHideFlow, getFlowSteps } = useFlows()\n const { mergeAppearanceWithDefault } = useTheme()\n appearance = mergeAppearanceWithDefault(appearance)\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n const steps = getFlowSteps(flowId)\n\n return <Guide steps={steps} style={style} appearance={appearance} {...props} />\n}\n","import React, { CSSProperties, FC, useContext, useEffect } from 'react'\nimport { useFlows } from '../api/flows'\nimport { ToolTipData, Tooltips } from '../components/Tooltips'\nimport { Appearance, DefaultFrigadeFlowProps, StepData } from '../types'\nimport { COMPLETED_FLOW, COMPLETED_STEP } from '../api/common'\nimport { Portal } from 'react-portal'\nimport { useFlowOpens } from '../api/flow-opens'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { useTheme } from '../hooks/useTheme'\nimport { useUserFlowStates } from '../api/user-flow-states'\nimport { ToolTipPosition } from '../components/Tooltips/Tooltips'\n\nexport interface FrigadeTourProps extends Omit<DefaultFrigadeFlowProps, 'flowId'> {\n /**\n * @ignore\n */\n steps?: ToolTipData[]\n onDismiss?: () => void\n onComplete?: () => void\n tooltipPosition?: ToolTipPosition\n /**\n * Whether to show the highlight (the small circle/ping) or not. Defaults to true.\n */\n showHighlight?: boolean\n /**\n * Whether to show more than one tooltip at a time. Defaults to false.\n */\n showTooltipsSimultaneously?: boolean\n /**\n * @ignore\n */\n buttonStyle?: CSSProperties\n /**\n * Offset to apply to all tooltips. If you only wish to apply an offset to a single tooltip you can use `props.offset` in the config.yml instead.\n */\n offset?: { x: number; y: number }\n visible?: boolean\n /**\n * @ignore\n */\n containerStyle?: CSSProperties\n customVariables?: { [key: string]: string | number | boolean }\n /**\n * @ignore\n */\n selectedStep?: number\n customStepTypes?: Record<\n string,\n (props: { stepData: StepData; primaryColor: string }) => React.ReactNode\n >\n appearance?: Appearance\n /**\n * Shows a close button in the top right corner of the tooltip. Depending on dismissBehavior, it will either end the entire flow or just the current step.\n */\n dismissible?: boolean\n primaryColor?: string\n /**\n * If true, the tooltip will only show the highlight and not the tooltip itself.\n * Clicking the highlight will reveal it.\n */\n showHighlightOnly?: boolean\n /**\n * If true, a step counter will show up in the tooltip.\n */\n showStepCount?: boolean\n /**\n * `skip-flow` (default): Completes the entire flow/tour when a single tooltip is dismissed.\n * `complete-step`: Completes the current step when a tooltip is dismissed. The user can continue in the tour.\n */\n dismissBehavior?: 'skip-flow' | 'complete-step'\n\n /**\n * @ignore\n */\n showFrigadeBranding?: boolean\n\n /**\n * If true, the tour will go to the next existing step/tip if the current selector element is not found on the page.\n * Be careful with this, as it can lead to unexpected behavior of tooltip ordering if the selector is slow to load on the page.\n * Defaults to false.\n */\n skipIfNotFound?: boolean\n /**\n * How to position the tooltips with CSS. Defaults to `absolute`.\n * @ignore\n */\n cssPosition?: 'fixed' | 'absolute' | 'static'\n}\n\nexport const FrigadeTour: FC<\n FrigadeTourProps & { flowId: string; initialSelectedStep?: number }\n> = ({\n flowId,\n customVariables,\n appearance,\n onStepCompletion,\n onButtonClick,\n showTooltipsSimultaneously = false,\n onDismiss,\n dismissible,\n tooltipPosition = 'auto',\n showHighlightOnly = false,\n dismissBehavior = 'skip-flow',\n onComplete,\n skipIfNotFound = false,\n cssPosition = 'absolute',\n className,\n ...props\n}) => {\n const {\n getFlow,\n getFlowSteps,\n isLoading,\n targetingLogicShouldHideFlow,\n markStepCompleted,\n markStepStarted,\n markFlowCompleted,\n markFlowSkipped,\n updateCustomVariables,\n getCurrentStepIndex,\n getStepStatus,\n isStepBlocked,\n getFlowStatus,\n getNumberOfStepsCompleted,\n } = useFlows()\n const { isLoadingUserFlowStateData } = useUserFlowStates()\n const { primaryCTAClickSideEffects, secondaryCTAClickSideEffects } = useCTAClickSideEffects()\n const { hasOpenModals } = useFlowOpens()\n const selectedStep = getCurrentStepIndex(flowId)\n const { openFlowStates } = useContext(FrigadeContext)\n\n const { mergeAppearanceWithDefault } = useTheme()\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n if (isLoadingUserFlowStateData) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (getFlowStatus(flowId) == COMPLETED_FLOW) {\n return null\n }\n\n // Check if any other flow modals are open. If so hide this one\n if (hasOpenModals()) {\n return null\n }\n\n const steps: ToolTipData[] = getFlowSteps(flowId)\n\n // Hide tour flow if another flow is open\n if (Object.keys(openFlowStates).length > 0) {\n const otherFlowId = Object.keys(openFlowStates).find(\n (_flowID) => openFlowStates[_flowID] === true\n )\n if (otherFlowId !== undefined && otherFlowId !== flowId) {\n return <></>\n }\n }\n\n async function markTooltipCompleted(stepData: StepData) {\n await markStepCompleted(flowId, stepData.id)\n\n // Check if all steps are now completed\n if (\n steps\n .map((step: StepData) => getStepStatus(flowId, step.id))\n .every((status) => status === COMPLETED_STEP)\n ) {\n await markFlowCompleted(flowId)\n return\n }\n if (!showHighlightOnly && selectedStep + 1 < steps.length && !showTooltipsSimultaneously) {\n // Double check next step is not blocked\n if (isStepBlocked(flowId, steps[selectedStep + 1].id)) {\n return\n }\n }\n }\n\n function handleStepCompletionHandlers(step: StepData, cta: 'primary' | 'secondary', idx: number) {\n const maybeNextStep = selectedStep + 1 < steps.length ? steps[selectedStep + 1] : null\n if (onButtonClick) {\n onButtonClick(step, selectedStep, cta, maybeNextStep)\n }\n if (onStepCompletion) {\n onStepCompletion(step, idx, maybeNextStep)\n }\n }\n\n function getSteps() {\n return steps.map((step: StepData) => {\n return {\n ...step,\n handleSecondaryButtonClick: async () => {\n // Default to skip behavior for secondary click but allow for override\n secondaryCTAClickSideEffects(step)\n if (step.skippable === true) {\n await markStepCompleted(flowId, step.id, { skipped: true })\n }\n handleStepCompletionHandlers(step, 'secondary', selectedStep)\n },\n handlePrimaryButtonClick: async () => {\n if (\n (!step.completionCriteria &&\n (step.autoMarkCompleted || step.autoMarkCompleted === undefined)) ||\n (step.completionCriteria && step.autoMarkCompleted === true)\n ) {\n await markTooltipCompleted(step)\n }\n handleStepCompletionHandlers(step, 'primary', selectedStep)\n primaryCTAClickSideEffects(step)\n },\n }\n })\n }\n\n async function onDismissTooltip(stepData: StepData) {\n if (onDismiss) {\n onDismiss()\n }\n if (dismissBehavior === 'skip-flow') {\n await markFlowSkipped(flowId)\n } else {\n await markStepCompleted(flowId, stepData.id)\n }\n }\n\n function handleComplete() {\n if (onComplete) {\n onComplete()\n }\n }\n\n async function handleViewTooltip(index: number) {\n await markStepStarted(flowId, steps[index].id)\n }\n\n const isCurrentSelectorMissing = !Boolean(document.querySelector(steps[selectedStep].selector))\n\n function renderMultipleToolTips() {\n const firstVisibleIndex = steps.findIndex((step, idx) => {\n return Boolean(document.querySelector(step.selector)) && idx >= selectedStep\n })\n\n return steps.map((step: StepData, idx: number) => {\n if (showTooltipsSimultaneously) {\n return (\n <Tooltips\n key={step.id}\n appearance={appearance}\n steps={getSteps()}\n selectedStep={idx}\n showTooltipsSimultaneously={showTooltipsSimultaneously}\n dismissible={dismissible}\n onDismiss={() => onDismissTooltip(step)}\n tooltipPosition={tooltipPosition}\n showHighlightOnly={showHighlightOnly}\n completedStepsCount={getNumberOfStepsCompleted(flowId)}\n onComplete={handleComplete}\n cssPosition={cssPosition}\n onViewTooltip={handleViewTooltip}\n className={className}\n {...props}\n />\n )\n }\n\n if (skipIfNotFound && isCurrentSelectorMissing && idx === firstVisibleIndex) {\n return (\n <Tooltips\n key={step.id}\n appearance={appearance}\n steps={getSteps()}\n selectedStep={idx}\n showTooltipsSimultaneously={showTooltipsSimultaneously}\n dismissible={dismissible}\n onDismiss={() => onDismissTooltip(step)}\n tooltipPosition={tooltipPosition}\n showHighlightOnly={showHighlightOnly}\n completedStepsCount={getNumberOfStepsCompleted(flowId)}\n onComplete={handleComplete}\n cssPosition={cssPosition}\n onViewTooltip={handleViewTooltip}\n className={className}\n {...props}\n />\n )\n }\n\n if (idx != selectedStep) {\n return null\n }\n\n return (\n <Tooltips\n key={step.id}\n appearance={appearance}\n steps={getSteps()}\n selectedStep={idx}\n showTooltipsSimultaneously={showTooltipsSimultaneously}\n dismissible={dismissible}\n onDismiss={() => onDismissTooltip(step)}\n tooltipPosition={tooltipPosition}\n showHighlightOnly={showHighlightOnly}\n completedStepsCount={getNumberOfStepsCompleted(flowId)}\n onComplete={handleComplete}\n cssPosition={cssPosition}\n onViewTooltip={handleViewTooltip}\n className={className}\n {...props}\n />\n )\n })\n }\n\n function getTooltips() {\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n {renderMultipleToolTips()}\n </>\n )\n }\n\n if (cssPosition === 'static') {\n return getTooltips()\n }\n\n return <Portal>{getTooltips()}</Portal>\n}\n\nexport default FrigadeTour\n","import React, { CSSProperties, FC, useEffect, useLayoutEffect, useRef, useState } from 'react'\n\nimport { Button } from '../Button'\nimport { Close } from '../Icons/Close'\nimport styled from 'styled-components'\nimport { getPosition, useElemRect } from './position'\nimport {\n TooltipContainer,\n TooltipContentContainer,\n TooltipCTAContainer,\n TooltipDismissButton,\n TooltipFooter,\n TooltipImageContainer,\n TooltipStepCountContainer,\n TooltipStepCounter,\n TooltipVideoContainer,\n} from './styled'\nimport { StepData } from '../../types'\n\nimport { getClassName } from '../../shared/appearance'\nimport { TitleSubtitle } from '../TitleSubtitle/TitleSubtitle'\nimport { VideoCard } from '../Video/VideoCard'\nimport { PoweredByFrigadeTooltipRibbon } from '../branding/styled'\nimport { PoweredByFrigade } from '../branding/PoweredByFrigade'\nimport { FrigadeTourProps } from '../../FrigadeTour'\nimport { useDebug } from '../../hooks/useDebug'\n\nexport type ToolTipPosition = 'left' | 'right' | 'auto'\n\nconst DEFAULT_CARD_WIDTH = 300\nconst DEFAULT_CARD_HEIGHT = 100\nconst DEFAULT_REFRESH_DELAY = 500\nconst HIGHLIGHT_RADIUS = 12\n\nexport interface ToolTipData extends StepData {\n selector?: string\n subtitleStyle?: CSSProperties\n titleStyle?: CSSProperties\n buttonStyle?: CSSProperties\n}\n\ninterface ToolTipPropsInternal extends FrigadeTourProps {\n completedStepsCount: number\n onViewTooltip: (step: number) => void\n}\n\nconst HighlightOuter = styled.div<{ primaryColor: string }>`\n width: 100%;\n height: 100%;\n border-radius: 9999px;\n display: inline-flex;\n background-color: ${(props: any) => props.primaryColor};\n animation-duration: 1.5s;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n animation-delay: 0.15s;\n animation-iteration-count: infinite;\n animation-direction: normal;\n animation-fill-mode: none;\n animation-play-state: running;\n animation-name: ping;\n opacity: 0.15;\n\n @keyframes ping {\n 75%,\n to {\n transform: scale(1.75);\n opacity: 0;\n }\n }\n`\n\nconst HighlightInner = styled.div<{ primaryColor: string }>`\n width: ${HIGHLIGHT_RADIUS}px;\n height: ${HIGHLIGHT_RADIUS}px;\n border-radius: 100px;\n background-color: ${(props) => props.primaryColor};\n z-index: 20;\n opacity: 1;\n`\n\nconst TooltipWrapper = styled.div`\n pointer-events: all;\n`\n\nconst PositionWrapper = styled.div<{ primaryColor: string }>`\n display: flex;\n align-content: center;\n justify-content: center;\n align-items: center;\n z-index: ${(props) => (props.zIndex ? props.zIndex : 90)};\n`\n\nconst HighlightContainer = styled(PositionWrapper)`\n width: ${HIGHLIGHT_RADIUS + 12}px;\n height: ${HIGHLIGHT_RADIUS + 12}px;\n`\n\nconst Tooltips: FC<ToolTipPropsInternal> = ({\n steps = [],\n onDismiss,\n onComplete = () => {},\n tooltipPosition = 'auto',\n showHighlight = true,\n primaryColor = '#000000',\n offset = { x: 0, y: 0 },\n visible = true,\n containerStyle = {},\n selectedStep = 0,\n customStepTypes,\n appearance,\n dismissible = false,\n showHighlightOnly,\n showStepCount = true,\n completedStepsCount = 0,\n showFrigadeBranding = false,\n cssPosition = 'absolute',\n onViewTooltip,\n className,\n}) => {\n const { logErrorIfDebugMode } = useDebug()\n const [selfBounds, setSelfBounds] = useState<undefined | Partial<DOMRect>>()\n const [needsUpdate, setNeedsUpdate] = useState(new Date())\n const selfRef = useRef(null)\n\n const [elem, setElem] = useState(document.querySelector(steps[selectedStep].selector))\n const boundingRect = useElemRect(elem, needsUpdate)\n const [lastBoundingRect, setLastBoundingRect] = useState<string>()\n const [showTooltipContainer, setShowTooltipContainer] = useState(!showHighlightOnly)\n const positionStyle =\n cssPosition != 'static'\n ? steps[selectedStep]?.props?.position\n ? steps[selectedStep].props.position\n : cssPosition\n : 'static'\n const zIndex = steps[selectedStep]?.props?.zIndex ?? 90\n const cardWidth = selfBounds?.width ?? DEFAULT_CARD_WIDTH\n const cardHeight = selfBounds?.height ?? DEFAULT_CARD_HEIGHT\n const [renderTime, setRenderTime] = useState(new Date().getTime())\n offset = cssPosition != 'static' ? steps[selectedStep]?.props?.offset ?? offset : { x: 0, y: 0 }\n\n const url = window.location.pathname.split('/').pop()\n\n useLayoutEffect(() => {\n if (selfRef.current) {\n setSelfBounds({\n width: selfRef.current.clientWidth,\n height: selfRef.current.clientHeight,\n })\n }\n }, [selectedStep, needsUpdate, positionStyle])\n\n useEffect(() => {\n if (!showHighlightOnly) {\n setShowTooltipContainer(true)\n }\n }, [selectedStep])\n\n useEffect(() => {\n if (visible && showTooltipContainer) {\n onViewTooltip(selectedStep)\n }\n }, [showTooltipContainer])\n\n const handleRefreshPosition = () => {\n if (positionStyle === 'static') {\n return\n }\n\n const elem = document.querySelector(steps[selectedStep].selector)\n if (!elem) {\n setLastBoundingRect(undefined)\n setElem(null)\n logErrorIfDebugMode(\n `FrigadeTour: Could not find element with selector \"${steps[selectedStep].selector}\" for step ${steps[selectedStep].id}`\n )\n return\n }\n if (lastBoundingRect && lastBoundingRect === JSON.stringify(elem?.getBoundingClientRect())) {\n return\n }\n setElem(elem)\n setNeedsUpdate(new Date())\n if (elem) {\n setLastBoundingRect(JSON.stringify(elem.getBoundingClientRect()))\n }\n }\n\n useEffect(() => {\n const observer = new MutationObserver(handleRefreshPosition)\n observer.observe(document.body, { subtree: true, childList: true })\n return () => observer.disconnect()\n }, [handleRefreshPosition])\n\n useEffect(() => {\n const observer = new MutationObserver(handleRefreshPosition)\n observer.observe(document.body, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['style', 'class'],\n })\n return () => observer.disconnect()\n }, [handleRefreshPosition])\n\n useEffect(() => {\n const intervalId = setInterval(() => {\n handleRefreshPosition()\n }, 10)\n return () => clearInterval(intervalId)\n }, [handleRefreshPosition])\n\n useLayoutEffect(() => {\n setTimeout(() => {\n handleRefreshPosition()\n }, DEFAULT_REFRESH_DELAY)\n\n handleRefreshPosition()\n }, [selectedStep, url])\n\n useEffect(() => {\n if (!visible) {\n return\n }\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n onDismiss()\n }\n }\n document.addEventListener('keydown', handleEscape)\n\n return () => {\n document.removeEventListener('keydown', handleEscape)\n }\n }, [])\n\n if (elem === null || !visible) {\n return null\n }\n\n let tooltipPositionValue: ToolTipPosition =\n tooltipPosition === 'auto' ? 'right' : (tooltipPosition as ToolTipPosition)\n\n let position = getPosition(boundingRect, tooltipPositionValue, cardWidth, offset, positionStyle)\n\n const rightSideIsCropped =\n boundingRect.right + cardWidth > (window.innerWidth || document.documentElement.clientWidth)\n const bottomIsCropped =\n boundingRect.bottom + DEFAULT_CARD_HEIGHT >\n (window.innerHeight || document.documentElement.clientHeight)\n\n if (rightSideIsCropped && tooltipPosition === 'auto') {\n position = getPosition(boundingRect, 'left', cardWidth, offset, positionStyle)\n tooltipPositionValue = 'left'\n }\n\n if (\n steps[selectedStep]?.props?.tooltipPosition &&\n steps[selectedStep]?.props?.tooltipPosition !== 'auto' &&\n (steps[selectedStep]?.props?.tooltipPosition === 'left' ||\n steps[selectedStep]?.props?.tooltipPosition === 'right')\n ) {\n tooltipPositionValue = steps[selectedStep].props.tooltipPosition\n }\n\n const DefaultFooterContent = () => {\n const handleOnCTAClick = () => {\n if (steps[selectedStep].handlePrimaryButtonClick) {\n steps[selectedStep].handlePrimaryButtonClick()\n setShowTooltipContainer(false)\n setTimeout(() => {\n handleRefreshPosition()\n }, 30)\n }\n if (completedStepsCount === steps.length - 1) {\n return onComplete()\n }\n }\n\n const handleOnSecondaryCTAClick = () => {\n if (steps[selectedStep].handleSecondaryButtonClick) {\n steps[selectedStep].handleSecondaryButtonClick()\n if (showHighlightOnly && !steps[selectedStep].secondaryButtonUri) {\n setShowTooltipContainer(false)\n }\n }\n }\n\n return (\n <>\n {showStepCount && steps.length > 1 && (\n <TooltipStepCountContainer>\n <TooltipStepCounter\n role=\"status\"\n className={getClassName('tooltipStepCounter', appearance)}\n >\n {selectedStep + 1} of {steps.length}\n </TooltipStepCounter>\n </TooltipStepCountContainer>\n )}\n {(steps[selectedStep].primaryButtonTitle || steps[selectedStep].secondaryButtonTitle) && (\n <TooltipCTAContainer\n showStepCount={showStepCount}\n className={getClassName('tooltipCTAContainer', appearance)}\n >\n {steps[selectedStep].secondaryButtonTitle && (\n <Button\n title={steps[selectedStep].secondaryButtonTitle}\n appearance={appearance}\n onClick={handleOnSecondaryCTAClick}\n size=\"small\"\n withMargin={false}\n secondary\n />\n )}\n {steps[selectedStep].primaryButtonTitle && (\n <Button\n title={steps[selectedStep].primaryButtonTitle}\n appearance={appearance}\n onClick={handleOnCTAClick}\n withMargin={false}\n size=\"small\"\n />\n )}\n </TooltipCTAContainer>\n )}\n </>\n )\n }\n\n const DefaultTooltipStepContent = () => {\n return (\n <>\n {dismissible && (\n <TooltipDismissButton\n data-testid=\"tooltip-dismiss\"\n onClick={() => {\n if (onDismiss) {\n onDismiss()\n }\n }}\n className={getClassName('tooltipClose', appearance)}\n hasImage={!!steps[selectedStep].imageUri || !!steps[selectedStep].videoUri}\n aria-label=\"Close Tooltip\"\n role=\"button\"\n tabIndex={0}\n >\n <Close />\n </TooltipDismissButton>\n )}\n {steps[selectedStep].imageUri && (\n <TooltipImageContainer\n dismissible={dismissible}\n appearance={appearance}\n role=\"img\"\n aria-label={steps[selectedStep].title}\n src={steps[selectedStep].imageUri}\n className={getClassName('tooltipImageContainer', appearance)}\n />\n )}\n {steps[selectedStep].videoUri && !steps[selectedStep].imageUri && (\n <TooltipVideoContainer\n dismissible={dismissible}\n appearance={appearance}\n role=\"video\"\n aria-label={steps[selectedStep].title}\n className={getClassName('tooltipVideoContainer', appearance)}\n >\n <VideoCard\n appearance={appearance}\n videoUri={steps[selectedStep].videoUri}\n autoplay={steps[selectedStep].props?.autoplayVideo}\n loop={steps[selectedStep].props?.loopVideo}\n hideControls={steps[selectedStep].props?.hideVideoControls}\n />\n </TooltipVideoContainer>\n )}\n <TooltipContentContainer className={getClassName('tooltipContentContainer', appearance)}>\n <TitleSubtitle\n appearance={appearance}\n title={steps[selectedStep].title}\n subtitle={steps[selectedStep].subtitle}\n size=\"small\"\n ariaPrefix={`Tooltip${steps[selectedStep].id}`}\n />\n <TooltipFooter className={getClassName('tooltipFooter', appearance)}>\n <DefaultFooterContent />\n </TooltipFooter>\n </TooltipContentContainer>\n </>\n )\n }\n\n const DEFAULT_CUSTOM_STEP_TYPES = {\n default: (_: StepData) => {\n if (steps[selectedStep]?.StepContent) {\n const Content: React.ReactNode = steps[selectedStep].StepContent\n return <div>{Content}</div>\n }\n\n return <DefaultTooltipStepContent />\n },\n }\n\n const mergedCustomStepTypes = { ...DEFAULT_CUSTOM_STEP_TYPES, ...customStepTypes }\n\n const StepContent = () => {\n if (!steps) return <></>\n if (!steps[selectedStep]?.type || !mergedCustomStepTypes[steps[selectedStep].type]) {\n return mergedCustomStepTypes['default'](steps[selectedStep])\n }\n return mergedCustomStepTypes[steps[selectedStep].type]({\n stepData: steps[selectedStep],\n primaryColor: primaryColor,\n })\n }\n\n if (steps[selectedStep].complete === true) {\n return null\n }\n\n // Do not position the tooltip until 10ms after the first render\n // This is to prevent the tooltip from appearing in the wrong place\n // when the page is loading\n if (position.x == 0 && position.y == 0 && new Date().getTime() - renderTime < 100) {\n return null\n }\n\n const cssPos = {\n top: position?.y - HIGHLIGHT_RADIUS ?? 0,\n left:\n (tooltipPositionValue == 'left'\n ? boundingRect.x + offset.x\n : position?.x - HIGHLIGHT_RADIUS) ?? 0,\n cursor: showHighlightOnly ? 'pointer' : 'default',\n position: positionStyle,\n }\n\n // Lock tooltip position to be within bounds of the window\n const getBoundedLeftPosition = () => {\n const spaceFromEdge = 20\n const leftOffset = cssPos.left + (tooltipPositionValue == 'left' ? -cardWidth : 24)\n\n return Math.min(\n Math.max(leftOffset, spaceFromEdge),\n window.innerWidth - cardWidth - spaceFromEdge\n )\n }\n\n const getBoundedTopPosition = () => {\n const tooltipBottom = cssPos.top + cardHeight\n const spaceFromEdge = 20\n if (tooltipBottom > window.innerHeight - spaceFromEdge) {\n return cssPos.top + -cardHeight\n }\n return cssPos.top\n }\n\n const handleClick = () => {\n if (showHighlightOnly) {\n setNeedsUpdate(new Date())\n setShowTooltipContainer(!showTooltipContainer)\n }\n }\n\n return (\n <TooltipWrapper className={className}>\n <HighlightContainer\n style={cssPos}\n zIndex={zIndex}\n className={getClassName('tourHighlightContainer', appearance)}\n >\n {showHighlight &&\n steps[selectedStep].showHighlight !== false &&\n cssPosition !== 'static' && (\n <>\n <HighlightInner\n style={{\n position: positionStyle,\n }}\n onClick={handleClick}\n primaryColor={appearance.theme.colorPrimary}\n className={getClassName('tourHighlightInnerCircle', appearance)}\n ></HighlightInner>\n <HighlightOuter\n style={{\n position: 'absolute',\n }}\n onClick={handleClick}\n primaryColor={appearance.theme.colorPrimary}\n className={getClassName('tourHighlightOuterCircle', appearance)}\n ></HighlightOuter>\n </>\n )}\n </HighlightContainer>\n <PositionWrapper\n style={{\n ...cssPos,\n left: getBoundedLeftPosition(),\n top: getBoundedTopPosition(),\n }}\n zIndex={zIndex + 1}\n className={getClassName('tooltipContainerWrapper', appearance)}\n >\n {showTooltipContainer && (\n <>\n <TooltipContainer\n ref={selfRef}\n role=\"dialog\"\n aria-labelledby={`frigadeTooltip${steps[selectedStep].id}Title`}\n aria-describedby={`frigadeTooltip${steps[selectedStep].id}Subtitle`}\n layoutId=\"tooltip-container\"\n tabIndex={0}\n aria-label=\"Tooltip\"\n style={{\n position: 'relative',\n width: 'max-content',\n right: 0,\n top: cssPosition !== 'static' ? 12 : 0,\n ...containerStyle,\n }}\n appearance={appearance}\n className={getClassName('tooltipContainer', appearance)}\n maxWidth={DEFAULT_CARD_WIDTH}\n zIndex={zIndex + 10}\n >\n <StepContent />\n </TooltipContainer>\n {showFrigadeBranding && (\n <PoweredByFrigadeTooltipRibbon\n className={getClassName('poweredByFrigadeTooltipRibbon', appearance)}\n appearance={appearance}\n zIndex={zIndex + 10}\n >\n <PoweredByFrigade appearance={appearance} />\n </PoweredByFrigadeTooltipRibbon>\n )}\n </>\n )}\n </PositionWrapper>\n </TooltipWrapper>\n )\n}\n\nexport default Tooltips\n","import { ToolTipPosition } from './Tooltips'\nimport { useCallback, useEffect, useState } from 'react'\n\ntype Point = {\n x: number\n y: number\n}\n\nexport const getPosition = (\n boundingRect: DOMRect,\n position: ToolTipPosition,\n cardWidth: number,\n offset: Point = { x: 20, y: 20 },\n positionStyle: string\n): Point => {\n const scrollY = positionStyle == 'fixed' ? 0 : window.scrollY\n const scrollX = positionStyle == 'fixed' ? 0 : window.scrollX\n\n if (position === 'left') {\n return {\n x: boundingRect.left - cardWidth + offset.x + scrollX,\n y: boundingRect.top - offset.y + scrollY,\n }\n } else if (position === 'right') {\n return {\n x: boundingRect.left + boundingRect.width + offset.x + scrollX,\n y: boundingRect.top - offset.y + scrollY,\n }\n }\n\n return { x: 0, y: 0 }\n}\n\nexport function useElemRect(elem: Element | undefined, refresher?: any): DOMRect {\n // Spoof DOMRect for server renders\n const initialRect =\n 'DOMRect' in globalThis\n ? new DOMRect()\n : {\n height: 0,\n width: 0,\n x: 0,\n y: 0,\n bottom: 0,\n top: 0,\n right: 0,\n left: 0,\n toJSON: () => {},\n }\n\n const [dimensions, setDimensions] = useState(initialRect)\n const handleResize = useCallback(() => {\n if (!elem) return\n setDimensions(elem.getBoundingClientRect())\n }, [elem])\n\n useEffect(() => {\n handleResize()\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [elem, refresher])\n\n return dimensions\n}\n","import { useContext, useState } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\n\nexport function useDebug() {\n const { debug } = useContext(FrigadeContext)\n const [logMessages, setLogMessages] = useState<string[]>([])\n\n function logIfDebugMode(message) {\n if (!debug) {\n return\n }\n if (logMessages.find((m) => m === message)) {\n return\n }\n setLogMessages([...logMessages, message])\n console.log(message)\n }\n\n function logErrorIfDebugMode(message) {\n if (!debug) {\n return\n }\n if (logMessages.find((m) => m === message)) {\n return\n }\n setLogMessages([...logMessages, message])\n console.warn(message)\n }\n\n return {\n logIfDebugMode,\n logErrorIfDebugMode,\n }\n}\n","import React, { FC, useEffect, useRef, useState } from 'react'\n\nimport { DefaultFrigadeFlowProps, StepData } from '../types'\nimport { useFlows } from '../api/flows'\nimport { Portal } from 'react-portal'\nimport {\n FloatingWidgetButton,\n FloatingWidgetContainer,\n FloatingWidgetMenu,\n FlowWidgetMenuItem,\n SupportButton,\n SupportIconContainer,\n SupportTitle,\n} from './styled'\nimport { Question } from '../components/Icons/Question'\nimport { getClassName } from '../shared/appearance'\nimport { QuestionCircle } from '../components/Icons/QuestionCircle'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { useTheme } from '../hooks/useTheme'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\n\nexport interface FrigadeSupportWidgetProps extends DefaultFrigadeFlowProps {\n type?: 'floating' | 'inline'\n visible?: boolean\n title?: string\n}\n\nexport const FrigadeSupportWidget: FC<FrigadeSupportWidgetProps> = ({\n flowId,\n style,\n onStepCompletion,\n visible = true,\n type = 'inline',\n title = 'Help',\n appearance,\n}) => {\n const {\n getFlow,\n getFlowSteps,\n markStepCompleted,\n getStepStatus,\n getNumberOfStepsCompleted,\n isLoading,\n targetingLogicShouldHideFlow,\n } = useFlows()\n const { primaryCTAClickSideEffects } = useCTAClickSideEffects()\n const wrapperRef = useRef(null)\n const [showMenu, setShowMenu] = useState(false)\n const { mergeAppearanceWithDefault } = useTheme()\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n // below is the same as componentDidMount and componentDidUnmount\n useEffect(() => {\n document.addEventListener('click', handleClickOutside, false)\n return () => {\n document.removeEventListener('click', handleClickOutside, false)\n }\n }, [])\n\n const handleClickOutside = (event) => {\n if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {\n setShowMenu(false)\n }\n }\n\n if (isLoading) {\n return null\n }\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n const steps: StepData[] = getFlowSteps(flowId)\n if (!steps) {\n return null\n }\n\n if (!visible) {\n return null\n }\n\n function handlePrimaryButtonClick(step: StepData, index: number) {\n if (\n !step.completionCriteria &&\n (step.autoMarkCompleted || step.autoMarkCompleted === undefined)\n ) {\n markStepCompleted(flowId, step.id)\n }\n primaryCTAClickSideEffects(step)\n if (onStepCompletion) {\n onStepCompletion(step, index)\n }\n setShowMenu(false)\n }\n\n function Menu() {\n return (\n showMenu && (\n <FloatingWidgetMenu\n className={getClassName('floatingWidgetMenu', appearance)}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.1 }}\n type={type}\n >\n {steps.map((step, index) => (\n <FlowWidgetMenuItem\n className={getClassName('floatingWidgetMenuItem', appearance)}\n key={index}\n onClick={() => handlePrimaryButtonClick(step, index)}\n >\n {step.title}\n </FlowWidgetMenuItem>\n ))}\n </FloatingWidgetMenu>\n )\n )\n }\n\n if (type == 'inline') {\n return (\n <span ref={wrapperRef}>\n <RenderInlineStyles appearance={appearance} />\n <SupportButton\n style={style}\n onClick={() => {\n setShowMenu(!showMenu)\n }}\n className={getClassName('supportButton', appearance)}\n >\n <SupportIconContainer className={getClassName('supportIconContainer', appearance)}>\n <QuestionCircle\n className={getClassName('supportIcon', appearance)}\n style={{ width: '18px', height: '18px' }}\n />\n </SupportIconContainer>\n <SupportTitle className={getClassName('supportButtonTitle', appearance)}>\n {title}\n </SupportTitle>\n </SupportButton>\n <Menu />\n </span>\n )\n }\n\n return (\n <Portal>\n <RenderInlineStyles appearance={appearance} />\n <FloatingWidgetContainer style={style} ref={wrapperRef}>\n <Menu />\n <FloatingWidgetButton\n onClick={() => {\n setShowMenu(!showMenu)\n }}\n whileHover={{ scale: 1.1 }}\n className={getClassName('floatingWidgetButton', appearance)}\n >\n <Question\n className={getClassName('floatingWidgetButtonIcon', appearance)}\n style={{ display: 'flex', width: '20px', height: '20px' }}\n />\n </FloatingWidgetButton>\n </FloatingWidgetContainer>\n </Portal>\n )\n}\n\nexport default FrigadeSupportWidget\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../shared/appearance'\n\nexport const SupportButton = styled.button`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n padding: 6px 10px;\n gap: 8px;\n\n background: #fafafa;\n border: 1px solid #d9d9d9;\n border-radius: 21px;\n font-size: 12px;\n :hover {\n opacity: 0.8;\n }\n }\n`\n\nexport const SupportTitle = styled.span`\n ${(props) => getCustomClassOverrides(props)} {\n font-size: 12px;\n display: inline-block;\n }\n`\nexport const SupportIconContainer = styled.span`\n ${(props) => getCustomClassOverrides(props)} {\n font-size: 12px;\n display: inline-block;\n }\n`\n\nexport const FloatingWidgetContainer = styled.div`\n position: fixed;\n right: 0;\n bottom: 0;\n margin-right: 24px;\n margin-bottom: 24px;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n z-index: 50;\n`\n\nexport const FloatingWidgetButton = styled.button`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n background-color: #ffffff;\n border: 1px solid #f5f5f5;\n }\n width: 50px;\n height: 50px;\n display: flex;\n align-content: center;\n align-items: center;\n justify-content: center;\n box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05), 0px 6px 16px rgba(0, 0, 0, 0.08),\n 0px 3px 6px -4px rgba(0, 0, 0, 0.12);\n border-radius: 45px;\n cursor: pointer;\n`\nexport const FloatingWidgetMenu = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n background: #ffffff;\n }\n\n display: flex;\n flex-direction: column;\n min-width: 200px;\n padding: 4px;\n box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05), 0px 6px 16px rgba(0, 0, 0, 0.08),\n 0px 3px 6px -4px rgba(0, 0, 0, 0.12);\n border-radius: 8px;\n margin-bottom: 22px;\n position: ${(props) => (props.type == 'inline' ? 'absolute' : 'relative')};\n top: ${(props) => (props.type == 'inline' ? '68px' : 0)};\n margin-left: ${(props) => (props.type == 'inline' ? '-127px' : 0)};\n`\n\nexport const FlowWidgetMenuItem = styled.button`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n color: #434343;\n :hover {\n background-color: #f5f5f5;\n }\n }\n\n display: flex;\n border-radius: 8px;\n background-color: transparent;\n border: none;\n cursor: pointer;\n font-size: 14px;\n\n padding: 8px 12px;\n`\n","import React, { CSSProperties } from 'react'\n\nexport const Question = ({\n style,\n className,\n}: {\n color?: string\n style?: CSSProperties\n className?: string\n}) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"18\"\n fill=\"none\"\n viewBox=\"0 0 18 18\"\n style={style}\n className={className}\n >\n <path\n fill=\"currentColor\"\n 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\"\n ></path>\n </svg>\n)\n","import React, { CSSProperties } from 'react'\n\nexport const QuestionCircle = ({\n style,\n className,\n}: {\n color?: string\n style?: CSSProperties\n className?: string\n}) => (\n <svg\n style={style}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n)\n","import { DefaultFrigadeFlowProps } from '../types'\nimport React, { useEffect } from 'react'\nimport { useFlows } from '../api/flows'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { useTheme } from '../hooks/useTheme'\nimport { COMPLETED_FLOW } from '../api/common'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport { CallToActionContainer, DismissButton, EmbeddedTipContainer, TextContainer } from './styled'\nimport { getClassName, mergeClasses } from '../shared/appearance'\nimport { Close } from '../components/Icons/Close'\nimport { TitleSubtitle } from '../components/TitleSubtitle/TitleSubtitle'\nimport { Button } from '../components/Button'\nimport { useFlowImpressions } from '../hooks/useFlowImpressions'\nimport { MediaContainer } from '../FrigadeAnnouncement/styled'\nimport { Media } from '../components/Media'\n\nexport interface FrigadeEmbeddedTipProps extends DefaultFrigadeFlowProps {\n dismissible?: boolean\n /**\n * Handler for when the container is clicked\n */\n onClick?: () => void\n}\n\nexport const FrigadeEmbeddedTip: React.FC<FrigadeEmbeddedTipProps> = ({\n flowId,\n onDismiss,\n customVariables,\n onButtonClick,\n appearance,\n className,\n style,\n dismissible,\n onClick,\n}) => {\n const {\n getFlow,\n markFlowCompleted,\n markFlowSkipped,\n markStepCompleted,\n isLoading,\n targetingLogicShouldHideFlow,\n updateCustomVariables,\n getFlowSteps,\n getFlowStatus,\n getCurrentStepIndex,\n } = useFlows()\n const { primaryCTAClickSideEffects, secondaryCTAClickSideEffects } = useCTAClickSideEffects()\n const { mergeAppearanceWithDefault } = useTheme()\n useFlowImpressions(flowId)\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n if (isLoading) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (getFlowStatus(flowId) === COMPLETED_FLOW) {\n return null\n }\n\n const steps = getFlowSteps(flowId)\n\n const currentStep = steps[getCurrentStepIndex(flowId)]\n\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <EmbeddedTipContainer\n appearance={appearance}\n className={mergeClasses(getClassName('embeddedTipContainer', appearance), className)}\n style={style}\n onClick={onClick}\n >\n {(dismissible === true || currentStep.dismissible) && (\n <DismissButton\n onClick={async () => {\n await markFlowSkipped(flowId)\n if (onDismiss) {\n onDismiss()\n }\n }}\n className={getClassName('embeddedTipDismissButton', appearance)}\n >\n <Close />\n </DismissButton>\n )}\n {(currentStep.imageUri || currentStep.videoUri) && (\n <MediaContainer className={getClassName('embeddedTipMediaContainer', appearance)}>\n <Media appearance={appearance} stepData={currentStep} />\n </MediaContainer>\n )}\n <TextContainer className={getClassName('embeddedTipTextContainer', appearance)}>\n <TitleSubtitle\n size=\"small\"\n appearance={appearance}\n title={currentStep.title}\n subtitle={currentStep.subtitle}\n />\n </TextContainer>\n {(currentStep.primaryButtonTitle || currentStep.secondaryButtonTitle) && (\n <CallToActionContainer\n className={getClassName('embeddedTipCallToActionContainer', appearance)}\n >\n {currentStep.primaryButtonTitle && (\n <Button\n classPrefix=\"embeddedTip\"\n title={currentStep.primaryButtonTitle}\n appearance={appearance}\n withMargin={false}\n size=\"medium\"\n type=\"inline\"\n onClick={async () => {\n currentStep.handlePrimaryButtonClick()\n primaryCTAClickSideEffects(currentStep)\n if (onButtonClick) {\n const result = onButtonClick(\n currentStep,\n getCurrentStepIndex(flowId),\n 'primary'\n )\n if (result === false) {\n return\n }\n }\n await markStepCompleted(flowId, currentStep.id)\n await markFlowCompleted(flowId)\n }}\n />\n )}\n {currentStep.secondaryButtonTitle && (\n <Button\n classPrefix=\"embeddedTip\"\n title={currentStep.secondaryButtonTitle}\n appearance={appearance}\n withMargin={false}\n size=\"medium\"\n type=\"inline\"\n onClick={async () => {\n currentStep.handleSecondaryButtonClick()\n secondaryCTAClickSideEffects(currentStep)\n if (onButtonClick) {\n const result = onButtonClick(\n currentStep,\n getCurrentStepIndex(flowId),\n 'secondary'\n )\n if (result === false) {\n return\n }\n }\n }}\n secondary\n />\n )}\n </CallToActionContainer>\n )}\n </EmbeddedTipContainer>\n </>\n )\n}\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../shared/appearance'\n\nexport const EmbeddedTipContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: 400px;\n padding: 28px 18px;\n box-sizing: border-box;\n align-items: unset;\n background-color: ${(props) => props.appearance.theme.colorBackground};\n border-width: 1px;\n border-color: ${(props) => props.appearance.theme.colorBorder};\n border-radius: 12px;\n position: relative;\n }\n`\nexport const TextContainer = styled.div`\n display: flex;\n flex-direction: column;\n flex: 1;\n`\nexport const CallToActionContainer = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n margin-top: 16px;\n gap: 12px;\n`\n\nexport const DismissButton = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n position: absolute;\n top: 16px;\n right: 16px;\n cursor: pointer;\n\n :hover {\n opacity: 0.8;\n }\n }\n`\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../shared/appearance'\n\nexport const AnnouncementContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: 500px;\n box-sizing: border-box;\n align-items: unset;\n background-color: ${(props) => props.appearance.theme.colorBackground};\n position: relative;\n }\n`\nexport const TextContainer = styled.div`\n display: flex;\n flex-direction: column;\n flex: 1;\n`\n\nexport const PaginationContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n margin-bottom: 12px;\n margin-top: 4px;\n`\n\nexport const CallToActionContainer = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: stretch;\n gap: 16px;\n margin-top: 8px;\n`\n\nexport const MediaContainer = styled.div`\n margin-top: 16px;\n margin-bottom: 16px;\n`\n\nexport const DismissButton = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n position: absolute;\n top: -16px;\n right: -16px;\n cursor: pointer;\n\n :hover {\n opacity: 0.8;\n }\n }\n`\n\nexport const HeaderTitle = styled.h1`\n ${(props) => getCustomClassOverrides(props)} {\n font-style: normal;\n justify-content: center;\n text-align: center;\n font-size: 18px;\n font-weight: 700;\n line-height: 24px; /* 125% */\n letter-spacing: 0.36px;\n display: flex;\n align-items: center;\n color: ${(props) => props.appearance.theme.colorText};\n margin-bottom: 8px;\n }\n`\n\nexport const HeaderSubtitle = styled.h2`\n ${(props) => getCustomClassOverrides(props)} {\n font-style: normal;\n justify-content: center;\n text-align: center;\n font-weight: 400;\n color: ${(props) => props.appearance.theme.colorTextSecondary};\n font-size: 14px;\n line-height: 22px; /* 150% */\n letter-spacing: 0.28px;\n margin-bottom: 8px;\n }\n`\n","import { Appearance, StepData } from '../../types'\nimport { VideoCard } from '../Video/VideoCard'\nimport React from 'react'\nimport styled from 'styled-components'\nimport { getClassName } from '../../shared/appearance'\n\nexport const Image = styled.img`\n width: 100%;\n height: 100%;\n min-height: 200px;\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\n\nexport function Media({\n stepData,\n appearance,\n classPrefix = '',\n}: {\n stepData: StepData\n appearance: Appearance\n classPrefix?: string\n}) {\n if (stepData.videoUri) {\n return (\n <VideoCard\n appearance={appearance}\n videoUri={stepData.videoUri}\n autoplay={stepData.props?.autoplayVideo}\n loop={stepData.props?.loopVideo}\n hideControls={stepData.props?.hideVideoControls}\n />\n )\n }\n\n if (stepData.imageUri) {\n return (\n <Image\n className={getClassName(`${classPrefix}image`, appearance)}\n appearance={appearance}\n src={stepData.imageUri}\n />\n )\n }\n\n return null\n}\n","import React, { useEffect } from 'react'\n\nimport { useFlows } from '../api/flows'\nimport { DefaultFrigadeFlowProps, StepData } from '../types'\nimport { COMPLETED_FLOW } from '../api/common'\nimport {\n BannerContainer,\n CallToActionContainer,\n DismissButton,\n DismissButtonContainer,\n IconContainer,\n TextContainer,\n} from './styled'\nimport { Info } from '../components/Icons/Info'\nimport { Button } from '../components/Button'\nimport { Close } from '../components/Icons/Close'\nimport { getClassName } from '../shared/appearance'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { TitleSubtitle } from '../components/TitleSubtitle/TitleSubtitle'\nimport { useTheme } from '../hooks/useTheme'\nimport { useFlowImpressions } from '../hooks/useFlowImpressions'\n\nexport type FrigadeBannerType = 'full-width' | 'square'\n\nexport interface FrigadeBannerProps extends DefaultFrigadeFlowProps {\n /**\n * full-width: Full width banner, useful in top of the page.\n *\n * square: Square sized banner, useful in sidebars\n */\n type?: FrigadeBannerType\n title?: string\n subtitle?: string\n onDismiss?: () => void\n /**\n * Icon to use in the banner\n */\n icon?: React.ReactNode\n /**\n * Handler for when the banner container is clicked\n */\n onClick?: () => void\n}\n\nexport const FrigadeBanner: React.FC<FrigadeBannerProps> = ({\n flowId,\n title,\n subtitle,\n onDismiss,\n customVariables,\n onButtonClick,\n appearance,\n type = 'full-width',\n icon,\n onClick,\n}) => {\n const {\n getFlow,\n markFlowCompleted,\n markFlowSkipped,\n isLoading,\n targetingLogicShouldHideFlow,\n updateCustomVariables,\n getFlowMetadata,\n getFlowStatus,\n getFlowSteps,\n getCurrentStepIndex,\n } = useFlows()\n const { primaryCTAClickSideEffects } = useCTAClickSideEffects()\n const { mergeAppearanceWithDefault } = useTheme()\n useFlowImpressions(flowId)\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n if (isLoading) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (getFlowStatus(flowId) === COMPLETED_FLOW) {\n return null\n }\n\n const steps = getFlowSteps(flowId)\n\n const metaData = (\n steps.length > 0 ? steps[getCurrentStepIndex(flowId)] : getFlowMetadata(flowId)\n ) as StepData\n\n if (metaData?.title) {\n title = metaData.title\n }\n if (metaData?.subtitle) {\n subtitle = metaData.subtitle\n }\n\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <BannerContainer\n type={type}\n appearance={appearance}\n className={getClassName('bannerContainer', appearance)}\n onClick={onClick}\n >\n {type != 'square' && (\n <IconContainer className={getClassName('bannerIconContainer', appearance)}>\n {icon ? icon : <Info />}\n </IconContainer>\n )}\n {type === 'square' && metaData.dismissible && (\n <DismissButtonContainer\n type={type}\n className={getClassName('bannerDismissButtonContainer', appearance)}\n >\n <DismissButton\n type={type}\n onClick={async () => {\n await markFlowSkipped(flowId)\n if (onDismiss) {\n onDismiss()\n }\n }}\n className={getClassName('bannerDismissButton', appearance)}\n >\n <Close />\n </DismissButton>\n </DismissButtonContainer>\n )}\n <TextContainer type={type} className={getClassName('bannerTextContainer', appearance)}>\n <TitleSubtitle\n appearance={appearance}\n title={title}\n subtitle={subtitle}\n classPrefix=\"banner\"\n />\n </TextContainer>\n {metaData?.primaryButtonTitle && (\n <CallToActionContainer\n type={type}\n className={getClassName('bannerCallToActionContainer', appearance)}\n >\n <Button\n title={metaData?.primaryButtonTitle}\n appearance={appearance}\n onClick={() => {\n primaryCTAClickSideEffects(metaData)\n if (onButtonClick) {\n onButtonClick(metaData, 0, 'primary')\n }\n }}\n classPrefix=\"banner\"\n />\n </CallToActionContainer>\n )}\n {type !== 'square' && metaData.dismissible && (\n <DismissButtonContainer\n type={type}\n className={getClassName('bannerDismissButtonContainer', appearance)}\n >\n <DismissButton\n type={type}\n onClick={async () => {\n await markFlowSkipped(flowId)\n if (onDismiss) {\n onDismiss()\n }\n }}\n className={getClassName('bannerDismissButton', appearance)}\n >\n <Close />\n </DismissButton>\n </DismissButtonContainer>\n )}\n </BannerContainer>\n </>\n )\n}\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../shared/appearance'\n\nexport const BannerContainer = styled.div`\n // use the :not annotation\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n flex-direction: ${(props) => (props.type === 'square' ? 'column' : 'row')};\n width: 100%;\n padding: 16px;\n box-sizing: border-box;\n align-items: ${(props) => (props.type === 'square' ? 'unset' : 'center')};\n background-color: ${(props) => props.appearance.theme.colorBackground};\n border-radius: 12px;\n }\n`\n\nexport const IconContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n width: 46px;\n height: 46px;\n }\n`\n\nexport const TextContainer = styled.div`\n display: flex;\n flex-direction: column;\n flex: 1;\n margin-left: ${(props) => (props.type === 'square' ? '0px' : '16px')};\n margin-top: ${(props) => (props.type === 'square' ? '12px' : '0')};\n`\nexport const CallToActionContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-left: ${(props) => (props.type === 'square' ? '0px' : '16px')};\n`\n\nexport const DismissButton = styled.div`\n display: flex;\n justify-content: ${(props) => (props.type === 'square' ? 'flex-end' : 'center')};\n align-items: flex-end;\n cursor: pointer;\n :hover {\n opacity: 0.8;\n }\n`\n\nexport const DismissButtonContainer = styled.div`\n display: flex;\n justify-content: ${(props) => (props.type === 'square' ? 'flex-end' : 'center')};\n align-items: flex-end;\n margin-left: ${(props) => (props.type === 'square' ? '0px' : '16px')};\n`\n","import React, { CSSProperties } from 'react'\n\nexport const Info = ({\n style,\n className,\n}: {\n color?: string\n style?: CSSProperties\n className?: string\n}) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"46\"\n height=\"46\"\n fill=\"none\"\n viewBox=\"0 0 46 46\"\n style={style}\n className={className}\n >\n <circle cx=\"23\" cy=\"23\" r=\"23\" fill=\"#E6F1FF\"></circle>\n <path\n stroke=\"#0171F8\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n d=\"M32 18.5l-2.25-1.313M32 18.5v2.25m0-2.25l-2.25 1.313M14 18.5l2.25-1.313M14 18.5l2.25 1.313M14 18.5v2.25m9 3l2.25-1.313M23 23.75l-2.25-1.313M23 23.75V26m0 6.75l2.25-1.313M23 32.75V30.5m0 2.25l-2.25-1.313m0-16.875L23 13.25l2.25 1.313M32 25.25v2.25l-2.25 1.313m-13.5 0L14 27.5v-2.25\"\n ></path>\n </svg>\n)\n","import { DefaultFrigadeFlowProps } from '../types'\nimport React, { useEffect } from 'react'\nimport { useFlows } from '../api/flows'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { useTheme } from '../hooks/useTheme'\nimport { COMPLETED_FLOW } from '../api/common'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport { Portal } from 'react-portal'\nimport {\n DismissButton,\n NPSCTAContainer,\n NPSLabel,\n NPSLabelContainer,\n NPSNumberButton,\n NPSNumberButtonContainer,\n NPSSurveyContainer,\n TextArea,\n TextContainer,\n} from './styled'\nimport { getClassName, mergeClasses } from '../shared/appearance'\nimport { Close } from '../components/Icons/Close'\nimport { TitleSubtitle } from '../components/TitleSubtitle/TitleSubtitle'\nimport { useFlowOpens } from '../api/flow-opens'\nimport { Button } from '../components/Button'\nimport { useFlowImpressions } from '../hooks/useFlowImpressions'\nimport { removeHTMLChars } from '../shared/sanitizer'\n\nexport interface FrigadeNPSSurveyProps extends DefaultFrigadeFlowProps {\n dismissible?: boolean\n type?: 'inline' | 'modal'\n}\n\nexport const FrigadeNPSSurvey: React.FC<FrigadeNPSSurveyProps> = ({\n flowId,\n onDismiss,\n customVariables,\n onButtonClick,\n appearance,\n className,\n style,\n type = 'modal',\n}) => {\n const {\n getFlow,\n markFlowCompleted,\n markFlowSkipped,\n markStepCompleted,\n getNumberOfStepsCompleted,\n isLoading,\n targetingLogicShouldHideFlow,\n updateCustomVariables,\n getFlowSteps,\n getFlowStatus,\n getFlowMetadata,\n markStepNotStarted,\n } = useFlows()\n const { primaryCTAClickSideEffects } = useCTAClickSideEffects()\n const { mergeAppearanceWithDefault } = useTheme()\n const [score, setScore] = React.useState<number | null>(null)\n const [feedbackText, setFeedbackText] = React.useState<string>('')\n const metadata = getFlowMetadata(flowId)\n const numberOfStepsCompleted = getNumberOfStepsCompleted(flowId)\n const {\n hasOpenModals,\n setKeepCompletedFlowOpenDuringSession,\n shouldKeepCompletedFlowOpenDuringSession,\n } = useFlowOpens()\n useFlowImpressions(flowId)\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n useEffect(() => {\n if (\n numberOfStepsCompleted === 1 &&\n !shouldKeepCompletedFlowOpenDuringSession(flowId) &&\n getFlowStatus(flowId) !== COMPLETED_FLOW\n ) {\n markFlowSkipped(flowId)\n }\n }, [numberOfStepsCompleted])\n\n if (isLoading) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (getFlowStatus(flowId) === COMPLETED_FLOW) {\n return null\n }\n\n if (\n getNumberOfStepsCompleted(flowId) === 1 &&\n !shouldKeepCompletedFlowOpenDuringSession(flowId)\n ) {\n return null\n }\n\n if (hasOpenModals()) {\n return null\n }\n\n const steps = getFlowSteps(flowId)\n\n const currentStep = steps[getNumberOfStepsCompleted(flowId)]\n\n function getScoreChooser() {\n return (\n <>\n <TextContainer>\n <TitleSubtitle\n size=\"large\"\n appearance={appearance}\n title={currentStep.title}\n subtitle={currentStep.subtitle}\n />\n </TextContainer>\n <NPSNumberButtonContainer\n className={getClassName('npsNumberButtonContainer', appearance)}\n appearance={appearance}\n >\n {Array.from(Array(11).keys()).map((i) => (\n <NPSNumberButton\n className={getClassName('npsNumberButton', appearance)}\n selected={score === i}\n key={i}\n onClick={async () => {\n setKeepCompletedFlowOpenDuringSession(flowId)\n setScore(i)\n await markStepCompleted(flowId, currentStep.id, { score: i })\n }}\n appearance={appearance}\n >\n {i}\n </NPSNumberButton>\n ))}\n </NPSNumberButtonContainer>\n <NPSLabelContainer appearance={appearance}>\n <NPSLabel appearance={appearance}>\n {metadata?.negativeLabel ?? `Not likely at all`}\n </NPSLabel>\n <NPSLabel appearance={appearance}>\n {metadata?.positiveLabel ?? `Extremely likely`}\n </NPSLabel>\n </NPSLabelContainer>\n </>\n )\n }\n\n function getScoreReason() {\n return (\n <>\n <TextContainer>\n <TitleSubtitle\n appearance={appearance}\n title={currentStep.title ?? `Why did you choose this score?`}\n subtitle={currentStep.subtitle ?? undefined}\n size=\"large\"\n />\n </TextContainer>\n <TextArea\n appearance={appearance}\n value={feedbackText}\n onChange={(e) => {\n setFeedbackText(e.target.value)\n }}\n placeholder={\n removeHTMLChars(currentStep.placeholder) ?? 'Add your optional feedback here...'\n }\n ></TextArea>\n <NPSNumberButtonContainer\n appearance={appearance}\n className={getClassName('npsNumberButtonContainer', appearance)}\n >\n {currentStep.backButtonTitle && (\n <Button\n size={'large'}\n withMargin={false}\n onClick={async () => {\n markStepNotStarted(flowId, steps[0].id)\n markStepNotStarted(flowId, currentStep.id)\n }}\n appearance={appearance}\n title={currentStep.backButtonTitle}\n secondary\n />\n )}\n <NPSCTAContainer\n appearance={appearance}\n className={getClassName('npsCTAContainer', appearance)}\n >\n <Button\n size={'large'}\n withMargin={false}\n onClick={async () => {\n await markFlowCompleted(flowId)\n if (onButtonClick) {\n onButtonClick(currentStep, 1, 'primary')\n }\n }}\n appearance={appearance}\n title={currentStep.secondaryButtonTitle || 'Skip'}\n secondary\n />\n <Button\n size={'large'}\n withMargin={false}\n onClick={async () => {\n await markStepCompleted(flowId, currentStep.id, { feedbackText })\n await markFlowCompleted(flowId)\n if (onButtonClick) {\n onButtonClick(currentStep, 1, 'primary')\n }\n }}\n appearance={appearance}\n title={currentStep.primaryButtonTitle || 'Submit'}\n />\n </NPSCTAContainer>\n </NPSNumberButtonContainer>\n </>\n )\n }\n\n function getContent() {\n if (getNumberOfStepsCompleted(flowId) >= 2) {\n return null\n }\n\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <NPSSurveyContainer\n appearance={appearance}\n className={mergeClasses(getClassName('npsSurveyContainer', appearance), className)}\n style={style}\n type={type}\n >\n <DismissButton\n onClick={async () => {\n await markFlowSkipped(flowId)\n if (onDismiss) {\n onDismiss()\n }\n }}\n className={getClassName('npsSurveyDismissButton', appearance)}\n >\n <Close />\n </DismissButton>\n {getNumberOfStepsCompleted(flowId) == 0 && getScoreChooser()}\n {getNumberOfStepsCompleted(flowId) == 1 && getScoreReason()}\n </NPSSurveyContainer>\n </>\n )\n }\n\n if (type === 'inline') {\n return getContent()\n }\n\n return <Portal>{getContent()}</Portal>\n}\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../shared/appearance'\n\nexport const NPSSurveyContainer = styled.div`\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: 650px;\n padding: 28px 18px;\n box-sizing: border-box;\n align-items: unset;\n background-color: ${(props) => props.appearance.theme.colorBackground};\n position: ${(props) => (props.type == 'modal' ? 'fixed' : 'relative')};\n\n min-width: 600px;\n\n ${(props) =>\n props.type == 'modal'\n ? `\n left: 50%;\n transform: translate(-50%);\n bottom: 24px;\n z-index: 1000;\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);\n border-width: 1px;\n border-color: ${(props) => props.appearance.theme.colorBorder};\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;`\n : ''}\n`\n\nexport const NPSNumberButton = styled.button`\n border: 1px solid ${(props) => props.appearance.theme.colorBorder};\n border-radius: 8px;\n // If selected make border color primary and text color color priamry\n border-color: ${(props) =>\n props.selected ? props.appearance.theme.colorPrimary : props.appearance.theme.colorBorder};\n color: ${(props) =>\n props.selected ? props.appearance.theme.colorPrimary : props.appearance.theme.colorText};\n :hover {\n border-color: ${(props) => props.appearance.theme.colorPrimary};\n }\n :focus {\n border-color: ${(props) => props.appearance.theme.colorPrimary};\n color: ${(props) => props.appearance.theme.colorPrimary};\n }\n font-size: 16px;\n font-weight: 600;\n line-height: 24px;\n width: 44px;\n height: 44px;\n display: flex;\n justify-content: center;\n align-items: center;\n`\n\nexport const NPSNumberButtonContainer = styled.div`\n display: flex;\n justify-content: space-between;\n margin-top: 16px;\n gap: 8px;\n`\n\nexport const NPSLabelContainer = styled.div`\n display: flex;\n justify-content: space-between;\n margin-top: 8px;\n`\n\nexport const NPSLabel = styled.div`\n font-size: 12px;\n line-height: 18px;\n color: ${(props) => props.appearance.theme.colorTextDisabled};\n font-style: normal;\n font-weight: 400;\n letter-spacing: 0.24px;\n`\n\nexport const TextContainer = styled.div`\n display: flex;\n flex-direction: column;\n flex: 1;\n`\nexport const CallToActionContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n margin-top: 16px;\n`\n\nexport const TextArea = styled.textarea`\n ${(props) => getCustomClassOverrides(props)} {\n color: ${(props) => props.appearance.theme.colorText};\n margin-top: 16px;\n border: 1px solid ${(props) => props.appearance.theme.colorBorder};\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n padding: 12px 16px;\n font-size: 16px;\n line-height: 24px;\n width: 100%;\n height: 100px;\n resize: none;\n box-sizing: border-box;\n }\n`\n\nexport const DismissButton = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n position: absolute;\n top: 16px;\n right: 16px;\n cursor: pointer;\n\n :hover {\n opacity: 0.8;\n }\n }\n`\n\nexport const NPSCTAContainer = styled.div`\n display: flex;\n flex-wrap: nowrap;\n gap: 8px;\n display: flex;\n`\n","import { DefaultFrigadeFlowProps } from '../types'\nimport React, { CSSProperties, useEffect } from 'react'\nimport { useFlows } from '../api/flows'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { useTheme } from '../hooks/useTheme'\nimport { COMPLETED_FLOW } from '../api/common'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport {\n AnnouncementContainer,\n CallToActionContainer,\n DismissButton,\n HeaderSubtitle,\n HeaderTitle,\n MediaContainer,\n PaginationContainer,\n TextContainer,\n} from './styled'\nimport { getClassName, mergeClasses } from '../shared/appearance'\nimport { Close } from '../components/Icons/Close'\nimport { Button } from '../components/Button'\nimport { Modal } from '../components/Modal'\nimport { CornerModal } from '../components/CornerModal'\nimport { useFlowOpens } from '../api/flow-opens'\nimport { Media } from '../components/Media'\nimport { sanitize } from '../shared/sanitizer'\nimport { useFlowImpressions } from '../hooks/useFlowImpressions'\nimport { FormPagination } from '../FrigadeForm/FormPagination'\n\nexport interface FrigadeAnnouncementProps extends DefaultFrigadeFlowProps {\n dismissible?: boolean\n /**\n * Indicates the position of the modal if the form type is a modal. Default is center.\n */\n modalPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center' | 'inline'\n /**\n * Show a pagination indicator at the bottom of the announcement when using more than 1 page. Default is true.\n */\n showPagination?: boolean\n /**\n * Whether to allow the user to navigate back to previous steps. Default is false.\n * The title of the button can be controlled by the `backButtonTitle` prop on the step.\n */\n allowBackNavigation?: boolean\n}\n\nexport const FrigadeAnnouncement: React.FC<FrigadeAnnouncementProps> = ({\n flowId,\n onDismiss,\n customVariables,\n onButtonClick,\n appearance,\n className,\n style,\n dismissible = true,\n modalPosition = 'center',\n showPagination = true,\n allowBackNavigation,\n}) => {\n const {\n getFlow,\n markFlowCompleted,\n markFlowSkipped,\n markStepCompleted,\n markStepStarted,\n isLoading,\n targetingLogicShouldHideFlow,\n updateCustomVariables,\n getFlowSteps,\n getFlowStatus,\n getCurrentStepIndex,\n } = useFlows()\n const { primaryCTAClickSideEffects, secondaryCTAClickSideEffects } = useCTAClickSideEffects()\n const { mergeAppearanceWithDefault } = useTheme()\n const { setOpenFlowState, getOpenFlowState, hasOpenModals } = useFlowOpens()\n useFlowImpressions(flowId)\n\n const [showModal, setShowModal] = [\n getOpenFlowState(flowId, true),\n (value) => setOpenFlowState(flowId, value),\n ]\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n if (isLoading) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (getFlowStatus(flowId) === COMPLETED_FLOW) {\n return null\n }\n\n if (hasOpenModals()) {\n return null\n }\n\n const steps = getFlowSteps(flowId)\n const currentStepIndex = getCurrentStepIndex(flowId)\n const totalSteps = steps.length\n\n const currentStep = steps[currentStepIndex]\n\n if (!currentStep) {\n return null\n }\n\n const handleClose = async () => {\n setShowModal(false)\n await markFlowSkipped(flowId)\n if (onDismiss) {\n onDismiss()\n }\n }\n\n function getContent() {\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <AnnouncementContainer\n appearance={appearance}\n className={mergeClasses(getClassName('announcementContainer', appearance), className)}\n style={style}\n >\n {(dismissible === true || currentStep.dismissible) && modalPosition == 'inline' && (\n <DismissButton\n onClick={async () => {\n await markFlowSkipped(flowId)\n if (onDismiss) {\n onDismiss()\n }\n }}\n className={getClassName('announcementDismissButton', appearance)}\n >\n <Close />\n </DismissButton>\n )}\n <TextContainer className={getClassName('announcementTextContainer', appearance)}>\n <HeaderTitle\n appearance={appearance}\n className={getClassName('announcementTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(currentStep.title)}\n />\n {currentStep.subtitle && (\n <HeaderSubtitle\n appearance={appearance}\n className={getClassName('announcementSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(currentStep.subtitle)}\n />\n )}\n </TextContainer>\n {(currentStep.imageUri || currentStep.videoUri) && (\n <MediaContainer className={getClassName('announcementMediaContainer', appearance)}>\n <Media appearance={appearance} stepData={currentStep} />\n </MediaContainer>\n )}\n\n {showPagination && totalSteps > 1 && (\n <PaginationContainer\n className={getClassName('announcementPaginationContainer', appearance)}\n >\n <FormPagination\n className={getClassName('announcementPagination', appearance)}\n appearance={appearance}\n stepCount={totalSteps}\n currentStep={currentStepIndex}\n />\n </PaginationContainer>\n )}\n {(currentStep.primaryButtonTitle || currentStep.secondaryButtonTitle) && (\n <CallToActionContainer\n allowBackNavigation={allowBackNavigation}\n className={getClassName('announcementCTAContainer', appearance)}\n >\n {allowBackNavigation && currentStepIndex > 0 && (\n <Button\n classPrefix=\"announcementBack\"\n title={currentStep.backButtonTitle ?? 'Back'}\n appearance={appearance}\n withMargin={false}\n size=\"small\"\n type=\"full-width\"\n onClick={async () => {\n if (onButtonClick) {\n onButtonClick(currentStep, getCurrentStepIndex(flowId), 'back')\n }\n await markStepStarted(flowId, steps[currentStepIndex - 1].id)\n }}\n secondary\n />\n )}\n {currentStep.secondaryButtonTitle && (\n <Button\n classPrefix=\"announcement\"\n title={currentStep.secondaryButtonTitle}\n appearance={appearance}\n withMargin={false}\n size=\"small\"\n type=\"full-width\"\n onClick={async () => {\n currentStep.handleSecondaryButtonClick()\n secondaryCTAClickSideEffects(currentStep)\n if (onButtonClick) {\n onButtonClick(currentStep, getCurrentStepIndex(flowId), 'secondary')\n }\n }}\n secondary\n />\n )}\n {currentStep.primaryButtonTitle && (\n <Button\n classPrefix=\"announcement\"\n title={currentStep.primaryButtonTitle}\n appearance={appearance}\n withMargin={false}\n size=\"small\"\n type={'full-width'}\n onClick={async () => {\n primaryCTAClickSideEffects(currentStep)\n if (onButtonClick) {\n const result = onButtonClick(\n currentStep,\n getCurrentStepIndex(flowId),\n 'primary'\n )\n if (result === false) {\n return\n }\n }\n if (getCurrentStepIndex(flowId) === totalSteps - 1) {\n currentStep.handlePrimaryButtonClick()\n await markFlowCompleted(flowId)\n } else {\n currentStep.handlePrimaryButtonClick()\n }\n }}\n />\n )}\n </CallToActionContainer>\n )}\n </AnnouncementContainer>\n </>\n )\n }\n\n const overrideStyle: CSSProperties = {\n padding: '24px',\n maxWidth: '400px',\n }\n\n if (modalPosition === 'inline') {\n return getContent()\n }\n\n if (modalPosition !== 'center') {\n return (\n <CornerModal\n modalPosition={modalPosition}\n onClose={handleClose}\n visible={showModal}\n dismissible={dismissible}\n appearance={appearance}\n >\n {getContent()}\n </CornerModal>\n )\n }\n\n return (\n <Modal\n appearance={appearance}\n onClose={handleClose}\n visible={showModal}\n style={overrideStyle}\n dismissible={dismissible}\n >\n {getContent()}\n </Modal>\n )\n}\n","import * as React from 'react'\nimport { StyledButton } from './Button.styles'\nimport { BoxProps } from '../Box'\nimport { Text } from '../Text'\n\nimport { buttonVariants } from './Button.styles'\n\n// TEMP: Non-standard filename to avoid conflict with existing/deprecated button component\n\nexport interface ButtonProps extends BoxProps {\n title: string\n}\n\nconst BaseButton: React.FC<ButtonProps> = ({\n as = 'button',\n className,\n size = 'md',\n title,\n variant = 'Primary',\n ...rest\n}) => {\n return (\n <StyledButton\n className={`fr-button-${variant.toLowerCase()}${className ? ` ${className}` : ''}`}\n forwardedAs={as}\n variant={variant}\n size={size}\n borderRadius=\"md\"\n {...rest}\n >\n <Text color={buttonVariants[variant]?.color} fontWeight=\"semibold\">\n {title}\n </Text>\n </StyledButton>\n )\n}\n\nconst buttonVariantComponents = Object.fromEntries(\n Object.keys(buttonVariants).map((variant) => {\n const component = (props: ButtonProps) => <BaseButton {...props} variant={variant} />\n\n component.displayName = `Button.${variant}`\n\n return [variant, component]\n })\n)\n\nexport const Button = Object.assign(BaseButton, buttonVariantComponents)\n","import React from 'react'\nimport { FontProps } from 'styled-system'\nimport { BoxProps } from '../Box'\nimport { StyledText, textVariants } from './Text.styles'\n\ntype TextVariant = keyof typeof textVariants\nexport interface BaseTextProps extends BoxProps, Partial<Pick<FontProps, 'fontWeight'>> {\n variant?: TextVariant\n}\n\nconst BaseText: React.FC<BaseTextProps> = ({\n as = 'span',\n children,\n variant = 'Body1',\n ...rest\n}) => {\n return (\n <StyledText\n color=\"neutral.foreground\"\n fontFamily=\"default\"\n forwardedAs={as}\n variant={variant}\n {...rest}\n >\n {children}\n </StyledText>\n )\n}\n\nconst textVariantComponents = Object.fromEntries(\n Object.keys(textVariants).map((variant) => {\n const asProp = ['H1', 'H2', 'H3', 'H4'].includes(variant) ? variant.toLowerCase() : undefined\n const component = (props: BaseTextProps) => (\n <BaseText as={asProp} {...props} variant={variant as TextVariant}>\n {props.children}\n </BaseText>\n )\n\n component.displayName = `Text.${variant}`\n\n return [variant, component]\n })\n)\n\nexport const Text = Object.assign(BaseText, textVariantComponents)\n","import { MultipleChoice } from './components/Forms/MultiInputStepType/form-components/MultipleChoice'\n\nexport { FrigadeProvider } from './FrigadeProvider'\nexport { FrigadeHeroChecklist } from './components/HeroChecklist'\nexport { FrigadeChecklist } from './FrigadeChecklist'\nexport { FrigadeProgressBadge } from './FrigadeProgressBadge'\nexport { FrigadeForm } from './FrigadeForm'\nexport { FrigadeGuide } from './FrigadeGuide'\nexport { FrigadeTour } from './FrigadeTour'\nexport { FrigadeSupportWidget } from './FrigadeSupportWidget'\nexport { FrigadeEmbeddedTip } from './FrigadeEmbeddedTip'\nexport { FrigadeBanner } from './FrigadeBanner'\nexport { FrigadeNPSSurvey } from './FrigadeNPSSurvey'\nexport { FrigadeAnnouncement } from './FrigadeAnnouncement'\n\nexport type { BaseTheme as FrigadeTheme } from './types'\nexport { DefaultAppearance as FrigadeDefaultAppearance } from './types'\n\nexport { useFlows, Flow, FlowType } from './api/flows'\nexport { useFlowOpens } from './api/flow-opens'\nexport { useFlowResponses, FlowResponse, PublicStepState } from './api/flow-responses'\nexport { useUser } from './api/users'\nexport { useOrganization } from './api/organizations'\nexport { useUserFlowStates } from './api/user-flow-states'\n\nexport type { StepData, Appearance } from './types'\n\nexport type {\n CustomFormTypeProps,\n FormInputType,\n FormInputProps,\n FormValidationError,\n StepContentProps,\n EntityProperties,\n} from './FrigadeForm/types'\n\nexport { Label as FormLabel } from './components/Forms/MultiInputStepType/form-components/shared/Label'\nexport { TextField as FormTextField } from './components/Forms/MultiInputStepType/form-components/TextField'\n\nexport { Box } from './components/Box'\nexport { Button } from './components/Button/TEMP_index'\nexport { CheckBox } from './components/CheckBox'\nexport { ProgressRing } from './components/Progress/ProgressRing'\nexport { Text } from './components/Text'\nexport { ProgressBar } from './components/Checklists/Checklist/ProgressBar'\n\nexport { FrigadeBannerProps } from './FrigadeBanner'\nexport { FrigadeChecklistProps } from './FrigadeChecklist'\nexport { FrigadeEmbeddedTipProps } from './FrigadeEmbeddedTip'\nexport { FrigadeFormProps } from './FrigadeForm'\nexport { FrigadeTourProps } from './FrigadeTour'\nexport { FrigadeNPSSurveyProps } from './FrigadeNPSSurvey'\nexport { FrigadeAnnouncementProps } from './FrigadeAnnouncement'\nexport { FrigadeProgressBadgeProps } from './FrigadeProgressBadge'\n\nexport { MultipleChoice } from './components/Forms/MultiInputStepType/form-components/MultipleChoice'\nexport {\n MultipleChoiceOption,\n MultipleChoiceProps,\n} from './components/Forms/MultiInputStepType/form-components/MultipleChoice'\nexport { tokens } from './shared/theme'\n\nif (!String.prototype.replaceAll) {\n String.prototype.replaceAll = function (str: any, newStr: any) {\n // If a regex pattern\n if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') {\n return this.replace(str, newStr)\n }\n\n // If a string\n return this.replace(new RegExp(str, 'g'), newStr)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/FrigadeProvider/index.tsx","../src/components/DataFetcher/index.tsx","../src/api/flows.ts","../src/api/common.ts","../src/api/version.ts","../src/api/flow-responses.ts","../src/api/user-flow-states.ts","../src/api/flow-opens.ts","../src/shared/deepmerge.ts","../src/shared/parse.ts","../src/shared/completion-util.ts","../src/api/users.tsx","../src/FrigadeForm/index.tsx","../src/components/Modal/index.tsx","../src/components/Modal/ModalBackground.tsx","../src/shared/appearance.ts","../src/components/Icons/Close.tsx","../src/components/branding/PoweredByFrigade.tsx","../src/components/Icons/FrigadeLogo.tsx","../src/components/branding/styled.ts","../src/components/Tooltips/styled.ts","../src/components/CornerModal/index.tsx","../src/hooks/useTheme.ts","../src/components/Forms/MultiInputStepType/MultiInputStepType.tsx","../src/components/Forms/MultiInputStepType/form-components/TextField/index.tsx","../src/components/Forms/MultiInputStepType/form-components/shared/styled.tsx","../src/components/Forms/MultiInputStepType/form-components/shared/Label.tsx","../src/types/index.tsx","../src/components/Forms/MultiInputStepType/form-components/shared/SubLabel.tsx","../src/components/Forms/MultiInputStepType/form-components/shared/validation.ts","../src/components/Forms/MultiInputStepType/form-components/MultipleChoice/index.tsx","../src/components/Forms/MultiInputStepType/form-components/MultipleChoiceList/index.tsx","../src/components/CheckBox/index.tsx","../src/components/Progress/ProgressRing/ProgressRing.tsx","../src/shared/sanitizer.ts","../src/components/TitleSubtitle/TitleSubtitle.tsx","../src/components/Icons/Warning.tsx","../src/FrigadeForm/styled.ts","../src/FrigadeForm/FormFooter.tsx","../src/components/Button/index.tsx","../src/components/Spinner/index.tsx","../src/FrigadeForm/FormPagination.tsx","../src/components/Forms/LinkCollectionStepType/index.tsx","../src/hooks/useCTAClickSideEffects.ts","../src/components/Forms/CallToActionStepType/CallToActionStepType.tsx","../src/components/Icons/Play.tsx","../src/components/Video/VideoCard.tsx","../src/components/Forms/SelectListStepType/SelectListStepType.tsx","../src/components/Forms/SelectListStepType/styled.ts","../src/FrigadeForm/FormContent.tsx","../src/components/RenderInlineStyles.tsx","../src/hooks/useFlowImpressions.ts","../src/api/organizations.tsx","../src/shared/appearanceToOverrides.ts","../src/components/Button/Button.styles.ts","../src/components/Box/index.tsx","../src/components/Text/Text.styles.ts","../src/shared/theme.ts","../src/components/HeroChecklist/index.tsx","../src/FrigadeChecklist/index.tsx","../src/components/Checklists/HeroChecklist/HeroChecklist.tsx","../src/components/Checklists/HeroChecklist/StepChecklistItem.tsx","../src/components/CheckBoxRow/index.tsx","../src/components/Checklists/HeroChecklist/styled.ts","../src/components/Checklists/Checklist/ProgressBar.tsx","../src/components/Checklists/Checklist/styled.ts","../src/components/checklist-step-content/HeroStepContent.tsx","../src/components/checklist-step-content/shared/TitleSubtitleWithCTA.tsx","../src/components/checklist-step-content/shared/TitleSubtitle.tsx","../src/components/checklist-step-content/shared/CTA.tsx","../src/components/Video/VideoPlayer.tsx","../src/components/checklist-step-content/VideoCarousel.tsx","../src/components/checklist-step-content/CodeSnippetContent.tsx","../src/components/Checklists/ChecklistWithGuide/ChecklistWithGuide.tsx","../src/components/Icons/Chevron.tsx","../src/components/Checklists/ChecklistWithGuide/styled.ts","../src/components/styled.ts","../src/components/Guides/Guide.tsx","../src/components/Guides/styled.ts","../src/components/Checklists/CondensedChecklist/CondensedChecklist.tsx","../src/components/Checklists/CondensedChecklist/CollapsibleStep/index.tsx","../src/components/Checklists/CondensedChecklist/CollapsibleStep/styled.ts","../src/components/Checklists/CondensedChecklist/styled.ts","../src/components/Checklists/CarouselChecklist/index.tsx","../src/hooks/useMediaQuery.ts","../src/components/Checklists/CarouselChecklist/CarouselCard.tsx","../src/components/Checklists/CarouselChecklist/styled.ts","../src/FrigadeProgressBadge/index.tsx","../src/components/Checklists/MiniProgressBadge/index.tsx","../src/components/Checklists/MiniProgressBadge/styled.ts","../src/components/Checklists/FullWidthProgressBadge/index.tsx","../src/components/Checklists/FullWidthProgressBadge/styled.ts","../src/FrigadeGuide/FrigadeGuide.tsx","../src/FrigadeTour/index.tsx","../src/components/Tooltips/Tooltips.tsx","../src/components/Tooltips/position.ts","../src/hooks/useDebug.ts","../src/FrigadeSupportWidget/index.tsx","../src/FrigadeSupportWidget/styled.ts","../src/components/Icons/Question.tsx","../src/components/Icons/QuestionCircle.tsx","../src/FrigadeEmbeddedTip/index.tsx","../src/FrigadeEmbeddedTip/styled.ts","../src/FrigadeAnnouncement/styled.ts","../src/components/Media/index.tsx","../src/FrigadeBanner/index.tsx","../src/FrigadeBanner/styled.ts","../src/components/Icons/Info.tsx","../src/FrigadeNPSSurvey/index.tsx","../src/FrigadeNPSSurvey/styled.ts","../src/FrigadeAnnouncement/index.tsx","../src/components/Button/TEMP_index.tsx","../src/components/Text/index.tsx","../src/index.ts"],"names":["React","createContext","useEffect","useState","ThemeProvider","useContext","useCallback","useMemo","VERSION_NUMBER","NOT_STARTED_STEP","COMPLETED_FLOW","SKIPPED_FLOW","STARTED_FLOW","NOT_STARTED_FLOW","COMPLETED_STEP","STARTED_STEP","useConfig","publicApiKey","userId","apiUrl","FrigadeContext","LAST_POST_CALL_AT","LAST_POST_CALL_DATA","useGracefulFetch","shouldGracefullyDegrade","readonly","url","options","__async","getEmptyResponse","lastCallAtKey","lastCallDataKey","lastCall","lastCallData","lastCallDate","response","error","useCheckHasInitiatedAPI","verifySDKInitiated","wait","delay","resolve","fetchRetry","delayMS","tries","fetchOptions","onError","err","triesLeft","useSWR","useFlowOpens","openFlowStates","setOpenFlowStates","hasActiveFullPageFlow","setCompletedFlowsToKeepOpenDuringSession","completedFlowsToKeepOpenDuringSession","getOpenFlowState","flowId","defaultValue","_a","setOpenFlowState","isOpen","prev","__spreadProps","__spreadValues","resetOpenFlowState","_","rest","__objRest","__restKey","setKeepCompletedFlowOpenDuringSession","shouldKeepCompletedFlowOpenDuringSession","hasOpenModals","currentFlowId","useSWRImmutable","structuredClone","isObject","obj","deepmerge","args","target","source","result","key","value","safeParse","stringified","e","UNKNOWN_STEP_ID","useUserFlowStates","config","organizationId","flows","setShouldGracefullyDegrade","hasFinishedInitialLoad","setHasFinishedInitialLoad","emptyResponse","flow","fetcher","data","isLoadingUserFlowStateData","mutateUserFlowState","userFlowStatesData","optimisticallyMarkFlowCompleted","flowState","state","optimisticallyMarkFlowSkipped","optimisticallyMarkStepCompleted","stepId","flowResponse","_b","_c","steps","currentStepIndex","step","nextStep","optimisticallyMarkStepStarted","optimisticallyMarkFlowNotStarted","optimisticallyMarkStepNotStarted","useFlowResponses","failedFlowResponses","setFailedFlowResponses","flowResponses","setFlowResponses","successfulFlowResponsesStrings","setSuccessfulFlowResponsesStrings","successfulFlowResponses","setSuccessfulFlowResponses","gracefullyFetch","postFlowResponse","flowResponseString","existingFlowResponse","r","addResponse","getFlowResponses","apiFlowResponses","stepSlug","stepState","regex","getSubFlowFromCompletionCriteria","completionCriteria","flowMatch","match","trimmed","replaceAll","search","replacement","FlowType","useFlows","setFlows","customVariables","setCustomVariables","setHasActiveFullPageFlow","flowDataOverrides","debug","flowData","isLoadingFlows","getFlow","f","getFlowSteps","_d","_e","substituteVariables","autoCalculatedProgress","getStepOptionalProgress","returnData","markStepCompleted","getStepStatus","isStepBlocked","isStepHidden","variableName","i","getFlowMetadata","slug","setCustomVariable","updateCustomVariables","newCustomVariables","markStepStarted","shouldSendServerSideCall","markStepNotStarted","markFlowNotStarted","getFlowStatus","markFlowStarted","markFlowCompleted","markFlowSkipped","sortedStepStates","a","b","aDate","bDate","maybeFlowResponse","getStepStateForFlow","getCurrentStep","lastStep","s","getCurrentStepIndex","currentStep","index","stepSubFlowSlug","completed","getNumberOfStepsCompleted","total","getNumberOfSteps","userFlowState","getFlowData","maybeFlow","targetingLogicShouldHideFlow","matchingUserFlowState","ufs","isFlowAvailableToUser","refresh","getAllFlows","GUEST_PREFIX","useUser","userIdInternal","setUserId","setUserProperties","getUserIdKey","id","userRegisteredKey","addPropertiesToUser","properties","userProperties","trackEventForUser","event","setUserIdWithProperties","linkExistingGuestSessionToUser","existingGuestId","guestUserIdField","uuidv4","styled","CSS_CLASS_PREFIX","CUSTOM_CSS_STYLES_PREFIX","getClassName","className","appearance","defaultClass","getCustomClassOverrides","props","customClassesArray","toKebabKey","styleOverridesToCSS","mergeClasses","classes","ucFirst","str","Background","ModalBackground","onClose","CloseContainer","Close","Portal","FrigadeLogo","style","FrigadeLogo_default","TooltipContainer","dismissWithImageStyle","dismissWithoutImageStyle","TooltipDismissButton","TooltipImageContainer","TooltipVideoContainer","TooltipFooter","TooltipContentContainer","TooltipStepCountContainer","TooltipCTAContainer","TooltipStepCounter","PoweredByFrigadeModalRibbon","PoweredByFrigadeTooltipRibbon","PoweredByFrigadeContainer","PoweredByFrigade","ModalContainer","ModalHeader","ModalClose","Body","Modal","visible","headerContent","children","dismissible","showFrigadeBranding","initialBodyOverflow","setInitialBodyOverflow","initialOverflow","handleEscape","bodyStyle","getModalPosition","modalPosition","CornerModalContainer","CornerModalHeader","CornerModalClose","CornerModal","handleDismiss","useTheme","defaultAppearance","mergeAppearanceWithDefault","_appearance","FormLabel","FormSubLabel","RequiredSymbol","LabelWrapper","DefaultAppearance","Label","title","required","SubLabel","z","getErrorsFromValidationResult","validation","_f","_g","validator","validationProp","TextInputWrapper","TextInput","TextArea","TextField","formInput","customFormTypeProps","onSaveInputData","setFormValidationErrors","inputData","input","setData","hasLoaded","setHasLoaded","hasGivenFocus","setHasGivenFocus","InputComponent","handleDataChange","validationError","getType","NULL_VALUE","MultipleChoiceWrapper","MultipleChoiceSelect","MultipleChoice","_h","_i","hasSelected","setHasSelected","otherValue","setOtherValue","option","Circle","color","percentage","size","circum","strokePct","ProgressRing","fillColor","bgColor","ProgressRing_default","CheckIcon","BASE_CHECKBOX_STYLES_SQUARE","BASE_CHECKBOX_STYLES_ROUND","BASE_CHECKBOX_STYLES_SQUARE__CHECKED","BASE_CHECKBOX_STYLES_SQUARE__UNCHECKED","BASE_CHECKBOX_STYLES_ROUND__CHECKED","BASE_CHECKBOX_STYLES_ROUND__UNCHECKED","getBaseStyle","type","getStateStyle","checked","CheckIconContainer","CheckBox","primaryColor","progress","label","checkBoxStyle","stateStyle","DOMPurify","sanitize","dirty","removeHTMLChars","encoded","dec","MultipleChoiceListWrapper","MultipleChoiceListItem","MultipleChoiceList","selectedIds","setSelectedIds","HeaderTitle","HeaderSubtitle","TitleSubtitle","subtitle","classPrefix","ariaPrefix","Warning","MultiInputContainer","MultiInputValidationError","MultiInputValidationErrorIcon","MultiInput","DEFAULT_INPUT_TYPES","FORM_DATA_KEY_PREFIX","MultiInputStepType","stepData","canContinue","setCanContinue","onSaveData","customFormElements","prefillData","formElements","formValidationErrors","touchedInputs","setTouchedInputs","allFormData","setAllFormData","loadFromLocalStorage","mergedInputTypes","saveDataFromInputs","prevData","newData","getLocalStorageKey","errors","FormCTAContainer","FormCTAError","CTAWrapper","FormContainer","FormContainerWrapper","FormContainerSidebarImage","Spinner","ButtonContainer","MultipleButtonContainer","Button","onClick","disabled","secondary","withMargin","loading","getClassNameWithPrefix","name","commonProps","FormFooter","onPrimaryClick","onSecondaryClick","selectedStep","onBack","allowBackNavigation","errorMessage","isSaving","showBackButton","buttonType","Wrapper","FormPagination","stepCount","theme","idx","useCTAClickSideEffects","context","primaryCTAClickSideEffects","handleUrl","secondaryCTAClickSideEffects","updatedTarget","LinkContainer","Link","LinkIcon","LinkTitle","LinkCollectionStepType","link","Play","useRef","VideoPlayerWrapper","PlayIconWrapper","Video","YouTubeVideoSource","VimeoVideoSource","WistiaVideoSource","VideoCard","videoUri","autoplay","loop","hideControls","ref","isPlaying","setIsPlaying","videoId","ampersandPosition","CallToActionStepContainer","CallToActionImage","CallToActionTextContainer","CallToActionVideo","CallToActionStepType","SelectListSelectionContainer","SelectListHeader","SelectListTitle","SelectListSubtitle","SelectItem","SelectItemLeft","ItemIcon","SelectItemText","SelectListStepType","multipleChoiceProps","lastStepId","setLastStepId","isSelected","AnimationWrapper","shouldWrap","FormContent","customStepTypes","onButtonClick","onStepCompletion","hideOnFlowCompletion","onComplete","setVisible","setShowModal","onDismiss","showPagination","validationHandler","onFormDataChange","showFooter","updateUrlOnPageChange","repeatable","mergedCustomStepTypes","formData","setFormData","setIsSaving","setErrorMessage","isLoading","getDataPayload","handleStepCompletionHandlers","cta","maybeNextStep","updateData","prevState","newObj","FormContainerSidebar","formFooter","payload","shouldClose","StepComponent","createGlobalStyle","GlobalStyleComponent","nestedKey","nestedValue","RenderInlineStyles","inlineStyles","useFlowImpressions","hasMarkedFlowStarted","setHasMarkedFlowStarted","markFlowStartedIfNeeded","FrigadeForm","endFlowOnDismiss","lastHashNavigationStepId","setLastHashNavigationStepId","showModal","hash","stepIdFromHash","newStepIndex","stepIdToGoTo","handleClose","overrideStyle","FrigadeForm_default","useOrganization","organizationIdInternal","setOrganizationId","getUserGroupKey","uId","oId","addPropertiesToOrganization","trackEventForOrganization","setOrganizationIdWithProperties","realUserIdField","DataFetcher","lastUserId","setLastUserId","setIsNewGuestUser","disableImagePreloading","automaticFlowIdsToTrigger","setAutomaticFlowIdsToTrigger","triggeredFlows","setTriggeredFlows","lastOrganizationId","setLastOrganizationId","triggerFlow","generateGuestUserId","realUserId","guestUserId","newGuestUserId","loadedImageUrls","imageUrls","imageUrl","img","AutomaticFlowIdsToTrigger","THEME_MAP","themeToTokens","overrides","levels","currentLevel","nextLevel","styleOverrides","copiedOverrides","css","oldSelector","newSelector","appearanceToOverrides","compose","variant","border","get","shadow","space","system","typography","layoutWithoutSize","n","scale","StyledBox","Box","as","styleResetProps","renderBox","newTheme","buttonVariants","buttonSizes","StyledButton","textVariants","StyledText","SPACE_VALUE","SPACE_UNIT","SPACE_SCALE_EXTENT","spaceScale","palette","tokens","DEFAULT_API_URL","clearLocalStorage","FrigadeProvider","guestId","userIdValue","setUserIdValue","organizationIdValue","setOrganizationIdValue","isNewGuestUser","isValidApiKey","internalNavigate","apiKey","contextParams","CheckBoxRowContainer","CheckBoxRow","labelStyle","labelPosition","checkBoxType","HeroChecklistStepContent","HeroChecklistStepTitle","HeroChecklistStepSubtitle","StepItemSelectedIndicator","ChecklistStepItem","StepChecklistItem","ChecklistTitle","ChecklistSubtitle","ProgressBarFill","ProgressBarBackground","ProgressContainer","ProgressProgressBar","StepText","ProgressBar","count","display","textLocation","textStyle","fgWidth","barHeight","percentComplete","padding","stepText","CTA","handlePrimaryButtonClick","handleSecondaryButtonClick","TitleSubtitleWithCTA","VideoPlayer","HERO_STEP_CONTENT_TYPE","StepImage","HeroStepContent","Content","VideoCarouselContainer","VideoList","VideoSource","VideoTitle","VIDEO_CAROUSEL_TYPE","VideoCarousel","video","videoProps","CodeSnippetContainer","CodeSnippet","CodeSnippetTitle","CodeSnippets","CODE_SNIPPET_CONTENT_TYPE","CodeSnippetContent","codeProps","codeSnippet","HeroChecklistContainer","HeroChecklistTitle","HeroChecklistSubtitle","ChecklistHeader","ChecklistHeaderContainer","ChecklistStepsContainer","Divider","HeroChecklistStepContentContainer","HeroChecklist","setSelectedStep","DEFAULT_CUSTOM_STEP_TYPES","selectedStepInternal","setSelectedStepInternal","selectedStepValue","setSelectedStepValue","completeCount","StepContent","HeroChecklist_default","ChevronSVG","Chevron","ContainerStyle","ScrollContainer","HeaderContent","StepsContainer","StepsHeader","StepsTitle","StepsBody","StepListContainer","StepContainer","StepTitle","StepSubtitle","StepListItem","StepListStepName","StepListItemRight","ProgressBarContainer","ChecklistContainer","CenterVertical","GuideContainer","GuideItems","GuideTitle","GuideItem","GuideIconWrapper","GuideIcon","GuideItemTitle","GuideItemSubtitle","GuideItemLink","Guide","Guide_default","ChecklistWithGuide","stepsTitle","guideData","guideTitle","onGuideButtonClick","DefaultStepContent","handleSecondaryCTAClick","handleCTAClick","ChecklistWithGuide_default","StepMediaContainer","StepHeader","CollapseChevronContainer","ExpandedContentContainer","HeaderLeft","CollapsibleStep","collapsed","onPrimaryButtonClick","onSecondaryButtonClick","iconStyle","stepContentStyle","getDefaultStepContent","getCustomStep","customStep","ModalChecklistContainer","ModalChecklistTitle","ModalChecklistSubtitle","CondensedInlineChecklistContainer","CondensedChecklist","autoExpandFirstIncompleteStep","autoCollapse","autoExpandNextStep","collapsedSteps","setCollapsedSteps","initCollapsedState","handleStepClick","newCollapsedState","checklistContent","isCollapsed","CondensedChecklist_default","useMediaQuery","queries","defaultMatches","matches","setMatches","updateTimeout","throttledUpdate","updateMatches","freshMatches","query","mediaQuery","keyframes","defaultBorder","defaultShadow","fadeIn","fadeOut","CarouselScroll","CarouselScrollGroup","StyledCarouselFade","StyledScrollButton","Card","StyledCarouselCard","StyledCarouselCardImage","CarouselContainer","CarouselProgressBar","ProgressBarLabel","CompletedPill","H3","CarouselTitle","ProgressWrapper","H4","CardTitle","Small","CarouselCard","imageUri","complete","blocked","hasCTA","handleClick","RightArrow","CarouselFade","side","show","mounted","setMounted","reversed","setReversed","handleFadeOutEnd","CarouselChecklist","scrollContainerRef","showLeftFade","setShowLeftFade","showRightFade","setShowRightFade","flowMetadata","setFlowMetadata","flowSteps","setFlowSteps","numberOfStepsCompleted","setNumberOfStepsCompleted","isSmall","pageSize","metadata","completedStepCount","scrollGroups","handleScroll","maxScroll","currentScroll","handleScrollByPage","forward","direction","scrollTimeout","throttledScroll","group","j","FrigadeChecklist","initialSelectedStep","checklistStyle","guideProps","finishedInitialLoad","setFinishedInitialLoad","isModal","initialCompleteState","setInitialCompleteState","flowStatus","metaData","firstIncompleteStep","goToNextStepIfPossible","getSteps","CommonDom","getCarouselChecklist","getCondensedChecklist","getChecklistWithGuide","guideFlowId","guideFlowSteps","getDefaultChecklist","checklist","FrigadeHeroChecklist","BadgeContainer","BadgeRow","BadgeTitle","ProgressRingContainer","MiniProgressBadge","FullWidthProgressBadgeContainer","IconContainer","TextContainer","DismissButton","FullWidthProgressBadge","icon","FrigadeProgressBadge","completedCount","FrigadeGuide","useLayoutEffect","getPosition","boundingRect","position","cardWidth","offset","positionStyle","scrollY","scrollX","useElemRect","elem","refresher","initialRect","dimensions","setDimensions","handleResize","useDebug","logMessages","setLogMessages","logIfDebugMode","message","m","logErrorIfDebugMode","DEFAULT_CARD_WIDTH","DEFAULT_CARD_HEIGHT","DEFAULT_REFRESH_DELAY","HIGHLIGHT_RADIUS","HighlightOuter","HighlightInner","TooltipWrapper","PositionWrapper","HighlightContainer","Tooltips","tooltipPosition","showHighlight","containerStyle","showHighlightOnly","showStepCount","completedStepsCount","cssPosition","onViewTooltip","_j","_k","_l","_m","_n","_o","_p","_q","_r","_s","selfBounds","setSelfBounds","needsUpdate","setNeedsUpdate","selfRef","setElem","lastBoundingRect","setLastBoundingRect","showTooltipContainer","setShowTooltipContainer","zIndex","cardHeight","renderTime","setRenderTime","handleRefreshPosition","observer","intervalId","tooltipPositionValue","rightSideIsCropped","bottomIsCropped","DefaultFooterContent","handleOnCTAClick","handleOnSecondaryCTAClick","DefaultTooltipStepContent","cssPos","getBoundedLeftPosition","leftOffset","getBoundedTopPosition","tooltipBottom","spaceFromEdge","Tooltips_default","FrigadeTour","showTooltipsSimultaneously","dismissBehavior","skipIfNotFound","otherFlowId","_flowID","markTooltipCompleted","status","onDismissTooltip","handleComplete","handleViewTooltip","isCurrentSelectorMissing","renderMultipleToolTips","firstVisibleIndex","getTooltips","SupportButton","SupportTitle","SupportIconContainer","FloatingWidgetContainer","FloatingWidgetButton","FloatingWidgetMenu","FlowWidgetMenuItem","Question","QuestionCircle","FrigadeSupportWidget","wrapperRef","showMenu","setShowMenu","handleClickOutside","Menu","EmbeddedTipContainer","CallToActionContainer","AnnouncementContainer","PaginationContainer","MediaContainer","Image","Media","FrigadeEmbeddedTip","BannerContainer","DismissButtonContainer","Info","FrigadeBanner","NPSSurveyContainer","NPSNumberButton","NPSNumberButtonContainer","NPSLabelContainer","NPSLabel","NPSCTAContainer","FrigadeNPSSurvey","score","setScore","feedbackText","setFeedbackText","getScoreChooser","getScoreReason","getContent","FrigadeAnnouncement","totalSteps","BaseText","textVariantComponents","asProp","component","Text","BaseButton","buttonVariantComponents","newStr"],"mappings":"i1BAAA,OAAOA,IAAS,iBAAAC,GAAmB,aAAAC,GAAW,YAAAC,OAAgB,QAC9D,OAAS,iBAAAC,OAAqB,oBCD9B,OAAOJ,IAAa,cAAAK,GAAY,aAAAH,GAAW,YAAAC,OAAgB,QCA3D,OAAS,eAAAG,GAAa,cAAAD,GAAY,aAAAH,OAAiB,QCAnD,OAAOF,IAAS,WAAAO,OAAe,QCAxB,IAAMC,GAAiB,UDIvB,IAAMC,GAAmB,mBACnBC,GAAiB,iBACjBC,GAAe,eACfC,GAAe,eACfC,GAAmB,mBACnBC,GAAiB,iBACjBC,GAAe,eAIrB,SAASC,IAAY,CAC1B,GAAM,CAAE,aAAAC,EAAc,OAAAC,EAAQ,OAAAC,CAAO,EAAInB,GAAM,WAAWoB,EAAc,EAExE,MAAO,CACL,OAAQb,GACN,KAAO,CACL,QAAS,CACP,cAAe,UAAUU,IACzB,eAAgB,mBAChB,wBAAyBT,GACzB,yBAA0B,OAC5B,CACF,GACA,CAACS,EAAcC,CAAM,CACvB,EACA,OAAQX,GAAQ,IAAM,GAAGY,eAAqB,CAACA,CAAM,CAAC,CACxD,CACF,CAEA,IAAME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,EAI1B,KAAK,QAAQ,IAAI,OAAOtxB,EAAK,GAAG,EAAGsxB,CAAM,CAClD","sourcesContent":["import React, { createContext, FC, useEffect, useState } from 'react'\nimport { ThemeProvider } from 'styled-components'\nimport { DataFetcher, guestUserIdField, realUserIdField } from '../components/DataFetcher'\nimport { Flow } from '../api/flows'\nimport { FlowResponse } from '../api/flow-responses'\nimport { Appearance, DefaultAppearance } from '../types'\nimport { deepmerge } from '../shared/deepmerge'\nimport { appearanceToOverrides } from '../shared/appearanceToOverrides'\n\nimport { tokens } from '../shared/theme'\n\nexport interface IFrigadeContext {\n publicApiKey: string\n userId?: string | null\n setUserId: React.Dispatch<React.SetStateAction<string | null>>\n flows: Flow[]\n setFlows: React.Dispatch<React.SetStateAction<Flow[]>>\n failedFlowResponses: FlowResponse[]\n setFailedFlowResponses: React.Dispatch<React.SetStateAction<FlowResponse[]>>\n flowResponses?: FlowResponse[]\n setFlowResponses?: React.Dispatch<React.SetStateAction<FlowResponse[]>>\n children?: React.ReactNode\n userProperties?: { [key: string]: string | boolean | number | null }\n setUserProperties?: React.Dispatch<\n React.SetStateAction<{ [key: string]: string | boolean | number | null }>\n >\n openFlowStates: { [key: string]: boolean }\n setOpenFlowStates: React.Dispatch<React.SetStateAction<{ [key: string]: boolean }>>\n completedFlowsToKeepOpenDuringSession: string[]\n setCompletedFlowsToKeepOpenDuringSession: React.Dispatch<React.SetStateAction<string[]>>\n customVariables?: { [key: string]: string | boolean | number | null }\n setCustomVariables?: React.Dispatch<\n React.SetStateAction<{ [key: string]: string | boolean | number | null }>\n >\n isNewGuestUser: boolean\n setIsNewGuestUser: React.Dispatch<React.SetStateAction<boolean>>\n hasActiveFullPageFlow: boolean\n setHasActiveFullPageFlow: React.Dispatch<React.SetStateAction<boolean>>\n organizationId?: string\n setOrganizationId?: React.Dispatch<React.SetStateAction<string | null>>\n navigate: (url: string, target: string) => void\n defaultAppearance: Appearance\n shouldGracefullyDegrade: boolean\n setShouldGracefullyDegrade: React.Dispatch<React.SetStateAction<boolean>>\n apiUrl: string\n readonly: boolean\n debug: boolean\n flowDataOverrides?: { [key: string]: string }\n disableImagePreloading: boolean\n}\n\nexport interface FrigadeProviderProps {\n publicApiKey: string\n /**\n * The user id of the user that is currently logged in.\n */\n userId?: string\n /**\n * The organization id of the organization that is currently logged in.\n */\n organizationId?: string\n config?: FrigadeConfig\n children?: React.ReactNode\n}\n\nconst DEFAULT_API_URL = 'https://api.frigade.com'\nexport const FrigadeContext = createContext<IFrigadeContext>({\n publicApiKey: '',\n setUserId: () => {},\n flows: [],\n setFlows: () => {},\n failedFlowResponses: [],\n setFailedFlowResponses: () => {},\n flowResponses: [],\n setFlowResponses: () => {},\n userProperties: {},\n setUserProperties: () => {},\n openFlowStates: {},\n setOpenFlowStates: () => {},\n completedFlowsToKeepOpenDuringSession: [],\n setCompletedFlowsToKeepOpenDuringSession: () => {},\n customVariables: {},\n setCustomVariables: () => {},\n isNewGuestUser: false,\n setIsNewGuestUser: () => {},\n hasActiveFullPageFlow: false,\n setHasActiveFullPageFlow: () => {},\n organizationId: '',\n setOrganizationId: () => {},\n navigate: () => {},\n defaultAppearance: DefaultAppearance,\n shouldGracefullyDegrade: false,\n setShouldGracefullyDegrade: () => {},\n apiUrl: DEFAULT_API_URL,\n readonly: false,\n debug: false,\n disableImagePreloading: false,\n})\n\ninterface FrigadeConfig {\n /**\n * Override the default router used by Frigade.\n * This is useful if you are using a router and want to avoid doing a full page refresh on navigation.\n * @param url The url to navigate to.\n */\n navigate?: (url: string, target: string) => void\n /**\n * Default Appearance for all flows.\n */\n defaultAppearance?: Appearance\n /**\n * API url to use for all requests. Defaults to https://api.frigade.com\n */\n apiUrl?: string\n /**\n * When true, Frigade will be in read-only mode and state will not be updated. Default false.\n * Used mostly for demo purposes.\n */\n readonly?: boolean\n\n theme?: Record<string, any>\n /**\n * Flag to turn on debug mode which will log all events to the console. Default false.\n * Default false.\n */\n debug?: boolean\n /**\n * Flag to disable preloading images. Default false.\n */\n disableImagePreloading?: boolean\n\n /**\n * @ignore\n */\n __internal__?: { [key: string]: string }\n}\n\nfunction clearLocalStorage() {\n Object.keys(localStorage).forEach((key) => {\n if (key.startsWith('frigade-')) {\n localStorage.removeItem(key)\n }\n })\n}\n\nexport const FrigadeProvider: FC<FrigadeProviderProps> = ({\n publicApiKey,\n userId,\n organizationId,\n config,\n children,\n}) => {\n const guestId = typeof window !== 'undefined' ? localStorage.getItem(guestUserIdField) : null\n const [userIdValue, setUserIdValue] = useState<string | null>(!userId ? guestId : userId)\n const [organizationIdValue, setOrganizationIdValue] = useState<string | null>(\n !organizationId ? null : organizationId\n )\n const [flows, setFlows] = useState<Flow[]>([])\n const [failedFlowResponses, setFailedFlowResponses] = useState<FlowResponse[]>([])\n const [flowResponses, setFlowResponses] = useState<FlowResponse[]>([])\n const [userProperties, setUserProperties] = useState<{\n [key: string]: string | boolean | number | null\n }>({})\n const [openFlowStates, setOpenFlowStates] = useState<{ [key: string]: boolean }>({})\n const [completedFlowsToKeepOpenDuringSession, setCompletedFlowsToKeepOpenDuringSession] =\n useState<string[]>([])\n const [customVariables, setCustomVariables] = useState<{\n [key: string]: string | boolean | number | null\n }>({})\n const [isNewGuestUser, setIsNewGuestUser] = useState(false)\n const [hasActiveFullPageFlow, setHasActiveFullPageFlow] = useState(false)\n const [shouldGracefullyDegrade, setShouldGracefullyDegrade] = useState(\n !isValidApiKey(publicApiKey)\n )\n const internalNavigate = (url: string, target: string) => {\n if (target === '_blank') {\n window.open(url, '_blank')\n return\n }\n setTimeout(() => {\n window.location.href = url\n }, 50)\n }\n\n const appearance: Appearance = {\n theme: { ...DefaultAppearance.theme, ...(config?.defaultAppearance?.theme ?? {}) },\n styleOverrides: {\n ...DefaultAppearance.styleOverrides,\n ...(config?.defaultAppearance?.styleOverrides ?? {}),\n },\n }\n\n function isValidApiKey(apiKey: string): boolean {\n return Boolean(apiKey && apiKey.length > 10 && apiKey.substring(0, 10) === 'api_public')\n }\n\n useEffect(() => {\n if (userId) {\n setUserIdValue(userId)\n }\n }, [userId])\n\n useEffect(() => {\n if (userIdValue) {\n if (\n typeof window !== 'undefined' &&\n window.localStorage &&\n window.localStorage.getItem(realUserIdField)\n ) {\n if (window.localStorage.getItem(realUserIdField) !== userIdValue) {\n clearLocalStorage()\n }\n }\n }\n }, [userIdValue])\n\n useEffect(() => {\n if (organizationId) {\n setOrganizationIdValue(organizationId)\n }\n }, [organizationId])\n\n useEffect(() => {\n if (!isValidApiKey(publicApiKey)) {\n console.error(\n 'Frigade SDK failed to initialize. API key provided is either missing or invalid.'\n )\n setShouldGracefullyDegrade(true)\n return\n } else {\n setShouldGracefullyDegrade(false)\n }\n }, [publicApiKey, setShouldGracefullyDegrade])\n\n const contextParams = {\n publicApiKey,\n userId: userIdValue,\n setUserId: setUserIdValue,\n setFlows,\n flows: flows,\n failedFlowResponses,\n setFailedFlowResponses,\n flowResponses,\n setFlowResponses,\n userProperties,\n setUserProperties,\n openFlowStates,\n setOpenFlowStates,\n completedFlowsToKeepOpenDuringSession,\n setCompletedFlowsToKeepOpenDuringSession,\n customVariables,\n setCustomVariables,\n isNewGuestUser,\n setIsNewGuestUser,\n hasActiveFullPageFlow,\n setHasActiveFullPageFlow,\n organizationId: organizationIdValue,\n setOrganizationId: setOrganizationIdValue,\n navigate: config && config.navigate ? config.navigate : internalNavigate,\n defaultAppearance: appearance,\n shouldGracefullyDegrade,\n setShouldGracefullyDegrade,\n apiUrl: config && config.apiUrl ? config.apiUrl : DEFAULT_API_URL,\n readonly: config && config.readonly ? config.readonly : false,\n debug: config && config.debug ? config.debug : false,\n flowDataOverrides: config && config.__internal__ ? config.__internal__ : undefined,\n disableImagePreloading:\n config && config.disableImagePreloading ? config.disableImagePreloading : false,\n } as IFrigadeContext\n\n // Forward-port appearance.theme into theme tokens\n const { overrides } = appearanceToOverrides(appearance)\n\n if (shouldGracefullyDegrade) {\n return (\n <FrigadeContext.Provider value={contextParams}>\n <ThemeProvider\n theme={deepmerge(appearance.theme, tokens, overrides ?? {}, config?.theme ?? {})}\n >\n {children}\n </ThemeProvider>\n </FrigadeContext.Provider>\n )\n }\n\n return (\n <FrigadeContext.Provider value={contextParams}>\n {/* TEMP: Merge old appearance.theme vars in for backwards compatibility */}\n <ThemeProvider\n theme={deepmerge(appearance.theme, tokens, overrides ?? {}, config?.theme ?? {})}\n >\n {children}\n <DataFetcher />\n </ThemeProvider>\n </FrigadeContext.Provider>\n )\n}\n","import React, { FC, useContext, useEffect, useState } from 'react'\nimport { Flow, FlowType, TriggerType, useFlows } from '../../api/flows'\nimport { FrigadeContext } from '../../FrigadeProvider'\nimport { GUEST_PREFIX, useUser } from '../../api/users'\nimport { v4 as uuidv4 } from 'uuid'\nimport { useFlowResponses } from '../../api/flow-responses'\nimport { useUserFlowStates } from '../../api/user-flow-states'\nimport FrigadeForm from '../../FrigadeForm'\nimport { NOT_STARTED_FLOW } from '../../api/common'\nimport { useOrganization } from '../../api/organizations'\n\ninterface DataFetcherProps {}\n\nexport const guestUserIdField = 'frigade-xFrigade_guestUserId'\nexport const realUserIdField = 'frigade-xFrigade_userId'\n\nexport const DataFetcher: FC<DataFetcherProps> = ({}) => {\n const { setFlowResponses } = useFlowResponses()\n const { userFlowStatesData, isLoadingUserFlowStateData, mutateUserFlowState } =\n useUserFlowStates()\n const { userId, setUserId } = useUser()\n const [lastUserId, setLastUserId] = useState<string | null>(userId)\n const { getFlowStatus } = useFlows()\n const { flows, userProperties, setIsNewGuestUser, flowResponses, disableImagePreloading } =\n useContext(FrigadeContext)\n const [automaticFlowIdsToTrigger, setAutomaticFlowIdsToTrigger] = useState<Flow[]>([])\n // Add list of flows already triggered\n const [triggeredFlows, setTriggeredFlows] = useState<string[]>([])\n const { organizationId } = useOrganization()\n const [lastOrganizationId, setLastOrganizationId] = useState<string | null>(organizationId)\n const [hasFinishedInitialLoad, setHasFinishedInitialLoad] = useState(false)\n\n useEffect(() => {\n if (!isLoadingUserFlowStateData) {\n if (userFlowStatesData) {\n for (let i = 0; i < userFlowStatesData.length; i++) {\n const flowState = userFlowStatesData[i]\n const flow = flows.find((flow) => flow.slug === flowState?.flowId)\n if (\n flow &&\n flowState &&\n flowState.shouldTrigger === true &&\n flow.type == FlowType.FORM &&\n flow.triggerType === TriggerType.AUTOMATIC &&\n !triggeredFlows.includes(flow.slug)\n ) {\n // If the flow should be triggered, trigger it\n // Give a small grace period before triggering the flow\n setTimeout(() => {\n triggerFlow(flowState.flowId)\n }, 500)\n\n // We only want to trigger one at a time\n break\n }\n }\n }\n }\n }, [isLoadingUserFlowStateData, userFlowStatesData])\n\n useEffect(() => {\n if (flowResponses.length > 0) {\n mutateUserFlowState()\n }\n }, [flowResponses])\n\n useEffect(() => {\n if (!hasFinishedInitialLoad) {\n setHasFinishedInitialLoad(true)\n mutateUserFlowState()\n }\n }, [isLoadingUserFlowStateData, setHasFinishedInitialLoad])\n\n function triggerFlow(flowId: string) {\n const flow = flows.find((flow) => flow.slug === flowId)\n if (flow && flow.triggerType === TriggerType.AUTOMATIC && !triggeredFlows.includes(flow.slug)) {\n // We only trigger one at a time\n setTriggeredFlows([...triggeredFlows, flow.slug])\n setAutomaticFlowIdsToTrigger([flow])\n }\n }\n\n function generateGuestUserId() {\n // If userId is null, generate a guest user id using uuid\n if (!userId) {\n // Check if a real user id exists in local storage\n const realUserId = localStorage.getItem(realUserIdField)\n if (realUserId) {\n setUserId(realUserId)\n return\n }\n\n // Call local storage to see if we already have a guest user id\n const guestUserId = localStorage.getItem(guestUserIdField)\n if (guestUserId) {\n setUserId(guestUserId)\n return\n }\n\n // If we don't have a guest user id, generate one and save it to local storage\n setIsNewGuestUser(true)\n const newGuestUserId = GUEST_PREFIX + uuidv4()\n try {\n localStorage.setItem(guestUserIdField, newGuestUserId)\n } catch (e) {\n console.log('Failed to save guest user id locally: Local storage unavailable', e)\n }\n setUserId((userId) => (userId ? userId : newGuestUserId))\n }\n }\n\n useEffect(() => {\n try {\n // Parse all image urls from flows (contained in flow.data) and asynchronously load them\n if (!disableImagePreloading && flows) {\n const loadedImageUrls: string[] = []\n flows.forEach((flow) => {\n if (flow.data && flow.active) {\n // Find all image urls in flow data. All image urls are in the json data as \"imageUri\" fields\n const imageUrls = flow.data.match(/\"imageUri\":\"(.*?)\"/g)\n if (imageUrls) {\n imageUrls.forEach((imageUrl) => {\n // Remove the \"imageUri\" and \" from the url\n const url = imageUrl.replace('\"imageUri\":\"', '').replace('\"', '')\n // If the url has already been loaded, skip it\n if (loadedImageUrls.includes(url)) {\n return\n }\n // Create an image element and set the src to the url\n const img = new Image()\n img.src = url\n loadedImageUrls.push(url)\n })\n }\n }\n })\n }\n } catch (e) {}\n }, [flows])\n\n useEffect(() => {\n if (userId !== lastUserId) {\n // Reset responses\n setFlowResponses([])\n mutateUserFlowState()\n }\n\n setLastUserId(userId)\n // if user id isn't null and doesn't begin with GUEST_PREFIX , save it to local storage\n if (userId && !userId.startsWith(GUEST_PREFIX)) {\n try {\n localStorage.setItem(realUserIdField, userId)\n } catch (e) {\n console.log('Failed to save user id locally: Local storage available', e)\n }\n }\n // If the user ID is null, give a grace period of 50ms to set the real user id\n if (userId === null) {\n setTimeout(() => {\n if (userId === null) {\n generateGuestUserId()\n }\n }, 50)\n }\n }, [userId, flows, userProperties])\n\n useEffect(() => {\n if (organizationId != lastOrganizationId) {\n setLastOrganizationId(organizationId)\n setFlowResponses([])\n mutateUserFlowState()\n }\n }, [organizationId, lastOrganizationId, setLastOrganizationId])\n\n function AutomaticFlowIdsToTrigger() {\n return (\n <>\n {automaticFlowIdsToTrigger.map((flow) => {\n if (getFlowStatus(flow.slug) !== NOT_STARTED_FLOW) {\n return null\n }\n\n return (\n <span key={flow.slug}>\n <FrigadeForm\n flowId={flow.slug}\n type={'modal'}\n modalPosition={'center'}\n endFlowOnDismiss={true}\n />\n </span>\n )\n })}\n </>\n )\n }\n\n return (\n <>\n <AutomaticFlowIdsToTrigger />\n </>\n )\n}\n","import { useCallback, useContext, useEffect } from 'react'\nimport {\n COMPLETED_FLOW,\n COMPLETED_STEP,\n fetchRetry,\n NOT_STARTED_FLOW,\n NOT_STARTED_STEP,\n SKIPPED_FLOW,\n STARTED_FLOW,\n STARTED_STEP,\n StepActionType,\n useCheckHasInitiatedAPI,\n useConfig,\n} from './common'\n\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { FlowResponse, useFlowResponses } from './flow-responses'\nimport useSWR from 'swr'\nimport { useUserFlowStates } from './user-flow-states'\nimport { StepData } from '../types'\nimport { getSubFlowFromCompletionCriteria } from '../shared/completion-util'\nimport { safeParse } from '../shared/parse'\n\nexport interface Flow {\n id: number\n name: string\n description: string\n data: string\n createdAt: string\n modifiedAt: string\n slug: string\n type: FlowType\n triggerType: TriggerType\n targetingLogic?: string\n active: boolean\n}\n\nexport enum FlowType {\n CHECKLIST = 'CHECKLIST',\n FORM = 'FORM',\n TOUR = 'TOUR',\n SUPPORT = 'SUPPORT',\n CUSTOM = 'CUSTOM',\n BANNER = 'BANNER',\n EMBEDDED_TIP = 'EMBEDDED_TIP',\n NPS_SURVEY = 'NPS_SURVEY',\n ANNOUNCEMENT = 'ANNOUNCEMENT',\n}\n\nexport enum TriggerType {\n MANUAL = 'MANUAL',\n AUTOMATIC = 'AUTOMATIC',\n}\n\nexport function useFlows() {\n const { config, apiUrl } = useConfig()\n const {\n flows,\n setFlows,\n userId,\n organizationId,\n publicApiKey,\n customVariables,\n setCustomVariables,\n hasActiveFullPageFlow,\n setHasActiveFullPageFlow,\n setFlowResponses,\n setShouldGracefullyDegrade,\n shouldGracefullyDegrade,\n readonly,\n flowDataOverrides,\n debug,\n } = useContext(FrigadeContext)\n\n const emptyResponse = {\n data: [],\n }\n const { verifySDKInitiated } = useCheckHasInitiatedAPI()\n const { addResponse, getFlowResponses } = useFlowResponses()\n const fetcher = (url) =>\n fetchRetry(url, 100, 2, config)\n .then((response) => {\n if (response.ok) {\n return response.json()\n }\n console.log(\n `Error fetching ${url} (${response.status}): ${response.statusText}. Will gracefully degrade and hide Frigade`\n )\n setShouldGracefullyDegrade(true)\n return emptyResponse\n })\n .catch((error) => {\n console.log(`Error fetching ${url}: ${error}. Will gracefully degrade and hide Frigade`)\n setShouldGracefullyDegrade(true)\n return emptyResponse\n })\n const {\n mutateUserFlowState,\n userFlowStatesData,\n isLoadingUserFlowStateData,\n optimisticallyMarkFlowCompleted,\n optimisticallyMarkFlowSkipped,\n optimisticallyMarkFlowNotStarted,\n optimisticallyMarkStepCompleted,\n optimisticallyMarkStepNotStarted,\n optimisticallyMarkStepStarted,\n } = useUserFlowStates()\n\n const {\n data: flowData,\n error,\n isLoading: isLoadingFlows,\n } = useSWR(publicApiKey ? `${apiUrl}flows${readonly ? `?readonly=true` : ''}` : null, fetcher, {\n keepPreviousData: true,\n })\n\n useEffect(() => {\n if (error) {\n console.error(error)\n return\n }\n if (flowData && flowData.data) {\n setFlows(flowData.data)\n }\n }, [flowData, error])\n\n function getFlow(flowId: string): Flow {\n if (isLoadingFlows) {\n return null\n }\n const flow = flows.find((f) => f.slug === flowId)\n if (!flow && flows.length > 0 && !isLoadingUserFlowStateData && !isLoadingFlows) {\n if (debug) {\n console.log(`Flow with id ${flowId} not found`)\n }\n return null\n }\n if (flow && flowDataOverrides && flowDataOverrides[flowId]) {\n flow.data = flowDataOverrides[flowId]\n }\n if (flow?.active === false && !readonly) {\n return null\n }\n return flow\n }\n\n function getFlowSteps(flowId: string): StepData[] {\n if (!getFlow(flowId)) {\n return []\n }\n let flowData = getFlow(flowId)?.data\n if (!flowData) {\n return []\n }\n\n flowData = substituteVariables(flowData)\n\n const steps = safeParse<any>(flowData)?.data ?? safeParse<any>(flowData)?.steps ?? []\n\n return steps\n .map((step: StepData) => {\n const autoCalculatedProgress = getStepOptionalProgress(step)\n let returnData = {\n handleSecondaryButtonClick: () => {\n if (step.skippable === true) {\n markStepCompleted(flowId, step.id, { skipped: true })\n }\n },\n ...step,\n complete:\n getStepStatus(flowId, step.id) === COMPLETED_STEP || autoCalculatedProgress >= 1,\n started:\n getStepStatus(flowId, step.id) === STARTED_STEP ||\n getStepStatus(flowId, step.id) === COMPLETED_STEP,\n currentlyActive: userFlowStatesData?.some(\n (data) => data.flowId == flowId && data.lastStepId === step.id\n ),\n blocked: isStepBlocked(flowId, step.id),\n hidden: isStepHidden(flowId, step.id),\n handlePrimaryButtonClick: () => {\n if (\n (!step.completionCriteria &&\n (step.autoMarkCompleted || step.autoMarkCompleted === undefined)) ||\n (step.completionCriteria && step.autoMarkCompleted === true)\n ) {\n markStepCompleted(flowId, step.id)\n }\n },\n progress: autoCalculatedProgress,\n }\n\n if (step.primaryButton && step.primaryButton.title) {\n returnData = {\n ...returnData,\n primaryButtonTitle: step.primaryButton.title,\n }\n }\n if (step.primaryButton && step.primaryButton.uri) {\n returnData = {\n ...returnData,\n primaryButtonUri: step.primaryButton.uri,\n }\n }\n if (step.primaryButton && step.primaryButton.target) {\n returnData = {\n ...returnData,\n primaryButtonUriTarget: step.primaryButton.target,\n }\n }\n\n if (step.secondaryButton && step.secondaryButton.title) {\n returnData = {\n ...returnData,\n secondaryButtonTitle: step.secondaryButton.title,\n }\n }\n if (step.secondaryButton && step.secondaryButton.uri) {\n returnData = {\n ...returnData,\n secondaryButtonUri: step.secondaryButton.uri,\n }\n }\n if (step.secondaryButton && step.secondaryButton.target) {\n returnData = {\n ...returnData,\n secondaryButtonUriTarget: step.secondaryButton.target,\n }\n }\n\n return returnData\n })\n .filter((step: StepData) => !(step.hidden === true))\n }\n\n function substituteVariables(flowData: string) {\n try {\n return flowData.replaceAll(/\\${(.*?)}/g, (_, variableName) => {\n if (customVariables[variableName] === undefined) {\n return ''\n }\n\n return String(customVariables[variableName])\n .replace(/[\\u00A0-\\u9999<>\\&]/g, function (i) {\n return '&#' + i.charCodeAt(0) + ';'\n })\n .replaceAll(/[\\\\]/g, '\\\\\\\\')\n .replaceAll(/[\\\"]/g, '\\\\\"')\n .replaceAll(/[\\/]/g, '\\\\/')\n .replaceAll(/[\\b]/g, '\\\\b')\n .replaceAll(/[\\f]/g, '\\\\f')\n .replaceAll(/[\\n]/g, '\\\\n')\n .replaceAll(/[\\r]/g, '\\\\r')\n .replaceAll(/[\\t]/g, '\\\\t')\n })\n } catch (e) {\n console.debug('Error substituting variables', e)\n return flowData\n }\n }\n\n /**\n * Get high-level props for a flow such as title and subtitle\n * @param slug\n */\n function getFlowMetadata(slug: string): any {\n if (!getFlow(slug)) {\n return []\n }\n let flowData = getFlow(slug).data\n if (!flowData) {\n return []\n }\n\n flowData = substituteVariables(flowData)\n\n return JSON.parse(flowData) ?? {}\n }\n\n function setCustomVariable(key: string, value: string | number | boolean) {\n setCustomVariables((prev) => ({ ...prev, [key]: value }))\n }\n\n function updateCustomVariables(newCustomVariables?: {\n [key: string]: string | number | boolean\n }) {\n if (\n !isLoadingUserFlowStateData &&\n !isLoadingFlows &&\n newCustomVariables &&\n JSON.stringify(customVariables) !=\n JSON.stringify({ ...customVariables, ...newCustomVariables })\n ) {\n Object.keys(newCustomVariables).forEach((key) => {\n setCustomVariable(key, newCustomVariables[key])\n })\n }\n }\n\n const markStepStarted = useCallback(\n async (flowId: string, stepId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId,\n actionType: STARTED_STEP,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n\n await optimisticallyMarkStepStarted(flowId, stepId, flowResponse)\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n const markStepNotStarted = useCallback(\n async (flowId: string, stepId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId,\n actionType: NOT_STARTED_STEP,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n await optimisticallyMarkStepNotStarted(flowId, stepId, flowResponse)\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n const markStepCompleted = useCallback(\n async (flowId: string, stepId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId,\n actionType: COMPLETED_STEP,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n await optimisticallyMarkStepCompleted(flowId, stepId, flowResponse)\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n const markFlowNotStarted = useCallback(\n async (flowId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n if (getFlowStatus(flowId) === NOT_STARTED_FLOW) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId: 'unknown',\n actionType: NOT_STARTED_FLOW,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n\n await optimisticallyMarkFlowNotStarted(flowId)\n\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n const markFlowStarted = useCallback(\n async (flowId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId: 'unknown',\n actionType: STARTED_FLOW,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n const markFlowCompleted = useCallback(\n async (flowId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId: 'unknown',\n actionType: COMPLETED_FLOW,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n\n await optimisticallyMarkFlowCompleted(flowId)\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n const markFlowSkipped = useCallback(\n async (flowId: string, data?: any) => {\n if (!verifySDKInitiated()) {\n return\n }\n const flowResponse = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId ?? null,\n flowSlug: flowId,\n stepId: 'unknown',\n actionType: SKIPPED_FLOW,\n data: data ?? {},\n createdAt: new Date(),\n blocked: false,\n hidden: false,\n }\n if (!shouldSendServerSideCall(flowResponse)) {\n return\n }\n await optimisticallyMarkFlowSkipped(flowId)\n addResponse(flowResponse)\n },\n [userId, organizationId, userFlowStatesData]\n )\n\n function shouldSendServerSideCall(flowResponse: FlowResponse) {\n if (userFlowStatesData === undefined) {\n return false\n }\n if (userFlowStatesData) {\n const flowState = userFlowStatesData.find((state) => state.flowId === flowResponse.flowSlug)\n\n if (\n flowResponse.actionType === NOT_STARTED_STEP &&\n (!flowState?.stepStates[flowResponse.stepId] ||\n flowState.stepStates[flowResponse.stepId].actionType === NOT_STARTED_STEP)\n ) {\n return false\n }\n if (\n flowState &&\n flowState.stepStates[flowResponse.stepId]?.actionType === flowResponse.actionType\n ) {\n if (\n flowResponse.actionType === COMPLETED_STEP &&\n (!flowResponse.data || JSON.stringify(flowResponse.data) === JSON.stringify({}))\n ) {\n return false\n }\n // Sort flowState.stepDates by createdAt date\n const sortedStepStates = Object.keys(flowState.stepStates).sort((a, b) => {\n const aDate = new Date(flowState.stepStates[a].createdAt)\n const bDate = new Date(flowState.stepStates[b].createdAt)\n return aDate.getTime() - bDate.getTime()\n })\n\n // Only return false if the newest stepState is the same as the flowResponse\n if (\n flowState.stepStates[sortedStepStates[sortedStepStates.length - 1]].actionType ===\n flowResponse.actionType &&\n flowResponse.stepId === sortedStepStates[sortedStepStates.length - 1]\n ) {\n return false\n }\n }\n if (\n flowState &&\n flowState.flowState === COMPLETED_FLOW &&\n flowResponse.actionType === COMPLETED_FLOW\n ) {\n return false\n }\n }\n\n return true\n }\n\n function getStepStatus(flowId: string, stepId: string): StepActionType | null {\n const maybeFlowResponse = getStepStateForFlow(flowId, stepId)\n\n if (isLoadingUserFlowStateData) {\n return null\n }\n\n return (maybeFlowResponse ? maybeFlowResponse.actionType : NOT_STARTED_STEP) as StepActionType\n }\n\n function isStepBlocked(flowId: string, stepId: string): boolean {\n const maybeFlowResponse = getStepStateForFlow(flowId, stepId)\n\n if (!maybeFlowResponse) {\n return false\n }\n\n return maybeFlowResponse.blocked\n }\n\n function isStepHidden(flowId: string, stepId: string): boolean {\n const maybeFlowResponse = getStepStateForFlow(flowId, stepId)\n\n if (!maybeFlowResponse) {\n return false\n }\n\n return maybeFlowResponse.hidden\n }\n\n function getStepStateForFlow(flowId: string, stepId: string): FlowResponse | null {\n if (isLoadingUserFlowStateData) {\n return null\n }\n\n const flowState = userFlowStatesData?.find((state) => state.flowId === flowId)\n if (!flowState || !flowState.stepStates[stepId]) {\n return null\n }\n\n return flowState.stepStates[stepId] ?? null\n }\n\n function getCurrentStep(flowId: string): StepData | null {\n if (isLoadingUserFlowStateData || !userFlowStatesData) {\n return null\n }\n if (getFlowStatus(flowId) === NOT_STARTED_FLOW) {\n return getFlowSteps(flowId)[0] ?? null\n }\n\n const lastStep = userFlowStatesData.find((f) => f.flowId === flowId)?.lastStepId\n if (lastStep) {\n return getFlowSteps(flowId).find((s) => s.id === lastStep)\n }\n return null\n }\n\n function getCurrentStepIndex(flowId: string): number {\n const currentStep = getCurrentStep(flowId)\n if (!currentStep) {\n return 0\n }\n const index = getFlowSteps(flowId).findIndex((s) => s.id === currentStep.id) ?? 0\n if (\n getStepStatus(flowId, currentStep.id) === COMPLETED_STEP &&\n index < getFlowSteps(flowId).length - 1\n ) {\n return index + 1\n }\n return index\n }\n\n function getStepOptionalProgress(step: StepData) {\n if (!step.completionCriteria) return undefined\n\n const stepSubFlowSlug = getSubFlowFromCompletionCriteria(step.completionCriteria)\n if (stepSubFlowSlug === null) return undefined\n\n const completed = getNumberOfStepsCompleted(stepSubFlowSlug)\n const total = getNumberOfSteps(stepSubFlowSlug)\n\n return total === 0 ? undefined : completed / total\n }\n\n function getFlowStatus(flowId: string) {\n const userFlowState = userFlowStatesData?.find((f) => f.flowId === flowId)\n if (!userFlowState) {\n return null\n }\n return userFlowState.flowState\n }\n\n function getNumberOfStepsCompleted(flowId: string): number {\n const steps = getFlowSteps(flowId)\n if (steps.length === 0) {\n return 0\n }\n\n const completedSteps = steps.filter((s) => getStepStatus(flowId, s.id) === COMPLETED_STEP)\n\n return completedSteps.length\n }\n\n function getNumberOfSteps(flowId: string) {\n return getFlowSteps(flowId).length\n }\n\n /**\n * Generic method for getting the raw Flow data as a Javascript object.\n * For typescript, pass in T to get the correct type.\n * @param flowId\n */\n function getFlowData<T>(flowId: string): T | null {\n const maybeFlow = flows.find((f) => f.slug === flowId)\n if (!maybeFlow) {\n return null\n }\n if (flowDataOverrides && flowDataOverrides[flowId]) {\n maybeFlow.data = flowDataOverrides[flowId]\n }\n return safeParse<T>(maybeFlow.data)\n }\n\n function targetingLogicShouldHideFlow(flow: Flow) {\n if (readonly) {\n return false\n }\n if (isLoadingUserFlowStateData) {\n return true\n }\n if (shouldGracefullyDegrade) {\n return true\n }\n if (flow?.targetingLogic && userFlowStatesData) {\n // Iterate through matching userFlowState for the flow and if shouldTrigger is true, return false\n const matchingUserFlowState = userFlowStatesData.find((ufs) => ufs.flowId === flow.slug)\n if (matchingUserFlowState) {\n return matchingUserFlowState.shouldTrigger === false\n }\n }\n if (flow?.targetingLogic && userId && userId.startsWith('guest_')) {\n return true\n }\n\n return false\n }\n\n function isFlowAvailableToUser(flowId: string) {\n const flow = getFlow(flowId)\n if (!flow) {\n return false\n }\n if (flow.active === false) {\n return false\n }\n return !targetingLogicShouldHideFlow(getFlow(flowId))\n }\n\n function refresh() {\n if (userId) {\n mutateUserFlowState()\n }\n }\n\n function getAllFlows() {\n return flows\n }\n\n return {\n getAllFlows,\n getFlow,\n getFlowData,\n isLoading: isLoadingUserFlowStateData || isLoadingFlows,\n getStepStatus,\n getFlowSteps,\n getCurrentStepIndex,\n markStepStarted,\n markStepCompleted,\n markFlowNotStarted,\n markFlowStarted,\n markFlowCompleted,\n markFlowSkipped,\n markStepNotStarted,\n getFlowStatus,\n getNumberOfStepsCompleted,\n getNumberOfSteps,\n targetingLogicShouldHideFlow,\n setCustomVariable,\n updateCustomVariables,\n customVariables,\n getStepOptionalProgress,\n getFlowMetadata,\n isStepBlocked,\n isStepHidden,\n hasActiveFullPageFlow,\n setHasActiveFullPageFlow,\n isFlowAvailableToUser,\n refresh,\n isDegraded: shouldGracefullyDegrade,\n }\n}\n","import React, { useMemo } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { VERSION_NUMBER } from './version'\n\nexport const NOT_STARTED_STEP = 'NOT_STARTED_STEP'\nexport const COMPLETED_FLOW = 'COMPLETED_FLOW'\nexport const SKIPPED_FLOW = 'SKIPPED_FLOW'\nexport const STARTED_FLOW = 'STARTED_FLOW'\nexport const NOT_STARTED_FLOW = 'NOT_STARTED_FLOW'\nexport const COMPLETED_STEP = 'COMPLETED_STEP'\nexport const STARTED_STEP = 'STARTED_STEP'\n// Define a string type that is either STARTED_STEP or COMPLETED_STEP\nexport type StepActionType = 'STARTED_STEP' | 'COMPLETED_STEP' | 'NOT_STARTED_STEP'\n\nexport function useConfig() {\n const { publicApiKey, userId, apiUrl } = React.useContext(FrigadeContext)\n\n return {\n config: useMemo(\n () => ({\n headers: {\n Authorization: `Bearer ${publicApiKey}`,\n 'Content-Type': 'application/json',\n 'X-Frigade-SDK-Version': VERSION_NUMBER,\n 'X-Frigade-SDK-Platform': 'React',\n },\n }),\n [publicApiKey, userId]\n ),\n apiUrl: useMemo(() => `${apiUrl}/v1/public/`, [apiUrl]),\n }\n}\n\nconst LAST_POST_CALL_AT = 'frigade-last-call-at-'\nconst LAST_POST_CALL_DATA = 'frigade-last-call-data-'\nexport function useGracefulFetch() {\n const { shouldGracefullyDegrade, readonly } = React.useContext(FrigadeContext)\n\n return async (url: string, options: any) => {\n if (\n readonly &&\n (options.method === 'POST' || options.method === 'PUT' || options.method === 'DELETE')\n ) {\n return getEmptyResponse()\n }\n if (shouldGracefullyDegrade) {\n console.log(`Skipping ${url} call to Frigade due to error`)\n return getEmptyResponse()\n }\n const lastCallAtKey = LAST_POST_CALL_AT + url\n const lastCallDataKey = LAST_POST_CALL_DATA + url\n if (\n typeof window !== 'undefined' &&\n window.localStorage &&\n options &&\n options.body &&\n options.method === 'POST'\n ) {\n const lastCall = window.localStorage.getItem(lastCallAtKey)\n const lastCallData = window.localStorage.getItem(lastCallDataKey)\n if (lastCall && lastCallData && lastCallData == options.body) {\n const lastCallDate = new Date(lastCall)\n const now = new Date()\n const diff = now.getTime() - lastCallDate.getTime()\n // Throttle consecutive POST calls to 1 second\n if (diff < 1000) {\n return getEmptyResponse()\n }\n }\n if (typeof window !== 'undefined') {\n window.localStorage.setItem(lastCallAtKey, new Date().toISOString())\n window.localStorage.setItem(lastCallDataKey, options.body)\n }\n }\n\n let response\n try {\n response = await fetch(url, options)\n } catch (error) {\n return getEmptyResponse(error)\n }\n\n if (!response) {\n return getEmptyResponse()\n }\n\n if (!response.ok) {\n return getEmptyResponse(response.statusText)\n }\n\n return response\n }\n}\n\nfunction getEmptyResponse(error?: any) {\n if (error) {\n console.log('Call to Frigade failed', error)\n }\n\n // Create empty response that contains the .json method and returns an empty object\n return {\n json: () => ({}),\n }\n}\n\nexport interface PaginatedResult<T> {\n data: T[]\n offset: number\n limit: number\n}\n\nexport function useCheckHasInitiatedAPI() {\n const { publicApiKey, shouldGracefullyDegrade } = React.useContext(FrigadeContext)\n\n function verifySDKInitiated() {\n if (shouldGracefullyDegrade) {\n return false\n }\n if (!publicApiKey) {\n console.error('Frigade hooks cannot be used outside the scope of FrigadeProvider')\n return false\n }\n return true\n }\n\n return {\n verifySDKInitiated,\n }\n}\n\nfunction wait(delay: number) {\n return new Promise((resolve) => setTimeout(resolve, delay))\n}\n\nexport function fetchRetry(url: string, delayMS: number, tries: number, fetchOptions = {}) {\n function onError(err) {\n let triesLeft = tries - 1\n if (!triesLeft) {\n throw err\n }\n return wait(delayMS).then(() => fetchRetry(url, delayMS, triesLeft, fetchOptions))\n }\n return fetch(url, fetchOptions).catch(onError)\n}\n","export const VERSION_NUMBER = '1.38.11'\n","import { useContext, useState } from 'react'\nimport {\n COMPLETED_FLOW,\n COMPLETED_STEP,\n NOT_STARTED_FLOW,\n NOT_STARTED_STEP,\n SKIPPED_FLOW,\n STARTED_FLOW,\n STARTED_STEP,\n useConfig,\n useGracefulFetch,\n} from './common'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { useUserFlowStates } from './user-flow-states'\n\nexport interface FlowResponse {\n foreignUserId: string\n foreignUserGroupId?: string\n flowSlug: string\n stepId: string\n actionType: string\n data: object\n createdAt: Date\n blocked: boolean\n hidden: boolean\n}\n\nexport interface PublicStepState {\n stepId: string\n actionType: 'COMPLETED_STEP' | 'STARTED_STEP' | 'NOT_STARTED_STEP'\n blocked: boolean\n hidden: boolean\n createdAt: Date\n}\n\nexport function useFlowResponses() {\n const { config, apiUrl } = useConfig()\n const { userFlowStatesData, mutateUserFlowState } = useUserFlowStates()\n const { failedFlowResponses, setFailedFlowResponses, flowResponses, setFlowResponses } =\n useContext(FrigadeContext)\n const [successfulFlowResponsesStrings, setSuccessfulFlowResponsesStrings] = useState<Set<String>>(\n new Set()\n )\n const [successfulFlowResponses, setSuccessfulFlowResponses] = useState<Set<FlowResponse>>(\n new Set()\n )\n\n const gracefullyFetch = useGracefulFetch()\n\n function postFlowResponse(flowResponse: FlowResponse) {\n const flowResponseString = JSON.stringify(flowResponse)\n\n if (successfulFlowResponsesStrings.has(flowResponseString)) {\n return null\n }\n // For steps that are already in the same state, do not update the API.\n successfulFlowResponsesStrings.add(flowResponseString)\n setSuccessfulFlowResponsesStrings(successfulFlowResponsesStrings)\n successfulFlowResponses.add(flowResponse)\n setSuccessfulFlowResponses(successfulFlowResponses)\n // Only update flow responses if there is not already an entry for this step.\n // Check for flow id, step id, and action type, and date\n const existingFlowResponse = flowResponses?.find(\n (r) =>\n r.flowSlug === flowResponse.flowSlug &&\n r.stepId === flowResponse.stepId &&\n r.actionType === flowResponse.actionType &&\n r.createdAt === flowResponse.createdAt\n )\n\n return gracefullyFetch(`${apiUrl}flowResponses`, {\n ...config,\n method: 'POST',\n body: flowResponseString,\n }).then((r) => {\n if (r.status !== 200 && r.status !== 201) {\n console.log(\n 'Failed to send flow response for step ' +\n flowResponse.stepId +\n '. Will retry again later.'\n )\n setFailedFlowResponses([...failedFlowResponses, flowResponse])\n } else {\n if (!existingFlowResponse) {\n setFlowResponses((prev) => [...(prev ?? []), flowResponse])\n }\n }\n })\n }\n\n async function addResponse(flowResponse: FlowResponse) {\n if (!flowResponse.foreignUserId) {\n return\n }\n\n if (flowResponse.actionType === STARTED_FLOW || flowResponse.actionType === NOT_STARTED_FLOW) {\n await postFlowResponse(flowResponse)\n } else if (flowResponse.actionType === COMPLETED_FLOW) {\n await postFlowResponse(flowResponse)\n } else if (flowResponse.actionType === STARTED_STEP) {\n await postFlowResponse(flowResponse)\n } else if (flowResponse.actionType === COMPLETED_STEP) {\n await postFlowResponse(flowResponse)\n } else if (flowResponse.actionType === SKIPPED_FLOW) {\n await postFlowResponse(flowResponse)\n } else if (flowResponse.actionType === NOT_STARTED_STEP) {\n await postFlowResponse(flowResponse)\n }\n }\n\n function getFlowResponses() {\n const apiFlowResponses: FlowResponse[] = []\n\n userFlowStatesData?.forEach((flowState) => {\n if (flowState && flowState.stepStates && Object.keys(flowState.stepStates).length !== 0) {\n // Convert flowState.stepStates map to flowResponses\n\n for (const stepSlug in flowState.stepStates) {\n const stepState = flowState.stepStates[stepSlug] as PublicStepState\n\n apiFlowResponses.push({\n foreignUserId: flowState.foreignUserId,\n flowSlug: flowState.flowId,\n stepId: stepState.stepId,\n actionType: stepState.actionType,\n data: {},\n createdAt: new Date(stepState.createdAt),\n blocked: stepState.blocked,\n hidden: stepState.hidden,\n } as FlowResponse)\n }\n }\n })\n\n return [...apiFlowResponses, ...flowResponses]\n }\n\n return {\n addResponse,\n setFlowResponses,\n getFlowResponses,\n }\n}\n","import {\n COMPLETED_FLOW,\n fetchRetry,\n NOT_STARTED_FLOW,\n NOT_STARTED_STEP,\n SKIPPED_FLOW,\n STARTED_FLOW,\n useConfig,\n} from './common'\nimport { useContext, useEffect, useState } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport useSWR from 'swr'\nimport { useFlowOpens } from './flow-opens'\nimport { FlowResponse } from './flow-responses'\nimport useSWRImmutable from 'swr/immutable'\nimport { deepmerge } from '../shared/deepmerge'\nimport { safeParse } from '../shared/parse'\n\nexport interface PublicUserFlowState {\n flowId: string\n flowState: 'COMPLETED_FLOW' | 'STARTED_FLOW' | 'NOT_STARTED_FLOW'\n lastStepId: string\n userId: string\n foreignUserId: string\n stepStates: object\n shouldTrigger: boolean\n}\n\nconst UNKNOWN_STEP_ID = 'unknown'\n\nexport function useUserFlowStates(): {\n userFlowStatesData: PublicUserFlowState[]\n isLoadingUserFlowStateData: boolean\n mutateUserFlowState: () => any\n optimisticallyMarkFlowCompleted: (flowId: string) => void\n optimisticallyMarkFlowSkipped: (flowId: string) => void\n optimisticallyMarkFlowNotStarted: (flowId: string) => void\n optimisticallyMarkStepCompleted: (\n flowId: string,\n stepId: string,\n flowResponse: FlowResponse\n ) => void\n optimisticallyMarkStepNotStarted: (\n flowId: string,\n stepId: string,\n flowResponse: FlowResponse\n ) => void\n optimisticallyMarkStepStarted: (\n flowId: string,\n stepId: string,\n flowResponse: FlowResponse\n ) => void\n error: any\n} {\n const { config, apiUrl } = useConfig()\n const { publicApiKey, userId, organizationId, flows, setShouldGracefullyDegrade, readonly } =\n useContext(FrigadeContext)\n const { resetOpenFlowState } = useFlowOpens()\n const [hasFinishedInitialLoad, setHasFinishedInitialLoad] = useState(false)\n const emptyResponse = {\n data: flows.map((flow) => ({\n flowId: flow.id,\n flowState: COMPLETED_FLOW,\n lastStepId: null,\n userId,\n foreignUserId: userId,\n stepStates: {},\n shouldTrigger: false,\n })),\n }\n const fetcher = (url) =>\n fetchRetry(url, 100, 2, config)\n .then((response) => {\n if (response.ok) {\n return response.json()\n }\n throw new Error('Failed to fetch user flow states')\n })\n .catch((error) => {\n console.error(`Error fetching ${url}: ${error}. Will gracefully degrade and hide Frigade`)\n setShouldGracefullyDegrade(true)\n return emptyResponse\n })\n\n const key =\n publicApiKey && flows && userId\n ? `${apiUrl}userFlowStates?foreignUserId=${encodeURIComponent(userId)}${\n organizationId ? `&foreignUserGroupId=${encodeURIComponent(organizationId)}` : ''\n }`\n : null\n\n const {\n data,\n isLoading: isLoadingUserFlowStateData,\n mutate: mutateUserFlowState,\n error,\n } = readonly\n ? useSWRImmutable(key, fetcher)\n : useSWR(key, fetcher, {\n revalidateOnFocus: true,\n revalidateIfStale: true,\n keepPreviousData: true,\n revalidateOnMount: false,\n errorRetryInterval: 10000,\n errorRetryCount: 3,\n onError: () => {\n // In case of errors fetching the user flow states, hide all Frigade flow by setting shouldTrigger to false\n return emptyResponse\n },\n onLoadingSlow: () => {\n return emptyResponse\n },\n })\n const userFlowStatesData = data?.data\n\n useEffect(() => {\n if (!hasFinishedInitialLoad && !isLoadingUserFlowStateData && userFlowStatesData) {\n setHasFinishedInitialLoad(true)\n }\n }, [userFlowStatesData, hasFinishedInitialLoad, isLoadingUserFlowStateData])\n\n async function optimisticallyMarkFlowCompleted(flowId: string) {\n if (userFlowStatesData && !readonly) {\n const flowState = userFlowStatesData.find((state) => state.flowId === flowId)\n if (flowState && flowState.flowState !== COMPLETED_FLOW) {\n flowState.flowState = COMPLETED_FLOW\n }\n await mutateUserFlowState(Promise.resolve(deepmerge(data, { data: userFlowStatesData })), {\n optimisticData: deepmerge(data, { data: userFlowStatesData }),\n revalidate: false,\n rollbackOnError: false,\n })\n }\n }\n\n async function optimisticallyMarkFlowSkipped(flowId: string) {\n if (userFlowStatesData && !readonly) {\n const flowState = userFlowStatesData.find((state) => state.flowId === flowId)\n if (flowState && flowState.flowState !== SKIPPED_FLOW) {\n flowState.flowState = SKIPPED_FLOW\n }\n await mutateUserFlowState(Promise.resolve(deepmerge(data, { data: userFlowStatesData })), {\n optimisticData: deepmerge(data, { data: userFlowStatesData }),\n revalidate: false,\n rollbackOnError: false,\n })\n }\n }\n\n async function optimisticallyMarkStepCompleted(\n flowId: string,\n stepId: string,\n flowResponse: FlowResponse\n ) {\n if (userFlowStatesData) {\n const flowState = userFlowStatesData.find(\n (state) => state.flowId === flowId\n ) as PublicUserFlowState\n if (flowState) {\n const flow = flows.find((flow) => flow.slug === flowId)\n const data = safeParse<any>(flow?.data)\n const steps = data?.steps ?? data?.data ?? []\n const currentStepIndex = steps.findIndex((step) => step.id === stepId)\n const nextStep =\n steps && steps.length > currentStepIndex + 1 ? steps[currentStepIndex + 1] : null\n if (nextStep) {\n // Check that next step is not hidden\n if (!flowState.stepStates[nextStep.id]?.hidden) {\n flowState.lastStepId = nextStep.id\n }\n }\n flowState.stepStates[stepId] = flowResponse\n flowState.flowState = STARTED_FLOW\n }\n if (!readonly) {\n await mutateUserFlowState(Promise.resolve(deepmerge(data, { data: userFlowStatesData })), {\n optimisticData: deepmerge(data, { data: userFlowStatesData }),\n revalidate: false,\n rollbackOnError: false,\n })\n }\n }\n }\n\n async function optimisticallyMarkStepStarted(\n flowId: string,\n stepId: string,\n flowResponse: FlowResponse\n ) {\n if (userFlowStatesData) {\n const flowState = userFlowStatesData.find(\n (state) => state.flowId === flowId\n ) as PublicUserFlowState\n if (flowState) {\n flowState.lastStepId = stepId\n flowState.stepStates[stepId] = flowResponse\n flowState.flowState = STARTED_FLOW\n }\n if (!readonly) {\n await mutateUserFlowState(deepmerge(data, { data: userFlowStatesData }), {\n optimisticData: deepmerge(data, { data: userFlowStatesData }),\n revalidate: false,\n rollbackOnError: false,\n })\n }\n }\n }\n\n async function optimisticallyMarkFlowNotStarted(flowId: string) {\n if (userFlowStatesData) {\n const flowState = userFlowStatesData.find((state) => state.flowId === flowId)\n if (flowState && flowState.flowState !== NOT_STARTED_FLOW) {\n flowState.flowState = NOT_STARTED_FLOW\n flowState.lastStepId = UNKNOWN_STEP_ID\n // Update all sets to NOT_STARTED_STEP\n Object.keys(flowState.stepStates).forEach((stepId) => {\n flowState.stepStates[stepId].actionType = NOT_STARTED_STEP\n flowState.stepStates[stepId].createdAt = new Date().toISOString()\n })\n await mutateUserFlowState(deepmerge(data, { data: userFlowStatesData }), {\n optimisticData: deepmerge(data, { data: userFlowStatesData }),\n revalidate: false,\n rollbackOnError: false,\n })\n resetOpenFlowState(flowId)\n }\n }\n }\n\n async function optimisticallyMarkStepNotStarted(\n flowId: string,\n stepId: string,\n flowResponse: FlowResponse\n ) {\n if (userFlowStatesData) {\n const flowState = userFlowStatesData.find(\n (state) => state.flowId === flowId\n ) as PublicUserFlowState\n if (flowState) {\n flowState.stepStates[stepId] = flowResponse\n }\n await mutateUserFlowState(Promise.resolve(deepmerge(data, { data: userFlowStatesData })), {\n optimisticData: deepmerge(data, { data: userFlowStatesData }),\n revalidate: false,\n rollbackOnError: false,\n })\n }\n }\n\n return {\n userFlowStatesData,\n isLoadingUserFlowStateData: !hasFinishedInitialLoad,\n mutateUserFlowState,\n optimisticallyMarkFlowCompleted,\n optimisticallyMarkFlowSkipped,\n optimisticallyMarkFlowNotStarted,\n optimisticallyMarkStepCompleted,\n optimisticallyMarkStepNotStarted,\n optimisticallyMarkStepStarted,\n error,\n }\n}\n","import { useContext } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\n\nexport function useFlowOpens() {\n const {\n openFlowStates,\n setOpenFlowStates,\n hasActiveFullPageFlow,\n setCompletedFlowsToKeepOpenDuringSession,\n completedFlowsToKeepOpenDuringSession,\n } = useContext(FrigadeContext)\n\n function getOpenFlowState(flowId: string, defaultValue = false) {\n return openFlowStates[flowId] ?? defaultValue\n }\n\n function setOpenFlowState(flowId: string, isOpen: boolean) {\n setOpenFlowStates((prev) => ({ ...prev, [flowId]: isOpen }))\n }\n\n function resetOpenFlowState(flowId: string) {\n setOpenFlowStates((prev) => {\n const { [flowId]: _, ...rest } = prev\n return { ...rest }\n })\n }\n\n function setKeepCompletedFlowOpenDuringSession(flowId: string) {\n if (completedFlowsToKeepOpenDuringSession.includes(flowId)) {\n return\n }\n setCompletedFlowsToKeepOpenDuringSession((prev) => [...prev, flowId])\n }\n\n function shouldKeepCompletedFlowOpenDuringSession(flowId: string): boolean {\n return completedFlowsToKeepOpenDuringSession.includes(flowId)\n }\n\n function hasOpenModals(currentFlowId?: string) {\n return (\n Object.entries(openFlowStates).some(\n ([flowId, isOpen]) => isOpen && flowId != currentFlowId\n ) || hasActiveFullPageFlow\n )\n }\n\n return {\n getOpenFlowState,\n setOpenFlowState,\n resetOpenFlowState,\n hasOpenModals,\n setKeepCompletedFlowOpenDuringSession,\n shouldKeepCompletedFlowOpenDuringSession,\n }\n}\n","import structuredClone from 'core-js-pure/actual/structured-clone'\n\nfunction isObject(obj) {\n return typeof obj === 'object' && obj !== null && !Array.isArray(obj)\n}\n\nexport function deepmerge(...args) {\n const target = args.shift()\n\n // Recurse to the right until we've merged all the way back to a single target and source\n const source = args.length === 1 ? args[0] : deepmerge(...args)\n\n if (!isObject(target) || !isObject(source)) {\n throw new Error('deepmerge can only merge Objects')\n }\n\n const result = structuredClone(target)\n\n Object.entries(source).forEach(([key, value]) => {\n // Is value an Object, i.e. are we at risk of passing by reference?\n if (isObject(value)) {\n // Does key already exist in result?\n if (result[key] !== undefined) {\n // Deepmerge it on\n Object.assign(result, { [key]: deepmerge(result[key], structuredClone(value)) })\n } else {\n // Else clone value onto result\n Object.assign(result, { [key]: structuredClone(value) })\n }\n } else if (Array.isArray(value)) {\n // Does key already exist in result?\n if (result[key] !== undefined) {\n // Clone and spread onto existing\n // TODO: This only shallow-merges arrays. Add ability to deep merge here, so nested structures aren't overwritten\n Object.assign(result, { [key]: [...result[key], ...structuredClone(value)] })\n } else {\n // Else spread array onto result\n Object.assign(result, { [key]: structuredClone(value) })\n }\n } else {\n // Assign value onto result\n Object.assign(result, { [key]: value })\n }\n })\n\n return result\n}\n","/**\n * Safely parse a stringified JSON object.\n *\n * @param stringified A stringified JSON object (or other value)\n * @returns The parsed object or null if the stringified value is not a valid JSON object\n */\nexport function safeParse<R>(stringified: string): R | null {\n try {\n return JSON.parse(stringified) as R\n } catch (e) {\n console.error('Failed to parse Frigade config.yml to JSON', e)\n return null\n }\n}\n","const regex = /user.flow\\(([^\\)]+)\\) == '?COMPLETED_FLOW'?/gm\n\nexport const getSubFlowFromCompletionCriteria = (completionCriteria: string) => {\n const flowMatch = regex.exec(completionCriteria)\n if (flowMatch === null) return null\n\n /**\n * Use the grouped regex match to\n * - match on full completion criteria for a 'Flow' completion\n * - get the flowId slug from within the completion criteria\n */\n let flow = null\n flowMatch.forEach((match, _) => {\n let trimmed = replaceAll(match, \"'\", '')\n if (trimmed.startsWith('flow_')) {\n flow = trimmed\n }\n })\n return flow\n}\n\nexport const replaceAll = function (target, search, replacement) {\n return target.replace(new RegExp(search, 'g'), replacement)\n}\n","import React, { useCallback, useContext, useEffect } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { useCheckHasInitiatedAPI, useConfig, useGracefulFetch } from './common'\nimport { useUserFlowStates } from './user-flow-states'\nimport { EntityProperties } from '../FrigadeForm/types'\nimport { guestUserIdField } from '../components/DataFetcher'\n\ninterface AddPropertyToUserDTO {\n readonly foreignId: string\n readonly properties?: { [key: string]: string | boolean | number | null }\n readonly events?: UserEvent[]\n readonly linkGuestId?: string\n}\n\ninterface UserEvent {\n readonly event: string\n readonly properties?: { [key: string]: string | boolean | number | null }\n}\n\nexport const GUEST_PREFIX = 'guest_'\n\nexport function useUser(): {\n readonly userId: string | null\n readonly setUserId: React.Dispatch<React.SetStateAction<string | null>>\n readonly setUserIdWithProperties: (userId: string, properties?: EntityProperties) => Promise<void>\n readonly addPropertiesToUser: (properties: EntityProperties) => Promise<void>\n readonly trackEventForUser: (event: string, properties?: EntityProperties) => Promise<void>\n readonly linkExistingGuestSessionToUser: (userId: string) => Promise<void>\n} {\n const {\n userId: userIdInternal,\n organizationId,\n setUserId,\n setUserProperties,\n shouldGracefullyDegrade,\n } = useContext(FrigadeContext)\n const { config, apiUrl } = useConfig()\n const { mutateUserFlowState } = useUserFlowStates()\n const gracefullyFetch = useGracefulFetch()\n const { verifySDKInitiated } = useCheckHasInitiatedAPI()\n\n function getUserIdKey(id?: string) {\n return `frigade-user-registered-${id}`\n }\n\n // Use local storage to mark if user has already been registered in frigade\n useEffect(() => {\n // Check if user is not a guest\n if (userIdInternal && !organizationId) {\n // Check if userid begins with the guest prefix\n if (userIdInternal.startsWith(GUEST_PREFIX)) {\n return\n }\n const userRegisteredKey = getUserIdKey(userIdInternal)\n // Check if user has already been registered in frigade\n if (!localStorage.getItem(userRegisteredKey)) {\n // Register user in frigade\n gracefullyFetch(`${apiUrl}users`, {\n ...config,\n method: 'POST',\n body: JSON.stringify({ foreignId: userIdInternal }),\n })\n // Mark user as registered in frigade\n localStorage.setItem(userRegisteredKey, 'true')\n }\n }\n }, [userIdInternal, shouldGracefullyDegrade, organizationId])\n\n const addPropertiesToUser = useCallback(\n async (properties: EntityProperties) => {\n if (!verifySDKInitiated()) {\n return\n }\n const data: AddPropertyToUserDTO = {\n foreignId: userIdInternal,\n properties,\n }\n await gracefullyFetch(`${apiUrl}users`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n setUserProperties((userProperties) => ({ ...userProperties, ...properties }))\n mutateUserFlowState()\n },\n [userIdInternal, config, shouldGracefullyDegrade, mutateUserFlowState]\n )\n\n const trackEventForUser = useCallback(\n async (event: string, properties?: EntityProperties) => {\n if (!verifySDKInitiated()) {\n return\n }\n const eventData: UserEvent = {\n event,\n properties,\n }\n const data: AddPropertyToUserDTO = {\n foreignId: userIdInternal,\n events: [eventData],\n }\n await gracefullyFetch(`${apiUrl}users`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n mutateUserFlowState()\n },\n [userIdInternal, config, mutateUserFlowState]\n )\n\n const setUserIdWithProperties = useCallback(\n async (userId: string, properties?: EntityProperties) => {\n if (!verifySDKInitiated()) {\n return\n }\n if (properties && Object.keys(properties).length > 0) {\n const userRegisteredKey = getUserIdKey(userId)\n localStorage.setItem(userRegisteredKey, 'true')\n setUserId(userId)\n const data: AddPropertyToUserDTO = {\n foreignId: userId,\n properties,\n }\n await gracefullyFetch(`${apiUrl}users`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n setUserProperties((userProperties) => ({ ...userProperties, ...properties }))\n mutateUserFlowState()\n } else {\n setUserId(userId)\n }\n },\n [config, shouldGracefullyDegrade, mutateUserFlowState]\n )\n\n const linkExistingGuestSessionToUser = useCallback(\n async (userId: string) => {\n if (!verifySDKInitiated()) {\n return\n }\n const existingGuestId =\n typeof window !== 'undefined' ? localStorage.getItem(guestUserIdField) : null\n\n if (!existingGuestId) {\n return\n }\n\n const data: AddPropertyToUserDTO = {\n foreignId: userId,\n linkGuestId: existingGuestId,\n }\n await gracefullyFetch(`${apiUrl}users`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n mutateUserFlowState()\n },\n [config, shouldGracefullyDegrade, mutateUserFlowState]\n )\n\n return {\n userId: userIdInternal,\n setUserId,\n setUserIdWithProperties,\n addPropertiesToUser,\n trackEventForUser,\n linkExistingGuestSessionToUser,\n }\n}\n","import React, { CSSProperties, FC, useEffect, useState } from 'react'\n\nimport { Appearance, DefaultFrigadeFlowProps, StepData } from '../types'\nimport { useFlows } from '../api/flows'\nimport { COMPLETED_FLOW } from '../api/common'\nimport { Modal } from '../components/Modal'\nimport { CornerModal } from '../components/CornerModal'\nimport { FormInputProps } from './types'\nimport { useTheme } from '../hooks/useTheme'\nimport { FormContent } from './FormContent'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport { useFlowOpens } from '../api/flow-opens'\nimport { useFlowImpressions } from '../hooks/useFlowImpressions'\n\nexport type FrigadeFormType = 'inline' | 'modal' | 'large-modal' | 'corner-modal'\n\nexport interface FrigadeFormProps extends DefaultFrigadeFlowProps {\n /**\n * @ignore\n */\n title?: string\n /**\n * @ignore\n */\n subtitle?: string\n type?: FrigadeFormType\n /**\n * Map of custom components. The key must match the `type` property of the step defined in `config.yml`\n */\n customStepTypes?: {\n [key: string]:\n | ((params: {\n flowId: string\n stepData: StepData\n canContinue: boolean\n setCanContinue: (canContinue: boolean) => void\n onSaveData: (data: object) => void\n appearance?: Appearance\n prefillData?: Record<string, any>\n customFormElements?: { [key: string]: (params: FormInputProps) => React.ReactNode }\n }) => React.ReactNode)\n | React.ReactNode\n }\n /**\n * Map of custom form components. Can only be used with a step of type `multiInput` (defined in `config.yml`).\n * The key must match the `type` property of the input defined in `config.yml`\n */\n customFormElements?: { [key: string]: (params: FormInputProps) => React.ReactNode }\n visible?: boolean\n setVisible?: (visible: boolean) => void\n onComplete?: () => void\n /**\n * Whether to show a dismiss button to exit out of the form. Applicable only for modal forms.\n */\n dismissible?: boolean\n /**\n * If true, the form can be repeated multiple times. Default is false. Useful for e.g. contact/support forms.\n */\n repeatable?: boolean\n /**\n * If true, the user will be excited from the flow when the form is dismissed. The flow will be marked as dismissed. Default is false.\n */\n endFlowOnDismiss?: boolean\n /**\n * Indicates the position of the modal if the form type is a modal. Default is center.\n */\n modalPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center'\n /**\n * Show a pagination indicator at the bottom of the form. Default is false.\n */\n showPagination?: boolean\n /**\n * Whether to allow the user to navigate back to previous steps. Default is false.\n * The title of the button can be controlled by the `backButtonTitle` prop on the step.\n */\n allowBackNavigation?: boolean\n /**\n * @ignore\n */\n showFrigadeBranding?: boolean\n /**\n * Async function resolved when the user submits data in a step.\n * If the promise evaluates to a string or `false`, the flow will not proceed to the next step. The string will be displayed as an error message if passed.\n * If the promise evaluates to `true`, the flow will proceed to the next step.\n */\n validationHandler?: (\n step: StepData,\n index: number,\n nextStep?: StepData,\n allFormData?: any,\n stepSpecificFormData?: any\n ) => Promise<string | null | boolean | undefined>\n /**\n * Handler that is called when the form data changes.\n */\n onFormDataChange?: (\n allFormData: any,\n stepSpecificFormData: any,\n step: StepData,\n index: number\n ) => void\n /**\n * Show or hide the form footer\n */\n showFooter?: boolean\n /**\n * Data to use for prefilling forms with data.\n * Useful when you want to prefill a form with data from another source.\n * The format of the data maps a step id to the prefill data. Depending on the implementation of the given step type,\n * the value of the data will follow a different structure.\n *\n * For `type` multiInputStep, the value contains another map similar to the structure returned from `onFormDataChange`\n */\n prefillData?: Record<string, any>\n /**\n * Whether to update the url when the page changes in multi-page forms. If enabled, the current url will be updated with the\n * current step id in the following format: <my_url>?p=<current_step_id>\n *\n * This is useful when wanting to capture URL changes with third-party tracking tools.\n *\n * Default is false.\n */\n updateUrlOnPageChange?: boolean\n}\n\nexport const FrigadeForm: FC<FrigadeFormProps> = ({\n flowId,\n customStepTypes = {},\n type = 'inline',\n visible,\n setVisible,\n customVariables,\n customFormElements,\n onComplete,\n appearance,\n hideOnFlowCompletion = true,\n onStepCompletion,\n onButtonClick,\n dismissible = true,\n endFlowOnDismiss = false,\n modalPosition = 'center',\n repeatable = false,\n onDismiss,\n showPagination = false,\n allowBackNavigation = false,\n validationHandler,\n showFrigadeBranding = false,\n onFormDataChange,\n showFooter = true,\n prefillData = {},\n updateUrlOnPageChange = false,\n}) => {\n const {\n getFlow,\n getFlowSteps,\n isLoading,\n targetingLogicShouldHideFlow,\n getFlowStatus,\n getCurrentStepIndex,\n markFlowSkipped,\n markFlowNotStarted,\n markStepStarted,\n } = useFlows()\n const selectedStep = getCurrentStepIndex(flowId)\n const { mergeAppearanceWithDefault } = useTheme()\n const [lastHashNavigationStepId, setLastHashNavigationStepId] = useState(null)\n const { setOpenFlowState, getOpenFlowState, hasOpenModals } = useFlowOpens()\n useFlowImpressions(flowId, visible)\n const steps = getFlowSteps(flowId)\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n const [showModal, setShowModal] =\n visible !== undefined && setVisible !== undefined\n ? [visible, setVisible]\n : [getOpenFlowState(flowId, true), (value) => setOpenFlowState(flowId, value)]\n\n const hash = typeof window !== 'undefined' ? window.location.hash : null\n useEffect(() => {\n if (steps && steps.length > 0 && allowBackNavigation) {\n const stepIdFromHash =\n typeof window !== 'undefined' && window?.location?.hash\n ? window.location.hash.replace('#', '')\n : ''\n if (steps && steps?.length > 0) {\n let newStepIndex = -1\n if (stepIdFromHash) {\n const stepIdToGoTo = stepIdFromHash\n newStepIndex = steps.findIndex((step) => step.id === stepIdToGoTo)\n if (lastHashNavigationStepId === stepIdFromHash) {\n newStepIndex = -1\n }\n }\n if (newStepIndex !== -1) {\n setLastHashNavigationStepId(stepIdFromHash)\n markStepStarted(flowId, steps[newStepIndex].id)\n }\n }\n }\n }, [hash])\n\n useEffect(() => {\n if (\n !isLoading &&\n steps &&\n steps.length &&\n typeof window !== 'undefined' &&\n allowBackNavigation\n ) {\n setLastHashNavigationStepId(steps[selectedStep].id)\n window.location.hash = steps[selectedStep].id\n }\n }, [isLoading, selectedStep, steps])\n\n if (isLoading) {\n return null\n }\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (!steps) {\n return null\n }\n\n if (visible !== undefined && visible === false) {\n return null\n }\n\n if (getFlowStatus(flowId) === COMPLETED_FLOW && hideOnFlowCompletion && !repeatable) {\n return null\n }\n\n if ((type == 'modal' || type == 'corner-modal') && hasOpenModals(flowId)) {\n return null\n }\n\n const handleClose = () => {\n setShowModal(false)\n if (onDismiss) {\n onDismiss()\n }\n if (endFlowOnDismiss === true) {\n markFlowSkipped(flowId)\n }\n }\n\n if ((modalPosition == 'center' && type === 'modal') || type === 'large-modal') {\n const overrideStyle: CSSProperties = {\n padding: '24px',\n }\n if (type === 'large-modal') {\n overrideStyle.width = '85%'\n overrideStyle.height = '90%'\n overrideStyle.maxHeight = '800px'\n overrideStyle.minHeight = '500px'\n overrideStyle.padding = '0'\n } else {\n overrideStyle.width = '400px'\n }\n return (\n <Modal\n appearance={appearance}\n onClose={handleClose}\n visible={showModal}\n style={overrideStyle}\n dismissible={dismissible}\n showFrigadeBranding={showFrigadeBranding}\n >\n <RenderInlineStyles appearance={appearance} />\n <FormContent\n appearance={appearance}\n steps={steps}\n selectedStep={selectedStep}\n customStepTypes={customStepTypes}\n customVariables={customVariables}\n onButtonClick={onButtonClick}\n onStepCompletion={onStepCompletion}\n flowId={flowId}\n type={type}\n hideOnFlowCompletion={hideOnFlowCompletion}\n onComplete={onComplete}\n setVisible={setVisible}\n setShowModal={setShowModal}\n onDismiss={onDismiss}\n showPagination={showPagination}\n customFormElements={customFormElements}\n allowBackNavigation={allowBackNavigation}\n validationHandler={validationHandler}\n onFormDataChange={onFormDataChange}\n showFooter={showFooter}\n prefillData={prefillData}\n updateUrlOnPageChange={updateUrlOnPageChange}\n repeatable={repeatable}\n />\n </Modal>\n )\n }\n\n if (type === 'modal' && modalPosition !== 'center') {\n return (\n <CornerModal\n appearance={appearance}\n onClose={handleClose}\n visible={showModal}\n modalPosition={modalPosition}\n >\n <RenderInlineStyles appearance={appearance} />\n <FormContent\n appearance={appearance}\n steps={steps}\n selectedStep={selectedStep}\n customStepTypes={customStepTypes}\n customVariables={customVariables}\n onButtonClick={onButtonClick}\n onStepCompletion={onStepCompletion}\n flowId={flowId}\n type={type}\n hideOnFlowCompletion={hideOnFlowCompletion}\n onComplete={onComplete}\n setVisible={setVisible}\n setShowModal={setShowModal}\n onDismiss={onDismiss}\n showPagination={showPagination}\n customFormElements={customFormElements}\n allowBackNavigation={allowBackNavigation}\n validationHandler={validationHandler}\n onFormDataChange={onFormDataChange}\n showFooter={showFooter}\n prefillData={prefillData}\n updateUrlOnPageChange={updateUrlOnPageChange}\n repeatable={repeatable}\n />\n </CornerModal>\n )\n }\n\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <FormContent\n appearance={appearance}\n steps={steps}\n selectedStep={selectedStep}\n customStepTypes={customStepTypes}\n customVariables={customVariables}\n onButtonClick={onButtonClick}\n onStepCompletion={onStepCompletion}\n flowId={flowId}\n type={type}\n hideOnFlowCompletion={hideOnFlowCompletion}\n onComplete={onComplete}\n setVisible={setVisible}\n setShowModal={setShowModal}\n onDismiss={onDismiss}\n showPagination={showPagination}\n customFormElements={customFormElements}\n allowBackNavigation={allowBackNavigation}\n validationHandler={validationHandler}\n onFormDataChange={onFormDataChange}\n showFooter={showFooter}\n prefillData={prefillData}\n updateUrlOnPageChange={updateUrlOnPageChange}\n repeatable={repeatable}\n />\n </>\n )\n}\n\nexport default FrigadeForm\n","import React, { FC, useEffect, useState } from 'react'\nimport styled from 'styled-components'\n\nimport { ModalBackground } from './ModalBackground'\nimport { Close } from '../Icons/Close'\nimport { getClassName, getCustomClassOverrides, styleOverridesToCSS } from '../../shared/appearance'\nimport { Appearance } from '../../types'\nimport { Portal } from 'react-portal'\nimport { PoweredByFrigade } from '../branding/PoweredByFrigade'\nimport { PoweredByFrigadeModalRibbon } from '../branding/styled'\n\nconst ModalContainer = styled.div<{ appearance; maxWidth }>`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n background-color: ${(props) => props.appearance?.theme?.colorBackground};\n /* Mobile */\n @media (max-width: 500px) {\n width: 90%;\n height: 90%;\n top: 50%;\n left: 50%;\n }\n\n width: ${(props) => props.width ?? '1000px'};\n z-index: 1500;\n border-radius: ${(props) => props.appearance?.theme?.borderRadius ?? 8}px;\n ${(props) => styleOverridesToCSS(props)}\n }\n\n padding: 32px;\n\n position: fixed;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n max-height: 90%;\n\n display: flex;\n flex-direction: column;\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);\n animation-duration: 0.15s;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n animation-name: fadeIn;\n box-sizing: border-box;\n\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n`\n\nconst ModalHeader = styled.div`\n position: relative;\n flex: 0 1 auto;\n`\n\nconst ModalClose = styled.div<{ appearance }>`\n position: absolute;\n top: 16px;\n right: 16px;\n cursor: pointer;\n z-index: 1501;\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n color: ${(props) => props.appearance?.theme?.colorText};\n }\n`\n\nconst Body = styled.div`\n overflow: scroll;\n flex: 1 1;\n display: flex;\n ::-webkit-scrollbar {\n display: none;\n }\n`\n\ninterface ModalProps {\n onClose: () => void\n visible: boolean\n headerContent?: React.ReactNode\n children: React.ReactNode\n style?: React.CSSProperties\n appearance?: Appearance\n dismissible?: boolean // defaults to true\n showFrigadeBranding?: boolean\n}\n\nexport const Modal: FC<ModalProps> = ({\n onClose,\n visible,\n headerContent = null,\n style = null,\n children,\n appearance,\n dismissible = true,\n showFrigadeBranding = false,\n}) => {\n const [initialBodyOverflow, setInitialBodyOverflow] = useState('')\n\n useEffect(() => {\n const initialOverflow = getComputedStyle(document.body).getPropertyValue('overflow')\n setInitialBodyOverflow(initialOverflow)\n }, [])\n\n // If user presses escape key, close modal\n useEffect(() => {\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n onClose()\n }\n }\n document.addEventListener('keydown', handleEscape)\n\n return () => {\n document.removeEventListener('keydown', handleEscape)\n }\n }, [onClose])\n\n useEffect(() => {\n const bodyStyle = document.body.style\n\n if (visible) {\n bodyStyle.setProperty('overflow', 'hidden')\n } else {\n bodyStyle.setProperty('overflow', initialBodyOverflow)\n }\n\n return () => {\n bodyStyle.setProperty('overflow', initialBodyOverflow)\n }\n }, [visible])\n\n if (!visible) return <></>\n\n return (\n <Portal>\n <ModalBackground\n appearance={appearance}\n onClose={() => {\n if (dismissible) {\n onClose()\n }\n }}\n />\n <ModalContainer\n appearance={appearance}\n className={getClassName('modalContainer', appearance)}\n styleOverrides={style}\n >\n {dismissible && (\n <ModalClose\n className={getClassName('modalClose', appearance)}\n onClick={() => onClose()}\n appearance={appearance}\n >\n <Close />\n </ModalClose>\n )}\n {headerContent && <ModalHeader>{headerContent}</ModalHeader>}\n <Body className={getClassName('modalBody', appearance)}>{children}</Body>\n\n {showFrigadeBranding && (\n <PoweredByFrigadeModalRibbon\n appearance={appearance}\n className={getClassName('poweredByFrigadeRibbon', appearance)}\n >\n <PoweredByFrigade appearance={appearance} />\n </PoweredByFrigadeModalRibbon>\n )}\n </ModalContainer>\n </Portal>\n )\n}\n","import React from 'react'\nimport styled from 'styled-components'\nimport { getClassName, getCustomClassOverrides } from '../../shared/appearance'\n\nconst Background = styled.div`\n display: flex;\n justify-content: center;\n position: fixed;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n ${(props) => getCustomClassOverrides(props)} {\n background-color: rgba(0, 0, 0, 0.6);\n z-index: 1400;\n }\n animation-duration: 0.15s;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n animation-name: fadeIn;\n\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n`\n\nexport const ModalBackground = ({ onClose, appearance }) => {\n return (\n <Background\n className={getClassName('modalBackground', appearance)}\n onClick={() => onClose()}\n ></Background>\n )\n}\n","import { Appearance } from '../types'\n\nexport const CSS_CLASS_PREFIX = 'fr-'\nexport const CUSTOM_CSS_STYLES_PREFIX = 'cfr-'\nconst defaultClass = '.fr-element'\n\nexport function getClassName(className: string, appearance?: Appearance) {\n const defaultClass = `${CSS_CLASS_PREFIX}${className}`\n if (!appearance) {\n return defaultClass\n }\n\n if (appearance.styleOverrides && appearance.styleOverrides[className]) {\n if (typeof appearance.styleOverrides[className] === 'string') {\n // It's a class name\n return defaultClass + ' ' + appearance.styleOverrides[className]\n } else if (typeof appearance.styleOverrides[className] === 'object') {\n // It's a style object\n return defaultClass + ' ' + CUSTOM_CSS_STYLES_PREFIX + className\n }\n }\n\n return defaultClass\n}\n\nexport function getCustomClassOverrides(props: any) {\n if (!props.className) {\n return ''\n }\n if (props.className.indexOf(CUSTOM_CSS_STYLES_PREFIX) !== -1) {\n return ''\n }\n\n // Remove any extra spaces from props.customClasses. Only allow one space per class.\n const customClasses = props.className.replace(/\\s+/g, ' ')\n const customClassesArray = customClasses.split(' ')\n if (customClassesArray.length == 1 && customClassesArray[0].startsWith(CSS_CLASS_PREFIX)) {\n return ''\n }\n return `:not(${customClassesArray\n .map((className: string) => {\n return `.${className}`\n })\n .join(', ')})`\n}\n\nexport function toKebabKey(key: string) {\n return key.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase()\n}\n\nexport function styleOverridesToCSS(props: any) {\n return props?.styleOverrides\n ? Object.keys(props.styleOverrides)\n .map((key) => `${toKebabKey(key)}: ${props.styleOverrides[key]};`)\n .join(' ')\n : ''\n}\n\nexport function mergeClasses(...classes: string[]) {\n return classes.filter(Boolean).join(' ')\n}\n\nexport function ucFirst(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1)\n}\n","import React from 'react'\nimport styled from 'styled-components'\n\nconst CloseContainer = styled.div`\n :hover {\n opacity: 0.8;\n }\n`\n\nexport const Close = () => (\n <CloseContainer>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\" viewBox=\"0 0 20 20\">\n <path\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n d=\"M5 15L15 5M5 5l10 10\"\n ></path>\n </svg>\n </CloseContainer>\n)\n","import React from 'react'\nimport FrigadeLogo from '../Icons/FrigadeLogo'\nimport { Appearance } from '../../types'\nimport { PoweredByFrigadeContainer } from './styled'\nimport { getClassName } from '../../shared/appearance'\n\nexport function PoweredByFrigade({ appearance }: { appearance: Appearance }) {\n return (\n <PoweredByFrigadeContainer\n className={getClassName('poweredByFrigadeContainer', appearance)}\n appearance={appearance}\n >\n Powered by \n <FrigadeLogo />\n </PoweredByFrigadeContainer>\n )\n}\n","import React, { CSSProperties } from 'react'\n\nfunction FrigadeLogo({ style, className }: { style?: CSSProperties; className?: string }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"54\"\n height=\"14\"\n fill=\"none\"\n viewBox=\"0 0 54 14\"\n style={style}\n className={className}\n >\n <path\n fill=\"currentColor\"\n d=\"M16.293 3.476v1.036h1.593v1.256h-1.593v5.098h-1.41V5.768H14V4.512h.883V3.244c0-.67.294-1.744 1.777-1.744.515 0 .969.049 1.361.146l-.233 1.232a5.939 5.939 0 00-.833-.073c-.442 0-.662.22-.662.67zm6.534.975V5.83c-.846 0-1.63.159-2.342.476v4.56h-1.41V4.513h1.263l.086.61c.846-.451 1.655-.67 2.403-.67zm2.505-.951c-.331.33-.944.33-1.287 0a.93.93 0 01-.246-.659c0-.268.086-.487.246-.646.343-.33.956-.33 1.287 0 .343.33.343.964 0 1.305zm.061 7.366h-1.41V4.512h1.41v6.354zm6.928-5.756c.246.146.368.402.368.756v4.976c0 1.804-.858 2.658-2.672 2.658-.92 0-1.753-.146-2.514-.439l.417-1.073c.674.22 1.336.33 1.974.33.98 0 1.385-.379 1.385-1.403v-.171c-.588.134-1.09.207-1.52.207-.907 0-1.655-.305-2.231-.902-.576-.598-.87-1.39-.87-2.354 0-.963.294-1.756.87-2.354.576-.61 1.324-.914 2.231-.914 1.005 0 1.864.232 2.562.683zm-2.488 4.634a5.15 5.15 0 001.446-.22V5.951a3.695 3.695 0 00-1.446-.292c-1.08 0-1.778.841-1.778 2.048 0 1.22.699 2.037 1.778 2.037zm7.34-5.317c1.52 0 2.28.878 2.28 2.634v3.805h-1.275l-.073-.524c-.601.414-1.288.621-2.084.621-1.263 0-2.06-.658-2.06-1.731 0-1.269 1.25-2.025 3.408-2.025.135 0 .503.013.662.013v-.171c0-1.012-.343-1.451-1.115-1.451-.675 0-1.435.158-2.256.475l-.466-1.012c1.017-.427 2.01-.634 2.979-.634zm-1.839 4.756c0 .427.343.695 1.017.695.528 0 1.251-.22 1.68-.512V8.22h-.441c-1.508 0-2.256.317-2.256.963zm9.953-4.549v-2.83h1.41v7.72c0 .354-.123.598-.368.757-.71.45-1.57.67-2.562.67-.907 0-1.655-.305-2.231-.902-.577-.61-.87-1.39-.87-2.354 0-.963.293-1.756.87-2.354.576-.61 1.324-.914 2.23-.914.43 0 .933.073 1.521.207zM43.84 9.72c.503 0 .981-.098 1.447-.293V5.854a5.15 5.15 0 00-1.447-.22c-1.078 0-1.777.817-1.777 2.037s.699 2.049 1.777 2.049zM54 7.866v.439h-4.573c.184.963.858 1.512 1.827 1.512.613 0 1.275-.146 1.986-.451l.466 1.024c-.87.378-1.729.573-2.575.573-.931 0-1.692-.304-2.268-.902-.576-.61-.87-1.402-.87-2.366 0-.975.294-1.768.87-2.366.576-.597 1.324-.902 2.244-.902.968 0 1.691.33 2.17.975.478.647.723 1.464.723 2.464zm-4.61-.586h3.298c-.086-1.073-.613-1.731-1.581-1.731-.969 0-1.582.695-1.717 1.731z\"\n ></path>\n <path\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n d=\"M1.196 1.229A4.009 4.009 0 014.08 0l4.092.027C9.183.027 10 .867 10 1.904c0 .6-.273 1.133-.7 1.478-.31.25-.7.399-1.126.4h-.001l-4.09-.027h-.002a4.804 4.804 0 00-2.614.77A4.986 4.986 0 000 5.974v-1.78C0 3.036.456 1.988 1.196 1.23zm4.525 4.65a4.282 4.282 0 00-1.184 2.513l3.637.023c.131 0 .259-.015.382-.042h.002c.81-.178 1.42-.908 1.44-1.788v-.046a1.9 1.9 0 00-.533-1.328 1.813 1.813 0 00-.908-.508h-.002l-.002-.001a1.68 1.68 0 00-.366-.042A4.084 4.084 0 005.72 5.88zm-4.525-.016A4.235 4.235 0 000 8.829C0 10.997 1.601 12.78 3.654 13V9.265h-.005l.005-.439v-.437h.023a5.175 5.175 0 011.439-3.13 5.05 5.05 0 01.72-.614l-1.754-.011H4.08c-.787 0-1.521.229-2.144.625a4.11 4.11 0 00-.74.603z\"\n clipRule=\"evenodd\"\n ></path>\n </svg>\n )\n}\n\nexport default FrigadeLogo\n","import styled from 'styled-components'\nimport { TooltipContainer } from '../Tooltips/styled'\n\nexport const PoweredByFrigadeModalRibbon = styled.div`\n background-color: ${(props) => props.appearance?.theme.colorBackground};\n position: absolute;\n bottom: -47px;\n left: 0;\n width: 100%;\n height: 40px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: ${(props) => props.appearance?.theme.borderRadius}px;\n`\n\nexport const PoweredByFrigadeTooltipRibbon = styled(TooltipContainer)`\n background-color: ${(props) => props.appearance?.theme.colorBackground};\n position: absolute;\n bottom: -60px;\n left: 0;\n width: 100%;\n height: 40px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: ${(props) => props.appearance?.theme.borderRadius}px;\n padding: 0;\n z-index: ${(props) => props.zIndex};\n`\n\nexport const PoweredByFrigadeContainer = styled.div`\n display: flex;\n justify-content: center;\n align-items: center;\n font-style: normal;\n font-weight: 500;\n font-size: 12px;\n line-height: 18px;\n color: ${(props) => props.appearance?.theme?.colorTextSecondary};\n`\n","import styled from 'styled-components'\nimport { Appearance } from '../../types'\nimport { getCustomClassOverrides } from '../../shared/appearance'\n\nexport const TooltipContainer = styled.div<{ maxWidth: number; appearance: Appearance }>`\n ${(props) => getCustomClassOverrides(props)} {\n background: ${(props) => props.appearance.theme.colorBackground};\n }\n\n box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n max-width: ${(props) => props.maxWidth}px;\n min-width: 300px;\n z-index: ${(props) => props.zIndex};\n overflow: hidden;\n`\nconst dismissWithImageStyle = `\n display: block;\n cursor: pointer;\n position: absolute;\n background-color: rgba(0, 0, 0, 0.2);\n color: #ffffff;\n padding: 4px;\n border-radius: 100px;\n border-width: 0px;\n top: 12px;\n right: 12px;\n box-sizing: border-box;\n :hover {\n opacity: 0.8;\n }`\n\nconst dismissWithoutImageStyle = `\n display: block;\n cursor: pointer;\n position: absolute;\n top: 12px;\n right: 12px;\n background-color: transparent;\n border: none;\n `\n\nexport const TooltipDismissButton = styled.button`\n ${(props) => getCustomClassOverrides(props)} {\n ${(props) => (props.hasImage ? dismissWithImageStyle : dismissWithoutImageStyle)};\n }\n`\n\nexport const TooltipImageContainer = styled.img`\n ${(props) => getCustomClassOverrides(props)} {\n display: block;\n width: 100%;\n height: auto;\n min-height: 200px;\n object-fit: cover;\n }\n`\n\nexport const TooltipVideoContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: block;\n width: 100%;\n height: auto;\n margin-top: ${(props) => (props.dismissible ? '24px' : '0px')};\n object-fit: cover;\n }\n`\n\nexport const TooltipFooter = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-content: center;\n`\n\nexport const TooltipContentContainer = styled.div`\n padding: 22px 22px 12px;\n`\n\nexport const TooltipStepCountContainer = styled.div`\n display: flex;\n flex: 1;\n flex-direction: column;\n justify-content: center;\n`\n\nexport const TooltipCTAContainer = styled.div`\n display: flex;\n flex: 2;\n flex-shrink: 1;\n gap: 8px;\n height: 64px;\n ${(props) => getCustomClassOverrides(props)} {\n flex-direction: row;\n justify-content: ${(props) => (props.showStepCount ? 'flex-end' : 'flex-start')};\n align-content: center;\n align-items: center;\n }\n`\n\nexport const TooltipStepCounter = styled.p`\n ${(props) => getCustomClassOverrides(props)} {\n font-style: normal;\n font-weight: 600;\n font-size: 15px;\n line-height: 22px;\n color: #808080;\n }\n margin: 0;\n`\n","import React, { FC, useEffect, useState } from 'react'\nimport styled from 'styled-components'\nimport { Portal } from 'react-portal'\nimport { Appearance } from '../../types'\nimport { getClassName, getCustomClassOverrides } from '../../shared/appearance'\nimport { Close } from '../Icons/Close'\n\nfunction getModalPosition(\n modalPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n) {\n switch (modalPosition) {\n case 'top-left':\n return `\n top: 0;\n left: 0;\n `\n case 'top-right':\n return `\n top: 0;\n right: 0;\n `\n case 'bottom-left':\n return `\n bottom: 0;\n left: 0;\n `\n }\n\n return `right: 0; bottom: 0;`\n}\n\nconst CornerModalContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n background: ${(props) => props.appearance?.theme?.colorBackground};\n position: fixed;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n z-index: 1500;\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);\n border-radius: 12px;\n width: 350px;\n padding: 24px;\n }\n ${(props) => getModalPosition(props.modalPosition)}\n margin: 28px;\n`\n\nconst CornerModalHeader = styled.div`\n position: relative;\n flex: 1;\n`\n\nconst CornerModalClose = styled.div`\n position: absolute;\n top: 16px;\n right: 16px;\n cursor: pointer;\n z-index: 1501;\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n color: ${(props) => props.appearance?.theme?.colorText};\n }\n`\n\nconst Body = styled.div`\n overflow: scroll;\n flex: 5;\n ::-webkit-scrollbar {\n display: none;\n }\n`\n\ninterface CornerModalProps {\n onClose: () => void\n visible: boolean\n headerContent?: React.ReactNode\n children: React.ReactNode\n style?: React.CSSProperties\n appearance?: Appearance\n modalPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n dismissible?: boolean\n}\n\nexport const CornerModal: FC<CornerModalProps> = ({\n onClose,\n visible,\n headerContent = null,\n children,\n appearance,\n modalPosition = 'bottom-right',\n dismissible = true,\n}) => {\n const [initialBodyOverflow, setInitialBodyOverflow] = useState('')\n\n function handleDismiss() {\n const bodyStyle = document.body.style\n bodyStyle.setProperty('overflow', initialBodyOverflow)\n onClose()\n }\n\n useEffect(() => {\n const initialOverflow = getComputedStyle(document.body).getPropertyValue('overflow')\n setInitialBodyOverflow(initialOverflow)\n }, [])\n\n // If user presses escape key, close modal\n useEffect(() => {\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n handleDismiss()\n }\n }\n document.addEventListener('keydown', handleEscape)\n\n return () => {\n document.removeEventListener('keydown', handleEscape)\n }\n }, [onClose])\n\n useEffect(() => {\n const bodyStyle = document.body.style\n\n if (visible) {\n bodyStyle.setProperty('overflow', 'hidden')\n } else {\n bodyStyle.setProperty('overflow', initialBodyOverflow)\n }\n\n return () => {\n bodyStyle.setProperty('overflow', initialBodyOverflow)\n }\n }, [visible])\n\n if (!visible) return <></>\n\n return (\n <Portal>\n <CornerModalContainer\n appearance={appearance}\n className={getClassName('cornerModalContainer', appearance)}\n modalPosition={modalPosition}\n >\n {dismissible && (\n <CornerModalClose\n className={getClassName('cornerModalClose', appearance)}\n onClick={handleDismiss}\n >\n <Close />\n </CornerModalClose>\n )}\n {headerContent && <CornerModalHeader>{headerContent}</CornerModalHeader>}\n <Body>{children}</Body>\n </CornerModalContainer>\n </Portal>\n )\n}\n","import { useContext } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { Appearance } from '../types'\n\nexport function useTheme() {\n const { defaultAppearance } = useContext(FrigadeContext)\n\n function mergeAppearanceWithDefault(appearance?: Appearance): Appearance {\n const _appearance = JSON.parse(JSON.stringify(defaultAppearance))\n\n if (!appearance) {\n return _appearance\n }\n\n return {\n styleOverrides: Object.assign(\n _appearance.styleOverrides ?? {},\n appearance.styleOverrides ?? {}\n ),\n theme: Object.assign(_appearance.theme, appearance.theme ?? {}),\n }\n }\n\n return { mergeAppearanceWithDefault }\n}\n","import React, { useContext, useEffect, useState } from 'react'\nimport styled from 'styled-components'\nimport {\n CustomFormTypeProps,\n FormInputProps,\n FormInputType,\n FormValidationError,\n} from '../../../FrigadeForm/types'\nimport { TextField } from './form-components/TextField'\nimport { MultipleChoice } from './form-components/MultipleChoice'\nimport { MultipleChoiceList } from './form-components/MultipleChoiceList'\nimport { TitleSubtitle } from '../../TitleSubtitle/TitleSubtitle'\nimport { getClassName } from '../../../shared/appearance'\nimport { useUser } from '../../../api/users'\nimport { Warning } from '../../Icons/Warning'\nimport { FrigadeContext } from '../../../FrigadeProvider'\n\ninterface MultiInputStepProps {\n data?: FormInputType[]\n}\n\nconst MultiInputContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n overflow: visible;\n padding-top: 14px;\n`\n\nconst MultiInputValidationError = styled.div`\n color: ${(props) => props.appearance?.theme?.colorTextError};\n font-size: 12px;\n margin-bottom: 12px;\n display: flex;\n align-items: center;\n`\n\nconst MultiInputValidationErrorIcon = styled.div`\n margin-right: 4px;\n display: inline-flex;\n`\n\nconst MultiInput = styled.div`\n padding-left: 1px;\n padding-right: 1px;\n`\n\nconst DEFAULT_INPUT_TYPES: { [key: string]: (params: FormInputProps) => React.ReactNode } = {\n text: TextField,\n multipleChoice: MultipleChoice,\n multipleChoiceList: MultipleChoiceList,\n}\n\nexport const FORM_DATA_KEY_PREFIX = `frigade-multiInputStepTypeData`\n\nexport function MultiInputStepType({\n flowId,\n stepData,\n canContinue,\n setCanContinue,\n onSaveData,\n appearance,\n customFormElements,\n prefillData,\n}: CustomFormTypeProps) {\n const formElements = stepData.props as MultiInputStepProps\n const [formValidationErrors, setFormValidationErrors] = useState<FormValidationError[]>([])\n const [touchedInputs, setTouchedInputs] = useState<string[]>([])\n const { userId } = useUser()\n const [allFormData, setAllFormData] = useState(\n loadFromLocalStorage() || (prefillData ? prefillData[stepData.id] : null) || {}\n )\n const { readonly } = useContext(FrigadeContext)\n const mergedInputTypes = { ...DEFAULT_INPUT_TYPES, ...customFormElements }\n\n useEffect(() => {\n setCanContinue(formValidationErrors.length === 0)\n }, [formValidationErrors, setCanContinue])\n\n useEffect(() => {\n onSaveData(allFormData)\n }, [allFormData])\n\n function saveDataFromInputs(input: FormInputType, data: object) {\n setAllFormData((prevData) => {\n const newData = { ...prevData, [input.id]: data }\n if (typeof window !== 'undefined' && window.localStorage && !readonly) {\n window.localStorage.setItem(getLocalStorageKey(), JSON.stringify(newData))\n }\n return newData\n })\n }\n\n function loadFromLocalStorage() {\n if (typeof window !== 'undefined' && window.localStorage) {\n const data = window.localStorage.getItem(getLocalStorageKey())\n if (data) {\n return JSON.parse(data)\n }\n }\n return null\n }\n\n function getLocalStorageKey() {\n return `${FORM_DATA_KEY_PREFIX}-${flowId}-${stepData.id}-${userId}`\n }\n\n return (\n <MultiInput className={getClassName('multiInput', appearance)}>\n <TitleSubtitle appearance={appearance} title={stepData.title} subtitle={stepData.subtitle} />\n <MultiInputContainer className={getClassName('multiInputContainer', appearance)}>\n {formElements?.data?.map((input: FormInputType) => {\n const err = formValidationErrors.reverse().find((error) => error.id === input.id)\n return mergedInputTypes[input.type] ? (\n <span\n key={input.id}\n data-field-id={input.id}\n className={getClassName('multiInputField', appearance)}\n >\n {mergedInputTypes[input.type]({\n formInput: input,\n customFormTypeProps: {\n flowId,\n stepData,\n canContinue,\n setCanContinue,\n onSaveData,\n appearance,\n },\n onSaveInputData: (data) => {\n if (\n !touchedInputs.includes(input.id) &&\n // Ensure not empty string\n data &&\n data?.text !== ''\n ) {\n setTouchedInputs((prev) => [...prev, input.id])\n }\n saveDataFromInputs(input, data)\n },\n inputData: allFormData[input.id],\n allInputData: allFormData,\n setFormValidationErrors: (errors) => {\n if (errors.length === 0 && formValidationErrors.length === 0) {\n return\n }\n setFormValidationErrors((prev) => {\n if (errors.length === 0) {\n return prev.filter((error) => error.id !== input.id)\n }\n return [...prev, ...errors]\n })\n },\n })}\n {err && err.message && touchedInputs.includes(input.id) && err.hidden !== true && (\n <MultiInputValidationError\n key={input.id}\n style={{ overflow: 'hidden' }}\n appearance={appearance}\n className={getClassName('multiInputValidationError', appearance)}\n >\n <MultiInputValidationErrorIcon\n appearance={appearance}\n className={getClassName('multiInputValidationErrorIcon', appearance)}\n >\n <Warning />\n </MultiInputValidationErrorIcon>\n {err.message}\n </MultiInputValidationError>\n )}\n </span>\n ) : null\n })}\n </MultiInputContainer>\n </MultiInput>\n )\n}\n","import React, { useEffect, useState } from 'react'\n\nimport styled from 'styled-components'\nimport { FormInputProps, FormInputType } from '../../../../../FrigadeForm/types'\nimport { getClassName, getCustomClassOverrides } from '../../../../../shared/appearance'\nimport { Label } from '../shared/Label'\nimport { SubLabel } from '../shared/SubLabel'\nimport { getErrorsFromValidationResult } from '../shared/validation'\n\ninterface TextFieldProps extends FormInputType {\n id: string\n title?: string\n placeholder?: string\n multiline?: boolean\n}\n\nconst TextInputWrapper = styled.div`\n display: flex;\n flex-direction: column;\n width: 100%;\n`\n\nexport const TextInput = styled.input`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n border: 1px solid ${(props) => props.appearance?.theme?.colorBorder};\n font-size: 14px;\n ::placeholder {\n color: ${(props) => props.appearance?.theme?.colorTextDisabled};\n font-size: 14px;\n }\n border-radius: 6px;\n }\n width: 100%;\n height: 40px;\n box-sizing: border-box;\n padding: 0 10px;\n margin-bottom: 10px;\n`\nconst TextArea = styled.textarea`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n border: 1px solid ${(props) => props.appearance?.theme?.colorBorder};\n font-size: 14px;\n padding: 10px;\n ::placeholder {\n color: #c7c7c7;\n font-size: 14px;\n }\n border-radius: 6px;\n }\n width: 100%;\n min-height: 70px;\n box-sizing: border-box;\n margin-bottom: 10px;\n resize: none;\n`\n\nexport function TextField({\n formInput,\n customFormTypeProps,\n onSaveInputData,\n setFormValidationErrors,\n inputData,\n}: FormInputProps) {\n const input = formInput as TextFieldProps\n const [data, setData] = useState(inputData?.text || '')\n const [hasLoaded, setHasLoaded] = useState(false)\n const [hasGivenFocus, setHasGivenFocus] = useState(false)\n let InputComponent = TextInput\n useEffect(() => {\n if (data === '' && !hasLoaded) {\n setHasLoaded(true)\n handleDataChange('')\n }\n }, [])\n\n useEffect(() => {\n if (hasGivenFocus) {\n handleDataChange(data)\n return\n }\n }, [hasGivenFocus])\n\n function handleDataChange(value: string) {\n setData(value)\n onSaveInputData({ text: value })\n if (input.required === true && value.trim() === '') {\n setFormValidationErrors([\n {\n id: input.id,\n message: `${input.title ?? `Field`} is required`,\n hidden: !hasGivenFocus,\n },\n ])\n return\n }\n const validationError = getErrorsFromValidationResult(value, input.validation)\n if (validationError && (value.trim() !== '' || input.required === true)) {\n setFormValidationErrors([\n {\n id: input.id,\n message: validationError,\n hidden: !hasGivenFocus,\n },\n ])\n return\n }\n setFormValidationErrors([])\n }\n\n if (input.multiline) {\n InputComponent = TextArea\n }\n\n function getType() {\n switch (input?.validation?.type) {\n case 'email':\n return 'email'\n case 'number':\n return 'number'\n case 'password':\n return 'password'\n }\n\n return null\n }\n\n return (\n <TextInputWrapper>\n <Label\n title={input.title}\n required={input.required}\n appearance={customFormTypeProps.appearance}\n />\n <InputComponent\n className={getClassName('inputComponent', customFormTypeProps.appearance)}\n value={data}\n onChange={(e) => {\n handleDataChange(e.target.value)\n }}\n appearance={customFormTypeProps.appearance}\n placeholder={input.placeholder}\n type={getType()}\n onBlur={() => {\n setHasGivenFocus(true)\n }}\n ></InputComponent>\n <SubLabel title={input.subtitle} appearance={customFormTypeProps.appearance} />\n </TextInputWrapper>\n )\n}\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../../../../../shared/appearance'\n\nexport const FormLabel = styled.label`\n ${(props) => getCustomClassOverrides(props)} {\n font-size: 12px;\n line-height: 18px;\n margin-bottom: 5px;\n margin-top: 10px;\n font-style: normal;\n font-weight: 600;\n letter-spacing: 0.24px;\n }\n display: flex;\n`\n\nexport const FormSubLabel = styled.label`\n ${(props) => getCustomClassOverrides(props)} {\n font-size: 12px;\n line-height: 20px;\n margin-bottom: 5px;\n }\n display: flex;\n`\n\nexport const RequiredSymbol = styled.span`\n font-weight: 400;\n font-size: 14px;\n line-height: 22px;\n color: ${(props) => props.appearance?.theme?.colorTextError};\n display: flex;\n margin-right: 5px;\n margin-top: 10px;\n`\n\nexport const LabelWrapper = styled.div`\n display: flex;\n align-items: flex-start;\n justify-content: left;\n margin-bottom: 10px;\n`\n","import { FormLabel, LabelWrapper, RequiredSymbol } from './styled'\nimport { getClassName } from '../../../../../shared/appearance'\nimport React from 'react'\nimport { Appearance, DefaultAppearance } from '../../../../../types'\n\nexport function Label({\n title,\n required,\n appearance = DefaultAppearance,\n}: {\n title?: string\n required: boolean\n appearance?: Appearance\n}) {\n if (!title) {\n return null\n }\n\n return (\n <LabelWrapper className={getClassName('formLabelWrapper', appearance)}>\n {required ? (\n <RequiredSymbol\n className={getClassName('formLabelRequired', appearance)}\n appearance={appearance}\n >\n *\n </RequiredSymbol>\n ) : null}\n <FormLabel className={getClassName('formLabel', appearance)}>{title}</FormLabel>\n </LabelWrapper>\n )\n}\n","import React, { CSSProperties } from 'react'\n\nexport interface StepData {\n /**\n * Unique identifier for the step.\n */\n id: string\n /**\n * Name of the step when shown in a list view\n */\n stepName?: string\n /**\n * Title of the step\n */\n title?: string\n /**\n * Subtitle of the step\n */\n subtitle?: string\n /**\n * Primary button title. If omitted, the primary button will not be shown.\n */\n primaryButtonTitle?: string\n /**\n * Primary button URI.\n */\n primaryButtonUri?: string\n /**\n * Primary button URI target (either _blank or _self)\n */\n primaryButtonUriTarget?: string\n /**\n * Secondary button title. If omitted, the secondary button will not be shown.\n */\n secondaryButtonTitle?: string\n /**\n * Secondary button URI.\n */\n secondaryButtonUri?: string\n /**\n * Secondary button URI target (either _blank or _self)\n */\n secondaryButtonUriTarget?: string\n /**\n * Text on button if a back button is present\n */\n backButtonTitle?: string\n /**\n * If true, the step will be marked as completed when the secondary button is clicked.\n */\n skippable?: boolean\n /**\n * @deprecated use primaryButtonUri instead\n */\n url?: string\n /**\n * @deprecated use primaryButtonUriTarget instead\n */\n urlTarget?: string\n type?: string\n /**\n * Video url to be shown for components supporting video.\n */\n videoUri?: string\n /**\n * Image url to be shown for components supporting image.\n */\n imageUri?: string | null\n /**\n * Automatically mark the step as completed when the primary button is clicked. Default is false.\n */\n autoMarkCompleted?: boolean\n /**\n * Whether the step is completed.\n */\n complete: boolean\n /**\n * Whether the step has been started by the user. True if either the step was marked started or completed.\n */\n started: boolean\n /**\n * Whether the step is currently active/the flow is currently on this step. Can only be true for on step at a time.\n */\n currentlyActive: boolean\n /**\n * Whether the step is blocked (can't be accessed yet)\n */\n blocked?: boolean\n /**\n * Whether the step is hidden (not shown in the list view)\n */\n hidden?: boolean\n StepContent?: React.ReactNode\n /**\n * Handler for when the primary button is clicked.\n */\n handlePrimaryButtonClick?: () => void\n /**\n * Handler for when the secondary button is clicked.\n */\n handleSecondaryButtonClick?: () => void\n ctaActionType?: 'complete'\n props?: any\n /**\n * Criteria that needs to be met for the step to complete\n */\n completionCriteria?: string\n /**\n * Criteria that needs to be met for the step to start\n */\n startCriteria?: string\n progress?: number\n /**\n * Whether the step is dismissible (for instance, tooltips or other non-essential steps)\n */\n dismissible?: boolean\n /**\n * Whether to show a highlight in the page where the step is shown. Typically used in tooltips for creating small pings.\n */\n showHighlight?: boolean\n\n /**\n * Config for the primary button in this step\n */\n primaryButton?: {\n /**\n * Primary button URI target (defaults to _self).\n */\n target?: string\n\n /**\n * Primary button title. If omitted, the primary button will not be shown.\n */\n title?: string\n\n /**\n * Primary button URI.\n */\n uri?: string\n }\n\n /**\n * Config for the secondary button in this step\n */\n secondaryButton?: {\n /**\n * Secondary button URI target (defaults to _self).\n */\n target?: string\n\n /**\n * Secondary button title. If omitted, the secondary button will not be shown.\n */\n title?: string\n\n /**\n * Secondary button URI.\n */\n uri?: string\n }\n\n /**\n * Any other additional props defined in config.yml\n */\n [x: string | number | symbol]: unknown\n}\n\nexport interface DefaultFrigadeFlowProps {\n flowId: string\n style?: CSSProperties\n className?: string\n /**\n * The appearance of the flow. See https://docs.frigade.com/sdk/styling\n */\n appearance?: Appearance\n /**\n * Dynamic variables to use in config.yml. See https://docs.frigade.com/flows/dynamic-variables\n */\n customVariables?: { [key: string]: string | number | boolean }\n hideOnFlowCompletion?: boolean\n /**\n * Handler for when a step is completed.\n * @param step\n * @param index\n * @param nextStep\n * @param allFormData All form data collected so far (only applicable to FrigadeForms)\n * @param stepSpecificFormData Form data collected for the finished step (only applicable to FrigadeForms)\n */\n onStepCompletion?: (\n step: StepData,\n index: number,\n nextStep?: StepData,\n allFormData?: any,\n stepSpecificFormData?: any\n ) => boolean\n /**\n * Handler for when a primary or secondary CTA is clicked (regardless if step is completed or not).\n * Return true if your app performs an action (e.g. open other modal or page transition).\n * @param step\n * @param index\n * @param cta\n */\n onButtonClick?: (\n step: StepData,\n index?: number,\n cta?: 'primary' | 'secondary' | 'link' | 'back' | 'collapse' | 'expand',\n nextStep?: StepData\n ) => boolean\n\n onDismiss?: () => void\n onComplete?: () => void\n}\n\nexport interface Appearance {\n /**\n * Overrides of individual components and classes.\n * This map can either be className(s) or CSSProperties.\n */\n styleOverrides?: {\n [key: string]: CSSProperties | string\n }\n /**\n * The base theme to use with Frigade components.\n */\n theme?: BaseTheme\n}\n\nexport interface BaseTheme {\n /**\n * The base theme color used on CTAs and other primary elements.\n */\n colorPrimary?: string\n /**\n * Secondary color, used for CTAs and other secondary elements.\n */\n colorSecondary?: string\n\n colorBackground?: string\n colorBackgroundSecondary?: string\n colorText?: string\n colorTextOnPrimaryBackground?: string\n colorTextSecondary?: string\n colorTextDisabled?: string\n colorTextError?: string\n colorTextSuccess?: string\n colorBorder?: string\n fontSize?: string | number\n fontSmoothing?: string\n fontWeight?: string | number\n borderRadius?: number\n modalContainer?: CSSProperties\n}\n\nexport const DefaultAppearance: Appearance = {\n theme: {\n colorPrimary: '#0171F8',\n colorSecondary: '#2E343D',\n colorText: '#0F1114',\n colorBackground: '#ffffff',\n colorBackgroundSecondary: '#d2d2d2',\n colorTextOnPrimaryBackground: '#ffffff',\n colorTextSecondary: '#2E343D',\n colorTextDisabled: '#5A6472',\n colorBorder: '#E5E5E5',\n colorTextError: '#c00000',\n colorTextSuccess: '#00D149',\n borderRadius: 10,\n },\n}\n","import { FormSubLabel, LabelWrapper } from './styled'\nimport { getClassName } from '../../../../../shared/appearance'\nimport React from 'react'\nimport { Appearance } from '../../../../../types'\n\nexport function SubLabel({ title, appearance }: { title?: string; appearance: Appearance }) {\n if (!title) {\n return null\n }\n\n return (\n <LabelWrapper>\n <FormSubLabel className={getClassName('formSubLabel', appearance)}>{title}</FormSubLabel>\n </LabelWrapper>\n )\n}\n","import { InputValidation } from '../../../../../FrigadeForm/types'\nimport { z } from 'zod'\n\nexport function getErrorsFromValidationResult(\n value?: string,\n validation?: InputValidation\n): string | null {\n try {\n if (validation) {\n if (validation.type == 'number') {\n let validator = z.number()\n if (validation.props) {\n for (const validationProp of validation.props) {\n if (validationProp.requirement == 'min') {\n validator = validator.min(\n Number(validationProp.value),\n validationProp.message ?? 'Value is too small'\n )\n } else if (validationProp.requirement == 'max') {\n validator = validator.max(\n Number(validationProp.value),\n validationProp.message ?? 'Value is too large'\n )\n } else if (validationProp.requirement == 'positive') {\n validator = validator.positive(validationProp.message ?? 'Value must be positive')\n } else if (validationProp.requirement == 'negative') {\n validator = validator.nonpositive(validationProp.message ?? 'Value must be negative')\n }\n }\n }\n validator.parse(Number(value))\n }\n if (validation.type == 'string') {\n let validator = z.string()\n if (validation.props) {\n for (const validationProp of validation.props) {\n if (validationProp.requirement == 'min') {\n validator = validator.min(\n Number(validationProp.value),\n validationProp.message ?? 'Value is too short'\n )\n } else if (validationProp.requirement == 'max') {\n validator = validator.max(\n Number(validationProp.value),\n validationProp.message ?? 'Value is too long'\n )\n } else if (validationProp.requirement == 'regex') {\n validator = validator.regex(\n new RegExp(String(validationProp.value)),\n validationProp.message ?? 'Value does not match requirements'\n )\n }\n }\n }\n validator.parse(value)\n }\n\n return\n }\n } catch (e) {\n if (e instanceof z.ZodError) {\n if (e.issues && e.issues.length > 0) {\n return e.issues[0].message\n }\n return null\n }\n console.error('Frigade Form validation failed for rule ', validation, e)\n }\n\n return null\n}\n","import React, { useEffect, useState } from 'react'\n\nimport styled from 'styled-components'\nimport { FormInputProps, FormInputType } from '../../../../../FrigadeForm/types'\nimport { getClassName, getCustomClassOverrides } from '../../../../../shared/appearance'\nimport { Label } from '../shared/Label'\nimport { TextInput } from '../TextField'\nimport { SubLabel } from '../shared/SubLabel'\n\nconst NULL_VALUE = ''\n\nexport interface MultipleChoiceProps extends FormInputType {\n id: string\n title?: string\n placeholder?: string\n defaultValue?: string\n requireSelection?: boolean\n props: {\n options?: MultipleChoiceOption[]\n }\n}\n\nexport interface MultipleChoiceOption {\n id: string\n title: string\n isOpenEnded?: boolean\n openEndedLabel?: string\n}\n\nconst MultipleChoiceWrapper = styled.div`\n display: flex;\n flex-direction: column;\n width: 100%;\n -webkit-appearance: none;\n appearance: none;\n`\n\nconst MultipleChoiceSelect = styled.select`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n border: 1px solid ${(props) => props.appearance?.theme?.colorBorder};\n font-size: 14px;\n border-radius: 6px;\n }\n width: 100%;\n height: 40px;\n box-sizing: border-box;\n\n padding: 0 10px;\n margin-bottom: 10px;\n color: ${(props) =>\n props.value == ''\n ? props.appearance?.theme?.colorTextDisabled\n : props.appearance?.theme?.colorText};\n\n appearance: none;\n background-image: url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'><path stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/></svg>\");\n background-position: right 0.5rem center;\n background-repeat: no-repeat;\n background-size: 1.5em 1.5em;\n -webkit-print-color-adjust: exact;\n`\n\nexport function MultipleChoice({\n formInput,\n customFormTypeProps,\n onSaveInputData,\n inputData,\n setFormValidationErrors,\n}: FormInputProps) {\n const input = formInput as MultipleChoiceProps\n const [hasLoaded, setHasLoaded] = useState(false)\n const [hasSelected, setHasSelected] = useState(false)\n const [otherValue, setOtherValue] = useState('')\n\n useEffect(() => {\n if (!inputData?.choice?.[0] && !hasLoaded) {\n setHasLoaded(true)\n if (input.requireSelection) {\n onSaveInputData({ choice: [NULL_VALUE] })\n return\n }\n if (\n input.defaultValue &&\n input.props.options?.find((option) => option.id === input.defaultValue)\n ) {\n // Find input.props.options with id == defaultValue\n const defaultValue = input.props.options?.find((option) => option.id === input.defaultValue)\n onSaveInputData({ choice: [defaultValue.id], label: [defaultValue.title] })\n } else {\n onSaveInputData({\n choice: [input.props.options?.[0].id || ''],\n label: [input.props.options?.[0].title],\n })\n }\n }\n }, [])\n\n useEffect(() => {\n if (input.requireSelection && inputData?.choice?.[0] === NULL_VALUE) {\n setFormValidationErrors([\n {\n message: 'Please select an option',\n id: input.id,\n hidden: true,\n },\n ])\n } else {\n setFormValidationErrors([])\n }\n }, [inputData?.choice?.[0], hasSelected])\n\n return (\n <MultipleChoiceWrapper>\n <Label\n title={input.title}\n required={input.required}\n appearance={customFormTypeProps.appearance}\n />\n <MultipleChoiceSelect\n value={inputData?.choice?.[0]}\n onChange={(e) => {\n setHasSelected(true)\n onSaveInputData({ choice: [e.target.value], label: [e.target.selectedOptions[0].text] })\n }}\n placeholder={input.placeholder}\n appearance={customFormTypeProps.appearance}\n className={getClassName('multipleChoiceSelect', customFormTypeProps.appearance)}\n >\n {input.requireSelection && (\n <option key=\"null-value\" value={NULL_VALUE} disabled>\n {input.placeholder ?? `Select an option`}\n </option>\n )}\n {input.props.options?.map((option) => {\n return (\n <option key={option.id} value={option.id}>\n {option.title}\n </option>\n )\n })}\n </MultipleChoiceSelect>\n {/*// If selected data is option.isOpenEnded is true, render an input field*/}\n {input.props.options?.find((option) => option.id === inputData?.choice?.[0])?.isOpenEnded && (\n <>\n <Label\n title={\n input.props.options?.find((option) => option.id === inputData?.choice?.[0])\n ?.openEndedLabel ?? `Please specify`\n }\n required={false}\n appearance={customFormTypeProps.appearance}\n />\n <TextInput\n type=\"text\"\n placeholder=\"Enter your answer here\"\n onChange={(e) => {\n onSaveInputData({\n choice: [\n input.props.options?.find((option) => option.id === inputData?.choice?.[0])?.id,\n ],\n label: [e.target.value],\n isOpenEnded: true,\n })\n }}\n appearance={customFormTypeProps.appearance}\n />\n </>\n )}\n <SubLabel title={input.subtitle} appearance={customFormTypeProps.appearance} />\n </MultipleChoiceWrapper>\n )\n}\n","import React, { useEffect, useState } from 'react'\n\nimport styled from 'styled-components'\nimport { FormInputProps, MultipleChoiceListProps } from '../../../../../FrigadeForm/types'\nimport { getClassName, getCustomClassOverrides } from '../../../../../shared/appearance'\nimport { Label } from '../shared/Label'\nimport { SubLabel } from '../shared/SubLabel'\nimport { CheckBox } from '../../../../CheckBox'\nimport { sanitize } from '../../../../../shared/sanitizer'\n\nconst MultipleChoiceListWrapper = styled.div`\n display: flex;\n flex-direction: column;\n width: 100%;\n -webkit-appearance: none;\n appearance: none;\n`\n\nconst MultipleChoiceListItem = styled.button`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n border: 1px solid ${(props) => props.appearance?.theme?.colorBorder};\n font-size: 14px;\n // Selector for when selected=true\n &[data-selected='true'] {\n border: 1px solid ${(props) => props.appearance.theme.colorPrimary};\n background-color: ${(props) => props.appearance.theme.colorPrimary}1a;\n }\n\n :hover {\n border: 1px solid ${(props) => props.appearance.theme.colorPrimary};\n }\n text-align: left;\n border-radius: 10px;\n }\n display: inline-flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n width: 100%;\n line-height: 18px;\n padding: 18px;\n margin-bottom: 10px;\n`\n\nexport function MultipleChoiceList({\n formInput,\n customFormTypeProps,\n onSaveInputData,\n inputData,\n setFormValidationErrors,\n}: FormInputProps) {\n const input = formInput as MultipleChoiceListProps\n const [selectedIds, setSelectedIds] = useState<string[]>(inputData?.choice || [])\n const [hasLoaded, setHasLoaded] = useState(false)\n\n useEffect(() => {\n if (selectedIds.length == 0 && !hasLoaded) {\n setHasLoaded(true)\n onSaveInputData({ choice: [] })\n }\n }, [])\n\n useEffect(() => {\n onSaveInputData({ choice: selectedIds })\n }, [selectedIds])\n\n useEffect(() => {\n // Set errors if inputData does not meet min/max requirements and if field is required\n if (\n input.required &&\n (selectedIds.length < input.props.minChoices || selectedIds.length > input.props.maxChoices)\n ) {\n setFormValidationErrors([\n {\n message: ``,\n id: input.id,\n },\n ])\n } else {\n setFormValidationErrors([])\n }\n }, [selectedIds])\n\n return (\n <MultipleChoiceListWrapper>\n <Label\n title={input.title}\n required={input.required}\n appearance={customFormTypeProps.appearance}\n />\n {input.props.options?.map((option) => {\n return (\n <MultipleChoiceListItem\n appearance={customFormTypeProps.appearance}\n className={getClassName(\n selectedIds.includes(option.id)\n ? 'multipleChoiceListItemSelected'\n : 'multipleChoiceListItem',\n customFormTypeProps.appearance\n )}\n key={option.id}\n value={option.id}\n data-selected={selectedIds.includes(option.id)}\n onClick={() => {\n // If the option is already selected, remove it from the selectedIds\n if (selectedIds.includes(option.id)) {\n setSelectedIds(selectedIds.filter((id) => id !== option.id))\n return\n }\n // Select the input if we are still under maxChoices\n if (selectedIds.length < input.props.maxChoices) {\n setSelectedIds([...selectedIds, option.id])\n } else {\n if (selectedIds.length == 1 && input.props.maxChoices == 1) {\n // deselect the input if we are at maxChoices and minChoices is 1\n setSelectedIds([option.id])\n }\n }\n }}\n >\n <span dangerouslySetInnerHTML={sanitize(option.title)} />\n <CheckBox\n type=\"round\"\n primaryColor={customFormTypeProps.appearance.theme.colorPrimary}\n value={selectedIds.includes(option.id)}\n appearance={customFormTypeProps.appearance}\n />\n </MultipleChoiceListItem>\n )\n })}\n <SubLabel title={input.subtitle} appearance={customFormTypeProps.appearance} />\n </MultipleChoiceListWrapper>\n )\n}\n","import React, { CSSProperties, FC } from 'react'\nimport { ProgressRing } from '../Progress/ProgressRing'\nimport { getClassName, mergeClasses, styleOverridesToCSS } from '../../shared/appearance'\nimport { Appearance, DefaultAppearance } from '../../types'\nimport styled from 'styled-components'\n\nconst CheckIcon = ({ color = '#FFFFFF' }) => (\n <svg width={10} height={8} viewBox=\"0 0 10 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M1 4.34815L3.4618 7L3.4459 6.98287L9 1\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n)\n\nconst BASE_CHECKBOX_STYLES_SQUARE: CSSProperties = {\n width: '22px',\n height: '22px',\n borderRadius: '8px',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n}\n\nconst BASE_CHECKBOX_STYLES_ROUND: CSSProperties = {\n width: '22px',\n height: '22px',\n borderRadius: '40px',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n}\n\nconst BASE_CHECKBOX_STYLES_SQUARE__CHECKED = {\n border: '1px solid #000000',\n color: '#FFFFFF',\n}\n\nconst BASE_CHECKBOX_STYLES_SQUARE__UNCHECKED = {\n border: '1px solid #C5CBD3',\n}\n\nconst BASE_CHECKBOX_STYLES_ROUND__CHECKED = {\n color: '#FFFFFF',\n}\n\nconst BASE_CHECKBOX_STYLES_ROUND__UNCHECKED = {\n border: '1px solid #C5CBD3',\n}\n\nconst getBaseStyle = (type: CheckBoxType): CSSProperties => {\n if (type === 'square') return BASE_CHECKBOX_STYLES_SQUARE\n else return BASE_CHECKBOX_STYLES_ROUND\n}\n\nconst getStateStyle = (type: CheckBoxType, checked: boolean): CSSProperties => {\n if (type === 'square')\n return checked ? BASE_CHECKBOX_STYLES_SQUARE__CHECKED : BASE_CHECKBOX_STYLES_SQUARE__UNCHECKED\n return checked ? BASE_CHECKBOX_STYLES_ROUND__CHECKED : BASE_CHECKBOX_STYLES_ROUND__UNCHECKED\n}\n\nexport type CheckBoxType = 'square' | 'round'\n\nexport interface CheckBoxProps {\n value: boolean\n type?: CheckBoxType\n primaryColor?: string\n progress?: number // progress percentage our of 1. e.g. 0.5\n appearance?: Appearance\n className?: string\n style?: React.CSSProperties\n label?: string\n}\n\nconst CheckIconContainer = styled.div`\n ${(props) => styleOverridesToCSS(props)}\n flex-shrink: 0;\n`\n\nexport const CheckBox: FC<CheckBoxProps> = ({\n value,\n type = 'round',\n primaryColor = '#000000',\n progress,\n appearance = DefaultAppearance,\n style,\n className,\n label,\n}) => {\n let checkBoxStyle = getBaseStyle(type as CheckBoxType)\n let stateStyle = getStateStyle(type as CheckBoxType, value)\n\n if (value === true) {\n checkBoxStyle = {\n ...checkBoxStyle,\n ...stateStyle,\n backgroundColor: appearance.theme.colorTextSuccess,\n borderColor: type === 'square' ? primaryColor : 'none',\n }\n } else {\n checkBoxStyle = {\n ...checkBoxStyle,\n ...stateStyle,\n }\n }\n\n if (value !== true && type === 'round' && progress !== undefined && progress !== 1) {\n return <ProgressRing fillColor={primaryColor} percentage={progress} size={22} />\n }\n\n return (\n <CheckIconContainer\n styleOverrides={checkBoxStyle}\n style={style}\n role=\"checkbox\"\n aria-checked={value === true}\n aria-label={label}\n className={mergeClasses(\n getClassName('checkIconContainer', appearance),\n getClassName(\n value ? 'checkIconContainerChecked' : 'checkIconContainerUnchecked',\n appearance\n ),\n value ? 'checkIconContainerChecked' : 'checkIconContainerUnchecked',\n className\n )}\n >\n {value && <CheckIcon color={'#FFFFFF'} />}\n </CheckIconContainer>\n )\n}\n","import React, { FC } from 'react'\n\nconst Circle: FC<{ color: string; percentage?: number; size: number }> = ({\n color,\n percentage,\n size,\n}) => {\n const r = size * 0.5 - 2\n const circum = 2 * Math.PI * r\n const strokePct = (1 - percentage) * circum // where stroke will start, e.g. from 15% to 100%.\n\n return (\n <circle\n r={r}\n cx={size * 0.5}\n cy={size * 0.5}\n fill=\"transparent\"\n stroke={strokePct !== circum ? color : ''}\n strokeWidth={'3px'}\n strokeDasharray={circum}\n strokeDashoffset={percentage ? strokePct : 0}\n ></circle>\n )\n}\n\ninterface ProgressRingProps {\n fillColor: string\n size: number\n bgColor?: string\n percentage: number\n className?: string\n style?: React.CSSProperties\n children?: React.ReactNode\n}\n\nconst ProgressRing: FC<ProgressRingProps> = ({\n fillColor,\n size,\n percentage,\n children,\n bgColor = '#D9D9D9',\n className,\n style,\n}) => {\n return (\n <svg style={style} className={className} width={size} height={size} overflow=\"visible\">\n <g transform={`rotate(-90 ${`${size * 0.5} ${size * 0.5}`})`}>\n <Circle color={bgColor} size={size} />\n <Circle color={fillColor} percentage={Math.max(percentage, 0.1)} size={size} />\n </g>\n {children}\n </svg>\n )\n}\n\nexport default ProgressRing\n","import DOMPurify from 'dompurify'\n\nexport function sanitize(dirty?: string) {\n if (!dirty) {\n return { __html: '' }\n }\n return {\n __html: DOMPurify.sanitize(dirty, {\n ALLOWED_TAGS: [\n 'b',\n 'i',\n 'a',\n 'span',\n 'div',\n 'p',\n 'pre',\n 'u',\n 'br',\n 'img',\n 'code',\n 'li',\n 'ul',\n 'table',\n 'tbody',\n 'thead',\n 'tr',\n 'td',\n 'th',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'video',\n ],\n ALLOWED_ATTR: [\n 'style',\n 'class',\n 'target',\n 'id',\n 'href',\n 'alt',\n 'src',\n 'controls',\n 'autoplay',\n 'loop',\n 'muted',\n 'playsinline',\n ],\n }),\n }\n}\n\nexport function removeHTMLChars(encoded?: string | unknown) {\n if (!encoded) {\n return ''\n }\n\n if (typeof encoded !== 'string') {\n return encoded\n }\n\n return encoded.replace(/&#(\\d+);/g, function (_, dec) {\n return String.fromCharCode(dec)\n })\n}\n","import React from 'react'\n\nimport { Appearance } from '../../types'\nimport { getClassName, getCustomClassOverrides, ucFirst } from '../../shared/appearance'\nimport styled from 'styled-components'\nimport { sanitize } from '../../shared/sanitizer'\n\nconst HeaderTitle = styled.h1`\n ${(props) => getCustomClassOverrides(props)} {\n font-style: normal;\n font-weight: 700;\n font-size: ${(props) => (props.size == 'small' ? '15px' : '18px')};\n line-height: ${(props) => (props.size == 'small' ? '22px' : '24px')};\n letter-spacing: 0.36px;\n display: flex;\n align-items: center;\n margin-bottom: 4px;\n color: ${(props) => props.appearance.theme.colorText};\n }\n`\n\nconst HeaderSubtitle = styled.h2`\n ${(props) => getCustomClassOverrides(props)} {\n font-style: normal;\n font-weight: 400;\n font-size: 14px;\n line-height: 22px;\n letter-spacing: 0.28px;\n color: ${(props) => props.appearance.theme.colorTextSecondary};\n }\n`\n\nexport function TitleSubtitle({\n appearance,\n title,\n subtitle,\n size = 'medium',\n classPrefix = '',\n ariaPrefix = '',\n}: {\n appearance: Appearance\n title: string\n subtitle?: string\n size?: 'small' | 'medium' | 'large'\n classPrefix?: string\n ariaPrefix?: string\n}) {\n return (\n <>\n <HeaderTitle\n appearance={appearance}\n id={ariaPrefix ? `frigade${ariaPrefix}Title` : 'frigadeTitle'}\n className={getClassName(\n `${classPrefix}${classPrefix ? ucFirst(size) : size}Title`,\n appearance\n )}\n dangerouslySetInnerHTML={sanitize(title)}\n size={size}\n />\n {subtitle && (\n <HeaderSubtitle\n id={ariaPrefix ? `frigade${ariaPrefix}Subtitle` : 'frigadeSubtitle'}\n appearance={appearance}\n className={getClassName(\n `${classPrefix}${classPrefix ? ucFirst(size) : size}Subtitle`,\n appearance\n )}\n dangerouslySetInnerHTML={sanitize(subtitle)}\n size={size}\n />\n )}\n </>\n )\n}\n","import * as React from 'react'\n\nexport const Warning = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={12}\n height={12}\n aria-hidden=\"true\"\n viewBox=\"0 0 16 16\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n d=\"m10.115 1.308 5.635 11.269A2.365 2.365 0 0 1 13.634 16H2.365A2.365 2.365 0 0 1 .25 12.577L5.884 1.308a2.365 2.365 0 0 1 4.231 0zM8 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM8 9c.552 0 1-.32 1-.714V4.714C9 4.32 8.552 4 8 4s-1 .32-1 .714v3.572C7 8.68 7.448 9 8 9z\"\n />\n </svg>\n)\n","import styled from 'styled-components'\n\nexport const FormCTAContainer = styled.div`\n align-items: center;\n display: flex;\n justify-content: ${(props) => (props.showBackButton ? 'space-between' : 'flex-end')};\n padding-top: 14px;\n`\n\nexport const FormCTAError = styled.div`\n color: ${(props) => props.appearance.theme.colorTextError};\n font-size: 12px;\n`\n\nexport const CTAWrapper = styled.div`\n display: flex;\n gap: 12px;\n width: 100%;\n justify-content: flex-end;\n`\nexport const FormContainer = styled.div`\n display: flex;\n // If type is set to large-modal, use padding 60px horizontal, 80px vertical\n // Otherwise, use 4px padding\n flex-direction: column;\n flex-grow: 1;\n flex-basis: 0;\n position: relative;\n`\n\nexport const FormContainerWrapper = styled.div`\n padding: ${(props) => (props.type === 'large-modal' ? '50px' : '0px')};\n position: relative;\n overflow-y: auto;\n`\n\nexport const FormContainerSidebarImage = styled.div`\n display: flex;\n align-self: stretch;\n flex-grow: 1;\n flex-basis: 0;\n // If props.image is set, use it as the background image\n background-image: ${(props) => (props.image ? `url(${props.image})` : 'none')};\n // scale background image to fit\n background-size: contain;\n background-position: center;\n border-top-right-radius: ${(props) => props.appearance.theme.borderRadius}px;\n border-bottom-right-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\n","import React, { FC } from 'react'\nimport { FrigadeFormType } from './index'\nimport { Button } from '../components/Button'\nimport { getClassName } from '../shared/appearance'\nimport { Appearance, StepData } from '../types'\nimport { CTAWrapper, FormCTAContainer, FormCTAError } from './styled'\n\ninterface FormFooterProps {\n step: StepData\n canContinue: boolean\n appearance: Appearance\n onPrimaryClick: () => void\n onSecondaryClick: () => void\n onBack: () => void\n formType: FrigadeFormType\n steps: StepData[]\n selectedStep: number\n allowBackNavigation: boolean\n errorMessage?: string\n isSaving?: boolean\n}\n\nexport const FormFooter: FC<FormFooterProps> = ({\n step,\n canContinue,\n appearance,\n onPrimaryClick,\n onSecondaryClick,\n selectedStep,\n steps,\n onBack,\n allowBackNavigation,\n errorMessage,\n isSaving,\n}) => {\n const showBackButton = steps.length > 1 && selectedStep != 0 && allowBackNavigation\n const buttonType =\n (step.primaryButtonTitle && step.secondaryButtonTitle) || showBackButton\n ? 'inline'\n : 'full-width'\n\n return (\n <>\n {errorMessage !== null && errorMessage != undefined && (\n <FormCTAError appearance={appearance} className={getClassName('formCTAError', appearance)}>\n {errorMessage}\n </FormCTAError>\n )}\n <FormCTAContainer\n showBackButton={showBackButton}\n className={getClassName('formCTAContainer', appearance)}\n >\n {showBackButton && (\n <Button\n title={step.backButtonTitle ?? 'Back'}\n onClick={onBack}\n secondary={true}\n withMargin={false}\n type={buttonType}\n appearance={appearance}\n style={{ width: '90px', maxWidth: '90px' }}\n classPrefix=\"back\"\n />\n )}\n <CTAWrapper className={getClassName('ctaWrapper', appearance)}>\n {step.secondaryButtonTitle ? (\n <Button\n title={step.secondaryButtonTitle}\n onClick={onSecondaryClick}\n secondary={true}\n withMargin={false}\n type={buttonType}\n appearance={appearance}\n disabled={isSaving}\n />\n ) : null}{' '}\n {step.primaryButtonTitle ? (\n <Button\n disabled={!canContinue}\n withMargin={false}\n title={step.primaryButtonTitle}\n onClick={onPrimaryClick}\n type={buttonType}\n appearance={appearance}\n loading={isSaving}\n />\n ) : null}\n </CTAWrapper>\n </FormCTAContainer>\n </>\n )\n}\n","import React, { CSSProperties, FC } from 'react'\nimport styled from 'styled-components'\nimport { Appearance } from '../../types'\nimport {\n getClassName,\n getCustomClassOverrides,\n styleOverridesToCSS,\n ucFirst,\n} from '../../shared/appearance'\nimport { Spinner } from '../Spinner'\nimport { sanitize } from '../../shared/sanitizer'\n\ninterface ButtonProps {\n onClick?: () => void\n title?: string\n style?: CSSProperties\n textStyle?: CSSProperties\n disabled?: boolean\n type?: 'full-width' | 'inline'\n secondary?: boolean\n appearance?: Appearance\n withMargin?: boolean\n size?: 'small' | 'medium' | 'large'\n classPrefix?: string\n loading?: boolean\n autoFocus?: boolean\n}\n\nconst ButtonContainer = styled.button`\n justify-content: center;\n align-content: center;\n align-items: center;\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n // Anything inside this block will be ignored if the user provides a custom class\n width: ${(props) => (props.type === 'full-width' ? '100%' : 'auto')};\n // Only add margin if prop withMargin is true\n ${(props) => (props.withMargin ? 'margin: 16px 0px 16px 0px;' : '')}\n\n border: 1px solid ${(props) =>\n props.secondary ? '#C5CBD3' : props?.appearance?.theme?.colorPrimary};\n color: ${(props) =>\n props.secondary\n ? props.appearance?.theme?.colorText\n : props.appearance?.theme?.colorTextOnPrimaryBackground};\n background-color: ${(props) =>\n props.secondary\n ? props.appearance?.theme?.colorBackground\n : props?.appearance?.theme?.colorPrimary};\n border-radius: ${(props) => props.appearance?.theme?.borderRadius}px;\n padding: ${(props) => (props.size == 'small' ? '6px 14px 6px 14px' : '8px 20px 8px 20px')};\n font-size: ${(props) => (props.size == 'small' ? '14px' : '15px')};\n line-height: 20px;\n font-weight: 500;\n ${(props) => styleOverridesToCSS(props)}\n }\n\n font-family: inherit;\n\n cursor: pointer;\n :hover {\n opacity: ${(props) => (props.loading == 'true' ? '1.0' : '0.8')};\n }\n\n :disabled {\n opacity: ${(props) => (props.loading == 'true' ? '1.0' : '0.3')};\n cursor: not-allowed;\n }\n`\n\nexport const MultipleButtonContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n margin-top: 8px;\n\n & > * {\n margin-right: 8px;\n }\n }\n`\n\nexport const Button: FC<ButtonProps> = ({\n onClick,\n title,\n style,\n disabled,\n type = 'inline',\n size = 'medium',\n secondary = false,\n appearance,\n withMargin = true,\n classPrefix = '',\n loading = false,\n}) => {\n function getClassNameWithPrefix() {\n const name = secondary ? 'buttonSecondary' : 'button'\n if (classPrefix === '') {\n return name\n }\n\n return `${classPrefix}${ucFirst(name)}`\n }\n\n const commonProps = {\n tabindex: secondary ? '0' : '1',\n secondary,\n appearance,\n disabled: disabled || loading,\n loading: loading?.toString() ?? '',\n onClick,\n styleOverrides: style,\n type,\n withMargin,\n size,\n className: getClassName(getClassNameWithPrefix(), appearance),\n }\n\n if (!loading) {\n return (\n <ButtonContainer {...commonProps} dangerouslySetInnerHTML={sanitize(title ?? `Continue`)} />\n )\n }\n\n return (\n <ButtonContainer {...commonProps}>\n <Spinner className={getClassName('buttonLoader', appearance)} />\n </ButtonContainer>\n )\n}\n","import styled from 'styled-components'\n\nexport const Spinner = styled.div`\n width: 24px;\n height: 24px;\n border: 3px solid rgba(255, 255, 255, 0.25);\n border-bottom-color: #fff;\n border-radius: 50%;\n display: inline-block;\n box-sizing: border-box;\n animation: rotation 0.75s linear infinite;\n\n @keyframes rotation {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n`\n","import React, { FC } from 'react'\nimport styled from 'styled-components'\n\nimport { useTheme } from '../hooks/useTheme'\nimport { Appearance } from '../types'\n\nconst Wrapper = styled.div`\n text-align: center;\n color: #e6e6e6;\n`\n\ninterface FormPaginationProps {\n stepCount: number\n currentStep: number\n appearance: Appearance\n className?: string\n}\n\nexport const FormPagination: FC<FormPaginationProps> = ({\n stepCount = 0,\n currentStep = 0,\n className,\n appearance,\n}) => {\n const { theme } = useTheme().mergeAppearanceWithDefault(appearance)\n\n return (\n <Wrapper className={className}>\n <svg\n width={16 * stepCount - 8}\n height={8}\n viewBox={`0 0 ${16 * stepCount - 8} 8`}\n fill=\"none\"\n >\n {Array(stepCount)\n .fill(null)\n .map((_, idx) => (\n <rect\n key={idx}\n x={16 * idx}\n y={0}\n width={8}\n height={8}\n rx={4}\n fill={currentStep === idx ? theme.colorPrimary : 'currentColor'}\n />\n ))}\n </svg>\n </Wrapper>\n )\n}\n","import React from 'react'\nimport styled from 'styled-components'\nimport { CustomFormTypeProps } from '../../../FrigadeForm/types'\nimport { useCTAClickSideEffects } from '../../../hooks/useCTAClickSideEffects'\nimport { sanitize } from '../../../shared/sanitizer'\n\ninterface Link {\n title?: string\n uri?: string\n uriTarget?: string\n imageUri?: string\n}\n\n// create flex that wraps if not enoug space\nconst LinkContainer = styled.div`\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n`\n\nconst Link = styled.div`\n align-content: center;\n align-items: center;\n display: flex;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n margin: 15px;\n padding: 20px;\n flex-basis: 255px;\n flex-grow: 0;\n flex-shrink: 0;\n`\n\nconst LinkIcon = styled.img`\n width: 78px;\n height: auto;\n`\n\nconst LinkTitle = styled.button`\n font-style: normal;\n font-weight: 600;\n font-size: 13px;\n line-height: 16px;\n\n display: flex;\n align-items: center;\n text-align: center;\n border: 1px solid;\n border-radius: 100px;\n padding: 8px 12px;\n margin-top: 16px;\n`\n\nconst HeaderTitle = styled.h1`\n font-weight: 700;\n font-size: 28px;\n line-height: 34px;\n`\n\nconst HeaderSubtitle = styled.h2`\n font-style: normal;\n font-weight: 400;\n font-size: 16px;\n line-height: 24px;\n color: #7e7e7e;\n margin-top: 12px;\n margin-bottom: 16px;\n max-width: 70%;\n`\n\nexport function LinkCollectionStepType({ stepData, appearance }: CustomFormTypeProps) {\n const { handleUrl } = useCTAClickSideEffects()\n\n return (\n <div>\n <HeaderTitle dangerouslySetInnerHTML={sanitize(stepData.title)} />\n <HeaderSubtitle dangerouslySetInnerHTML={sanitize(stepData.subtitle)} />\n <LinkContainer>\n {stepData.props?.links?.map((link: Link) => (\n <Link key={link.title}>\n <LinkIcon src={link.imageUri} />\n <LinkTitle\n style={{\n borderColor: appearance.theme.colorPrimary,\n color: appearance.theme.colorPrimary,\n }}\n onClick={() => {\n if (link.uri) {\n handleUrl(link.uri, link.uriTarget ?? '_blank')\n }\n }}\n >\n {link.title}\n </LinkTitle>\n </Link>\n ))}\n </LinkContainer>\n </div>\n )\n}\n","import { StepData } from '../types'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { useContext } from 'react'\n\nexport function useCTAClickSideEffects() {\n const context = useContext(FrigadeContext)\n\n function primaryCTAClickSideEffects(step: StepData) {\n handleUrl(step.primaryButtonUri, step.primaryButtonUriTarget)\n }\n\n function secondaryCTAClickSideEffects(step: StepData) {\n handleUrl(step.secondaryButtonUri, step.secondaryButtonUriTarget)\n }\n\n function handleUrl(url?: string, target?: string) {\n if (!url) {\n return\n }\n // Check if url starts with http -- if so, default to _blank otherwise default to _self\n let updatedTarget = url.startsWith('http') ? '_blank' : '_self'\n\n if (target && target !== '_blank') {\n updatedTarget = '_self'\n }\n context.navigate(url, updatedTarget)\n }\n\n return {\n primaryCTAClickSideEffects,\n secondaryCTAClickSideEffects,\n handleUrl,\n }\n}\n","import React, { useEffect } from 'react'\nimport styled from 'styled-components'\nimport { CustomFormTypeProps, FormInputType } from '../../../FrigadeForm/types'\nimport { getClassName, getCustomClassOverrides } from '../../../shared/appearance'\nimport { TitleSubtitle } from '../../TitleSubtitle/TitleSubtitle'\nimport { VideoCard } from '../../Video/VideoCard'\n\ninterface CallToActionStepProps {\n data?: FormInputType[]\n}\n\n// create flex that wraps if not enoug space\nconst CallToActionStepContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n`\n\nconst CallToActionImage = styled.img`\n ${(props) => getCustomClassOverrides(props)} {\n width: 100%;\n height: auto;\n max-height: 250px;\n margin-bottom: 24px;\n }\n`\n\nconst CallToActionTextContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n margin-bottom: 24px;\n }\n`\n\nconst CallToActionVideo = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n width: 100%;\n height: auto;\n max-height: 250px;\n margin-bottom: 24px;\n }\n`\n\nexport function CallToActionStepType({\n stepData,\n appearance,\n setCanContinue,\n}: CustomFormTypeProps) {\n useEffect(() => {\n setCanContinue(true)\n }, [])\n\n return (\n <CallToActionStepContainer className={getClassName('callToActionContainer', appearance)}>\n <CallToActionTextContainer className={getClassName('callToActionTextContainer', appearance)}>\n <TitleSubtitle\n appearance={appearance}\n title={stepData.title}\n subtitle={stepData.subtitle}\n />\n </CallToActionTextContainer>\n {stepData.imageUri && (\n <CallToActionImage\n className={getClassName('callToActionImage', appearance)}\n src={stepData.imageUri}\n />\n )}\n {!stepData.imageUri && stepData.videoUri && (\n <CallToActionVideo\n appearance={appearance}\n className={getClassName('callToActionVideo', appearance)}\n >\n <VideoCard\n appearance={appearance}\n videoUri={stepData.videoUri}\n autoplay={stepData.props?.autoplayVideo}\n loop={stepData.props?.loopVideo}\n hideControls={stepData.props?.hideVideoControls}\n />\n </CallToActionVideo>\n )}\n </CallToActionStepContainer>\n )\n}\n","import React, { CSSProperties } from 'react'\n\nexport const Play = ({\n style,\n className,\n}: {\n color?: string\n style?: CSSProperties\n className?: string\n}) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={1.5}\n stroke=\"currentColor\"\n className={className}\n style={style}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" />\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n)\n","import { Play } from '../Icons/Play'\nimport { Appearance } from '../../types'\nimport React, { useRef, useState } from 'react'\nimport styled from 'styled-components'\nimport { getClassName } from '../../shared/appearance'\n\nconst VideoPlayerWrapper = styled.div`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n`\n\nconst PlayIconWrapper = styled.div`\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n cursor: pointer;\n :hover {\n opacity: 0.6;\n }\n z-index: 10;\n\n > svg {\n width: 40px;\n height: 40px;\n color: ${(props) => props.appearance.theme.colorBackground};\n box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);\n border-radius: 50%;\n }\n`\nconst Video = styled.video`\n width: 100%;\n height: 100%;\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\nconst YouTubeVideoSource = styled.iframe`\n width: 100%;\n height: 100%;\n min-height: 260px;\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\n\nconst VimeoVideoSource = styled.iframe`\n width: 100%;\n height: 100%;\n min-height: 400px;\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\nconst WistiaVideoSource = styled.iframe`\n width: 100%;\n height: 100%;\n min-height: 400px;\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\n\nexport function VideoCard({\n appearance,\n videoUri,\n autoplay = false,\n loop = false,\n hideControls = false,\n}: {\n appearance: Appearance\n videoUri: string\n autoplay?: boolean\n loop?: boolean\n hideControls?: boolean\n}) {\n // Create ref to use with videoplayer\n\n const ref = useRef<any>()\n\n const [isPlaying, setIsPlaying] = useState(autoplay)\n\n if (videoUri.includes('youtube')) {\n let videoId = videoUri.split('v=')[1]\n const ampersandPosition = videoId.indexOf('&')\n if (ampersandPosition !== -1) {\n videoId = videoId.substring(0, ampersandPosition)\n }\n return (\n <YouTubeVideoSource\n width=\"100%\"\n height=\"100%\"\n src={`https://www.youtube.com/embed/${videoId}`}\n frameBorder=\"0\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n appearance={appearance}\n className={getClassName('youtubePlayer', appearance)}\n />\n )\n }\n // Check if vimeo\n if (videoUri.includes('vimeo')) {\n let videoId = videoUri.split('vimeo.com/')[1]\n const ampersandPosition = videoId.indexOf('&')\n if (ampersandPosition !== -1) {\n videoId = videoId.substring(0, ampersandPosition)\n }\n return (\n <VimeoVideoSource\n width=\"100%\"\n height=\"100%\"\n src={`https://player.vimeo.com/video/${videoId}`}\n frameBorder=\"0\"\n allow=\"autoplay; fullscreen; picture-in-picture\"\n allowFullScreen\n appearance={appearance}\n className={getClassName('vimeoPlayer', appearance)}\n />\n )\n }\n // Check if wistia\n if (videoUri.includes('wistia')) {\n let videoId = videoUri.split('wistia.com/medias/')[1]\n const ampersandPosition = videoId.indexOf('&')\n if (ampersandPosition !== -1) {\n videoId = videoId.substring(0, ampersandPosition)\n }\n return (\n <WistiaVideoSource\n width=\"100%\"\n height=\"100%\"\n src={`https://fast.wistia.net/embed/iframe/${videoId}`}\n frameBorder=\"0\"\n allow=\"autoplay; fullscreen; picture-in-picture\"\n allowFullScreen\n appearance={appearance}\n className={getClassName('wistiaPlayer', appearance)}\n />\n )\n }\n\n return (\n <VideoPlayerWrapper\n className={getClassName('videoPlayerWrapper', appearance)}\n appearance={appearance}\n >\n {!isPlaying && (\n <PlayIconWrapper\n onClick={() => {\n setIsPlaying(true)\n ref.current.play()\n }}\n appearance={appearance}\n className={getClassName('playIconWrapper', appearance)}\n >\n <Play />\n </PlayIconWrapper>\n )}\n <Video\n appearance={appearance}\n controls={isPlaying && !hideControls}\n ref={ref}\n play={isPlaying}\n src={videoUri}\n autoPlay={autoplay}\n muted={autoplay}\n loop={loop}\n />\n </VideoPlayerWrapper>\n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { CheckBox } from '../../CheckBox'\nimport { getClassName } from '../../../shared/appearance'\nimport {\n ItemIcon,\n SelectItem,\n SelectItemLeft,\n SelectItemText,\n SelectListHeader,\n SelectListSelectionContainer,\n SelectListSubtitle,\n SelectListTitle,\n} from './styled'\nimport { CustomFormTypeProps, MultipleChoiceProps } from '../../../FrigadeForm/types'\n\nexport const SelectListStepType = ({\n stepData,\n setCanContinue,\n onSaveData,\n appearance,\n}: CustomFormTypeProps) => {\n const multipleChoiceProps = stepData.props as MultipleChoiceProps\n const [selectedIds, setSelectedIds] = useState<string[]>([])\n const [hasLoaded, setHasLoaded] = useState(false)\n const [lastStepId, setLastStepId] = useState(stepData.id)\n\n useEffect(() => {\n if (selectedIds.length == 0 && !hasLoaded) {\n setHasLoaded(true)\n onSaveData({ choice: [] })\n }\n }, [hasLoaded])\n\n useEffect(() => {\n if (lastStepId !== stepData.id) {\n setLastStepId(stepData.id)\n setSelectedIds([])\n }\n }, [stepData])\n\n useEffect(() => {\n onSaveData({ choice: selectedIds })\n if (selectedIds.length >= multipleChoiceProps.minChoices) {\n setCanContinue(true)\n } else {\n setCanContinue(false)\n }\n }, [selectedIds])\n\n return (\n <SelectListSelectionContainer className={getClassName('selectListContainer', appearance)}>\n <SelectListHeader>\n <SelectListTitle className={getClassName('selectListTitle', appearance)}>\n {stepData.title}\n </SelectListTitle>\n <SelectListSubtitle\n appearance={appearance}\n className={getClassName('selectListSubtitle', appearance)}\n >\n {stepData.subtitle}\n </SelectListSubtitle>\n </SelectListHeader>\n {multipleChoiceProps.options.map((option, idx) => {\n const isSelected = selectedIds.includes(option.id)\n return (\n <SelectItem\n key={`select-item-${idx}`}\n onClick={() => {\n // If the option is already selected, remove it from the selectedIds\n if (selectedIds.includes(option.id)) {\n setSelectedIds(selectedIds.filter((id) => id !== option.id))\n return\n }\n // Select the input if we are still under maxChoices\n if (selectedIds.length < multipleChoiceProps.maxChoices) {\n setSelectedIds([...selectedIds, option.id])\n } else {\n if (selectedIds.length == 1 && multipleChoiceProps.maxChoices == 1) {\n // deselect the input if we are at maxChoices and minChoices is 1\n setSelectedIds([option.id])\n }\n }\n }}\n hideBottomBorder={idx === multipleChoiceProps.options.length - 1}\n className={getClassName('selectListSelectItem', appearance)}\n >\n <SelectItemLeft className={getClassName('selectListItemImage', appearance)}>\n {option.imageUri && <ItemIcon src={option.imageUri} alt={`select-icon-${idx}`} />}\n <SelectItemText\n appearance={appearance}\n className={getClassName('selectListSelectItemText', appearance)}\n >\n {option.title}\n </SelectItemText>\n </SelectItemLeft>\n <CheckBox\n appearance={appearance}\n value={isSelected}\n primaryColor={appearance.theme.colorPrimary}\n />\n </SelectItem>\n )\n })}\n </SelectListSelectionContainer>\n )\n}\n","import styled from 'styled-components'\n\nexport const SelectListSelectionContainer = styled.div`\n width: auto;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 4px;\n`\n\nexport const SelectListHeader = styled.div`\n width: 100%;\n text-align: left;\n`\n\nexport const SelectListTitle = styled.h1<{ appearance }>`\n font-style: normal;\n font-weight: 700;\n font-size: 32px;\n line-height: 38px;\n color: ${(props) => props.appearance?.theme?.colorText};\n`\n\nexport const SelectListSubtitle = styled.h1<{ appearance }>`\n font-style: normal;\n font-weight: 400;\n font-size: 16px;\n line-height: 27px;\n margin-top: 16px;\n margin-bottom: 16px;\n color: ${(props) => props.appearance?.theme?.colorTextSecondary};\n`\n\nexport const SelectItem = styled.div<{ hideBottomBorder }>`\n padding-top: 12px;\n padding-bottom: 12px;\n flex-direction: row;\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n cursor: pointer;\n border-bottom: ${(props) => (props.hideBottomBorder ? 'none' : '1px solid #D8D8D8')};\n width: 100%;\n`\n\nexport const SelectItemLeft = styled.div`\n padding-top: 10px;\n padding-bottom: 10px;\n flex-direction: row;\n display: flex;\n justify-content: flex-start;\n`\n\nexport const ItemIcon = styled.img`\n width: 42px;\n height: 42px;\n margin-right: 12px;\n`\n\nexport const SelectItemText = styled.p`\n font-style: normal;\n font-weight: 500;\n font-size: 17px;\n line-height: 21px;\n color: ${(props) => props.appearance?.theme?.colorText};\n display: flex;\n align-self: center;\n`\n","import {\n FORM_DATA_KEY_PREFIX,\n MultiInputStepType,\n} from '../components/Forms/MultiInputStepType/MultiInputStepType'\nimport { Appearance, StepData } from '../types'\nimport { FormContainer, FormContainerSidebarImage, FormContainerWrapper } from './styled'\nimport { getClassName } from '../shared/appearance'\nimport { FormFooter } from './FormFooter'\nimport { FormPagination } from './FormPagination'\nimport { LinkCollectionStepType } from '../components/Forms/LinkCollectionStepType'\nimport { CallToActionStepType } from '../components/Forms/CallToActionStepType/CallToActionStepType'\nimport { SelectListStepType } from '../components/Forms/SelectListStepType/SelectListStepType'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { FrigadeFormProps, FrigadeFormType } from './index'\nimport React, { FC, useEffect, useState } from 'react'\nimport { CustomFormTypeProps, FormInputProps } from './types'\nimport { useFlows } from '../api/flows'\n\nconst AnimationWrapper = ({ children, id, shouldWrap = false }) => {\n return (\n <>\n {shouldWrap ? (\n <div\n key={id}\n style={{\n width: '100%',\n height: '100%',\n position: 'absolute',\n top: 0,\n left: 0,\n zIndex: 1,\n overflowY: 'auto',\n }}\n >\n {children}\n </div>\n ) : (\n children\n )}\n </>\n )\n}\n\ninterface FormContentProps extends FrigadeFormProps {\n appearance: Appearance\n steps: StepData[]\n selectedStep: number\n customStepTypes?: {\n [key: string]: ((params: CustomFormTypeProps) => React.ReactNode) | React.ReactNode\n }\n type: FrigadeFormType\n setShowModal: (showModal: boolean) => void\n setVisible?: (visible: boolean) => void\n showPagination?: boolean\n customFormElements?: { [key: string]: (params: FormInputProps) => React.ReactNode }\n allowBackNavigation: boolean\n}\nexport const FormContent: FC<FormContentProps> = ({\n appearance,\n steps,\n selectedStep,\n customStepTypes,\n customVariables,\n onButtonClick,\n onStepCompletion,\n flowId,\n type,\n hideOnFlowCompletion,\n onComplete,\n setVisible,\n setShowModal,\n onDismiss,\n showPagination = false,\n customFormElements,\n allowBackNavigation,\n validationHandler,\n onFormDataChange,\n showFooter,\n prefillData,\n updateUrlOnPageChange,\n repeatable,\n}) => {\n const DEFAULT_CUSTOM_STEP_TYPES = {\n linkCollection: LinkCollectionStepType,\n multiInput: MultiInputStepType,\n callToAction: CallToActionStepType,\n selectList: SelectListStepType,\n }\n\n const mergedCustomStepTypes = { ...DEFAULT_CUSTOM_STEP_TYPES, ...customStepTypes }\n const { primaryCTAClickSideEffects, secondaryCTAClickSideEffects } = useCTAClickSideEffects()\n\n const [canContinue, setCanContinue] = useState(false)\n const [formData, setFormData] = useState({})\n const [isSaving, setIsSaving] = useState(false)\n const [errorMessage, setErrorMessage] = useState<string | null | undefined>(null)\n\n const currentStep = steps[selectedStep] ?? null\n const {\n markStepCompleted,\n markStepStarted,\n isLoading,\n updateCustomVariables,\n markFlowCompleted,\n } = useFlows()\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n useEffect(() => {\n if (onFormDataChange) {\n onFormDataChange(formData, getDataPayload(), steps[selectedStep], selectedStep)\n }\n }, [formData])\n\n function getDataPayload() {\n const data = formData[steps[selectedStep].id] ?? {}\n return {\n data: data,\n stepId: steps[selectedStep].id,\n customVariables: customVariables,\n }\n }\n\n function handleStepCompletionHandlers(step: StepData, cta: 'primary' | 'secondary', idx: number) {\n const maybeNextStep = selectedStep + 1 < steps.length ? steps[selectedStep + 1] : null\n if (onStepCompletion) {\n onStepCompletion(step, idx, maybeNextStep, formData, getDataPayload())\n }\n if (onButtonClick) {\n return onButtonClick(step, selectedStep, cta, maybeNextStep)\n }\n return true\n }\n\n function updateData(step: StepData, data: object) {\n setFormData((prevState) => {\n let newObj = {}\n newObj[step.id] = data\n return {\n ...prevState,\n ...newObj,\n }\n })\n }\n\n function FormContainerSidebar(props: { selectedStep: StepData }) {\n if (props.selectedStep.imageUri) {\n return (\n <FormContainerSidebarImage\n image={props.selectedStep.imageUri}\n appearance={appearance}\n className={getClassName('formContainerSidebarImage', appearance)}\n />\n )\n }\n return null\n }\n\n const formFooter = showFooter && (\n <FormFooter\n step={steps[selectedStep]}\n canContinue={canContinue && !isSaving}\n formType={type}\n selectedStep={selectedStep}\n appearance={appearance}\n onPrimaryClick={async () => {\n setIsSaving(true)\n if (validationHandler) {\n const validationError = await validationHandler(\n steps[selectedStep],\n selectedStep,\n steps[selectedStep + 1],\n formData,\n getDataPayload()\n )\n if (validationError !== true) {\n // check if validation error is a string\n if (typeof validationError === 'string') {\n setErrorMessage(validationError)\n } else {\n setErrorMessage(null)\n }\n setIsSaving(false)\n return\n } else {\n setErrorMessage(null)\n }\n }\n const payload = { ...getDataPayload() }\n await markStepCompleted(flowId, steps[selectedStep].id, payload)\n if (\n selectedStep + 1 < steps.length &&\n // the url hash will control current step if allowBackNavigation is true\n !allowBackNavigation\n ) {\n await markStepStarted(flowId, steps[selectedStep + 1].id)\n }\n const shouldClose = handleStepCompletionHandlers(\n steps[selectedStep],\n 'primary',\n selectedStep\n )\n if (selectedStep + 1 >= steps.length) {\n if (onComplete) {\n onComplete()\n }\n if (onDismiss) {\n onDismiss()\n }\n if (hideOnFlowCompletion && shouldClose) {\n if (setVisible) {\n setVisible(false)\n }\n setShowModal(false)\n }\n await markFlowCompleted(flowId)\n if (repeatable) {\n // Set index back to 0\n await markStepStarted(flowId, steps[0].id)\n // Clear all cached form fill data\n if (typeof window !== 'undefined' && window.localStorage) {\n const localStorageKeys = Object.keys(window.localStorage)\n localStorageKeys.forEach((key) => {\n if (key.startsWith(FORM_DATA_KEY_PREFIX)) {\n window.localStorage.removeItem(key)\n }\n })\n }\n }\n }\n primaryCTAClickSideEffects(steps[selectedStep])\n setIsSaving(false)\n if (\n typeof window !== 'undefined' &&\n !allowBackNavigation &&\n updateUrlOnPageChange &&\n selectedStep + 1 < steps.length\n ) {\n // Update the current url with a query param p=stepId -- only use when allowbacknavigation is false\n const url = new URL(window.location.href)\n url.searchParams.set('p', steps[selectedStep + 1].id)\n window.history.pushState({}, '', url.toString())\n }\n }}\n onSecondaryClick={() => {\n handleStepCompletionHandlers(steps[selectedStep], 'secondary', selectedStep)\n secondaryCTAClickSideEffects(steps[selectedStep])\n }}\n onBack={async () => {\n if (selectedStep - 1 >= 0) {\n setIsSaving(true)\n await markStepStarted(flowId, steps[selectedStep - 1].id)\n setIsSaving(false)\n }\n }}\n steps={steps}\n allowBackNavigation={allowBackNavigation}\n errorMessage={errorMessage}\n isSaving={isSaving}\n />\n )\n\n return (\n <>\n <FormContainer className={getClassName('formContainer', appearance)}>\n <AnimationWrapper id={selectedStep} shouldWrap={type === 'large-modal'}>\n <FormContainerWrapper\n key={currentStep.id}\n type={type}\n className={getClassName('formContent', appearance)}\n >\n {steps.map((step) => {\n const StepComponent = mergedCustomStepTypes[step.type ?? 'multiInput']\n\n if (currentStep.id !== step.id) {\n return null\n }\n\n // Check if StepComponent is a function\n if (typeof StepComponent !== 'function') {\n return StepComponent\n }\n\n return (\n <StepComponent\n key={step.id}\n stepData={step}\n canContinue={canContinue}\n setCanContinue={setCanContinue}\n onSaveData={(data) => {\n updateData(step, data)\n }}\n appearance={appearance}\n customFormElements={customFormElements}\n flowId={flowId}\n prefillData={prefillData}\n />\n )\n })}\n {showPagination && (\n <FormPagination\n className={getClassName('formPagination', appearance)}\n appearance={appearance}\n stepCount={steps.length}\n currentStep={selectedStep}\n />\n )}\n {formFooter}\n </FormContainerWrapper>\n </AnimationWrapper>\n {type == 'large-modal' && <FormContainerSidebar selectedStep={steps[selectedStep]} />}\n </FormContainer>\n </>\n )\n}\n","import React from 'react'\nimport { Appearance } from '../types'\nimport { createGlobalStyle } from 'styled-components'\nimport { CUSTOM_CSS_STYLES_PREFIX, toKebabKey } from '../shared/appearance'\n\nconst GlobalStyleComponent = createGlobalStyle`\n${(props) =>\n props.inlineStyles\n .map(([key, value]) => {\n return `.${CUSTOM_CSS_STYLES_PREFIX}${key}.${CUSTOM_CSS_STYLES_PREFIX}${key} { ${Object.entries(\n value\n )\n .map(([key, value]) => {\n if (typeof value === 'object') {\n // This is a selector. Render it.\n return `${key} { ${Object.entries(value)\n .map(([nestedKey, nestedValue]) => {\n let kebabKey = toKebabKey(nestedKey)\n\n return `${kebabKey}: ${nestedValue};`\n })\n .join(' ')} }`\n }\n\n let kebabKey = toKebabKey(key)\n\n return `${kebabKey}: ${value};`\n })\n .join(' ')} }`\n })\n .join(' ')}`\n\nexport function RenderInlineStyles({ appearance }: { appearance?: Appearance }) {\n if (!appearance || !appearance.styleOverrides) {\n return <></>\n }\n const inlineStyles = Object.entries(appearance.styleOverrides).filter(([_, value]) => {\n return typeof value === 'object'\n })\n\n if (inlineStyles.length === 0) {\n return <></>\n }\n\n return <GlobalStyleComponent inlineStyles={inlineStyles} />\n}\n","import { useEffect, useState } from 'react'\nimport { NOT_STARTED_FLOW } from '../api/common'\nimport { useFlows } from '../api/flows'\n\nexport function useFlowImpressions(flowId: string, visible: boolean = true) {\n const [hasMarkedFlowStarted, setHasMarkedFlowStarted] = useState(false)\n const {\n markStepStarted,\n isLoading,\n getFlowStatus,\n getFlowSteps,\n getCurrentStepIndex,\n targetingLogicShouldHideFlow,\n getFlow,\n } = useFlows()\n const steps = getFlowSteps(flowId)\n\n async function markFlowStartedIfNeeded() {\n if (\n !hasMarkedFlowStarted &&\n !isLoading &&\n getFlowStatus(flowId) === NOT_STARTED_FLOW &&\n targetingLogicShouldHideFlow(getFlow(flowId)) === false &&\n visible &&\n steps &&\n steps.length > 0\n ) {\n setHasMarkedFlowStarted(true)\n await markStepStarted(flowId, steps[getCurrentStepIndex(flowId)].id)\n }\n }\n\n useEffect(() => {\n markFlowStartedIfNeeded()\n }, [isLoading, flowId, visible])\n\n return {}\n}\n","import React, { useCallback, useContext, useEffect } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { useCheckHasInitiatedAPI, useConfig, useGracefulFetch } from './common'\nimport { useUserFlowStates } from './user-flow-states'\nimport { GUEST_PREFIX } from './users'\nimport { EntityProperties } from '../FrigadeForm/types'\n\ninterface AddPropertyToOrganizationDTO {\n readonly foreignUserId: string\n readonly foreignUserGroupId: string\n readonly properties?: { [key: string]: string | boolean | number | null }\n readonly events?: OrganizationEvent[]\n}\n\ninterface OrganizationEvent {\n readonly event: string\n readonly properties?: { [key: string]: string | boolean | number | null }\n}\n\nexport function useOrganization(): {\n readonly organizationId: string | null\n readonly setOrganizationId: React.Dispatch<React.SetStateAction<string | null>>\n readonly setOrganizationIdWithProperties: (\n organizationId: string,\n properties?: EntityProperties\n ) => Promise<void>\n readonly addPropertiesToOrganization: (properties: EntityProperties) => Promise<void>\n readonly trackEventForOrganization: (\n event: string,\n properties?: EntityProperties\n ) => Promise<void>\n} {\n const {\n organizationId: organizationIdInternal,\n userId,\n setOrganizationId,\n } = useContext(FrigadeContext)\n const { mutateUserFlowState } = useUserFlowStates()\n const { config, apiUrl } = useConfig()\n const gracefullyFetch = useGracefulFetch()\n const { verifySDKInitiated } = useCheckHasInitiatedAPI()\n\n function getUserGroupKey(uId?: string, oId?: string) {\n return `frigade-user-group-registered-${uId}-${oId}`\n }\n\n useEffect(() => {\n // Check if user is not a guest\n\n if (userId && organizationIdInternal) {\n // Check if userid begins with the guest prefix\n if (userId.startsWith(GUEST_PREFIX)) {\n return\n }\n const userRegisteredKey = getUserGroupKey(userId, organizationIdInternal)\n // Check if user has already been registered in frigade\n if (!localStorage.getItem(userRegisteredKey)) {\n // Register user in frigade\n gracefullyFetch(`${apiUrl}userGroups`, {\n ...config,\n method: 'POST',\n body: JSON.stringify({\n foreignUserId: userId,\n foreignUserGroupId: organizationIdInternal,\n }),\n })\n // Mark user as registered in frigade\n localStorage.setItem(userRegisteredKey, 'true')\n }\n }\n }, [userId, organizationIdInternal])\n\n const addPropertiesToOrganization = useCallback(\n async (properties: EntityProperties) => {\n if (!verifySDKInitiated()) {\n return\n }\n if (!organizationIdInternal || !userId) {\n console.error(\n 'Cannot add properties to organization: Organization ID and User ID must both be set.',\n { organizationIdInternal, userId }\n )\n return\n }\n\n const data: AddPropertyToOrganizationDTO = {\n foreignUserId: userId,\n foreignUserGroupId: organizationIdInternal,\n properties,\n }\n await gracefullyFetch(`${apiUrl}userGroups`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n mutateUserFlowState()\n },\n [organizationIdInternal, userId, config, mutateUserFlowState]\n )\n\n const trackEventForOrganization = useCallback(\n async (event: string, properties?: EntityProperties) => {\n if (!verifySDKInitiated()) {\n return\n }\n if (!organizationIdInternal || !userId) {\n console.error(\n 'Cannot track event for organization: Organization ID and User ID must both be set.',\n { organizationIdInternal, userId }\n )\n return\n }\n const eventData: OrganizationEvent = {\n event,\n properties,\n }\n const data: AddPropertyToOrganizationDTO = {\n foreignUserId: userId,\n foreignUserGroupId: organizationIdInternal,\n events: [eventData],\n }\n await gracefullyFetch(`${apiUrl}userGroups`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n mutateUserFlowState()\n },\n [organizationIdInternal, userId, config, mutateUserFlowState]\n )\n\n const setOrganizationIdWithProperties = useCallback(\n async (organizationId: string, properties?: EntityProperties) => {\n if (!verifySDKInitiated()) {\n return\n }\n if (properties) {\n const userRegisteredKey = getUserGroupKey(userId, organizationId)\n localStorage.setItem(userRegisteredKey, 'true')\n setOrganizationId(organizationId)\n const data: AddPropertyToOrganizationDTO = {\n foreignUserId: userId,\n foreignUserGroupId: organizationId,\n properties,\n }\n await gracefullyFetch(`${apiUrl}userGroups`, {\n ...config,\n method: 'POST',\n body: JSON.stringify(data),\n })\n mutateUserFlowState()\n } else {\n setOrganizationId(organizationId)\n }\n },\n [userId, config, mutateUserFlowState]\n )\n\n return {\n organizationId: organizationIdInternal,\n setOrganizationId,\n setOrganizationIdWithProperties,\n addPropertiesToOrganization,\n trackEventForOrganization,\n }\n}\n","import { deepmerge } from './deepmerge'\n\nconst THEME_MAP = {\n // { oldThemeKey: 'path.to.new.theme.token' }\n colorPrimary: 'colors.primary.background',\n colorText: 'colors.neutral.foreground',\n colorBackground: 'colors.neutral.background',\n colorBackgroundSecondary: 'colors.secondary.background',\n colorTextOnPrimaryBackground: 'colors.primary.foreground',\n colorTextSecondary: 'colors.secondary.foreground',\n colorTextDisabled: 'colors.gray700',\n colorBorder: 'colors.gray800',\n colorTextError: 'colors.negative.foreground',\n borderRadius: 'radii.lg',\n}\n\n// Convert appearance.theme prop (old) to theme tokens for overrides prop (new)\nfunction themeToTokens(theme) {\n if (!theme) return undefined\n\n const overrides = {}\n\n Object.entries(theme).forEach(([key, value]) => {\n if (THEME_MAP[key]) {\n // Step 1: 'foo.bar.baz' -> ['foo', 'bar', 'baz']\n const levels = THEME_MAP[key].split('.')\n\n // Step 2: ['foo', 'bar', 'baz'] -> { foo: { bar: { baz: value } } }\n let currentLevel = overrides\n levels.forEach((nextLevel, i) => {\n if (!currentLevel[nextLevel]) {\n currentLevel[nextLevel] = i === levels.length - 1 ? value : {}\n }\n\n currentLevel = currentLevel[nextLevel]\n })\n }\n })\n\n return overrides\n}\n\nfunction styleOverridesToCSS(styleOverrides) {\n // Walk overrides and convert them to CSS descendent selectors\n // ...that's pretty much it?\n if (!styleOverrides) return undefined\n\n // We don't want to reference the original object\n const copiedOverrides = deepmerge({}, styleOverrides)\n\n const css = {}\n\n Object.keys(copiedOverrides).forEach((oldSelector) => {\n const newSelector = `.fr-${oldSelector}`\n\n css[newSelector] = copiedOverrides[oldSelector]\n })\n\n return css\n}\n\nexport function appearanceToOverrides(appearance) {\n const { theme, styleOverrides } = appearance\n\n const overrides = themeToTokens(theme)\n const css = styleOverridesToCSS(styleOverrides)\n\n return {\n overrides,\n css,\n }\n}\n","import styled from 'styled-components'\nimport { compose, variant } from 'styled-system'\n\nimport { Box } from '../Box'\n\nexport const buttonVariants = {\n Primary: {\n backgroundColor: 'primary.background',\n color: 'primary.foreground',\n\n '&:hover': {\n backgroundColor: 'blue400',\n },\n },\n Secondary: {\n backgroundColor: 'white',\n border: '1px solid',\n borderColor: 'gray800',\n color: 'neutral.foreground',\n\n '&:hover': {\n backgroundColor: 'blue900',\n },\n },\n Link: {\n backgroundColor: 'transparent',\n color: 'primary.inverted',\n },\n Plain: {\n backgroundColor: 'transparent',\n color: 'neutral.foreground',\n },\n} as const\n\nexport const buttonSizes = {\n sm: {\n paddingX: 4,\n paddingY: 1,\n },\n md: {\n paddingX: 6,\n paddingY: 2,\n },\n}\n\nexport const StyledButton = styled(Box)(\n () => ({\n whiteSpace: 'nowrap',\n }),\n compose(\n variant({\n scale: 'components.Button',\n variants: 'components.Button',\n }),\n variant({\n prop: 'size',\n variants: buttonSizes,\n })\n )\n)\n\n// export type ButtonVariant = keyof typeof buttonVariants\n// export type ButtonSize = keyof typeof buttonSizes\n","import React, { ComponentPropsWithoutRef, CSSProperties, ElementType, ReactNode } from 'react'\nimport styled, { ThemeProvider, useTheme } from 'styled-components'\nimport {\n border,\n BorderProps,\n color,\n ColorProps,\n compose,\n get,\n LayoutProps,\n shadow,\n ShadowProps,\n space,\n SpaceProps,\n system,\n typography,\n TypographyProps,\n} from 'styled-system'\nimport { deepmerge } from '../../shared/deepmerge'\n\ninterface Overrides extends Record<string, Overrides | CSSProperties> {}\n\n// Drop the size property from layout props, it conflicts with our own size prop\n// SEE: https://github.com/styled-system/styled-system/blob/master/packages/layout/src/index.js\nconst layoutWithoutSize = {\n width: {\n property: 'width',\n scale: 'sizes',\n transform: (n, scale) =>\n get(scale, n, !(typeof n === 'number' && !isNaN(n)) || n > 1 ? n : n * 100 + '%'),\n },\n height: {\n property: 'height',\n scale: 'sizes',\n },\n minWidth: {\n property: 'minWidth',\n scale: 'sizes',\n },\n minHeight: {\n property: 'minHeight',\n scale: 'sizes',\n },\n maxWidth: {\n property: 'maxWidth',\n scale: 'sizes',\n },\n maxHeight: {\n property: 'maxHeight',\n scale: 'sizes',\n },\n overflow: true,\n overflowX: true,\n overflowY: true,\n display: true,\n verticalAlign: true,\n}\n\nexport type BoxProps<T extends ElementType = 'div'> = {\n as?: T\n css?: Record<string, any> // TODO: Fix any\n children?: ReactNode\n overrides?: Overrides\n} & BorderProps &\n ColorProps &\n Exclude<LayoutProps, 'size'> &\n ShadowProps &\n SpaceProps &\n TypographyProps &\n ComponentPropsWithoutRef<T>\n\nconst StyledBox = styled('div')(\n ({ css }) => css,\n compose(border, color, shadow, space, typography, system(layoutWithoutSize))\n)\n\nexport const Box = <T extends React.ElementType = 'div'>({\n as,\n children,\n overrides,\n ...rest\n}: BoxProps<T>) => {\n const theme = useTheme()\n\n const styleResetProps = {\n border: 'none',\n boxSizing: 'border-box',\n m: 0,\n p: 0,\n }\n\n const renderBox = () => (\n <StyledBox as={as} {...styleResetProps} {...rest}>\n {children}\n </StyledBox>\n )\n\n if (overrides !== undefined) {\n const newTheme = deepmerge(theme, overrides)\n\n return <ThemeProvider theme={newTheme}>{renderBox()}</ThemeProvider>\n }\n\n return renderBox()\n}\n","import styled from 'styled-components'\nimport { variant, system } from 'styled-system'\n\nimport { Box } from '../Box'\n\nexport const textVariants = {\n Display1: {\n fontSize: '5xl',\n fontWeight: 'bold',\n letterSpacing: 'md',\n lineHeight: '4xl',\n },\n Display2: {\n fontSize: '4xl',\n fontWeight: 'bold',\n letterSpacing: 'md',\n lineHeight: '3xl',\n },\n H1: {\n fontSize: '3xl',\n fontWeight: 'bold',\n letterSpacing: 'md',\n lineHeight: '2xl',\n },\n H2: {\n fontSize: '2xl',\n fontWeight: 'bold',\n letterSpacing: 'md',\n lineHeight: 'xl',\n },\n H3: {\n fontSize: 'xl',\n fontWeight: 'bold',\n letterSpacing: 'md',\n lineHeight: 'lg',\n },\n H4: {\n fontSize: 'lg',\n fontWeight: 'bold',\n letterSpacing: 'md',\n lineHeight: 'md',\n },\n Body1: {\n fontSize: 'md',\n fontWeight: 'regular',\n letterSpacing: 'md',\n lineHeight: 'md',\n },\n Body2: {\n fontSize: 'sm',\n fontWeight: 'regular',\n letterSpacing: 'md',\n lineHeight: 'md',\n },\n Caption: {\n fontSize: 'xs',\n fontWeight: 'regular',\n letterSpacing: 'md',\n lineHeight: 'sm',\n },\n} as const\n\nexport const fontWeights = {\n regular: 400,\n semibold: 600,\n bold: 700,\n}\n\nexport const StyledText = styled(Box)(\n variant({\n scale: 'components.Text',\n variants: 'components.Text',\n }),\n system({\n fontWeight: {\n property: 'fontWeight',\n scale: 'fontWeights',\n },\n })\n)\n","import { buttonVariants } from '../components/Button/Button.styles'\nimport { textVariants } from '../components/Text/Text.styles'\n\nconst SPACE_VALUE = 4\nconst SPACE_UNIT = 'px'\nconst SPACE_SCALE_EXTENT = 20\n\n// Fill an array with SPACE_SCALE_EXTENT multiples of SPACE_VALUE\nconst spaceScale = Object.fromEntries(\n Array.from(Array(SPACE_SCALE_EXTENT + 1), (_, i) => {\n // Just a cute lil' 0.5 space would you look at this tiny guy over here\n if (i === 0) {\n return [0.5, `${0.5 * SPACE_VALUE}${SPACE_UNIT}`]\n }\n\n return [i, `${i * SPACE_VALUE}${SPACE_UNIT}`]\n })\n)\n\nconst palette = {\n black: '#000000',\n gray100: '#14161A',\n gray200: '#181B20',\n gray300: '#1F2329',\n gray400: '#2E343D',\n gray500: '#4C5766',\n gray600: '#5A6472',\n gray700: '#C5CBD3',\n gray800: '#E2E5E9',\n gray900: '#F1F2F4',\n white: '#ffffff',\n blue400: '#015AC6',\n blue500: '#0171F8',\n blue800: '#DBECFF',\n blue900: '#F5F9FF',\n green400: '#009E37',\n green500: '#00D149',\n green800: '#DBFFE8',\n transparent: '#FFFFFF00',\n\n // This color isn't in the Design System yet, but it's used in old components\n red500: '#c00000',\n}\n\nexport const tokens = {\n colors: {\n ...palette,\n\n neutral: {\n foreground: palette.gray300,\n },\n primary: {\n background: palette.blue500,\n foreground: palette.white,\n inverted: palette.blue500,\n },\n negative: {\n foreground: palette.red500,\n },\n },\n fonts: {\n default: 'TT Interphases Pro, sans-serif',\n },\n fontSizes: {\n xs: '12px',\n sm: '14px',\n md: '16px',\n lg: '18px',\n xl: '20px',\n '2xl': '24px',\n '3xl': '30px',\n '4xl': '36px',\n '5xl': '48px',\n },\n fontWeights: {\n regular: 400,\n semibold: 500,\n bold: 700,\n },\n letterSpacings: {\n md: '0.02em',\n },\n lineHeights: {\n xs: '18px',\n sm: '22px',\n md: '24px',\n lg: '26px',\n xl: '30px',\n '2xl': '38px',\n '3xl': '46px',\n '4xl': '60px',\n },\n radii: {\n md: '8px',\n lg: '20px',\n round: '50%',\n },\n shadows: {\n md: '0px 4px 20px rgba(0, 0, 0, 0.06)',\n },\n space: spaceScale,\n components: {\n Button: buttonVariants,\n Text: textVariants,\n },\n}\n","import React, { CSSProperties } from 'react'\nimport { FrigadeChecklist } from '../../FrigadeChecklist'\nimport { HeroChecklistProps } from '../Checklists/HeroChecklist'\nimport { StepData } from '../../types'\n\nexport interface FrigadeHeroChecklistProps extends HeroChecklistProps {\n flowId: string\n title?: string\n subtitle?: string\n primaryColor?: string\n\n onCompleteStep?: (index: number, stepData: StepData) => void\n style?: CSSProperties\n // Optional props\n initialSelectedStep?: number\n\n className?: string\n}\n\nexport const FrigadeHeroChecklist: React.FC<FrigadeHeroChecklistProps> = (props) => {\n return <FrigadeChecklist type=\"inline\" {...props} />\n}\n","import React, { CSSProperties, useEffect, useState } from 'react'\n\nimport { useFlows } from '../api/flows'\nimport { HeroChecklist, HeroChecklistProps } from '../components/Checklists/HeroChecklist'\nimport { StepData } from '../types'\nimport { COMPLETED_FLOW, COMPLETED_STEP } from '../api/common'\nimport { useFlowOpens } from '../api/flow-opens'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\n\nimport { ChecklistWithGuide } from '../components/Checklists/ChecklistWithGuide'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { useTheme } from '../hooks/useTheme'\nimport { CondensedChecklist } from '../components/Checklists/CondensedChecklist'\nimport { Modal } from '../components/Modal'\nimport { CarouselChecklist } from '../components/Checklists/CarouselChecklist'\nimport { useFlowImpressions } from '../hooks/useFlowImpressions'\n\nexport interface FrigadeChecklistProps extends HeroChecklistProps {\n flowId: string\n title?: string\n subtitle?: string\n\n style?: CSSProperties\n // Optional props\n /** @ignore */\n initialSelectedStep?: number\n\n className?: string\n type?: 'inline' | 'modal'\n checklistStyle?: 'with-guide' | 'default' | 'condensed' | 'carousel'\n\n visible?: boolean\n setVisible?: (visible: boolean) => void\n\n onDismiss?: () => void\n\n /**\n * See https://docs.frigade.com/flows/dynamic-variables\n */\n customVariables?: { [key: string]: string | number | boolean }\n\n /** @ignore */\n guideFlowId?: string\n /** @ignore */\n guideTitle?: string\n\n autoExpandFirstIncompleteStep?: boolean\n autoExpandNextStep?: boolean\n}\n\nexport const FrigadeChecklist: React.FC<FrigadeChecklistProps> = ({\n flowId,\n title,\n subtitle,\n style,\n initialSelectedStep,\n className,\n type = 'inline',\n onDismiss,\n visible,\n customVariables,\n onStepCompletion,\n onButtonClick,\n appearance,\n hideOnFlowCompletion,\n setVisible,\n customStepTypes,\n checklistStyle = 'default',\n autoExpandFirstIncompleteStep,\n autoExpandNextStep,\n onComplete,\n ...guideProps\n}) => {\n const {\n getFlow,\n getFlowSteps,\n markStepCompleted,\n getStepStatus,\n getNumberOfStepsCompleted,\n isLoading,\n targetingLogicShouldHideFlow,\n updateCustomVariables,\n getFlowMetadata,\n isStepBlocked,\n getFlowStatus,\n hasActiveFullPageFlow,\n setHasActiveFullPageFlow,\n markStepStarted,\n getCurrentStepIndex,\n } = useFlows()\n const { primaryCTAClickSideEffects, secondaryCTAClickSideEffects } = useCTAClickSideEffects()\n const { getOpenFlowState, setOpenFlowState } = useFlowOpens()\n const [selectedStep, setSelectedStep] = useState(initialSelectedStep || 0)\n const [finishedInitialLoad, setFinishedInitialLoad] = useState(false)\n const showModal = visible === undefined ? getOpenFlowState(flowId) : visible\n const isModal = type === 'modal'\n const { mergeAppearanceWithDefault } = useTheme()\n const [initialCompleteState, setInitialCompleteState] = useState<string>(COMPLETED_FLOW)\n const flowStatus = getFlowStatus(flowId)\n\n useFlowImpressions(flowId, visible)\n\n const steps = getFlowSteps(flowId)\n const index = getCurrentStepIndex(flowId)\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n useEffect(() => {\n if (flowStatus && flowStatus !== initialCompleteState && flowStatus !== COMPLETED_FLOW) {\n setInitialCompleteState(flowStatus)\n }\n if (flowStatus && flowStatus === COMPLETED_FLOW && initialCompleteState !== COMPLETED_FLOW) {\n if (onComplete) {\n setInitialCompleteState(flowStatus)\n onComplete()\n }\n }\n }, [flowStatus])\n\n useEffect(() => {\n if (visible !== undefined) {\n if (isModal && visible === true) {\n setHasActiveFullPageFlow(true)\n } else if (isModal && visible === false) {\n setHasActiveFullPageFlow(false)\n }\n }\n }, [visible, setVisible, hasActiveFullPageFlow])\n\n useEffect(() => {\n if (selectedStep === index) {\n return\n }\n setSelectedStep(index)\n }, [index])\n\n if (isLoading) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (!steps || !steps.length) {\n return null\n }\n\n if (hideOnFlowCompletion === true && getFlowStatus(flowId) === COMPLETED_FLOW) {\n return null\n }\n\n const metaData = getFlowMetadata(flowId)\n if (metaData?.title) {\n title = metaData.title\n }\n if (metaData?.subtitle) {\n subtitle = metaData.subtitle\n }\n\n if (\n !finishedInitialLoad &&\n initialSelectedStep === undefined &&\n getNumberOfStepsCompleted(flowId) > 0\n ) {\n const firstIncompleteStep = steps.findIndex((step) => step.complete === false)\n setSelectedStep(firstIncompleteStep > -1 ? firstIncompleteStep : steps.length - 1)\n setFinishedInitialLoad(true)\n }\n\n function goToNextStepIfPossible() {\n if (selectedStep + 1 >= steps.length) {\n // If modal, close it\n if (isModal) {\n setOpenFlowState(flowId, false)\n }\n return\n }\n // Double check next step is not blocked\n if (isStepBlocked(flowId, steps[selectedStep + 1].id)) {\n return\n }\n\n setSelectedStep(selectedStep + 1)\n }\n\n function handleStepCompletionHandlers(\n step: StepData,\n cta: 'primary' | 'secondary' | 'link',\n idx: number\n ) {\n const maybeNextStep = selectedStep + 1 < steps.length ? steps[selectedStep + 1] : null\n if (onButtonClick) {\n const completion = onButtonClick(step, selectedStep, cta, maybeNextStep)\n if (completion === true && isModal) {\n handleClose()\n }\n }\n if (onStepCompletion) {\n onStepCompletion(step, idx, maybeNextStep)\n }\n if (!onStepCompletion && !onButtonClick && (step.primaryButtonUri || step.secondaryButtonUri)) {\n if (isModal) {\n handleClose()\n }\n }\n }\n\n function getSteps() {\n return steps.map((step: StepData, idx: number) => {\n return {\n ...step,\n handleSecondaryButtonClick: () => {\n // Default to skip behavior for secondary click but allow for override\n goToNextStepIfPossible()\n secondaryCTAClickSideEffects(step)\n if (step.skippable === true) {\n markStepCompleted(flowId, step.id, { skipped: true })\n }\n handleStepCompletionHandlers(step, 'secondary', idx)\n },\n handlePrimaryButtonClick: () => {\n if (\n (!step.completionCriteria &&\n (step.autoMarkCompleted || step.autoMarkCompleted === undefined)) ||\n (step.completionCriteria && step.autoMarkCompleted === true)\n ) {\n markStepCompleted(flowId, step.id)\n goToNextStepIfPossible()\n }\n handleStepCompletionHandlers(step, 'primary', idx)\n primaryCTAClickSideEffects(step)\n // If step is done, try to go to next step\n if (getStepStatus(flowId, step.id) === COMPLETED_STEP) {\n goToNextStepIfPossible()\n }\n },\n }\n })\n }\n\n function CommonDom() {\n return <RenderInlineStyles appearance={appearance} />\n }\n\n const commonProps = {\n steps: getSteps(),\n title,\n subtitle,\n primaryColor: appearance.theme.colorPrimary,\n appearance,\n customStepTypes,\n type,\n className,\n autoExpandFirstIncompleteStep,\n autoExpandNextStep,\n }\n\n function handleClose() {\n setOpenFlowState(flowId, false)\n if (onDismiss) {\n onDismiss()\n }\n if (setVisible) {\n setVisible(false)\n }\n }\n\n function getCarouselChecklist() {\n return (\n <>\n <CommonDom />\n <CarouselChecklist\n flowId={flowId}\n appearance={appearance}\n customVariables={customVariables}\n className={className}\n />\n </>\n )\n }\n\n function getCondensedChecklist() {\n return (\n <>\n <CommonDom />\n <CondensedChecklist\n visible={showModal}\n onClose={() => {\n handleClose()\n }}\n selectedStep={selectedStep}\n setSelectedStep={setSelectedStep}\n autoExpandNextStep={true}\n appearance={appearance}\n onButtonClick={onButtonClick}\n {...commonProps}\n />\n </>\n )\n }\n\n function getChecklistWithGuide() {\n const guideFlowId = guideProps.guideFlowId\n let guideFlowSteps\n if (guideFlowId) {\n const guideFlow = getFlow(guideFlowId)\n if (guideFlow) {\n guideFlowSteps = getFlowSteps(guideFlowId)\n }\n }\n\n return (\n <>\n <CommonDom />\n <ChecklistWithGuide\n visible={showModal}\n stepsTitle={metaData.stepsTitle ? metaData.stepsTitle : 'Your quick start guide'}\n onClose={() => {\n handleClose()\n }}\n selectedStep={selectedStep}\n setSelectedStep={setSelectedStep}\n guideData={guideFlowSteps}\n guideTitle={guideProps.guideTitle ?? 'Guide'}\n appearance={appearance}\n title={title}\n subtitle={subtitle}\n onGuideButtonClick={(step) => {\n handleStepCompletionHandlers(step, 'link', 0)\n }}\n customStepTypes={customStepTypes}\n {...commonProps}\n />\n </>\n )\n }\n\n function getDefaultChecklist() {\n const checklist = (\n <HeroChecklist\n flowId={flowId}\n style={style}\n selectedStep={selectedStep}\n setSelectedStep={setSelectedStep}\n appearance={appearance}\n type={type}\n {...commonProps}\n />\n )\n\n if (!isModal) {\n return (\n <>\n <CommonDom />\n {checklist}\n </>\n )\n }\n\n return (\n <Modal\n onClose={() => {\n handleClose()\n }}\n visible={showModal}\n appearance={appearance}\n style={{\n paddingTop: '0px',\n padding: '12px',\n paddingLeft: 0,\n }}\n >\n <CommonDom />\n {checklist}\n </Modal>\n )\n }\n\n switch (checklistStyle) {\n case 'condensed':\n return getCondensedChecklist()\n case 'with-guide':\n return getChecklistWithGuide()\n case 'default':\n return getDefaultChecklist()\n case 'carousel':\n return getCarouselChecklist()\n default:\n return getDefaultChecklist()\n }\n}\n","import React, { FC, useMemo, useState } from 'react'\n\nimport styled from 'styled-components'\nimport { StepChecklistItem } from './StepChecklistItem'\nimport { ProgressBar } from '../Checklist/ProgressBar'\nimport { Appearance, DefaultFrigadeFlowProps, StepData } from '../../../types'\nimport {\n HERO_STEP_CONTENT_TYPE,\n HeroStepContent,\n} from '../../checklist-step-content/HeroStepContent'\nimport { VIDEO_CAROUSEL_TYPE, VideoCarousel } from '../../checklist-step-content/VideoCarousel'\nimport {\n CODE_SNIPPET_CONTENT_TYPE,\n CodeSnippetContent,\n} from '../../checklist-step-content/CodeSnippetContent'\nimport { useTheme } from '../../../hooks/useTheme'\nimport { FrigadeChecklistProps } from '../../../FrigadeChecklist'\nimport { getClassName, styleOverridesToCSS } from '../../../shared/appearance'\nimport { sanitize } from '../../../shared/sanitizer'\n\nexport interface HeroChecklistProps extends Omit<DefaultFrigadeFlowProps, 'flowId'> {\n title?: string\n subtitle?: string\n /**\n * @deprecated Use `appearance` instead\n * @ignore\n */\n primaryColor?: string\n /** @ignore */\n steps?: StepData[]\n\n /** @ignore */\n selectedStep?: number\n /** @ignore */\n setSelectedStep?: (index: number) => void\n\n /**\n * Map of custom step types that the checklist supports. To use a custom steps in your checklist, see [Component Customization](/component/customization#customizing-frigade-components)\n */\n customStepTypes?: Record<\n string,\n ((stepData: StepData, appearance: Appearance) => React.ReactNode) | React.ReactNode\n >\n}\n\nconst HeroChecklistContainer = styled.div<{ appearance }>`\n display: flex;\n flex-direction: row;\n overflow: hidden;\n min-width: ${(props) => (props.type != 'modal' ? '600px' : '100%')};\n background: ${(props) => props.appearance?.theme.colorBackground};\n border-radius: ${(props) => props.appearance?.theme.borderRadius}px;\n ${(props) => styleOverridesToCSS(props)}\n`\n\nconst HeroChecklistTitle = styled.h1<{ appearance }>`\n font-size: 18px;\n font-style: normal;\n font-weight: 700;\n line-height: 24px;\n letter-spacing: 0.36px;\n color: ${(props) => props.appearance?.theme?.colorText};\n`\n\nconst HeroChecklistSubtitle = styled.h2`\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 22px;\n letter-spacing: 0.28px;\n color: ${(props) => props.appearance?.theme?.colorTextSecondary};\n margin: 10px 0px 0px 0px;\n`\n\nconst ChecklistHeader = styled.div`\n padding: 28px 0px 28px 28px;\n border-bottom: 1px solid ${(props) => props.appearance?.theme?.colorBorder};\n`\n\nconst ChecklistHeaderContainer = styled.div`\n flex: 1;\n`\n\nconst ChecklistStepsContainer = styled.div`\n list-style: none;\n padding: 0;\n margin: 0;\n cursor: pointer;\n min-width: 300px;\n`\n\nconst Divider = styled.div`\n width: 1px;\n margin-right: 40px;\n background: ${(props) => props.appearance?.theme?.colorBorder};\n`\n\nconst HeroChecklistStepContentContainer = styled.div`\n flex: 2;\n padding: 40px 40px 40px 0px;\n`\n\nconst HeroChecklist: FC<FrigadeChecklistProps> = ({\n title,\n subtitle,\n steps = [],\n style = {},\n selectedStep,\n setSelectedStep,\n className = '',\n customStepTypes = new Map(),\n appearance,\n type,\n}) => {\n const { mergeAppearanceWithDefault } = useTheme()\n appearance = mergeAppearanceWithDefault(appearance)\n\n const DEFAULT_CUSTOM_STEP_TYPES = {\n [HERO_STEP_CONTENT_TYPE]: HeroStepContent,\n [VIDEO_CAROUSEL_TYPE]: VideoCarousel,\n [CODE_SNIPPET_CONTENT_TYPE]: CodeSnippetContent,\n }\n\n const mergedCustomStepTypes = {\n ...DEFAULT_CUSTOM_STEP_TYPES,\n ...customStepTypes,\n }\n\n const [selectedStepInternal, setSelectedStepInternal] = useState(0)\n\n const selectedStepValue = selectedStep ?? selectedStepInternal\n const setSelectedStepValue = setSelectedStep ?? setSelectedStepInternal\n\n const completeCount = steps.filter((s) => s.complete === true).length\n\n const StepContent = useMemo(() => {\n if (!steps[selectedStepValue]?.type || !mergedCustomStepTypes[steps[selectedStepValue].type]) {\n return mergedCustomStepTypes[HERO_STEP_CONTENT_TYPE]\n }\n return mergedCustomStepTypes[steps[selectedStepValue].type]\n }, [selectedStepValue])\n\n return (\n <HeroChecklistContainer\n type={type}\n styleOverrides={style}\n className={className}\n appearance={appearance}\n >\n <ChecklistHeaderContainer\n className={getClassName('checklistHeaderContainer', appearance)}\n appearance={appearance}\n >\n <ChecklistHeader\n className={getClassName('checklistHeader', appearance)}\n appearance={appearance}\n >\n <HeroChecklistTitle\n className={getClassName('checklistTitle', appearance)}\n appearance={appearance}\n dangerouslySetInnerHTML={sanitize(title)}\n />\n <HeroChecklistSubtitle\n className={getClassName('checklistSubtitle', appearance)}\n appearance={appearance}\n dangerouslySetInnerHTML={sanitize(subtitle)}\n />\n <ProgressBar\n total={steps.length}\n count={completeCount}\n style={{ marginTop: '24px', paddingRight: `40px` }}\n appearance={appearance}\n />\n </ChecklistHeader>\n <ChecklistStepsContainer\n role=\"list\"\n className={getClassName('checklistStepsContainer', appearance)}\n >\n {steps.map((s: StepData, idx: number) => {\n return (\n <StepChecklistItem\n data={s}\n index={idx}\n key={s.id}\n listLength={steps.length}\n isSelected={idx === selectedStepValue}\n primaryColor={appearance.theme.colorPrimary}\n style={{ justifyContent: 'space-between' }}\n onClick={() => {\n setSelectedStepValue(idx)\n }}\n appearance={appearance}\n />\n )\n })}\n </ChecklistStepsContainer>\n </ChecklistHeaderContainer>\n <Divider appearance={appearance} className={getClassName('checklistDivider', appearance)} />\n <HeroChecklistStepContentContainer data-stepid={`${steps[selectedStepValue].id}`}>\n <StepContent appearance={appearance} stepData={steps[selectedStepValue]} />\n </HeroChecklistStepContentContainer>\n </HeroChecklistContainer>\n )\n}\n\nexport default HeroChecklist\n","import React, { CSSProperties, FC } from 'react'\nimport { CheckBoxRow } from '../../CheckBoxRow'\nimport { Appearance, StepData } from '../../../types'\nimport { ChecklistStepItem, StepItemSelectedIndicator } from './styled'\nimport { getClassName } from '../../../shared/appearance'\n\ninterface StepItemProps {\n data: StepData\n index: number\n listLength: number\n isSelected: boolean\n primaryColor: string\n style: CSSProperties\n onClick: () => void\n appearance: Appearance\n}\n\nexport const StepChecklistItem: FC<StepItemProps> = ({\n data,\n index,\n isSelected,\n primaryColor,\n style,\n onClick,\n appearance,\n}) => {\n return (\n <div\n style={{ position: 'relative', paddingLeft: '0px' }}\n onClick={() => {\n onClick()\n }}\n >\n {isSelected && (\n <StepItemSelectedIndicator\n className={getClassName('checklistStepItemSelectedIndicator', appearance)}\n layoutId=\"checklist-step-selected\"\n style={{ backgroundColor: appearance?.theme?.colorPrimary ?? primaryColor }}\n ></StepItemSelectedIndicator>\n )}\n <ChecklistStepItem\n className={getClassName('checklistStepItem', appearance)}\n key={`hero-checklist-step-${index}`}\n appearance={appearance}\n role=\"listitem\"\n >\n <CheckBoxRow\n value={data.complete}\n labelPosition=\"left\"\n label={data.stepName ?? data.title}\n style={style}\n primaryColor={appearance?.theme?.colorPrimary ?? primaryColor}\n appearance={appearance}\n />\n </ChecklistStepItem>\n </div>\n )\n}\n","import React, { CSSProperties, FC } from 'react'\nimport styled from 'styled-components'\nimport { CheckBox, CheckBoxType } from '../CheckBox'\nimport { Appearance } from '../../types'\nimport { getClassName, styleOverridesToCSS } from '../../shared/appearance'\nimport { RenderInlineStyles } from '../RenderInlineStyles'\nimport { sanitize } from '../../shared/sanitizer'\n\ninterface CheckBoxRowProps {\n label?: string\n value: boolean\n labelStyle?: CSSProperties\n labelPosition?: 'left' | 'right'\n style?: CSSProperties\n primaryColor?: string\n secondaryColor?: string\n checkBoxType?: CheckBoxType\n appearance?: Appearance\n}\n\nconst Label = styled.span`\n font-weight: 600;\n font-size: 14px;\n font-style: normal;\n line-height: 22px;\n letter-spacing: 0.28px;\n color: #4d4d4d;\n display: inline-block;\n vertical-align: middle;\n margin-left: 32px;\n padding-right: 12px;\n ${(props) => styleOverridesToCSS(props)}\n`\n\nconst CheckBoxRowContainer = styled.div`\n flex-direction: row;\n justify-content: space-between;\n display: flex;\n padding-top: 20px;\n padding-bottom: 20px;\n padding-right: 8px;\n width: 100%;\n ${(props) => styleOverridesToCSS(props)}\n`\n\nexport const CheckBoxRow: FC<CheckBoxRowProps> = ({\n label,\n value,\n labelStyle = {},\n labelPosition = 'right',\n style,\n primaryColor = '#000000',\n checkBoxType = 'round',\n appearance,\n}) => {\n return (\n <>\n <CheckBoxRowContainer\n className={getClassName('checklistStepsContainer', appearance)}\n appearance={appearance}\n styleOverrides={{ ...style }}\n >\n {labelPosition === 'left' && label && (\n <Label\n className={getClassName('checklistStepLabel', appearance)}\n styleOverrides={labelStyle}\n appearnace={appearance}\n dangerouslySetInnerHTML={sanitize(label)}\n />\n )}\n <CheckBox\n appearance={appearance}\n value={value}\n type={checkBoxType}\n label={label}\n primaryColor={primaryColor}\n />\n {labelPosition === 'right' && label && (\n <Label\n className={getClassName('checklistStepLabel', appearance)}\n styleOverrides={labelStyle}\n appearance={appearance}\n dangerouslySetInnerHTML={sanitize(label)}\n />\n )}\n </CheckBoxRowContainer>\n <RenderInlineStyles appearance={appearance} />\n </>\n )\n}\n","import styled from 'styled-components'\n\nexport const HeroChecklistStepContent = styled.div`\n font-weight: 700;\n font-size: 18px;\n line-height: 22px;\n`\n\nexport const HeroChecklistStepTitle = styled.p<{ appearance }>`\n font-weight: 600;\n font-size: 16px;\n line-height: 24px;\n margin: 20px 0px 0px 0px;\n letter-spacing: 0.32px;\n font-style: normal;\n color: ${(props) => props.appearance?.theme?.colorText};\n`\n\nexport const HeroChecklistStepSubtitle = styled.p<{ appearance }>`\n font-weight: 400;\n font-size: 14px;\n font-style: normal;\n line-height: 22px;\n max-width: 540px;\n letter-spacing: 0.28px;\n margin: 8px 0px 0px 0px;\n color: ${(props) => props.appearance?.theme?.colorTextSecondary};\n`\n\nexport const StepItemSelectedIndicator = styled.div`\n width: 6px;\n position: absolute;\n left: 0;\n height: 100%;\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n`\n\nexport const ChecklistStepItem = styled.div`\n flex-direction: row;\n justify-content: flex-start;\n border-bottom: 1px solid ${(props) => props.theme.colorBorder};\n padding-right: 16px;\n`\n","import React, { CSSProperties } from 'react'\nimport styled from 'styled-components'\nimport { Appearance } from '../../../types'\nimport { getClassName, styleOverridesToCSS } from '../../../shared/appearance'\nimport { ProgressBarBackground, ProgressBarFill } from './styled'\n\n// TODO: remove once secondary color is passed from theme\nconst PROGRESS_BAR_COLOR_STYLES = {\n backgroundColor: '#E6E6E6',\n}\n\nconst ProgressContainer = styled.div`\n display: flex;\n flex-direction: ${(props) => (props.textLocation == 'top' ? 'column' : 'row')};\n justify-content: flex-start;\n align-items: ${(props) => (props.textLocation == 'top' ? 'flex-end' : 'center')};\n width: 100%;\n\n ${(props) => styleOverridesToCSS(props)}\n`\nconst ProgressProgressBar = styled.div`\n flex-grow: 1;\n position: relative;\n ${(props) => (props.textLocation == 'top' ? `width: 100%;` : ``)}\n`\n\nconst StepText = styled.span<{ padding; appearance }>`\n font-weight: 600;\n font-size: 14px;\n line-height: 18px;\n padding-right: ${(props) => props.padding};\n margin-bottom: ${(props) => (props.textLocation == 'top' ? '8px' : '0px')};\n ${(props) => styleOverridesToCSS(props)}\n`\n\nconst progressBgStyle: CSSProperties = {\n position: 'relative',\n left: 0,\n top: 0,\n width: '100%',\n minWidth: '40px',\n height: '10px',\n borderRadius: '20px',\n}\n\nexport const ProgressBar = ({\n count,\n total,\n display = 'count',\n textLocation = 'left',\n style = {},\n textStyle = {},\n appearance,\n}: {\n count: number\n total: number\n bgColor?: string\n display?: 'count' | 'percent' | 'compact'\n textLocation?: 'top' | 'left'\n style?: CSSProperties\n textStyle?: CSSProperties\n appearance?: Appearance\n}) => {\n if (total === 0) {\n return <></>\n }\n\n if (Object.keys(textStyle).length === 0 && textStyle.constructor === Object) {\n textStyle = {\n color: appearance?.theme?.colorText,\n }\n }\n\n const fgWidth = count === 0 ? '10px' : `${(count / total) * 100}%`\n const barHeight = display === 'compact' ? '8px' : '10px'\n const percentComplete = Math.round((count / total) * 100)\n let padding = display === 'compact' ? '10px' : '14px'\n\n let stepText\n if (display === 'count' || display === 'compact') {\n stepText = `${count}/${total}`\n } else if (display === 'percent') {\n stepText = `${percentComplete}% complete`\n }\n if (textLocation === 'top') {\n padding = '0px'\n }\n\n return (\n <ProgressContainer\n className={getClassName('progressBarContainer', appearance)}\n textLocation={textLocation}\n styleOverrides={style}\n >\n <StepText\n className={getClassName('progressBarStepText', appearance)}\n styleOverrides={{\n ...textStyle,\n fontSize: display === 'compact' ? 12 : 14,\n fontWeight: 600,\n }}\n appearance={appearance}\n padding={padding}\n textLocation={textLocation}\n >\n {stepText}\n </StepText>\n <ProgressProgressBar\n textLocation={textLocation}\n className={getClassName('progressBar', appearance)}\n >\n <ProgressBarFill\n style={{\n zIndex: display == 'compact' ? 1 : 5,\n }}\n fgWidth={fgWidth}\n barHeight={barHeight}\n appearance={appearance}\n className={getClassName('progressBarFill', appearance)}\n />\n <ProgressBarBackground\n className={getClassName('progressBarBackground', appearance)}\n barHeight={barHeight}\n appearance={appearance}\n />\n </ProgressProgressBar>\n </ProgressContainer>\n )\n}\n","import styled from 'styled-components'\n\nexport const ChecklistTitle = styled.h1`\n display: flex;\n margin: 0;\n font-size: 18px;\n`\n\nexport const ChecklistSubtitle = styled.h2`\n font-size: 15px;\n color: #4d4d4d;\n`\n\nexport const ProgressBarFill = styled.div`\n position: absolute;\n left: 0;\n top: 0;\n height: ${(props) => props.barHeight};\n width: ${(props) => props.fgWidth};\n border-radius: 20px;\n background-color: ${(props) => props.theme.colorPrimary};\n transition: width 0.5s;\n`\nexport const ProgressBarBackground = styled.div`\n position: relative;\n left: 0;\n top: 0;\n width: 100%;\n min-width: 40px;\n height: ${(props) => props.barHeight};\n border-radius: 20px;\n background-color: ${(props) => props.theme.colorPrimary};\n opacity: 0.12;\n`\n","import { HeroChecklistStepContent } from '../Checklists/HeroChecklist/styled'\n\nimport React, { FC } from 'react'\nimport { StepContentProps } from '../../FrigadeForm/types'\nimport styled from 'styled-components'\nimport { TitleSubtitleWithCTA } from './shared/TitleSubtitleWithCTA'\nimport { VideoPlayer } from '../Video/VideoPlayer'\nimport { getClassName } from '../../shared/appearance'\n\nexport const HERO_STEP_CONTENT_TYPE = 'default'\nconst StepImage = styled.img`\n border-radius: ${(props) => props.appearance?.theme.borderRadius}px;\n width: 100%;\n height: auto;\n min-height: 200px;\n`\nexport const HeroStepContent: FC<StepContentProps> = ({ stepData, appearance }) => {\n if (stepData?.StepContent) {\n const Content: React.ReactNode = stepData.StepContent\n return <div>{Content}</div>\n }\n\n return (\n <HeroChecklistStepContent className={getClassName('checklistStepContent', appearance)}>\n {stepData.imageUri ? (\n <StepImage\n className={getClassName('checklistStepImage', appearance)}\n src={stepData.imageUri}\n appearance={appearance}\n />\n ) : null}\n {stepData.videoUri ? (\n <VideoPlayer\n videoUri={stepData.videoUri}\n appearance={appearance}\n autoplay={stepData.props?.autoplayVideo}\n loop={stepData.props?.loopVideo}\n hideControls={stepData.props?.hideVideoControls}\n />\n ) : null}\n <TitleSubtitleWithCTA stepData={stepData} appearance={appearance} />\n </HeroChecklistStepContent>\n )\n}\n","import React, { FC } from 'react'\nimport { StepContentProps } from '../../../FrigadeForm/types'\nimport { TitleSubtitle } from './TitleSubtitle'\nimport { CTA } from './CTA'\n\nexport const TitleSubtitleWithCTA: FC<StepContentProps> = ({ stepData, appearance }) => {\n return (\n <>\n <TitleSubtitle stepData={stepData} appearance={appearance} />\n <CTA stepData={stepData} appearance={appearance} />\n </>\n )\n}\n","import React, { FC } from 'react'\n\nimport {\n HeroChecklistStepSubtitle,\n HeroChecklistStepTitle,\n} from '../../Checklists/HeroChecklist/styled'\nimport { StepContentProps } from '../../../FrigadeForm/types'\nimport { sanitize } from '../../../shared/sanitizer'\nimport { getClassName } from '../../../shared/appearance'\n\nexport const TitleSubtitle: FC<StepContentProps> = ({ stepData, appearance }) => {\n return (\n <>\n <HeroChecklistStepTitle\n appearance={appearance}\n className={getClassName('checklistStepTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.title)}\n />\n <HeroChecklistStepSubtitle\n appearance={appearance}\n className={getClassName('checklistStepSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.subtitle)}\n />\n </>\n )\n}\n","import React, { FC } from 'react'\nimport { Button, MultipleButtonContainer } from '../../Button'\nimport { StepContentProps } from '../../../FrigadeForm/types'\nimport { getClassName } from '../../../shared/appearance'\n\nexport const CTA: FC<StepContentProps> = ({ stepData, appearance }) => {\n const handlePrimaryButtonClick = () => {\n if (stepData.handlePrimaryButtonClick) {\n stepData.handlePrimaryButtonClick()\n }\n }\n\n const handleSecondaryButtonClick = () => {\n if (stepData.handleSecondaryButtonClick) {\n stepData.handleSecondaryButtonClick()\n }\n }\n\n return (\n <MultipleButtonContainer className={getClassName('ctaContainer', appearance)}>\n <Button\n appearance={appearance}\n title={stepData.primaryButtonTitle}\n onClick={handlePrimaryButtonClick}\n />\n {stepData.secondaryButtonTitle && (\n <Button\n appearance={appearance}\n secondary\n title={stepData.secondaryButtonTitle}\n onClick={handleSecondaryButtonClick}\n style={{\n width: 'auto',\n marginRight: '12px',\n }}\n />\n )}\n </MultipleButtonContainer>\n )\n}\n","import React from 'react'\nimport { Appearance } from '../../types'\nimport { VideoCard } from './VideoCard'\n\nexport function VideoPlayer(props: {\n videoUri: string\n autoplay: boolean\n appearance?: Appearance\n loop?: boolean\n hideControls?: boolean\n}) {\n return (\n <VideoCard\n appearance={props.appearance}\n videoUri={props.videoUri}\n autoplay={props.autoplay}\n loop={props.loop}\n hideControls={props.hideControls}\n />\n )\n}\n","import React, { FC, useRef, useState } from 'react'\nimport styled from 'styled-components'\nimport { TitleSubtitleWithCTA } from './shared/TitleSubtitleWithCTA'\nimport { StepContentProps } from '../../FrigadeForm/types'\nimport { Play } from '../Icons/Play'\nimport { TitleSubtitle } from './shared/TitleSubtitle'\nimport { CTA } from './shared/CTA'\n\nconst VideoCarouselContainer = styled.div`\n display: block;\n`\n\nconst VideoList = styled.div`\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: flex-start;\n gap: 0px;\n align-items: center;\n align-content: center;\n margin-top: 24px;\n margin-bottom: 24px;\n`\n\nconst Video = styled.div`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n flex-direction: column;\n margin-right: 16px;\n`\n\nconst VideoSource = styled.video`\n width: 200px;\n height: 120px;\n`\n\nconst VideoTitle = styled.div`\n font-size: 14px;\n line-height: 20px;\n text-align: center;\n`\n\nconst PlayIconWrapper = styled.div`\n position: absolute;\n width: 200px;\n height: 120px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n :hover {\n opacity: 0.6;\n }\n z-index: 10;\n\n > svg {\n width: 40px;\n height: 40px;\n color: ${(props) => props.appearance.theme.colorBackground};\n box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);\n border-radius: 50%;\n }\n`\n\ninterface VideoMetadata {\n uri: string\n thumbnailUri?: string\n title?: string\n}\n\ninterface VideoCarouselProps {\n videos: VideoMetadata[]\n}\n\nexport const VIDEO_CAROUSEL_TYPE = 'videoCarousel'\n\nexport const VideoCarousel: FC<StepContentProps> = ({ stepData, appearance }) => {\n if (!stepData.props?.videos) {\n return (\n <VideoCarouselContainer>\n <TitleSubtitleWithCTA stepData={stepData} appearance={appearance} />\n </VideoCarouselContainer>\n )\n }\n\n function VideoCard({ video }: { video: VideoMetadata }) {\n // Create ref to use with videoplayer\n\n const ref = useRef<any>()\n\n const [isPlaying, setIsPlaying] = useState(false)\n\n return (\n <Video>\n {!isPlaying && (\n <PlayIconWrapper\n onClick={() => {\n setIsPlaying(true)\n ref.current.play()\n }}\n appearance={appearance}\n >\n <Play />\n </PlayIconWrapper>\n )}\n <VideoSource controls={isPlaying} ref={ref} play={isPlaying} src={video.uri} />\n <VideoTitle>{video.title}</VideoTitle>\n </Video>\n )\n }\n\n const videoProps = stepData.props as VideoCarouselProps\n\n if (videoProps.videos) {\n return (\n <VideoCarouselContainer>\n <TitleSubtitle stepData={stepData} appearance={appearance} />\n <VideoList>\n {videoProps.videos.map((video: VideoMetadata, idx: number) => (\n <span key={`${video.uri}-${idx}`}>\n <VideoCard video={video} />\n </span>\n ))}\n </VideoList>\n <CTA stepData={stepData} appearance={appearance} />\n </VideoCarouselContainer>\n )\n }\n return null\n}\n","import React, { FC } from 'react'\nimport styled from 'styled-components'\nimport { TitleSubtitleWithCTA } from './shared/TitleSubtitleWithCTA'\nimport { StepContentProps } from '../../FrigadeForm/types'\nimport { CTA } from './shared/CTA'\nimport { TitleSubtitle } from './shared/TitleSubtitle'\nimport { sanitize } from '../../shared/sanitizer'\nimport { getClassName } from '../../shared/appearance'\n\nconst CodeSnippetContainer = styled.div`\n display: block;\n`\n\n// Create a cool code snippet style that is dark background white text\nconst CodeSnippet = styled.pre`\n display: block;\n background-color: #2a2a2a;\n color: #f8f8f8;\n padding: 16px;\n border-radius: 6px;\n font-size: 14px;\n line-height: 20px;\n font-family: 'Source Code Pro', monospace;\n width: 600px;\n white-space: pre-wrap; /* css-3 */\n white-space: -moz-pre-wrap; /* Mozilla, since 1999 */\n white-space: -pre-wrap; /* Opera 4-6 */\n white-space: -o-pre-wrap; /* Opera 7 */\n word-wrap: break-word; /* Internet Explorer 5.5+ */\n margin-bottom: 24px;\n`\nconst CodeSnippetTitle = styled.div`\n font-size: 15px;\n line-height: 20px;\n margin-bottom: 12px;\n margin-top: 12px;\n`\n\nconst CodeSnippets = styled.div`\n margin-top: 24px;\n`\n\ninterface CodeSnippetMetadata {\n code?: string\n title?: string\n}\n\ninterface CodeSnippetProps {\n codeSnippets: CodeSnippetMetadata[]\n}\n\nexport const CODE_SNIPPET_CONTENT_TYPE = 'codeSnippet'\n\nexport const CodeSnippetContent: FC<StepContentProps> = ({ stepData, appearance }) => {\n if (!stepData.props?.codeSnippets) {\n return (\n <CodeSnippetContainer>\n <TitleSubtitleWithCTA stepData={stepData} appearance={appearance} />\n </CodeSnippetContainer>\n )\n }\n\n const codeProps = stepData.props as CodeSnippetProps\n\n if (codeProps.codeSnippets) {\n return (\n <CodeSnippetContainer className={getClassName('codeSnippetContainer', appearance)}>\n <TitleSubtitle stepData={stepData} appearance={appearance} />\n <CodeSnippets>\n {codeProps.codeSnippets.map((codeSnippet, index) => {\n return (\n <div key={index}>\n {codeSnippet.title ? (\n <CodeSnippetTitle dangerouslySetInnerHTML={sanitize(codeSnippet.title)} />\n ) : null}\n {codeSnippet.code ? <CodeSnippet>{codeSnippet.code}</CodeSnippet> : null}\n </div>\n )\n })}\n </CodeSnippets>\n <CTA stepData={stepData} appearance={appearance} />\n </CodeSnippetContainer>\n )\n }\n return null\n}\n","import React, { FC, useState } from 'react'\nimport { Button } from '../../Button'\nimport { CheckBox } from '../../CheckBox'\nimport { Chevron } from '../../Icons/Chevron'\nimport { StepData } from '../../../types'\nimport { ProgressBar } from '../Checklist/ProgressBar'\nimport { StepItemSelectedIndicator } from '../HeroChecklist/styled'\nimport {\n ChecklistContainer,\n ChecklistSubtitle,\n ChecklistTitle,\n ContainerStyle,\n HeaderContent,\n MultipleButtonContainer,\n ProgressBarContainer,\n ScrollContainer,\n StepContainer,\n StepListContainer,\n StepListItem,\n StepListItemRight,\n StepListStepName,\n StepsBody,\n StepsContainer,\n StepsHeader,\n StepsTitle,\n StepSubtitle,\n StepTitle,\n} from './styled'\nimport { CenterVertical } from '../../styled'\nimport { Modal } from '../../Modal'\nimport Guide, { GuideStepData } from '../../Guides/Guide'\nimport { getClassName } from '../../../shared/appearance'\nimport { ChecklistProps } from '../index'\nimport { sanitize } from '../../../shared/sanitizer'\n\nexport interface ChecklistWithGuideProps extends ChecklistProps {\n // Map from string to function with StepData returning React.ReactNode\n visible: boolean\n stepsTitle: string\n\n guideData?: GuideStepData[]\n guideTitle?: string\n\n onGuideButtonClick?: (stepData: StepData) => void\n}\n\nconst ChecklistWithGuide: FC<ChecklistWithGuideProps> = ({\n steps,\n title,\n subtitle,\n stepsTitle,\n\n visible,\n onClose,\n\n selectedStep,\n setSelectedStep,\n customStepTypes,\n\n appearance,\n\n guideData,\n guideTitle,\n\n onGuideButtonClick,\n}) => {\n const DefaultStepContent = ({ stepData, handleSecondaryCTAClick, handleCTAClick }) => {\n if (!stepData) return <></>\n\n return (\n <StepContainer\n className={getClassName('checklistStepContainer', appearance)}\n data-testid=\"checklistStepContainer\"\n >\n <StepTitle\n appearance={appearance}\n className={getClassName('checklistStepTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.title)}\n />\n <StepSubtitle\n appearance={appearance}\n className={getClassName('checklistStepSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.subtitle)}\n />\n <MultipleButtonContainer className={getClassName('checklistCTAContainer', appearance)}>\n {stepData.secondaryButtonTitle && (\n <Button\n title={stepData.secondaryButtonTitle}\n onClick={handleSecondaryCTAClick}\n appearance={appearance}\n secondary\n />\n )}\n <Button\n title={stepData.primaryButtonTitle}\n onClick={handleCTAClick}\n appearance={appearance}\n />\n </MultipleButtonContainer>\n </StepContainer>\n )\n }\n\n const DEFAULT_CUSTOM_STEP_TYPES = {\n default: (stepData: StepData) => {\n if (steps[selectedStepValue]?.StepContent) {\n const Content: React.ReactNode = steps[selectedStepValue].StepContent\n return <div>{Content}</div>\n }\n const currentStep = steps[selectedStepValue]\n\n const handleCTAClick = () => {\n if (currentStep.handlePrimaryButtonClick) {\n currentStep.handlePrimaryButtonClick()\n }\n }\n\n const handleSecondaryCTAClick = () => {\n if (currentStep.handleSecondaryButtonClick) {\n currentStep.handleSecondaryButtonClick()\n }\n }\n\n return (\n <DefaultStepContent\n stepData={stepData}\n handleCTAClick={handleCTAClick}\n handleSecondaryCTAClick={handleSecondaryCTAClick}\n />\n )\n },\n }\n\n const mergedCustomStepTypes = { ...DEFAULT_CUSTOM_STEP_TYPES, ...customStepTypes }\n\n const [selectedStepInternal, setSelectedStepInternal] = useState(0)\n\n const selectedStepValue = selectedStep ?? selectedStepInternal\n const setSelectedStepValue = setSelectedStep ?? setSelectedStepInternal\n\n const StepContent = () => {\n if (!steps) return <></>\n if (!steps[selectedStepValue]?.type || !mergedCustomStepTypes[steps[selectedStepValue].type]) {\n return mergedCustomStepTypes['default'](steps[selectedStepValue])\n }\n\n // check if mergedCustomStepTypes[steps[selectedStepValue].type] is a function\n if (typeof mergedCustomStepTypes[steps[selectedStepValue].type] !== 'function') {\n return mergedCustomStepTypes[steps[selectedStepValue].type]\n }\n\n return mergedCustomStepTypes[steps[selectedStepValue].type]({\n stepData: steps[selectedStepValue],\n primaryColor: appearance.theme.colorPrimary,\n })\n }\n\n const completeCount = steps.filter((s) => s.complete).length\n\n if (!visible) return <></>\n\n if (!appearance.theme.modalContainer) {\n if (appearance.theme.borderRadius) {\n ContainerStyle.borderRadius = appearance.theme.borderRadius + 'px'\n }\n appearance.theme.modalContainer = ContainerStyle\n }\n\n return (\n <Modal onClose={onClose} visible={visible} appearance={appearance}>\n <ChecklistContainer>\n <HeaderContent>\n <ChecklistTitle\n appearance={appearance}\n className={getClassName('checklistTitle', appearance)}\n >\n {title}\n </ChecklistTitle>\n <ChecklistSubtitle\n appearance={appearance}\n className={getClassName('checklistSubtitle', appearance)}\n >\n {subtitle}\n </ChecklistSubtitle>\n </HeaderContent>\n\n <ScrollContainer>\n {steps && steps.length > 0 && (\n <StepsContainer className={getClassName('stepsContainer', appearance)}>\n <StepsHeader>\n <div style={{ flex: 3 }}>\n <StepsTitle className={getClassName('stepsTitle', appearance)}>\n {stepsTitle}\n </StepsTitle>\n </div>\n <ProgressBarContainer>\n <ProgressBar\n style={{ width: '100%' }}\n count={completeCount}\n total={steps.length}\n appearance={appearance}\n />\n </ProgressBarContainer>\n </StepsHeader>\n <StepsBody>\n <StepListContainer\n className={getClassName('checklistStepListContainer', appearance)}\n appearance={appearance}\n >\n {steps.map((stepData: StepData, idx: number) => {\n const isSelected = selectedStepValue === idx\n return (\n <StepListItem\n selected={isSelected}\n className={getClassName(\n `checklistStepListItem${isSelected ? 'Selected' : ''}`,\n appearance\n )}\n key={`checklist-guide-step-${stepData.id ?? idx}`}\n disabled={stepData.blocked}\n onClick={() => {\n if (stepData.blocked) {\n return\n }\n setSelectedStepValue(idx)\n }}\n title={stepData.blocked ? 'Finish remaining steps to continue' : undefined}\n >\n {isSelected && (\n <StepItemSelectedIndicator\n className={getClassName(\n 'checklistStepItemSelectedIndicator',\n appearance\n )}\n layoutId=\"checklist-step-selected\"\n style={{\n backgroundColor: appearance.theme.colorPrimary,\n borderRadius: 0,\n height: '100%',\n top: '0%',\n width: '2px',\n }}\n ></StepItemSelectedIndicator>\n )}\n <StepListStepName\n selected={isSelected}\n className={getClassName(\n `checklistStepListStepName${isSelected ? 'Selected' : ''}`,\n appearance\n )}\n >\n {stepData.stepName}\n </StepListStepName>\n <StepListItemRight>\n <CheckBox\n value={stepData.complete}\n type=\"round\"\n primaryColor={appearance.theme.colorPrimary}\n progress={stepData.progress}\n appearance={appearance}\n />\n <CenterVertical>\n <Chevron\n style={{ marginLeft: '10px' }}\n color={appearance.theme.colorBackgroundSecondary}\n />\n </CenterVertical>\n </StepListItemRight>\n </StepListItem>\n )\n })}\n </StepListContainer>\n\n <StepContent />\n </StepsBody>\n </StepsContainer>\n )}\n {guideData && guideData.length > 0 && (\n <Guide\n steps={guideData}\n title={guideTitle}\n primaryColor={appearance.theme.colorPrimary}\n style={{\n border: 'none',\n boxShadow: 'none',\n }}\n appearance={appearance}\n onButtonClick={(step) => {\n if (onGuideButtonClick) {\n onGuideButtonClick(step)\n }\n\n return true\n }}\n />\n )}\n </ScrollContainer>\n </ChecklistContainer>\n </Modal>\n )\n}\n\nexport default ChecklistWithGuide\n","import React, { CSSProperties } from 'react'\nimport styled from 'styled-components'\n\nconst ChevronSVG = styled.svg`\n transition: 'transform 0.35s ease-in-out';\n`\n\nexport const Chevron = ({\n style,\n className,\n}: {\n color?: string\n style?: CSSProperties\n className?: string\n}) => (\n <ChevronSVG\n width=\"7\"\n height=\"10\"\n viewBox=\"0 0 9 15\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n style={style}\n className={className}\n >\n <path\n d=\"M1 13L7.5 7L0.999999 1\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </ChevronSVG>\n)\n","import { CSSProperties } from 'react'\nimport styled from 'styled-components'\nimport { getCustomClassOverrides } from '../../../shared/appearance'\n\n// Styles for top level container and text\n\nexport const ContainerStyle: CSSProperties = {\n boxShadow: '0px 6px 25px rgba(0, 0, 0, 0.06)',\n padding: '32px',\n maxHeight: '700px',\n msOverflowStyle: 'none' /* IE and Edge */,\n scrollbarWidth: 'none' /* Firefox */,\n paddingBottom: '12px',\n minHeight: '610px',\n}\n\nexport const ScrollContainer = styled.div`\n max-height: 350px;\n padding-bottom: 40px;\n`\n\nexport const HeaderContent = styled.div`\n display: flex;\n flex-direction: column;\n margin-top: 20px;\n`\n\nexport const ChecklistTitle = styled.h1<{ appearance }>`\n font-style: normal;\n font-weight: 600;\n font-size: 30px;\n line-height: 36px;\n margin-bottom: 16px;\n color: ${(props) => props.appearance?.theme?.colorText};\n`\nexport const ChecklistSubtitle = styled.h2<{ appearance }>`\n font-weight: 400;\n font-size: 16px;\n line-height: 20px;\n margin-bottom: 16px;\n padding-left: 1px;\n color: ${(props) => props.appearance?.theme?.colorTextSecondary};\n`\n\nexport const StepsContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n border: 1px solid #fafafa;\n }\n box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);\n border-radius: 14px;\n display: flex;\n flex-direction: column;\n min-height: 240px;\n overflow: hidden;\n`\n\nexport const StepsHeader = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n`\n\nexport const StepsTitle = styled.p`\n ${(props) => getCustomClassOverrides(props)} {\n font-weight: 400;\n font-size: 10px;\n line-height: 12px;\n text-transform: uppercase;\n color: #8c8c8c;\n margin: 20px;\n }\n`\n\nexport const StepsBody = styled.div`\n display: flex;\n flex-direction: row;\n`\n\nexport const StepListContainer = styled.div`\n flex: 1;\n`\n\n// Styles for Step content\n\nexport const StepContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n flex: 1;\n padding-left: 8px;\n padding-right: 8px;\n }\n`\n\nexport const StepTitle = styled.p`\n ${(props) => getCustomClassOverrides(props)} {\n font-style: normal;\n font-weight: 600;\n font-size: 22px;\n line-height: 26px;\n\n text-align: center;\n color: ${(props) => props.appearance.theme.colorText};\n margin-top: 20px;\n margin-bottom: 16px;\n }\n`\n\nexport const StepSubtitle = styled.p`\n ${(props) => getCustomClassOverrides(props)} {\n font-weight: 400;\n font-size: 14px;\n line-height: 18px;\n text-align: center;\n color: ${(props) => props.appearance.theme.colorTextSecondary};\n margin-bottom: 8px;\n }\n`\n\nexport const MultipleButtonContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 8px;\n }\n`\n\nexport const StepListItem = styled.div<{ selected: boolean }>`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n background-color: ${(props) => (props.selected ? '#FAFAFA' : '#FFFFFF')};\n :hover {\n background-color: #fafafa;\n }\n }\n //Check if attr disabled is true\n &[disabled] {\n opacity: 0.3;\n cursor: not-allowed;\n }\n\n padding: 20px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n position: relative;\n cursor: pointer;\n`\n\nexport const StepListStepName = styled.p<{ selected: boolean }>`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n color: ${(props) => (props.selected ? '#434343' : '#BFBFBF')};\n }\n font-weight: ${(props) => (props.selected ? 500 : 400)};\n font-size: 14px;\n line-height: 22px;\n margin: 0;\n`\n\nexport const StepListItemRight = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-content: center;\n`\n\nexport const ProgressBarContainer = styled.div`\n display: flex;\n flex: 1;\n flex-direction: row;\n justify-content: flex-end;\n align-content: center;\n align-items: center;\n margin-right: 20px;\n`\n\nexport const ChecklistContainer = styled.div`\n display: block;\n width: 100%;\n`\n","import styled from 'styled-components'\n\nexport const CenterVertical = styled.div`\n flex-direction: column;\n justify-content: center;\n display: flex;\n`","import React, { CSSProperties, FC } from 'react'\nimport { Appearance, DefaultFrigadeFlowProps, StepData } from '../../types'\n\nimport {\n GuideContainer,\n GuideIcon,\n GuideIconWrapper,\n GuideItem,\n GuideItemLink,\n GuideItems,\n GuideItemSubtitle,\n GuideItemTitle,\n GuideTitle,\n} from './styled'\nimport { getClassName } from '../../shared/appearance'\nimport { useCTAClickSideEffects } from '../../hooks/useCTAClickSideEffects'\nimport { sanitize } from '../../shared/sanitizer'\n\nexport interface GuideStepData extends StepData {\n icon?: string\n}\n\ninterface GuideProps extends Pick<DefaultFrigadeFlowProps, 'onButtonClick'> {\n steps: GuideStepData[]\n title: string\n style?: CSSProperties\n primaryColor?: string\n appearance: Appearance\n}\n\n/**\n * A guide is essentially a list of links that does not have a state\n */\nconst Guide: FC<GuideProps> = ({\n steps,\n style,\n title,\n primaryColor,\n appearance,\n onButtonClick,\n}) => {\n const { primaryCTAClickSideEffects } = useCTAClickSideEffects()\n\n return (\n <GuideContainer style={style} className={getClassName('guideContainer', appearance)}>\n <GuideTitle className={getClassName('guideTitle', appearance)}>{title}</GuideTitle>\n <GuideItems className={getClassName('guideItemContainer', appearance)}>\n {steps.map((stepData: GuideStepData, idx) => {\n return (\n <GuideItem\n key={`guide-${stepData.id ?? idx}`}\n className={getClassName('guideItem', appearance)}\n >\n {stepData.icon && (\n <GuideIconWrapper className={getClassName('guideIcon', appearance)}>\n <GuideIcon>{stepData.icon}</GuideIcon>\n </GuideIconWrapper>\n )}\n\n <GuideItemTitle\n className={getClassName('guideItemTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.title)}\n />\n <GuideItemSubtitle\n className={getClassName('guideItemSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.subtitle)}\n />\n <GuideItemLink\n className={getClassName('guideItemLink', appearance)}\n color={primaryColor}\n onClick={() => {\n if (stepData.primaryButtonUri) {\n primaryCTAClickSideEffects(stepData)\n }\n if (onButtonClick) {\n onButtonClick(stepData)\n }\n }}\n >\n {stepData.primaryButtonTitle}\n </GuideItemLink>\n </GuideItem>\n )\n })}\n </GuideItems>\n </GuideContainer>\n )\n}\n\nexport default Guide\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../../shared/appearance'\n\nexport const GuideContainer = styled.div`\n border: 1px solid #fafafa;\n box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);\n border-radius: 14px;\n padding-top: 20px;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n`\n\nexport const GuideItems = styled.div`\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n overflow: hidden;\n row-gap: 10px;\n`\n\nexport const GuideTitle = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n color: #595959;\n }\n text-transform: uppercase;\n font-weight: 400;\n font-size: 10px;\n line-height: 12px;\n letter-spacing: 0.09em;\n margin-bottom: 12px;\n`\n\nexport const GuideItem = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n background: #ffffff;\n border: 1px solid #fafafa;\n }\n border-radius: 14px;\n padding: 20px;\n flex-direction: column;\n align-content: center;\n\n max-width: 150px;\n min-width: 200px;\n`\n\nexport const GuideIconWrapper = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);\n }\n width: 40px;\n height: 40px;\n\n border-radius: 7px;\n display: flex;\n justify-content: center;\n align-content: center;\n align-items: center;\n`\n\nexport const GuideIcon = styled.div`\n font-weight: 600;\n font-size: 20px;\n line-height: 24px;\n width: 20px;\n height: 20px;\n`\n\nexport const GuideItemTitle = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n color: #434343;\n }\n font-weight: 600;\n font-size: 14px;\n line-height: 17px;\n margin-top: 12px;\n margin-bottom: 8px;\n`\n\nexport const GuideItemSubtitle = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n color: #8c8c8c;\n }\n font-weight: 400;\n font-size: 12px;\n line-height: 14px;\n`\n\nexport const GuideItemLink = styled.a<{ color: string }>`\n color: ${(props) => props.color};\n font-size: 12px;\n line-height: 14px;\n font-weight: 400;\n cursor: pointer;\n`\n","import React, { FC, useEffect, useState } from 'react'\nimport { StepData } from '../../../types'\nimport { Modal } from '../../Modal'\nimport { ProgressBar } from '../Checklist/ProgressBar'\nimport { CollapsibleStep } from './CollapsibleStep'\n\nimport {\n ChecklistContainer,\n CondensedInlineChecklistContainer,\n HeaderContent,\n ModalChecklistSubtitle,\n ModalChecklistTitle,\n} from './styled'\nimport { sanitize } from '../../../shared/sanitizer'\nimport { getClassName, mergeClasses } from '../../../shared/appearance'\nimport { FrigadeChecklistProps } from '../../../FrigadeChecklist'\n\nexport interface CondensedChecklistProps extends Omit<FrigadeChecklistProps, 'flowId'> {\n autoCollapse?: boolean\n onClose: () => void\n}\n\nconst CondensedChecklist: FC<CondensedChecklistProps> = ({\n title,\n subtitle,\n steps,\n onClose,\n visible,\n autoExpandFirstIncompleteStep = true,\n autoCollapse = true,\n autoExpandNextStep = true,\n setSelectedStep,\n appearance,\n type,\n className,\n customStepTypes,\n style,\n onButtonClick,\n}) => {\n const completeCount = steps.filter((s) => s.complete).length\n const [collapsedSteps, setCollapsedSteps] = useState<boolean[]>(Array(steps.length).fill(true))\n\n useEffect(() => {\n const initCollapsedState = [...collapsedSteps]\n if (!autoExpandFirstIncompleteStep) return\n for (let i = 0; i < steps.length; i++) {\n if (!steps[i].complete) {\n initCollapsedState[i] = false\n break\n }\n }\n setCollapsedSteps(initCollapsedState)\n }, [])\n\n const handleStepClick = (idx: number) => {\n const newCollapsedState = [...collapsedSteps]\n if (autoCollapse) {\n for (let i = 0; i < collapsedSteps.length; ++i) {\n if (i != idx && newCollapsedState[idx]) {\n newCollapsedState[i] = true\n }\n }\n }\n newCollapsedState[idx] = !collapsedSteps[idx]\n setCollapsedSteps(newCollapsedState)\n }\n\n if (!visible && type == 'modal') return <></>\n\n const headerContent = (\n <>\n <HeaderContent>\n <ModalChecklistTitle\n appearance={appearance}\n className={getClassName('checklistTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(title)}\n />\n <ModalChecklistSubtitle\n appearance={appearance}\n className={getClassName('checklistSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(subtitle)}\n />\n </HeaderContent>\n <ProgressBar\n display=\"percent\"\n count={completeCount}\n total={steps.length}\n style={{ margin: '14px 0px 8px 0px' }}\n appearance={appearance}\n />\n </>\n )\n\n const checklistContent = (\n <ChecklistContainer\n className={mergeClasses(getClassName('checklistContainer', appearance), className)}\n >\n {steps.map((step: StepData, idx: number) => {\n const isCollapsed = collapsedSteps[idx]\n return (\n <CollapsibleStep\n appearance={appearance}\n stepData={step}\n collapsed={isCollapsed}\n key={`modal-checklist-${step.id ?? idx}`}\n onClick={() => {\n handleStepClick(idx)\n setSelectedStep(idx)\n if (onButtonClick) {\n onButtonClick(steps[idx], idx, collapsedSteps[idx] ? 'expand' : 'collapse')\n }\n }}\n onPrimaryButtonClick={() => {\n handleStepClick(idx)\n if (autoExpandNextStep && idx < steps.length - 1) {\n setSelectedStep(idx + 1)\n }\n if (step.handlePrimaryButtonClick) {\n step.handlePrimaryButtonClick()\n }\n if (autoExpandNextStep && idx < steps.length - 1) {\n handleStepClick(idx + 1)\n }\n }}\n onSecondaryButtonClick={() => {\n if (step.handleSecondaryButtonClick) {\n step.handleSecondaryButtonClick()\n }\n if (autoExpandNextStep && idx < steps.length - 1) {\n handleStepClick(idx + 1)\n }\n }}\n customStepTypes={customStepTypes}\n />\n )\n })}\n </ChecklistContainer>\n )\n\n if (type === 'inline') {\n return (\n <CondensedInlineChecklistContainer\n appearance={appearance}\n className={mergeClasses(getClassName('checklistInlineContainer', appearance), className)}\n style={style}\n >\n {headerContent}\n {checklistContent}\n </CondensedInlineChecklistContainer>\n )\n }\n\n return (\n <>\n <Modal\n onClose={onClose}\n visible={visible}\n appearance={appearance}\n style={{ maxWidth: '600px' }}\n headerContent={headerContent}\n >\n {checklistContent}\n </Modal>\n </>\n )\n}\n\nexport default CondensedChecklist\n","import React, { FC } from 'react'\nimport { Appearance, StepData } from '../../../../types'\nimport { CheckBoxRow } from '../../../CheckBoxRow'\nimport { Chevron } from '../../../Icons/Chevron'\nimport { Button, MultipleButtonContainer } from '../../../Button'\n\nimport {\n CollapseChevronContainer,\n HeaderLeft,\n StepContainer,\n StepHeader,\n StepImage,\n StepMediaContainer,\n StepSubtitle,\n StepTitle,\n} from './styled'\nimport { sanitize } from '../../../../shared/sanitizer'\nimport { getClassName } from '../../../../shared/appearance'\nimport { VideoCard } from '../../../Video/VideoCard'\n\ninterface CollapsibleStepProps {\n stepData: StepData\n collapsed: boolean\n onClick: () => void\n onSecondaryButtonClick: () => void\n onPrimaryButtonClick: () => void\n appearance?: Appearance\n /**\n * Map of custom step types that the checklist supports. To use a custom steps in your checklist, see [Component Customization](/component/customization#customizing-frigade-components)\n */\n customStepTypes?: Record<\n string,\n ((stepData: StepData, appearance: Appearance) => React.ReactNode) | React.ReactNode\n >\n}\n\nexport const CollapsibleStep: FC<CollapsibleStepProps> = ({\n stepData,\n collapsed,\n onClick,\n onPrimaryButtonClick,\n onSecondaryButtonClick,\n appearance,\n customStepTypes,\n}) => {\n const iconStyle = collapsed ? {} : { transform: 'rotate(90deg)' }\n const stepContentStyle = collapsed\n ? {\n overflow: 'hidden',\n maxHeight: '0px',\n transition: 'max-height 0.35s ease-out',\n }\n : {\n overflow: 'hidden',\n maxHeight: '1000px',\n transition: 'max-height 0.7s ease-out',\n }\n\n function getDefaultStepContent() {\n return (\n <>\n {stepData.imageUri || stepData.videoUri ? (\n <StepMediaContainer className={getClassName('stepMediaContainer', appearance)}>\n {stepData.imageUri ? (\n <StepImage\n className={getClassName('stepImage', appearance)}\n src={stepData.imageUri}\n />\n ) : null}\n {stepData.videoUri ? (\n <VideoCard\n appearance={appearance}\n videoUri={stepData.videoUri}\n autoplay={stepData.props?.autoplayVideo}\n loop={stepData.props?.loopVideo}\n hideControls={stepData.props?.hideVideoControls}\n />\n ) : null}\n </StepMediaContainer>\n ) : null}\n <StepSubtitle\n className={getClassName('stepSubtitle', appearance)}\n appearance={appearance}\n dangerouslySetInnerHTML={sanitize(stepData.subtitle)}\n />\n <MultipleButtonContainer className={getClassName('checklistCTAContainer', appearance)}>\n {stepData.secondaryButtonTitle ? (\n <Button\n secondary\n title={stepData.secondaryButtonTitle}\n onClick={() => onSecondaryButtonClick()}\n appearance={appearance}\n />\n ) : null}\n <Button\n title={stepData.primaryButtonTitle ?? 'Continue'}\n onClick={() => onPrimaryButtonClick()}\n appearance={appearance}\n />\n </MultipleButtonContainer>\n </>\n )\n }\n\n function getCustomStep() {\n if (!customStepTypes) {\n return null\n }\n const customStep = customStepTypes[stepData.type]\n if (!customStep) {\n return null\n }\n // Check if not a function\n if (typeof customStep !== 'function') {\n return customStep\n }\n\n return customStep(stepData, appearance)\n }\n\n return (\n <StepContainer\n data-testid={`step-${stepData.id}`}\n data-stepid={`${stepData.id}`}\n className={getClassName('checklistStepContainer', appearance)}\n appearance={appearance}\n >\n <StepHeader className={getClassName('stepHeader', appearance)} onClick={() => onClick()}>\n <HeaderLeft className={getClassName('stepHeaderContent', appearance)}>\n <CheckBoxRow\n value={stepData.complete}\n style={{ width: 'auto', borderTop: 0 }}\n primaryColor={appearance?.theme?.colorPrimary}\n appearance={appearance}\n />\n <StepTitle\n appearance={appearance}\n className={getClassName('stepTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(stepData.title)}\n />\n </HeaderLeft>\n\n <CollapseChevronContainer\n className={getClassName('stepChevronContainer', appearance)}\n appearance={appearance}\n >\n <Chevron style={{ ...iconStyle, transition: 'transform 0.2s ease-in-out' }} />\n </CollapseChevronContainer>\n </StepHeader>\n\n <div\n key={stepData.id}\n style={{\n ...stepContentStyle,\n }}\n className={getClassName('stepContent', appearance)}\n >\n {getCustomStep() ?? getDefaultStepContent()}\n </div>\n </StepContainer>\n )\n}\n","import styled from 'styled-components'\n\nexport const StepContainer = styled.div<{ appearance }>`\n background-color: ${(props) => props.appearance?.theme?.colorBackground};\n border: 1px solid;\n border-color: ${(props) => props.appearance?.theme?.colorBorder};\n border-radius: 6px;\n padding: 2px 20px 2px 20px;\n display: flex;\n margin-top: 14px;\n margin-bottom: 14px;\n display: flex;\n flex-direction: column;\n transition: max-height 0.25s;\n`\n\nexport const StepMediaContainer = styled.div`\n display: flex;\n margin-bottom: 20px;\n`\n\nexport const StepImage = styled.img`\n border-radius: 4px;\n max-height: 260px;\n min-height: 200px;\n`\nexport const StepHeader = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n :hover {\n opacity: 0.8;\n }\n`\n\nexport const StepTitle = styled.p<{ appearance }>`\n color: ${(props) => props.appearance?.theme?.colorText};\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 18px;\n margin-left: 8px;\n cursor: pointer;\n :hover {\n opacity: 0.8;\n }\n`\n\nexport const CollapseChevronContainer = styled.div`\n cursor: pointer;\n color: ${(props) => props.appearance.theme.colorTextSecondary};\n :hover {\n opacity: 0.8;\n }\n`\n\nexport const ExpandedContentContainer = styled.div``\n\nexport const StepSubtitle = styled.p<{ appearance }>`\n color: ${(props) => props.appearance?.theme?.colorText};\n font-weight: 400;\n font-size: 14px;\n line-height: 22px;\n`\n\nexport const HeaderLeft = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n`\n","import styled from 'styled-components'\n\nexport const ModalChecklistContainer = styled.div`\n background: #ffffff;\n box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);\n border-radius: 6px;\n z-index: 10;\n padding: 32px;\n\n position: absolute;\n width: 80%;\n top: 20%;\n left: 20%;\n\n max-width: 800px;\n min-width: 350px;\n`\n\nexport const HeaderContent = styled.div`\n display: flex;\n flex-direction: column;\n`\n\nexport const ModalChecklistTitle = styled.h1<{ appearance }>`\n color: ${(props) => props.appearance?.theme?.colorText};\n font-style: normal;\n font-weight: 700;\n font-size: 20px;\n line-height: 24px;\n margin-bottom: 8px;\n`\nexport const ModalChecklistSubtitle = styled.h2<{ appearance }>`\n color: ${(props) => props.appearance?.theme?.colorTextSecondary};\n font-weight: 400;\n font-size: 14px;\n line-height: 23px;\n margin: 2px 0 0 0;\n`\nexport const ChecklistContainer = styled.div`\n display: block;\n width: 100%;\n`\nexport const CondensedInlineChecklistContainer = styled.div`\n display: flex;\n width: 100%;\n flex-direction: column;\n justify-content: space-between;\n padding: 24px;\n border-radius: ${(props) => props.appearance?.theme?.borderRadius}px;\n background-color: ${(props) => props.appearance?.theme?.colorBackground};\n`\n","import React, { useEffect, useRef, useState } from 'react'\nimport { useFlows } from '../../../api/flows'\nimport { useMediaQuery } from '../../../hooks/useMediaQuery'\n\nimport { CarouselCard } from './CarouselCard'\n\nimport {\n Body,\n CarouselContainer,\n CarouselScroll,\n CarouselScrollGroup,\n CarouselTitle,\n ProgressWrapper,\n StyledCarouselFade,\n StyledScrollButton,\n} from './styled'\nimport { DefaultFrigadeFlowProps } from '../../../types'\nimport { getClassName, mergeClasses } from '../../../shared/appearance'\nimport { RenderInlineStyles } from '../../RenderInlineStyles'\nimport { ProgressBar } from '../Checklist/ProgressBar'\nimport { sanitize } from '../../../shared/sanitizer'\n\nconst RightArrow = () => (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M14 6L20 12\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" />\n <path d=\"M14 18L20 12\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" />\n <path d=\"M4 12H20\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" />\n </svg>\n)\n\nconst CarouselFade: React.FC<{ side?: string; show?: boolean; onClick?: any }> = ({\n side = 'left',\n show = false,\n onClick = () => {},\n}) => {\n const [mounted, setMounted] = useState(false)\n const [reversed, setReversed] = useState(false)\n\n useEffect(() => {\n if (show === true && mounted === false) {\n setMounted(true)\n } else if (show === false && mounted === true) {\n setReversed(true)\n }\n }, [show])\n\n const handleFadeOutEnd = () => {\n setMounted(false)\n setReversed(false)\n }\n\n const style: React.CSSProperties =\n side == 'left'\n ? { top: 0, bottom: 0, left: -20, transform: 'rotate(180deg)' }\n : { top: 0, bottom: 0, right: -20 }\n\n return mounted ? (\n <StyledCarouselFade\n style={style}\n reversed={reversed}\n onAnimationEnd={reversed ? handleFadeOutEnd : null}\n >\n <StyledScrollButton onClick={() => onClick()} style={{ right: 16, top: 'calc(50% - 24px)' }}>\n <RightArrow />\n </StyledScrollButton>\n </StyledCarouselFade>\n ) : null\n}\n\nexport interface CarouselChecklistProps extends DefaultFrigadeFlowProps {\n flowId: string\n}\n\nexport const CarouselChecklist: React.FC<CarouselChecklistProps> = ({\n flowId,\n appearance,\n customVariables,\n className,\n}) => {\n const scrollContainerRef = useRef<HTMLDivElement>(null)\n const [showLeftFade, setShowLeftFade] = useState(false)\n const [showRightFade, setShowRightFade] = useState(false)\n const [flowMetadata, setFlowMetadata] = useState(null)\n const [flowSteps, setFlowSteps] = useState([])\n const [numberOfStepsCompleted, setNumberOfStepsCompleted] = useState(0)\n const { isSmall } = useMediaQuery()\n\n const pageSize = isSmall ? 1 : 3\n\n const {\n getFlowMetadata,\n getFlowSteps,\n getNumberOfStepsCompleted,\n updateCustomVariables,\n isLoading,\n } = useFlows()\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n useEffect(() => {\n if (isLoading) return\n\n const metadata = getFlowMetadata(flowId)\n const completedStepCount = getNumberOfStepsCompleted(flowId)\n const steps = getFlowSteps(flowId)\n\n setFlowMetadata(metadata)\n if (metadata.data !== null || metadata.steps !== null) {\n setFlowSteps(steps.sort((a, b) => Number(a.complete) - Number(b.complete)))\n setShowRightFade(steps.length > pageSize)\n setNumberOfStepsCompleted(completedStepCount)\n }\n }, [isLoading])\n\n const scrollGroups: any[][] = []\n for (let i = 0; i < flowSteps.length; i += pageSize) {\n scrollGroups.push(flowSteps.slice(i, i + pageSize))\n }\n\n const handleScroll = (e: React.UIEvent<HTMLElement>) => {\n const target = e.target as HTMLElement\n const maxScroll = target.scrollWidth - target.clientWidth\n // Round up to avoid issues with fractional pixels\n const currentScroll = Math.ceil(target.scrollLeft)\n\n if (currentScroll > 0 && showLeftFade === false) {\n setShowLeftFade(true)\n }\n\n if (currentScroll === 0 && showLeftFade === true) {\n setShowLeftFade(false)\n }\n\n if (currentScroll < maxScroll && showRightFade === false) {\n setShowRightFade(true)\n }\n\n if (currentScroll === maxScroll && showRightFade === true) {\n setShowRightFade(false)\n }\n }\n\n const handleScrollByPage = (forward = true) => {\n const direction = forward ? 1 : -1\n\n if (scrollContainerRef.current === null) return\n\n scrollContainerRef.current.scrollBy({\n left: scrollContainerRef.current.clientWidth * direction,\n behavior: 'smooth',\n })\n }\n\n let scrollTimeout = null\n const throttledScroll = (e: React.UIEvent<HTMLElement>) => {\n if (scrollTimeout !== null) {\n clearTimeout(scrollTimeout)\n } else {\n // Invoke once before starting to throttle\n handleScroll(e)\n }\n\n scrollTimeout = setTimeout(() => {\n handleScroll(e)\n }, 16)\n }\n\n if (isLoading) {\n return null\n }\n\n return (\n <CarouselContainer\n className={mergeClasses(getClassName('carouselContainer', appearance), className)}\n >\n <div\n style={{\n display: 'flex',\n justifyContent: isSmall ? 'center' : 'space-between',\n marginBottom: 20,\n flexWrap: isSmall ? 'wrap' : 'nowrap',\n gap: isSmall ? 16 : 20,\n }}\n >\n <div>\n <CarouselTitle\n className={getClassName('carouselTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(flowMetadata?.title)}\n />\n <Body.Quiet\n className={getClassName('carouselSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(flowMetadata?.subtitle)}\n />\n </div>\n <ProgressWrapper className={getClassName('progressWrapper', appearance)}>\n <ProgressBar\n count={numberOfStepsCompleted}\n total={flowSteps.length}\n appearance={appearance}\n />\n </ProgressWrapper>\n </div>\n\n <div style={{ position: 'relative' }}>\n <CarouselFade show={showLeftFade} onClick={() => handleScrollByPage(false)} />\n <CarouselFade side=\"right\" show={showRightFade} onClick={handleScrollByPage} />\n\n <CarouselScroll ref={scrollContainerRef} onScroll={throttledScroll}>\n {scrollGroups.map((group, i) => (\n <CarouselScrollGroup\n key={i}\n style={{\n flex: `0 0 calc(100% - ${flowSteps.length > pageSize ? 36 : 0}px)`,\n }}\n >\n {group.map((stepData, j) => (\n <CarouselCard\n key={j}\n stepData={stepData}\n style={{\n flex:\n flowSteps.length > pageSize\n ? `0 1 calc(100% / ${pageSize} - 16px * 2 / ${pageSize})`\n : 1,\n }}\n appearance={appearance}\n />\n ))}\n </CarouselScrollGroup>\n ))}\n </CarouselScroll>\n </div>\n <RenderInlineStyles appearance={appearance} />\n </CarouselContainer>\n )\n}\n","import { useEffect, useState } from 'react'\n\nexport const useMediaQuery = () => {\n const queries = {\n isSmall: '(max-width: 480px)',\n isMedium: '(min-width: 481px) AND (max-width: 1023px)',\n isLarge: '(min-width: 1025px)',\n }\n\n const defaultMatches = Object.fromEntries(Object.entries(queries).map(([key]) => [key, false]))\n\n const [matches, setMatches] = useState(defaultMatches)\n\n let updateTimeout = null\n const throttledUpdate = () => {\n if (updateTimeout !== null) {\n clearTimeout(updateTimeout)\n } else {\n updateMatches()\n }\n\n updateTimeout = setTimeout(() => {\n updateMatches()\n }, 16)\n }\n\n const updateMatches = () => {\n const freshMatches = Object.fromEntries(\n Object.entries(queries).map(([key, query]) => {\n if (!window) {\n return [key, false]\n }\n\n const mediaQuery = window.matchMedia(query)\n\n mediaQuery.addEventListener('change', throttledUpdate)\n\n return [key, mediaQuery.matches]\n })\n )\n\n setMatches(freshMatches)\n }\n\n useEffect(() => {\n updateMatches()\n }, [])\n\n return matches\n}\n","import React, { FC } from 'react'\nimport { Appearance, StepData } from '../../../types'\nimport { useCTAClickSideEffects } from '../../../hooks/useCTAClickSideEffects'\n\nimport {\n Body,\n CardTitle,\n CompletedPill,\n Small,\n StyledCarouselCard,\n StyledCarouselCardImage,\n} from './styled'\nimport { useTheme } from '../../../hooks/useTheme'\nimport { getClassName } from '../../../shared/appearance'\nimport { sanitize } from '../../../shared/sanitizer'\n\ninterface CarouselCardProps {\n stepData: StepData\n style?: React.CSSProperties\n appearance?: Appearance\n}\n\nexport const CarouselCard: FC<CarouselCardProps> = ({ stepData, style = {}, appearance }) => {\n const { mergeAppearanceWithDefault } = useTheme()\n const { primaryCTAClickSideEffects } = useCTAClickSideEffects()\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n const {\n imageUri = null,\n subtitle = null,\n title = null,\n complete = false,\n blocked = false,\n } = stepData\n\n const hasCTA = stepData.primaryButtonTitle || stepData.secondaryButtonTitle\n\n const handleClick = () => {\n primaryCTAClickSideEffects(stepData)\n }\n\n return (\n <StyledCarouselCard\n className={getClassName('carouselCard', appearance)}\n onClick={blocked ? null : handleClick}\n style={style}\n blocked={blocked}\n complete={complete}\n >\n {imageUri && (\n <StyledCarouselCardImage\n className={getClassName('carouselCardImage', appearance)}\n src={imageUri}\n alt={title}\n style={{ opacity: complete || blocked ? 0.4 : 1 }}\n />\n )}\n {complete && (\n <CompletedPill className={getClassName('carouselCompletedPill', appearance)}>\n <Small style={{ color: '#108E0B' }}>Complete</Small>\n </CompletedPill>\n )}\n {title && (\n <CardTitle\n blocked={blocked}\n complete={complete}\n className={getClassName('carouselCardTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(title)}\n />\n )}\n {subtitle && (\n <Body.Quiet\n blocked={blocked}\n complete={complete}\n className={getClassName('carouselCardSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(subtitle)}\n />\n )}\n {/* !(complete || blocked) && hasCTA && <CTA stepData={stepData} appearance={appearance} /> */}\n </StyledCarouselCard>\n )\n}\n","import styled, { css, keyframes } from 'styled-components'\nimport { getCustomClassOverrides } from '../../../shared/appearance'\n\nconst defaultBorder = css`\n border: 1px solid ${({ theme }) => theme.colorBorder};\n`\n\nconst defaultShadow = css`\n box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);\n`\n\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n } to {\n opacity: 1;\n }\n`\n\nconst fadeOut = keyframes`\n from {\n opacity: 1;\n } to {\n opacity: 0;\n }\n`\n\nexport const CarouselScroll = styled.div`\n margin: 0 -20px;\n overflow-x: auto;\n padding-left: 20px;\n padding-right: 20px;\n scroll-snap-type: x mandatory;\n\n display: flex;\n flex-flow: row nowrap;\n gap: 0 16px;\n\n -ms-overflow-style: none;\n scrollbar-width: none;\n\n ::-webkit-scrollbar {\n display: none;\n }\n`\n\nexport const CarouselScrollGroup = styled.div`\n display: flex;\n flex-flow: row nowrap;\n gap: 0 16px;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n`\n\nexport const StyledCarouselFade = styled.div`\n animation: ${(props) => (props.reversed ? fadeOut : fadeIn)} 0.25s ease-out;\n background: linear-gradient(\n to right,\n ${({ theme }) => theme.colorBackground}00,\n ${({ theme }) => theme.colorBackground} 100%\n );\n position: absolute;\n width: 64px;\n z-index: 10;\n`\n\nexport const StyledScrollButton = styled.button`\n ${defaultBorder}\n box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.1);\n align-items: center;\n border-radius: 50%;\n background: ${({ theme }) => theme.colorBackground};\n color: ${({ theme }) => theme.colorPrimary};\n display: flex;\n height: 48px;\n justify-content: center;\n position: absolute;\n width: 48px;\n`\n\nexport const Card = styled.div`\n border-radius: ${({ theme }) => theme.borderRadius}px;\n padding: 20px;\n`\n\nexport const StyledCarouselCard = styled(Card)`\n ${defaultBorder}\n background: ${({ theme }) => theme.colorBackground};\n position: relative;\n\n &:active {\n ${(props) => (!props.blocked ? `background: ${props.theme.colorBackgroundSecondary};` : ``)}\n }\n\n &:hover {\n ${(props) => (!props.blocked ? `border: 1px solid ${props.theme.colorPrimary};` : ``)}\n ${(props) => (!props.blocked ? `cursor: pointer` : `cursor: default`)}\n }\n`\n\nexport const StyledCarouselCardImage = styled.img`\n border-radius: 50%;\n height: 40px;\n margin-bottom: 12px;\n width: 40px;\n`\n\nexport const CarouselContainer = styled(Card)`\n ${(props) => getCustomClassOverrides(props)} {\n ${defaultShadow}\n\n background: ${({ theme }) => theme.colorBackground};\n }\n`\n\nexport const CarouselProgressBar = styled.div`\n color: ${({ theme }) => theme.colorPrimary};\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n`\n\nexport const ProgressBarLabel = styled.div`\n white-space: nowrap;\n`\n\nexport const CompletedPill = styled.div`\n background: #d8fed8;\n border-radius: 6px;\n float: right;\n margin-bottom: 12px;\n padding: 4px 10px;\n`\n\nexport const H3 = styled.p`\n font-weight: bold;\n font-size: 18px;\n line-height: 22px;\n letter-spacing: calc(18px * -0.01);\n margin: 0;\n`\n\nexport const CarouselTitle = styled(H3)`\n margin-bottom: 4px;\n`\n\nexport const ProgressWrapper = styled.div`\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n min-width: 50%;\n`\n\nexport const H4 = styled.p`\n font-weight: bold;\n font-size: 16px;\n line-height: 20px;\n letter-spacing: calc(16px * -0.01);\n margin: 0;\n`\n\nexport const CardTitle = styled(H4)`\n margin-bottom: 4px;\n ${(props) =>\n props.blocked || props.complete\n ? `opacity: 0.4;`\n : `\n `}\n`\n\nexport const Body = styled.p`\n color: ${({ theme }) => theme.colorText};\n font-weight: normal;\n font-size: 14px;\n line-height: 22px;\n margin: 0;\n`\n\nexport const Small = styled.p`\n color: ${({ theme }) => theme.colorText};\n font-weight: 600;\n font-size: 12px;\n line-height: 16px;\n margin: 0;\n`\n\nBody.Loud = styled(Body)`\n font-weight: 600;\n`\n\nBody.Quiet = styled(Body)`\n color: ${({ theme }) => theme.colorTextSecondary};\n ${(props) =>\n props.blocked || props.complete\n ? `opacity: 0.4;`\n : `\n `}\n`\n","import React, { CSSProperties, useEffect } from 'react'\nimport { useFlows } from '../api/flows'\nimport { MiniProgressBadge, ProgressBadgeType } from '../components/Checklists/MiniProgressBadge'\nimport { useFlowOpens } from '../api/flow-opens'\nimport { DefaultFrigadeFlowProps } from '../types'\nimport { COMPLETED_FLOW } from '../api/common'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport { useTheme } from '../hooks/useTheme'\nimport { FullWidthProgressBadge } from '../components/Checklists/FullWidthProgressBadge'\n\nexport interface FrigadeProgressBadgeProps extends DefaultFrigadeFlowProps {\n title: string\n subtitle?: string\n icon?: React.ReactNode\n textStyle?: CSSProperties\n onClick?: () => void\n hideOnFlowCompletion?: boolean\n type?: ProgressBadgeType\n}\n\nexport const FrigadeProgressBadge: React.FC<FrigadeProgressBadgeProps> = ({\n flowId,\n title,\n subtitle,\n icon,\n style,\n onClick,\n className,\n customVariables,\n hideOnFlowCompletion,\n appearance,\n type = 'default',\n}) => {\n const {\n getFlow,\n getFlowSteps,\n getFlowStatus,\n getNumberOfStepsCompleted,\n isLoading,\n targetingLogicShouldHideFlow,\n updateCustomVariables,\n } = useFlows()\n const { mergeAppearanceWithDefault } = useTheme()\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n const { setOpenFlowState, getOpenFlowState } = useFlowOpens()\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n if (isLoading) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (hideOnFlowCompletion === true && getFlowStatus(flowId) === COMPLETED_FLOW) {\n return null\n }\n\n const steps = getFlowSteps(flowId)\n const completedCount = getNumberOfStepsCompleted(flowId)\n\n if (type === 'full-width') {\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <FullWidthProgressBadge\n title={title}\n subtitle={subtitle}\n count={completedCount}\n total={steps.length}\n style={style}\n className={className}\n appearance={appearance}\n icon={icon}\n onClick={onClick}\n />\n </>\n )\n }\n\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <MiniProgressBadge\n count={completedCount}\n total={steps.length}\n title={title}\n style={style}\n onClick={() => {\n setOpenFlowState(flowId, true)\n if (onClick) {\n onClick()\n }\n }}\n type={type}\n className={className}\n appearance={appearance}\n />\n </>\n )\n}\n","import React, { CSSProperties, FC } from 'react'\nimport { Chevron } from '../../Icons/Chevron'\nimport { ProgressBar } from '../Checklist/ProgressBar'\nimport { BadgeContainer, BadgeRow, BadgeTitle, ProgressRingContainer } from './styled'\nimport { Appearance } from '../../../types'\nimport ProgressRing from '../../Progress/ProgressRing/ProgressRing'\nimport { getClassName, mergeClasses } from '../../../shared/appearance'\nimport { RenderInlineStyles } from '../../RenderInlineStyles'\n\nexport type ProgressBadgeType = 'condensed' | 'default' | 'full-width'\n\nexport interface ProgressBadgeProps {\n title: string\n subtitle?: string\n icon?: React.ReactNode\n count: number\n total: number\n style?: CSSProperties\n onClick: () => void\n className?: string\n type?: ProgressBadgeType\n appearance?: Appearance\n}\n\nexport const MiniProgressBadge: FC<ProgressBadgeProps> = ({\n title,\n count,\n total,\n onClick,\n style = {},\n className,\n appearance,\n type = 'default',\n}) => {\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <BadgeContainer\n onClick={() => onClick !== undefined && onClick()}\n styleOverrides={{\n ...(type == 'condensed' ? { display: 'flex', justifyContent: 'space-between' } : {}),\n ...style,\n }}\n className={mergeClasses(\n className ?? '',\n getClassName('progressBadgeContainer', appearance)\n )}\n appearance={appearance}\n >\n {type == 'condensed' && total && total !== 0 && (\n <ProgressRingContainer className={getClassName('progressRingContainer', appearance)}>\n <ProgressRing\n size={19}\n percentage={count / total}\n fillColor={appearance.theme.colorPrimary}\n bgColor={appearance.theme.colorBackgroundSecondary}\n />\n </ProgressRingContainer>\n )}\n <BadgeRow type={type} className={getClassName('badgeTitleContainer', appearance)}>\n <BadgeTitle\n type={type}\n appearance={appearance}\n className={getClassName('badgeTitle', appearance)}\n >\n {title}\n </BadgeTitle>\n {onClick !== undefined && (\n <Chevron\n className={getClassName('badgeChevron', appearance)}\n color={appearance.theme.colorPrimary}\n />\n )}\n </BadgeRow>\n {type == 'default' && total && total !== 0 && (\n <ProgressBar\n display=\"compact\"\n count={count}\n total={total}\n bgColor={appearance.theme.colorBackgroundSecondary}\n style={{ width: '100%' }}\n appearance={appearance}\n textStyle={{\n color: '#818898',\n }}\n />\n )}\n </BadgeContainer>\n </>\n )\n}\n","import styled from 'styled-components'\nimport { styleOverridesToCSS } from '../../../shared/appearance'\n\nexport const BadgeContainer = styled.div`\n border: 1px solid ${(props) => props.appearance.theme.colorBorder};\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n padding: 10px 12px 10px 12px;\n min-width: 160px;\n cursor: pointer;\n background-color: ${(props) => props.appearance.theme.colorBackground}};\n ${(props) => styleOverridesToCSS(props)}\n \n &:hover {\n filter: brightness(.99);\n }\n`\n\nexport const BadgeRow = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n margin-bottom: ${(props) => (props.type === 'condensed' ? '0' : '6px')};\n flex-grow: 2;\n`\n\nexport const BadgeTitle = styled.div<{ color; type }>`\n text-overflow: ellipsis;\n font-weight: 600;\n font-size: 14px;\n line-height: 16px;\n margin-right: ${(props) => (props.type === 'condensed' ? '8px' : '0')};\n text-align: ${(props) => (props.type === 'condensed' ? 'left' : 'right')};\n`\nexport const ProgressRingContainer = styled.div`\n width: 20px;\n margin-right: 8px;\n display: flex;\n height: 100%;\n align-items: center;\n`\n","import React from 'react'\n\nimport {\n FullWidthProgressBadgeContainer,\n IconContainer,\n ProgressBarContainer,\n TextContainer,\n} from './styled'\nimport { ProgressBadgeProps } from '../MiniProgressBadge'\nimport { TitleSubtitle } from '../../TitleSubtitle/TitleSubtitle'\nimport { getClassName, mergeClasses } from '../../../shared/appearance'\nimport { ProgressBar } from '../Checklist/ProgressBar'\n\nexport const FullWidthProgressBadge: React.FC<ProgressBadgeProps> = ({\n title,\n subtitle,\n icon,\n appearance,\n count,\n total,\n className,\n style,\n onClick,\n}) => {\n return (\n <>\n <FullWidthProgressBadgeContainer\n appearance={appearance}\n className={mergeClasses(\n getClassName('fullWidthProgressBadgeContainer', appearance),\n className ?? ''\n )}\n style={style}\n onClick={() => onClick !== undefined && onClick()}\n >\n {icon && (\n <IconContainer className={getClassName('fullWidthProgressBadgeIcon', appearance)}>\n {icon}\n </IconContainer>\n )}\n <TextContainer>\n <TitleSubtitle size={'small'} appearance={appearance} title={title} subtitle={subtitle} />\n </TextContainer>\n <ProgressBarContainer\n className={getClassName('fullWidthProgressBadgeProgressContainer', appearance)}\n >\n <ProgressBar count={count} total={total} display=\"percent\" textLocation=\"top\" />\n </ProgressBarContainer>\n </FullWidthProgressBadgeContainer>\n </>\n )\n}\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../../../shared/appearance'\n\nexport const FullWidthProgressBadgeContainer = styled.div`\n display: flex;\n flex-direction: row;\n width: 100%;\n padding: 16px;\n box-sizing: border-box;\n align-items: center;\n background-color: ${(props) => props.appearance.theme.colorBackground};\n border: 1px solid ${(props) => props.appearance.theme.colorBorder};\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\n\nexport const IconContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n justify-content: center;\n align-items: center;\n margin-right: 16px;\n }\n`\n\nexport const TextContainer = styled.div`\n display: flex;\n flex-direction: column;\n flex: 1;\n margin-top: 0;\n`\nexport const ProgressBarContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-left: 16px;\n min-width: 200px;\n`\n\nexport const DismissButton = styled.div`\n display: flex;\n justify-content: center;\n align-items: flex-end;\n margin-left: 16px;\n cursor: pointer;\n :hover {\n opacity: 0.8;\n }\n`\n","import React, { FC } from 'react'\nimport { useFlows } from '../api/flows'\nimport { Guide } from '../components/Guides'\nimport { DefaultFrigadeFlowProps } from '../types'\nimport { useTheme } from '../hooks/useTheme'\n\nexport interface FrigadeGuideProps extends DefaultFrigadeFlowProps {\n title: string\n primaryColor?: string\n}\n\nexport const FrigadeGuide: FC<FrigadeGuideProps> = ({ flowId, style, appearance, ...props }) => {\n const { getFlow, targetingLogicShouldHideFlow, getFlowSteps } = useFlows()\n const { mergeAppearanceWithDefault } = useTheme()\n appearance = mergeAppearanceWithDefault(appearance)\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n const steps = getFlowSteps(flowId)\n\n return <Guide steps={steps} style={style} appearance={appearance} {...props} />\n}\n","import React, { CSSProperties, FC, useContext, useEffect } from 'react'\nimport { useFlows } from '../api/flows'\nimport { ToolTipData, Tooltips } from '../components/Tooltips'\nimport { Appearance, DefaultFrigadeFlowProps, StepData } from '../types'\nimport { COMPLETED_FLOW, COMPLETED_STEP } from '../api/common'\nimport { Portal } from 'react-portal'\nimport { useFlowOpens } from '../api/flow-opens'\nimport { FrigadeContext } from '../FrigadeProvider'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { useTheme } from '../hooks/useTheme'\nimport { useUserFlowStates } from '../api/user-flow-states'\nimport { ToolTipPosition } from '../components/Tooltips/Tooltips'\n\nexport interface FrigadeTourProps extends Omit<DefaultFrigadeFlowProps, 'flowId'> {\n /**\n * @ignore\n */\n steps?: ToolTipData[]\n onDismiss?: () => void\n onComplete?: () => void\n tooltipPosition?: ToolTipPosition\n /**\n * Whether to show the highlight (the small circle/ping) or not. Defaults to true.\n */\n showHighlight?: boolean\n /**\n * Whether to show more than one tooltip at a time. Defaults to false.\n */\n showTooltipsSimultaneously?: boolean\n /**\n * @ignore\n */\n buttonStyle?: CSSProperties\n /**\n * Offset to apply to all tooltips. If you only wish to apply an offset to a single tooltip you can use `props.offset` in the config.yml instead.\n */\n offset?: { x: number; y: number }\n visible?: boolean\n /**\n * @ignore\n */\n containerStyle?: CSSProperties\n customVariables?: { [key: string]: string | number | boolean }\n /**\n * @ignore\n */\n selectedStep?: number\n customStepTypes?: Record<\n string,\n (props: { stepData: StepData; primaryColor: string }) => React.ReactNode\n >\n appearance?: Appearance\n /**\n * Shows a close button in the top right corner of the tooltip. Depending on dismissBehavior, it will either end the entire flow or just the current step.\n */\n dismissible?: boolean\n primaryColor?: string\n /**\n * If true, the tooltip will only show the highlight and not the tooltip itself.\n * Clicking the highlight will reveal it.\n */\n showHighlightOnly?: boolean\n /**\n * If true, a step counter will show up in the tooltip.\n */\n showStepCount?: boolean\n /**\n * `skip-flow` (default): Completes the entire flow/tour when a single tooltip is dismissed.\n * `complete-step`: Completes the current step when a tooltip is dismissed. The user can continue in the tour.\n */\n dismissBehavior?: 'skip-flow' | 'complete-step'\n\n /**\n * @ignore\n */\n showFrigadeBranding?: boolean\n\n /**\n * If true, the tour will go to the next existing step/tip if the current selector element is not found on the page.\n * Be careful with this, as it can lead to unexpected behavior of tooltip ordering if the selector is slow to load on the page.\n * Defaults to false.\n */\n skipIfNotFound?: boolean\n /**\n * How to position the tooltips with CSS. Defaults to `absolute`.\n * @ignore\n */\n cssPosition?: 'fixed' | 'absolute' | 'static'\n}\n\nexport const FrigadeTour: FC<\n FrigadeTourProps & { flowId: string; initialSelectedStep?: number }\n> = ({\n flowId,\n customVariables,\n appearance,\n onStepCompletion,\n onButtonClick,\n showTooltipsSimultaneously = false,\n onDismiss,\n dismissible,\n tooltipPosition = 'auto',\n showHighlightOnly = false,\n dismissBehavior = 'skip-flow',\n onComplete,\n skipIfNotFound = false,\n cssPosition = 'absolute',\n className,\n ...props\n}) => {\n const {\n getFlow,\n getFlowSteps,\n isLoading,\n targetingLogicShouldHideFlow,\n markStepCompleted,\n markStepStarted,\n markFlowCompleted,\n markFlowSkipped,\n updateCustomVariables,\n getCurrentStepIndex,\n getStepStatus,\n isStepBlocked,\n getFlowStatus,\n getNumberOfStepsCompleted,\n } = useFlows()\n const { isLoadingUserFlowStateData } = useUserFlowStates()\n const { primaryCTAClickSideEffects, secondaryCTAClickSideEffects } = useCTAClickSideEffects()\n const { hasOpenModals } = useFlowOpens()\n const selectedStep = getCurrentStepIndex(flowId)\n const { openFlowStates } = useContext(FrigadeContext)\n\n const { mergeAppearanceWithDefault } = useTheme()\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n if (isLoadingUserFlowStateData) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (getFlowStatus(flowId) == COMPLETED_FLOW) {\n return null\n }\n\n // Check if any other flow modals are open. If so hide this one\n if (hasOpenModals()) {\n return null\n }\n\n const steps: ToolTipData[] = getFlowSteps(flowId)\n\n // Hide tour flow if another flow is open\n if (Object.keys(openFlowStates).length > 0) {\n const otherFlowId = Object.keys(openFlowStates).find(\n (_flowID) => openFlowStates[_flowID] === true\n )\n if (otherFlowId !== undefined && otherFlowId !== flowId) {\n return <></>\n }\n }\n\n async function markTooltipCompleted(stepData: StepData) {\n await markStepCompleted(flowId, stepData.id)\n\n // Check if all steps are now completed\n if (\n steps\n .map((step: StepData) => getStepStatus(flowId, step.id))\n .every((status) => status === COMPLETED_STEP)\n ) {\n await markFlowCompleted(flowId)\n return\n }\n if (!showHighlightOnly && selectedStep + 1 < steps.length && !showTooltipsSimultaneously) {\n // Double check next step is not blocked\n if (isStepBlocked(flowId, steps[selectedStep + 1].id)) {\n return\n }\n }\n }\n\n function handleStepCompletionHandlers(step: StepData, cta: 'primary' | 'secondary', idx: number) {\n const maybeNextStep = selectedStep + 1 < steps.length ? steps[selectedStep + 1] : null\n if (onButtonClick) {\n onButtonClick(step, selectedStep, cta, maybeNextStep)\n }\n if (onStepCompletion) {\n onStepCompletion(step, idx, maybeNextStep)\n }\n }\n\n function getSteps() {\n return steps.map((step: StepData) => {\n return {\n ...step,\n handleSecondaryButtonClick: async () => {\n // Default to skip behavior for secondary click but allow for override\n secondaryCTAClickSideEffects(step)\n if (step.skippable === true) {\n await markStepCompleted(flowId, step.id, { skipped: true })\n }\n handleStepCompletionHandlers(step, 'secondary', selectedStep)\n },\n handlePrimaryButtonClick: async () => {\n if (\n (!step.completionCriteria &&\n (step.autoMarkCompleted || step.autoMarkCompleted === undefined)) ||\n (step.completionCriteria && step.autoMarkCompleted === true)\n ) {\n await markTooltipCompleted(step)\n }\n handleStepCompletionHandlers(step, 'primary', selectedStep)\n primaryCTAClickSideEffects(step)\n },\n }\n })\n }\n\n async function onDismissTooltip(stepData: StepData) {\n if (onDismiss) {\n onDismiss()\n }\n if (dismissBehavior === 'skip-flow') {\n await markFlowSkipped(flowId)\n } else {\n await markStepCompleted(flowId, stepData.id)\n }\n }\n\n function handleComplete() {\n if (onComplete) {\n onComplete()\n }\n }\n\n async function handleViewTooltip(index: number) {\n await markStepStarted(flowId, steps[index].id)\n }\n\n const isCurrentSelectorMissing = !Boolean(document.querySelector(steps[selectedStep].selector))\n\n function renderMultipleToolTips() {\n const firstVisibleIndex = steps.findIndex((step, idx) => {\n return Boolean(document.querySelector(step.selector)) && idx >= selectedStep\n })\n\n return steps.map((step: StepData, idx: number) => {\n if (showTooltipsSimultaneously) {\n return (\n <Tooltips\n key={step.id}\n appearance={appearance}\n steps={getSteps()}\n selectedStep={idx}\n showTooltipsSimultaneously={showTooltipsSimultaneously}\n dismissible={dismissible}\n onDismiss={() => onDismissTooltip(step)}\n tooltipPosition={tooltipPosition}\n showHighlightOnly={showHighlightOnly}\n completedStepsCount={getNumberOfStepsCompleted(flowId)}\n onComplete={handleComplete}\n cssPosition={cssPosition}\n onViewTooltip={handleViewTooltip}\n className={className}\n {...props}\n />\n )\n }\n\n if (skipIfNotFound && isCurrentSelectorMissing && idx === firstVisibleIndex) {\n return (\n <Tooltips\n key={step.id}\n appearance={appearance}\n steps={getSteps()}\n selectedStep={idx}\n showTooltipsSimultaneously={showTooltipsSimultaneously}\n dismissible={dismissible}\n onDismiss={() => onDismissTooltip(step)}\n tooltipPosition={tooltipPosition}\n showHighlightOnly={showHighlightOnly}\n completedStepsCount={getNumberOfStepsCompleted(flowId)}\n onComplete={handleComplete}\n cssPosition={cssPosition}\n onViewTooltip={handleViewTooltip}\n className={className}\n {...props}\n />\n )\n }\n\n if (idx != selectedStep) {\n return null\n }\n\n return (\n <Tooltips\n key={step.id}\n appearance={appearance}\n steps={getSteps()}\n selectedStep={idx}\n showTooltipsSimultaneously={showTooltipsSimultaneously}\n dismissible={dismissible}\n onDismiss={() => onDismissTooltip(step)}\n tooltipPosition={tooltipPosition}\n showHighlightOnly={showHighlightOnly}\n completedStepsCount={getNumberOfStepsCompleted(flowId)}\n onComplete={handleComplete}\n cssPosition={cssPosition}\n onViewTooltip={handleViewTooltip}\n className={className}\n {...props}\n />\n )\n })\n }\n\n function getTooltips() {\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n {renderMultipleToolTips()}\n </>\n )\n }\n\n if (cssPosition === 'static') {\n return getTooltips()\n }\n\n return <Portal>{getTooltips()}</Portal>\n}\n\nexport default FrigadeTour\n","import React, { CSSProperties, FC, useEffect, useLayoutEffect, useRef, useState } from 'react'\n\nimport { Button } from '../Button'\nimport { Close } from '../Icons/Close'\nimport styled from 'styled-components'\nimport { getPosition, useElemRect } from './position'\nimport {\n TooltipContainer,\n TooltipContentContainer,\n TooltipCTAContainer,\n TooltipDismissButton,\n TooltipFooter,\n TooltipImageContainer,\n TooltipStepCountContainer,\n TooltipStepCounter,\n TooltipVideoContainer,\n} from './styled'\nimport { StepData } from '../../types'\n\nimport { getClassName } from '../../shared/appearance'\nimport { TitleSubtitle } from '../TitleSubtitle/TitleSubtitle'\nimport { VideoCard } from '../Video/VideoCard'\nimport { PoweredByFrigadeTooltipRibbon } from '../branding/styled'\nimport { PoweredByFrigade } from '../branding/PoweredByFrigade'\nimport { FrigadeTourProps } from '../../FrigadeTour'\nimport { useDebug } from '../../hooks/useDebug'\n\nexport type ToolTipPosition = 'left' | 'right' | 'auto'\n\nconst DEFAULT_CARD_WIDTH = 300\nconst DEFAULT_CARD_HEIGHT = 100\nconst DEFAULT_REFRESH_DELAY = 500\nconst HIGHLIGHT_RADIUS = 12\n\nexport interface ToolTipData extends StepData {\n selector?: string\n subtitleStyle?: CSSProperties\n titleStyle?: CSSProperties\n buttonStyle?: CSSProperties\n}\n\ninterface ToolTipPropsInternal extends FrigadeTourProps {\n completedStepsCount: number\n onViewTooltip: (step: number) => void\n}\n\nconst HighlightOuter = styled.div<{ primaryColor: string }>`\n width: 100%;\n height: 100%;\n border-radius: 9999px;\n display: inline-flex;\n background-color: ${(props: any) => props.primaryColor};\n animation-duration: 1.5s;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n animation-delay: 0.15s;\n animation-iteration-count: infinite;\n animation-direction: normal;\n animation-fill-mode: none;\n animation-play-state: running;\n animation-name: ping;\n opacity: 0.15;\n\n @keyframes ping {\n 75%,\n to {\n transform: scale(1.75);\n opacity: 0;\n }\n }\n`\n\nconst HighlightInner = styled.div<{ primaryColor: string }>`\n width: ${HIGHLIGHT_RADIUS}px;\n height: ${HIGHLIGHT_RADIUS}px;\n border-radius: 100px;\n background-color: ${(props) => props.primaryColor};\n z-index: 20;\n opacity: 1;\n`\n\nconst TooltipWrapper = styled.div`\n pointer-events: all;\n`\n\nconst PositionWrapper = styled.div<{ primaryColor: string }>`\n display: flex;\n align-content: center;\n justify-content: center;\n align-items: center;\n z-index: ${(props) => (props.zIndex ? props.zIndex : 90)};\n`\n\nconst HighlightContainer = styled(PositionWrapper)`\n width: ${HIGHLIGHT_RADIUS + 12}px;\n height: ${HIGHLIGHT_RADIUS + 12}px;\n`\n\nconst Tooltips: FC<ToolTipPropsInternal> = ({\n steps = [],\n onDismiss,\n onComplete = () => {},\n tooltipPosition = 'auto',\n showHighlight = true,\n primaryColor = '#000000',\n offset = { x: 0, y: 0 },\n visible = true,\n containerStyle = {},\n selectedStep = 0,\n customStepTypes,\n appearance,\n dismissible = false,\n showHighlightOnly,\n showStepCount = true,\n completedStepsCount = 0,\n showFrigadeBranding = false,\n cssPosition = 'absolute',\n onViewTooltip,\n className,\n}) => {\n const { logErrorIfDebugMode } = useDebug()\n const [selfBounds, setSelfBounds] = useState<undefined | Partial<DOMRect>>()\n const [needsUpdate, setNeedsUpdate] = useState(new Date())\n const selfRef = useRef(null)\n\n const [elem, setElem] = useState(document.querySelector(steps[selectedStep].selector))\n const boundingRect = useElemRect(elem, needsUpdate)\n const [lastBoundingRect, setLastBoundingRect] = useState<string>()\n const [showTooltipContainer, setShowTooltipContainer] = useState(!showHighlightOnly)\n const positionStyle =\n cssPosition != 'static'\n ? steps[selectedStep]?.props?.position\n ? steps[selectedStep].props.position\n : cssPosition\n : 'static'\n const zIndex = steps[selectedStep]?.props?.zIndex ?? 90\n const cardWidth = selfBounds?.width ?? DEFAULT_CARD_WIDTH\n const cardHeight = selfBounds?.height ?? DEFAULT_CARD_HEIGHT\n const [renderTime, setRenderTime] = useState(new Date().getTime())\n offset = cssPosition != 'static' ? steps[selectedStep]?.props?.offset ?? offset : { x: 0, y: 0 }\n\n const url = window.location.pathname.split('/').pop()\n\n useLayoutEffect(() => {\n if (selfRef.current) {\n setSelfBounds({\n width: selfRef.current.clientWidth,\n height: selfRef.current.clientHeight,\n })\n }\n }, [selectedStep, needsUpdate, positionStyle])\n\n useEffect(() => {\n if (!showHighlightOnly) {\n setShowTooltipContainer(true)\n }\n }, [selectedStep])\n\n useEffect(() => {\n if (visible && showTooltipContainer) {\n onViewTooltip(selectedStep)\n }\n }, [showTooltipContainer])\n\n const handleRefreshPosition = () => {\n if (positionStyle === 'static') {\n return\n }\n\n const elem = document.querySelector(steps[selectedStep].selector)\n if (!elem) {\n setLastBoundingRect(undefined)\n setElem(null)\n logErrorIfDebugMode(\n `FrigadeTour: Could not find element with selector \"${steps[selectedStep].selector}\" for step ${steps[selectedStep].id}`\n )\n return\n }\n if (lastBoundingRect && lastBoundingRect === JSON.stringify(elem?.getBoundingClientRect())) {\n return\n }\n setElem(elem)\n setNeedsUpdate(new Date())\n if (elem) {\n setLastBoundingRect(JSON.stringify(elem.getBoundingClientRect()))\n }\n }\n\n useEffect(() => {\n const observer = new MutationObserver(handleRefreshPosition)\n observer.observe(document.body, { subtree: true, childList: true })\n return () => observer.disconnect()\n }, [handleRefreshPosition])\n\n useEffect(() => {\n const observer = new MutationObserver(handleRefreshPosition)\n observer.observe(document.body, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['style', 'class'],\n })\n return () => observer.disconnect()\n }, [handleRefreshPosition])\n\n useEffect(() => {\n const intervalId = setInterval(() => {\n handleRefreshPosition()\n }, 10)\n return () => clearInterval(intervalId)\n }, [handleRefreshPosition])\n\n useLayoutEffect(() => {\n setTimeout(() => {\n handleRefreshPosition()\n }, DEFAULT_REFRESH_DELAY)\n\n handleRefreshPosition()\n }, [selectedStep, url])\n\n useEffect(() => {\n if (!visible) {\n return\n }\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n onDismiss()\n }\n }\n document.addEventListener('keydown', handleEscape)\n\n return () => {\n document.removeEventListener('keydown', handleEscape)\n }\n }, [])\n\n if (elem === null || !visible) {\n return null\n }\n\n let tooltipPositionValue: ToolTipPosition =\n tooltipPosition === 'auto' ? 'right' : (tooltipPosition as ToolTipPosition)\n\n let position = getPosition(boundingRect, tooltipPositionValue, cardWidth, offset, positionStyle)\n\n const rightSideIsCropped =\n boundingRect.right + cardWidth > (window.innerWidth || document.documentElement.clientWidth)\n const bottomIsCropped =\n boundingRect.bottom + DEFAULT_CARD_HEIGHT >\n (window.innerHeight || document.documentElement.clientHeight)\n\n if (rightSideIsCropped && tooltipPosition === 'auto') {\n position = getPosition(boundingRect, 'left', cardWidth, offset, positionStyle)\n tooltipPositionValue = 'left'\n }\n\n if (\n steps[selectedStep]?.props?.tooltipPosition &&\n steps[selectedStep]?.props?.tooltipPosition !== 'auto' &&\n (steps[selectedStep]?.props?.tooltipPosition === 'left' ||\n steps[selectedStep]?.props?.tooltipPosition === 'right')\n ) {\n tooltipPositionValue = steps[selectedStep].props.tooltipPosition\n }\n\n const DefaultFooterContent = () => {\n const handleOnCTAClick = () => {\n if (steps[selectedStep].handlePrimaryButtonClick) {\n steps[selectedStep].handlePrimaryButtonClick()\n setShowTooltipContainer(false)\n setTimeout(() => {\n handleRefreshPosition()\n }, 30)\n }\n if (completedStepsCount === steps.length - 1) {\n return onComplete()\n }\n }\n\n const handleOnSecondaryCTAClick = () => {\n if (steps[selectedStep].handleSecondaryButtonClick) {\n steps[selectedStep].handleSecondaryButtonClick()\n if (showHighlightOnly && !steps[selectedStep].secondaryButtonUri) {\n setShowTooltipContainer(false)\n }\n }\n }\n\n return (\n <>\n {showStepCount && steps.length > 1 && (\n <TooltipStepCountContainer>\n <TooltipStepCounter\n role=\"status\"\n className={getClassName('tooltipStepCounter', appearance)}\n >\n {selectedStep + 1} of {steps.length}\n </TooltipStepCounter>\n </TooltipStepCountContainer>\n )}\n {(steps[selectedStep].primaryButtonTitle || steps[selectedStep].secondaryButtonTitle) && (\n <TooltipCTAContainer\n showStepCount={showStepCount}\n className={getClassName('tooltipCTAContainer', appearance)}\n >\n {steps[selectedStep].secondaryButtonTitle && (\n <Button\n title={steps[selectedStep].secondaryButtonTitle}\n appearance={appearance}\n onClick={handleOnSecondaryCTAClick}\n size=\"small\"\n withMargin={false}\n secondary\n />\n )}\n {steps[selectedStep].primaryButtonTitle && (\n <Button\n title={steps[selectedStep].primaryButtonTitle}\n appearance={appearance}\n onClick={handleOnCTAClick}\n withMargin={false}\n size=\"small\"\n />\n )}\n </TooltipCTAContainer>\n )}\n </>\n )\n }\n\n const DefaultTooltipStepContent = () => {\n return (\n <>\n {dismissible && (\n <TooltipDismissButton\n data-testid=\"tooltip-dismiss\"\n onClick={() => {\n if (onDismiss) {\n onDismiss()\n }\n }}\n className={getClassName('tooltipClose', appearance)}\n hasImage={!!steps[selectedStep].imageUri || !!steps[selectedStep].videoUri}\n aria-label=\"Close Tooltip\"\n role=\"button\"\n tabIndex={0}\n >\n <Close />\n </TooltipDismissButton>\n )}\n {steps[selectedStep].imageUri && (\n <TooltipImageContainer\n dismissible={dismissible}\n appearance={appearance}\n role=\"img\"\n aria-label={steps[selectedStep].title}\n src={steps[selectedStep].imageUri}\n className={getClassName('tooltipImageContainer', appearance)}\n />\n )}\n {steps[selectedStep].videoUri && !steps[selectedStep].imageUri && (\n <TooltipVideoContainer\n dismissible={dismissible}\n appearance={appearance}\n role=\"video\"\n aria-label={steps[selectedStep].title}\n className={getClassName('tooltipVideoContainer', appearance)}\n >\n <VideoCard\n appearance={appearance}\n videoUri={steps[selectedStep].videoUri}\n autoplay={steps[selectedStep].props?.autoplayVideo}\n loop={steps[selectedStep].props?.loopVideo}\n hideControls={steps[selectedStep].props?.hideVideoControls}\n />\n </TooltipVideoContainer>\n )}\n <TooltipContentContainer className={getClassName('tooltipContentContainer', appearance)}>\n <TitleSubtitle\n appearance={appearance}\n title={steps[selectedStep].title}\n subtitle={steps[selectedStep].subtitle}\n size=\"small\"\n ariaPrefix={`Tooltip${steps[selectedStep].id}`}\n />\n <TooltipFooter className={getClassName('tooltipFooter', appearance)}>\n <DefaultFooterContent />\n </TooltipFooter>\n </TooltipContentContainer>\n </>\n )\n }\n\n const DEFAULT_CUSTOM_STEP_TYPES = {\n default: (_: StepData) => {\n if (steps[selectedStep]?.StepContent) {\n const Content: React.ReactNode = steps[selectedStep].StepContent\n return <div>{Content}</div>\n }\n\n return <DefaultTooltipStepContent />\n },\n }\n\n const mergedCustomStepTypes = { ...DEFAULT_CUSTOM_STEP_TYPES, ...customStepTypes }\n\n const StepContent = () => {\n if (!steps) return <></>\n if (!steps[selectedStep]?.type || !mergedCustomStepTypes[steps[selectedStep].type]) {\n return mergedCustomStepTypes['default'](steps[selectedStep])\n }\n return mergedCustomStepTypes[steps[selectedStep].type]({\n stepData: steps[selectedStep],\n primaryColor: primaryColor,\n })\n }\n\n if (steps[selectedStep].complete === true) {\n return null\n }\n\n // Do not position the tooltip until 10ms after the first render\n // This is to prevent the tooltip from appearing in the wrong place\n // when the page is loading\n if (position.x == 0 && position.y == 0 && new Date().getTime() - renderTime < 100) {\n return null\n }\n\n const cssPos = {\n top: position?.y - HIGHLIGHT_RADIUS ?? 0,\n left:\n (tooltipPositionValue == 'left'\n ? boundingRect.x + offset.x\n : position?.x - HIGHLIGHT_RADIUS) ?? 0,\n cursor: showHighlightOnly ? 'pointer' : 'default',\n position: positionStyle,\n }\n\n // Lock tooltip position to be within bounds of the window\n const getBoundedLeftPosition = () => {\n const spaceFromEdge = 20\n const leftOffset = cssPos.left + (tooltipPositionValue == 'left' ? -cardWidth : 24)\n\n return Math.min(\n Math.max(leftOffset, spaceFromEdge),\n window.innerWidth - cardWidth - spaceFromEdge\n )\n }\n\n const getBoundedTopPosition = () => {\n const tooltipBottom = cssPos.top + cardHeight\n const spaceFromEdge = 20\n if (tooltipBottom > window.innerHeight - spaceFromEdge) {\n return cssPos.top + -cardHeight\n }\n return cssPos.top\n }\n\n const handleClick = () => {\n if (showHighlightOnly) {\n setNeedsUpdate(new Date())\n setShowTooltipContainer(!showTooltipContainer)\n }\n }\n\n return (\n <TooltipWrapper className={className}>\n <HighlightContainer\n style={cssPos}\n zIndex={zIndex}\n className={getClassName('tourHighlightContainer', appearance)}\n >\n {showHighlight &&\n steps[selectedStep].showHighlight !== false &&\n cssPosition !== 'static' && (\n <>\n <HighlightInner\n style={{\n position: positionStyle,\n }}\n onClick={handleClick}\n primaryColor={appearance.theme.colorPrimary}\n className={getClassName('tourHighlightInnerCircle', appearance)}\n ></HighlightInner>\n <HighlightOuter\n style={{\n position: 'absolute',\n }}\n onClick={handleClick}\n primaryColor={appearance.theme.colorPrimary}\n className={getClassName('tourHighlightOuterCircle', appearance)}\n ></HighlightOuter>\n </>\n )}\n </HighlightContainer>\n <PositionWrapper\n style={{\n ...cssPos,\n left: getBoundedLeftPosition(),\n top: getBoundedTopPosition(),\n }}\n zIndex={zIndex + 1}\n className={getClassName('tooltipContainerWrapper', appearance)}\n >\n {showTooltipContainer && (\n <>\n <TooltipContainer\n ref={selfRef}\n role=\"dialog\"\n aria-labelledby={`frigadeTooltip${steps[selectedStep].id}Title`}\n aria-describedby={`frigadeTooltip${steps[selectedStep].id}Subtitle`}\n layoutId=\"tooltip-container\"\n tabIndex={0}\n aria-label=\"Tooltip\"\n style={{\n position: 'relative',\n width: 'max-content',\n right: 0,\n top: cssPosition !== 'static' ? 12 : 0,\n ...containerStyle,\n }}\n appearance={appearance}\n className={getClassName('tooltipContainer', appearance)}\n maxWidth={DEFAULT_CARD_WIDTH}\n zIndex={zIndex + 10}\n >\n <StepContent />\n </TooltipContainer>\n {showFrigadeBranding && (\n <PoweredByFrigadeTooltipRibbon\n className={getClassName('poweredByFrigadeTooltipRibbon', appearance)}\n appearance={appearance}\n zIndex={zIndex + 10}\n >\n <PoweredByFrigade appearance={appearance} />\n </PoweredByFrigadeTooltipRibbon>\n )}\n </>\n )}\n </PositionWrapper>\n </TooltipWrapper>\n )\n}\n\nexport default Tooltips\n","import { ToolTipPosition } from './Tooltips'\nimport { useCallback, useEffect, useState } from 'react'\n\ntype Point = {\n x: number\n y: number\n}\n\nexport const getPosition = (\n boundingRect: DOMRect,\n position: ToolTipPosition,\n cardWidth: number,\n offset: Point = { x: 20, y: 20 },\n positionStyle: string\n): Point => {\n const scrollY = positionStyle == 'fixed' ? 0 : window.scrollY\n const scrollX = positionStyle == 'fixed' ? 0 : window.scrollX\n\n if (position === 'left') {\n return {\n x: boundingRect.left - cardWidth + offset.x + scrollX,\n y: boundingRect.top - offset.y + scrollY,\n }\n } else if (position === 'right') {\n return {\n x: boundingRect.left + boundingRect.width + offset.x + scrollX,\n y: boundingRect.top - offset.y + scrollY,\n }\n }\n\n return { x: 0, y: 0 }\n}\n\nexport function useElemRect(elem: Element | undefined, refresher?: any): DOMRect {\n // Spoof DOMRect for server renders\n const initialRect =\n 'DOMRect' in globalThis\n ? new DOMRect()\n : {\n height: 0,\n width: 0,\n x: 0,\n y: 0,\n bottom: 0,\n top: 0,\n right: 0,\n left: 0,\n toJSON: () => {},\n }\n\n const [dimensions, setDimensions] = useState(initialRect)\n const handleResize = useCallback(() => {\n if (!elem) return\n setDimensions(elem.getBoundingClientRect())\n }, [elem])\n\n useEffect(() => {\n handleResize()\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [elem, refresher])\n\n return dimensions\n}\n","import { useContext, useState } from 'react'\nimport { FrigadeContext } from '../FrigadeProvider'\n\nexport function useDebug() {\n const { debug } = useContext(FrigadeContext)\n const [logMessages, setLogMessages] = useState<string[]>([])\n\n function logIfDebugMode(message) {\n if (!debug) {\n return\n }\n if (logMessages.find((m) => m === message)) {\n return\n }\n setLogMessages([...logMessages, message])\n console.log(message)\n }\n\n function logErrorIfDebugMode(message) {\n if (!debug) {\n return\n }\n if (logMessages.find((m) => m === message)) {\n return\n }\n setLogMessages([...logMessages, message])\n console.warn(message)\n }\n\n return {\n logIfDebugMode,\n logErrorIfDebugMode,\n }\n}\n","import React, { FC, useEffect, useRef, useState } from 'react'\n\nimport { DefaultFrigadeFlowProps, StepData } from '../types'\nimport { useFlows } from '../api/flows'\nimport { Portal } from 'react-portal'\nimport {\n FloatingWidgetButton,\n FloatingWidgetContainer,\n FloatingWidgetMenu,\n FlowWidgetMenuItem,\n SupportButton,\n SupportIconContainer,\n SupportTitle,\n} from './styled'\nimport { Question } from '../components/Icons/Question'\nimport { getClassName } from '../shared/appearance'\nimport { QuestionCircle } from '../components/Icons/QuestionCircle'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { useTheme } from '../hooks/useTheme'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\n\nexport interface FrigadeSupportWidgetProps extends DefaultFrigadeFlowProps {\n type?: 'floating' | 'inline'\n visible?: boolean\n title?: string\n}\n\nexport const FrigadeSupportWidget: FC<FrigadeSupportWidgetProps> = ({\n flowId,\n style,\n onStepCompletion,\n visible = true,\n type = 'inline',\n title = 'Help',\n appearance,\n}) => {\n const {\n getFlow,\n getFlowSteps,\n markStepCompleted,\n getStepStatus,\n getNumberOfStepsCompleted,\n isLoading,\n targetingLogicShouldHideFlow,\n } = useFlows()\n const { primaryCTAClickSideEffects } = useCTAClickSideEffects()\n const wrapperRef = useRef(null)\n const [showMenu, setShowMenu] = useState(false)\n const { mergeAppearanceWithDefault } = useTheme()\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n // below is the same as componentDidMount and componentDidUnmount\n useEffect(() => {\n document.addEventListener('click', handleClickOutside, false)\n return () => {\n document.removeEventListener('click', handleClickOutside, false)\n }\n }, [])\n\n const handleClickOutside = (event) => {\n if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {\n setShowMenu(false)\n }\n }\n\n if (isLoading) {\n return null\n }\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n const steps: StepData[] = getFlowSteps(flowId)\n if (!steps) {\n return null\n }\n\n if (!visible) {\n return null\n }\n\n function handlePrimaryButtonClick(step: StepData, index: number) {\n if (\n !step.completionCriteria &&\n (step.autoMarkCompleted || step.autoMarkCompleted === undefined)\n ) {\n markStepCompleted(flowId, step.id)\n }\n primaryCTAClickSideEffects(step)\n if (onStepCompletion) {\n onStepCompletion(step, index)\n }\n setShowMenu(false)\n }\n\n function Menu() {\n return (\n showMenu && (\n <FloatingWidgetMenu\n className={getClassName('floatingWidgetMenu', appearance)}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.1 }}\n type={type}\n >\n {steps.map((step, index) => (\n <FlowWidgetMenuItem\n className={getClassName('floatingWidgetMenuItem', appearance)}\n key={index}\n onClick={() => handlePrimaryButtonClick(step, index)}\n >\n {step.title}\n </FlowWidgetMenuItem>\n ))}\n </FloatingWidgetMenu>\n )\n )\n }\n\n if (type == 'inline') {\n return (\n <span ref={wrapperRef}>\n <RenderInlineStyles appearance={appearance} />\n <SupportButton\n style={style}\n onClick={() => {\n setShowMenu(!showMenu)\n }}\n className={getClassName('supportButton', appearance)}\n >\n <SupportIconContainer className={getClassName('supportIconContainer', appearance)}>\n <QuestionCircle\n className={getClassName('supportIcon', appearance)}\n style={{ width: '18px', height: '18px' }}\n />\n </SupportIconContainer>\n <SupportTitle className={getClassName('supportButtonTitle', appearance)}>\n {title}\n </SupportTitle>\n </SupportButton>\n <Menu />\n </span>\n )\n }\n\n return (\n <Portal>\n <RenderInlineStyles appearance={appearance} />\n <FloatingWidgetContainer style={style} ref={wrapperRef}>\n <Menu />\n <FloatingWidgetButton\n onClick={() => {\n setShowMenu(!showMenu)\n }}\n whileHover={{ scale: 1.1 }}\n className={getClassName('floatingWidgetButton', appearance)}\n >\n <Question\n className={getClassName('floatingWidgetButtonIcon', appearance)}\n style={{ display: 'flex', width: '20px', height: '20px' }}\n />\n </FloatingWidgetButton>\n </FloatingWidgetContainer>\n </Portal>\n )\n}\n\nexport default FrigadeSupportWidget\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../shared/appearance'\n\nexport const SupportButton = styled.button`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n padding: 6px 10px;\n gap: 8px;\n\n background: #fafafa;\n border: 1px solid #d9d9d9;\n border-radius: 21px;\n font-size: 12px;\n :hover {\n opacity: 0.8;\n }\n }\n`\n\nexport const SupportTitle = styled.span`\n ${(props) => getCustomClassOverrides(props)} {\n font-size: 12px;\n display: inline-block;\n }\n`\nexport const SupportIconContainer = styled.span`\n ${(props) => getCustomClassOverrides(props)} {\n font-size: 12px;\n display: inline-block;\n }\n`\n\nexport const FloatingWidgetContainer = styled.div`\n position: fixed;\n right: 0;\n bottom: 0;\n margin-right: 24px;\n margin-bottom: 24px;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n z-index: 50;\n`\n\nexport const FloatingWidgetButton = styled.button`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n background-color: #ffffff;\n border: 1px solid #f5f5f5;\n }\n width: 50px;\n height: 50px;\n display: flex;\n align-content: center;\n align-items: center;\n justify-content: center;\n box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05), 0px 6px 16px rgba(0, 0, 0, 0.08),\n 0px 3px 6px -4px rgba(0, 0, 0, 0.12);\n border-radius: 45px;\n cursor: pointer;\n`\nexport const FloatingWidgetMenu = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n background: #ffffff;\n }\n\n display: flex;\n flex-direction: column;\n min-width: 200px;\n padding: 4px;\n box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05), 0px 6px 16px rgba(0, 0, 0, 0.08),\n 0px 3px 6px -4px rgba(0, 0, 0, 0.12);\n border-radius: 8px;\n margin-bottom: 22px;\n position: ${(props) => (props.type == 'inline' ? 'absolute' : 'relative')};\n top: ${(props) => (props.type == 'inline' ? '68px' : 0)};\n margin-left: ${(props) => (props.type == 'inline' ? '-127px' : 0)};\n`\n\nexport const FlowWidgetMenuItem = styled.button`\n ${(props) => getCustomClassOverrides(props)} {\n // Anything inside this block will be ignored if the user provides a custom class\n color: #434343;\n :hover {\n background-color: #f5f5f5;\n }\n }\n\n display: flex;\n border-radius: 8px;\n background-color: transparent;\n border: none;\n cursor: pointer;\n font-size: 14px;\n\n padding: 8px 12px;\n`\n","import React, { CSSProperties } from 'react'\n\nexport const Question = ({\n style,\n className,\n}: {\n color?: string\n style?: CSSProperties\n className?: string\n}) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"18\"\n fill=\"none\"\n viewBox=\"0 0 18 18\"\n style={style}\n className={className}\n >\n <path\n fill=\"currentColor\"\n 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\"\n ></path>\n </svg>\n)\n","import React, { CSSProperties } from 'react'\n\nexport const QuestionCircle = ({\n style,\n className,\n}: {\n color?: string\n style?: CSSProperties\n className?: string\n}) => (\n <svg\n style={style}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n 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\"\n />\n </svg>\n)\n","import { DefaultFrigadeFlowProps } from '../types'\nimport React, { useEffect } from 'react'\nimport { useFlows } from '../api/flows'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { useTheme } from '../hooks/useTheme'\nimport { COMPLETED_FLOW } from '../api/common'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport { CallToActionContainer, DismissButton, EmbeddedTipContainer, TextContainer } from './styled'\nimport { getClassName, mergeClasses } from '../shared/appearance'\nimport { Close } from '../components/Icons/Close'\nimport { TitleSubtitle } from '../components/TitleSubtitle/TitleSubtitle'\nimport { Button } from '../components/Button'\nimport { useFlowImpressions } from '../hooks/useFlowImpressions'\nimport { MediaContainer } from '../FrigadeAnnouncement/styled'\nimport { Media } from '../components/Media'\n\nexport interface FrigadeEmbeddedTipProps extends DefaultFrigadeFlowProps {\n dismissible?: boolean\n /**\n * Handler for when the container is clicked\n */\n onClick?: () => void\n}\n\nexport const FrigadeEmbeddedTip: React.FC<FrigadeEmbeddedTipProps> = ({\n flowId,\n onDismiss,\n customVariables,\n onButtonClick,\n appearance,\n className,\n style,\n dismissible,\n onClick,\n}) => {\n const {\n getFlow,\n markFlowCompleted,\n markFlowSkipped,\n markStepCompleted,\n isLoading,\n targetingLogicShouldHideFlow,\n updateCustomVariables,\n getFlowSteps,\n getFlowStatus,\n getCurrentStepIndex,\n } = useFlows()\n const { primaryCTAClickSideEffects, secondaryCTAClickSideEffects } = useCTAClickSideEffects()\n const { mergeAppearanceWithDefault } = useTheme()\n useFlowImpressions(flowId)\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n if (isLoading) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (getFlowStatus(flowId) === COMPLETED_FLOW) {\n return null\n }\n\n const steps = getFlowSteps(flowId)\n\n const currentStep = steps[getCurrentStepIndex(flowId)]\n\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <EmbeddedTipContainer\n appearance={appearance}\n className={mergeClasses(getClassName('embeddedTipContainer', appearance), className)}\n style={style}\n onClick={onClick}\n >\n {(dismissible === true || currentStep.dismissible) && (\n <DismissButton\n onClick={async () => {\n await markFlowSkipped(flowId)\n if (onDismiss) {\n onDismiss()\n }\n }}\n className={getClassName('embeddedTipDismissButton', appearance)}\n >\n <Close />\n </DismissButton>\n )}\n {(currentStep.imageUri || currentStep.videoUri) && (\n <MediaContainer className={getClassName('embeddedTipMediaContainer', appearance)}>\n <Media appearance={appearance} stepData={currentStep} />\n </MediaContainer>\n )}\n <TextContainer className={getClassName('embeddedTipTextContainer', appearance)}>\n <TitleSubtitle\n size=\"small\"\n appearance={appearance}\n title={currentStep.title}\n subtitle={currentStep.subtitle}\n />\n </TextContainer>\n {(currentStep.primaryButtonTitle || currentStep.secondaryButtonTitle) && (\n <CallToActionContainer\n className={getClassName('embeddedTipCallToActionContainer', appearance)}\n >\n {currentStep.primaryButtonTitle && (\n <Button\n classPrefix=\"embeddedTip\"\n title={currentStep.primaryButtonTitle}\n appearance={appearance}\n withMargin={false}\n size=\"medium\"\n type=\"inline\"\n onClick={async () => {\n currentStep.handlePrimaryButtonClick()\n primaryCTAClickSideEffects(currentStep)\n if (onButtonClick) {\n const result = onButtonClick(\n currentStep,\n getCurrentStepIndex(flowId),\n 'primary'\n )\n if (result === false) {\n return\n }\n }\n await markStepCompleted(flowId, currentStep.id)\n await markFlowCompleted(flowId)\n }}\n />\n )}\n {currentStep.secondaryButtonTitle && (\n <Button\n classPrefix=\"embeddedTip\"\n title={currentStep.secondaryButtonTitle}\n appearance={appearance}\n withMargin={false}\n size=\"medium\"\n type=\"inline\"\n onClick={async () => {\n currentStep.handleSecondaryButtonClick()\n secondaryCTAClickSideEffects(currentStep)\n if (onButtonClick) {\n const result = onButtonClick(\n currentStep,\n getCurrentStepIndex(flowId),\n 'secondary'\n )\n if (result === false) {\n return\n }\n }\n }}\n secondary\n />\n )}\n </CallToActionContainer>\n )}\n </EmbeddedTipContainer>\n </>\n )\n}\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../shared/appearance'\n\nexport const EmbeddedTipContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: 400px;\n padding: 28px 18px;\n box-sizing: border-box;\n align-items: unset;\n background-color: ${(props) => props.appearance.theme.colorBackground};\n border-width: 1px;\n border-color: ${(props) => props.appearance.theme.colorBorder};\n border-radius: 12px;\n position: relative;\n }\n`\nexport const TextContainer = styled.div`\n display: flex;\n flex-direction: column;\n flex: 1;\n`\nexport const CallToActionContainer = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n margin-top: 16px;\n gap: 12px;\n`\n\nexport const DismissButton = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n position: absolute;\n top: 16px;\n right: 16px;\n cursor: pointer;\n\n :hover {\n opacity: 0.8;\n }\n }\n`\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../shared/appearance'\n\nexport const AnnouncementContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: 500px;\n box-sizing: border-box;\n align-items: unset;\n background-color: ${(props) => props.appearance.theme.colorBackground};\n position: relative;\n }\n`\nexport const TextContainer = styled.div`\n display: flex;\n flex-direction: column;\n flex: 1;\n`\n\nexport const PaginationContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n margin-bottom: 12px;\n margin-top: 4px;\n`\n\nexport const CallToActionContainer = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: stretch;\n gap: 16px;\n margin-top: 8px;\n`\n\nexport const MediaContainer = styled.div`\n margin-top: 16px;\n margin-bottom: 16px;\n`\n\nexport const DismissButton = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n position: absolute;\n top: -16px;\n right: -16px;\n cursor: pointer;\n\n :hover {\n opacity: 0.8;\n }\n }\n`\n\nexport const HeaderTitle = styled.h1`\n ${(props) => getCustomClassOverrides(props)} {\n font-style: normal;\n justify-content: center;\n text-align: center;\n font-size: 18px;\n font-weight: 700;\n line-height: 24px; /* 125% */\n letter-spacing: 0.36px;\n display: flex;\n align-items: center;\n color: ${(props) => props.appearance.theme.colorText};\n margin-bottom: 8px;\n }\n`\n\nexport const HeaderSubtitle = styled.h2`\n ${(props) => getCustomClassOverrides(props)} {\n font-style: normal;\n justify-content: center;\n text-align: center;\n font-weight: 400;\n color: ${(props) => props.appearance.theme.colorTextSecondary};\n font-size: 14px;\n line-height: 22px; /* 150% */\n letter-spacing: 0.28px;\n margin-bottom: 8px;\n }\n`\n","import { Appearance, StepData } from '../../types'\nimport { VideoCard } from '../Video/VideoCard'\nimport React from 'react'\nimport styled from 'styled-components'\nimport { getClassName } from '../../shared/appearance'\n\nexport const Image = styled.img`\n width: 100%;\n height: 100%;\n min-height: 200px;\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n`\n\nexport function Media({\n stepData,\n appearance,\n classPrefix = '',\n}: {\n stepData: StepData\n appearance: Appearance\n classPrefix?: string\n}) {\n if (stepData.videoUri) {\n return (\n <VideoCard\n appearance={appearance}\n videoUri={stepData.videoUri}\n autoplay={stepData.props?.autoplayVideo}\n loop={stepData.props?.loopVideo}\n hideControls={stepData.props?.hideVideoControls}\n />\n )\n }\n\n if (stepData.imageUri) {\n return (\n <Image\n className={getClassName(`${classPrefix}image`, appearance)}\n appearance={appearance}\n src={stepData.imageUri}\n />\n )\n }\n\n return null\n}\n","import React, { useEffect } from 'react'\n\nimport { useFlows } from '../api/flows'\nimport { DefaultFrigadeFlowProps, StepData } from '../types'\nimport { COMPLETED_FLOW } from '../api/common'\nimport {\n BannerContainer,\n CallToActionContainer,\n DismissButton,\n DismissButtonContainer,\n IconContainer,\n TextContainer,\n} from './styled'\nimport { Info } from '../components/Icons/Info'\nimport { Button } from '../components/Button'\nimport { Close } from '../components/Icons/Close'\nimport { getClassName } from '../shared/appearance'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { TitleSubtitle } from '../components/TitleSubtitle/TitleSubtitle'\nimport { useTheme } from '../hooks/useTheme'\nimport { useFlowImpressions } from '../hooks/useFlowImpressions'\n\nexport type FrigadeBannerType = 'full-width' | 'square'\n\nexport interface FrigadeBannerProps extends DefaultFrigadeFlowProps {\n /**\n * full-width: Full width banner, useful in top of the page.\n *\n * square: Square sized banner, useful in sidebars\n */\n type?: FrigadeBannerType\n title?: string\n subtitle?: string\n onDismiss?: () => void\n /**\n * Icon to use in the banner\n */\n icon?: React.ReactNode\n /**\n * Handler for when the banner container is clicked\n */\n onClick?: () => void\n}\n\nexport const FrigadeBanner: React.FC<FrigadeBannerProps> = ({\n flowId,\n title,\n subtitle,\n onDismiss,\n customVariables,\n onButtonClick,\n appearance,\n type = 'full-width',\n icon,\n onClick,\n}) => {\n const {\n getFlow,\n markFlowCompleted,\n markFlowSkipped,\n isLoading,\n targetingLogicShouldHideFlow,\n updateCustomVariables,\n getFlowMetadata,\n getFlowStatus,\n getFlowSteps,\n getCurrentStepIndex,\n } = useFlows()\n const { primaryCTAClickSideEffects } = useCTAClickSideEffects()\n const { mergeAppearanceWithDefault } = useTheme()\n useFlowImpressions(flowId)\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n if (isLoading) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (getFlowStatus(flowId) === COMPLETED_FLOW) {\n return null\n }\n\n const steps = getFlowSteps(flowId)\n\n const metaData = (\n steps.length > 0 ? steps[getCurrentStepIndex(flowId)] : getFlowMetadata(flowId)\n ) as StepData\n\n if (metaData?.title) {\n title = metaData.title\n }\n if (metaData?.subtitle) {\n subtitle = metaData.subtitle\n }\n\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <BannerContainer\n type={type}\n appearance={appearance}\n className={getClassName('bannerContainer', appearance)}\n onClick={onClick}\n >\n {type != 'square' && (\n <IconContainer className={getClassName('bannerIconContainer', appearance)}>\n {icon ? icon : <Info />}\n </IconContainer>\n )}\n {type === 'square' && metaData.dismissible && (\n <DismissButtonContainer\n type={type}\n className={getClassName('bannerDismissButtonContainer', appearance)}\n >\n <DismissButton\n type={type}\n onClick={async () => {\n await markFlowSkipped(flowId)\n if (onDismiss) {\n onDismiss()\n }\n }}\n className={getClassName('bannerDismissButton', appearance)}\n >\n <Close />\n </DismissButton>\n </DismissButtonContainer>\n )}\n <TextContainer type={type} className={getClassName('bannerTextContainer', appearance)}>\n <TitleSubtitle\n appearance={appearance}\n title={title}\n subtitle={subtitle}\n classPrefix=\"banner\"\n />\n </TextContainer>\n {metaData?.primaryButtonTitle && (\n <CallToActionContainer\n type={type}\n className={getClassName('bannerCallToActionContainer', appearance)}\n >\n <Button\n title={metaData?.primaryButtonTitle}\n appearance={appearance}\n onClick={() => {\n primaryCTAClickSideEffects(metaData)\n if (onButtonClick) {\n onButtonClick(metaData, 0, 'primary')\n }\n }}\n classPrefix=\"banner\"\n />\n </CallToActionContainer>\n )}\n {type !== 'square' && metaData.dismissible && (\n <DismissButtonContainer\n type={type}\n className={getClassName('bannerDismissButtonContainer', appearance)}\n >\n <DismissButton\n type={type}\n onClick={async () => {\n await markFlowSkipped(flowId)\n if (onDismiss) {\n onDismiss()\n }\n }}\n className={getClassName('bannerDismissButton', appearance)}\n >\n <Close />\n </DismissButton>\n </DismissButtonContainer>\n )}\n </BannerContainer>\n </>\n )\n}\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../shared/appearance'\n\nexport const BannerContainer = styled.div`\n // use the :not annotation\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n flex-direction: ${(props) => (props.type === 'square' ? 'column' : 'row')};\n width: 100%;\n padding: 16px;\n box-sizing: border-box;\n align-items: ${(props) => (props.type === 'square' ? 'unset' : 'center')};\n background-color: ${(props) => props.appearance.theme.colorBackground};\n border-radius: 12px;\n }\n`\n\nexport const IconContainer = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n display: flex;\n width: 46px;\n height: 46px;\n }\n`\n\nexport const TextContainer = styled.div`\n display: flex;\n flex-direction: column;\n flex: 1;\n margin-left: ${(props) => (props.type === 'square' ? '0px' : '16px')};\n margin-top: ${(props) => (props.type === 'square' ? '12px' : '0')};\n`\nexport const CallToActionContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-left: ${(props) => (props.type === 'square' ? '0px' : '16px')};\n`\n\nexport const DismissButton = styled.div`\n display: flex;\n justify-content: ${(props) => (props.type === 'square' ? 'flex-end' : 'center')};\n align-items: flex-end;\n cursor: pointer;\n :hover {\n opacity: 0.8;\n }\n`\n\nexport const DismissButtonContainer = styled.div`\n display: flex;\n justify-content: ${(props) => (props.type === 'square' ? 'flex-end' : 'center')};\n align-items: flex-end;\n margin-left: ${(props) => (props.type === 'square' ? '0px' : '16px')};\n`\n","import React, { CSSProperties } from 'react'\n\nexport const Info = ({\n style,\n className,\n}: {\n color?: string\n style?: CSSProperties\n className?: string\n}) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"46\"\n height=\"46\"\n fill=\"none\"\n viewBox=\"0 0 46 46\"\n style={style}\n className={className}\n >\n <circle cx=\"23\" cy=\"23\" r=\"23\" fill=\"#E6F1FF\"></circle>\n <path\n stroke=\"#0171F8\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n d=\"M32 18.5l-2.25-1.313M32 18.5v2.25m0-2.25l-2.25 1.313M14 18.5l2.25-1.313M14 18.5l2.25 1.313M14 18.5v2.25m9 3l2.25-1.313M23 23.75l-2.25-1.313M23 23.75V26m0 6.75l2.25-1.313M23 32.75V30.5m0 2.25l-2.25-1.313m0-16.875L23 13.25l2.25 1.313M32 25.25v2.25l-2.25 1.313m-13.5 0L14 27.5v-2.25\"\n ></path>\n </svg>\n)\n","import { DefaultFrigadeFlowProps } from '../types'\nimport React, { useEffect } from 'react'\nimport { useFlows } from '../api/flows'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { useTheme } from '../hooks/useTheme'\nimport { COMPLETED_FLOW } from '../api/common'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport { Portal } from 'react-portal'\nimport {\n DismissButton,\n NPSCTAContainer,\n NPSLabel,\n NPSLabelContainer,\n NPSNumberButton,\n NPSNumberButtonContainer,\n NPSSurveyContainer,\n TextArea,\n TextContainer,\n} from './styled'\nimport { getClassName, mergeClasses } from '../shared/appearance'\nimport { Close } from '../components/Icons/Close'\nimport { TitleSubtitle } from '../components/TitleSubtitle/TitleSubtitle'\nimport { useFlowOpens } from '../api/flow-opens'\nimport { Button } from '../components/Button'\nimport { useFlowImpressions } from '../hooks/useFlowImpressions'\nimport { removeHTMLChars, sanitize } from '../shared/sanitizer'\n\nexport interface FrigadeNPSSurveyProps extends DefaultFrigadeFlowProps {\n dismissible?: boolean\n type?: 'inline' | 'modal'\n}\n\nexport const FrigadeNPSSurvey: React.FC<FrigadeNPSSurveyProps> = ({\n flowId,\n onDismiss,\n customVariables,\n onButtonClick,\n appearance,\n className,\n style,\n type = 'modal',\n}) => {\n const {\n getFlow,\n markFlowCompleted,\n markFlowSkipped,\n markStepCompleted,\n getNumberOfStepsCompleted,\n isLoading,\n targetingLogicShouldHideFlow,\n updateCustomVariables,\n getFlowSteps,\n getFlowStatus,\n getFlowMetadata,\n markStepNotStarted,\n } = useFlows()\n const { primaryCTAClickSideEffects } = useCTAClickSideEffects()\n const { mergeAppearanceWithDefault } = useTheme()\n const [score, setScore] = React.useState<number | null>(null)\n const [feedbackText, setFeedbackText] = React.useState<string>('')\n const metadata = getFlowMetadata(flowId)\n const numberOfStepsCompleted = getNumberOfStepsCompleted(flowId)\n const {\n hasOpenModals,\n setKeepCompletedFlowOpenDuringSession,\n shouldKeepCompletedFlowOpenDuringSession,\n } = useFlowOpens()\n useFlowImpressions(flowId)\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n if (isLoading) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (getFlowStatus(flowId) === COMPLETED_FLOW) {\n return null\n }\n\n if (hasOpenModals()) {\n return null\n }\n\n const steps = getFlowSteps(flowId)\n\n const currentStep = steps[getNumberOfStepsCompleted(flowId)]\n\n function getScoreChooser() {\n return (\n <>\n <TextContainer>\n <TitleSubtitle\n size=\"large\"\n appearance={appearance}\n title={currentStep.title}\n subtitle={currentStep.subtitle}\n />\n </TextContainer>\n <NPSNumberButtonContainer\n className={getClassName('npsNumberButtonContainer', appearance)}\n appearance={appearance}\n >\n {Array.from(Array(11).keys()).map((i) => (\n <NPSNumberButton\n className={getClassName('npsNumberButton', appearance)}\n selected={score === i}\n key={i}\n onClick={async () => {\n setKeepCompletedFlowOpenDuringSession(flowId)\n setScore(i)\n await markStepCompleted(flowId, currentStep.id, { score: i })\n }}\n appearance={appearance}\n >\n {i}\n </NPSNumberButton>\n ))}\n </NPSNumberButtonContainer>\n <NPSLabelContainer appearance={appearance}>\n <NPSLabel\n appearance={appearance}\n dangerouslySetInnerHTML={sanitize(metadata?.negativeLabel ?? `Not likely at all`)}\n />\n <NPSLabel\n appearance={appearance}\n dangerouslySetInnerHTML={sanitize(metadata?.positiveLabel ?? `Extremely likely`)}\n />\n </NPSLabelContainer>\n </>\n )\n }\n\n function getScoreReason() {\n return (\n <>\n <TextContainer>\n <TitleSubtitle\n appearance={appearance}\n title={currentStep.title ?? `Why did you choose this score?`}\n subtitle={currentStep.subtitle ?? undefined}\n size=\"large\"\n />\n </TextContainer>\n <TextArea\n appearance={appearance}\n value={feedbackText}\n onChange={(e) => {\n setFeedbackText(e.target.value)\n }}\n placeholder={\n removeHTMLChars(currentStep.placeholder) ?? 'Add your optional feedback here...'\n }\n ></TextArea>\n <NPSNumberButtonContainer\n appearance={appearance}\n className={getClassName('npsNumberButtonContainer', appearance)}\n >\n {currentStep.backButtonTitle && (\n <Button\n size={'large'}\n withMargin={false}\n onClick={async () => {\n markStepNotStarted(flowId, steps[0].id)\n markStepNotStarted(flowId, currentStep.id)\n }}\n appearance={appearance}\n title={currentStep.backButtonTitle}\n secondary\n />\n )}\n <NPSCTAContainer\n appearance={appearance}\n className={getClassName('npsCTAContainer', appearance)}\n >\n <Button\n size={'large'}\n withMargin={false}\n onClick={async () => {\n await markFlowCompleted(flowId)\n if (onButtonClick) {\n onButtonClick(currentStep, 1, 'primary')\n }\n }}\n appearance={appearance}\n title={currentStep.secondaryButtonTitle || 'Skip'}\n secondary\n />\n <Button\n size={'large'}\n withMargin={false}\n onClick={async () => {\n await markStepCompleted(flowId, currentStep.id, { feedbackText })\n await markFlowCompleted(flowId)\n if (onButtonClick) {\n onButtonClick(currentStep, 1, 'primary')\n }\n }}\n appearance={appearance}\n title={currentStep.primaryButtonTitle || 'Submit'}\n />\n </NPSCTAContainer>\n </NPSNumberButtonContainer>\n </>\n )\n }\n\n function getContent() {\n if (getNumberOfStepsCompleted(flowId) >= 2) {\n return null\n }\n\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <NPSSurveyContainer\n appearance={appearance}\n className={mergeClasses(getClassName('npsSurveyContainer', appearance), className)}\n style={style}\n type={type}\n >\n <DismissButton\n onClick={async () => {\n await markFlowSkipped(flowId)\n if (onDismiss) {\n onDismiss()\n }\n }}\n className={getClassName('npsSurveyDismissButton', appearance)}\n >\n <Close />\n </DismissButton>\n {getNumberOfStepsCompleted(flowId) == 0 && getScoreChooser()}\n {getNumberOfStepsCompleted(flowId) == 1 && getScoreReason()}\n </NPSSurveyContainer>\n </>\n )\n }\n\n if (type === 'inline') {\n return getContent()\n }\n\n return <Portal>{getContent()}</Portal>\n}\n","import styled from 'styled-components'\nimport { getCustomClassOverrides } from '../shared/appearance'\n\nexport const NPSSurveyContainer = styled.div`\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: 650px;\n padding: 28px 18px;\n box-sizing: border-box;\n align-items: unset;\n background-color: ${(props) => props.appearance.theme.colorBackground};\n position: ${(props) => (props.type == 'modal' ? 'fixed' : 'relative')};\n\n min-width: 600px;\n\n ${(props) =>\n props.type == 'modal'\n ? `\n left: 50%;\n transform: translate(-50%);\n bottom: 24px;\n z-index: 1000;\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);\n border-width: 1px;\n border-color: ${(props) => props.appearance.theme.colorBorder};\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;`\n : ''}\n`\n\nexport const NPSNumberButton = styled.button`\n border: 1px solid ${(props) => props.appearance.theme.colorBorder};\n border-radius: 8px;\n // If selected make border color primary and text color color priamry\n border-color: ${(props) =>\n props.selected ? props.appearance.theme.colorPrimary : props.appearance.theme.colorBorder};\n color: ${(props) =>\n props.selected ? props.appearance.theme.colorPrimary : props.appearance.theme.colorText};\n :hover {\n border-color: ${(props) => props.appearance.theme.colorPrimary};\n }\n :focus {\n border-color: ${(props) => props.appearance.theme.colorPrimary};\n color: ${(props) => props.appearance.theme.colorPrimary};\n }\n font-size: 16px;\n font-weight: 600;\n line-height: 24px;\n width: 44px;\n height: 44px;\n display: flex;\n justify-content: center;\n align-items: center;\n`\n\nexport const NPSNumberButtonContainer = styled.div`\n display: flex;\n justify-content: space-between;\n margin-top: 16px;\n gap: 8px;\n`\n\nexport const NPSLabelContainer = styled.div`\n display: flex;\n justify-content: space-between;\n margin-top: 8px;\n`\n\nexport const NPSLabel = styled.div`\n font-size: 12px;\n line-height: 18px;\n color: ${(props) => props.appearance.theme.colorTextDisabled};\n font-style: normal;\n font-weight: 400;\n letter-spacing: 0.24px;\n`\n\nexport const TextContainer = styled.div`\n display: flex;\n flex-direction: column;\n flex: 1;\n`\nexport const CallToActionContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n margin-top: 16px;\n`\n\nexport const TextArea = styled.textarea`\n ${(props) => getCustomClassOverrides(props)} {\n color: ${(props) => props.appearance.theme.colorText};\n margin-top: 16px;\n border: 1px solid ${(props) => props.appearance.theme.colorBorder};\n border-radius: ${(props) => props.appearance.theme.borderRadius}px;\n padding: 12px 16px;\n font-size: 16px;\n line-height: 24px;\n width: 100%;\n height: 100px;\n resize: none;\n box-sizing: border-box;\n }\n`\n\nexport const DismissButton = styled.div`\n ${(props) => getCustomClassOverrides(props)} {\n position: absolute;\n top: 16px;\n right: 16px;\n cursor: pointer;\n\n :hover {\n opacity: 0.8;\n }\n }\n`\n\nexport const NPSCTAContainer = styled.div`\n display: flex;\n flex-wrap: nowrap;\n gap: 8px;\n display: flex;\n`\n","import { DefaultFrigadeFlowProps } from '../types'\nimport React, { CSSProperties, useEffect } from 'react'\nimport { useFlows } from '../api/flows'\nimport { useCTAClickSideEffects } from '../hooks/useCTAClickSideEffects'\nimport { useTheme } from '../hooks/useTheme'\nimport { COMPLETED_FLOW } from '../api/common'\nimport { RenderInlineStyles } from '../components/RenderInlineStyles'\nimport {\n AnnouncementContainer,\n CallToActionContainer,\n DismissButton,\n HeaderSubtitle,\n HeaderTitle,\n MediaContainer,\n PaginationContainer,\n TextContainer,\n} from './styled'\nimport { getClassName, mergeClasses } from '../shared/appearance'\nimport { Close } from '../components/Icons/Close'\nimport { Button } from '../components/Button'\nimport { Modal } from '../components/Modal'\nimport { CornerModal } from '../components/CornerModal'\nimport { useFlowOpens } from '../api/flow-opens'\nimport { Media } from '../components/Media'\nimport { sanitize } from '../shared/sanitizer'\nimport { useFlowImpressions } from '../hooks/useFlowImpressions'\nimport { FormPagination } from '../FrigadeForm/FormPagination'\n\nexport interface FrigadeAnnouncementProps extends DefaultFrigadeFlowProps {\n dismissible?: boolean\n /**\n * Indicates the position of the modal if the form type is a modal. Default is center.\n */\n modalPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center' | 'inline'\n /**\n * Show a pagination indicator at the bottom of the announcement when using more than 1 page. Default is true.\n */\n showPagination?: boolean\n /**\n * Whether to allow the user to navigate back to previous steps. Default is false.\n * The title of the button can be controlled by the `backButtonTitle` prop on the step.\n */\n allowBackNavigation?: boolean\n}\n\nexport const FrigadeAnnouncement: React.FC<FrigadeAnnouncementProps> = ({\n flowId,\n onDismiss,\n customVariables,\n onButtonClick,\n appearance,\n className,\n style,\n dismissible = true,\n modalPosition = 'center',\n showPagination = true,\n allowBackNavigation,\n}) => {\n const {\n getFlow,\n markFlowCompleted,\n markFlowSkipped,\n markStepCompleted,\n markStepStarted,\n isLoading,\n targetingLogicShouldHideFlow,\n updateCustomVariables,\n getFlowSteps,\n getFlowStatus,\n getCurrentStepIndex,\n } = useFlows()\n const { primaryCTAClickSideEffects, secondaryCTAClickSideEffects } = useCTAClickSideEffects()\n const { mergeAppearanceWithDefault } = useTheme()\n const { setOpenFlowState, getOpenFlowState, hasOpenModals } = useFlowOpens()\n useFlowImpressions(flowId)\n\n const [showModal, setShowModal] = [\n getOpenFlowState(flowId, true),\n (value) => setOpenFlowState(flowId, value),\n ]\n\n appearance = mergeAppearanceWithDefault(appearance)\n\n useEffect(() => {\n updateCustomVariables(customVariables)\n }, [customVariables, isLoading])\n\n if (isLoading) {\n return null\n }\n\n const flow = getFlow(flowId)\n if (!flow) {\n return null\n }\n\n if (targetingLogicShouldHideFlow(flow)) {\n return null\n }\n\n if (getFlowStatus(flowId) === COMPLETED_FLOW) {\n return null\n }\n\n if (hasOpenModals()) {\n return null\n }\n\n const steps = getFlowSteps(flowId)\n const currentStepIndex = getCurrentStepIndex(flowId)\n const totalSteps = steps.length\n\n const currentStep = steps[currentStepIndex]\n\n if (!currentStep) {\n return null\n }\n\n const handleClose = async () => {\n setShowModal(false)\n await markFlowSkipped(flowId)\n if (onDismiss) {\n onDismiss()\n }\n }\n\n function getContent() {\n return (\n <>\n <RenderInlineStyles appearance={appearance} />\n <AnnouncementContainer\n appearance={appearance}\n className={mergeClasses(getClassName('announcementContainer', appearance), className)}\n style={style}\n >\n {(dismissible === true || currentStep.dismissible) && modalPosition == 'inline' && (\n <DismissButton\n onClick={async () => {\n await markFlowSkipped(flowId)\n if (onDismiss) {\n onDismiss()\n }\n }}\n className={getClassName('announcementDismissButton', appearance)}\n >\n <Close />\n </DismissButton>\n )}\n <TextContainer className={getClassName('announcementTextContainer', appearance)}>\n <HeaderTitle\n appearance={appearance}\n className={getClassName('announcementTitle', appearance)}\n dangerouslySetInnerHTML={sanitize(currentStep.title)}\n />\n {currentStep.subtitle && (\n <HeaderSubtitle\n appearance={appearance}\n className={getClassName('announcementSubtitle', appearance)}\n dangerouslySetInnerHTML={sanitize(currentStep.subtitle)}\n />\n )}\n </TextContainer>\n {(currentStep.imageUri || currentStep.videoUri) && (\n <MediaContainer className={getClassName('announcementMediaContainer', appearance)}>\n <Media appearance={appearance} stepData={currentStep} />\n </MediaContainer>\n )}\n\n {showPagination && totalSteps > 1 && (\n <PaginationContainer\n className={getClassName('announcementPaginationContainer', appearance)}\n >\n <FormPagination\n className={getClassName('announcementPagination', appearance)}\n appearance={appearance}\n stepCount={totalSteps}\n currentStep={currentStepIndex}\n />\n </PaginationContainer>\n )}\n {(currentStep.primaryButtonTitle || currentStep.secondaryButtonTitle) && (\n <CallToActionContainer\n allowBackNavigation={allowBackNavigation}\n className={getClassName('announcementCTAContainer', appearance)}\n >\n {allowBackNavigation && currentStepIndex > 0 && (\n <Button\n classPrefix=\"announcementBack\"\n title={currentStep.backButtonTitle ?? 'Back'}\n appearance={appearance}\n withMargin={false}\n size=\"small\"\n type=\"full-width\"\n onClick={async () => {\n if (onButtonClick) {\n onButtonClick(currentStep, getCurrentStepIndex(flowId), 'back')\n }\n await markStepStarted(flowId, steps[currentStepIndex - 1].id)\n }}\n secondary\n />\n )}\n {currentStep.secondaryButtonTitle && (\n <Button\n classPrefix=\"announcement\"\n title={currentStep.secondaryButtonTitle}\n appearance={appearance}\n withMargin={false}\n size=\"small\"\n type=\"full-width\"\n onClick={async () => {\n currentStep.handleSecondaryButtonClick()\n secondaryCTAClickSideEffects(currentStep)\n if (onButtonClick) {\n onButtonClick(currentStep, getCurrentStepIndex(flowId), 'secondary')\n }\n }}\n secondary\n />\n )}\n {currentStep.primaryButtonTitle && (\n <Button\n classPrefix=\"announcement\"\n title={currentStep.primaryButtonTitle}\n appearance={appearance}\n withMargin={false}\n size=\"small\"\n type={'full-width'}\n onClick={async () => {\n primaryCTAClickSideEffects(currentStep)\n if (onButtonClick) {\n const result = onButtonClick(\n currentStep,\n getCurrentStepIndex(flowId),\n 'primary'\n )\n if (result === false) {\n return\n }\n }\n if (getCurrentStepIndex(flowId) === totalSteps - 1) {\n currentStep.handlePrimaryButtonClick()\n await markFlowCompleted(flowId)\n } else {\n currentStep.handlePrimaryButtonClick()\n }\n }}\n />\n )}\n </CallToActionContainer>\n )}\n </AnnouncementContainer>\n </>\n )\n }\n\n const overrideStyle: CSSProperties = {\n padding: '24px',\n maxWidth: '400px',\n }\n\n if (modalPosition === 'inline') {\n return getContent()\n }\n\n if (modalPosition !== 'center') {\n return (\n <CornerModal\n modalPosition={modalPosition}\n onClose={handleClose}\n visible={showModal}\n dismissible={dismissible}\n appearance={appearance}\n >\n {getContent()}\n </CornerModal>\n )\n }\n\n return (\n <Modal\n appearance={appearance}\n onClose={handleClose}\n visible={showModal}\n style={overrideStyle}\n dismissible={dismissible}\n >\n {getContent()}\n </Modal>\n )\n}\n","import * as React from 'react'\nimport { StyledButton } from './Button.styles'\nimport { BoxProps } from '../Box'\nimport { Text } from '../Text'\n\nimport { buttonVariants } from './Button.styles'\n\n// TEMP: Non-standard filename to avoid conflict with existing/deprecated button component\n\nexport interface ButtonProps extends BoxProps {\n title: string\n}\n\nconst BaseButton: React.FC<ButtonProps> = ({\n as = 'button',\n className,\n size = 'md',\n title,\n variant = 'Primary',\n ...rest\n}) => {\n return (\n <StyledButton\n className={`fr-button-${variant.toLowerCase()}${className ? ` ${className}` : ''}`}\n forwardedAs={as}\n variant={variant}\n size={size}\n borderRadius=\"md\"\n {...rest}\n >\n <Text color={buttonVariants[variant]?.color} fontWeight=\"semibold\">\n {title}\n </Text>\n </StyledButton>\n )\n}\n\nconst buttonVariantComponents = Object.fromEntries(\n Object.keys(buttonVariants).map((variant) => {\n const component = (props: ButtonProps) => <BaseButton {...props} variant={variant} />\n\n component.displayName = `Button.${variant}`\n\n return [variant, component]\n })\n)\n\nexport const Button = Object.assign(BaseButton, buttonVariantComponents)\n","import React from 'react'\nimport { FontProps } from 'styled-system'\nimport { BoxProps } from '../Box'\nimport { StyledText, textVariants } from './Text.styles'\n\ntype TextVariant = keyof typeof textVariants\nexport interface BaseTextProps extends BoxProps, Partial<Pick<FontProps, 'fontWeight'>> {\n variant?: TextVariant\n}\n\nconst BaseText: React.FC<BaseTextProps> = ({\n as = 'span',\n children,\n variant = 'Body1',\n ...rest\n}) => {\n return (\n <StyledText\n color=\"neutral.foreground\"\n fontFamily=\"default\"\n forwardedAs={as}\n variant={variant}\n {...rest}\n >\n {children}\n </StyledText>\n )\n}\n\nconst textVariantComponents = Object.fromEntries(\n Object.keys(textVariants).map((variant) => {\n const asProp = ['H1', 'H2', 'H3', 'H4'].includes(variant) ? variant.toLowerCase() : undefined\n const component = (props: BaseTextProps) => (\n <BaseText as={asProp} {...props} variant={variant as TextVariant}>\n {props.children}\n </BaseText>\n )\n\n component.displayName = `Text.${variant}`\n\n return [variant, component]\n })\n)\n\nexport const Text = Object.assign(BaseText, textVariantComponents)\n","import { MultipleChoice } from './components/Forms/MultiInputStepType/form-components/MultipleChoice'\n\nexport { FrigadeProvider } from './FrigadeProvider'\nexport { FrigadeHeroChecklist } from './components/HeroChecklist'\nexport { FrigadeChecklist } from './FrigadeChecklist'\nexport { FrigadeProgressBadge } from './FrigadeProgressBadge'\nexport { FrigadeForm } from './FrigadeForm'\nexport { FrigadeGuide } from './FrigadeGuide'\nexport { FrigadeTour } from './FrigadeTour'\nexport { FrigadeSupportWidget } from './FrigadeSupportWidget'\nexport { FrigadeEmbeddedTip } from './FrigadeEmbeddedTip'\nexport { FrigadeBanner } from './FrigadeBanner'\nexport { FrigadeNPSSurvey } from './FrigadeNPSSurvey'\nexport { FrigadeAnnouncement } from './FrigadeAnnouncement'\n\nexport type { BaseTheme as FrigadeTheme } from './types'\nexport { DefaultAppearance as FrigadeDefaultAppearance } from './types'\n\nexport { useFlows, Flow, FlowType } from './api/flows'\nexport { useFlowOpens } from './api/flow-opens'\nexport { useFlowResponses, FlowResponse, PublicStepState } from './api/flow-responses'\nexport { useUser } from './api/users'\nexport { useOrganization } from './api/organizations'\nexport { useUserFlowStates } from './api/user-flow-states'\n\nexport type { StepData, Appearance } from './types'\n\nexport type {\n CustomFormTypeProps,\n FormInputType,\n FormInputProps,\n FormValidationError,\n StepContentProps,\n EntityProperties,\n} from './FrigadeForm/types'\n\nexport { Label as FormLabel } from './components/Forms/MultiInputStepType/form-components/shared/Label'\nexport { TextField as FormTextField } from './components/Forms/MultiInputStepType/form-components/TextField'\n\nexport { Box } from './components/Box'\nexport { Button } from './components/Button/TEMP_index'\nexport { CheckBox } from './components/CheckBox'\nexport { ProgressRing } from './components/Progress/ProgressRing'\nexport { Text } from './components/Text'\nexport { ProgressBar } from './components/Checklists/Checklist/ProgressBar'\n\nexport { FrigadeBannerProps } from './FrigadeBanner'\nexport { FrigadeChecklistProps } from './FrigadeChecklist'\nexport { FrigadeEmbeddedTipProps } from './FrigadeEmbeddedTip'\nexport { FrigadeFormProps } from './FrigadeForm'\nexport { FrigadeTourProps } from './FrigadeTour'\nexport { FrigadeNPSSurveyProps } from './FrigadeNPSSurvey'\nexport { FrigadeAnnouncementProps } from './FrigadeAnnouncement'\nexport { FrigadeProgressBadgeProps } from './FrigadeProgressBadge'\n\nexport { MultipleChoice } from './components/Forms/MultiInputStepType/form-components/MultipleChoice'\nexport {\n MultipleChoiceOption,\n MultipleChoiceProps,\n} from './components/Forms/MultiInputStepType/form-components/MultipleChoice'\nexport { tokens } from './shared/theme'\n\nif (!String.prototype.replaceAll) {\n String.prototype.replaceAll = function (str: any, newStr: any) {\n // If a regex pattern\n if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') {\n return this.replace(str, newStr)\n }\n\n // If a string\n return this.replace(new RegExp(str, 'g'), newStr)\n }\n}\n"]}
|