Skip to content

Commit 88e95bc

Browse files
🪟 🔧 Add isCorporate to Airbyte.UI.User.Create (#22137)
* 🪟 🔧 Add isCorporate to Airbyte.UI.User.Create We use this event to track conversions across paid channels such as Google Ads. Since we are only interested in corporate signups, we only want to track a successful conversion in those cases. Previously, we only added the `isCorporate` flag on `.identify()` but we need this info also in `.track('Airbyte.UI.User.Create')` Context: https://docs.google.com/document/d/13JbXLgAEVQmMoCBOPdDzAKpzwvqGclMcGSdA3bQ5KYQ/edit?disco=AAAAofb14Pg * code style suggestion
1 parent 15fce4f commit 88e95bc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

airbyte-webapp/src/packages/cloud/services/auth/AuthService.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ interface AuthContextApi {
6262
loggedOut: boolean;
6363
providers: string[] | null;
6464
hasPasswordLogin: () => boolean;
65-
hasCorporateEmail: () => boolean;
65+
hasCorporateEmail: (email?: string) => boolean;
6666
login: AuthLogin;
6767
loginWithOAuth: (provider: OAuthProviders) => Observable<OAuthLoginState>;
6868
signUpWithEmailLink: (form: { name: string; email: string; password: string; news: boolean }) => Promise<void>;
@@ -116,6 +116,7 @@ export const AuthenticationProvider: React.FC<React.PropsWithChildren<unknown>>
116116
user_id: firebaseUser.uid,
117117
name: user.name,
118118
email: user.email,
119+
isCorporate: ctx.hasCorporateEmail(user.email),
119120
// Which login provider was used, e.g. "password", "google.com", "github.com"
120121
provider: firebaseUser.providerData[0]?.providerId,
121122
...getUtmFromStorage(),
@@ -187,8 +188,8 @@ export const AuthenticationProvider: React.FC<React.PropsWithChildren<unknown>>
187188
hasPasswordLogin(): boolean {
188189
return !!state.providers?.includes("password");
189190
},
190-
hasCorporateEmail(): boolean {
191-
return !FREE_EMAIL_SERVICE_PROVIDERS.some((provider) => state.currentUser?.email.endsWith(`@${provider}`));
191+
hasCorporateEmail(email: string | undefined = state.currentUser?.email): boolean {
192+
return !FREE_EMAIL_SERVICE_PROVIDERS.some((provider) => email?.endsWith(`@${provider}`));
192193
},
193194
async login(values: { email: string; password: string }): Promise<void> {
194195
await authService.login(values.email, values.password);

0 commit comments

Comments
 (0)