@wowlabtech/mini-app-adapter 0.2.5 → 0.2.7

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.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(_capability: MiniAppCapability): boolean | Promise<boolean>;
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>;
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(_capability: MiniAppCapability): boolean | Promise<boolean>;
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>;
package/dist/index.js CHANGED
@@ -525,8 +525,13 @@ var BaseMiniAppAdapter = class {
525
525
  }
526
526
  }
527
527
  }
528
- supports(_capability) {
529
- return false;
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,16 @@ var VKMiniAppAdapter = class extends BaseMiniAppAdapter {
1933
1940
  queryParams: this.queryParams
1934
1941
  };
1935
1942
  }
1943
+ async openExternalLink(url) {
1944
+ const a = document.createElement("a");
1945
+ a.href = url;
1946
+ a.target = "_blank";
1947
+ a.rel = "noopener noreferrer";
1948
+ a.style.display = "none";
1949
+ document.body.appendChild(a);
1950
+ a.click();
1951
+ a.remove();
1952
+ }
1936
1953
  async supports(capability) {
1937
1954
  switch (capability) {
1938
1955
  case "haptics": {
@@ -1964,6 +1981,8 @@ var VKMiniAppAdapter = class extends BaseMiniAppAdapter {
1964
1981
  return this.supportsBridgeMethod("VKWebAppAddToHomeScreen");
1965
1982
  case "denyNotifications":
1966
1983
  return this.supportsBridgeMethod("VKWebAppDenyNotifications");
1984
+ case "openExternalLink":
1985
+ return true;
1967
1986
  case "viewVisibility":
1968
1987
  return true;
1969
1988
  default: