From ac4ade62626452b474c86df0f638bfcd8d78ca82 Mon Sep 17 00:00:00 2001 From: arcoraven Date: Fri, 30 May 2025 01:03:44 +0000 Subject: [PATCH] chore: remove Team from confirmEmail response (#7200) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## PR-Codex overview This PR focuses on removing references to `Team` in various components related to email verification and onboarding, simplifying the data structure passed around. ### Detailed summary - Removed `teamStub` import and related references in `VerifyEmail.stories.tsx`. - Eliminated `Team` type imports in `useApi.ts`, `VerifyEmail.tsx`, and `account-onboarding-ui.tsx`. - Updated `onEmailConfirmed` and `verifyEmail` props to only handle `account` in `VerifyEmail.tsx` and `account-onboarding-ui.tsx`. - Adjusted the `onComplete` prop in `AccountOnboardingProps` to reflect the removal of `team`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` ## Summary by CodeRabbit - **Refactor** - Simplified onboarding and email verification flows by removing the requirement for team-related data. All relevant callbacks and functions now operate solely with account information. - **Type Updates** - Updated type signatures for onboarding and verification handlers to exclude the team property, streamlining integration for end-users and developers. --- .../src/@3rdweb-sdk/react/hooks/useApi.ts | 3 +-- .../VerifyEmail/VerifyEmail.stories.tsx | 3 +-- .../onboarding/VerifyEmail/VerifyEmail.tsx | 12 ++---------- .../onboarding/account-onboarding-ui.tsx | 19 +++---------------- 4 files changed, 7 insertions(+), 30 deletions(-) diff --git a/apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts b/apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts index 7ea8155c96b..881004738d4 100644 --- a/apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts +++ b/apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts @@ -1,6 +1,5 @@ import { apiServerProxy } from "@/actions/proxies"; import type { Project } from "@/api/projects"; -import type { Team } from "@/api/team"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { useActiveAccount } from "thirdweb/react"; import { accountKeys, authorizedWallets } from "../cache-keys"; @@ -188,7 +187,7 @@ export function useUpdateNotifications() { export const verifyEmailClient = async (input: ConfirmEmailInput) => { type Result = { error?: { message: string }; - data: { team: Team; account: Account }; + data: { account: Account }; }; const res = await apiServerProxy({ diff --git a/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.stories.tsx b/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.stories.tsx index 4b4610ec27b..a8b58421fda 100644 --- a/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.stories.tsx +++ b/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from "@storybook/react"; -import { newAccountStub, teamStub } from "stories/stubs"; +import { newAccountStub } from "stories/stubs"; import { storybookLog } from "stories/utils"; import { AccountOnboardingLayout } from "../onboarding-layout"; import { VerifyEmail } from "./VerifyEmail"; @@ -60,7 +60,6 @@ function Story(props: { throw new Error("Example error"); } return { - team: teamStub("foo", "free"), account: newAccountStub(), }; }} diff --git a/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.tsx b/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.tsx index 8ed64807bb5..43d902dce9f 100644 --- a/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.tsx +++ b/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.tsx @@ -1,6 +1,4 @@ "use client"; - -import type { Team } from "@/api/team"; import { Spinner } from "@/components/ui/Spinner/Spinner"; import { Button } from "@/components/ui/button"; import { @@ -24,17 +22,11 @@ import { type VerifyEmailProps = { email: string; - onEmailConfirmed: (params: { - team: Team; - account: Account; - }) => void; + onEmailConfirmed: (params: { account: Account }) => void; onBack: () => void; verifyEmail: (params: { confirmationToken: string; - }) => Promise<{ - team: Team; - account: Account; - }>; + }) => Promise<{ account: Account }>; resendConfirmationEmail: () => Promise; trackEvent: (params: TrackingParams) => void; accountAddress: string; diff --git a/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding-ui.tsx b/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding-ui.tsx index 17338ed5f8d..69b622924f4 100644 --- a/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding-ui.tsx +++ b/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding-ui.tsx @@ -1,6 +1,4 @@ "use client"; - -import type { Team } from "@/api/team"; import type { Account } from "@3rdweb-sdk/react/hooks/useApi"; import type { TrackingParams } from "hooks/analytics/useTrack"; import { useState } from "react"; @@ -27,18 +25,12 @@ type AccountOnboardingScreen = }; type AccountOnboardingProps = { - onComplete: (param: { - team: Team; - account: Account; - }) => void; + onComplete: (param: { account: Account }) => void; accountAddress: string; trackEvent: (params: TrackingParams) => void; verifyEmail: (params: { confirmationToken: string; - }) => Promise<{ - team: Team; - account: Account; - }>; + }) => Promise<{ account: Account }>; resendEmailConfirmation: () => Promise; loginOrSignup: (input: { email: string; @@ -106,12 +98,7 @@ export function AccountOnboardingUI(props: AccountOnboardingProps) { verifyEmail={props.verifyEmail} resendConfirmationEmail={props.resendEmailConfirmation} trackEvent={props.trackEvent} - onEmailConfirmed={(data) => { - props.onComplete({ - team: data.team, - account: data.account, - }); - }} + onEmailConfirmed={props.onComplete} onBack={() => setScreen(screen.backScreen)} email={screen.email} />