@smartico/public-api 0.0.353 → 0.0.355
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/ActivityLog/PointChangeSourceType.d.ts +2 -1
- package/dist/SmarticoAPI.d.ts +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +13 -6
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/ActivityLog/PointChangeSourceType.ts +1 -0
- package/src/SmarticoAPI.ts +14 -6
package/package.json
CHANGED
package/src/SmarticoAPI.ts
CHANGED
|
@@ -150,7 +150,7 @@ const DEFAULT_LANG_EN = 'EN';
|
|
|
150
150
|
interface Tracker {
|
|
151
151
|
label_api_key: string;
|
|
152
152
|
userPublicProps: any;
|
|
153
|
-
params
|
|
153
|
+
params?: { brand_key?: string };
|
|
154
154
|
on: (callBackKey: ClassId, func: (data: any) => void) => void;
|
|
155
155
|
getLabelSetting: (key: PublicLabelSettings) => any;
|
|
156
156
|
triggerExternalCallBack: (callBackKey: string, payload: any) => void;
|
|
@@ -200,11 +200,14 @@ class SmarticoAPI {
|
|
|
200
200
|
this.publicUrl = SmarticoAPI.getPublicUrl(label_api_key);
|
|
201
201
|
this.wsUrl = SmarticoAPI.getPublicWsUrl(label_api_key);
|
|
202
202
|
|
|
203
|
-
this.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
203
|
+
if (this.tracker) {
|
|
204
|
+
// available only for real users
|
|
205
|
+
this.baseRgApiParams = {
|
|
206
|
+
env_id: String(SmarticoAPI.getEnvId(label_api_key)),
|
|
207
|
+
label_api_key: label_api_key,
|
|
208
|
+
brand_key: options.brand_api_key || this.tracker.params.brand_key,
|
|
209
|
+
hash: IntUtils.uuid(),
|
|
210
|
+
}
|
|
208
211
|
}
|
|
209
212
|
|
|
210
213
|
this.avatarDomain = SmarticoAPI.getAvatarUrl(label_api_key || options.tracker?.label_api_key);
|
|
@@ -1297,6 +1300,11 @@ class SmarticoAPI {
|
|
|
1297
1300
|
}
|
|
1298
1301
|
|
|
1299
1302
|
private async sendGamesApi<T>({ method, params, usePost = false }: { method: string, params: Record<string, any>, usePost?: boolean }): Promise<GamesApiResponse<T>> {
|
|
1303
|
+
|
|
1304
|
+
if (!this.tracker) {
|
|
1305
|
+
throw new Error(`MatchX and Quiz APIs are not available in the visitor mode`);
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1300
1308
|
const baseParams = this.buildGamesApiParams();
|
|
1301
1309
|
const queryString = Object.entries(baseParams).map(([k, v]) => `${k}=${encodeURIComponent(v)}`).join('&');
|
|
1302
1310
|
let url = `${GAMES_API_URL}/${method}?${queryString}`;
|