Skip to content

Commit

Permalink
Chore: Export MixpanelProps (#37)
Browse files Browse the repository at this point in the history
* chore: export props to be able to use in own implentation

* 1.1.1
  • Loading branch information
KevinvdBurg authored Aug 1, 2024
1 parent 3df1381 commit 2efcb9f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions lib/mixpanel/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { TrackingService } from './tracking/TrackingService.ts';
import { WebMixpanelEvent, WebMixpanelPageViewEvent } from './types/webTypes.ts';
import { MobileMixpanelEvent, MobileMixpanelPageViewEvent } from './types/mobileTypes.ts';

interface MixpanelContextProps {
export interface MixpanelContextProps {
trackEvent: (event: WebMixpanelEvent | MobileMixpanelEvent) => void;
trackPageView: (event: WebMixpanelPageViewEvent | MobileMixpanelPageViewEvent) => void;
setEventContext: (context: WebMixpanelEvent['context'] | MobileMixpanelEvent['context']) => void;
}

interface MixpanelProviderProps {
export interface MixpanelProviderProps {
/**
* Children to render
*/
Expand Down Expand Up @@ -58,7 +58,7 @@ export function MixpanelProvider({
disableSessionStorage = false,
}: MixpanelProviderProps) {
const [eventContext, setEventContext] = useState<WebMixpanelEvent['context'] | MobileMixpanelEvent['context']>(
defaultEventContext || {}
defaultEventContext || {},
);

const trackEvent = useCallback(
Expand All @@ -71,7 +71,7 @@ export function MixpanelProvider({
},
});
},
[trackingService, eventContext]
[trackingService, eventContext],
);

const trackPageView = useCallback(
Expand All @@ -83,7 +83,7 @@ export function MixpanelProvider({
},
});
},
[trackingService]
[trackingService],
);

useEffect(() => {
Expand All @@ -100,7 +100,8 @@ export function MixpanelProvider({
trackEvent,
trackPageView,
setEventContext,
}}>
}}
>
{children}
</MixpanelContext.Provider>
);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@freshheads/analytics-essentials",
"version": "1.1.0",
"version": "1.1.1",
"keywords": [
"Analytics",
"Tag Manager",
Expand Down

0 comments on commit 2efcb9f

Please sign in to comment.