@smartico/public-api 0.0.53 → 0.0.55
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/Core/PublicLabelSettings.d.ts +0 -1
- package/dist/SmarticoAPI.d.ts +2 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +7 -5
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Core/PublicLabelSettings.ts +0 -2
- package/src/SmarticoAPI.ts +10 -4
|
@@ -27,8 +27,6 @@ export enum PublicLabelSettings {
|
|
|
27
27
|
AVATAR_CUSTOM_IMAGE_MAX_ID = "AVATAR_CUSTOM_IMAGE_MAX_ID",
|
|
28
28
|
AVATAR_CUSTOM_IMAGE_FOLDER = "AVATAR_CUSTOM_IMAGE_FOLDER",
|
|
29
29
|
|
|
30
|
-
RETENTION_GAMES_CUSTOMER_ID = "RETENTION_GAMES_CUSTOMER_ID",
|
|
31
|
-
|
|
32
30
|
GAMIFICATION_SHOW_POWERED_BY = "GAMIFICATION_SHOW_POWERED_BY",
|
|
33
31
|
_system_leader_board_mask_username = "_system_leader_board_mask_username",
|
|
34
32
|
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -71,7 +71,7 @@ class SmarticoAPI {
|
|
|
71
71
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
public static
|
|
74
|
+
public static getEnvDnsSuffix(label_api_key: string): string {
|
|
75
75
|
|
|
76
76
|
let ENV_ID = label_api_key.length === 38 ? label_api_key.substring(37, 38) : '';
|
|
77
77
|
|
|
@@ -81,20 +81,26 @@ class SmarticoAPI {
|
|
|
81
81
|
return ENV_ID;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
public static getEnvId(label_api_key: string): number {
|
|
85
|
+
|
|
86
|
+
return label_api_key.length === 38 ? parseInt(label_api_key.substring(37, 38), 10) : 2;
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
84
90
|
public static getCleanLabelApiKey(label_api_key: string): string {
|
|
85
91
|
return label_api_key.substring(0, 36);
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
public static getPublicUrl(label_api_key: string): string {
|
|
89
|
-
return PUBLIC_API_URL.replace('{ENV_ID}', SmarticoAPI.
|
|
95
|
+
return PUBLIC_API_URL.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
public static getPublicWsUrl(label_api_key: string): string {
|
|
93
|
-
return C_SOCKET_PROD.replace('{ENV_ID}', SmarticoAPI.
|
|
99
|
+
return C_SOCKET_PROD.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
public static getAvatarUrl(label_api_key: string): string {
|
|
97
|
-
return AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.
|
|
103
|
+
return AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
98
104
|
}
|
|
99
105
|
|
|
100
106
|
private async send<T>(message: any, expectCID?: ClassId): Promise<T> {
|