first commit

This commit is contained in:
2025-12-27 18:18:32 +03:00
commit 2d20861db1
228 changed files with 467019 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

715
node_modules/@vkontakte/vk-bridge/dist/index.es.js generated vendored Normal file
View File

@@ -0,0 +1,715 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
/**
* Creates counter interface.
*/
function createCounter() {
return {
current: 0,
next: function () {
return ++this.current;
},
};
}
/**
* Creates interface for resolving request promises by request id's (or not).
*
* @param instanceId Uniq bridge instance ID.
*/
function createRequestResolver(instanceId) {
var counter = createCounter();
var promiseControllers = {};
return {
/**
* Adds new controller with resolve/reject methods.
*
* @param controller Object with `resolve` and `reject` functions
* @param customId Custom `request_id`
* @returns New request id of the added controller.
*/
add: function (controller, customId) {
var id = customId != null ? customId : "".concat(counter.next(), "_").concat(instanceId);
promiseControllers[id] = controller;
return id;
},
/**
* Resolves/rejects an added promise by request id and the `isSuccess`
* predicate.
*
* @param requestId Request ID.
* @param data Data to pass to the resolve- or reject-function.
* @param isSuccess Predicate to select the desired function.
*/
resolve: function (requestId, data, isSuccess) {
var requestPromise = promiseControllers[requestId];
if (requestPromise) {
if (isSuccess(data)) {
requestPromise.resolve(data);
}
else {
requestPromise.reject(data);
}
promiseControllers[requestId] = null;
}
},
};
}
/**
* Returns send function that returns promises.
*
* @param sendEvent Send event function.
* @param subscribe Subscribe event function.
* @param instanceId Uniq bridge instance ID.
* @returns Send function which returns the Promise object.
*/
function promisifySend(sendEvent, subscribe, instanceId) {
var requestResolver = createRequestResolver(instanceId);
// Subscribe to receive a data
subscribe(function (event) {
if (!event.detail || !event.detail.data || typeof event.detail.data !== 'object') {
return;
}
// There is no request_id in receive-only events, so we check its existence.
if ('request_id' in event.detail.data) {
var _a = event.detail.data, requestId = _a.request_id, data = __rest(_a, ["request_id"]);
if (requestId) {
requestResolver.resolve(requestId, data, function (data) { return !('error_type' in data); });
}
}
});
return function promisifiedSend(method, props) {
if (props === void 0) { props = {}; }
return new Promise(function (resolve, reject) {
var requestId = requestResolver.add({ resolve: resolve, reject: reject }, props.request_id);
sendEvent(method, __assign(__assign({}, props), { request_id: requestId }));
});
};
}
function createInstanceId() {
var allNumbersAndLetters = 36;
var positionAfterZeroAnDot = 2;
var keyLength = 3;
return Math.random()
.toString(allNumbersAndLetters)
.substring(positionAfterZeroAnDot, positionAfterZeroAnDot + keyLength);
}
/** Is the client side runtime environment */
var IS_CLIENT_SIDE = typeof window !== 'undefined';
/** Is the runtime environment an Android app */
var IS_ANDROID_WEBVIEW = Boolean(IS_CLIENT_SIDE && window.AndroidBridge);
/** Is the runtime environment an iOS app */
var IS_IOS_WEBVIEW = Boolean(IS_CLIENT_SIDE &&
window.webkit &&
window.webkit.messageHandlers &&
window.webkit.messageHandlers.VKWebAppClose);
var IS_REACT_NATIVE_WEBVIEW = Boolean(IS_CLIENT_SIDE &&
window.ReactNativeWebView &&
typeof window.ReactNativeWebView.postMessage === 'function');
/** Is the runtime environment a browser */
var IS_WEB = IS_CLIENT_SIDE && !IS_ANDROID_WEBVIEW && !IS_IOS_WEBVIEW;
/** Is the runtime environment m.vk.ru */
var IS_MVK = IS_WEB && /(^\?|&)vk_platform=mobile_web(&|$)/.test(location.search);
/** Is the runtime environment vk.ru */
var IS_DESKTOP_VK = IS_WEB && !IS_MVK;
/** Type of subscribe event */
var EVENT_TYPE = IS_WEB ? 'message' : 'VKWebAppEvent';
/** Methods supported on the desktop */
var DESKTOP_METHODS = __spreadArray([
'VKWebAppInit',
'VKWebAppGetCommunityAuthToken',
'VKWebAppAddToCommunity',
'VKWebAppAddToHomeScreenInfo',
'VKWebAppClose',
'VKWebAppCopyText',
'VKWebAppCreateHash',
'VKWebAppGetUserInfo',
'VKWebAppSetLocation',
'VKWebAppSendToClient',
'VKWebAppGetClientVersion',
'VKWebAppGetPhoneNumber',
'VKWebAppGetEmail',
'VKWebAppGetGroupInfo',
'VKWebAppGetGeodata',
'VKWebAppGetCommunityToken',
'VKWebAppGetConfig',
'VKWebAppGetLaunchParams',
'VKWebAppSetTitle',
'VKWebAppGetAuthToken',
'VKWebAppCallAPIMethod',
'VKWebAppJoinGroup',
'VKWebAppLeaveGroup',
'VKWebAppAllowMessagesFromGroup',
'VKWebAppDenyNotifications',
'VKWebAppAllowNotifications',
'VKWebAppOpenPayForm',
'VKWebAppOpenApp',
'VKWebAppShare',
'VKWebAppShowWallPostBox',
'VKWebAppScroll',
'VKWebAppShowOrderBox',
'VKWebAppShowLeaderBoardBox',
'VKWebAppShowInviteBox',
'VKWebAppShowRequestBox',
'VKWebAppAddToFavorites',
'VKWebAppShowStoryBox',
'VKWebAppStorageGet',
'VKWebAppStorageGetKeys',
'VKWebAppStorageSet',
'VKWebAppFlashGetInfo',
'VKWebAppSubscribeStoryApp',
'VKWebAppOpenWallPost',
'VKWebAppCheckAllowedScopes',
'VKWebAppCheckBannerAd',
'VKWebAppHideBannerAd',
'VKWebAppShowBannerAd',
'VKWebAppCheckNativeAds',
'VKWebAppShowNativeAds',
'VKWebAppRetargetingPixel',
'VKWebAppConversionHit',
'VKWebAppShowSubscriptionBox',
'VKWebAppCheckSurvey',
'VKWebAppShowSurvey',
'VKWebAppScrollTop',
'VKWebAppScrollTopStart',
'VKWebAppScrollTopStop',
'VKWebAppShowSlidesSheet',
'VKWebAppTranslate',
'VKWebAppRecommend',
'VKWebAppAddToProfile',
'VKWebAppGetFriends'
], (IS_DESKTOP_VK
? [
'VKWebAppResizeWindow',
'VKWebAppAddToMenu',
'VKWebAppShowInstallPushBox',
'VKWebAppShowCommunityWidgetPreviewBox',
'VKWebAppCallStart',
'VKWebAppCallJoin',
'VKWebAppCallGetStatus',
]
: ['VKWebAppShowImages']), true);
/** Cache for supported methods */
var supportedHandlers;
/** Android VK Bridge interface. */
var androidBridge = IS_CLIENT_SIDE ? window.AndroidBridge : undefined;
/** iOS VK Bridge interface. */
var iosBridge = IS_IOS_WEBVIEW ? window.webkit.messageHandlers : undefined;
/** Web VK Bridge interface. */
var webBridge = IS_WEB
? parent
: undefined;
// [Примечание 1] Отключили использование в этом PR https://github.com/VKCOM/vk-bridge/pull/262
// let webSdkHandlers: string[] | undefined;
/**
* Creates a VK Bridge API that holds functions for interact with runtime
* environment.
*
* @param version Version of the package
*/
function createVKBridge(version) {
/** Current frame id. */
var webFrameId = undefined;
/** List of functions that subscribed on events. */
var subscribers = [];
/** Uniq instance ID */
var instanceId = createInstanceId();
/**
* Sends an event to the runtime env. In the case of Android/iOS application
* env is the application itself. In the case of the browser, the parent
* frame in which the event handlers is located.
*
* @param method The method (event) name to send
* @param [props] Method properties
*/
function send(method, props) {
// Sending data through Android bridge
if (androidBridge && androidBridge[method]) {
androidBridge[method](JSON.stringify(props));
}
// Sending data through iOS bridge
else if (iosBridge &&
iosBridge[method] &&
typeof iosBridge[method].postMessage === 'function') {
iosBridge[method].postMessage(props);
}
// Sending data through React Native bridge
else if (IS_REACT_NATIVE_WEBVIEW) {
window.ReactNativeWebView.postMessage(JSON.stringify({
handler: method,
params: props,
}));
}
// Sending data through web bridge
else if (webBridge && typeof webBridge.postMessage === 'function') {
webBridge.postMessage({
handler: method,
params: props,
type: 'vk-connect',
webFrameId: webFrameId,
connectVersion: version,
}, '*');
}
}
/**
* Adds an event listener. It will be called any time a data is received.
*
* @param listener A callback to be invoked on every event receive.
*/
function subscribe(listener) {
subscribers.push(listener);
}
/**
* Removes an event listener which has been subscribed for event listening.
*
* @param listener A callback to unsubscribe.
*/
function unsubscribe(listener) {
var index = subscribers.indexOf(listener);
if (index > -1) {
subscribers.splice(index, 1);
}
}
function supportsInner(method) {
if (IS_ANDROID_WEBVIEW) {
// Android support check
return !!(androidBridge && typeof androidBridge[method] === 'function');
}
else if (IS_IOS_WEBVIEW) {
// iOS support check
return !!(iosBridge &&
iosBridge[method] &&
typeof iosBridge[method].postMessage === 'function');
}
else if (IS_WEB) {
// Web support check
return DESKTOP_METHODS.includes(method);
// см. Примечание 1
// if (!webSdkHandlers) {
// console.error('You should call bridge.send("VKWebAppInit") first');
// return false;
// }
// return webSdkHandlers.includes(method);
}
return false;
}
/**
* Checks if a method is supported on runtime platform.
*
* @param method Method (event) name to check.
* @returns Result of checking.
* @deprecated This method is deprecated. Use supportsAsync instead.
*/
function supports(method) {
console.warn('bridge.supports method is deprecated. Use bridge.supportsAsync instead.');
return supportsInner(method);
}
/**
* Checks whether the runtime is a WebView.
*
* @returns Result of checking.
*/
function isWebView() {
return IS_IOS_WEBVIEW || IS_ANDROID_WEBVIEW;
}
/**
* Checks whether the runtime is an iframe.
*
* @returns Result of checking.
*/
function isIframe() {
return IS_WEB && window.parent !== window;
}
/**
* Checks whether the runtime is embedded.
*
* @returns Result of checking.
*/
function isEmbedded() {
return isWebView() || isIframe();
}
/**
* Checks whether the runtime is standalone.
*
* @returns Result of checking.
*/
function isStandalone() {
return !isEmbedded();
}
function handleEvent(event) {
if (IS_IOS_WEBVIEW || IS_ANDROID_WEBVIEW) {
// If it's webview
return __spreadArray([], subscribers, true).map(function (fn) { return fn.call(null, event); });
}
var bridgeEventData = event === null || event === void 0 ? void 0 : event.data;
if (!IS_WEB || !bridgeEventData) {
return;
}
if (IS_REACT_NATIVE_WEBVIEW && typeof bridgeEventData === 'string') {
try {
bridgeEventData = JSON.parse(bridgeEventData);
}
catch (_a) { }
}
var type = bridgeEventData.type, data = bridgeEventData.data, frameId = bridgeEventData.frameId;
if (!type) {
return;
}
// см. Примечание 1
// if (type === 'SetSupportedHandlers') {
// webSdkHandlers = data.supportedHandlers;
// return;
// }
if (type === 'VKWebAppSettings') {
webFrameId = frameId;
return;
}
__spreadArray([], subscribers, true).map(function (fn) { return fn({ detail: { type: type, data: data } }); });
}
// Subscribes to listening messages from a runtime for calling each
// subscribed event listener.
if (IS_REACT_NATIVE_WEBVIEW && /(android)/i.test(navigator.userAgent)) {
document.addEventListener(EVENT_TYPE, handleEvent);
}
else if (typeof window !== 'undefined' && 'addEventListener' in window) {
window.addEventListener(EVENT_TYPE, handleEvent);
}
/**
* Enhanced send functions for the ability to receive response data in
* the Promise object.
*/
var sendPromise = promisifySend(send, subscribe, instanceId);
function supportsAsync(method) {
return __awaiter(this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (IS_ANDROID_WEBVIEW || IS_IOS_WEBVIEW) {
return [2 /*return*/, supportsInner(method)];
}
if (supportedHandlers) {
return [2 /*return*/, supportedHandlers.has(method)];
}
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, sendPromise('SetSupportedHandlers')];
case 2:
response = _a.sent();
supportedHandlers = new Set(response.supportedHandlers);
return [3 /*break*/, 4];
case 3:
_a.sent();
supportedHandlers = new Set(['VKWebAppInit']);
return [3 /*break*/, 4];
case 4: return [2 /*return*/, supportedHandlers.has(method)];
}
});
});
}
subscribe(function (event) {
if (!event.detail) {
return;
}
switch (event.detail.type) {
case 'SetSupportedHandlers':
supportedHandlers = new Set(event.detail.data.supportedHandlers);
}
});
return {
send: sendPromise,
sendPromise: sendPromise,
subscribe: subscribe,
unsubscribe: unsubscribe,
supports: supports,
supportsAsync: supportsAsync,
isWebView: isWebView,
isIframe: isIframe,
isEmbedded: isEmbedded,
isStandalone: isStandalone,
};
}
var version = "2.15.11";
var EAdsFormats;
(function (EAdsFormats) {
EAdsFormats["REWARD"] = "reward";
EAdsFormats["INTERSTITIAL"] = "interstitial";
})(EAdsFormats || (EAdsFormats = {}));
var BannerAdLayoutType;
(function (BannerAdLayoutType) {
BannerAdLayoutType["RESIZE"] = "resize";
BannerAdLayoutType["OVERLAY"] = "overlay";
})(BannerAdLayoutType || (BannerAdLayoutType = {}));
var BannerAdLocation;
(function (BannerAdLocation) {
BannerAdLocation["TOP"] = "top";
BannerAdLocation["BOTTOM"] = "bottom";
})(BannerAdLocation || (BannerAdLocation = {}));
var BannerAdAlign;
(function (BannerAdAlign) {
BannerAdAlign["LEFT"] = "left";
BannerAdAlign["RIGHT"] = "right";
BannerAdAlign["CENTER"] = "center";
})(BannerAdAlign || (BannerAdAlign = {}));
var BannerAdHeightType;
(function (BannerAdHeightType) {
BannerAdHeightType["COMPACT"] = "compact";
BannerAdHeightType["REGULAR"] = "regular";
})(BannerAdHeightType || (BannerAdHeightType = {}));
var BannerAdOrientation;
(function (BannerAdOrientation) {
BannerAdOrientation["HORIZONTAL"] = "horizontal";
BannerAdOrientation["VERTICAL"] = "vertical";
})(BannerAdOrientation || (BannerAdOrientation = {}));
var EGrantedPermission;
(function (EGrantedPermission) {
EGrantedPermission["CAMERA"] = "camera";
EGrantedPermission["LOCATION"] = "location";
EGrantedPermission["PHOTO"] = "photo";
})(EGrantedPermission || (EGrantedPermission = {}));
var EGetLaunchParamsResponseLanguages;
(function (EGetLaunchParamsResponseLanguages) {
EGetLaunchParamsResponseLanguages["RU"] = "ru";
EGetLaunchParamsResponseLanguages["UK"] = "uk";
EGetLaunchParamsResponseLanguages["UA"] = "ua";
EGetLaunchParamsResponseLanguages["EN"] = "en";
EGetLaunchParamsResponseLanguages["BE"] = "be";
EGetLaunchParamsResponseLanguages["KZ"] = "kz";
EGetLaunchParamsResponseLanguages["PT"] = "pt";
EGetLaunchParamsResponseLanguages["ES"] = "es";
})(EGetLaunchParamsResponseLanguages || (EGetLaunchParamsResponseLanguages = {}));
var EGetLaunchParamsResponseGroupRole;
(function (EGetLaunchParamsResponseGroupRole) {
EGetLaunchParamsResponseGroupRole["ADMIN"] = "admin";
EGetLaunchParamsResponseGroupRole["EDITOR"] = "editor";
EGetLaunchParamsResponseGroupRole["MEMBER"] = "member";
EGetLaunchParamsResponseGroupRole["MODER"] = "moder";
EGetLaunchParamsResponseGroupRole["NONE"] = "none";
})(EGetLaunchParamsResponseGroupRole || (EGetLaunchParamsResponseGroupRole = {}));
var EGetLaunchParamsResponsePlatforms;
(function (EGetLaunchParamsResponsePlatforms) {
EGetLaunchParamsResponsePlatforms["DESKTOP_WEB"] = "desktop_web";
EGetLaunchParamsResponsePlatforms["DESKTOP_WEB_MESSENGER"] = "desktop_web_messenger";
EGetLaunchParamsResponsePlatforms["DESKTOP_APP_MESSENGER"] = "desktop_app_messenger";
EGetLaunchParamsResponsePlatforms["MOBILE_WEB"] = "mobile_web";
EGetLaunchParamsResponsePlatforms["MOBILE_ANDROID"] = "mobile_android";
EGetLaunchParamsResponsePlatforms["MOBILE_ANDROID_MESSENGER"] = "mobile_android_messenger";
EGetLaunchParamsResponsePlatforms["MOBILE_IPHONE"] = "mobile_iphone";
EGetLaunchParamsResponsePlatforms["MOBILE_IPHONE_MESSENGER"] = "mobile_iphone_messenger";
EGetLaunchParamsResponsePlatforms["MOBILE_IPAD"] = "mobile_ipad";
})(EGetLaunchParamsResponsePlatforms || (EGetLaunchParamsResponsePlatforms = {}));
/**
* Creates the VK Bridge enhancer that applies middleware to the `send`
* method. This is handy for a variety of task such as logging every sent
* event.
*
* @param middlewares The middleware chain to be applied.
* @returns The VK Bridge enhancer applying the middleware.
*/
function applyMiddleware() {
var middlewares = [];
for (var _i = 0; _i < arguments.length; _i++) {
middlewares[_i] = arguments[_i];
}
if (middlewares.includes(undefined) || middlewares.includes(null)) {
return applyMiddleware.apply(void 0, middlewares.filter(function (item) { return typeof item === 'function'; }));
}
return function (bridge) {
if (middlewares.length === 0) {
return bridge;
}
var send = function () {
throw new Error('Sending events while constructing your middleware is not allowed. ' +
'Other middleware would not be applied to this send.');
};
var middlewareAPI = {
subscribe: bridge.subscribe,
send: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return bridge.send.apply(bridge, args);
},
};
var chain = middlewares
.filter(function (item) { return typeof item === 'function'; })
.map(function (middleware) { return middleware(middlewareAPI); }) //
.reduce(function (a, b) { return function (send) { return a(b(send)); }; });
send = chain(bridge.send);
return __assign(__assign({}, bridge), { send: send });
};
}
/**
* @see https://dev.vk.ru/mini-apps/development/launch-params
*/
var parseURLSearchParamsForGetLaunchParams = function (searchParams) {
var launchParams = {};
try {
var parsedSearchParams = new URLSearchParams(searchParams);
var convertToggleStateFromStringToNumber_1 = function (value) {
switch (value) {
case '0':
return 0;
case '1':
return 1;
default:
return undefined;
}
};
parsedSearchParams.forEach(function (value, query) {
switch (query) {
case 'vk_ts':
case 'vk_is_recommended':
case 'vk_profile_id':
case 'vk_has_profile_button':
case 'vk_testing_group_id':
case 'vk_user_id':
case 'vk_app_id':
case 'vk_group_id':
launchParams[query] = Number(value);
break;
case 'sign':
case 'vk_chat_id':
case 'vk_ref':
case 'vk_access_token_settings':
launchParams[query] = value;
break;
case 'odr_enabled':
launchParams['odr_enabled'] = value === '1' ? 1 : undefined;
break;
case 'vk_is_app_user':
case 'vk_are_notifications_enabled':
case 'vk_is_favorite': {
launchParams[query] = convertToggleStateFromStringToNumber_1(value);
break;
}
case 'vk_language': {
var validateVKLanguage = function (value) {
return Object.values(EGetLaunchParamsResponseLanguages).some(function (i) { return i === value; });
};
launchParams['vk_language'] = validateVKLanguage(value) ? value : undefined;
break;
}
case 'vk_viewer_group_role': {
var validateVKViewerGroupRole = function (value) {
return Object.values(EGetLaunchParamsResponseGroupRole).some(function (i) { return i === value; });
};
launchParams['vk_viewer_group_role'] = validateVKViewerGroupRole(value)
? value
: undefined;
break;
}
case 'vk_platform': {
var validateVKPlatform = function (value) {
return Object.values(EGetLaunchParamsResponsePlatforms).some(function (i) { return i === value; });
};
launchParams['vk_platform'] = validateVKPlatform(value) ? value : undefined;
break;
}
}
});
}
catch (e) {
console.warn(e);
}
return launchParams;
};
// VK Bridge API
var bridge = createVKBridge(version);
export { BannerAdAlign, BannerAdHeightType, BannerAdLayoutType, BannerAdLocation, BannerAdOrientation, EAdsFormats, EGetLaunchParamsResponseGroupRole, EGetLaunchParamsResponseLanguages, EGetLaunchParamsResponsePlatforms, EGrantedPermission, applyMiddleware, bridge as default, parseURLSearchParamsForGetLaunchParams };
//# sourceMappingURL=index.es.js.map

File diff suppressed because one or more lines are too long

2
node_modules/@vkontakte/vk-bridge/dist/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/@vkontakte/vk-bridge/dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/@vkontakte/vk-bridge/dist/index.umd.js generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
import { VKBridge } from './types/bridge';
import { Middleware } from './types/middleware';
/**
* Creates the VK Bridge enhancer that applies middleware to the `send`
* method. This is handy for a variety of task such as logging every sent
* event.
*
* @param middlewares The middleware chain to be applied.
* @returns The VK Bridge enhancer applying the middleware.
*/
export declare function applyMiddleware(...middlewares: Array<Middleware | undefined | null>): (bridge: VKBridge) => VKBridge;

View File

@@ -0,0 +1,25 @@
import { VKBridge } from './types/bridge';
/** Is the client side runtime environment */
export declare const IS_CLIENT_SIDE: boolean;
/** Is the runtime environment an Android app */
export declare const IS_ANDROID_WEBVIEW: boolean;
/** Is the runtime environment an iOS app */
export declare const IS_IOS_WEBVIEW: boolean;
export declare const IS_REACT_NATIVE_WEBVIEW: boolean;
/** Is the runtime environment a browser */
export declare const IS_WEB: boolean;
/** Is the runtime environment m.vk.ru */
export declare const IS_MVK: boolean;
/** Is the runtime environment vk.ru */
export declare const IS_DESKTOP_VK: boolean;
/** Type of subscribe event */
export declare const EVENT_TYPE: string;
/** Methods supported on the desktop */
export declare const DESKTOP_METHODS: string[];
/**
* Creates a VK Bridge API that holds functions for interact with runtime
* environment.
*
* @param version Version of the package
*/
export declare function createVKBridge(version: string): VKBridge;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,8 @@
declare const bridge: import("./types/bridge").VKBridge;
export * from './types/data';
export * from './types/bridge';
export * from './types/middleware';
export * from './types/deprecated';
export { applyMiddleware } from './applyMiddleware';
export { parseURLSearchParamsForGetLaunchParams } from './parseURLSearchParamsForGetLaunchParams';
export { bridge as default };

View File

@@ -0,0 +1,13 @@
import type { GetLaunchParamsResponse } from './types/data';
export interface LaunchParams extends GetLaunchParamsResponse {
vk_chat_id: string;
vk_is_recommended: number;
vk_profile_id: number;
vk_has_profile_button: number;
vk_testing_group_id: number;
odr_enabled: undefined | 1;
}
/**
* @see https://dev.vk.ru/mini-apps/development/launch-params
*/
export declare const parseURLSearchParamsForGetLaunchParams: (searchParams: string) => Partial<LaunchParams>;

View File

@@ -0,0 +1,10 @@
import { VKBridgeSubscribeHandler, AnyRequestMethodName, RequestProps, RequestIdProp, ReceiveData, AnyReceiveMethodName } from './types/bridge';
/**
* Returns send function that returns promises.
*
* @param sendEvent Send event function.
* @param subscribe Subscribe event function.
* @param instanceId Uniq bridge instance ID.
* @returns Send function which returns the Promise object.
*/
export declare function promisifySend(sendEvent: <K extends AnyRequestMethodName>(method: K, props?: RequestProps<K> & RequestIdProp) => void, subscribe: (fn: VKBridgeSubscribeHandler) => void, instanceId: string): <K extends keyof import(".").RequestPropsMap>(method: K, props?: RequestProps<K> & RequestIdProp) => Promise<K extends keyof import(".").ReceiveDataMap ? ReceiveData<K> : void>;

View File

@@ -0,0 +1,207 @@
import { RequestPropsMap, ReceiveDataMap, ReceiveEventMap } from './data';
/**
* Name of a method that can be sent.
*/
export type AnyRequestMethodName = keyof RequestPropsMap;
/**
* Name of a method that can be received.
*/
export type AnyReceiveMethodName = keyof ReceiveDataMap;
/**
* Name of a method that can be only sent.
*/
export type AnyRequestOnlyMethodName = Exclude<AnyRequestMethodName, AnyReceiveMethodName>;
/**
* Name of a method that can be only received.
*/
export type AnyReceiveOnlyMethodName = Exclude<AnyReceiveMethodName, AnyRequestMethodName>;
/**
* Name of a method which contains properties
*/
export type AnyRequestMethodNameWithProps = {
[K in keyof RequestPropsMap]: keyof RequestPropsMap[K] extends never ? never : K;
}[keyof RequestPropsMap];
/**
* Name of a method which doesn't contain properties
*/
export type AnyRequestMethodNameWithoutProps = Exclude<AnyRequestMethodName, AnyRequestMethodNameWithProps>;
/**
* Type of any method name.
*/
export type AnyMethodName = AnyRequestMethodName | AnyReceiveMethodName;
/**
* The name of the method that can be both sent and received.
*/
export type AnyIOMethodName = AnyRequestMethodName & AnyReceiveMethodName;
/**
* Any failed event method name.
*/
export type AnyFailedResponseEventName = FailedResponseEventName<AnyRequestMethodName>;
/**
* Any result response event method name.
*/
export type AnyResultResponseEventName = ResultResponseEventName<AnyRequestMethodName>;
/**
* Getter of failed event name of a method.
*/
export type FailedResponseEventName<M extends AnyRequestMethodName> = M extends keyof ReceiveEventMap ? ReceiveEventMap[M]['failed'] : never;
/**
* Getter of result event name of a method.
*/
export type ResultResponseEventName<M extends AnyRequestMethodName> = M extends keyof ReceiveEventMap ? ReceiveEventMap[M]['result'] : never;
/**
* Getter of request properties of a method.
*/
export type RequestProps<M extends AnyRequestMethodName = AnyRequestMethodName> = RequestPropsMap[M];
/**
* Getter of response data of a method.
*/
export type ReceiveData<M extends AnyReceiveMethodName> = ReceiveDataMap[M];
/**
* Property for matching sent request and received message.
*/
export type RequestIdProp = {
request_id?: number | string;
};
/**
* Client error data.
*/
export type ErrorDataClientError = {
error_code: number;
error_reason: string;
error_description?: string;
};
/**
* API error data.
*/
export type ErrorDataAPIError = {
error_code: number;
error_msg: string;
request_params: string[];
};
/**
* Auth error data.
*/
export type ErrorDataAuthError = {
error_code: number;
error_reason: string;
error_description?: string[];
};
/**
* Type of error data
*/
export type ErrorData = {
error_type: 'client_error';
error_data: ErrorDataClientError;
request_id?: number | string;
} | {
error_type: 'api_error';
error_data: ErrorDataAPIError;
request_id?: number | string;
} | {
error_type: 'auth_error';
error_data: ErrorDataAuthError;
request_id?: number | string;
};
/**
* Generic event type for creating event types.
*/
export type VKBridgeEventBase<Type extends string, Data> = {
detail: {
type: Type;
data: Data;
};
};
/**
* Type of error event data
*/
export type VKBridgeErrorEvent<M extends AnyReceiveMethodName> = VKBridgeEventBase<M extends AnyRequestMethodName ? FailedResponseEventName<M> : never, ErrorData>;
/**
* Type of event that is a response to a request
*/
export type VKBridgeIOEvent<M extends AnyIOMethodName> = {
[K in M]: VKBridgeEventBase<ResultResponseEventName<K>, ReceiveData<K> & RequestIdProp>;
}[M];
/**
* Type of event that is not a response to a request
*/
export type VKBridgeReceiveOnlyEvent<M extends AnyReceiveOnlyMethodName> = {
[K in M]: VKBridgeEventBase<K, ReceiveData<K>>;
}[M];
/**
* Type of result event data
*/
export type VKBridgeResultEvent<M extends AnyReceiveMethodName> = M extends AnyReceiveOnlyMethodName ? VKBridgeReceiveOnlyEvent<M> : M extends AnyIOMethodName ? VKBridgeIOEvent<M> : never;
/**
* VK Bridge event.
*/
export type VKBridgeEvent<M extends AnyReceiveMethodName> = VKBridgeErrorEvent<M> | VKBridgeResultEvent<M>;
/**
* Type of function that will be subscribed to VK Bridge events.
*/
export type VKBridgeSubscribeHandler = (event: VKBridgeEvent<AnyReceiveMethodName>) => void;
/**
* Type of send function for methods that have props.
*
* @param method The method (event) name to send.
* @param props Method properties.
* @returns The Promise object with response data.
*/
export type VKBridgeSend = <K extends AnyRequestMethodName>(method: K, props?: RequestProps<K> & RequestIdProp) => Promise<K extends AnyReceiveMethodName ? ReceiveData<K> : void>;
/**
* VK Bridge interface.
*/
export interface VKBridge {
/**
* Sends an event to the runtime env and returns the Promise object with
* response data. In the case of Android/iOS application env is the
* application itself. In the case of the browser, the parent frame in which
* the event handlers is located.
*
* @param method The method (event) name to send.
* @param [props] Method properties.
* @returns The Promise object with response data.
*/
send: VKBridgeSend;
/**
* @alias send
* @deprecated
*/
sendPromise: VKBridgeSend;
/**
* Adds an event listener. It will be called any time a data is received.
*
* @param listener A callback to be invoked on every event receive.
*/
subscribe: (listener: VKBridgeSubscribeHandler) => void;
/**
* Removes an event listener which has been subscribed for event listening.
*
* @param listener A callback to unsubscribe.
*/
unsubscribe: (listener: VKBridgeSubscribeHandler) => void;
/**
* Checks if a method is supported on runtime platform.
*
* @param method Method (event) name to check.
* @returns Result of checking.
* @deprecated This method is deprecated. Use supportsAsync instead.
*/
supports: <K extends AnyRequestMethodName>(method: K) => boolean;
/**
* Checks if a method is supported on runtime platform.
*
* @param method Method (event) name to check.
* @returns The Promise object with result of checking.
*/
supportsAsync: <K extends AnyRequestMethodName>(method: K) => Promise<boolean>;
/**
* Checks whether the runtime is a WebView.
*
* @returns Result of checking.
*/
isWebView: () => boolean;
isIframe: () => boolean;
isEmbedded: () => boolean;
isStandalone: () => boolean;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,56 @@
import { AnyRequestMethodName, AnyReceiveMethodName, AnyRequestMethodNameWithProps, AnyRequestMethodNameWithoutProps, AnyMethodName, AnyIOMethodName, AnyRequestOnlyMethodName, AnyReceiveOnlyMethodName } from './bridge';
import { CommunityWidgetType } from './data';
/**
* Name of a method that can be sent.
* @alias AnyRequestMethodName
* @deprecated
*/
export type RequestMethodName = AnyRequestMethodName;
/**
* Name of a method that can be received.
* @alias AnyReceiveMethodName
* @deprecated
*/
export type ReceiveMethodName = AnyReceiveMethodName;
/**
* Name of a method that can be only sent.
* @alias AnyRequestOnlyMethodName
* @deprecated
*/
export type RequestOnlyMethodName = AnyRequestOnlyMethodName;
/**
* Name of a method that can be only received.
* @alias AnyReceiveOnlyMethodName
* @deprecated
*/
export type ReceiveOnlyMethodName = AnyReceiveOnlyMethodName;
/**
* Name of a method which contains properties
* @alias AnyRequestMethodNameWithProps
* @deprecated
*/
export type RequestMethodNameWithProps = AnyRequestMethodNameWithProps;
/**
* Name of a method which doesn't contain properties
* @alias AnyRequestMethodNameWithoutProps
* @deprecated
*/
export type RequestMethodNameWithoutProps = AnyRequestMethodNameWithoutProps;
/**
* Type of any method name.
* @alias AnyMethodName
* @deprecated
*/
export type MethodName = AnyMethodName;
/**
* The name of the method that can be both sent and received.
* @alias AnyIOMethodName
* @deprecated
*/
export type IOMethodName = AnyIOMethodName;
/**
* Community widget type
* @alias CommunityWidgetType
* @deprecated
*/
export type WidgetType = CommunityWidgetType;

View File

@@ -0,0 +1,13 @@
import { VKBridgeSend, VKBridgeSubscribeHandler } from './bridge';
/**
* API that can use middleware.
*/
export interface MiddlewareAPI<S extends VKBridgeSend = VKBridgeSend, L extends VKBridgeSubscribeHandler = VKBridgeSubscribeHandler> {
send: S;
subscribe(listener: L): void;
}
/**
* A middleware is a higher-order function that composes a dispatch function
* to return a new `send` function.
*/
export type Middleware<S extends VKBridgeSend = VKBridgeSend> = (api: MiddlewareAPI<S>) => (next: S) => S;

View File

@@ -0,0 +1 @@
export declare function createInstanceId(): string;

View File

@@ -0,0 +1,11 @@
import { VKBridge } from './types/bridge';
import { Middleware } from './types/middleware';
/**
* Creates the VK Bridge enhancer that applies middleware to the `send`
* method. This is handy for a variety of task such as logging every sent
* event.
*
* @param middlewares The middleware chain to be applied.
* @returns The VK Bridge enhancer applying the middleware.
*/
export declare function applyMiddleware(...middlewares: Array<Middleware | undefined | null>): (bridge: VKBridge) => VKBridge;

View File

@@ -0,0 +1,25 @@
import { VKBridge } from './types/bridge';
/** Is the client side runtime environment */
export declare const IS_CLIENT_SIDE: boolean;
/** Is the runtime environment an Android app */
export declare const IS_ANDROID_WEBVIEW: boolean;
/** Is the runtime environment an iOS app */
export declare const IS_IOS_WEBVIEW: boolean;
export declare const IS_REACT_NATIVE_WEBVIEW: boolean;
/** Is the runtime environment a browser */
export declare const IS_WEB: boolean;
/** Is the runtime environment m.vk.ru */
export declare const IS_MVK: boolean;
/** Is the runtime environment vk.ru */
export declare const IS_DESKTOP_VK: boolean;
/** Type of subscribe event */
export declare const EVENT_TYPE: string;
/** Methods supported on the desktop */
export declare const DESKTOP_METHODS: string[];
/**
* Creates a VK Bridge API that holds functions for interact with runtime
* environment.
*
* @param version Version of the package
*/
export declare function createVKBridge(version: string): VKBridge;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,8 @@
declare const bridge: import("./types/bridge").VKBridge;
export * from './types/data';
export * from './types/bridge';
export * from './types/middleware';
export * from './types/deprecated';
export { applyMiddleware } from './applyMiddleware';
export { parseURLSearchParamsForGetLaunchParams } from './parseURLSearchParamsForGetLaunchParams';
export { bridge as default };

View File

@@ -0,0 +1,13 @@
import type { GetLaunchParamsResponse } from './types/data';
export interface LaunchParams extends GetLaunchParamsResponse {
vk_chat_id: string;
vk_is_recommended: number;
vk_profile_id: number;
vk_has_profile_button: number;
vk_testing_group_id: number;
odr_enabled: undefined | 1;
}
/**
* @see https://dev.vk.ru/mini-apps/development/launch-params
*/
export declare const parseURLSearchParamsForGetLaunchParams: (searchParams: string) => Partial<LaunchParams>;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,207 @@
import { RequestPropsMap, ReceiveDataMap, ReceiveEventMap } from './data';
/**
* Name of a method that can be sent.
*/
export declare type AnyRequestMethodName = keyof RequestPropsMap;
/**
* Name of a method that can be received.
*/
export declare type AnyReceiveMethodName = keyof ReceiveDataMap;
/**
* Name of a method that can be only sent.
*/
export declare type AnyRequestOnlyMethodName = Exclude<AnyRequestMethodName, AnyReceiveMethodName>;
/**
* Name of a method that can be only received.
*/
export declare type AnyReceiveOnlyMethodName = Exclude<AnyReceiveMethodName, AnyRequestMethodName>;
/**
* Name of a method which contains properties
*/
export declare type AnyRequestMethodNameWithProps = {
[K in keyof RequestPropsMap]: keyof RequestPropsMap[K] extends never ? never : K;
}[keyof RequestPropsMap];
/**
* Name of a method which doesn't contain properties
*/
export declare type AnyRequestMethodNameWithoutProps = Exclude<AnyRequestMethodName, AnyRequestMethodNameWithProps>;
/**
* Type of any method name.
*/
export declare type AnyMethodName = AnyRequestMethodName | AnyReceiveMethodName;
/**
* The name of the method that can be both sent and received.
*/
export declare type AnyIOMethodName = AnyRequestMethodName & AnyReceiveMethodName;
/**
* Any failed event method name.
*/
export declare type AnyFailedResponseEventName = FailedResponseEventName<AnyRequestMethodName>;
/**
* Any result response event method name.
*/
export declare type AnyResultResponseEventName = ResultResponseEventName<AnyRequestMethodName>;
/**
* Getter of failed event name of a method.
*/
export declare type FailedResponseEventName<M extends AnyRequestMethodName> = M extends keyof ReceiveEventMap ? ReceiveEventMap[M]['failed'] : never;
/**
* Getter of result event name of a method.
*/
export declare type ResultResponseEventName<M extends AnyRequestMethodName> = M extends keyof ReceiveEventMap ? ReceiveEventMap[M]['result'] : never;
/**
* Getter of request properties of a method.
*/
export declare type RequestProps<M extends AnyRequestMethodName = AnyRequestMethodName> = RequestPropsMap[M];
/**
* Getter of response data of a method.
*/
export declare type ReceiveData<M extends AnyReceiveMethodName> = ReceiveDataMap[M];
/**
* Property for matching sent request and received message.
*/
export declare type RequestIdProp = {
request_id?: number | string;
};
/**
* Client error data.
*/
export declare type ErrorDataClientError = {
error_code: number;
error_reason: string;
error_description?: string;
};
/**
* API error data.
*/
export declare type ErrorDataAPIError = {
error_code: number;
error_msg: string;
request_params: string[];
};
/**
* Auth error data.
*/
export declare type ErrorDataAuthError = {
error_code: number;
error_reason: string;
error_description?: string[];
};
/**
* Type of error data
*/
export declare type ErrorData = {
error_type: 'client_error';
error_data: ErrorDataClientError;
request_id?: number | string;
} | {
error_type: 'api_error';
error_data: ErrorDataAPIError;
request_id?: number | string;
} | {
error_type: 'auth_error';
error_data: ErrorDataAuthError;
request_id?: number | string;
};
/**
* Generic event type for creating event types.
*/
export declare type VKBridgeEventBase<Type extends string, Data> = {
detail: {
type: Type;
data: Data;
};
};
/**
* Type of error event data
*/
export declare type VKBridgeErrorEvent<M extends AnyReceiveMethodName> = VKBridgeEventBase<M extends AnyRequestMethodName ? FailedResponseEventName<M> : never, ErrorData>;
/**
* Type of event that is a response to a request
*/
export declare type VKBridgeIOEvent<M extends AnyIOMethodName> = {
[K in M]: VKBridgeEventBase<ResultResponseEventName<K>, ReceiveData<K> & RequestIdProp>;
}[M];
/**
* Type of event that is not a response to a request
*/
export declare type VKBridgeReceiveOnlyEvent<M extends AnyReceiveOnlyMethodName> = {
[K in M]: VKBridgeEventBase<K, ReceiveData<K>>;
}[M];
/**
* Type of result event data
*/
export declare type VKBridgeResultEvent<M extends AnyReceiveMethodName> = M extends AnyReceiveOnlyMethodName ? VKBridgeReceiveOnlyEvent<M> : M extends AnyIOMethodName ? VKBridgeIOEvent<M> : never;
/**
* VK Bridge event.
*/
export declare type VKBridgeEvent<M extends AnyReceiveMethodName> = VKBridgeErrorEvent<M> | VKBridgeResultEvent<M>;
/**
* Type of function that will be subscribed to VK Bridge events.
*/
export declare type VKBridgeSubscribeHandler = (event: VKBridgeEvent<AnyReceiveMethodName>) => void;
/**
* Type of send function for methods that have props.
*
* @param method The method (event) name to send.
* @param props Method properties.
* @returns The Promise object with response data.
*/
export declare type VKBridgeSend = <K extends AnyRequestMethodName>(method: K, props?: RequestProps<K> & RequestIdProp) => Promise<K extends AnyReceiveMethodName ? ReceiveData<K> : void>;
/**
* VK Bridge interface.
*/
export interface VKBridge {
/**
* Sends an event to the runtime env and returns the Promise object with
* response data. In the case of Android/iOS application env is the
* application itself. In the case of the browser, the parent frame in which
* the event handlers is located.
*
* @param method The method (event) name to send.
* @param [props] Method properties.
* @returns The Promise object with response data.
*/
send: VKBridgeSend;
/**
* @alias send
* @deprecated
*/
sendPromise: VKBridgeSend;
/**
* Adds an event listener. It will be called any time a data is received.
*
* @param listener A callback to be invoked on every event receive.
*/
subscribe: (listener: VKBridgeSubscribeHandler) => void;
/**
* Removes an event listener which has been subscribed for event listening.
*
* @param listener A callback to unsubscribe.
*/
unsubscribe: (listener: VKBridgeSubscribeHandler) => void;
/**
* Checks if a method is supported on runtime platform.
*
* @param method Method (event) name to check.
* @returns Result of checking.
* @deprecated This method is deprecated. Use supportsAsync instead.
*/
supports: <K extends AnyRequestMethodName>(method: K) => boolean;
/**
* Checks if a method is supported on runtime platform.
*
* @param method Method (event) name to check.
* @returns The Promise object with result of checking.
*/
supportsAsync: <K extends AnyRequestMethodName>(method: K) => Promise<boolean>;
/**
* Checks whether the runtime is a WebView.
*
* @returns Result of checking.
*/
isWebView: () => boolean;
isIframe: () => boolean;
isEmbedded: () => boolean;
isStandalone: () => boolean;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,56 @@
import { AnyRequestMethodName, AnyReceiveMethodName, AnyRequestMethodNameWithProps, AnyRequestMethodNameWithoutProps, AnyMethodName, AnyIOMethodName, AnyRequestOnlyMethodName, AnyReceiveOnlyMethodName } from './bridge';
import { CommunityWidgetType } from './data';
/**
* Name of a method that can be sent.
* @alias AnyRequestMethodName
* @deprecated
*/
export declare type RequestMethodName = AnyRequestMethodName;
/**
* Name of a method that can be received.
* @alias AnyReceiveMethodName
* @deprecated
*/
export declare type ReceiveMethodName = AnyReceiveMethodName;
/**
* Name of a method that can be only sent.
* @alias AnyRequestOnlyMethodName
* @deprecated
*/
export declare type RequestOnlyMethodName = AnyRequestOnlyMethodName;
/**
* Name of a method that can be only received.
* @alias AnyReceiveOnlyMethodName
* @deprecated
*/
export declare type ReceiveOnlyMethodName = AnyReceiveOnlyMethodName;
/**
* Name of a method which contains properties
* @alias AnyRequestMethodNameWithProps
* @deprecated
*/
export declare type RequestMethodNameWithProps = AnyRequestMethodNameWithProps;
/**
* Name of a method which doesn't contain properties
* @alias AnyRequestMethodNameWithoutProps
* @deprecated
*/
export declare type RequestMethodNameWithoutProps = AnyRequestMethodNameWithoutProps;
/**
* Type of any method name.
* @alias AnyMethodName
* @deprecated
*/
export declare type MethodName = AnyMethodName;
/**
* The name of the method that can be both sent and received.
* @alias AnyIOMethodName
* @deprecated
*/
export declare type IOMethodName = AnyIOMethodName;
/**
* Community widget type
* @alias CommunityWidgetType
* @deprecated
*/
export declare type WidgetType = CommunityWidgetType;

View File

@@ -0,0 +1,13 @@
import { VKBridgeSend, VKBridgeSubscribeHandler } from './bridge';
/**
* API that can use middleware.
*/
export interface MiddlewareAPI<S extends VKBridgeSend = VKBridgeSend, L extends VKBridgeSubscribeHandler = VKBridgeSubscribeHandler> {
send: S;
subscribe(listener: L): void;
}
/**
* A middleware is a higher-order function that composes a dispatch function
* to return a new `send` function.
*/
export declare type Middleware<S extends VKBridgeSend = VKBridgeSend> = (api: MiddlewareAPI<S>) => (next: S) => S;

View File

@@ -0,0 +1 @@
export declare function createInstanceId(): string;