UNPKG

@devcycle/nextjs-sdk

Version:

The Next.js SDK for DevCycle!

40 lines (39 loc) 1.95 kB
import 'server-only'; import { DevCycleEvent, DevCycleUser, DVCCustomDataJSON, VariableDefinitions } from '@devcycle/js-client-sdk'; import { DevCycleNextOptions } from '../common/types'; import { InferredVariableType, VariableKey } from '@devcycle/types'; type ServerUser<CustomData extends DVCCustomDataJSON = DVCCustomDataJSON> = Omit<DevCycleUser<CustomData>, 'user_id' | 'isAnonymous'> & { user_id: string; }; type GetVariableValue = <K extends VariableKey, ValueType extends VariableDefinitions[K]>(key: K, defaultValue: ValueType) => Promise<InferredVariableType<K, ValueType>>; export declare const setupDevCycle: <CustomData extends DVCCustomDataJSON = DVCCustomDataJSON>({ serverSDKKey, clientSDKKey, userGetter, options, }: { serverSDKKey: string; clientSDKKey: string; userGetter: () => Promise<ServerUser<CustomData>> | ServerUser<CustomData>; options?: DevCycleNextOptions; }) => { getVariableValue: GetVariableValue; getAllVariables: () => Promise<import("@devcycle/js-client-sdk").DVCVariableSet>; getAllFeatures: () => Promise<import("@devcycle/js-client-sdk").DVCFeatureSet>; getClientContext: () => { serverDataPromise: Promise<{ user: DevCycleUser; config: import("../..").BucketedConfigWithAdditionalFields | null; userAgent: string | undefined; }>; options: { disableAutomaticEventLogging: boolean | undefined; disableCustomEventLogging: boolean | undefined; disableRealtimeUpdates: boolean | undefined; apiProxyURL: string | undefined; eventFlushIntervalMS: number | undefined; flushEventQueueSize: number | undefined; enableObfuscation: boolean | undefined; }; clientSDKKey: string; enableStreaming: boolean; realtimeDelay: number | undefined; }; track: (event: DevCycleEvent) => Promise<void>; }; export {};