Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix debugger build #981

Merged
merged 2 commits into from
Oct 24, 2024
Merged
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
9 changes: 7 additions & 2 deletions lib/web-debugger/next.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ import {
initializeDevCycleDebugger,
DebuggerIframeOptions,
} from './src/initializeDevCycleDebugger.js'
import { useDevCycleClient } from '@devcycle/nextjs-sdk'
import { useDevCycleClient, DevCycleJSClient } from '@devcycle/nextjs-sdk'

export const DevCycleDebugger = (options: DebuggerIframeOptions): null => {
const client = useDevCycleClient()

useEffect(() => {
const cleanupPromise = initializeDevCycleDebugger(client, options)
// client here is typed as a DevCycleNextClient which is just a Typescript-omitted version of DevCycleClient
// its still a DevCycleClient under the hood, we just want to expose it to Next.js users as having less methods
const cleanupPromise = initializeDevCycleDebugger(
client as DevCycleJSClient,
options,
)
return () => {
cleanupPromise.then((cleanup) => cleanup())
}
Expand Down
9 changes: 5 additions & 4 deletions sdk/nextjs/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Use this file to export React client code (e.g. those with 'use client' directive)
// or other non-server utilities
import { DevCycleClient as JSClient } from '@devcycle/js-client-sdk'

import { DevCycleNextClient } from './src/client/internal/context'

export { useVariable, useVariableValue } from './src/client/useVariableValue'
export type * from './src/common/types'
Expand All @@ -18,6 +19,6 @@ export {
DVCCustomDataJSON,
} from '@devcycle/react-client-sdk'

type DevCycleClient = Omit<JSClient, 'identifyUser' | 'resetUser'>

export type { DevCycleClient }
export type DevCycleClient = DevCycleNextClient
export type { DevCycleClient as DevCycleJSClient } from '@devcycle/js-client-sdk'
export type { DevCycleNextClient }
Loading