@wowlabtech/mini-app-adapter 0.2.84 → 0.2.86
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 +4 -3280
- package/dist/index.d.cts +16 -38
- package/dist/index.d.ts +16 -38
- package/dist/index.js +4 -3254
- package/package.json +1 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -139,8 +139,10 @@ interface MiniAppAdapter {
|
|
|
139
139
|
readonly shell: ShellAPI;
|
|
140
140
|
/**
|
|
141
141
|
* Quick capability check before calling platform specific APIs.
|
|
142
|
+
* Always asynchronous so callers can rely on a single contract across platforms
|
|
143
|
+
* (VK resolves capabilities via the async bridge). Always `await` the result.
|
|
142
144
|
*/
|
|
143
|
-
supports(capability: MiniAppCapability):
|
|
145
|
+
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
144
146
|
/**
|
|
145
147
|
* Initializes platform SDK. Safe to call multiple times.
|
|
146
148
|
*/
|
|
@@ -229,9 +231,9 @@ interface MiniAppAdapter {
|
|
|
229
231
|
/**
|
|
230
232
|
* Strong/weak haptic feedback helpers.
|
|
231
233
|
*/
|
|
232
|
-
vibrateImpact(style: ImpactHapticFeedbackStyle): void
|
|
233
|
-
vibrateNotification(type: NotificationHapticFeedbackType): void
|
|
234
|
-
vibrateSelection(): void
|
|
234
|
+
vibrateImpact(style: ImpactHapticFeedbackStyle): void | Promise<void>;
|
|
235
|
+
vibrateNotification(type: NotificationHapticFeedbackType): void | Promise<void>;
|
|
236
|
+
vibrateSelection(): void | Promise<void>;
|
|
235
237
|
/**
|
|
236
238
|
* Notifies when the host view goes to background/foreground (VK only).
|
|
237
239
|
*/
|
|
@@ -294,7 +296,7 @@ interface MiniAppAdapter {
|
|
|
294
296
|
/**
|
|
295
297
|
* Shares a URL using platform-specific capabilities.
|
|
296
298
|
*/
|
|
297
|
-
shareUrl?(url: string, text
|
|
299
|
+
shareUrl?(url: string, text?: string): void;
|
|
298
300
|
/**
|
|
299
301
|
* Copies text to the clipboard if supported by the platform.
|
|
300
302
|
*/
|
|
@@ -328,7 +330,7 @@ declare abstract class BaseMiniAppAdapter implements MiniAppAdapter {
|
|
|
328
330
|
private readonly disposables;
|
|
329
331
|
readonly shell: ShellAPI;
|
|
330
332
|
protected constructor(platform: MiniAppPlatform, environment?: Partial<MiniAppEnvironmentInfo>);
|
|
331
|
-
supports(capability: MiniAppCapability):
|
|
333
|
+
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
332
334
|
get platform(): MiniAppPlatform;
|
|
333
335
|
init(_options?: MiniAppInitOptions): Promise<void>;
|
|
334
336
|
isReady(): boolean;
|
|
@@ -357,7 +359,7 @@ declare abstract class BaseMiniAppAdapter implements MiniAppAdapter {
|
|
|
357
359
|
}) => void): () => void;
|
|
358
360
|
getViewportInsets(): MiniAppViewportInsets | undefined;
|
|
359
361
|
shareMessage(_message: string): Promise<void>;
|
|
360
|
-
shareUrl(_url: string, _text
|
|
362
|
+
shareUrl(_url: string, _text?: string): void;
|
|
361
363
|
downloadFile(url: string, filename: string): Promise<void>;
|
|
362
364
|
shareStory(_mediaUrl: string, _options?: MiniAppShareStoryOptions): Promise<void>;
|
|
363
365
|
trackConversionEvent(_event: string, _payload?: Record<string, unknown>): void;
|
|
@@ -386,35 +388,9 @@ declare abstract class BaseMiniAppAdapter implements MiniAppAdapter {
|
|
|
386
388
|
private applyScrollGuards;
|
|
387
389
|
}
|
|
388
390
|
|
|
389
|
-
declare class MaxMiniAppAdapter extends BaseMiniAppAdapter {
|
|
390
|
-
private readonly backHandlers;
|
|
391
|
-
private initData?;
|
|
392
|
-
private initDataUnsafe?;
|
|
393
|
-
constructor();
|
|
394
|
-
init(_options?: MiniAppInitOptions): Promise<void>;
|
|
395
|
-
supports(capability: MiniAppCapability): boolean;
|
|
396
|
-
getInitData(): string | undefined;
|
|
397
|
-
getLaunchParams(): MiniAppLaunchParams | undefined;
|
|
398
|
-
onBackButton(callback: () => void): () => void;
|
|
399
|
-
setBackButtonVisibility(visible: boolean): void;
|
|
400
|
-
openExternalLink(url: string): Promise<void>;
|
|
401
|
-
openInternalLink(url: string): Promise<void>;
|
|
402
|
-
closeApp(): Promise<void>;
|
|
403
|
-
vibrateImpact(style: ImpactHapticFeedbackStyle): void;
|
|
404
|
-
vibrateNotification(type: NotificationHapticFeedbackType): void;
|
|
405
|
-
vibrateSelection(): void;
|
|
406
|
-
scanQRCode(options?: MiniAppQrScanOptions): Promise<string | null>;
|
|
407
|
-
requestPhone(): Promise<string | null>;
|
|
408
|
-
showPopup(options: MiniAppPopupOptions): Promise<string | null>;
|
|
409
|
-
downloadFile(url: string, filename: string): Promise<void>;
|
|
410
|
-
private requestPhoneViaEvent;
|
|
411
|
-
private extractPhone;
|
|
412
|
-
protected onDestroy(): void;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
391
|
declare class ShellMiniAppAdapter extends BaseMiniAppAdapter {
|
|
416
392
|
constructor(platform: 'shell_ios' | 'shell_android');
|
|
417
|
-
supports(capability: MiniAppCapability):
|
|
393
|
+
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
418
394
|
scanQRCode(): Promise<string | null>;
|
|
419
395
|
requestNotificationsPermission(): Promise<boolean>;
|
|
420
396
|
}
|
|
@@ -439,7 +415,8 @@ declare class TelegramMiniAppAdapter extends BaseMiniAppAdapter {
|
|
|
439
415
|
openExternalLink(url: string): Promise<void>;
|
|
440
416
|
openInternalLink(url: string): Promise<void>;
|
|
441
417
|
enableDebug(state: boolean): void;
|
|
442
|
-
|
|
418
|
+
private hapticsAvailable;
|
|
419
|
+
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
443
420
|
bindCssVariables(mapper?: (key: string) => string): void;
|
|
444
421
|
vibrateImpact(style: ImpactHapticFeedbackStyle): void;
|
|
445
422
|
vibrateNotification(type: NotificationHapticFeedbackType): void;
|
|
@@ -506,6 +483,7 @@ declare class VKMiniAppAdapter extends BaseMiniAppAdapter {
|
|
|
506
483
|
getEnvironment(): MiniAppEnvironmentInfo;
|
|
507
484
|
getLaunchParams(): MiniAppLaunchParams | undefined;
|
|
508
485
|
openExternalLink(url: string): Promise<void>;
|
|
486
|
+
closeApp(): Promise<void>;
|
|
509
487
|
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
510
488
|
requestPhone(): Promise<string | null>;
|
|
511
489
|
requestNotificationsPermission(): Promise<boolean>;
|
|
@@ -546,10 +524,10 @@ declare class VKMiniAppAdapter extends BaseMiniAppAdapter {
|
|
|
546
524
|
declare class WebMiniAppAdapter extends BaseMiniAppAdapter {
|
|
547
525
|
private deferredPrompt;
|
|
548
526
|
constructor();
|
|
549
|
-
supports(capability: MiniAppCapability):
|
|
527
|
+
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
550
528
|
downloadFile(url: string, filename: string): Promise<void>;
|
|
551
529
|
scanQRCode(_options?: MiniAppQrScanOptions): Promise<string | null>;
|
|
552
|
-
shareUrl(url: string, text
|
|
530
|
+
shareUrl(url: string, text?: string): void;
|
|
553
531
|
addToHomeScreen(): Promise<boolean>;
|
|
554
532
|
checkHomeScreenStatus(): Promise<'added' | 'not_added' | 'unknown' | string>;
|
|
555
533
|
}
|
|
@@ -596,4 +574,4 @@ declare function trackPixelEvent(event: string, payload?: Record<string, unknown
|
|
|
596
574
|
|
|
597
575
|
declare function getPlatform(): MiniAppPlatform;
|
|
598
576
|
|
|
599
|
-
export { AdapterProvider, BaseMiniAppAdapter, type CreateAdapterOptions,
|
|
577
|
+
export { AdapterProvider, BaseMiniAppAdapter, type CreateAdapterOptions, type MiniAppAdapter, type MiniAppCapability, type MiniAppEnvironmentInfo, type MiniAppInitOptions, type MiniAppLaunchParams, 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
|
@@ -139,8 +139,10 @@ interface MiniAppAdapter {
|
|
|
139
139
|
readonly shell: ShellAPI;
|
|
140
140
|
/**
|
|
141
141
|
* Quick capability check before calling platform specific APIs.
|
|
142
|
+
* Always asynchronous so callers can rely on a single contract across platforms
|
|
143
|
+
* (VK resolves capabilities via the async bridge). Always `await` the result.
|
|
142
144
|
*/
|
|
143
|
-
supports(capability: MiniAppCapability):
|
|
145
|
+
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
144
146
|
/**
|
|
145
147
|
* Initializes platform SDK. Safe to call multiple times.
|
|
146
148
|
*/
|
|
@@ -229,9 +231,9 @@ interface MiniAppAdapter {
|
|
|
229
231
|
/**
|
|
230
232
|
* Strong/weak haptic feedback helpers.
|
|
231
233
|
*/
|
|
232
|
-
vibrateImpact(style: ImpactHapticFeedbackStyle): void
|
|
233
|
-
vibrateNotification(type: NotificationHapticFeedbackType): void
|
|
234
|
-
vibrateSelection(): void
|
|
234
|
+
vibrateImpact(style: ImpactHapticFeedbackStyle): void | Promise<void>;
|
|
235
|
+
vibrateNotification(type: NotificationHapticFeedbackType): void | Promise<void>;
|
|
236
|
+
vibrateSelection(): void | Promise<void>;
|
|
235
237
|
/**
|
|
236
238
|
* Notifies when the host view goes to background/foreground (VK only).
|
|
237
239
|
*/
|
|
@@ -294,7 +296,7 @@ interface MiniAppAdapter {
|
|
|
294
296
|
/**
|
|
295
297
|
* Shares a URL using platform-specific capabilities.
|
|
296
298
|
*/
|
|
297
|
-
shareUrl?(url: string, text
|
|
299
|
+
shareUrl?(url: string, text?: string): void;
|
|
298
300
|
/**
|
|
299
301
|
* Copies text to the clipboard if supported by the platform.
|
|
300
302
|
*/
|
|
@@ -328,7 +330,7 @@ declare abstract class BaseMiniAppAdapter implements MiniAppAdapter {
|
|
|
328
330
|
private readonly disposables;
|
|
329
331
|
readonly shell: ShellAPI;
|
|
330
332
|
protected constructor(platform: MiniAppPlatform, environment?: Partial<MiniAppEnvironmentInfo>);
|
|
331
|
-
supports(capability: MiniAppCapability):
|
|
333
|
+
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
332
334
|
get platform(): MiniAppPlatform;
|
|
333
335
|
init(_options?: MiniAppInitOptions): Promise<void>;
|
|
334
336
|
isReady(): boolean;
|
|
@@ -357,7 +359,7 @@ declare abstract class BaseMiniAppAdapter implements MiniAppAdapter {
|
|
|
357
359
|
}) => void): () => void;
|
|
358
360
|
getViewportInsets(): MiniAppViewportInsets | undefined;
|
|
359
361
|
shareMessage(_message: string): Promise<void>;
|
|
360
|
-
shareUrl(_url: string, _text
|
|
362
|
+
shareUrl(_url: string, _text?: string): void;
|
|
361
363
|
downloadFile(url: string, filename: string): Promise<void>;
|
|
362
364
|
shareStory(_mediaUrl: string, _options?: MiniAppShareStoryOptions): Promise<void>;
|
|
363
365
|
trackConversionEvent(_event: string, _payload?: Record<string, unknown>): void;
|
|
@@ -386,35 +388,9 @@ declare abstract class BaseMiniAppAdapter implements MiniAppAdapter {
|
|
|
386
388
|
private applyScrollGuards;
|
|
387
389
|
}
|
|
388
390
|
|
|
389
|
-
declare class MaxMiniAppAdapter extends BaseMiniAppAdapter {
|
|
390
|
-
private readonly backHandlers;
|
|
391
|
-
private initData?;
|
|
392
|
-
private initDataUnsafe?;
|
|
393
|
-
constructor();
|
|
394
|
-
init(_options?: MiniAppInitOptions): Promise<void>;
|
|
395
|
-
supports(capability: MiniAppCapability): boolean;
|
|
396
|
-
getInitData(): string | undefined;
|
|
397
|
-
getLaunchParams(): MiniAppLaunchParams | undefined;
|
|
398
|
-
onBackButton(callback: () => void): () => void;
|
|
399
|
-
setBackButtonVisibility(visible: boolean): void;
|
|
400
|
-
openExternalLink(url: string): Promise<void>;
|
|
401
|
-
openInternalLink(url: string): Promise<void>;
|
|
402
|
-
closeApp(): Promise<void>;
|
|
403
|
-
vibrateImpact(style: ImpactHapticFeedbackStyle): void;
|
|
404
|
-
vibrateNotification(type: NotificationHapticFeedbackType): void;
|
|
405
|
-
vibrateSelection(): void;
|
|
406
|
-
scanQRCode(options?: MiniAppQrScanOptions): Promise<string | null>;
|
|
407
|
-
requestPhone(): Promise<string | null>;
|
|
408
|
-
showPopup(options: MiniAppPopupOptions): Promise<string | null>;
|
|
409
|
-
downloadFile(url: string, filename: string): Promise<void>;
|
|
410
|
-
private requestPhoneViaEvent;
|
|
411
|
-
private extractPhone;
|
|
412
|
-
protected onDestroy(): void;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
391
|
declare class ShellMiniAppAdapter extends BaseMiniAppAdapter {
|
|
416
392
|
constructor(platform: 'shell_ios' | 'shell_android');
|
|
417
|
-
supports(capability: MiniAppCapability):
|
|
393
|
+
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
418
394
|
scanQRCode(): Promise<string | null>;
|
|
419
395
|
requestNotificationsPermission(): Promise<boolean>;
|
|
420
396
|
}
|
|
@@ -439,7 +415,8 @@ declare class TelegramMiniAppAdapter extends BaseMiniAppAdapter {
|
|
|
439
415
|
openExternalLink(url: string): Promise<void>;
|
|
440
416
|
openInternalLink(url: string): Promise<void>;
|
|
441
417
|
enableDebug(state: boolean): void;
|
|
442
|
-
|
|
418
|
+
private hapticsAvailable;
|
|
419
|
+
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
443
420
|
bindCssVariables(mapper?: (key: string) => string): void;
|
|
444
421
|
vibrateImpact(style: ImpactHapticFeedbackStyle): void;
|
|
445
422
|
vibrateNotification(type: NotificationHapticFeedbackType): void;
|
|
@@ -506,6 +483,7 @@ declare class VKMiniAppAdapter extends BaseMiniAppAdapter {
|
|
|
506
483
|
getEnvironment(): MiniAppEnvironmentInfo;
|
|
507
484
|
getLaunchParams(): MiniAppLaunchParams | undefined;
|
|
508
485
|
openExternalLink(url: string): Promise<void>;
|
|
486
|
+
closeApp(): Promise<void>;
|
|
509
487
|
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
510
488
|
requestPhone(): Promise<string | null>;
|
|
511
489
|
requestNotificationsPermission(): Promise<boolean>;
|
|
@@ -546,10 +524,10 @@ declare class VKMiniAppAdapter extends BaseMiniAppAdapter {
|
|
|
546
524
|
declare class WebMiniAppAdapter extends BaseMiniAppAdapter {
|
|
547
525
|
private deferredPrompt;
|
|
548
526
|
constructor();
|
|
549
|
-
supports(capability: MiniAppCapability):
|
|
527
|
+
supports(capability: MiniAppCapability): Promise<boolean>;
|
|
550
528
|
downloadFile(url: string, filename: string): Promise<void>;
|
|
551
529
|
scanQRCode(_options?: MiniAppQrScanOptions): Promise<string | null>;
|
|
552
|
-
shareUrl(url: string, text
|
|
530
|
+
shareUrl(url: string, text?: string): void;
|
|
553
531
|
addToHomeScreen(): Promise<boolean>;
|
|
554
532
|
checkHomeScreenStatus(): Promise<'added' | 'not_added' | 'unknown' | string>;
|
|
555
533
|
}
|
|
@@ -596,4 +574,4 @@ declare function trackPixelEvent(event: string, payload?: Record<string, unknown
|
|
|
596
574
|
|
|
597
575
|
declare function getPlatform(): MiniAppPlatform;
|
|
598
576
|
|
|
599
|
-
export { AdapterProvider, BaseMiniAppAdapter, type CreateAdapterOptions,
|
|
577
|
+
export { AdapterProvider, BaseMiniAppAdapter, type CreateAdapterOptions, type MiniAppAdapter, type MiniAppCapability, type MiniAppEnvironmentInfo, type MiniAppInitOptions, type MiniAppLaunchParams, 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 };
|