Skip to content

Commit

Permalink
Remove redundant OTP events (#7542)
Browse files Browse the repository at this point in the history
  • Loading branch information
malithsen authored Oct 26, 2023
1 parent 641fb60 commit 34c0175
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 44 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-remove-redundant-tracks-events
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Remove redundant Tracks events in WooPay OTP flow
20 changes: 0 additions & 20 deletions client/checkout/woopay/email-input-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,6 @@ export const handleWooPayEmailInput = async (
window.addEventListener( 'resize', setPopoverPosition );

iframe.classList.add( 'open' );
wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_OTP_START,
[],
true
);
} );

// Add the iframe and iframe arrow to the wrapper.
Expand Down Expand Up @@ -539,11 +534,6 @@ export const handleWooPayEmailInput = async (
closeLoginSessionIframe();
break;
case 'redirect_to_woopay_skip_session_init':
wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_OTP_COMPLETE,
[],
true
);
if ( e.data.redirectUrl ) {
window.location = appendRedirectionParams(
e.data.redirectUrl
Expand All @@ -552,11 +542,6 @@ export const handleWooPayEmailInput = async (
break;
case 'redirect_to_platform_checkout':
case 'redirect_to_woopay':
wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_OTP_COMPLETE,
[],
true
);
api.initWooPay(
woopayEmailInput.value,
e.data.platformCheckoutUserSession
Expand All @@ -581,11 +566,6 @@ export const handleWooPayEmailInput = async (
} );
break;
case 'otp_validation_failed':
wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_OTP_FAILED,
[],
true
);
break;
case 'close_modal':
closeIframe();
Expand Down
21 changes: 0 additions & 21 deletions client/checkout/woopay/express-button/express-checkout-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
validateEmail,
appendRedirectionParams,
} from '../utils';
import wcpayTracks from 'tracks';

export const expressCheckoutIframe = async ( api, context, emailSelector ) => {
const woopayEmailInput = await getTargetElement( emailSelector );
Expand Down Expand Up @@ -126,11 +125,6 @@ export const expressCheckoutIframe = async ( api, context, emailSelector ) => {
window.addEventListener( 'resize', setPopoverPosition );

iframe.classList.add( 'open' );
wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_OTP_START,
[],
true
);
} );

// Add the iframe to the wrapper.
Expand Down Expand Up @@ -212,11 +206,6 @@ export const expressCheckoutIframe = async ( api, context, emailSelector ) => {
userEmail = e.data.userEmail;
break;
case 'redirect_to_woopay_skip_session_init':
wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_OTP_COMPLETE,
[],
true
);
if ( e.data.redirectUrl ) {
window.location = appendRedirectionParams(
e.data.redirectUrl
Expand All @@ -225,11 +214,6 @@ export const expressCheckoutIframe = async ( api, context, emailSelector ) => {
break;
case 'redirect_to_platform_checkout':
case 'redirect_to_woopay':
wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_OTP_COMPLETE,
[],
true
);
api.initWooPay(
userEmail || e.data.userEmail,
e.data.platformCheckoutUserSession
Expand All @@ -254,11 +238,6 @@ export const expressCheckoutIframe = async ( api, context, emailSelector ) => {
} );
break;
case 'otp_validation_failed':
wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_OTP_FAILED,
[],
true
);
break;
case 'close_modal':
closeIframe();
Expand Down
3 changes: 0 additions & 3 deletions client/tracks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ const events = {
TRANSACTIONS_DOWNLOAD_CSV_CLICK: 'wcpay_transactions_download_csv_click',
WOOPAY_EMAIL_CHECK: 'checkout_email_address_woopay_check',
WOOPAY_OFFERED: 'woopay_offered',
WOOPAY_OTP_START: 'woopay_otp_prompt_start',
WOOPAY_OTP_COMPLETE: 'woopay_otp_prompt_complete',
WOOPAY_OTP_FAILED: 'woopay_otp_prompt_failed',
WOOPAY_AUTO_REDIRECT: 'checkout_woopay_auto_redirect',
WOOPAY_SKIPPED: 'woopay_skipped',
WOOPAY_BUTTON_LOAD: 'woopay_button_load',
Expand Down

0 comments on commit 34c0175

Please sign in to comment.