@tma.js/bridge 1.3.12 → 1.4.1
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.
- package/dist/dts/errors/MethodUnsupportedError.d.ts +8 -0
- package/dist/dts/errors/ParameterUnsupportedError.d.ts +8 -0
- package/dist/dts/errors/index.d.ts +2 -0
- package/dist/dts/events/events.d.ts +8 -3
- package/dist/dts/events/index.d.ts +2 -2
- package/dist/dts/events/parsers/clipboardTextReceived.d.ts +13 -0
- package/dist/dts/events/parsers/customMethodInvoked.d.ts +16 -0
- package/dist/dts/events/parsers/index.d.ts +9 -0
- package/dist/dts/events/parsers/invoiceClosed.d.ts +12 -0
- package/dist/dts/events/parsers/phoneRequested.d.ts +8 -0
- package/dist/dts/events/parsers/popupClosed.d.ts +8 -0
- package/dist/dts/events/parsers/qrTextReceived.d.ts +7 -0
- package/dist/dts/events/parsers/theme-changed.d.ts +42 -0
- package/dist/dts/events/parsers/viewportChanged.d.ts +19 -0
- package/dist/dts/events/parsers/writeAccessRequested.d.ts +8 -0
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/methods/createPostEvent.d.ts +10 -0
- package/dist/dts/methods/index.d.ts +5 -4
- package/dist/dts/methods/{params.d.ts → methods.d.ts} +30 -18
- package/dist/dts/methods/postEvent.d.ts +1 -1
- package/dist/dts/request.d.ts +10 -10
- package/dist/dts/supports.d.ts +2 -9
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +201 -153
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/errors/MethodUnsupportedError.ts +13 -0
- package/src/errors/ParameterUnsupportedError.ts +13 -0
- package/src/errors/index.ts +2 -0
- package/src/events/emitter.ts +20 -19
- package/src/events/events.ts +11 -6
- package/src/events/index.ts +2 -2
- package/src/events/parsers/clipboardTextReceived.ts +27 -0
- package/src/events/parsers/customMethodInvoked.ts +26 -0
- package/src/events/parsers/index.ts +9 -0
- package/src/events/parsers/invoiceClosed.ts +26 -0
- package/src/events/parsers/phoneRequested.ts +14 -0
- package/src/events/parsers/popupClosed.ts +19 -0
- package/src/events/parsers/qrTextReceived.ts +14 -0
- package/src/events/parsers/theme-changed.ts +58 -0
- package/src/events/parsers/viewportChanged.ts +33 -0
- package/src/events/parsers/writeAccessRequested.ts +14 -0
- package/src/index.ts +1 -0
- package/src/methods/createPostEvent.ts +39 -0
- package/src/methods/index.ts +5 -4
- package/src/methods/{params.ts → methods.ts} +33 -18
- package/src/methods/postEvent.ts +1 -1
- package/src/request.ts +27 -30
- package/src/supports.ts +19 -40
- package/dist/dts/events/parsing.d.ts +0 -38
- package/dist/dts/events/payloads.d.ts +0 -98
- package/src/events/parsing.ts +0 -104
- package/src/events/payloads.ts +0 -116
package/src/events/payloads.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import type { RGB } from '@tma.js/colors';
|
|
2
|
-
|
|
3
|
-
import type { RequestId } from '../shared.js';
|
|
4
|
-
|
|
5
|
-
export interface ClipboardTextReceivedPayload {
|
|
6
|
-
/**
|
|
7
|
-
* Passed during the `web_app_read_text_from_clipboard` method invocation `req_id` value.
|
|
8
|
-
*/
|
|
9
|
-
req_id: RequestId;
|
|
10
|
-
/**
|
|
11
|
-
* Data extracted from the clipboard. The returned value will have the type `string` only in
|
|
12
|
-
* the case, application has access to the clipboard.
|
|
13
|
-
*/
|
|
14
|
-
data?: string | null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface CustomMethodInvokedPayload<R = unknown> {
|
|
18
|
-
/**
|
|
19
|
-
* Unique identifier of this invocation.
|
|
20
|
-
*/
|
|
21
|
-
req_id: RequestId;
|
|
22
|
-
/**
|
|
23
|
-
* Method invocation successful result.
|
|
24
|
-
*/
|
|
25
|
-
result?: R;
|
|
26
|
-
/**
|
|
27
|
-
* Method invocation error code.
|
|
28
|
-
*/
|
|
29
|
-
error?: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export type InvoiceStatus =
|
|
33
|
-
| 'paid'
|
|
34
|
-
| 'failed'
|
|
35
|
-
| 'pending'
|
|
36
|
-
| 'cancelled'
|
|
37
|
-
| string;
|
|
38
|
-
|
|
39
|
-
export interface InvoiceClosedPayload {
|
|
40
|
-
/**
|
|
41
|
-
* Passed during the `web_app_open_invoice` method invocation `slug` value.
|
|
42
|
-
*/
|
|
43
|
-
slug: string;
|
|
44
|
-
/**
|
|
45
|
-
* Invoice status
|
|
46
|
-
*/
|
|
47
|
-
status: InvoiceStatus;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface QrTextReceivedPayload {
|
|
51
|
-
/**
|
|
52
|
-
* Data extracted from the QR.
|
|
53
|
-
*/
|
|
54
|
-
data?: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface ThemeChangedPayload {
|
|
58
|
-
/**
|
|
59
|
-
* Map where the key is a theme stylesheet key and value is the corresponding color in
|
|
60
|
-
* `#RRGGBB` format.
|
|
61
|
-
*/
|
|
62
|
-
theme_params: {
|
|
63
|
-
bg_color?: RGB;
|
|
64
|
-
text_color?: RGB;
|
|
65
|
-
hint_color?: RGB;
|
|
66
|
-
link_color?: RGB;
|
|
67
|
-
button_color?: RGB;
|
|
68
|
-
button_text_color?: RGB;
|
|
69
|
-
secondary_bg_color?: RGB;
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export interface ViewportChangedPayload {
|
|
74
|
-
/**
|
|
75
|
-
* The viewport height.
|
|
76
|
-
*/
|
|
77
|
-
height: number;
|
|
78
|
-
/**
|
|
79
|
-
* The viewport width.
|
|
80
|
-
*/
|
|
81
|
-
width: number;
|
|
82
|
-
/**
|
|
83
|
-
* Is the viewport currently expanded.
|
|
84
|
-
*/
|
|
85
|
-
is_expanded: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Is the viewport current state stable and not going to change in the next moment.
|
|
88
|
-
*/
|
|
89
|
-
is_state_stable: boolean;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface PopupClosedPayload {
|
|
93
|
-
/**
|
|
94
|
-
* Identifier of the clicked button. In case, the popup was closed without clicking any button,
|
|
95
|
-
* this property will be omitted.
|
|
96
|
-
*/
|
|
97
|
-
button_id?: string;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export type PhoneRequestedStatus = 'sent' | string;
|
|
101
|
-
|
|
102
|
-
export interface PhoneRequestedPayload {
|
|
103
|
-
/**
|
|
104
|
-
* Request status.
|
|
105
|
-
*/
|
|
106
|
-
status: PhoneRequestedStatus;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export type WriteAccessRequestedStatus = 'allowed' | string;
|
|
110
|
-
|
|
111
|
-
export interface WriteAccessRequestedPayload {
|
|
112
|
-
/**
|
|
113
|
-
* Request status.
|
|
114
|
-
*/
|
|
115
|
-
status: WriteAccessRequestedStatus;
|
|
116
|
-
}
|