Skip to content

Commit

Permalink
chore: fix debugger build (#981)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajwootto authored Oct 24, 2024
1 parent 0e01d6d commit 5a55e77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
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 }

0 comments on commit 5a55e77

Please sign in to comment.