### Configuration Example
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/MANIFEST.txt
Illustrates basic configuration setup for VK Bridge.
```typescript
// Configuration is typically handled internally or via specific methods.
// This is a conceptual example.
// Example of setting a configuration option (if available via API)
// bridge.config.set('someOption', true);
// For TypeScript setup, refer to the documentation for specific instructions.
console.log('Configuration setup details are in the documentation.');
```
--------------------------------
### Install Dependencies with Yarn
Source: https://github.com/vkcom/vk-bridge/blob/master/CONTRIBUTING.md
Install all project dependencies using Yarn. This command should be run after cloning the repository.
```sh
yarn install
```
--------------------------------
### Full App Example with VK Bridge Middleware
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/quick-reference.md
A comprehensive example of a React application using VK Bridge with middleware for logging. It demonstrates initialization, subscription to updates, and basic UI adaptation.
```typescript
import bridge, { applyMiddleware } from '@vkontakte/vk-bridge';
import { useAdaptivity, useAppearance } from '@vkontakte/vk-bridge-react';
// Set up middleware
const logger = ({ send }) => (next) => async (method, props) => {
console.log(`[${new Date().toISOString()}] Calling ${method}`);
return await next(method, props);
};
const enhancedBridge = applyMiddleware(logger)(bridge);
// React component
export function App() {
const { type, viewportWidth } = useAdaptivity();
const appearance = useAppearance();
React.useEffect(() => {
// Initialize bridge
enhancedBridge.send('VKWebAppInit');
// Subscribe to updates
const handleUpdate = (event) => {
if (event.detail.type === 'VKWebAppUpdateConfig') {
console.log('Config updated');
}
};
enhancedBridge.subscribe(handleUpdate);
return () => enhancedBridge.unsubscribe(handleUpdate);
}, []);
return (
{type}
);
}
```
--------------------------------
### Install VK Bridge Packages
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/README.md
Install the core VK Bridge package and the optional React hooks package using npm.
```bash
# Core package
npm install @vkontakte/vk-bridge
# React hooks (optional)
npm install @vkontakte/vk-bridge-react
```
--------------------------------
### Install VK Bridge Packages
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/quick-reference.md
Install the core VK Bridge package, the React hooks package, and TypeScript development dependencies.
```bash
# Core package
npm install @vkontakte/vk-bridge
# With React hooks
npm install @vkontakte/vk-bridge-react
# With TypeScript
npm install --save-dev typescript
npm install --save-dev @types/react # if using React
```
--------------------------------
### Install VK Bridge React
Source: https://github.com/vkcom/vk-bridge/blob/master/packages/react/README.md
Install the necessary packages for VK Bridge React integration using npm.
```sh
npm install @vkontakte/vk-bridge @vkontakte/vk-bridge-react
```
--------------------------------
### VKWebAppAddToHomeScreenInfo
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Gets information about the availability of adding the app to the home screen.
```APIDOC
## VKWebAppAddToHomeScreenInfo
### Description
Gets information about home screen availability.
### Method
POST
### Endpoint
/VKWebAppAddToHomeScreenInfo
### Parameters
This method does not accept any parameters.
### Request Example
```json
{
"event": "VKWebAppAddToHomeScreenInfo"
}
```
### Response
#### Success Response (200)
- **is_feature_supported** (boolean) - Indicates if the feature is supported on the current platform.
- **is_added_to_home_screen** (boolean) - Indicates if the app has already been added to the home screen.
```
--------------------------------
### Install VK Bridge React Packages
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/configuration.md
Install the necessary packages for using VK Bridge with React applications.
```bash
npm install @vkontakte/vk-bridge @vkontakte/vk-bridge-react
```
--------------------------------
### Debugging Example
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/MANIFEST.txt
Provides a conceptual example for debugging VK Bridge interactions.
```typescript
// Debugging often involves console logging and network inspection.
// Use bridge.send() and bridge.subscribe() with console logs
// to trace method calls and event responses.
bridge.send('VKWebAppGetUserInfo', {}).then(userInfo => {
console.log('User Info:', userInfo);
}).catch(error => {
console.error('Error fetching user info:', error);
});
bridge.subscribe((event) => {
console.log('Received event:', event.detail.type, event.detail);
});
console.log('VK Bridge debugging enabled via console logs.');
```
--------------------------------
### Get Launch Parameters
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Fetches the parameters provided when the application was launched, such as user ID and platform information.
```typescript
bridge.send('VKWebAppGetLaunchParams')
```
--------------------------------
### Simple Timing Middleware Example
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/middleware.md
A middleware that measures and logs the duration of bridge method calls. It wraps the next send function to record start and end times.
```typescript
// Simple middleware that adds request timing
const timingMiddleware = ({ send, subscribe }) => (next) => async (method, props) => {
const start = Date.now();
try {
const result = await next(method, props);
const duration = Date.now() - start;
console.log(`${method} completed in ${duration}ms`);
return result;
} catch (error) {
const duration = Date.now() - start;
console.log(`${method} failed after ${duration}ms`);
throw error;
}
};
const enhancedBridge = applyMiddleware(timingMiddleware)(bridge);
```
--------------------------------
### Install VK Bridge NPM Packages
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/configuration.md
Install the core bridge package using npm or yarn. The React package is optional and has peer dependencies.
```bash
npm install @vkontakte/vk-bridge
# or
yarn add @vkontakte/vk-bridge
```
```bash
npm install @vkontakte/vk-bridge-react
# or
yarn add @vkontakte/vk-bridge-react
```
--------------------------------
### Get Configuration and Launch Parameters
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/quick-reference.md
Fetch application configuration or launch parameters. These methods provide insights into the app's current settings and how it was launched.
```typescript
const config = await bridge.send('VKWebAppGetConfig');
const params = await bridge.send('VKWebAppGetLaunchParams');
```
--------------------------------
### VKWebAppInit
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/README.md
Initializes the VK Bridge. This method should be called once when the application starts.
```APIDOC
## VKWebAppInit
### Description
Initializes the VK Bridge. This method should be called once when the application starts.
### Method
POST
### Endpoint
/VKWebAppInit
### Parameters
#### Request Body
- None
### Response
#### Success Response (200)
- None
#### Response Example
{}
```
--------------------------------
### Type Usage Example
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/MANIFEST.txt
Demonstrates the usage of exported type definitions, such as AppearanceType.
```typescript
import bridge from '@vkontakte/vk-bridge';
import type { AppearanceType } from '@vkontakte/vk-bridge';
const currentAppearance: AppearanceType = bridge.getAppearance();
if (currentAppearance === 'dark') {
console.log('The app is in dark mode.');
} else {
console.log('The app is in light mode.');
}
```
--------------------------------
### Initialize and Send Basic Bridge Methods
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/README.md
Initialize the bridge, get user information, and subscribe to events. Ensure initialization is awaited before sending other methods.
```typescript
import bridge from '@vkontakte/vk-bridge';
// Initialize
await bridge.send('VKWebAppInit');
// Get user info
const user = await bridge.send('VKWebAppGetUserInfo');
console.log(user.first_name, user.last_name);
// Subscribe to events
bridge.subscribe((event) => {
console.log('Event:', event.detail.type);
});
// Close app
await bridge.send('VKWebAppClose', { status: 'success' });
```
--------------------------------
### Client Error Example
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/errors-and-events.md
An example of a client-side error, such as when a user declines an action.
```typescript
{
error_type: 'client_error',
error_data: {
error_code: 101,
error_reason: 'User declined',
error_description: 'The user tapped cancel'
}
}
```
--------------------------------
### Get Application Configuration
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Retrieves the current application's configuration, including appearance settings, viewport dimensions, and insets.
```typescript
bridge.send('VKWebAppGetConfig')
```
--------------------------------
### Notch-Aware Layout with useInsets
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/react-hooks.md
This example demonstrates how to create a notch-aware header using the useInsets hook. It checks if a notch is detected (insets.top > 0) and adjusts styling accordingly.
```typescript
import { useInsets } from '@vkontakte/vk-bridge-react';
function NotchAwareHeader() {
const insets = useInsets();
const hasNotch = insets && insets.top > 0;
return (
{hasNotch &&
Notch detected
}
);
}
```
--------------------------------
### Handling Update Events
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/errors-and-events.md
Demonstrates the structure of update events, which are not responses to methods but indicate changes in configuration or state. Example shows 'VKWebAppUpdateConfig'.
```typescript
{
detail: {
type: 'VKWebAppUpdateConfig',
data: ParentConfigData
}
}
```
--------------------------------
### Parse Custom Search String
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/launch-params.md
Demonstrates using parseURLSearchParamsForGetLaunchParams with a custom search string, not limited to window.location.search. Shows example output.
```typescript
import { parseURLSearchParamsForGetLaunchParams } from '@vkontakte/vk-bridge';
// Can be used with any search string, not just window.location.search
const customSearch = '?vk_user_id=42&vk_platform=desktop_web&vk_language=en';
const params = parseURLSearchParamsForGetLaunchParams(customSearch);
console.log(params);
// Output:
// {
// vk_user_id: 42,
// vk_platform: 'desktop_web',
// vk_language: 'en'
// }
```
--------------------------------
### Get Client Version - VKWebAppGetClientVersion
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Retrieves information about the native client version and platform.
```typescript
bridge.send('VKWebAppGetClientVersion')
```
--------------------------------
### VKWebAppFlashGetInfo / VKWebAppFlashSetLevel
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Methods for controlling the device's flash, including getting its status and setting its level.
```APIDOC
## VKWebAppFlashGetInfo / VKWebAppFlashSetLevel
### Description
Flash control.
### Method
`VKWebAppFlashGetInfo` / `VKWebAppFlashSetLevel`
```
--------------------------------
### VKWebAppGetGrantedPermissions
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Gets a list of permissions that have been granted by the user.
```APIDOC
## VKWebAppGetGrantedPermissions
### Description
Gets a list of permissions that have been granted by the user.
### Method
POST
### Endpoint
/VKWebAppGetGrantedPermissions
### Parameters
#### Request Body
None
### Response
#### Success Response (200)
- `GetGrantedPermissionsResponse` (object) - An object containing the list of granted permissions.
### Response Example
```json
{
"permissions": [
"photos",
"friends"
]
}
```
```
--------------------------------
### Basic Usage of VK Bridge React Hooks
Source: https://github.com/vkcom/vk-bridge/blob/master/packages/react/README.md
Demonstrates how to use the `useInsets` hook to get screen insets and `runTapticImpactOccurred` to trigger haptic feedback in a React component.
```tsx
import { useInsets, runTapticImpactOccurred } from '@vkontakte/vk-bridge-react';
// Sends event to client
const App = () => {
const insets = useInsets();
const handleClick = () => {
runTapticImpactOccurred();
};
return (
);
};
```
--------------------------------
### Get Home Screen Availability Info
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Use VKWebAppAddToHomeScreenInfo to retrieve information about whether the home screen feature is supported and if the app has already been added. This helps in conditional UI rendering.
```typescript
bridge.send('VKWebAppAddToHomeScreenInfo')
```
--------------------------------
### Call Methods
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Enables initiating and managing phone calls, including starting a call, joining one, and checking call status.
```APIDOC
## Call Methods
### Description
Control phone call functionalities.
### Methods
- CallStart
- CallJoin
- CallGetStatus
```
--------------------------------
### Get List of Storage Keys
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Use VKWebAppStorageGetKeys to retrieve a list of all keys currently stored in the application's storage, with options for pagination.
```typescript
bridge.send('VKWebAppStorageGetKeys', {
count: number;
offset: number;
})
```
--------------------------------
### VKWebAppGetLaunchParams
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Fetches parameters associated with the application's launch, such as user ID and platform.
```APIDOC
## VKWebAppGetLaunchParams
### Description
Gets application launch parameters (user ID, platform, etc.).
### Method
bridge.send
### Response
`GetLaunchParamsResponse`
```
--------------------------------
### Use useInsets Hook
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/react-hooks.md
Use the useInsets hook to get safe area padding values. It returns null until the first event is received. This example shows how to apply padding to a div.
```typescript
import { useInsets } from '@vkontakte/vk-bridge-react';
function SafeAreaLayout() {
const insets = useInsets();
if (!insets) {
return
Loading...
;
}
return (
Content with safe area padding
);
}
```
--------------------------------
### Initialize VK Bridge in React App
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/quick-reference.md
This snippet shows how to initialize the VK Bridge in a React application using the `useEffect` hook. It also demonstrates how to use `useAdaptivity` and `useAppearance` hooks to get theme and layout information.
```typescript
import bridge from '@vkontakte/vk-bridge';
import { useAdaptivity, useAppearance } from '@vkontakte/vk-bridge-react';
import React, { useEffect } from 'react';
export function App() {
const { type, viewportWidth, viewportHeight } = useAdaptivity();
const appearance = useAppearance();
useEffect(() => {
bridge.send('VKWebAppInit').catch(console.error);
}, []);
if (!type || !appearance) {
return
Loading...
;
}
return (
App Layout: {type}
Theme: {appearance}
);
}
```
--------------------------------
### Build Script Configuration
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/configuration.md
Defines the build tool as 'rslib' and sets the 'prepack' script to run the build command before packaging. Useful for ensuring the latest build is included.
```json
{
"build": "rslib",
"prepack": "yarn run build"
}
```
--------------------------------
### Configuration Methods
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/quick-reference.md
Methods for retrieving configuration and launch parameters.
```APIDOC
## Configuration
### Description
Methods to get application configuration and launch parameters.
### Methods
- `VKWebAppGetConfig`: Retrieves the application configuration.
- `VKWebAppGetLaunchParams`: Retrieves the launch parameters.
### Request Example
```typescript
const config = await bridge.send('VKWebAppGetConfig');
const params = await bridge.send('VKWebAppGetLaunchParams');
```
```
--------------------------------
### Auth Error Example
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/errors-and-events.md
An example of an authentication error, indicating that a required scope was not granted.
```typescript
{
error_type: 'auth_error',
error_data: {
error_code: 1,
error_reason: 'Scope not granted',
error_description: [
'friends',
'photos'
]
}
}
```
--------------------------------
### Initialize and Subscribe to VK Bridge Events
Source: https://github.com/vkcom/vk-bridge/blob/master/packages/core/README.md
Import the bridge, send an initialization event, and subscribe to client-sent events.
```javascript
import bridge from '@vkontakte/vk-bridge';
// Sends event to clientridge.send('VKWebAppInit');
// Subscribes to event, sended by clientridge.subscribe((e) => console.log(e));
```
--------------------------------
### API Error Example
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/errors-and-events.md
An example of an API error, such as an invalid user ID being provided.
```typescript
{
error_type: 'api_error',
error_data: {
error_code: 113,
error_msg: 'Invalid user ID',
request_params: ['user_id']
}
}
```
--------------------------------
### Production Build Command
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/configuration.md
Execute the 'build' script to create a production-ready build of the package. This command is typically used before publishing.
```bash
npm run build
# or
yarn build
```
--------------------------------
### Launch Parameter Parsing
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/MANIFEST.txt
Shows how to parse launch parameters from the URL search parameters.
```typescript
import { parseURLSearchParamsForGetLaunchParams } from '@vkontakte/vk-bridge';
// Assuming window.location.search is available
const launchParams = parseURLSearchParamsForGetLaunchParams(window.location.search);
console.log('Launch Params:', launchParams);
```
--------------------------------
### Get Type Definitions for VK Bridge Methods
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/quick-reference.md
Use these type definitions to get specific request and response types for VK Bridge methods. Imports are required.
```typescript
import type { RequestProps, ReceiveData } from '@vkontakte/vk-bridge';
type GetUserInfoRequest = RequestProps<'VKWebAppGetUserInfo'>;
type GetUserInfoResponse = ReceiveData<'VKWebAppGetUserInfo'>;
```
```typescript
import type {
AnyRequestMethodName,
AnyReceiveMethodName,
AnyIOMethodName,
} from '@vkontakte/vk-bridge';
const method: AnyRequestMethodName = 'VKWebAppGetUserInfo';
```
--------------------------------
### Browser Distribution Script
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/configuration.md
Include the minified browser bundle and initialize VK Bridge using the global `vkBridge` object.
```html
```
--------------------------------
### VKWebAppGetConfig
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Retrieves the application's configuration, including appearance and viewport settings.
```APIDOC
## VKWebAppGetConfig
### Description
Gets application configuration (appearance, viewport, insets).
### Method
bridge.send
### Response
`ParentConfigData`
```
--------------------------------
### Launch Parameter Parsing
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/MANIFEST.txt
Utilities for parsing launch parameters from the URL.
```APIDOC
## Launch Parameter Parsing
### Description
Utilities for parsing launch parameters, typically obtained from the URL when the VK app is launched.
### Function
- **parseURLSearchParamsForGetLaunchParams()**: Parses the URL's search parameters to extract launch parameters.
### Usage
This function is useful for retrieving parameters passed to the VK app when it's launched, such as user IDs, group IDs, or other contextual information.
### Example
```typescript
import { parseURLSearchParamsForGetLaunchParams } from '@vkontakte/vk-bridge';
const launchParams = parseURLSearchParamsForGetLaunchParams();
console.log('Launch Parameters:', launchParams);
```
```
--------------------------------
### Implement Graceful Degradation for App Initialization
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/errors-and-events.md
Initializes an application by attempting to fetch user info and configuration. If either fails, it logs a warning and continues execution with default values or null, ensuring the app remains functional.
```typescript
async function initializeApp() {
// Try to get user info
let userInfo: UserInfo | null = null;
try {
userInfo = await bridge.send('VKWebAppGetUserInfo');
} catch (error) {
console.warn('Failed to get user info:', error.error_data.error_reason);
// Continue without user info
}
// Try to get config
let config: ParentConfigData | null = null;
try {
config = await bridge.send('VKWebAppGetConfig');
} catch (error) {
console.warn('Failed to get config:', error.error_data.error_reason);
// Continue with default appearance
}
return { userInfo, config };
}
```
--------------------------------
### Open QR Code Scanner
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Use VKWebAppOpenCodeReader to launch the device's QR code scanner. The scanner returns scanned data.
```typescript
bridge.send('VKWebAppOpenCodeReader')
```
--------------------------------
### VKWebAppGetFriends
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Gets a list of the user's friends. The `multi` parameter can be set to true to allow selecting multiple friends.
```APIDOC
## VKWebAppGetFriends
### Description
Gets a list of the user's friends. Allows for multi-selection if the `multi` parameter is set to true.
### Method
POST
### Endpoint
/VKWebAppGetFriends
### Parameters
#### Request Body
- `multi` (boolean) - Optional - Allow selecting multiple friends.
### Response
#### Success Response (200)
- `users` (array of UserGetFriendsFriend) - An array of friend objects.
### Response Example
```json
{
"users": [
{
"id": 123,
"first_name": "Jane",
"last_name": "Doe"
}
]
}
```
```
--------------------------------
### Open QR Code Scanner (Alternative)
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Use VKWebAppOpenQR as an alternative method to open the QR code scanner. It also returns scanned data.
```typescript
bridge.send('VKWebAppOpenQR')
```
--------------------------------
### Get Granted Permissions
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Retrieves a list of permissions that the user has already granted to the application. Useful for checking access rights.
```typescript
bridge.send('VKWebAppGetGrantedPermissions')
```
--------------------------------
### GetLaunchParamsResponse Type
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/types.md
The response structure for the VKWebAppGetLaunchParams method. Contains essential user and application identifiers, platform, language, role, and signature.
```typescript
type GetLaunchParamsResponse = {
vk_user_id: number;
vk_app_id: number;
vk_group_id: number;
vk_platform: EGetLaunchParamsResponsePlatforms;
vk_language: EGetLaunchParamsResponseLanguages;
vk_viewer_group_role: EGetLaunchParamsResponseGroupRole;
vk_is_app_user: 0 | 1;
vk_are_notifications_enabled: 0 | 1;
vk_is_favorite: 0 | 1;
vk_ref?: string;
vk_access_token_settings?: string;
sign: string;
vk_ts: number;
}
```
--------------------------------
### Get User Friends List
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Fetches a list of the user's friends. Supports single or multiple friend selection.
```typescript
bridge.send('VKWebAppGetFriends', { multi?: boolean })
```
--------------------------------
### Launch Parameters Parsing
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/README.md
Utility for parsing URL search parameters to retrieve application launch parameters.
```APIDOC
## Launch Parameters Parsing
### Description
Parses URL search parameters to retrieve application launch parameters.
### Functions
- `parseURLSearchParamsForGetLaunchParams(): LaunchParams`
### Types
- `LaunchParams`: Type definition for the parsed launch parameters.
```
--------------------------------
### Get User Information
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Retrieves information about the current user or specific users by their IDs. Useful for personalizing the user experience.
```typescript
bridge.send('VKWebAppGetUserInfo', { user_id?: number; user_ids?: string })
```
```typescript
const userInfo = await bridge.send('VKWebAppGetUserInfo');
console.log(userInfo.first_name, userInfo.last_name);
```
--------------------------------
### Import VK Bridge in Web Applications
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/configuration.md
Import the VK Bridge library to start using its methods in your web application.
```typescript
import bridge from '@vkontakte/vk-bridge';
```
--------------------------------
### Interactive Button with Async Vibration
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/react-hooks.md
Example of using `runTapticImpactOccurredAsync` with React state to manage loading and disabled states during the asynchronous operation.
```typescript
import { useState, useCallback } from 'react';
import { runTapticImpactOccurredAsync } from '@vkontakte/vk-bridge-react';
function InteractiveButton() {
const [isLoading, setIsLoading] = useState(false);
const handleClick = useCallback(async () => {
setIsLoading(true);
try {
await runTapticImpactOccurredAsync('light');
// Handle click action
} finally {
setIsLoading(false);
}
}, []);
return ;
}
```
--------------------------------
### VKWebAppOpenOrderBox
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Opens the order dialog for creating an order.
```APIDOC
## VKWebAppOpenOrderBox
### Description
Opens the order dialog.
### Method
POST
### Endpoint
/VKWebAppOpenOrderBox
### Parameters
#### Request Body
- **options** (object) - Required - Options for the order box.
```
--------------------------------
### VKWebAppGetClientVersion
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Gets native client version information. This method retrieves details about the native VK client version running the application.
```APIDOC
## VKWebAppGetClientVersion
### Description
Gets native client version information. This method retrieves details about the native VK client version running the application.
### Method
`bridge.send`
### Endpoint
`VKWebAppGetClientVersion`
### Response
#### Success Response
- **platform** (string) - The platform of the client.
- **version** (string) - The version of the client.
```
--------------------------------
### Get Group Information
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Use this method to retrieve details about a specific VK group or community. Requires the group ID as a parameter.
```typescript
bridge.send('VKWebAppGetGroupInfo', { group_id: number })
```
--------------------------------
### Get User Information
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/quick-reference.md
Retrieve user details, friends list, email, or phone number. Ensure necessary permissions are granted.
```typescript
const user = await bridge.send('VKWebAppGetUserInfo');
const friends = await bridge.send('VKWebAppGetFriends');
const email = await bridge.send('VKWebAppGetEmail');
const phone = await bridge.send('VKWebAppGetPhoneNumber');
```
--------------------------------
### VKWebAppShowStoryBox
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Opens a dialog for creating and sharing a story.
```APIDOC
## VKWebAppShowStoryBox
### Description
Shows a story creation dialog.
### Method
`bridge.send('VKWebAppShowStoryBox', { /* options */ })
### Response
#### Success Response
- `result` (boolean) - Indicates if the story dialog was shown successfully, always true.
```
--------------------------------
### VKWebAppShowInviteBox
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Opens a dialog to invite friends to the application.
```APIDOC
## VKWebAppShowInviteBox
### Description
Shows an invitation dialog.
### Method
`bridge.send('VKWebAppShowInviteBox')
### Response
#### Success Response
- `success` (boolean) - Indicates if the invitation dialog was shown successfully, always true.
```
--------------------------------
### Send Request with Request ID
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/bridge.md
Example of sending a method with `send` and including a `request_id` to correlate the response. Useful for multiple concurrent requests.
```typescript
const result = await bridge.send('VKWebAppGetUserInfo', {
user_id: 12345,
request_id: 'get_user_123',
});
```
--------------------------------
### VKWebAppShowSubscriptionBox
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Displays a dialog for managing user subscriptions.
```APIDOC
## VKWebAppShowSubscriptionBox
### Description
Shows a subscription dialog.
### Method
`bridge.send('VKWebAppShowSubscriptionBox', { /* options */ })
### Response
#### Success Response
- `ShowSubscriptionBoxResponse` - The response object for the subscription box.
```
--------------------------------
### String Parameters Handling
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/launch-params.md
Parameters such as sign, vk_ref, and vk_access_token_settings are passed through as-is.
```typescript
// Input: ?vk_ref=source_app
// Output: { vk_ref: 'source_app' }
```
--------------------------------
### Configure Middleware for VK Bridge
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/configuration.md
Apply middleware during bridge initialization to intercept and modify requests or responses. This example shows a logger middleware.
```typescript
import bridge, { applyMiddleware } from '@vkontakte/vk-bridge';
// Define middleware
const logger = ({ send, subscribe }) => (next) => async (method, props) => {
console.log('→', method, props);
const result = await next(method, props);
console.log('←', method, result);
return result;
};
// Apply middleware
const enhancedBridge = applyMiddleware(logger)(bridge);
// Use enhanced bridge
export default enhancedBridge;
```
--------------------------------
### Add App to Home Screen
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Use VKWebAppAddToHomeScreen to request adding the application to the user's home screen on mobile devices. The response indicates success.
```typescript
bridge.send('VKWebAppAddToHomeScreen')
```
--------------------------------
### parseURLSearchParamsForGetLaunchParams
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/launch-params.md
Parses URL search parameters (query string) and extracts VK Mini App launch parameters. It automatically converts numeric parameters, validates enumerated values, handles toggle states, and returns a partial object containing only the parsed parameters.
```APIDOC
## Function: parseURLSearchParamsForGetLaunchParams
### Description
Parses URL search parameters (query string) and extracts VK Mini App launch parameters.
### Signature
```typescript
function parseURLSearchParamsForGetLaunchParams(searchParams: string): Partial
```
### Parameters
#### Path Parameters
- **searchParams** (string) - Required - URL search string (typically `window.location.search`)
### Return Type
`Partial` - An object containing parsed launch parameters. Only parameters present in the search string are included.
### Behavior
- Automatically converts numeric parameters to numbers (e.g., `vk_user_id`)
- Validates enumerated values (language, platform, group role)
- Handles toggle states (0/1 conversions)
- Wraps parsing in try-catch for robustness
- Returns partial object—only parsed parameters are included
### Example
```typescript
import { parseURLSearchParamsForGetLaunchParams } from '@vkontakte/vk-bridge';
// Example URL: https://example-mini-app.io/?vk_platform=desktop_web&vk_user_id=12345&vk_language=en
const launchParams = parseURLSearchParamsForGetLaunchParams(window.location.search);
console.log(launchParams.vk_platform); // 'desktop_web'
console.log(launchParams.vk_user_id); // 12345 (as number)
console.log(launchParams.vk_language); // 'en'
```
```
--------------------------------
### Request Modification Middleware for VK Bridge
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/middleware.md
A middleware that modifies outgoing request properties before they are sent. This example adds a 'timestamp' and 'version' to the request props.
```typescript
export const requestModifier = ({ send, subscribe }) => (next) => async (method, props) => {
const modifiedProps = {
...props,
timestamp: Date.now(),
version: '1.0',
};
return await next(method, modifiedProps);
};
```
--------------------------------
### Development Build Command
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/configuration.md
Run the 'watch' script in the 'packages/core' directory to continuously build changes during development. Supports both npm and yarn.
```bash
cd packages/core
npm run watch
# or
yarn watch
```
--------------------------------
### Event Tracking Middleware Example
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/middleware.md
A middleware that logs all incoming bridge events by subscribing to them. It also logs method calls before passing them to the next function.
```typescript
// Middleware that tracks all incoming events
const eventTracker = ({ send, subscribe }) => {
// Set up a listener for all events
subscribe((event) => {
console.log('Event received:', event.detail.type);
});
// Return the send function wrapper
return (next) => async (method, props) => {
console.log('Method called:', method);
return await next(method, props);
};
};
```
--------------------------------
### Parse Launch Parameters from URL Search String
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/launch-params.md
Use this function to parse URL search parameters and extract VK Mini App launch parameters. It automatically converts numeric values, validates enumerated types, and handles toggle states. Returns a partial object containing only the parameters found in the search string.
```typescript
import { parseURLSearchParamsForGetLaunchParams } from '@vkontakte/vk-bridge';
// Example URL: https://example-mini-app.io/?vk_platform=desktop_web&vk_user_id=12345&vk_language=en
const launchParams = parseURLSearchParamsForGetLaunchParams(window.location.search);
console.log(launchParams.vk_platform);
console.log(launchParams.vk_user_id);
console.log(launchParams.vk_language);
```
--------------------------------
### VKWebAppAddToFavorites
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Adds the current application to the user's favorites list.
```APIDOC
## VKWebAppAddToFavorites
### Description
Adds the app to user's favorites.
### Method
`bridge.send('VKWebAppAddToFavorites')
### Response
#### Success Response
- `result` (boolean) - Indicates if the app was added to favorites, always true.
```
--------------------------------
### Common Development Commands
Source: https://github.com/vkcom/vk-bridge/blob/master/CONTRIBUTING.md
Execute these commands from the root of the vk-bridge project to build, test, or lint the codebase. Refer to the root package.json for a full list of available commands.
```sh
yarn run build
```
```sh
yarn run test
```
```sh
yarn run lint
```
--------------------------------
### Get Geolocation Data
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Requests the user's current geolocation data, including latitude, longitude, and accuracy. Returns availability status if data is not accessible.
```typescript
bridge.send('VKWebAppGetGeodata')
```
--------------------------------
### Initialize VK Bridge in Web Applications
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/configuration.md
Call the VKWebAppInit method to initialize the bridge. This is a required step before using other bridge methods.
```typescript
await bridge.send('VKWebAppInit');
```
--------------------------------
### Open Another VK Application - VKWebAppOpenApp
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Opens another VK application. App options should be provided as an object.
```typescript
bridge.send('VKWebAppOpenApp', { /* app options */ })
```
--------------------------------
### Get Values from Application Storage
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Use VKWebAppStorageGet to retrieve specific values from the application's storage by providing an array of keys. The response contains key-value pairs.
```typescript
bridge.send('VKWebAppStorageGet', { keys: string[] })
```
--------------------------------
### Import and Use Default Bridge Instance
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/bridge.md
Demonstrates importing the default singleton instance of VKBridge and using its methods, such as `send`.
```typescript
import bridge from '@vkontakte/vk-bridge';
// `bridge` is an instance of VKBridge with all methods availableridge.send('VKWebAppInit');
```
--------------------------------
### Use Appearance Hook
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/react-hooks.md
Retrieves the current appearance ('light', 'dark', or null if not in embedded mode) and subscribes to changes. It calls `VKWebAppGetConfig` on mount and `VKWebAppUpdateConfig` events. Falls back to scheme-based detection if appearance is not explicitly set. Automatically unsubscribes on unmount and handles errors gracefully. Only works in embedded app mode.
```typescript
import { useAppearance } from '@vkontakte/vk-bridge-react';
function ThemedComponent() {
const appearance = useAppearance();
if (appearance === null) {
return
Not in embedded mode
;
}
return (
{appearance === 'dark' ? '🌙' : '☀️'}
);
}
```
--------------------------------
### useAdaptivity
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/react-hooks.md
Retrieves and subscribes to adaptivity configuration changes from the VK Bridge. It automatically fetches the initial configuration, listens for updates, and cleans up subscriptions.
```APIDOC
## Hook: useAdaptivity
### Description
Retrieves and subscribes to adaptivity configuration changes from the VK Bridge. This hook manages the subscription lifecycle automatically.
### Signature
```typescript
function useAdaptivity(): UseAdaptivity
```
### Return Type
`UseAdaptivity` object containing adaptivity details.
### Return Properties
- **type** (`'force_mobile' | 'force_mobile_compact' | 'adaptive' | null`) - The adaptivity mode, or null if not set.
- **viewportWidth** (`number`) - Current viewport width in pixels (0 if unknown).
- **viewportHeight** (`number`) - Current viewport height in pixels (0 if unknown).
### Behavior
- Calls `VKWebAppGetConfig` on mount to get initial adaptivity.
- Subscribes to `VKWebAppUpdateConfig` events.
- Updates state whenever config changes.
- Automatically unsubscribes on unmount.
- Handles errors gracefully (logs to console).
### Example
```typescript
import { useAdaptivity } from '@vkontakte/vk-bridge-react';
function App() {
const { type, viewportWidth, viewportHeight } = useAdaptivity();
return (
Adaptivity type: {type}
Viewport: {viewportWidth}x{viewportHeight}
{type === 'force_mobile' && (
Using mobile layout
)}
);
}
```
```
--------------------------------
### VKWebAppShowBannerAd
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Displays a banner advertisement to the user.
```APIDOC
## VKWebAppShowBannerAd
### Description
Shows a banner advertisement.
### Method
`bridge.send`
### Endpoint
`VKWebAppShowBannerAd`
### Parameters
#### Request Body
- **ad options** - Optional - Options for displaying the ad.
### Response
#### Success Response (200)
- **VKWebAppShowBannerAdResponse** - Details about the displayed banner ad.
```
--------------------------------
### Show Banner Advertisement
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Use VKWebAppShowBannerAd to display a banner advertisement to the user. Ad options can be specified.
```typescript
bridge.send('VKWebAppShowBannerAd', { /* ad options */ })
```
--------------------------------
### LaunchParams Interface
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/launch-params.md
The LaunchParams interface extends the base GetLaunchParamsResponse to include additional launch-specific parameters. All properties are optional.
```APIDOC
## Interface: LaunchParams
### Description
Provides extended launch parameters for mini-apps, including chat ID, recommendation status, profile information, and testing group details. This interface inherits properties from `GetLaunchParamsResponse`.
### Properties
All properties are optional.
| Property | Type | Description |
|----------|------|-------------|
| vk_chat_id | string | Chat ID if the mini app is launched from a chat |
| vk_is_recommended | number | 1 if the app was recommended, 0 otherwise |
| vk_profile_id | number | Profile ID if launched from a profile |
| vk_has_profile_button | number | 1 if the app has a profile button, 0 otherwise |
| vk_testing_group_id | number | Testing group ID for internal testing |
| odr_enabled | 1 | 1 if ODR (On-Device Referral) is enabled, undefined otherwise |
### Inherited Properties from GetLaunchParamsResponse
- `vk_user_id` (number)
- `vk_app_id` (number)
- `vk_group_id` (number)
- `vk_platform` (string - validated platform enum)
- `vk_language` (string - validated language enum)
- `vk_viewer_group_role` (string - validated role enum)
- `vk_is_app_user` (0 | 1)
- `vk_are_notifications_enabled` (0 | 1)
- `vk_is_favorite` (0 | 1)
- `vk_ref` (string)
- `vk_access_token_settings` (string)
- `sign` (string)
- `vk_ts` (number)
```
--------------------------------
### Show Wall Post Dialog
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Opens a dialog allowing the user to post content to their wall. Accepts optional configuration.
```typescript
bridge.send('VKWebAppShowWallPostBox', { /* options */ })
```
--------------------------------
### VKWebAppShowRequestBox
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Opens a dialog for sending requests or invitations to other users.
```APIDOC
## VKWebAppShowRequestBox
### Description
Shows a request/invitation dialog.
### Method
`bridge.send('VKWebAppShowRequestBox', { /* options */ })
### Response
#### Success Response
- `RequestResult` - The result of the request box interaction.
```
--------------------------------
### Responsive Design with useAdaptivity
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/react-hooks.md
Implements a responsive design pattern using the useAdaptivity hook to conditionally render components based on adaptivity type and viewport width.
```typescript
import { useAdaptivity } from '@vkontakte/vk-bridge-react';
function ResponsiveComponent() {
const { type, viewportWidth } = useAdaptivity();
const isMobile = type === 'force_mobile';
const isCompact = type === 'force_mobile_compact';
return (
{isCompact ? (
) : (
)}
);
}
```
--------------------------------
### Middleware System Usage
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/MANIFEST.txt
Illustrates how to apply middleware to the VK Bridge instance for advanced request handling.
```typescript
import bridge, { applyMiddleware } from '@vkontakte/vk-bridge';
const myMiddleware = (storeAPI) => (next) => (action) => {
console.log('Dispatching action:', action.type);
const result = next(action);
console.log('Action finished:', action.type);
return result;
};
const enhancedBridge = applyMiddleware(myMiddleware)(bridge);
// Use enhancedBridge for sending methods
enhancedBridge.send('VKWebAppInit', {});
```
--------------------------------
### VKWebAppRecommend
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Allows the application to recommend itself to other users.
```APIDOC
## VKWebAppRecommend
### Description
Recommends the app to other users.
### Method
`bridge.send('VKWebAppRecommend')`
```
--------------------------------
### Resize Window - VKWebAppResizeWindow
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Resizes the application window. This method is only available on desktop web. Specify the desired width and optionally the height.
```typescript
bridge.send('VKWebAppResizeWindow', {
width: number;
height?: number;
})
```
--------------------------------
### Show Invite Dialog
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Displays a dialog for inviting friends to the application. This method does not require any parameters.
```typescript
bridge.send('VKWebAppShowInviteBox')
```
--------------------------------
### VKWebAppShowWallPostBox
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Displays a dialog allowing the user to post content to their wall.
```APIDOC
## VKWebAppShowWallPostBox
### Description
Shows a dialog to post to user's wall.
### Method
`bridge.send('VKWebAppShowWallPostBox', { /* options */ })
### Response
#### Success Response
- `post_id` (number | string) - The ID of the created post.
```
--------------------------------
### Show Subscription Dialog
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Displays a dialog for managing user subscriptions. Accepts optional configuration.
```typescript
bridge.send('VKWebAppShowSubscriptionBox', { /* options */ })
```
--------------------------------
### VKWebAppSetViewSettings
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Configures the application's view settings, such as status bar style and action bar color.
```APIDOC
## VKWebAppSetViewSettings
### Description
Sets application view settings (status bar style, action bar color).
### Method
bridge.send
### Parameters
#### Request Parameters
- `status_bar_style` (AppearanceType, required)
- `action_bar_color` (string, optional) - Android only
- `navigation_bar_color` (string, optional) - Android only
```
--------------------------------
### Combine URL Params with Bridge API
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/api-reference/launch-params.md
Combines launch parameters obtained from both URL search parameters and the VKWebAppGetLaunchParams bridge method. This approach is more reliable for embedded contexts.
```typescript
import bridge, { parseURLSearchParamsForGetLaunchParams } from '@vkontakte/vk-bridge';
async function initializeApp() {
// Parse URL parameters
const urlParams = parseURLSearchParamsForGetLaunchParams(window.location.search);
// Get launch parameters from bridge (more reliable for embedded context)
const bridgeParams = await bridge.send('VKWebAppGetLaunchParams');
// Merge or prefer one over the other
const launchParams = { ...urlParams, ...bridgeParams };
console.log('Launch parameters:', launchParams);
}
```
--------------------------------
### Show Story Creation Dialog
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Opens a dialog for creating and sharing a story. Accepts optional configuration.
```typescript
bridge.send('VKWebAppShowStoryBox', { /* options */ })
```
--------------------------------
### Navigation Methods
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/quick-reference.md
Methods for controlling the application's navigation.
```APIDOC
## Navigation
### Description
Methods to control application navigation, such as closing the app or setting the location.
### Methods
- `VKWebAppClose`: Closes the application or a modal view.
- `VKWebAppSetLocation`: Sets the application's location within the VK interface.
### Request Example
```typescript
await bridge.send('VKWebAppClose', { status: 'success' });
await bridge.send('VKWebAppSetLocation', { location: 'tab=feed' });
```
```
--------------------------------
### VKWebAppAddToProfile
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Adds a widget to the user's profile page.
```APIDOC
## VKWebAppAddToProfile
### Description
Adds a widget to user's profile.
### Method
`bridge.send('VKWebAppAddToProfile', { /* options */ })
### Response
#### Success Response
- `AddToProfileResponse` - The response object for adding to profile.
```
--------------------------------
### Recommend App
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Sends a request to recommend the current application to other users. This method does not require any parameters.
```typescript
bridge.send('VKWebAppRecommend')
```
--------------------------------
### VKWebAppAddToHomeScreen
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Requests to add the application to the user's home screen on mobile devices.
```APIDOC
## VKWebAppAddToHomeScreen
### Description
Requests to add the app to the home screen on mobile devices.
### Method
POST
### Endpoint
/VKWebAppAddToHomeScreen
### Parameters
This method does not accept any parameters.
### Request Example
```json
{
"event": "VKWebAppAddToHomeScreen"
}
```
### Response
#### Success Response (200)
- **result** (boolean) - Indicates if the request was successful.
```
--------------------------------
### Clone vk-bridge Repository
Source: https://github.com/vkcom/vk-bridge/blob/master/CONTRIBUTING.md
Clone the vk-bridge repository to your local machine to begin development. Ensure you replace YOUR_USERNAME with your GitHub username.
```sh
git clone https://github.com/YOUR_USERNAME/vk-bridge.git
```
--------------------------------
### VKWebAppOpenQR
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Opens a QR code scanner as an alternative to VKWebAppOpenCodeReader.
```APIDOC
## VKWebAppOpenQR
### Description
Opens the QR code scanner (alternative).
### Method
`bridge.send`
### Endpoint
`VKWebAppOpenQR`
### Response
#### Success Response (200)
- **code_data** (string) - The data read from the QR code.
```
--------------------------------
### VKWebAppAddToCommunity
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/methods.md
Requests the user to add the application to their community.
```APIDOC
## VKWebAppAddToCommunity
### Description
Requests user to add the app to their community.
### Method
bridge.send
### Parameters
#### Request Parameters
- `group_id` (number, required) - Community ID
### Response
`{ group_id: number }`
```
--------------------------------
### Biome Linting Configuration
Source: https://github.com/vkcom/vk-bridge/blob/master/_autodocs/configuration.md
Sets up Biome for linting, providing commands to check code for errors and automatically fix them.
```json
{
"lint:biome": "biome check",
"lint:biome:fix": "biome check --write"
}
```