Skip to content

Commit

Permalink
Add VKWebAppTrackEvent types
Browse files Browse the repository at this point in the history
  • Loading branch information
Georgii Bagretsov committed Nov 8, 2024
1 parent 69f011f commit 9afcf3c
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion packages/core/src/types/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,27 @@ export type AddToProfileResponse = {
visibility: 'all' | 'friends' | 'best_friends';
};

export type TrackEventRequest = {
event_name:
| 'login'
| 'registration'
| 'subscribe'
| 'unsubscribe'
| 'purchase'
| 'add_to_cart'
| 'search'
| 'lead'
| 'product_card'
| 'enroll_in_course'
| 'take_test'
| 'visit_website'
| 'view_info_page'
| 'view_contacts'
| 'download'
| 'custom';
custom_user_id?: string;
};

/**
* Map of types of request props of VK Bridge methods
*/
Expand Down Expand Up @@ -1221,6 +1242,7 @@ export type RequestPropsMap = {
VKWebAppRecommend: {};
VKWebAppAddToProfile: AddToProfileRequest;
SetSupportedHandlers: {};
VKWebAppTrackEvent: TrackEventRequest;
};

/**
Expand Down Expand Up @@ -1343,6 +1365,7 @@ export type ReceiveDataMap = {
VKWebAppRecommend: { result: true };
VKWebAppAddToProfile: AddToProfileResponse;
SetSupportedHandlers: { supportedHandlers: Array<keyof RequestPropsMap> };
VKWebAppTrackEvent: { result: true };
};
/* eslint-enable @typescript-eslint/ban-types */

Expand Down Expand Up @@ -1720,4 +1743,5 @@ export type ReceiveEventMap = EventReceiveNames<
'VKWebAppAddToProfile',
'VKWebAppAddToProfileResult',
'VKWebAppAddToProfileFailed'
>;
> &
EventReceiveNames<'VKWebAppTrackEvent', 'VKWebAppTrackEventResult', 'VKWebAppTrackEventFailed'>;

0 comments on commit 9afcf3c

Please sign in to comment.