Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskmnds committed Oct 2, 2024
1 parent 9f14a72 commit ae77e60
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ export const useSignUpStartTracking = ( { flow }: Props ) => {
const [ queryParams ] = useSearchParams();
const ref = queryParams.get( 'ref' ) || '';
const flowName = flow.name;
const flowVariant = flow.variantSlug;
const isSignupFlow = flow.isSignupFlow;
const extraProps = useSnakeCasedKeys( {
input: {
flowVariant: flow.variantSlug,
...flow.useTracksEventProps?.()[ STEPPER_TRACKS_EVENT_SIGNUP_START ],
},
const signupStartEventProps = useSnakeCasedKeys( {
input: flow.useTracksEventProps?.()[ STEPPER_TRACKS_EVENT_SIGNUP_START ],
} );

/**
Expand All @@ -50,6 +48,13 @@ export const useSignUpStartTracking = ( { flow }: Props ) => {
return;
}

recordSignupStart( { flow: flowName, ref, optionalProps: extraProps || {} } );
}, [ isSignupFlow, flowName, ref, extraProps ] );
recordSignupStart( {
flow: flowName,
ref,
optionalProps: {
...signupStartEventProps,
...( flowVariant && { flow_variant: flowVariant } ),
},
} );
}, [ isSignupFlow, flowName, ref, signupStartEventProps, flowVariant ] );
};
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ describe( 'useSignUpTracking', () => {
const { rerender } = render( {
flow: {
...signUpFlow,
useSignupStartEventProps: () => ( { extra: 'props' } ),
useTracksEventProps: () => ( {
[ STEPPER_TRACKS_EVENT_SIGNUP_START ]: { extra: 'props' },
} ),
} satisfies Flow,
} );

Expand Down

0 comments on commit ae77e60

Please sign in to comment.