diff --git a/README.md b/README.md index 386c56c..99a0d8b 100644 --- a/README.md +++ b/README.md @@ -84,12 +84,10 @@ const Content = () => { This hook provides `CloudStorage` object as Promise functions - [useInitData](./docs/README.md#useinitdata) - This hook provides `InitDataUnsafe` and `InitData` object -- [useIsVersionAtLeast](./docs/README.md#useisversionatleast) - - This hook provides `isVersionAtLeast` function - [useVersionAtLeast](./docs/README.md#useversionatleast) - - This hook provides `isVersionAtLeast` result which is boolean + This hook provides `isVersionAtLeast` function result which is always boolean - [useTwa](./docs/README.md#usetwa) - - This hook provides boolean values indicates was TWA script loaded or not + This hook provides boolean values indicating whether the Telegram Web App is ready for use (loaded) or not (still loading). - [useWebApp](./docs/README.md#usewebapp) - This hook just provides native `WebApp` object diff --git a/docs/README.md b/docs/README.md index 5309ffb..9f6840f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -44,7 +44,6 @@ - [useExpand](README.md#useexpand) - [useHapticFeedback](README.md#usehapticfeedback) - [useInitData](README.md#useinitdata) -- [useIsVersionAtLeast](README.md#useIsVersionAtLeast) - [useReadTextFromClipboard](README.md#usereadtextfromclipboard) - [useScanQrPopup](README.md#usescanqrpopup) - [useShowPopup](README.md#useshowpopup) @@ -596,28 +595,9 @@ readonly [[`InitDataUnsafe`](README.md#initdataunsafe), `string`] --- -### useIsVersionAtLeast - -▸ **useIsVersionAtLeast**(): (version: string | number) => boolean - -This hook provides `isVersionAtLeast` function -You have to look original description in [telegram!WebApp](https://core.telegram.org/bots/webapps#initializing-mini-apps), because hook just return this. - -```tsx -import { useIsVersionAtLeast } from '@altiore/twa'; - -const isVersionAtLeast = useIsVersionAtLeast(); - -if (isVersionAtLeast('6.5')) { - return
Version is at least 6.5
; -} -``` - ---- - ### useVersionAtLeast -▸ **useVersionAtLeast**(): readonly boolean +▸ **useVersionAtLeast**(version?: string | number): readonly boolean This hook provides `isVersionAtLeast` function result You have to look original description in [telegram!WebApp](https://core.telegram.org/bots/webapps#initializing-mini-apps), because hook just return this. @@ -625,9 +605,9 @@ You have to look original description in [telegram!WebApp](https://core.telegram ```tsx import { useVersionAtLeast } from '@altiore/twa'; -const isCorrectVersion = useIsVersionAtLeast('6.5'); +const isCorrectVersion = useVersionAtLeast('6.9'); if (isCorrectVersion) { - returnVersion is at least 6.5
; + returnVersion is at least 6.9
; } ``` @@ -647,7 +627,7 @@ if (isLoading) { returnTWA script still loading
; } if (isLoaded) { - returnTWA script loaded
; + returnTWA Application ready to use
; } ``` @@ -828,11 +808,9 @@ Renders its props depends on was TWA loaded or not import { TwaLoader } from '@altiore/twa';This will be shown if TWA was loaded in Telegram and available
- } - noTWApp={This will be shown is this is not a Telegram environment
} + loading={...loading
} + isTWApp={I am a Telegram App!
} + noTWApp={I am non Telegram App (simple web app)
} />; ``` diff --git a/package-lock.json b/package-lock.json index b9e37c3..c171218 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@altiore/twa", - "version": "1.2.15", + "version": "1.2.16", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@altiore/twa", - "version": "1.2.15", + "version": "1.2.16", "license": "MIT", "devDependencies": { "@changesets/cli": "2.25.2", diff --git a/package.json b/package.json index efb1014..cca0c3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@altiore/twa", - "version": "1.2.15", + "version": "1.2.16", "description": "React components for Telegram WebApp", "source": "./src/index.ts", "type": "module", diff --git a/src/TwaLoader.tsx b/src/TwaLoader.tsx index e8cb98d..cdf0cb3 100644 --- a/src/TwaLoader.tsx +++ b/src/TwaLoader.tsx @@ -31,13 +31,6 @@ export const TwaLoader: FC