Skip to content

Commit bb7131f

Browse files
committed
fix build issue in main
1 parent 62b2f12 commit bb7131f

File tree

9 files changed

+318
-78
lines changed

9 files changed

+318
-78
lines changed

app.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.svg' {
2+
const ReactComponent: import('react').FC<import('react').SVGProps<SVGSVGElement>>
3+
export default ReactComponent
4+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"eslint": "eslint './src/**/*.{ts,tsx,js,jsx}'",
1212
"lint:check": "eslint \"{src,test}/**/*.{ts,tsx}\"",
1313
"lint:fix": "eslint . --fix",
14+
"tsc": "tsc --noemit",
1415
"prettier:check": "prettier --check \"{src,test}/**/*.{ts,tsx}\"",
1516
"prettier:fix": "prettier --write .",
1617
"prepare": "husky install",

src/app/client-preview/page.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { prepareCustomLabel } from '@/utils/customLabels'
66
import { getPreviewMode } from '@/utils/previewMode'
77
import { safeCompile } from '@/utils/safeCompile'
88
import { preprocessTemplate } from '@/utils/string'
9+
import Head from 'next/head'
910
import Image from 'next/image'
1011
import { z } from 'zod'
1112
import { defaultState } from '../../../defaultState'
@@ -69,9 +70,9 @@ async function getCustomFields(token: string) {
6970
export default async function ClientPreviewPage({
7071
searchParams,
7172
}: {
72-
searchParams: { token: string }
73+
searchParams: Promise<{ token: string }>
7374
}) {
74-
const tokenParsed = z.string().safeParse(searchParams.token)
75+
const tokenParsed = z.string().safeParse((await searchParams).token)
7576
if (!tokenParsed.success) {
7677
return <InvalidToken />
7778
}
@@ -111,7 +112,7 @@ export default async function ClientPreviewPage({
111112
const [defaultSetting, allCustomFields, _client, workspace] =
112113
await Promise.all([
113114
getSettings(token),
114-
getCustomFields(searchParams.token),
115+
getCustomFields(token),
115116
getClient(clientId.data, token),
116117
copilotClient.getWorkspaceInfo(),
117118
])
@@ -180,12 +181,12 @@ export default async function ClientPreviewPage({
180181

181182
return (
182183
<>
183-
<head>
184+
<Head>
184185
<link
185186
href={`https://fonts.googleapis.com/css2?family=${workspace.font}&display=swap`}
186187
rel='stylesheet'
187188
/>
188-
</head>
189+
</Head>
189190
<div
190191
className={`overflow-y-auto overflow-x-hidden max-h-screen w-full`}
191192
style={{
@@ -218,7 +219,7 @@ export default async function ClientPreviewPage({
218219
<ClientPreview
219220
content={htmlContent}
220221
settings={settings}
221-
token={searchParams.token}
222+
token={token}
222223
font={workspace.font}
223224
labels={workspace.labels}
224225
/>

src/app/page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from '@/types/common'
1111
import { IClient, ICustomField } from '@/types/interfaces'
1212
import { CopilotAPI } from '@/utils/copilotApiUtils'
13+
import Head from 'next/head'
1314
import { z } from 'zod'
1415

1516
export const revalidate = 0
@@ -59,9 +60,9 @@ async function getSettings(token: string) {
5960
export default async function Page({
6061
searchParams,
6162
}: {
62-
searchParams: { token: string }
63+
searchParams: Promise<{ token: string }>
6364
}) {
64-
const tokenParsed = z.string().safeParse(searchParams.token)
65+
const tokenParsed = z.string().safeParse((await searchParams).token)
6566
if (!tokenParsed.success) {
6667
return <InvalidToken />
6768
}
@@ -88,12 +89,12 @@ export default async function Page({
8889

8990
return (
9091
<>
91-
<head>
92+
<Head>
9293
<link
9394
href={`https://fonts.googleapis.com/css2?family=${workspace.font}&display=swap`}
9495
rel='stylesheet'
9596
/>
96-
</head>
97+
</Head>
9798
<div style={{ fontFamily: workspace.font.replaceAll('+', ' ') }}>
9899
<div className='flex flex-row'>
99100
<div className='relative w-full'>

src/icons/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export type SVGIcon = React.FC<React.SVGProps<SVGSVGElement>>
1+
import type { FC, SVGProps } from 'react'
2+
3+
export type SVGIcon = FC<SVGProps<SVGSVGElement>>
24

35
export { default as SelectArrowIcon } from './select-arrow.svg'
46
export { default as PlusIcon } from './plus.svg'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ Sentry.init({
3131
}),
3232
],
3333
})
34+
35+
// This export will instrument router navigations
36+
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart

src/instrumentation.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import * as Sentry from '@sentry/nextjs'
2+
3+
export async function register() {
4+
if (process.env.NEXT_RUNTIME === 'nodejs') {
5+
await import('../sentry.server.config')
6+
}
7+
if (process.env.NEXT_RUNTIME === 'edge') {
8+
await import('../sentry.edge.config')
9+
}
10+
}
11+
12+
// Capture errors from Server Components, middleware, and proxies
13+
export const onRequestError = Sentry.captureRequestError

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
"@/*": ["./src/*"]
2323
}
2424
},
25-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "app.d.ts"],
2626
"exclude": ["node_modules"]
2727
}

0 commit comments

Comments
 (0)