diff --git a/index.ts b/index.ts index 8a9dced..2bc2f10 100644 --- a/index.ts +++ b/index.ts @@ -99,6 +99,56 @@ export interface CloudStorage { ) => void; } +type DeviceStorageKey = string; +type DeviceStorageValue = unknown; + +export interface DeviceStorage { + setItem: ( + key: DeviceStorageKey, + value: DeviceStorageValue, + callback?: (error: string | null, result?: boolean) => unknown + ) => void; + getItem: ( + key: DeviceStorageKey, + callback?: (error: string | null, result?: DeviceStorageValue) => unknown + ) => void; + getKeys: ( + callback?: ( + error: string | null, + result?: Array + ) => unknown + ) => void; + removeItem: ( + key: DeviceStorageKey, + callback?: (error: string | null, result?: boolean) => unknown + ) => void; +} + +type SecureStorageKey = string; +type SecureStorageValue = unknown; + +export interface SecureStorage { + setItem: ( + key: SecureStorageKey, + value: SecureStorageValue, + callback?: (error: string | null, result?: boolean) => unknown + ) => void; + getItem: ( + key: SecureStorageKey, + callback?: (error: string | null, result?: SecureStorageValue) => unknown + ) => void; + getKeys: ( + callback?: ( + error: string | null, + result?: Array + ) => unknown + ) => void; + removeItem: ( + key: SecureStorageKey, + callback?: (error: string | null, result?: boolean) => unknown + ) => void; +} + export type Contact = { first_name?: string; last_name?: string; @@ -154,7 +204,7 @@ export interface BottomButton { offClick: (callback: VoidFunction) => BottomButton; setText: (text: string) => BottomButton; setParams: (params: BottomButtonParams) => BottomButton; - hasShineEffect: string; + hasShineEffect: boolean; } export type MainButton = BottomButton; @@ -410,7 +460,7 @@ export type BiometricManager = { ) => BiometricManager; authenticate: ( params: BiometricAuthenticateParams, - callback?: (isAuthenticated: boolean) => unknown + callback?: (isAuthenticated: boolean, token?: string) => unknown ) => BiometricManager; updateBiometricToken: ( token: string, @@ -476,6 +526,8 @@ export interface WebApp { SecondaryButton: SecondaryButton; HapticFeedback: HapticFeedback; CloudStorage: CloudStorage; + DeviceStorage: DeviceStorage; + SecureStorage: SecureStorage; openLink: (link: string, options?: { try_instant_view: boolean }) => void; openTelegramLink: (link: string) => void; BackButton: BackButton; @@ -536,6 +588,7 @@ export interface WebApp { lockOrientation: VoidFunction; unlockOrientation: VoidFunction; addToHomeScreen: VoidFunction; + hideKeyboard: VoidFunction; checkHomeScreenStatus: ( callback?: (status: HomeScreenStatus) => unknown ) => void; diff --git a/package.json b/package.json index 44472b6..ed64f15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@twa-dev/types", - "version": "8.0.2", + "version": "9.1.0", "main": "index.js", "description": "Types for Telegram Web Apps (TWA) SDK", "keywords": [ @@ -16,11 +16,11 @@ "author": "Artur Stambultsian ", "license": "MIT", "devDependencies": { - "@typescript-eslint/eslint-plugin": "^5.33.0", - "@typescript-eslint/parser": "^5.33.0", - "eslint": "^8.21.0", - "eslint-config-prettier": "^8.5.0", - "prettier": "^2.7.1", - "typescript": "^4.7.4" + "@typescript-eslint/eslint-plugin": "^8.40.0", + "@typescript-eslint/parser": "^8.40.0", + "eslint": "^9.33.0", + "eslint-config-prettier": "^10.1.8", + "prettier": "^3.6.2", + "typescript": "^5.9.2" } }