diff --git a/frontend/__snapshots__/scenes-app-pipeline--pipeline-node-metrics--dark.png b/frontend/__snapshots__/scenes-app-pipeline--pipeline-node-metrics--dark.png index 464d167ebc9..d9f0e8a7698 100644 Binary files a/frontend/__snapshots__/scenes-app-pipeline--pipeline-node-metrics--dark.png and b/frontend/__snapshots__/scenes-app-pipeline--pipeline-node-metrics--dark.png differ diff --git a/frontend/__snapshots__/scenes-app-pipeline--pipeline-node-metrics--light.png b/frontend/__snapshots__/scenes-app-pipeline--pipeline-node-metrics--light.png index 035deadc308..265d4adeba1 100644 Binary files a/frontend/__snapshots__/scenes-app-pipeline--pipeline-node-metrics--light.png and b/frontend/__snapshots__/scenes-app-pipeline--pipeline-node-metrics--light.png differ diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodeSurvey.tsx b/frontend/src/scenes/notebooks/Nodes/NotebookNodeSurvey.tsx index 975e4299353..ec2ad6e2d0e 100644 --- a/frontend/src/scenes/notebooks/Nodes/NotebookNodeSurvey.tsx +++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodeSurvey.tsx @@ -80,11 +80,7 @@ const Component = ({ attributes }: NotebookNodeProps
- +
diff --git a/frontend/src/scenes/surveys/SurveyAppearancePreview.tsx b/frontend/src/scenes/surveys/SurveyAppearancePreview.tsx index 8ee8fc60b70..4fab2e38012 100644 --- a/frontend/src/scenes/surveys/SurveyAppearancePreview.tsx +++ b/frontend/src/scenes/surveys/SurveyAppearancePreview.tsx @@ -7,25 +7,23 @@ import { NewSurvey } from './constants' export function SurveyAppearancePreview({ survey, - activePreview, - questionIndex, + previewPageIndex, }: { survey: Survey | NewSurvey - activePreview: 'survey' | 'confirmation' - questionIndex: number + previewPageIndex: number }): JSX.Element { const surveyPreviewRef = useRef(null) const feedbackWidgetPreviewRef = useRef(null) useEffect(() => { if (surveyPreviewRef.current) { - renderSurveysPreview(survey, surveyPreviewRef.current, activePreview, questionIndex) + renderSurveysPreview(survey, surveyPreviewRef.current, previewPageIndex) } if (feedbackWidgetPreviewRef.current) { renderFeedbackWidgetPreview(survey, feedbackWidgetPreviewRef.current) } - }, [survey, activePreview, questionIndex]) + }, [survey, previewPageIndex]) return ( <>
diff --git a/frontend/src/scenes/surveys/SurveyEdit.tsx b/frontend/src/scenes/surveys/SurveyEdit.tsx index 3e6adecb89d..342885da76c 100644 --- a/frontend/src/scenes/surveys/SurveyEdit.tsx +++ b/frontend/src/scenes/surveys/SurveyEdit.tsx @@ -43,7 +43,7 @@ export default function SurveyEdit(): JSX.Element { urlMatchTypeValidationError, writingHTMLDescription, hasTargetingSet, - selectedQuestion, + selectedPageIndex, selectedSection, isEditingSurvey, targetingFlagFilters, @@ -52,7 +52,7 @@ export default function SurveyEdit(): JSX.Element { setSurveyValue, setWritingHTMLDescription, resetTargeting, - setSelectedQuestion, + setSelectedPageIndex, setSelectedSection, setFlagPropertyErrors, } = useActions(surveyLogic) @@ -70,7 +70,7 @@ export default function SurveyEdit(): JSX.Element { return clone.map((child) => ({ ...child })) } setSurveyValue('questions', move(survey.questions, oldIndex, newIndex)) - setSelectedQuestion(newIndex) + setSelectedPageIndex(newIndex) } return ( @@ -113,11 +113,7 @@ export default function SurveyEdit(): JSX.Element { left: '-1rem', }} > - +
{ - setSelectedQuestion(index) + setSelectedPageIndex(index) }} panels={[ ...survey.questions.map( @@ -193,7 +189,7 @@ export default function SurveyEdit(): JSX.Element { ), @@ -218,7 +214,7 @@ export default function SurveyEdit(): JSX.Element { data-attr="delete-survey-confirmation" onClick={(e) => { e.stopPropagation() - setSelectedQuestion( + setSelectedPageIndex( survey.questions.length - 1 ) setSurveyValue('appearance', { @@ -316,7 +312,7 @@ export default function SurveyEdit(): JSX.Element { ...survey.questions, { ...defaultSurveyFieldValues.open.questions[0] }, ]) - setSelectedQuestion(survey.questions.length) + setSelectedPageIndex(survey.questions.length) }} > Add question @@ -337,7 +333,7 @@ export default function SurveyEdit(): JSX.Element { ...survey.appearance, displayThankYouMessage: true, }) - setSelectedQuestion(survey.questions.length) + setSelectedPageIndex(survey.questions.length) }} > Add confirmation message @@ -651,9 +647,9 @@ export default function SurveyEdit(): JSX.Element {
setSelectedQuestion(preview)} + handleSetSelectedPageIndex={(pageIndex) => setSelectedPageIndex(pageIndex)} isEditingSurvey={isEditingSurvey} />
diff --git a/frontend/src/scenes/surveys/SurveyEditQuestionRow.tsx b/frontend/src/scenes/surveys/SurveyEditQuestionRow.tsx index ac903deb53e..c197b9bda37 100644 --- a/frontend/src/scenes/surveys/SurveyEditQuestionRow.tsx +++ b/frontend/src/scenes/surveys/SurveyEditQuestionRow.tsx @@ -19,7 +19,7 @@ import { surveyLogic } from './surveyLogic' type SurveyQuestionHeaderProps = { index: number survey: Survey | NewSurvey - setSelectedQuestion: (index: number) => void + setSelectedPageIndex: (index: number) => void setSurveyValue: (key: string, value: any) => void } @@ -32,7 +32,7 @@ const DragHandle = ({ listeners }: { listeners: DraggableSyntheticListeners | un export function SurveyEditQuestionHeader({ index, survey, - setSelectedQuestion, + setSelectedPageIndex, setSurveyValue, }: SurveyQuestionHeaderProps): JSX.Element { const { setNodeRef, attributes, transform, transition, listeners, isDragging } = useSortable({ @@ -69,7 +69,7 @@ export function SurveyEditQuestionHeader({ data-attr={`delete-survey-question-${index}`} onClick={(e) => { e.stopPropagation() - setSelectedQuestion(index <= 0 ? 0 : index - 1) + setSelectedPageIndex(index <= 0 ? 0 : index - 1) setSurveyValue( 'questions', survey.questions.filter((_, i) => i !== index) diff --git a/frontend/src/scenes/surveys/SurveyFormAppearance.tsx b/frontend/src/scenes/surveys/SurveyFormAppearance.tsx index 85d6729df63..8eb1f9502a6 100644 --- a/frontend/src/scenes/surveys/SurveyFormAppearance.tsx +++ b/frontend/src/scenes/surveys/SurveyFormAppearance.tsx @@ -7,33 +7,25 @@ import { SurveyAPIEditor } from './SurveyAPIEditor' import { SurveyAppearancePreview } from './SurveyAppearancePreview' interface SurveyFormAppearanceProps { - activePreview: number + previewPageIndex: number survey: NewSurvey | Survey - setActivePreview: (activePreview: number) => void + handleSetSelectedPageIndex: (activePreview: number) => void isEditingSurvey?: boolean } export function SurveyFormAppearance({ - activePreview, + previewPageIndex, survey, - setActivePreview, + handleSetSelectedPageIndex, }: SurveyFormAppearanceProps): JSX.Element { - const showThankYou = survey.appearance?.displayThankYouMessage && activePreview >= survey.questions.length - return survey.type !== SurveyType.API ? (
- + { - setActivePreview(activePreview) - }} + onChange={(pageIndex) => handleSetSelectedPageIndex(pageIndex)} className="mt-4 whitespace-nowrap" fullWidth - value={activePreview} + value={previewPageIndex} options={[ ...survey.questions.map((question, index) => ({ label: `${index + 1}. ${question.question ?? ''}`, diff --git a/frontend/src/scenes/surveys/SurveyTemplates.tsx b/frontend/src/scenes/surveys/SurveyTemplates.tsx index 047fa4118b0..1b63a1a9cb5 100644 --- a/frontend/src/scenes/surveys/SurveyTemplates.tsx +++ b/frontend/src/scenes/surveys/SurveyTemplates.tsx @@ -67,8 +67,7 @@ export function SurveyTemplates(): JSX.Element { }, } as Survey } - activePreview="survey" - questionIndex={0} + previewPageIndex={0} />
diff --git a/frontend/src/scenes/surveys/SurveyView.tsx b/frontend/src/scenes/surveys/SurveyView.tsx index d1127fd0e58..94efe9c2228 100644 --- a/frontend/src/scenes/surveys/SurveyView.tsx +++ b/frontend/src/scenes/surveys/SurveyView.tsx @@ -33,7 +33,7 @@ import { } from './surveyViewViz' export function SurveyView({ id }: { id: string }): JSX.Element { - const { survey, surveyLoading, selectedQuestion, targetingFlagFilters } = useValues(surveyLogic) + const { survey, surveyLoading, selectedPageIndex, targetingFlagFilters } = useValues(surveyLogic) const { editingSurvey, updateSurvey, @@ -41,7 +41,7 @@ export function SurveyView({ id }: { id: string }): JSX.Element { stopSurvey, archiveSurvey, resumeSurvey, - setSelectedQuestion, + setSelectedPageIndex, duplicateSurvey, } = useActions(surveyLogic) const { deleteSurvey } = useActions(surveysLogic) @@ -252,9 +252,11 @@ export function SurveyView({ id }: { id: string }): JSX.Element { {survey.type !== SurveyType.API ? (
setSelectedQuestion(preview)} + handleSetSelectedPageIndex={(preview) => + setSelectedPageIndex(preview) + } />
) : ( diff --git a/frontend/src/scenes/surveys/surveyLogic.tsx b/frontend/src/scenes/surveys/surveyLogic.tsx index cf49659ef98..e42394b7f5d 100644 --- a/frontend/src/scenes/surveys/surveyLogic.tsx +++ b/frontend/src/scenes/surveys/surveyLogic.tsx @@ -141,7 +141,7 @@ export const surveyLogic = kea([ archiveSurvey: true, setWritingHTMLDescription: (writingHTML: boolean) => ({ writingHTML }), setSurveyTemplateValues: (template: any) => ({ template }), - setSelectedQuestion: (idx: number | null) => ({ idx }), + setSelectedPageIndex: (idx: number | null) => ({ idx }), setSelectedSection: (section: SurveyEditSection | null) => ({ section }), resetTargeting: true, setFlagPropertyErrors: (errors: any) => ({ errors }), @@ -541,10 +541,10 @@ export const surveyLogic = kea([ }, }, ], - selectedQuestion: [ + selectedPageIndex: [ 0 as number | null, { - setSelectedQuestion: (_, { idx }) => idx, + setSelectedPageIndex: (_, { idx }) => idx, }, ], selectedSection: [ diff --git a/package.json b/package.json index a1fc1270ab3..21aefa9800c 100644 --- a/package.json +++ b/package.json @@ -146,7 +146,7 @@ "pmtiles": "^2.11.0", "postcss": "^8.4.31", "postcss-preset-env": "^9.3.0", - "posthog-js": "1.136.5", + "posthog-js": "1.136.6", "posthog-js-lite": "3.0.0", "prettier": "^2.8.8", "prop-types": "^15.7.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 25cf3a5b3db..b9b0e40e863 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -260,8 +260,8 @@ dependencies: specifier: ^9.3.0 version: 9.3.0(postcss@8.4.31) posthog-js: - specifier: 1.136.5 - version: 1.136.5 + specifier: 1.136.6 + version: 1.136.6 posthog-js-lite: specifier: 3.0.0 version: 3.0.0 @@ -17564,8 +17564,8 @@ packages: resolution: {integrity: sha512-dyajjnfzZD1tht4N7p7iwf7nBnR1MjVaVu+MKr+7gBgA39bn28wizCIJZztZPtHy4PY0YwtSGgwfBCuG/hnHgA==} dev: false - /posthog-js@1.136.5: - resolution: {integrity: sha512-jLmR9HX7/zR/EfJ+7Fl6ivvBKJdmaFiB8mhdEITIPWpXVgGRvp3u5JuvlNXPW9r1pfux8qoPJCtsqHP+uv73gw==} + /posthog-js@1.136.6: + resolution: {integrity: sha512-gy20/2l7pnJ6/OO9o8D662nzRqfQRnmV3EK5jL8rMyOCSJrx4g/9Ne9kdxRY3zbnmn1Mh2K/ZvyQRkM6gCHxqA==} dependencies: fflate: 0.4.8 preact: 10.22.0