Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions types/telegram-web-app/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ interface WebApp {
* event qrTextReceived.
*/
closeScanQrPopup(): void;
/** A method that opens the native story editor with the media specified in
* the media_url parameter as an HTTPS URL. An optional params argument of
* the type StoryShareParams describes additional sharing settings. */
shareToStory(media_url: string, params?: StoryShareParams): void;
/**
* A method that requests text from the clipboard. The Web App will receive
* the event clipboardTextReceived. If an optional callback parameter was
Expand Down Expand Up @@ -1046,3 +1050,22 @@ interface RequestContactResponseCancelled {
}

type RequestContactResponse = RequestContactResponseSent | RequestContactResponseCancelled;

/** This object describes additional sharing settings for the native story
* editor. */
interface StoryShareParams {
/** The caption to be added to the media, 0-200 characters for regular users
* and 0-2048 characters for premium subscribers. */
text?: string;
/** An object that describes a widget link to be included in the story. Note
* that only premium subscribers can post stories with links. */
widget_link?: StoryWidgetLink;
}

/** This object describes a widget link to be included in the story. */
interface StoryWidgetLink {
/** The URL to be included in the story. */
url: string;
/** The name to be displayed for the widget link, 0-48 characters. */
name?: string;
}
2 changes: 1 addition & 1 deletion types/telegram-web-app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/telegram-web-app",
"version": "7.3.9999",
"version": "7.8.9999",
"nonNpm": "conflict",
"nonNpmDescription": "telegram-web-app",
"projects": [
Expand Down
4 changes: 4 additions & 0 deletions types/telegram-web-app/telegram-web-app-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,7 @@ app.BiometricManager.openSettings();
app.isVerticalSwipesEnabled; // $ExpectType boolean
app.enableVerticalSwipes();
app.disableVerticalSwipes();
app.shareToStory("url", {
text: "txt",
widget_link: { name: "name", url: "url" },
});