fix(sdks): ensure nextjs exports all methods
This commit is contained in:
@@ -96,15 +96,25 @@ export function useOpenPanel() {
|
||||
increment,
|
||||
decrement,
|
||||
clear,
|
||||
setGlobalProperties,
|
||||
};
|
||||
}
|
||||
|
||||
function setGlobalProperties(properties: Record<string, unknown>) {
|
||||
window.op?.('setGlobalProperties', properties);
|
||||
}
|
||||
|
||||
function track(name: string, properties?: TrackProperties) {
|
||||
window.op?.('track', name, properties);
|
||||
}
|
||||
|
||||
function screenView(properties: TrackProperties) {
|
||||
track('screen_view', properties);
|
||||
function screenView(properties?: TrackProperties): void;
|
||||
function screenView(path: string, properties?: TrackProperties): void;
|
||||
function screenView(
|
||||
pathOrProperties?: string | TrackProperties,
|
||||
propertiesOrUndefined?: TrackProperties,
|
||||
) {
|
||||
window.op?.('screenView', pathOrProperties, propertiesOrUndefined);
|
||||
}
|
||||
|
||||
function identify(payload: IdentifyPayload) {
|
||||
|
||||
9
packages/sdks/web/src/types.d.ts
vendored
9
packages/sdks/web/src/types.d.ts
vendored
@@ -1,9 +1,9 @@
|
||||
import type { OpenPanel, OpenPanelOptions } from './';
|
||||
|
||||
type ExposedMethodsNames =
|
||||
| 'screenView'
|
||||
| 'track'
|
||||
| 'identify'
|
||||
| 'setGlobalProperties'
|
||||
| 'alias'
|
||||
| 'increment'
|
||||
| 'decrement'
|
||||
@@ -15,8 +15,11 @@ export type ExposedMethods = {
|
||||
: never;
|
||||
}[ExposedMethodsNames];
|
||||
|
||||
export type OpenPanelMethodNames = ExposedMethodsNames | 'init';
|
||||
export type OpenPanelMethods = ExposedMethods | ['init', OpenPanelOptions];
|
||||
export type OpenPanelMethodNames = ExposedMethodsNames | 'init' | 'screenView';
|
||||
export type OpenPanelMethods =
|
||||
| ExposedMethods
|
||||
| ['init', OpenPanelOptions]
|
||||
| ['screenView', string | TrackProperties, TrackProperties];
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
|
||||
Reference in New Issue
Block a user