Skip to content

Commit 7090bb4

Browse files
committed
more stuff
1 parent 54d4a0a commit 7090bb4

File tree

27 files changed

+121
-174
lines changed

27 files changed

+121
-174
lines changed

Diff for: apps/web/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"@sushiswap/nextjs-config": "workspace:*",
4343
"@sushiswap/notifications": "workspace:*",
4444
"@sushiswap/steer-sdk": "workspace:*",
45-
"@sushiswap/styro-client": "0.0.23",
45+
"@sushiswap/styro-client": "0.0.25",
4646
"@sushiswap/tailwindcss-config": "workspace:*",
4747
"@sushiswap/telemetry": "workspace:*",
4848
"@sushiswap/ui": "workspace:*",

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/api-keys/[apiKeyId]/_common/ui/api-key-basic-settings/api-key-basic-settings-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
CardTitle,
88
TextField,
99
} from '@sushiswap/ui'
10-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
10+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
1111
import { ApiKeyBasicSettingsForm } from './api-key-basic-settings-form'
1212

1313
export async function ApiKeyBasicSettingsCard({
@@ -17,7 +17,7 @@ export async function ApiKeyBasicSettingsCard({
1717
teamId: string
1818
apiKeyId: string
1919
}) {
20-
const client = await getStyroClient()
20+
const client = await getUserStyroClient()
2121
const response = await client.getTeamsTeamIdApiKeysApiKeyId({
2222
teamId,
2323
apiKeyId,

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/api-keys/[apiKeyId]/_common/ui/api-key-key/api-key-key-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
CardHeader,
66
CardTitle,
77
} from '@sushiswap/ui'
8-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
8+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
99
import { ApiKeyKeyForm } from './api-key-key-form'
1010

1111
interface ApiKeyResetCard {
@@ -14,7 +14,7 @@ interface ApiKeyResetCard {
1414
}
1515

1616
export async function ApiKeyKeyCard({ teamId, apiKeyId }: ApiKeyResetCard) {
17-
const client = await getStyroClient()
17+
const client = await getUserStyroClient()
1818

1919
const response = await client.getTeamsTeamIdApiKeysApiKeyId({
2020
teamId,

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/api-keys/[apiKeyId]/_common/ui/api-key-rate-limit/api-key-rate-limit-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
CardTitle,
88
TextField,
99
} from '@sushiswap/ui'
10-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
10+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
1111
import { ApiKeyRateLimitForm } from './api-key-rate-limit-form'
1212

1313
export async function ApiKeyRateLimitCard({
@@ -17,7 +17,7 @@ export async function ApiKeyRateLimitCard({
1717
teamId: string
1818
apiKeyId: string
1919
}) {
20-
const client = await getStyroClient()
20+
const client = await getUserStyroClient()
2121
const [apiKeyResponse, planResponse] = await Promise.all([
2222
client.getTeamsTeamIdApiKeysApiKeyId({
2323
teamId,

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/api-keys/[apiKeyId]/_common/ui/api-key-restrictions/api-key-restrictions-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
CardHeader,
66
CardTitle,
77
} from '@sushiswap/ui'
8-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
8+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
99
import { ApiKeyRestrictionsForm } from './api-key-restrictions-form'
1010

1111
export async function ApiKeyRestrictionsCard({
@@ -15,7 +15,7 @@ export async function ApiKeyRestrictionsCard({
1515
teamId: string
1616
apiKeyId: string
1717
}) {
18-
const client = await getStyroClient()
18+
const client = await getUserStyroClient()
1919
const response = await client.getTeamsTeamIdApiKeysApiKeyId({
2020
teamId,
2121
apiKeyId,

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/api-keys/_common/ui/team-api-key-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import {
1010
QueryClient,
1111
dehydrate,
1212
} from '@tanstack/react-query'
13-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
13+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
1414
import { TeamApiKeyTable } from './team-api-key-table'
1515

1616
export async function TeamApiKeyCard({ teamId }: { teamId: string }) {
17-
const client = await getStyroClient()
17+
const client = await getUserStyroClient()
1818

1919
const queryClient = new QueryClient()
2020
await queryClient.prefetchQuery({

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/layout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
dehydrate,
66
} from '@tanstack/react-query'
77
import { getLoggedInSessionData } from 'src/app/portal/_common/lib/client-config'
8-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
8+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
99
import { DashboardSidebar } from './_common/ui/dashboard-sidebar'
1010

1111
export default async function Layout({
@@ -14,7 +14,7 @@ export default async function Layout({
1414
}: { children: React.ReactNode; params: Promise<{ teamId: string }> }) {
1515
const teamId = (await params).teamId
1616

17-
const client = await getStyroClient()
17+
const client = await getUserStyroClient()
1818
const session = await getLoggedInSessionData()
1919

2020
const [teamResponse, teamMembershipResponse] = await Promise.all([

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/settings/(account)/_common/ui/delete-account/delete-account-checks.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getSessionData } from 'src/app/portal/_common/lib/client-config'
2-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
2+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
33

44
export type DeleteAccountChecklist = {
55
checks?: {
@@ -15,7 +15,7 @@ export async function getDeleteAccountChecklist(): Promise<DeleteAccountChecklis
1515
return { canDelete: false }
1616
}
1717

18-
const client = await getStyroClient()
18+
const client = await getUserStyroClient()
1919
const response = await client.getUsersMe()
2020

2121
// TODO: Checks

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/settings/billing/_common/ui/team-balance-changes/team-balance-changes-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import {
55
CardHeader,
66
CardTitle,
77
} from '@sushiswap/ui'
8-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
8+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
99
import { TeamBalanceChangesTable } from './team-balance-changes-table'
1010

1111
export async function TeamBalanceChangesCard({ teamId }: { teamId: string }) {
12-
const client = await getStyroClient()
12+
const client = await getUserStyroClient()
1313
const response = await client.getTeamsTeamIdBilling({
1414
teamId,
1515
})

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/settings/billing/_common/ui/team-balance/team-balance-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import {
77
CardHeader,
88
CardTitle,
99
} from '@sushiswap/ui'
10-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
10+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
1111
import { BalanceTopUpDialog } from './balance-top-up-dialog'
1212

1313
export async function TeamBalanceCard({ teamId }: { teamId: string }) {
14-
const client = await getStyroClient()
14+
const client = await getUserStyroClient()
1515
const response = await client.getTeamsTeamIdBilling({ teamId })
1616

1717
return (

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/settings/billing/_common/ui/team-billing/team-billing-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import {
1010
List,
1111
} from '@sushiswap/ui'
1212
import { formatDistance } from 'date-fns/esm'
13-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
13+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
1414

1515
export async function TeamBillingCard({ teamId }: { teamId: string }) {
16-
const client = await getStyroClient()
16+
const client = await getUserStyroClient()
1717
const response = await client.getTeamsTeamIdBilling({ teamId })
1818

1919
return (

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/settings/billing/_common/ui/team-plan/team-plan-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import {
99
FormattedNumber,
1010
List,
1111
} from '@sushiswap/ui'
12-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
12+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
1313
import { TeamChangePlanDialog } from './team-change-plan-dialog'
1414

1515
export async function TeamPlanCard({ teamId }: { teamId: string }) {
16-
const client = await getStyroClient()
16+
const client = await getUserStyroClient()
1717

1818
const [teamBillingResponse, teamPlanResponse, plansResponse] =
1919
await Promise.all([

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/settings/team/_common/ui/delete-team/delete-team-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
CardHeader,
77
CardTitle,
88
} from '@sushiswap/ui'
9-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
9+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
1010
import { CheckerCustom } from 'src/app/portal/_common/ui/checker/checker-custom/checker-custom'
1111
import { CheckerRoleServer } from 'src/app/portal/_common/ui/checker/checker-role/checker-role-server'
1212
import { DeleteTeamDialog } from './delete-team-dialog'
@@ -16,7 +16,7 @@ interface DeleteTeamCard {
1616
}
1717

1818
export async function DeleteTeamCard({ teamId }: DeleteTeamCard) {
19-
const client = await getStyroClient()
19+
const client = await getUserStyroClient()
2020

2121
const teamResponse = await client.getTeamsTeamId({ teamId })
2222

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/settings/team/_common/ui/manage-team/manage-team-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import {
55
CardHeader,
66
CardTitle,
77
} from '@sushiswap/ui'
8-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
8+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
99
import { ManageTeamForm } from './manage-team-form'
1010

1111
interface ManageTeamCard {
1212
teamId: string
1313
}
1414

1515
export async function ManageTeamCard({ teamId }: ManageTeamCard) {
16-
const client = await getStyroClient()
16+
const client = await getUserStyroClient()
1717
const team = await client.getTeamsTeamId({ teamId })
1818

1919
return (

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/settings/team/_common/ui/team-details/team-details-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import {
66
CardTitle,
77
List,
88
} from '@sushiswap/ui'
9-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
9+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
1010
import { CopyButton } from 'src/app/portal/_common/ui/copy-button'
1111

1212
interface TeamDetailsCard {
1313
teamId: string
1414
}
1515

1616
export async function TeamDetailsCard({ teamId }: TeamDetailsCard) {
17-
const client = await getStyroClient()
17+
const client = await getUserStyroClient()
1818

1919
const response = await client.getTeamsTeamId({ teamId })
2020

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/settings/team/_common/ui/team-invites/team-invites-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import {
66
CardHeader,
77
CardTitle,
88
} from '@sushiswap/ui'
9-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
9+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
1010
import { CheckerRoleServer } from 'src/app/portal/_common/ui/checker/checker-role/checker-role-server'
1111
import { NewInviteDialog } from './new-invite-dialog'
1212
import { TeamInvitesTable } from './team-invites-table'
1313

1414
export async function TeamInvitesCard({ teamId }: { teamId: string }) {
15-
const client = await getStyroClient()
15+
const client = await getUserStyroClient()
1616
const [teamResponse, invitesResponse] = await Promise.all([
1717
client.getTeamsTeamId({ teamId }),
1818
client.getTeamsTeamIdInvites({ teamId }),

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/[teamId]/settings/team/_common/ui/team-members/team-members-card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import {
55
CardHeader,
66
CardTitle,
77
} from '@sushiswap/ui'
8-
import { getStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
8+
import { getUserStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
99
import { TeamMembersTable } from './team-members-table'
1010

1111
export async function TeamMembersCard({ teamId }: { teamId: string }) {
12-
const client = await getStyroClient()
12+
const client = await getUserStyroClient()
1313
const response = await client.getTeamsTeamIdMembers({ teamId })
1414

1515
return (

Diff for: apps/web/src/app/portal/(authenticated)/dashboard/route.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { type NextRequest, NextResponse } from 'next/server'
2-
import { getStyroClient } from '../../_common/lib/styro/styro-client'
2+
import { getUserStyroClient } from '../../_common/lib/styro/styro-client'
33

44
export async function GET(request: NextRequest) {
55
try {
6-
const client = await getStyroClient()
6+
const client = await getUserStyroClient()
77
const response = await client.getUsersMe()
88

99
return NextResponse.redirect(

Diff for: apps/web/src/app/portal/(authenticated)/verify/_common/ui/verify-form/resend-code/resend-code-action.ts

+22-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { headers } from 'next/headers'
44
import { getSessionData } from 'src/app/portal/_common/lib/client-config'
5+
import { getAdminStyroClient } from 'src/app/portal/_common/lib/styro/styro-client'
56
import { getUserServiceClient } from 'src/app/portal/_common/lib/zitadel-client'
67

78
export async function resendCodeAction() {
@@ -14,23 +15,38 @@ export async function resendCodeAction() {
1415
const host = headers_.get('Host')!
1516
const proto = headers_.get('X-Forwarded-Proto') || 'https'
1617

17-
console.log(`${proto}://${host}/portal/email/verify-email?code={{.Code}}`)
18-
1918
try {
2019
const userServiceClient = getUserServiceClient()
2120
const response = await userServiceClient.resendEmailCode({
2221
$typeName: 'zitadel.user.v2.ResendEmailCodeRequest',
2322
userId: session.user.id,
2423
verification: {
25-
case: 'sendCode',
24+
case: 'returnCode',
2625
value: {
27-
$typeName: 'zitadel.user.v2.SendEmailVerificationCode',
28-
urlTemplate: `${proto}://${host}/portal/email/verify-email?code={{.Code}}`,
26+
$typeName: 'zitadel.user.v2.ReturnEmailVerificationCode',
2927
},
3028
},
3129
})
3230

33-
console.log(response)
31+
if (!response.verificationCode) {
32+
return { error: 'Failed to resend code' }
33+
}
34+
35+
const client = getAdminStyroClient()
36+
await client.postAdminFrontendEmail({
37+
postAdminFrontendEmailRequest: {
38+
email: {
39+
type: 'verify_email',
40+
frontend: {
41+
baseUrl: `${proto}://${host}`,
42+
},
43+
verification: {
44+
code: response.verificationCode,
45+
email: session.user.email.email,
46+
},
47+
},
48+
},
49+
})
3450
} catch (e) {
3551
console.error(e)
3652
return { error: 'Failed to resend code' }

Diff for: apps/web/src/app/portal/(unauthenticated)/login/_common/ui/login-action.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type FormState =
1818
}
1919
| {
2020
success: true
21+
redirect: '/portal' | '/portal/verify'
2122
}
2223

2324
export async function loginAction(data: FormData): Promise<FormState> {
@@ -66,12 +67,10 @@ export async function loginAction(data: FormData): Promise<FormState> {
6667
})
6768

6869
if (!user.value.type.value.email.isVerified) {
69-
redirect('/portal/verify')
70+
return { success: true, redirect: '/portal/verify' }
7071
} else {
71-
redirect('/portal')
72+
return { success: true, redirect: '/portal' }
7273
}
73-
74-
return { success: true }
7574
} catch (e) {
7675
if (isRedirectError(e)) {
7776
throw e

Diff for: apps/web/src/app/portal/(unauthenticated)/login/_common/ui/login-form.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
formClassnames,
1212
} from '@sushiswap/ui'
1313
import { useSearchParams } from 'next/navigation'
14+
import { useRouter } from 'nextjs-toploader/app'
1415
import { useCallback, useState } from 'react'
1516
import { FormProvider, useForm } from 'react-hook-form'
1617
import type { z } from 'zod'
@@ -27,6 +28,7 @@ const paramErrors = {
2728
} as Record<string, string>
2829

2930
export function LoginForm() {
31+
const router = useRouter()
3032
const searchParamsError = useSearchParams().get('error_tag')
3133

3234
const [globalErrorMsg, setGlobalErrorMsg] = useState<string | null>(
@@ -56,9 +58,11 @@ export function LoginForm() {
5658
} else {
5759
setGlobalErrorMsg(result.error)
5860
}
61+
} else {
62+
router.push(result.redirect)
5963
}
6064
},
61-
[form.setError],
65+
[form.setError, router.push],
6266
)
6367

6468
return (

0 commit comments

Comments
 (0)