@core-ease/telegram-kit 3.0.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/LICENSE +21 -0
- package/README.md +299 -0
- package/dist/animation/index.d.mts +4 -0
- package/dist/animation/index.d.ts +4 -0
- package/dist/animation/index.js +2413 -0
- package/dist/animation/index.mjs +5 -0
- package/dist/animation/lottie/index.d.mts +10 -0
- package/dist/animation/lottie/index.d.ts +10 -0
- package/dist/animation/lottie/index.js +2313 -0
- package/dist/animation/lottie/index.mjs +4 -0
- package/dist/animation/tgs/index.d.mts +18 -0
- package/dist/animation/tgs/index.d.ts +18 -0
- package/dist/animation/tgs/index.js +2402 -0
- package/dist/animation/tgs/index.mjs +4 -0
- package/dist/bot/index.d.mts +477 -0
- package/dist/bot/index.d.ts +477 -0
- package/dist/bot/index.js +870 -0
- package/dist/bot/index.mjs +847 -0
- package/dist/bot-D8BnLWIi.d.mts +2041 -0
- package/dist/bot-D8BnLWIi.d.ts +2041 -0
- package/dist/browser.global.js +23 -0
- package/dist/chunk-7AARTHNW.mjs +40 -0
- package/dist/chunk-7CVYPKAL.mjs +15 -0
- package/dist/chunk-B3PWALX5.mjs +4418 -0
- package/dist/chunk-BQEUEAVK.mjs +2262 -0
- package/dist/chunk-FPWYSKK2.mjs +3089 -0
- package/dist/chunk-JXK5HCDV.mjs +254 -0
- package/dist/chunk-OMH2JGOH.mjs +88 -0
- package/dist/chunk-PXO36YTU.mjs +38 -0
- package/dist/core/index.d.mts +151 -0
- package/dist/core/index.d.ts +151 -0
- package/dist/core/index.js +3837 -0
- package/dist/core/index.mjs +495 -0
- package/dist/dev/index.d.mts +77 -0
- package/dist/dev/index.d.ts +77 -0
- package/dist/dev/index.js +3214 -0
- package/dist/dev/index.mjs +151 -0
- package/dist/engine-BDm1_hzn.d.mts +382 -0
- package/dist/engine-BDm1_hzn.d.ts +382 -0
- package/dist/format/index.d.mts +61 -0
- package/dist/format/index.d.ts +61 -0
- package/dist/format/index.js +121 -0
- package/dist/format/index.mjs +112 -0
- package/dist/hooks/index.d.mts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +4234 -0
- package/dist/hooks/index.mjs +3 -0
- package/dist/hooks-C5Per70R.d.mts +1066 -0
- package/dist/hooks-C5Per70R.d.ts +1066 -0
- package/dist/index.d.mts +849 -0
- package/dist/index.d.ts +849 -0
- package/dist/index.js +5026 -0
- package/dist/index.mjs +478 -0
- package/dist/keyboards/index.d.mts +50 -0
- package/dist/keyboards/index.d.ts +50 -0
- package/dist/keyboards/index.js +127 -0
- package/dist/keyboards/index.mjs +124 -0
- package/dist/links/index.d.mts +53 -0
- package/dist/links/index.d.ts +53 -0
- package/dist/links/index.js +139 -0
- package/dist/links/index.mjs +133 -0
- package/dist/lottie/index.d.mts +3 -0
- package/dist/lottie/index.d.ts +3 -0
- package/dist/lottie/index.js +2313 -0
- package/dist/lottie/index.mjs +4 -0
- package/dist/qr/index.d.mts +75 -0
- package/dist/qr/index.d.ts +75 -0
- package/dist/qr/index.js +983 -0
- package/dist/qr/index.mjs +946 -0
- package/dist/sdk/index.d.mts +322 -0
- package/dist/sdk/index.d.ts +322 -0
- package/dist/sdk/index.js +3138 -0
- package/dist/sdk/index.mjs +2 -0
- package/dist/server/index.d.mts +28 -0
- package/dist/server/index.d.ts +28 -0
- package/dist/server/index.js +254 -0
- package/dist/server/index.mjs +246 -0
- package/dist/tgs/index.d.mts +3 -0
- package/dist/tgs/index.d.ts +3 -0
- package/dist/tgs/index.js +2402 -0
- package/dist/tgs/index.mjs +4 -0
- package/dist/webapp-B-3_74nK.d.mts +842 -0
- package/dist/webapp-B-3_74nK.d.ts +842 -0
- package/dist/webapp-BDi9q3-a.d.mts +42 -0
- package/dist/webapp-YvmwFYUQ.d.ts +42 -0
- package/package.json +165 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/core/fallback.ts
|
|
3
|
+
var DEV_MODE_STORAGE_KEY = "@core-ease/telegram-kit:dev-mode-active";
|
|
4
|
+
function markDevModeActive() {
|
|
5
|
+
try {
|
|
6
|
+
if (typeof window !== "undefined") window.sessionStorage.setItem(DEV_MODE_STORAGE_KEY, "1");
|
|
7
|
+
} catch (e) {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function isDevModeActive() {
|
|
11
|
+
try {
|
|
12
|
+
return typeof window !== "undefined" && window.sessionStorage.getItem(DEV_MODE_STORAGE_KEY) === "1";
|
|
13
|
+
} catch (e) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
var STORAGE_PREFIX = "@core-ease/telegram-kit:fallback:";
|
|
18
|
+
function createLocalStorageFallback(namespace) {
|
|
19
|
+
const prefix = `${STORAGE_PREFIX}${namespace}:`;
|
|
20
|
+
const hasLocalStorage = () => typeof window !== "undefined" && !!window.localStorage;
|
|
21
|
+
return {
|
|
22
|
+
async setItem(key, value) {
|
|
23
|
+
if (!hasLocalStorage()) return false;
|
|
24
|
+
try {
|
|
25
|
+
window.localStorage.setItem(prefix + key, value);
|
|
26
|
+
return true;
|
|
27
|
+
} catch (e) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
async getItem(key) {
|
|
32
|
+
if (!hasLocalStorage()) return void 0;
|
|
33
|
+
try {
|
|
34
|
+
const value = window.localStorage.getItem(prefix + key);
|
|
35
|
+
return value === null ? void 0 : value;
|
|
36
|
+
} catch (e) {
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
async getItems(keys) {
|
|
41
|
+
const result = {};
|
|
42
|
+
if (!hasLocalStorage()) return result;
|
|
43
|
+
for (const key of keys) {
|
|
44
|
+
try {
|
|
45
|
+
const value = window.localStorage.getItem(prefix + key);
|
|
46
|
+
if (value !== null) result[key] = value;
|
|
47
|
+
} catch (e) {
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
},
|
|
52
|
+
async removeItem(key) {
|
|
53
|
+
if (!hasLocalStorage()) return false;
|
|
54
|
+
try {
|
|
55
|
+
window.localStorage.removeItem(prefix + key);
|
|
56
|
+
return true;
|
|
57
|
+
} catch (e) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
async removeItems(keys) {
|
|
62
|
+
if (!hasLocalStorage()) return false;
|
|
63
|
+
try {
|
|
64
|
+
keys.forEach((key) => window.localStorage.removeItem(prefix + key));
|
|
65
|
+
return true;
|
|
66
|
+
} catch (e) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
async getKeys() {
|
|
71
|
+
if (!hasLocalStorage()) return [];
|
|
72
|
+
try {
|
|
73
|
+
const keys = [];
|
|
74
|
+
for (let i = 0; i < window.localStorage.length; i++) {
|
|
75
|
+
const rawKey = window.localStorage.key(i);
|
|
76
|
+
if (rawKey && rawKey.startsWith(prefix)) keys.push(rawKey.slice(prefix.length));
|
|
77
|
+
}
|
|
78
|
+
return keys;
|
|
79
|
+
} catch (e) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
async clear() {
|
|
84
|
+
if (!hasLocalStorage()) return false;
|
|
85
|
+
try {
|
|
86
|
+
const keys = await this.getKeys();
|
|
87
|
+
keys.forEach((key) => window.localStorage.removeItem(prefix + key));
|
|
88
|
+
return true;
|
|
89
|
+
} catch (e) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
var HAPTIC_PATTERNS = {
|
|
96
|
+
light: 10,
|
|
97
|
+
medium: 20,
|
|
98
|
+
heavy: 30,
|
|
99
|
+
rigid: 15,
|
|
100
|
+
soft: 10,
|
|
101
|
+
success: [10, 30, 10],
|
|
102
|
+
warning: [20, 40, 20],
|
|
103
|
+
error: [30, 60, 30],
|
|
104
|
+
selection: 5
|
|
105
|
+
};
|
|
106
|
+
function vibrateFallback(kind) {
|
|
107
|
+
try {
|
|
108
|
+
if (typeof navigator !== "undefined" && typeof navigator.vibrate === "function") {
|
|
109
|
+
navigator.vibrate(HAPTIC_PATTERNS[kind]);
|
|
110
|
+
}
|
|
111
|
+
} catch (e) {
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function downloadFileFallback(url, fileName) {
|
|
115
|
+
try {
|
|
116
|
+
if (typeof document === "undefined") return false;
|
|
117
|
+
const a = document.createElement("a");
|
|
118
|
+
a.href = url;
|
|
119
|
+
a.download = fileName;
|
|
120
|
+
a.rel = "noopener";
|
|
121
|
+
a.target = "_blank";
|
|
122
|
+
document.body.appendChild(a);
|
|
123
|
+
a.click();
|
|
124
|
+
document.body.removeChild(a);
|
|
125
|
+
return true;
|
|
126
|
+
} catch (e) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function getLocationFallback() {
|
|
131
|
+
return new Promise((resolve) => {
|
|
132
|
+
if (typeof navigator === "undefined" || !navigator.geolocation) {
|
|
133
|
+
resolve(null);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
navigator.geolocation.getCurrentPosition(
|
|
137
|
+
(position) => {
|
|
138
|
+
resolve({
|
|
139
|
+
latitude: position.coords.latitude,
|
|
140
|
+
longitude: position.coords.longitude,
|
|
141
|
+
altitude: position.coords.altitude,
|
|
142
|
+
course: position.coords.heading,
|
|
143
|
+
speed: position.coords.speed,
|
|
144
|
+
horizontal_accuracy: position.coords.accuracy,
|
|
145
|
+
vertical_accuracy: position.coords.altitudeAccuracy,
|
|
146
|
+
course_accuracy: null,
|
|
147
|
+
speed_accuracy: null
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
() => resolve(null),
|
|
151
|
+
{ enableHighAccuracy: false, timeout: 8e3, maximumAge: 6e4 }
|
|
152
|
+
);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
async function readClipboardFallback() {
|
|
156
|
+
var _a;
|
|
157
|
+
try {
|
|
158
|
+
if (typeof navigator !== "undefined" && ((_a = navigator.clipboard) == null ? void 0 : _a.readText)) {
|
|
159
|
+
const text = await navigator.clipboard.readText();
|
|
160
|
+
return text != null ? text : null;
|
|
161
|
+
}
|
|
162
|
+
} catch (e) {
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
function scanQrFallback(promptText) {
|
|
167
|
+
if (typeof window === "undefined" || typeof window.prompt !== "function") return null;
|
|
168
|
+
const value = window.prompt(promptText || "Enter the QR code value:");
|
|
169
|
+
return value && value.length ? value : null;
|
|
170
|
+
}
|
|
171
|
+
async function shareTextFallback(text, url) {
|
|
172
|
+
var _a;
|
|
173
|
+
try {
|
|
174
|
+
if (typeof navigator !== "undefined" && typeof navigator.share === "function") {
|
|
175
|
+
await navigator.share({ text, url });
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
} catch (e) {
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
if (typeof navigator !== "undefined" && ((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
|
|
182
|
+
await navigator.clipboard.writeText(url ? `${text}
|
|
183
|
+
${url}` : text);
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
} catch (e) {
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
function callNativeOrFallback(options) {
|
|
191
|
+
const { ready, native, fallback, timeoutMs = 4e3 } = options;
|
|
192
|
+
if (!ready) {
|
|
193
|
+
try {
|
|
194
|
+
return Promise.resolve(fallback());
|
|
195
|
+
} catch (e) {
|
|
196
|
+
return Promise.reject(e);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return new Promise((resolve) => {
|
|
200
|
+
let settled = false;
|
|
201
|
+
const finish = async (useFallback, value) => {
|
|
202
|
+
if (settled) return;
|
|
203
|
+
settled = true;
|
|
204
|
+
clearTimeout(timer);
|
|
205
|
+
resolve(useFallback ? await fallback() : value);
|
|
206
|
+
};
|
|
207
|
+
const timer = setTimeout(() => finish(true), timeoutMs);
|
|
208
|
+
try {
|
|
209
|
+
native().then(
|
|
210
|
+
(value) => finish(false, value),
|
|
211
|
+
() => finish(true)
|
|
212
|
+
);
|
|
213
|
+
} catch (e) {
|
|
214
|
+
finish(true);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
async function orientationLockFallback(locked) {
|
|
219
|
+
try {
|
|
220
|
+
const orientation = typeof screen !== "undefined" ? screen.orientation : void 0;
|
|
221
|
+
if (!orientation) return false;
|
|
222
|
+
if (locked) {
|
|
223
|
+
await orientation.lock("portrait");
|
|
224
|
+
} else if (typeof orientation.unlock === "function") {
|
|
225
|
+
orientation.unlock();
|
|
226
|
+
}
|
|
227
|
+
return true;
|
|
228
|
+
} catch (e) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
async function fullscreenFallback(enter, el) {
|
|
233
|
+
var _a, _b;
|
|
234
|
+
try {
|
|
235
|
+
if (typeof document === "undefined") return false;
|
|
236
|
+
if (enter) {
|
|
237
|
+
const target = el != null ? el : document.documentElement;
|
|
238
|
+
await ((_a = target.requestFullscreen) == null ? void 0 : _a.call(target));
|
|
239
|
+
} else if (document.fullscreenElement) {
|
|
240
|
+
await ((_b = document.exitFullscreen) == null ? void 0 : _b.call(document));
|
|
241
|
+
}
|
|
242
|
+
return true;
|
|
243
|
+
} catch (e) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function safeInvoke(fn) {
|
|
248
|
+
try {
|
|
249
|
+
fn();
|
|
250
|
+
} catch (e) {
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export { callNativeOrFallback, createLocalStorageFallback, downloadFileFallback, fullscreenFallback, getLocationFallback, isDevModeActive, markDevModeActive, orientationLockFallback, readClipboardFallback, safeInvoke, scanQrFallback, shareTextFallback, vibrateFallback };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createAnimationPlayerComponent } from './chunk-BQEUEAVK.mjs';
|
|
3
|
+
import { __objRest, __spreadProps, __spreadValues } from './chunk-PXO36YTU.mjs';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
// src/_internal/animation/lottie/validate.ts
|
|
8
|
+
function checkTgsCompliance(data) {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const errors = [];
|
|
11
|
+
if (data.tgs !== 1) {
|
|
12
|
+
errors.push("Must be marked as a TGS Lottie variant (tgs: 1)");
|
|
13
|
+
}
|
|
14
|
+
if ((data.op - data.ip) / data.fr > 3) {
|
|
15
|
+
errors.push("Longer than 3 seconds");
|
|
16
|
+
}
|
|
17
|
+
if (data.w !== 512 || data.h !== 512) {
|
|
18
|
+
errors.push("Dimensions should be exactly 512x512px");
|
|
19
|
+
}
|
|
20
|
+
if (data.ddd != null && data.ddd !== 0) {
|
|
21
|
+
errors.push("Must not have 3D layers");
|
|
22
|
+
}
|
|
23
|
+
if (data.markers && data.markers.length > 0) {
|
|
24
|
+
errors.push("Must not have markers");
|
|
25
|
+
}
|
|
26
|
+
for (const asset of (_a = data.assets) != null ? _a : []) {
|
|
27
|
+
if (asset.layers) {
|
|
28
|
+
for (const layer of asset.layers) errors.push(...checkLayer(layer));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
for (const layer of (_b = data.layers) != null ? _b : []) {
|
|
32
|
+
errors.push(...checkLayer(layer));
|
|
33
|
+
}
|
|
34
|
+
return errors;
|
|
35
|
+
}
|
|
36
|
+
function checkLayer(layer) {
|
|
37
|
+
const errors = [];
|
|
38
|
+
if (layer.ddd != null && layer.ddd !== 0) {
|
|
39
|
+
errors.push("Composition should not include any 3D Layers");
|
|
40
|
+
}
|
|
41
|
+
if (layer.sr != null && layer.sr !== 1) {
|
|
42
|
+
errors.push("Composition should not include any Time Stretching");
|
|
43
|
+
}
|
|
44
|
+
if (layer.tm != null) {
|
|
45
|
+
errors.push("Composition should not include any Time Remapping");
|
|
46
|
+
}
|
|
47
|
+
if (layer.ty === 1) errors.push("Composition should not include any Solids");
|
|
48
|
+
if (layer.ty === 2) errors.push("Composition should not include any Images");
|
|
49
|
+
if (layer.ty === 5) errors.push("Composition should not include any Texts");
|
|
50
|
+
if (layer.masksProperties && layer.masksProperties.length > 0) {
|
|
51
|
+
errors.push("Composition should not include any Masks");
|
|
52
|
+
}
|
|
53
|
+
if (layer.tt != null) errors.push("Composition should not include any Mattes");
|
|
54
|
+
if (layer.ao === 1) errors.push("Composition should not include any Auto-Oriented Layers");
|
|
55
|
+
if (layer.ef != null) errors.push("Composition should not include any Layer Effects");
|
|
56
|
+
if (layer.shapes) {
|
|
57
|
+
errors.push(...checkItems(layer.shapes));
|
|
58
|
+
}
|
|
59
|
+
return errors;
|
|
60
|
+
}
|
|
61
|
+
function checkItems(items, isShapesLevel) {
|
|
62
|
+
const errors = [];
|
|
63
|
+
if (!items) return errors;
|
|
64
|
+
for (const item of items) {
|
|
65
|
+
if (item.ty === "rp") errors.push("Composition should not include any Repeaters");
|
|
66
|
+
if (item.ty === "sr") errors.push("Composition should not include any Star Shapes");
|
|
67
|
+
if (item.ty === "mm") errors.push("Composition should not include any Merge Paths");
|
|
68
|
+
if (item.ty === "gs") errors.push("Composition should not include any Gradient Strokes");
|
|
69
|
+
if (item.ty === "gr") {
|
|
70
|
+
errors.push(...checkItems(item.it));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return errors;
|
|
74
|
+
}
|
|
75
|
+
var BaseAnimationPlayer = createAnimationPlayerComponent("TgsPlayer", "Telegram animated sticker");
|
|
76
|
+
var TgsPlayer = React.forwardRef(function TgsPlayer2(props, ref) {
|
|
77
|
+
const _a = props, { strict = true } = _a, rest = __objRest(_a, ["strict"]);
|
|
78
|
+
return /* @__PURE__ */ jsx(
|
|
79
|
+
BaseAnimationPlayer,
|
|
80
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
81
|
+
ref,
|
|
82
|
+
validate: strict ? checkTgsCompliance : void 0
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
TgsPlayer.displayName = "TgsPlayer";
|
|
87
|
+
|
|
88
|
+
export { TgsPlayer, checkTgsCompliance };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
var __export = (target, all) => {
|
|
34
|
+
for (var name in all)
|
|
35
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { __export, __objRest, __spreadProps, __spreadValues };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { P as PopupParams, D as DownloadFileParams, W as WebAppUser, C as ColorScheme, T as ThemeParams, a as WebApp, H as HapticFeedback, L as LocationData, S as ShareToStoryParams } from '../webapp-B-3_74nK.mjs';
|
|
2
|
+
import { E as EmojiStatusParams } from '../webapp-BDi9q3-a.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Browser-native fallbacks for `@core-ease/telegram-kit`.
|
|
6
|
+
*
|
|
7
|
+
* Every wrapper in `core/index.ts` calls into the real bundled SDK first.
|
|
8
|
+
* When that isn't possible - the Mini App is opened in a plain browser tab,
|
|
9
|
+
* or the installed Telegram client is older than a feature needs - these
|
|
10
|
+
* helpers provide the closest standard Web API equivalent instead of
|
|
11
|
+
* rejecting the call or spamming the console with "not supported"
|
|
12
|
+
* warnings. Where no meaningful browser equivalent exists (biometrics,
|
|
13
|
+
* emoji status, Telegram-account actions, ...) the wrapper still resolves
|
|
14
|
+
* predictably (`false`/`null`/`[]`) instead of throwing.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** Swallows synchronous throws from fire-and-forget SDK calls (e.g. hard version gates). */
|
|
18
|
+
declare function safeInvoke(fn: () => void): void;
|
|
19
|
+
|
|
20
|
+
/** Returns the bundled SDK's `WebApp` instance directly (never reads `window.Telegram`). */
|
|
21
|
+
declare function getWebApp(): WebApp | null;
|
|
22
|
+
/**
|
|
23
|
+
* `true` once real Telegram init data has been observed - i.e. the Mini
|
|
24
|
+
* App was actually opened from inside Telegram, or `installDevMode()`
|
|
25
|
+
* seeded matching fake data for local testing.
|
|
26
|
+
*/
|
|
27
|
+
declare function isInTelegram(): boolean;
|
|
28
|
+
declare function isVersionAtLeast(version: string): boolean;
|
|
29
|
+
declare function getRawUserData(): WebAppUser | null;
|
|
30
|
+
declare function getUserDisplayName(user?: WebAppUser): string;
|
|
31
|
+
declare function getUserIdentifier(user?: WebAppUser): string;
|
|
32
|
+
declare function getUserAvatarUrl(user?: WebAppUser, fallback?: string): string;
|
|
33
|
+
declare function getUserInfoWithAvatar(): {
|
|
34
|
+
user: WebAppUser | undefined;
|
|
35
|
+
avatarUrl: string;
|
|
36
|
+
displayName: string;
|
|
37
|
+
identifier: string;
|
|
38
|
+
};
|
|
39
|
+
declare function openExternalLink(url: string, tryInstantView?: boolean): void;
|
|
40
|
+
declare function openTelegramLink(url: string): void;
|
|
41
|
+
/** No meaningful browser fallback exists for Telegram Payments; rejects clearly instead of hanging. */
|
|
42
|
+
declare function openInvoice(url: string): Promise<'paid' | 'cancelled' | 'failed' | 'pending'>;
|
|
43
|
+
declare function switchInlineQuery(query: string, chooseChatTypes?: Array<'users' | 'bots' | 'groups' | 'channels'>): void;
|
|
44
|
+
declare function hideKeyboard(): void;
|
|
45
|
+
declare function getTheme(): {
|
|
46
|
+
colorScheme: ColorScheme;
|
|
47
|
+
themeParams: ThemeParams;
|
|
48
|
+
};
|
|
49
|
+
declare function getViewport(): {
|
|
50
|
+
height: number;
|
|
51
|
+
stableHeight: number;
|
|
52
|
+
isExpanded: boolean;
|
|
53
|
+
};
|
|
54
|
+
declare function expand(): void;
|
|
55
|
+
declare function ready(): void;
|
|
56
|
+
declare function close(): void;
|
|
57
|
+
/** Fullscreen API fallback outside Telegram / older clients. */
|
|
58
|
+
declare const fullscreen: {
|
|
59
|
+
enter: () => Promise<boolean>;
|
|
60
|
+
exit: () => Promise<boolean>;
|
|
61
|
+
};
|
|
62
|
+
/** Screen Orientation API fallback outside Telegram / older clients. */
|
|
63
|
+
declare const orientation: {
|
|
64
|
+
lock: () => Promise<boolean>;
|
|
65
|
+
unlock: () => Promise<boolean>;
|
|
66
|
+
};
|
|
67
|
+
declare function enableClosingConfirmation(): void;
|
|
68
|
+
declare function disableClosingConfirmation(): void;
|
|
69
|
+
declare function enableVerticalSwipes(): void;
|
|
70
|
+
declare function disableVerticalSwipes(): void;
|
|
71
|
+
declare function setHeaderColor(color: string): void;
|
|
72
|
+
declare function setBackgroundColor(color: string): void;
|
|
73
|
+
declare function setBottomBarColor(color: string): void;
|
|
74
|
+
/** No meaningful browser equivalent (this adds a Telegram Mini App shortcut, specifically) - safely no-ops outside Telegram. */
|
|
75
|
+
declare function addToHomeScreen(): void;
|
|
76
|
+
declare function checkHomeScreenStatus(): Promise<'unsupported' | 'unknown' | 'added' | 'missed'>;
|
|
77
|
+
declare const haptic: {
|
|
78
|
+
light: () => void | HapticFeedback;
|
|
79
|
+
medium: () => void | HapticFeedback;
|
|
80
|
+
heavy: () => void | HapticFeedback;
|
|
81
|
+
rigid: () => void | HapticFeedback;
|
|
82
|
+
soft: () => void | HapticFeedback;
|
|
83
|
+
success: () => void | HapticFeedback;
|
|
84
|
+
warning: () => void | HapticFeedback;
|
|
85
|
+
error: () => void | HapticFeedback;
|
|
86
|
+
selection: () => void | HapticFeedback;
|
|
87
|
+
};
|
|
88
|
+
declare const cloudStorage: {
|
|
89
|
+
setItem: (key: string, value: string) => Promise<boolean>;
|
|
90
|
+
getItem: (key: string) => Promise<string | undefined>;
|
|
91
|
+
getItems: (keys: string[]) => Promise<Record<string, string>>;
|
|
92
|
+
removeItem: (key: string) => Promise<boolean>;
|
|
93
|
+
removeItems: (keys: string[]) => Promise<boolean>;
|
|
94
|
+
getKeys: () => Promise<string[]>;
|
|
95
|
+
};
|
|
96
|
+
declare const deviceStorage: {
|
|
97
|
+
setItem: (key: string, value: string) => Promise<boolean>;
|
|
98
|
+
getItem: (key: string) => Promise<string | undefined>;
|
|
99
|
+
removeItem: (key: string) => Promise<boolean>;
|
|
100
|
+
clear: () => Promise<boolean>;
|
|
101
|
+
};
|
|
102
|
+
declare const secureStorage: {
|
|
103
|
+
setItem: (key: string, value: string) => Promise<boolean>;
|
|
104
|
+
getItem: (key: string) => Promise<{
|
|
105
|
+
value: string | null | undefined;
|
|
106
|
+
canRestore: boolean;
|
|
107
|
+
}>;
|
|
108
|
+
removeItem: (key: string) => Promise<boolean>;
|
|
109
|
+
clear: () => Promise<boolean>;
|
|
110
|
+
restoreItem: (key: string) => Promise<string | undefined>;
|
|
111
|
+
};
|
|
112
|
+
declare const dialog: {
|
|
113
|
+
alert: (message: string) => Promise<void>;
|
|
114
|
+
confirm: (message: string) => Promise<boolean>;
|
|
115
|
+
popup: (params: PopupParams) => Promise<string | null>;
|
|
116
|
+
prompt: (message: string, defaultValue?: string) => Promise<string | null>;
|
|
117
|
+
};
|
|
118
|
+
declare function readClipboard(): Promise<string | null>;
|
|
119
|
+
declare function scanQr(text?: string): Promise<string | null>;
|
|
120
|
+
declare function shareToStory(mediaUrl: string, params?: ShareToStoryParams): void;
|
|
121
|
+
declare function shareMessage(msgId: string): Promise<boolean>;
|
|
122
|
+
declare function downloadFile(params: DownloadFileParams): Promise<boolean>;
|
|
123
|
+
declare function setEmojiStatus(customEmojiId: string, params?: EmojiStatusParams): Promise<boolean>;
|
|
124
|
+
declare function requestEmojiStatusAccess(): Promise<boolean>;
|
|
125
|
+
declare function requestWriteAccess(): Promise<boolean>;
|
|
126
|
+
declare function requestContact(): Promise<boolean>;
|
|
127
|
+
/**
|
|
128
|
+
* Opens Telegram's native chat-request dialog for a chat request you
|
|
129
|
+
* already created server-side, identified by `reqId`. Requires Bot API
|
|
130
|
+
* 9.6+. No browser fallback exists for this Telegram-account action.
|
|
131
|
+
*/
|
|
132
|
+
declare function requestChat(reqId: string): Promise<boolean>;
|
|
133
|
+
/** No fallback: this calls your own bot's server-side logic, which only exists via the real Telegram client. */
|
|
134
|
+
declare function invokeCustomMethod(method: string, params?: object): Promise<unknown>;
|
|
135
|
+
declare const biometric: {
|
|
136
|
+
init: () => Promise<void>;
|
|
137
|
+
requestAccess: (reason?: string) => Promise<boolean>;
|
|
138
|
+
authenticate: (reason?: string) => Promise<{
|
|
139
|
+
authenticated: boolean;
|
|
140
|
+
token?: string;
|
|
141
|
+
}>;
|
|
142
|
+
updateBiometricToken: (token: string) => Promise<boolean>;
|
|
143
|
+
openSettings: () => void;
|
|
144
|
+
};
|
|
145
|
+
declare const location: {
|
|
146
|
+
init: () => Promise<void>;
|
|
147
|
+
getLocation: () => Promise<LocationData | null>;
|
|
148
|
+
openSettings: () => void;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export { addToHomeScreen, biometric, checkHomeScreenStatus, close, cloudStorage, deviceStorage, dialog, disableClosingConfirmation, disableVerticalSwipes, downloadFile, enableClosingConfirmation, enableVerticalSwipes, expand, fullscreen, getRawUserData, getTheme, getUserAvatarUrl, getUserDisplayName, getUserIdentifier, getUserInfoWithAvatar, getViewport, getWebApp, haptic, hideKeyboard, invokeCustomMethod, isInTelegram, isVersionAtLeast, location, openExternalLink, openInvoice, openTelegramLink, orientation, readClipboard, ready, requestChat, requestContact, requestEmojiStatusAccess, requestWriteAccess, safeInvoke, scanQr, secureStorage, setBackgroundColor, setBottomBarColor, setEmojiStatus, setHeaderColor, shareMessage, shareToStory, switchInlineQuery };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { P as PopupParams, D as DownloadFileParams, W as WebAppUser, C as ColorScheme, T as ThemeParams, a as WebApp, H as HapticFeedback, L as LocationData, S as ShareToStoryParams } from '../webapp-B-3_74nK.js';
|
|
2
|
+
import { E as EmojiStatusParams } from '../webapp-YvmwFYUQ.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Browser-native fallbacks for `@core-ease/telegram-kit`.
|
|
6
|
+
*
|
|
7
|
+
* Every wrapper in `core/index.ts` calls into the real bundled SDK first.
|
|
8
|
+
* When that isn't possible - the Mini App is opened in a plain browser tab,
|
|
9
|
+
* or the installed Telegram client is older than a feature needs - these
|
|
10
|
+
* helpers provide the closest standard Web API equivalent instead of
|
|
11
|
+
* rejecting the call or spamming the console with "not supported"
|
|
12
|
+
* warnings. Where no meaningful browser equivalent exists (biometrics,
|
|
13
|
+
* emoji status, Telegram-account actions, ...) the wrapper still resolves
|
|
14
|
+
* predictably (`false`/`null`/`[]`) instead of throwing.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** Swallows synchronous throws from fire-and-forget SDK calls (e.g. hard version gates). */
|
|
18
|
+
declare function safeInvoke(fn: () => void): void;
|
|
19
|
+
|
|
20
|
+
/** Returns the bundled SDK's `WebApp` instance directly (never reads `window.Telegram`). */
|
|
21
|
+
declare function getWebApp(): WebApp | null;
|
|
22
|
+
/**
|
|
23
|
+
* `true` once real Telegram init data has been observed - i.e. the Mini
|
|
24
|
+
* App was actually opened from inside Telegram, or `installDevMode()`
|
|
25
|
+
* seeded matching fake data for local testing.
|
|
26
|
+
*/
|
|
27
|
+
declare function isInTelegram(): boolean;
|
|
28
|
+
declare function isVersionAtLeast(version: string): boolean;
|
|
29
|
+
declare function getRawUserData(): WebAppUser | null;
|
|
30
|
+
declare function getUserDisplayName(user?: WebAppUser): string;
|
|
31
|
+
declare function getUserIdentifier(user?: WebAppUser): string;
|
|
32
|
+
declare function getUserAvatarUrl(user?: WebAppUser, fallback?: string): string;
|
|
33
|
+
declare function getUserInfoWithAvatar(): {
|
|
34
|
+
user: WebAppUser | undefined;
|
|
35
|
+
avatarUrl: string;
|
|
36
|
+
displayName: string;
|
|
37
|
+
identifier: string;
|
|
38
|
+
};
|
|
39
|
+
declare function openExternalLink(url: string, tryInstantView?: boolean): void;
|
|
40
|
+
declare function openTelegramLink(url: string): void;
|
|
41
|
+
/** No meaningful browser fallback exists for Telegram Payments; rejects clearly instead of hanging. */
|
|
42
|
+
declare function openInvoice(url: string): Promise<'paid' | 'cancelled' | 'failed' | 'pending'>;
|
|
43
|
+
declare function switchInlineQuery(query: string, chooseChatTypes?: Array<'users' | 'bots' | 'groups' | 'channels'>): void;
|
|
44
|
+
declare function hideKeyboard(): void;
|
|
45
|
+
declare function getTheme(): {
|
|
46
|
+
colorScheme: ColorScheme;
|
|
47
|
+
themeParams: ThemeParams;
|
|
48
|
+
};
|
|
49
|
+
declare function getViewport(): {
|
|
50
|
+
height: number;
|
|
51
|
+
stableHeight: number;
|
|
52
|
+
isExpanded: boolean;
|
|
53
|
+
};
|
|
54
|
+
declare function expand(): void;
|
|
55
|
+
declare function ready(): void;
|
|
56
|
+
declare function close(): void;
|
|
57
|
+
/** Fullscreen API fallback outside Telegram / older clients. */
|
|
58
|
+
declare const fullscreen: {
|
|
59
|
+
enter: () => Promise<boolean>;
|
|
60
|
+
exit: () => Promise<boolean>;
|
|
61
|
+
};
|
|
62
|
+
/** Screen Orientation API fallback outside Telegram / older clients. */
|
|
63
|
+
declare const orientation: {
|
|
64
|
+
lock: () => Promise<boolean>;
|
|
65
|
+
unlock: () => Promise<boolean>;
|
|
66
|
+
};
|
|
67
|
+
declare function enableClosingConfirmation(): void;
|
|
68
|
+
declare function disableClosingConfirmation(): void;
|
|
69
|
+
declare function enableVerticalSwipes(): void;
|
|
70
|
+
declare function disableVerticalSwipes(): void;
|
|
71
|
+
declare function setHeaderColor(color: string): void;
|
|
72
|
+
declare function setBackgroundColor(color: string): void;
|
|
73
|
+
declare function setBottomBarColor(color: string): void;
|
|
74
|
+
/** No meaningful browser equivalent (this adds a Telegram Mini App shortcut, specifically) - safely no-ops outside Telegram. */
|
|
75
|
+
declare function addToHomeScreen(): void;
|
|
76
|
+
declare function checkHomeScreenStatus(): Promise<'unsupported' | 'unknown' | 'added' | 'missed'>;
|
|
77
|
+
declare const haptic: {
|
|
78
|
+
light: () => void | HapticFeedback;
|
|
79
|
+
medium: () => void | HapticFeedback;
|
|
80
|
+
heavy: () => void | HapticFeedback;
|
|
81
|
+
rigid: () => void | HapticFeedback;
|
|
82
|
+
soft: () => void | HapticFeedback;
|
|
83
|
+
success: () => void | HapticFeedback;
|
|
84
|
+
warning: () => void | HapticFeedback;
|
|
85
|
+
error: () => void | HapticFeedback;
|
|
86
|
+
selection: () => void | HapticFeedback;
|
|
87
|
+
};
|
|
88
|
+
declare const cloudStorage: {
|
|
89
|
+
setItem: (key: string, value: string) => Promise<boolean>;
|
|
90
|
+
getItem: (key: string) => Promise<string | undefined>;
|
|
91
|
+
getItems: (keys: string[]) => Promise<Record<string, string>>;
|
|
92
|
+
removeItem: (key: string) => Promise<boolean>;
|
|
93
|
+
removeItems: (keys: string[]) => Promise<boolean>;
|
|
94
|
+
getKeys: () => Promise<string[]>;
|
|
95
|
+
};
|
|
96
|
+
declare const deviceStorage: {
|
|
97
|
+
setItem: (key: string, value: string) => Promise<boolean>;
|
|
98
|
+
getItem: (key: string) => Promise<string | undefined>;
|
|
99
|
+
removeItem: (key: string) => Promise<boolean>;
|
|
100
|
+
clear: () => Promise<boolean>;
|
|
101
|
+
};
|
|
102
|
+
declare const secureStorage: {
|
|
103
|
+
setItem: (key: string, value: string) => Promise<boolean>;
|
|
104
|
+
getItem: (key: string) => Promise<{
|
|
105
|
+
value: string | null | undefined;
|
|
106
|
+
canRestore: boolean;
|
|
107
|
+
}>;
|
|
108
|
+
removeItem: (key: string) => Promise<boolean>;
|
|
109
|
+
clear: () => Promise<boolean>;
|
|
110
|
+
restoreItem: (key: string) => Promise<string | undefined>;
|
|
111
|
+
};
|
|
112
|
+
declare const dialog: {
|
|
113
|
+
alert: (message: string) => Promise<void>;
|
|
114
|
+
confirm: (message: string) => Promise<boolean>;
|
|
115
|
+
popup: (params: PopupParams) => Promise<string | null>;
|
|
116
|
+
prompt: (message: string, defaultValue?: string) => Promise<string | null>;
|
|
117
|
+
};
|
|
118
|
+
declare function readClipboard(): Promise<string | null>;
|
|
119
|
+
declare function scanQr(text?: string): Promise<string | null>;
|
|
120
|
+
declare function shareToStory(mediaUrl: string, params?: ShareToStoryParams): void;
|
|
121
|
+
declare function shareMessage(msgId: string): Promise<boolean>;
|
|
122
|
+
declare function downloadFile(params: DownloadFileParams): Promise<boolean>;
|
|
123
|
+
declare function setEmojiStatus(customEmojiId: string, params?: EmojiStatusParams): Promise<boolean>;
|
|
124
|
+
declare function requestEmojiStatusAccess(): Promise<boolean>;
|
|
125
|
+
declare function requestWriteAccess(): Promise<boolean>;
|
|
126
|
+
declare function requestContact(): Promise<boolean>;
|
|
127
|
+
/**
|
|
128
|
+
* Opens Telegram's native chat-request dialog for a chat request you
|
|
129
|
+
* already created server-side, identified by `reqId`. Requires Bot API
|
|
130
|
+
* 9.6+. No browser fallback exists for this Telegram-account action.
|
|
131
|
+
*/
|
|
132
|
+
declare function requestChat(reqId: string): Promise<boolean>;
|
|
133
|
+
/** No fallback: this calls your own bot's server-side logic, which only exists via the real Telegram client. */
|
|
134
|
+
declare function invokeCustomMethod(method: string, params?: object): Promise<unknown>;
|
|
135
|
+
declare const biometric: {
|
|
136
|
+
init: () => Promise<void>;
|
|
137
|
+
requestAccess: (reason?: string) => Promise<boolean>;
|
|
138
|
+
authenticate: (reason?: string) => Promise<{
|
|
139
|
+
authenticated: boolean;
|
|
140
|
+
token?: string;
|
|
141
|
+
}>;
|
|
142
|
+
updateBiometricToken: (token: string) => Promise<boolean>;
|
|
143
|
+
openSettings: () => void;
|
|
144
|
+
};
|
|
145
|
+
declare const location: {
|
|
146
|
+
init: () => Promise<void>;
|
|
147
|
+
getLocation: () => Promise<LocationData | null>;
|
|
148
|
+
openSettings: () => void;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export { addToHomeScreen, biometric, checkHomeScreenStatus, close, cloudStorage, deviceStorage, dialog, disableClosingConfirmation, disableVerticalSwipes, downloadFile, enableClosingConfirmation, enableVerticalSwipes, expand, fullscreen, getRawUserData, getTheme, getUserAvatarUrl, getUserDisplayName, getUserIdentifier, getUserInfoWithAvatar, getViewport, getWebApp, haptic, hideKeyboard, invokeCustomMethod, isInTelegram, isVersionAtLeast, location, openExternalLink, openInvoice, openTelegramLink, orientation, readClipboard, ready, requestChat, requestContact, requestEmojiStatusAccess, requestWriteAccess, safeInvoke, scanQr, secureStorage, setBackgroundColor, setBottomBarColor, setEmojiStatus, setHeaderColor, shareMessage, shareToStory, switchInlineQuery };
|