@alfabit/keycloak 0.0.33 → 0.0.34
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfabit/keycloak",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.34",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"main": "src/index.ts",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@alfabit/constants": "^0.0.21",
|
|
24
|
+
"@alfabit/analitics": "^0.0.18",
|
|
24
25
|
"@intlify/unplugin-vue-i18n": "^6.0.8",
|
|
25
26
|
"@tanstack/vue-query": "^5.72.0",
|
|
26
27
|
"@types/lodash-es": "^4.17.12",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { REF_KEY, WALLET_API_HOST } from '@alfabit/constants';
|
|
2
2
|
import { getToken } from '../../../composables';
|
|
3
|
+
import { useAnalytics } from '@alfabit/analitics';
|
|
3
4
|
|
|
4
5
|
export const postWebLogin = async () => {
|
|
5
6
|
if (typeof window === 'undefined') return;
|
|
@@ -11,13 +12,27 @@ export const postWebLogin = async () => {
|
|
|
11
12
|
const token = getToken();
|
|
12
13
|
if(token) headers['Authorization'] = `Bearer ${token}`;
|
|
13
14
|
|
|
15
|
+
let url = `${WALLET_API_HOST}/public/web/login/`;
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
const analytics = useAnalytics();
|
|
19
|
+
const clientID = await analytics.getClientID();
|
|
20
|
+
if (clientID) {
|
|
21
|
+
const urlObj = new URL(url);
|
|
22
|
+
urlObj.searchParams.set('ym_client_id', clientID);
|
|
23
|
+
url = urlObj.toString();
|
|
24
|
+
}
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.warn('Failed to get analytics clientID:', error);
|
|
27
|
+
}
|
|
28
|
+
|
|
14
29
|
const params: RequestInit = {
|
|
15
30
|
method: "POST",
|
|
16
31
|
headers,
|
|
17
32
|
body: JSON.stringify({ referral_token })
|
|
18
33
|
}
|
|
19
34
|
|
|
20
|
-
const res = await fetch(
|
|
35
|
+
const res = await fetch(url, params);
|
|
21
36
|
|
|
22
37
|
if (!res.ok) {
|
|
23
38
|
throw new Error(`postWebLogin /public/web/login/: HTTP error: ${res.status}`);
|