@wowlabtech/mini-app-adapter 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +25 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -113,7 +113,7 @@ interface MiniAppShareStoryOptions {
|
|
|
113
113
|
stickers?: Array<Record<string, unknown>>;
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
type MiniAppCapability = 'haptics' | 'popup' | 'qrScanner' | 'closeApp' | 'backButton' | 'backButtonVisibility' | 'bindCssVariables' | 'requestPhone' | 'notifications' | 'openInternalLink' | 'requestFullscreen' | 'verticalSwipes' | 'viewVisibility' | 'shareUrl' | 'shareStory' | 'copyTextToClipboard' | 'downloadFile' | 'addToHomeScreen' | 'checkHomeScreenStatus' | 'denyNotifications';
|
|
116
|
+
type MiniAppCapability = 'haptics' | 'popup' | 'qrScanner' | 'closeApp' | 'backButton' | 'backButtonVisibility' | 'bindCssVariables' | 'requestPhone' | 'notifications' | 'openExternalLink' | 'openInternalLink' | 'requestFullscreen' | 'verticalSwipes' | 'viewVisibility' | 'shareUrl' | 'shareStory' | 'copyTextToClipboard' | 'downloadFile' | 'addToHomeScreen' | 'checkHomeScreenStatus' | 'denyNotifications';
|
|
117
117
|
interface MiniAppPopupButton {
|
|
118
118
|
id: string;
|
|
119
119
|
text?: string;
|
|
@@ -324,7 +324,7 @@ declare abstract class BaseMiniAppAdapter implements MiniAppAdapter {
|
|
|
324
324
|
private readonly disposables;
|
|
325
325
|
readonly shell: ShellAPI;
|
|
326
326
|
protected constructor(platform: MiniAppPlatform, environment?: Partial<MiniAppEnvironmentInfo>);
|
|
327
|
-
supports(
|
|
327
|
+
supports(capability: MiniAppCapability): boolean | Promise<boolean>;
|
|
328
328
|
get platform(): MiniAppPlatform;
|
|
329
329
|
init(_options?: MiniAppInitOptions): Promise<void>;
|
|
330
330
|
isReady(): boolean;
|
|
@@ -498,6 +498,7 @@ declare class VKMiniAppAdapter extends BaseMiniAppAdapter {
|
|
|
498
498
|
}): Promise<void>;
|
|
499
499
|
getEnvironment(): MiniAppEnvironmentInfo;
|
|
500
500
|
getLaunchParams(): unknown;
|
|
501
|
+
openExternalLink(url: string): Promise<void>;
|
|
501
502
|
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
502
503
|
requestPhone(): Promise<string | null>;
|
|
503
504
|
requestNotificationsPermission(): Promise<boolean>;
|
|
@@ -588,4 +589,4 @@ declare function trackPixelEvent(event: string, payload?: Record<string, unknown
|
|
|
588
589
|
|
|
589
590
|
declare function getPlatform(): MiniAppPlatform;
|
|
590
591
|
|
|
591
|
-
export { AdapterProvider, BaseMiniAppAdapter, type CreateAdapterOptions, MaxMiniAppAdapter, type MiniAppAdapter, type MiniAppCapability, type MiniAppEnvironmentInfo, type MiniAppInitOptions, type MiniAppPlatform, type MiniAppPopupOptions, type MiniAppQrScanOptions, type MiniAppViewportState, ShellMiniAppAdapter, TelegramMiniAppAdapter, VKMiniAppAdapter, WebMiniAppAdapter, configureVkPixel, createAdapter, createShellAPI, detectPlatform, getActiveAdapter, getPlatform, isShell, isShellAndroid, isShellIOS, readShellPlatform, requestShellPushPermission, shell, storeShellToken, trackConversionEvent, trackPixelEvent, useAdapterTheme, useMiniAppAdapter, useSafeArea };
|
|
592
|
+
export { AdapterProvider, BaseMiniAppAdapter, type CreateAdapterOptions, MaxMiniAppAdapter, type MiniAppAdapter, type MiniAppCapability, type MiniAppEnvironmentInfo, type MiniAppInitOptions, type MiniAppPlatform, type MiniAppPopupOptions, type MiniAppQrScanOptions, type MiniAppShareStoryOptions, type MiniAppViewportState, ShellMiniAppAdapter, TelegramMiniAppAdapter, VKMiniAppAdapter, WebMiniAppAdapter, configureVkPixel, createAdapter, createShellAPI, detectPlatform, getActiveAdapter, getPlatform, isShell, isShellAndroid, isShellIOS, readShellPlatform, requestShellPushPermission, shell, storeShellToken, trackConversionEvent, trackPixelEvent, useAdapterTheme, useMiniAppAdapter, useSafeArea };
|
package/dist/index.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ interface MiniAppShareStoryOptions {
|
|
|
113
113
|
stickers?: Array<Record<string, unknown>>;
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
type MiniAppCapability = 'haptics' | 'popup' | 'qrScanner' | 'closeApp' | 'backButton' | 'backButtonVisibility' | 'bindCssVariables' | 'requestPhone' | 'notifications' | 'openInternalLink' | 'requestFullscreen' | 'verticalSwipes' | 'viewVisibility' | 'shareUrl' | 'shareStory' | 'copyTextToClipboard' | 'downloadFile' | 'addToHomeScreen' | 'checkHomeScreenStatus' | 'denyNotifications';
|
|
116
|
+
type MiniAppCapability = 'haptics' | 'popup' | 'qrScanner' | 'closeApp' | 'backButton' | 'backButtonVisibility' | 'bindCssVariables' | 'requestPhone' | 'notifications' | 'openExternalLink' | 'openInternalLink' | 'requestFullscreen' | 'verticalSwipes' | 'viewVisibility' | 'shareUrl' | 'shareStory' | 'copyTextToClipboard' | 'downloadFile' | 'addToHomeScreen' | 'checkHomeScreenStatus' | 'denyNotifications';
|
|
117
117
|
interface MiniAppPopupButton {
|
|
118
118
|
id: string;
|
|
119
119
|
text?: string;
|
|
@@ -324,7 +324,7 @@ declare abstract class BaseMiniAppAdapter implements MiniAppAdapter {
|
|
|
324
324
|
private readonly disposables;
|
|
325
325
|
readonly shell: ShellAPI;
|
|
326
326
|
protected constructor(platform: MiniAppPlatform, environment?: Partial<MiniAppEnvironmentInfo>);
|
|
327
|
-
supports(
|
|
327
|
+
supports(capability: MiniAppCapability): boolean | Promise<boolean>;
|
|
328
328
|
get platform(): MiniAppPlatform;
|
|
329
329
|
init(_options?: MiniAppInitOptions): Promise<void>;
|
|
330
330
|
isReady(): boolean;
|
|
@@ -498,6 +498,7 @@ declare class VKMiniAppAdapter extends BaseMiniAppAdapter {
|
|
|
498
498
|
}): Promise<void>;
|
|
499
499
|
getEnvironment(): MiniAppEnvironmentInfo;
|
|
500
500
|
getLaunchParams(): unknown;
|
|
501
|
+
openExternalLink(url: string): Promise<void>;
|
|
501
502
|
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
502
503
|
requestPhone(): Promise<string | null>;
|
|
503
504
|
requestNotificationsPermission(): Promise<boolean>;
|
|
@@ -588,4 +589,4 @@ declare function trackPixelEvent(event: string, payload?: Record<string, unknown
|
|
|
588
589
|
|
|
589
590
|
declare function getPlatform(): MiniAppPlatform;
|
|
590
591
|
|
|
591
|
-
export { AdapterProvider, BaseMiniAppAdapter, type CreateAdapterOptions, MaxMiniAppAdapter, type MiniAppAdapter, type MiniAppCapability, type MiniAppEnvironmentInfo, type MiniAppInitOptions, type MiniAppPlatform, type MiniAppPopupOptions, type MiniAppQrScanOptions, type MiniAppViewportState, ShellMiniAppAdapter, TelegramMiniAppAdapter, VKMiniAppAdapter, WebMiniAppAdapter, configureVkPixel, createAdapter, createShellAPI, detectPlatform, getActiveAdapter, getPlatform, isShell, isShellAndroid, isShellIOS, readShellPlatform, requestShellPushPermission, shell, storeShellToken, trackConversionEvent, trackPixelEvent, useAdapterTheme, useMiniAppAdapter, useSafeArea };
|
|
592
|
+
export { AdapterProvider, BaseMiniAppAdapter, type CreateAdapterOptions, MaxMiniAppAdapter, type MiniAppAdapter, type MiniAppCapability, type MiniAppEnvironmentInfo, type MiniAppInitOptions, type MiniAppPlatform, type MiniAppPopupOptions, type MiniAppQrScanOptions, type MiniAppShareStoryOptions, type MiniAppViewportState, ShellMiniAppAdapter, TelegramMiniAppAdapter, VKMiniAppAdapter, WebMiniAppAdapter, configureVkPixel, createAdapter, createShellAPI, detectPlatform, getActiveAdapter, getPlatform, isShell, isShellAndroid, isShellIOS, readShellPlatform, requestShellPushPermission, shell, storeShellToken, trackConversionEvent, trackPixelEvent, useAdapterTheme, useMiniAppAdapter, useSafeArea };
|
package/dist/index.js
CHANGED
|
@@ -525,8 +525,13 @@ var BaseMiniAppAdapter = class {
|
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
-
supports(
|
|
529
|
-
|
|
528
|
+
supports(capability) {
|
|
529
|
+
switch (capability) {
|
|
530
|
+
case "openExternalLink":
|
|
531
|
+
return true;
|
|
532
|
+
default:
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
530
535
|
}
|
|
531
536
|
get platform() {
|
|
532
537
|
return this.environment.platform;
|
|
@@ -1300,6 +1305,8 @@ var TelegramMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
1300
1305
|
return backButton.hide.isSupported();
|
|
1301
1306
|
case "bindCssVariables":
|
|
1302
1307
|
return true;
|
|
1308
|
+
case "openExternalLink":
|
|
1309
|
+
return isFeatureAvailable(openLink);
|
|
1303
1310
|
case "openInternalLink":
|
|
1304
1311
|
return true;
|
|
1305
1312
|
case "requestFullscreen":
|
|
@@ -1933,6 +1940,20 @@ var VKMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
1933
1940
|
queryParams: this.queryParams
|
|
1934
1941
|
};
|
|
1935
1942
|
}
|
|
1943
|
+
async openExternalLink(url) {
|
|
1944
|
+
if (!bridge.isWebView()) {
|
|
1945
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
1946
|
+
return;
|
|
1947
|
+
}
|
|
1948
|
+
const a = document.createElement("a");
|
|
1949
|
+
a.href = url;
|
|
1950
|
+
a.target = "_blank";
|
|
1951
|
+
a.rel = "noopener noreferrer";
|
|
1952
|
+
a.style.display = "none";
|
|
1953
|
+
document.body.appendChild(a);
|
|
1954
|
+
a.click();
|
|
1955
|
+
a.remove();
|
|
1956
|
+
}
|
|
1936
1957
|
async supports(capability) {
|
|
1937
1958
|
switch (capability) {
|
|
1938
1959
|
case "haptics": {
|
|
@@ -1964,6 +1985,8 @@ var VKMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
1964
1985
|
return this.supportsBridgeMethod("VKWebAppAddToHomeScreen");
|
|
1965
1986
|
case "denyNotifications":
|
|
1966
1987
|
return this.supportsBridgeMethod("VKWebAppDenyNotifications");
|
|
1988
|
+
case "openExternalLink":
|
|
1989
|
+
return true;
|
|
1967
1990
|
case "viewVisibility":
|
|
1968
1991
|
return true;
|
|
1969
1992
|
default:
|