Skip to content

Commit

Permalink
Start: Fix isNewUser logic, take 2 (#95405)
Browse files Browse the repository at this point in the history
* Revert "Revert "Start: Fix isNewUser logic" (#95394)"

This reverts commit 775df10.

* Make the prop optional
  • Loading branch information
escapemanuele authored Oct 15, 2024
1 parent 92bc9ba commit 4b73889
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions client/landing/stepper/hooks/use-record-signup-complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const useRecordSignupComplete = ( flow: string | null ) => {
isTransfer:
hasPaidDomainItem && domainCartItem ? isDomainTransfer( domainCartItem ) : undefined,
signupDomainOrigin: signupDomainOrigin ?? SIGNUP_DOMAIN_ORIGIN.NOT_SET,
framework: 'stepper',
},
true
);
Expand Down
4 changes: 3 additions & 1 deletion client/lib/analytics/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function recordSignupComplete(
isMapping,
signupDomainOrigin,
elapsedTimeSinceStart = null,
framework = 'start',
},
now
) {
Expand All @@ -80,6 +81,7 @@ export function recordSignupComplete(
isTransfer,
isMapping,
signupDomainOrigin,
framework,
},
true
);
Expand Down Expand Up @@ -122,7 +124,7 @@ export function recordSignupComplete(
const device = resolveDeviceTypeByViewPort();

// Tracks
recordTracksEvent( 'calypso_new_user_site_creation', { flow, device } );
recordTracksEvent( 'calypso_new_user_site_creation', { flow, device, framework } );
// Google Analytics
gaRecordEvent( 'Signup', 'calypso_new_user_site_creation' );
}
Expand Down
1 change: 1 addition & 0 deletions client/lib/signup/step-actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ export function createAccount(
const providedDependencies = {
username,
marketing_price_group,
is_new_account: newAccountCreated,
...bearerToken,
};

Expand Down
12 changes: 10 additions & 2 deletions client/signup/config/steps-pure.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@ export function generateSteps( {
'marketing_price_group',
'redirect',
'allowUnauthenticated',
'is_new_account',
'oauth2_client_id',
'oauth2_redirect',
],
optionalDependencies: [
'redirect',
'allowUnauthenticated',
'is_new_account',
'oauth2_client_id',
'oauth2_redirect',
],
Expand All @@ -153,12 +155,14 @@ export function generateSteps( {
'marketing_price_group',
'redirect',
'allowUnauthenticated',
'is_new_account',
'oauth2_client_id',
'oauth2_redirect',
],
optionalDependencies: [
'redirect',
'allowUnauthenticated',
'is_new_account',
'oauth2_client_id',
'oauth2_redirect',
],
Expand All @@ -179,6 +183,7 @@ export function generateSteps( {
'username',
'marketing_price_group',
'allowUnauthenticated',
'is_new_account',
'redirect',
'oauth2_client_id',
'oauth2_redirect',
Expand All @@ -188,6 +193,7 @@ export function generateSteps( {
'username',
'marketing_price_group',
'allowUnauthenticated',
'is_new_account',
'redirect',
'oauth2_client_id',
'oauth2_redirect',
Expand Down Expand Up @@ -519,9 +525,10 @@ export function generateSteps( {
'oauth2_redirect',
'marketing_price_group',
'allowUnauthenticated',
'is_new_account',
'redirect',
],
optionalDependencies: [ 'allowUnauthenticated', 'redirect' ],
optionalDependencies: [ 'allowUnauthenticated', 'redirect', 'is_new_account' ],
},

'oauth2-name': {
Expand All @@ -535,9 +542,10 @@ export function generateSteps( {
'oauth2_redirect',
'marketing_price_group',
'allowUnauthenticated',
'is_new_account',
'redirect',
],
optionalDependencies: [ 'allowUnauthenticated', 'redirect' ],
optionalDependencies: [ 'allowUnauthenticated', 'redirect', 'is_new_account' ],
props: {
isSocialSignupEnabled: config.isEnabled( 'signup/social' ),
oauth2Signup: true,
Expand Down
3 changes: 2 additions & 1 deletion client/signup/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ class Signup extends Component {

const { isNewishUser, existingSiteCount } = this.props;

const isNewUser = !! ( dependencies && dependencies.username );
const isNewUser = !! ( dependencies && dependencies.is_new_account );
const siteId = dependencies && dependencies.siteId;
const isNew7DUserSite = !! (
isNewUser ||
Expand Down Expand Up @@ -591,6 +591,7 @@ class Signup extends Component {
isMapping: isMapping,
isTransfer: isTransfer,
signupDomainOrigin: signupDomainOriginValue,
framework: 'start',
} );
}
};
Expand Down

0 comments on commit 4b73889

Please sign in to comment.