diff --git a/src/__tests__/extensions/surveys/action-matcher.test.ts b/src/__tests__/extensions/surveys/action-matcher.test.ts
index c7ef574f2..021088470 100644
--- a/src/__tests__/extensions/surveys/action-matcher.test.ts
+++ b/src/__tests__/extensions/surveys/action-matcher.test.ts
@@ -1,6 +1,6 @@
///
-import { ActionType, ActionStepStringMatching } from '../../../posthog-surveys-types'
+import { SurveyActionType, ActionStepStringMatching } from '../../../posthog-surveys-types'
import { PostHogPersistence } from '../../../posthog-persistence'
import { PostHog } from '../../../posthog-core'
import { CaptureResult, PostHogConfig } from '../../../types'
@@ -45,7 +45,7 @@ describe('action-matcher', () => {
eventName: string,
currentUrl?: string,
urlMatch?: ActionStepStringMatching
- ): ActionType => {
+ ): SurveyActionType => {
return {
id: id,
name: `${eventName || 'user defined '} action`,
@@ -68,7 +68,7 @@ describe('action-matcher', () => {
}
it('can match action on event name', () => {
- const pageViewAction = createAction(3, '$mypageview') as unknown as ActionType
+ const pageViewAction = createAction(3, '$mypageview') as unknown as SurveyActionType
const actionMatcher = new ActionMatcher(instance)
actionMatcher.register([pageViewAction])
let pageViewActionMatched = false
diff --git a/src/__tests__/utils/survey-event-receiver.test.ts b/src/__tests__/utils/survey-event-receiver.test.ts
index d36ff33e4..4ee51ed51 100644
--- a/src/__tests__/utils/survey-event-receiver.test.ts
+++ b/src/__tests__/utils/survey-event-receiver.test.ts
@@ -4,7 +4,7 @@ import {
SurveyType,
SurveyQuestionType,
Survey,
- ActionType,
+ SurveyActionType,
ActionStepStringMatching,
} from '../../posthog-surveys-types'
import { PostHogPersistence } from '../../posthog-persistence'
@@ -209,7 +209,7 @@ describe('survey-event-receiver', () => {
eventName: string,
currentUrl?: string,
urlMatch?: ActionStepStringMatching
- ): ActionType => {
+ ): SurveyActionType => {
return {
id: id,
name: `${eventName || 'user defined '} action`,
@@ -238,7 +238,7 @@ describe('survey-event-receiver', () => {
type: SurveyType.Popover,
questions: [{ type: SurveyQuestionType.Open, question: 'what is a bokoblin?' }],
conditions: {
- actions: [createAction(2, '$autocapture') as unknown as ActionType],
+ actions: [createAction(2, '$autocapture') as unknown as SurveyActionType],
},
} as unknown as Survey
@@ -249,7 +249,7 @@ describe('survey-event-receiver', () => {
type: SurveyType.Popover,
questions: [{ type: SurveyQuestionType.Open, question: 'what is a bokoblin?' }],
conditions: {
- actions: [createAction(3, '$pageview') as unknown as ActionType],
+ actions: [createAction(3, '$pageview') as unknown as SurveyActionType],
},
} as unknown as Survey
@@ -262,7 +262,7 @@ describe('survey-event-receiver', () => {
questions: [{ type: SurveyQuestionType.Open, question: 'what is a bokoblin?' }],
conditions: {
actions: {
- values: [createAction(3, '$mypageview') as unknown as ActionType],
+ values: [createAction(3, '$mypageview') as unknown as SurveyActionType],
},
},
} as unknown as Survey
diff --git a/src/extensions/surveys/action-matcher.ts b/src/extensions/surveys/action-matcher.ts
index a6d4ceb0a..82bb125a0 100644
--- a/src/extensions/surveys/action-matcher.ts
+++ b/src/extensions/surveys/action-matcher.ts
@@ -1,5 +1,5 @@
import { PostHog } from '../../posthog-core'
-import { ActionStepStringMatching, ActionStepType, ActionType, SurveyElement } from '../../posthog-surveys-types'
+import { ActionStepStringMatching, ActionStepType, SurveyActionType, SurveyElement } from '../../posthog-surveys-types'
import { SimpleEventEmitter } from '../../utils/simple-event-emitter'
import { CaptureResult } from '../../types'
import { isUndefined } from '../../utils/type-utils'
@@ -7,7 +7,7 @@ import { window } from '../../utils/globals'
import { isUrlMatchingRegex } from '../../utils/request-utils'
export class ActionMatcher {
- private readonly actionRegistry?: Set
+ private readonly actionRegistry?: Set
private readonly instance?: PostHog
private readonly actionEvents: Set
private _debugEventEmitter = new SimpleEventEmitter()
@@ -15,7 +15,7 @@ export class ActionMatcher {
constructor(instance?: PostHog) {
this.instance = instance
this.actionEvents = new Set()
- this.actionRegistry = new Set()
+ this.actionRegistry = new Set()
}
init() {
@@ -27,7 +27,7 @@ export class ActionMatcher {
}
}
- register(actions: ActionType[]): void {
+ register(actions: SurveyActionType[]): void {
if (isUndefined(this.instance?._addCaptureHook)) {
return
}
@@ -74,7 +74,7 @@ export class ActionMatcher {
this.onAction('actionCaptured', (data) => callback(data))
}
- private checkAction(event?: CaptureResult, action?: ActionType): boolean {
+ private checkAction(event?: CaptureResult, action?: SurveyActionType): boolean {
if (action?.steps == null) {
return false
}
diff --git a/src/posthog-surveys-types.ts b/src/posthog-surveys-types.ts
index 8313093b1..09aea91ce 100644
--- a/src/posthog-surveys-types.ts
+++ b/src/posthog-surveys-types.ts
@@ -172,7 +172,7 @@ export interface Survey {
}[]
} | null
actions: {
- values: ActionType[]
+ values: SurveyActionType[]
} | null
} | null
start_date: string | null
@@ -181,16 +181,10 @@ export interface Survey {
current_iteration_start_date: string | null
}
-export interface ActionType {
- count?: number
- created_at: string
- deleted?: boolean
+export interface SurveyActionType {
id: number
name: string | null
steps?: ActionStepType[]
- tags?: string[]
- is_action?: true
- action_id?: number // alias of id to make it compatible with event definitions uuid
}
/** Sync with plugin-server/src/types.ts */