telegram-apps icon indicating copy to clipboard operation
telegram-apps copied to clipboard

[Feature]: Migration from v1 to v2

Open sn4f opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe.

I am currently migrating from version v1 to version v2, but we were using imports such as:

import { initNavigator } from "@telegram-apps/sdk-react";
import { SDKProvider } from "@telegram-apps/sdk-react";
import { useBackButton } from "@telegram-apps/sdk-react";

which do not exist in v2. Is there any migration guide available? I am performing the migration because I would like to use methods related to invoices – displaying them to the user. v1 doesn't allow this as I get the error: [Telegram.WebApp] Method openInvoice is not supported in version 6.0.

Describe the solution you'd like

Would be great to have migration guide

Describe alternatives you've considered

No response

Additional context

No response

sn4f avatar Oct 24 '24 23:10 sn4f

Also example here: https://docs.telegram-mini-apps.com/packages/telegram-apps-react-router-integration Suggests using initNavigator from v1 of @telegram-apps/sdk-react

FlusherDock1 avatar Oct 25 '24 11:10 FlusherDock1

Personally I also faced with it, but I managed to migrate by creating new TMA template with 2.x version like npx create tma (I don't remember, look at the documentation), which has new imports/many removals and comparing my project and created template, I've migrated easily, but having the guide, it would be more nice and quicker

NeizKap avatar Nov 28 '24 02:11 NeizKap

This commit from official telegram-sdk-react template can be good sample as a fallback how to migrate from 1.x to 2.x: https://github.com/Telegram-Mini-Apps/reactjs-template/commit/b35359b3948618960c2d4d62af492209d5978ea1

Neiz-Kap avatar Dec 27 '24 11:12 Neiz-Kap

Sorry guys, we are now supporting the version 3 and not going to write the migration guide from v1 to v2

heyqbnk avatar Apr 05 '25 10:04 heyqbnk