From 66fc2176c683948ee00ab728e04e82aa7b6c1ccb Mon Sep 17 00:00:00 2001 From: Connor Lanigan Date: Fri, 21 Jul 2023 14:03:51 +0200 Subject: [PATCH] chore: Add `totalSubSteps` property and funnelStepError event (#1354) --- src/internal/analytics/__tests__/mocks.ts | 1 + src/internal/analytics/index.ts | 1 + src/internal/analytics/interfaces.ts | 17 +++++++++++++++-- src/wizard/__tests__/analytics.test.tsx | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/internal/analytics/__tests__/mocks.ts b/src/internal/analytics/__tests__/mocks.ts index 77092dcd1a..9b255e6a7b 100644 --- a/src/internal/analytics/__tests__/mocks.ts +++ b/src/internal/analytics/__tests__/mocks.ts @@ -14,6 +14,7 @@ export function mockFunnelMetrics() { funnelStepStart: jest.fn(), funnelStepComplete: jest.fn(), funnelStepNavigation: jest.fn(), + funnelStepError: jest.fn(), funnelSubStepStart: jest.fn(), funnelSubStepComplete: jest.fn(), funnelSubStepError: jest.fn(), diff --git a/src/internal/analytics/index.ts b/src/internal/analytics/index.ts index 6bd9d664bc..030f07c6d4 100644 --- a/src/internal/analytics/index.ts +++ b/src/internal/analytics/index.ts @@ -24,6 +24,7 @@ export let FunnelMetrics: IFunnelMetrics = { funnelStepStart(): void {}, funnelStepComplete(): void {}, funnelStepNavigation(): void {}, + funnelStepError(): void {}, funnelSubStepStart(): void {}, funnelSubStepComplete(): void {}, funnelSubStepError(): void {}, diff --git a/src/internal/analytics/interfaces.ts b/src/internal/analytics/interfaces.ts index fe57d3f1b6..729644b420 100644 --- a/src/internal/analytics/interfaces.ts +++ b/src/internal/analytics/interfaces.ts @@ -38,9 +38,21 @@ export interface FunnelStepProps extends BaseFunnelProps { subStepAllSelector: string; } +export interface FunnelStepStartProps extends FunnelStepProps { + totalSubSteps?: number; +} +export interface FunnelStepCompleteProps extends FunnelStepProps { + totalSubSteps?: number; +} + export interface FunnelStepNavigationProps extends FunnelStepProps { destinationStepNumber: number; navigationType: string; + totalSubSteps?: number; +} + +export interface FunnelStepErrorProps extends FunnelStepProps { + stepErrorSelector: string; } export interface FunnelSubStepProps extends FunnelStepProps { @@ -70,9 +82,10 @@ export interface IFunnelMetrics { funnelComplete: FunnelMethod; funnelSuccessful: FunnelMethod; funnelCancelled: FunnelMethod; - funnelStepStart: FunnelMethod; - funnelStepComplete: FunnelMethod; + funnelStepStart: FunnelMethod; + funnelStepComplete: FunnelMethod; funnelStepNavigation: FunnelMethod; + funnelStepError: FunnelMethod; funnelSubStepStart: FunnelMethod; funnelSubStepComplete: FunnelMethod; funnelSubStepError: FunnelMethod; diff --git a/src/wizard/__tests__/analytics.test.tsx b/src/wizard/__tests__/analytics.test.tsx index 80317a17af..2405c967ca 100644 --- a/src/wizard/__tests__/analytics.test.tsx +++ b/src/wizard/__tests__/analytics.test.tsx @@ -22,6 +22,7 @@ function mockFunnelMetrics() { funnelStepStart: jest.fn(), funnelStepComplete: jest.fn(), funnelStepNavigation: jest.fn(), + funnelStepError: jest.fn(), funnelSubStepStart: jest.fn(), funnelSubStepComplete: jest.fn(), funnelSubStepError: jest.fn(),