Skip to content

Commit ab299a2

Browse files
authored
Zalo integration in UAParser (#1) (#792)
1 parent 3fe137e commit ab299a2

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

src/enums/ua-parser-enums.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export const Browser: Readonly<{
154154
WHALE: "Whale";
155155
WOLVIC: "Wolvic";
156156
YANDEX: "Yandex";
157+
ZALO: "Zalo";
157158
}>;
158159
export const BrowserType: Readonly<{
159160
CRAWLER: "crawler";

src/enums/ua-parser-enums.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ const Browser = Object.freeze({
158158
WEIBO: 'Weibo',
159159
WHALE: 'Whale',
160160
WOLVIC: 'Wolvic',
161-
YANDEX: 'Yandex'
161+
YANDEX: 'Yandex',
162+
ZALO: 'Zalo'
162163

163164
// TODO : test!
164165
});

src/main/ua-parser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@
455455
], [VERSION, [NAME, 'TikTok'], [TYPE, INAPP]], [
456456
/\[(linkedin)app\]/i // LinkedIn App for iOS & Android
457457
], [NAME, [TYPE, INAPP]], [
458+
/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i // Zalo
459+
], [[NAME, /(.+)/, 'Zalo'], VERSION, [TYPE, INAPP]], [
458460

459461
/(chromium)[\/ ]([-\w\.]+)/i // Chromium
460462
], [NAME, VERSION], [

test/data/ua/browser/browser-all.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2695,5 +2695,27 @@
26952695
"major" : "10",
26962696
"type" : "inapp"
26972697
}
2698+
},
2699+
{
2700+
"desc" : "Zalo on iOS",
2701+
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Zalo/20.05.01 Mobile/15E148",
2702+
"expect" :
2703+
{
2704+
"name" : "Zalo",
2705+
"version" : "20.05.01",
2706+
"major" : "20",
2707+
"type" : "inapp"
2708+
}
2709+
},
2710+
{
2711+
"desc" : "Zalo on Android",
2712+
"ua" : "Mozilla/5.0 (Linux; Android 10; Vsmart Live Build/QKQ1.190918.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 Mobile Safari/537.36 Zalo/20.04.02.r1",
2713+
"expect" :
2714+
{
2715+
"name" : "Zalo",
2716+
"version" : "20.04.02.r1",
2717+
"major" : "20",
2718+
"type" : "inapp"
2719+
}
26982720
}
26992721
]

0 commit comments

Comments
 (0)