Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const ReactComponent: import('react').FC<import('react').SVGProps<SVGSVGElement>>
export default ReactComponent
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"eslint": "eslint './src/**/*.{ts,tsx,js,jsx}'",
"lint:check": "eslint \"{src,test}/**/*.{ts,tsx}\"",
"lint:fix": "eslint . --fix",
"tsc": "tsc --noemit",
"prettier:check": "prettier --check \"{src,test}/**/*.{ts,tsx}\"",
"prettier:fix": "prettier --write .",
"prepare": "husky install",
Expand Down
13 changes: 7 additions & 6 deletions src/app/client-preview/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { prepareCustomLabel } from '@/utils/customLabels'
import { getPreviewMode } from '@/utils/previewMode'
import { safeCompile } from '@/utils/safeCompile'
import { preprocessTemplate } from '@/utils/string'
import Head from 'next/head'
import Image from 'next/image'
import { z } from 'zod'
import { defaultState } from '../../../defaultState'
Expand Down Expand Up @@ -69,9 +70,9 @@ async function getCustomFields(token: string) {
export default async function ClientPreviewPage({
searchParams,
}: {
searchParams: { token: string }
searchParams: Promise<{ token: string }>
}) {
const tokenParsed = z.string().safeParse(searchParams.token)
const tokenParsed = z.string().safeParse((await searchParams).token)
if (!tokenParsed.success) {
return <InvalidToken />
}
Expand Down Expand Up @@ -111,7 +112,7 @@ export default async function ClientPreviewPage({
const [defaultSetting, allCustomFields, _client, workspace] =
await Promise.all([
getSettings(token),
getCustomFields(searchParams.token),
getCustomFields(token),
getClient(clientId.data, token),
copilotClient.getWorkspaceInfo(),
])
Expand Down Expand Up @@ -180,12 +181,12 @@ export default async function ClientPreviewPage({

return (
<>
<head>
<Head>
<link
href={`https://fonts.googleapis.com/css2?family=${workspace.font}&display=swap`}
rel='stylesheet'
/>
</head>
</Head>
<div
className={`overflow-y-auto overflow-x-hidden max-h-screen w-full`}
style={{
Expand Down Expand Up @@ -218,7 +219,7 @@ export default async function ClientPreviewPage({
<ClientPreview
content={htmlContent}
settings={settings}
token={searchParams.token}
token={token}
font={workspace.font}
labels={workspace.labels}
/>
Expand Down
9 changes: 5 additions & 4 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '@/types/common'
import { IClient, ICustomField } from '@/types/interfaces'
import { CopilotAPI } from '@/utils/copilotApiUtils'
import Head from 'next/head'
import { z } from 'zod'

export const revalidate = 0
Expand Down Expand Up @@ -59,9 +60,9 @@ async function getSettings(token: string) {
export default async function Page({
searchParams,
}: {
searchParams: { token: string }
searchParams: Promise<{ token: string }>
}) {
const tokenParsed = z.string().safeParse(searchParams.token)
const tokenParsed = z.string().safeParse((await searchParams).token)
if (!tokenParsed.success) {
return <InvalidToken />
}
Expand All @@ -88,12 +89,12 @@ export default async function Page({

return (
<>
<head>
<Head>
<link
href={`https://fonts.googleapis.com/css2?family=${workspace.font}&display=swap`}
rel='stylesheet'
/>
</head>
</Head>
<div style={{ fontFamily: workspace.font.replaceAll('+', ' ') }}>
<div className='flex flex-row'>
<div className='relative w-full'>
Expand Down
4 changes: 3 additions & 1 deletion src/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export type SVGIcon = React.FC<React.SVGProps<SVGSVGElement>>
import type { FC, SVGProps } from 'react'

export type SVGIcon = FC<SVGProps<SVGSVGElement>>

export { default as SelectArrowIcon } from './select-arrow.svg'
export { default as PlusIcon } from './plus.svg'
Expand Down
3 changes: 3 additions & 0 deletions sentry.client.config.ts → src/instrumentation-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ Sentry.init({
}),
],
})

// This export will instrument router navigations
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart
13 changes: 13 additions & 0 deletions src/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as Sentry from '@sentry/nextjs'

export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('../sentry.server.config')
}
if (process.env.NEXT_RUNTIME === 'edge') {
await import('../sentry.edge.config')
}
}

// Capture errors from Server Components, middleware, and proxies
export const onRequestError = Sentry.captureRequestError
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "app.d.ts"],
"exclude": ["node_modules"]
}
Loading
Loading