@types/telegram-web-app 7.0.0 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- telegram-web-app/README.md +1 -1
- telegram-web-app/index.d.ts +47 -4
- telegram-web-app/package.json +2 -2
telegram-web-app/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for telegram-web-app (https://telegram.or
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/telegram-web-app.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Wed, 06 Mar 2024 06:35:45 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
|
|
14
14
|
# Credits
|
telegram-web-app/index.d.ts
CHANGED
|
@@ -157,7 +157,7 @@ interface WebApp {
|
|
|
157
157
|
eventType: "writeAccessRequested",
|
|
158
158
|
eventHandler: (eventData: { status: "allowed" | "cancelled" }) => void,
|
|
159
159
|
): void;
|
|
160
|
-
onEvent(eventType: "contactRequested", eventHandler: (eventData:
|
|
160
|
+
onEvent(eventType: "contactRequested", eventHandler: (eventData: RequestContactResponse) => void): void;
|
|
161
161
|
|
|
162
162
|
/** A method that deletes a previously set event handler. */
|
|
163
163
|
offEvent(
|
|
@@ -176,7 +176,7 @@ interface WebApp {
|
|
|
176
176
|
eventType: "writeAccessRequested",
|
|
177
177
|
eventHandler: (eventData: { status: "allowed" | "cancelled" }) => void,
|
|
178
178
|
): void;
|
|
179
|
-
offEvent(eventType: "contactRequested", eventHandler: (eventData:
|
|
179
|
+
offEvent(eventType: "contactRequested", eventHandler: (eventData: RequestContactResponse) => void): void;
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
182
|
* A method used to send data to the bot. When this method is called, a
|
|
@@ -278,9 +278,12 @@ interface WebApp {
|
|
|
278
278
|
* @param callback If an optional callback parameter was passed, the
|
|
279
279
|
* callback function will be called when the popup is closed and the first
|
|
280
280
|
* argument will be a boolean indicating whether the user shared its
|
|
281
|
-
* phone number.
|
|
281
|
+
* phone number. The second argument, contingent upon success, will be
|
|
282
|
+
* an object detailing the shared contact information or a cancellation response.
|
|
282
283
|
*/
|
|
283
|
-
requestContact(
|
|
284
|
+
requestContact(
|
|
285
|
+
callback?: (success: boolean, response: RequestContactResponse) => void,
|
|
286
|
+
): void;
|
|
284
287
|
/**
|
|
285
288
|
* A method that informs the Telegram app that the Web App is ready to be
|
|
286
289
|
* displayed. It is recommended to call this method as early as possible, as
|
|
@@ -809,3 +812,43 @@ interface ScanQrPopupParams {
|
|
|
809
812
|
*/
|
|
810
813
|
text?: string;
|
|
811
814
|
}
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* This object describes contact information shared when requestContact was approved by the user.
|
|
818
|
+
*/
|
|
819
|
+
interface RequestContactResponseSent {
|
|
820
|
+
/** Status 'sent' indicates that contact information has been shared. */
|
|
821
|
+
status: "sent";
|
|
822
|
+
/** A status message or result as a string. */
|
|
823
|
+
response: string;
|
|
824
|
+
/** Contains sensitive information shared upon user consent. WARNING: Data from
|
|
825
|
+
* this field should not be trusted. You should only use data from `response` on
|
|
826
|
+
* the bot's server and only after it has been validated. */
|
|
827
|
+
responseUnsafe: {
|
|
828
|
+
/** Authorization date for sharing contact information. */
|
|
829
|
+
auth_date: string;
|
|
830
|
+
/** Object holding user's contact details. */
|
|
831
|
+
contact: {
|
|
832
|
+
/** User's first name. */
|
|
833
|
+
first_name: string;
|
|
834
|
+
/** Optional. User's last name. */
|
|
835
|
+
last_name?: string;
|
|
836
|
+
/** User's phone number. */
|
|
837
|
+
phone_number: string;
|
|
838
|
+
/** Unique identifier of the user. */
|
|
839
|
+
user_id: number;
|
|
840
|
+
};
|
|
841
|
+
/** Hash to verify data authenticity. */
|
|
842
|
+
hash: string;
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* This object only contains a status to indicate the cancellation.
|
|
848
|
+
*/
|
|
849
|
+
interface RequestContactResponseCancelled {
|
|
850
|
+
/** Status 'cancelled', indicates that user cancelled the contact share request. */
|
|
851
|
+
status: "cancelled";
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
type RequestContactResponse = RequestContactResponseSent | RequestContactResponseCancelled;
|
telegram-web-app/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/telegram-web-app",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "TypeScript definitions for telegram-web-app",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/telegram-web-app",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,6 +30,6 @@
|
|
|
30
30
|
},
|
|
31
31
|
"scripts": {},
|
|
32
32
|
"dependencies": {},
|
|
33
|
-
"typesPublisherContentHash": "
|
|
33
|
+
"typesPublisherContentHash": "e60f7c8652216a4904f9dec0fa735f121014abd943bd6a19bb9c430198c076b6",
|
|
34
34
|
"typeScriptVersion": "4.6"
|
|
35
35
|
}
|