From ff36dc45b78334782c59fe41cd3c3afea4d3490c Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 10 Jan 2025 15:34:46 +1000 Subject: [PATCH 1/6] Fix `BiometricManager.authenticate` typing The second parameter was missing from the typing of the `authenticate` method. https://core.telegram.org/bots/webapps#biometricmanager:~:text=If%20so%2C%20the%20second%20argument%20will%20be%20a%20biometric%20token. --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 8a9dced..02aec02 100644 --- a/index.ts +++ b/index.ts @@ -410,7 +410,7 @@ export type BiometricManager = { ) => BiometricManager; authenticate: ( params: BiometricAuthenticateParams, - callback?: (isAuthenticated: boolean) => unknown + callback?: (isAuthenticated: boolean; token?: string) => unknown ) => BiometricManager; updateBiometricToken: ( token: string, From 57600c55b3af6499010d4ac2ed09a4b96546b0fb Mon Sep 17 00:00:00 2001 From: xync Date: Wed, 20 Aug 2025 20:42:48 +0300 Subject: [PATCH 2/6] update dependencies --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 44472b6..b172bb4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@twa-dev/types", - "version": "8.0.2", + "version": "9.0.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" } } From 2aff9a4d2c3c5a55ea864b151d3e40743657ed43 Mon Sep 17 00:00:00 2001 From: xync Date: Wed, 20 Aug 2025 20:58:46 +0300 Subject: [PATCH 3/6] BiometricManager.authenticate.callback 2nd param; fixes pr #12 --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 02aec02..4aee8b4 100644 --- a/index.ts +++ b/index.ts @@ -410,7 +410,7 @@ export type BiometricManager = { ) => BiometricManager; authenticate: ( params: BiometricAuthenticateParams, - callback?: (isAuthenticated: boolean; token?: string) => unknown + callback?: (isAuthenticated: boolean, token?: string) => unknown ) => BiometricManager; updateBiometricToken: ( token: string, From a280caf7ccfa15bcd4e65359ad7e5287d8e5cec6 Mon Sep 17 00:00:00 2001 From: xync Date: Wed, 20 Aug 2025 21:00:38 +0300 Subject: [PATCH 4/6] fix BottomButton.hasShineEffect type; fixes issue #14 --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 4aee8b4..11cdce5 100644 --- a/index.ts +++ b/index.ts @@ -154,7 +154,7 @@ export interface BottomButton { offClick: (callback: VoidFunction) => BottomButton; setText: (text: string) => BottomButton; setParams: (params: BottomButtonParams) => BottomButton; - hasShineEffect: string; + hasShineEffect: boolean; } export type MainButton = BottomButton; From 45693e23d54520609884951bdec40c4b11bf55b7 Mon Sep 17 00:00:00 2001 From: xync Date: Wed, 20 Aug 2025 21:14:03 +0300 Subject: [PATCH 5/6] updated to 9.0 Bot API version: - DeviceStorage - SecureStorage --- index.ts | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/index.ts b/index.ts index 11cdce5..4dec4fe 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; @@ -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; From 15038c3be3f33a72ae702ffddc45f50f219d2921 Mon Sep 17 00:00:00 2001 From: xync Date: Wed, 20 Aug 2025 21:16:03 +0300 Subject: [PATCH 6/6] updated to 9.1 Bot API version: - hideKeyboard --- index.ts | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 4dec4fe..2bc2f10 100644 --- a/index.ts +++ b/index.ts @@ -588,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 b172bb4..ed64f15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@twa-dev/types", - "version": "9.0.0", + "version": "9.1.0", "main": "index.js", "description": "Types for Telegram Web Apps (TWA) SDK", "keywords": [