diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 631632a79..1166ad97e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -47,7 +47,7 @@ jobs: npm install -g corepack mkdir -p ~/.volta/bin corepack enable --install-directory ~/.volta/bin - npm install - name: Test Build run: | + npm ci npm run build -w apps/dashboard diff --git a/apps/dashboard/src/app/(base)/[domain]/api/images/[name]/route.ts b/apps/dashboard/src/app/(base)/[domain]/api/images/[name]/route.ts index d82a4e9bd..99048b294 100644 --- a/apps/dashboard/src/app/(base)/[domain]/api/images/[name]/route.ts +++ b/apps/dashboard/src/app/(base)/[domain]/api/images/[name]/route.ts @@ -3,9 +3,9 @@ import { NextRequest } from "next/server"; export async function GET( request: NextRequest, - { params }: { params: { name: string } }, + { params }: { params: Promise<{ name: string }> }, ) { - const { name } = params; + const { name } = await params; const searchParams = request.nextUrl.searchParams; const isIcon = name.includes("_icon"); const [_name, ..._] = name.replace(isIcon ? "_icon" : "_logo", "").split("."); diff --git a/apps/dashboard/src/app/api/images/[name]/route.ts b/apps/dashboard/src/app/api/images/[name]/route.ts index d82a4e9bd..99048b294 100644 --- a/apps/dashboard/src/app/api/images/[name]/route.ts +++ b/apps/dashboard/src/app/api/images/[name]/route.ts @@ -3,9 +3,9 @@ import { NextRequest } from "next/server"; export async function GET( request: NextRequest, - { params }: { params: { name: string } }, + { params }: { params: Promise<{ name: string }> }, ) { - const { name } = params; + const { name } = await params; const searchParams = request.nextUrl.searchParams; const isIcon = name.includes("_icon"); const [_name, ..._] = name.replace(isIcon ? "_icon" : "_logo", "").split("."); diff --git a/ee/apps/platform/next-env.d.ts b/ee/apps/platform/next-env.d.ts index 40c3d6809..1b3be0840 100644 --- a/ee/apps/platform/next-env.d.ts +++ b/ee/apps/platform/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. +// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/ee/packages/console/modules/auth/invites/index.tsx b/ee/packages/console/modules/auth/invites/index.tsx index 5a41cfade..555b7e29d 100644 --- a/ee/packages/console/modules/auth/invites/index.tsx +++ b/ee/packages/console/modules/auth/invites/index.tsx @@ -5,10 +5,12 @@ import { trpc } from "@karrio/console/trpc/client"; import { useRouter } from "next/navigation"; import { useEffect } from "react"; -export default function InvitePage({ params }: { params: { token: string } }) { +export default async function InvitePage({ params }: { params: Promise<{ token: string }> }) { + const query = await params; const router = useRouter(); const { toast } = useToast(); const acceptInvitation = trpc.organizations.acceptInvitation.useMutation({ + onSuccess: (org) => { toast({ title: "Welcome!", @@ -27,8 +29,9 @@ export default function InvitePage({ params }: { params: { token: string } }) { }); useEffect(() => { - acceptInvitation.mutate({ token: params.token }); - }, [params.token]); + acceptInvitation.mutate({ token: query.token }); + }, [query.token]); + return (
diff --git a/ee/packages/console/modules/organizations/billing/index.tsx b/ee/packages/console/modules/organizations/billing/index.tsx index 988ad9934..58c91ee91 100644 --- a/ee/packages/console/modules/organizations/billing/index.tsx +++ b/ee/packages/console/modules/organizations/billing/index.tsx @@ -62,21 +62,22 @@ const stripePromise = loadStripe( process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!, ); -export default function BillingPage({ params }: { params: { orgId: string } }) { +export default async function BillingPagePage({ params }: { params: Promise<{ orgId: string }>}){ + const query = await params; const { toast } = useToast(); const router = useRouter(); const utils = trpc.useUtils(); const { data: subscription } = trpc.billing.getSubscription.useQuery({ - orgId: params.orgId, + orgId: query.orgId, }); const { data: billingInfo } = trpc.billing.getBillingInfo.useQuery({ - orgId: params.orgId, + orgId: query.orgId, }); const { data: currentPlan } = trpc.billing.getPlan.useQuery({ - orgId: params.orgId, + orgId: query.orgId, }); const { data: invoices } = trpc.billing.getInvoices.useQuery({ - orgId: params.orgId, + orgId: query.orgId, }); const updateBilling = trpc.billing.updateBillingInfo.useMutation(); const createSetupIntent = trpc.billing.createSetupIntent.useMutation(); @@ -98,7 +99,7 @@ export default function BillingPage({ params }: { params: { orgId: string } }) { const [isMounted, setIsMounted] = useState(false); const { data: paymentMethods } = trpc.billing.getPaymentMethods.useQuery({ - orgId: params.orgId, + orgId: query.orgId, }); const setDefaultPaymentMethod = trpc.billing.setDefaultPaymentMethod.useMutation(); @@ -207,7 +208,7 @@ export default function BillingPage({ params }: { params: { orgId: string } }) { const handleUpdateBilling = async () => { try { await updateBilling.mutateAsync({ - orgId: params.orgId, + orgId: query.orgId, email: billingEmail, address: billingAddress, }); @@ -228,7 +229,7 @@ export default function BillingPage({ params }: { params: { orgId: string } }) { const handleUpdateTaxId = async () => { try { await updateBilling.mutateAsync({ - orgId: params.orgId, + orgId: query.orgId, taxId: { type: taxIdType, value: taxIdNumber, @@ -251,7 +252,7 @@ export default function BillingPage({ params }: { params: { orgId: string } }) { const handleAddCard = async () => { try { const setupIntent = await createSetupIntent.mutateAsync({ - orgId: params.orgId, + orgId: query.orgId, }); setSetupIntentSecret(setupIntent.setupIntent); @@ -268,7 +269,7 @@ export default function BillingPage({ params }: { params: { orgId: string } }) { const handleSetDefaultPaymentMethod = async (paymentMethodId: string) => { try { await setDefaultPaymentMethod.mutateAsync({ - orgId: params.orgId, + orgId: query.orgId, paymentMethodId, }); toast({ @@ -288,7 +289,7 @@ export default function BillingPage({ params }: { params: { orgId: string } }) { const handleDeletePaymentMethod = async (paymentMethodId: string) => { try { await deletePaymentMethod.mutateAsync({ - orgId: params.orgId, + orgId: query.orgId, paymentMethodId, }); } catch (error) { @@ -313,7 +314,7 @@ export default function BillingPage({ params }: { params: { orgId: string } }) { try { await createSubscription.mutateAsync({ - orgId: params.orgId, + orgId: query.orgId, priceId: selectedPlan, }); } catch (error: any) { @@ -465,7 +466,7 @@ export default function BillingPage({ params }: { params: { orgId: string } }) { onValueChange={async (value) => { try { await retrySubscriptionPayment.mutateAsync({ - orgId: params.orgId, + orgId: query.orgId, paymentMethodId: value, }); utils.billing.getSubscription.invalidate(); @@ -581,7 +582,7 @@ export default function BillingPage({ params }: { params: { orgId: string } }) { variant="outline" onClick={() => reactivateSubscription.mutateAsync({ - orgId: params.orgId, + orgId: query.orgId, }) } disabled={reactivateSubscription.status === "loading"} @@ -965,7 +966,7 @@ export default function BillingPage({ params }: { params: { orgId: string } }) { { refreshAllResources(); setShowPaymentForm(false); @@ -1014,7 +1015,7 @@ export default function BillingPage({ params }: { params: { orgId: string } }) { className="bg-destructive text-destructive-foreground hover:bg-destructive/90" onClick={() => { cancelSubscription.mutateAsync({ - orgId: params.orgId, + orgId: query.orgId, }); setShowCancelDialog(false); }} diff --git a/ee/packages/console/modules/organizations/settings/index.tsx b/ee/packages/console/modules/organizations/settings/index.tsx index c1e1f5e81..794a8a185 100644 --- a/ee/packages/console/modules/organizations/settings/index.tsx +++ b/ee/packages/console/modules/organizations/settings/index.tsx @@ -11,9 +11,9 @@ import { } from "@karrio/insiders/components/ui/card"; import { Alert, AlertDescription } from "@karrio/insiders/components/ui/alert"; import { Button } from "@karrio/insiders/components/ui/button"; +import { UserPlus, Trash2, AlertCircle } from "lucide-react"; import { Input } from "@karrio/insiders/components/ui/input"; import { useToast } from "@karrio/insiders/hooks/use-toast"; -import { UserPlus, Trash2, AlertCircle } from "lucide-react"; import { useSession } from "next-auth/react"; import { useState } from "react"; import { @@ -28,21 +28,24 @@ import { } from "@karrio/insiders/components/ui/alert-dialog"; import { useRouter } from "next/navigation"; -export default function SettingsPage({ +export default async function SettingsPage({ params, }: { - params: { orgId: string }; + params: Promise<{ orgId: string }>; }) { const { toast } = useToast(); const router = useRouter(); const utils = trpc.useContext(); const { data: session } = useSession(); + const { orgId } = await params; const { data: organization } = trpc.organizations.get.useQuery({ - orgId: params.orgId, + orgId, }); const { data: members } = trpc.organizations.getMembers.useQuery({ - orgId: params.orgId, + orgId, }); + + const currentUser = members?.find( (member) => member.user.email === session?.user?.email, ); @@ -172,11 +175,9 @@ export default function SettingsPage({ /> @@ -266,11 +268,12 @@ export default function SettingsPage({