Skip to content

Commit

Permalink
feat: add NOT options for url targeting (#22653)
Browse files Browse the repository at this point in the history
Co-authored-by: shawnlikescode <[email protected]>
Co-authored-by: Neil Kakkar <[email protected]>
  • Loading branch information
3 people authored Jun 14, 2024
1 parent 6133af0 commit 0d78e0f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 9 additions & 3 deletions frontend/src/scenes/surveys/constants.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { allOperatorsMapping } from 'lib/utils'

import {
Survey,
SurveyQuestionDescriptionContentType,
Expand All @@ -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 = {
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0d78e0f

Please sign in to comment.