fix: upload the query tag

feat/new-user
Arik Chakma 1 day ago
parent 6decf1eb70
commit 6c02da0b35
  1. 5
      src/components/AuthenticationFlow/EmailLoginForm.tsx
  2. 5
      src/components/AuthenticationFlow/GitHubButton.tsx
  3. 5
      src/components/AuthenticationFlow/GoogleButton.tsx
  4. 5
      src/components/AuthenticationFlow/LinkedInButton.tsx
  5. 6
      src/components/AuthenticationFlow/TriggerVerifyAccount.tsx

@ -3,6 +3,7 @@ import type { FormEvent } from 'react';
import { useId, useState } from 'react'; import { useId, useState } from 'react';
import { httpPost } from '../../lib/http'; import { httpPost } from '../../lib/http';
import { TOKEN_COOKIE_NAME, setAuthToken } from '../../lib/jwt'; import { TOKEN_COOKIE_NAME, setAuthToken } from '../../lib/jwt';
import { FIRST_LOGIN_TAG } from './TriggerVerifyAccount';
type EmailLoginFormProps = { type EmailLoginFormProps = {
isDisabled?: boolean; isDisabled?: boolean;
@ -38,7 +39,9 @@ export function EmailLoginForm(props: EmailLoginFormProps) {
const currentLocation = window.location.href; const currentLocation = window.location.href;
const url = new URL(currentLocation, window.location.origin); const url = new URL(currentLocation, window.location.origin);
url.searchParams.set('isNewUser', String(response?.isNewUser || false)); if (response?.isNewUser) {
url.searchParams.set(FIRST_LOGIN_TAG, '1');
}
window.location.href = url.toString(); window.location.href = url.toString();
return; return;
} }

@ -5,6 +5,7 @@ import { TOKEN_COOKIE_NAME, setAuthToken } from '../../lib/jwt';
import { httpGet } from '../../lib/http'; import { httpGet } from '../../lib/http';
import { Spinner } from '../ReactIcons/Spinner.tsx'; import { Spinner } from '../ReactIcons/Spinner.tsx';
import { triggerUtmRegistration } from '../../lib/browser.ts'; import { triggerUtmRegistration } from '../../lib/browser.ts';
import { FIRST_LOGIN_TAG } from './TriggerVerifyAccount.tsx';
type GitHubButtonProps = { type GitHubButtonProps = {
isDisabled?: boolean; isDisabled?: boolean;
@ -76,7 +77,9 @@ export function GitHubButton(props: GitHubButtonProps) {
setAuthToken(response.token); setAuthToken(response.token);
const url = new URL(redirectUrl, window.location.origin); const url = new URL(redirectUrl, window.location.origin);
url.searchParams.set('isNewUser', String(response?.isNewUser || false)); if (response?.isNewUser) {
url.searchParams.set(FIRST_LOGIN_TAG, '1');
}
window.location.href = url.toString(); window.location.href = url.toString();
}) })
.catch((err) => { .catch((err) => {

@ -8,6 +8,7 @@ import {
getStoredUtmParams, getStoredUtmParams,
triggerUtmRegistration, triggerUtmRegistration,
} from '../../lib/browser.ts'; } from '../../lib/browser.ts';
import { FIRST_LOGIN_TAG } from './TriggerVerifyAccount.tsx';
type GoogleButtonProps = { type GoogleButtonProps = {
isDisabled?: boolean; isDisabled?: boolean;
@ -80,7 +81,9 @@ export function GoogleButton(props: GoogleButtonProps) {
setAuthToken(response.token); setAuthToken(response.token);
const url = new URL(redirectUrl, window.location.origin); const url = new URL(redirectUrl, window.location.origin);
url.searchParams.set('isNewUser', String(response?.isNewUser || false)); if (response?.isNewUser) {
url.searchParams.set(FIRST_LOGIN_TAG, '1');
}
window.location.href = url.toString(); window.location.href = url.toString();
}) })
.catch((err) => { .catch((err) => {

@ -5,6 +5,7 @@ import { httpGet } from '../../lib/http';
import { Spinner } from '../ReactIcons/Spinner.tsx'; import { Spinner } from '../ReactIcons/Spinner.tsx';
import { LinkedInIcon } from '../ReactIcons/LinkedInIcon.tsx'; import { LinkedInIcon } from '../ReactIcons/LinkedInIcon.tsx';
import { triggerUtmRegistration } from '../../lib/browser.ts'; import { triggerUtmRegistration } from '../../lib/browser.ts';
import { FIRST_LOGIN_TAG } from './TriggerVerifyAccount.tsx';
type LinkedInButtonProps = { type LinkedInButtonProps = {
isDisabled?: boolean; isDisabled?: boolean;
@ -75,7 +76,9 @@ export function LinkedInButton(props: LinkedInButtonProps) {
setAuthToken(response.token); setAuthToken(response.token);
const url = new URL(redirectUrl, window.location.origin); const url = new URL(redirectUrl, window.location.origin);
url.searchParams.set('isNewUser', String(response?.isNewUser || false)); if (response?.isNewUser) {
url.searchParams.set(FIRST_LOGIN_TAG, '1');
}
window.location.href = url.toString(); window.location.href = url.toString();
}) })
.catch((err) => { .catch((err) => {

@ -6,6 +6,8 @@ import { Spinner } from '../ReactIcons/Spinner';
import { ErrorIcon2 } from '../ReactIcons/ErrorIcon2'; import { ErrorIcon2 } from '../ReactIcons/ErrorIcon2';
import { triggerUtmRegistration } from '../../lib/browser.ts'; import { triggerUtmRegistration } from '../../lib/browser.ts';
export const FIRST_LOGIN_TAG = 'fl' as const;
export function TriggerVerifyAccount() { export function TriggerVerifyAccount() {
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState(''); const [error, setError] = useState('');
@ -32,7 +34,9 @@ export function TriggerVerifyAccount() {
setAuthToken(response.token); setAuthToken(response.token);
const url = new URL('/', window.location.origin); const url = new URL('/', window.location.origin);
url.searchParams.set('isNewUser', String(response?.isNewUser || false)); if (response?.isNewUser) {
url.searchParams.set(FIRST_LOGIN_TAG, '1');
}
window.location.href = url.toString(); window.location.href = url.toString();
}) })
.catch((err) => { .catch((err) => {

Loading…
Cancel
Save