From 0d78e0fd8b6eb62805c3ce5f1b36a86ea4d1b87c Mon Sep 17 00:00:00 2001 From: Shawn Lockhart <64715274+shawnlikescode@users.noreply.github.com> Date: Fri, 14 Jun 2024 08:09:23 -0500 Subject: [PATCH] feat: add NOT options for url targeting (#22653) Co-authored-by: shawnlikescode Co-authored-by: Neil Kakkar --- frontend/src/scenes/surveys/constants.tsx | 12 +++++++++--- frontend/src/types.ts | 9 ++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/frontend/src/scenes/surveys/constants.tsx b/frontend/src/scenes/surveys/constants.tsx index 738e51b2a209a..6411868691bbd 100644 --- a/frontend/src/scenes/surveys/constants.tsx +++ b/frontend/src/scenes/surveys/constants.tsx @@ -1,3 +1,5 @@ +import { allOperatorsMapping } from 'lib/utils' + import { Survey, SurveyQuestionDescriptionContentType, @@ -17,10 +19,14 @@ export const SurveyQuestionLabel = { [SurveyQuestionType.MultipleChoice]: 'Multiple choice select', } +// Create SurveyUrlMatchTypeLabels using allOperatorsMapping export const SurveyUrlMatchTypeLabels = { - [SurveyUrlMatchType.Contains]: '∋ contains', - [SurveyUrlMatchType.Regex]: '∼ matches regex', - [SurveyUrlMatchType.Exact]: '= equals', + [SurveyUrlMatchType.Exact]: allOperatorsMapping[SurveyUrlMatchType.Exact], + [SurveyUrlMatchType.IsNot]: allOperatorsMapping[SurveyUrlMatchType.IsNot], + [SurveyUrlMatchType.Contains]: allOperatorsMapping[SurveyUrlMatchType.Contains], + [SurveyUrlMatchType.NotIContains]: allOperatorsMapping[SurveyUrlMatchType.NotIContains], + [SurveyUrlMatchType.Regex]: allOperatorsMapping[SurveyUrlMatchType.Regex], + [SurveyUrlMatchType.NotRegex]: allOperatorsMapping[SurveyUrlMatchType.NotRegex], } export const defaultSurveyAppearance = { diff --git a/frontend/src/types.ts b/frontend/src/types.ts index e568b42145ce6..ed3339591df09 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -2615,9 +2615,12 @@ export interface Survey { } export enum SurveyUrlMatchType { - Exact = 'exact', - Contains = 'icontains', - Regex = 'regex', + Exact = PropertyOperator.Exact, + IsNot = PropertyOperator.IsNot, + Contains = PropertyOperator.IContains, + NotIContains = PropertyOperator.NotIContains, + Regex = PropertyOperator.Regex, + NotRegex = PropertyOperator.NotRegex, } export enum SurveyType {