hm-tracking-sdk 0.1.8 → 0.1.9
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/README.md +35 -11
- package/dist/browser/index.es.js +27 -27
- package/dist/browser/index.umd.js +36 -36
- package/dist/sdk/telegram.js +28 -28
- package/dist/sdk/telegram.js.map +1 -1
- package/dist/sdk/types.d.ts +13 -6
- package/dist/sdk/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,12 +36,13 @@
|
|
|
36
36
|
customUser: {
|
|
37
37
|
user: {
|
|
38
38
|
id: 123456789,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
first_name: "Test",
|
|
40
|
+
last_name: "User",
|
|
41
41
|
username: "test_user",
|
|
42
|
-
|
|
42
|
+
language_code: "zh-hans",
|
|
43
|
+
photo_url: "https://t.me/i/userpic/320/example.svg",
|
|
43
44
|
},
|
|
44
|
-
|
|
45
|
+
auth_date: Math.floor(Date.now() / 1000),
|
|
45
46
|
hash: "your_hash_value",
|
|
46
47
|
},
|
|
47
48
|
};
|
|
@@ -95,7 +96,23 @@
|
|
|
95
96
|
- JSON 示例:
|
|
96
97
|
|
|
97
98
|
```json
|
|
98
|
-
{
|
|
99
|
+
{
|
|
100
|
+
"user": {
|
|
101
|
+
"id": 7506466780,
|
|
102
|
+
"first_name": "first",
|
|
103
|
+
"last_name": "name",
|
|
104
|
+
"username": "nickname1992",
|
|
105
|
+
"language_code": "zh",
|
|
106
|
+
"allows_write_to_pm": true,
|
|
107
|
+
"is_premium": false,
|
|
108
|
+
"photo_url": "https://t.me/i/userpic/320/uLzA4KyVzKwd0vi6Uvupe6U2mdnVEQOIbUZbFTQff6B3UhjRpQObL9I8Nq81G0ln.svg"
|
|
109
|
+
},
|
|
110
|
+
"auth_date": 1735792133,
|
|
111
|
+
"hash": "a9d2d7c1b066bebb73c170006dc474061d7601183b388b037936aa7cb6620acf",
|
|
112
|
+
"chat_instance": "-2254244616056098321",
|
|
113
|
+
"chat_type": "sender",
|
|
114
|
+
"start_param": "..."
|
|
115
|
+
}
|
|
99
116
|
```
|
|
100
117
|
|
|
101
118
|
- 若为加密字符串:请与服务端约定解密方式及签名校验流程。
|
|
@@ -145,14 +162,21 @@
|
|
|
145
162
|
|
|
146
163
|
```ts
|
|
147
164
|
export interface TelegramUserInfo {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
165
|
+
user: {
|
|
166
|
+
id: number;
|
|
167
|
+
first_name?: string;
|
|
168
|
+
last_name?: string;
|
|
169
|
+
username?: string;
|
|
170
|
+
photo_url?: string;
|
|
171
|
+
language_code?: string;
|
|
172
|
+
allows_write_to_pm?: boolean;
|
|
173
|
+
is_premium?: boolean;
|
|
174
|
+
};
|
|
154
175
|
auth_date?: number;
|
|
155
176
|
hash?: string;
|
|
177
|
+
start_param?: string;
|
|
178
|
+
chat_type?: string;
|
|
179
|
+
chat_instance?: string;
|
|
156
180
|
[key: string]: unknown;
|
|
157
181
|
}
|
|
158
182
|
```
|
package/dist/browser/index.es.js
CHANGED
|
@@ -4374,18 +4374,19 @@ function getTelegramUserUnsafe() {
|
|
|
4374
4374
|
return !r.user || !r.user.id ? null : {
|
|
4375
4375
|
user: {
|
|
4376
4376
|
id: r.user.id,
|
|
4377
|
-
|
|
4378
|
-
|
|
4377
|
+
first_name: r.user.first_name || "",
|
|
4378
|
+
last_name: r.user.last_name || "",
|
|
4379
4379
|
username: r.user.username,
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4380
|
+
photo_url: r.user.photo_url,
|
|
4381
|
+
language_code: r.user.language_code,
|
|
4382
|
+
allows_write_to_pm: r.user.allows_write_to_pm || !1,
|
|
4383
|
+
is_premium: r.user.is_premium || !1
|
|
4383
4384
|
},
|
|
4384
|
-
|
|
4385
|
+
auth_date: r.auth_date,
|
|
4385
4386
|
hash: r.hash || "",
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4387
|
+
start_param: r.start_param,
|
|
4388
|
+
chat_type: r.chat_type,
|
|
4389
|
+
chat_instance: r.chat_instance
|
|
4389
4390
|
};
|
|
4390
4391
|
} catch {
|
|
4391
4392
|
return null;
|
|
@@ -4425,36 +4426,35 @@ function getAnonymousBrowserUser(r = "tg_tracking_uid") {
|
|
|
4425
4426
|
return {
|
|
4426
4427
|
user: {
|
|
4427
4428
|
id: d,
|
|
4428
|
-
|
|
4429
|
-
|
|
4429
|
+
first_name: "Guest",
|
|
4430
|
+
last_name: "",
|
|
4430
4431
|
username: `guest_${f.slice(-6)}`,
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
allowsWriteToPm: !1
|
|
4432
|
+
language_code: m.toLowerCase(),
|
|
4433
|
+
allows_write_to_pm: !1
|
|
4434
4434
|
},
|
|
4435
|
-
|
|
4435
|
+
auth_date: Math.floor(Date.now() / 1e3),
|
|
4436
4436
|
hash: "anonymous_cookie_user",
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4437
|
+
start_param: "browser_guest",
|
|
4438
|
+
chat_type: "sender",
|
|
4439
|
+
chat_instance: ""
|
|
4440
4440
|
};
|
|
4441
4441
|
}
|
|
4442
4442
|
function getDefaultMockUser() {
|
|
4443
4443
|
return {
|
|
4444
4444
|
user: {
|
|
4445
4445
|
id: 2077220643,
|
|
4446
|
-
|
|
4447
|
-
|
|
4446
|
+
first_name: "Mock",
|
|
4447
|
+
last_name: "User",
|
|
4448
4448
|
username: "mock_user_demo",
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4449
|
+
language_code: "zh-hans",
|
|
4450
|
+
allows_write_to_pm: !0,
|
|
4451
|
+
is_premium: !0
|
|
4452
4452
|
},
|
|
4453
|
-
|
|
4453
|
+
auth_date: Math.floor(Date.now() / 1e3),
|
|
4454
4454
|
hash: "mock_hash_for_demo_purpose",
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4455
|
+
start_param: "demo_start_param",
|
|
4456
|
+
chat_type: "sender",
|
|
4457
|
+
chat_instance: "-245769840322609948"
|
|
4458
4458
|
};
|
|
4459
4459
|
}
|
|
4460
4460
|
var naclUtil$1 = { exports: {} }, naclUtil = naclUtil$1.exports, hasRequiredNaclUtil;
|