From 9afcf3cce539ff98f70e162c804e88abbb1962c1 Mon Sep 17 00:00:00 2001 From: Georgii Bagretsov Date: Fri, 8 Nov 2024 15:46:53 +0300 Subject: [PATCH] Add VKWebAppTrackEvent types --- packages/core/src/types/data.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/core/src/types/data.ts b/packages/core/src/types/data.ts index 02ccd24..4a44a97 100644 --- a/packages/core/src/types/data.ts +++ b/packages/core/src/types/data.ts @@ -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 */ @@ -1221,6 +1242,7 @@ export type RequestPropsMap = { VKWebAppRecommend: {}; VKWebAppAddToProfile: AddToProfileRequest; SetSupportedHandlers: {}; + VKWebAppTrackEvent: TrackEventRequest; }; /** @@ -1343,6 +1365,7 @@ export type ReceiveDataMap = { VKWebAppRecommend: { result: true }; VKWebAppAddToProfile: AddToProfileResponse; SetSupportedHandlers: { supportedHandlers: Array }; + VKWebAppTrackEvent: { result: true }; }; /* eslint-enable @typescript-eslint/ban-types */ @@ -1720,4 +1743,5 @@ export type ReceiveEventMap = EventReceiveNames< 'VKWebAppAddToProfile', 'VKWebAppAddToProfileResult', 'VKWebAppAddToProfileFailed' - >; + > & + EventReceiveNames<'VKWebAppTrackEvent', 'VKWebAppTrackEventResult', 'VKWebAppTrackEventFailed'>;