@smartico/public-api 0.0.323 → 0.0.325
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/SmarticoAPI.d.ts +9 -1
- package/dist/WSAPI/WSAPI.d.ts +49 -0
- package/dist/WSAPI/WSAPITypes.d.ts +2 -0
- package/dist/index.js +85 -10
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +76 -1
- package/dist/index.modern.mjs.map +1 -1
- package/docs/classes/WSAPI.md +66 -0
- package/docs/interfaces/TMissionOrBadge.md +16 -0
- package/package.json +1 -1
- package/src/Missions/UserAchievement.ts +1 -0
- package/src/SmarticoAPI.ts +35 -0
- package/src/WSAPI/WSAPI.ts +62 -1
- package/src/WSAPI/WSAPITypes.ts +3 -0
package/docs/classes/WSAPI.md
CHANGED
|
@@ -920,6 +920,72 @@ Requests translations for the given language. Returns the object including trans
|
|
|
920
920
|
|
|
921
921
|
___
|
|
922
922
|
|
|
923
|
+
### reportImpressionEvent
|
|
924
|
+
|
|
925
|
+
▸ **reportImpressionEvent**(`«destructured»`): `void`
|
|
926
|
+
|
|
927
|
+
Reports an impression event for an engagement (when engagement content is displayed to the user).
|
|
928
|
+
Use this method to track when users view engagement content such as inbox messages, popups.
|
|
929
|
+
When using for Inbox cases, you need to use message guid as engagement_uid, and pass 31 as activityType.
|
|
930
|
+
|
|
931
|
+
**Example**:
|
|
932
|
+
```
|
|
933
|
+
_smartico.api.reportImpressionEvent({
|
|
934
|
+
engagement_uid: 'abc123-def456',
|
|
935
|
+
activityType: 31 // Inbox
|
|
936
|
+
});
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
**Visitor mode: not supported**
|
|
940
|
+
|
|
941
|
+
#### Parameters
|
|
942
|
+
|
|
943
|
+
| Name | Type |
|
|
944
|
+
| :------ | :------ |
|
|
945
|
+
| `«destructured»` | `Object` |
|
|
946
|
+
| › `engagement_uid` | `string` |
|
|
947
|
+
| › `activityType` | `number` |
|
|
948
|
+
|
|
949
|
+
#### Returns
|
|
950
|
+
|
|
951
|
+
`void`
|
|
952
|
+
|
|
953
|
+
___
|
|
954
|
+
|
|
955
|
+
### reportClickEvent
|
|
956
|
+
|
|
957
|
+
▸ **reportClickEvent**(`«destructured»`): `void`
|
|
958
|
+
|
|
959
|
+
Reports a click/action event for an engagement (when user interacts with engagement content).
|
|
960
|
+
Use this method to track when users click on or interact with engagement content such as inbox messages, popups.
|
|
961
|
+
When using for Inbox cases, you need to use message guid as engagement_uid, and pass 31 as activityType, and pass the action/deeplink that was triggered by the user interaction as action.
|
|
962
|
+
|
|
963
|
+
**Example**:
|
|
964
|
+
```
|
|
965
|
+
_smartico.api.reportClickEvent({
|
|
966
|
+
engagement_uid: 'abc123-def456',
|
|
967
|
+
activityType: 31 // Inbox,
|
|
968
|
+
action: 'dp:gf_missions'
|
|
969
|
+
});
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
**Visitor mode: not supported**
|
|
973
|
+
|
|
974
|
+
#### Parameters
|
|
975
|
+
|
|
976
|
+
| Name | Type |
|
|
977
|
+
| :------ | :------ |
|
|
978
|
+
| `«destructured»` | `Object` |
|
|
979
|
+
| › `engagement_uid` | `string` |
|
|
980
|
+
| › `activityType` | `number` |
|
|
981
|
+
| › `action?` | `string` |
|
|
982
|
+
|
|
983
|
+
#### Returns
|
|
984
|
+
|
|
985
|
+
`void`
|
|
986
|
+
|
|
987
|
+
___
|
|
988
|
+
|
|
923
989
|
### jackpotGet
|
|
924
990
|
|
|
925
991
|
▸ **jackpotGet**(`filter?`): `Promise`\<[`JackpotDetails`](../interfaces/JackpotDetails.md)[]\>
|
|
@@ -350,3 +350,19 @@ ___
|
|
|
350
350
|
• `Optional` **claim\_button\_action**: `string`
|
|
351
351
|
|
|
352
352
|
Action for the claim reward button
|
|
353
|
+
|
|
354
|
+
___
|
|
355
|
+
|
|
356
|
+
### badgeTimeLimitState
|
|
357
|
+
|
|
358
|
+
• `Optional` **badgeTimeLimitState**: `BadgesTimeLimitStates`
|
|
359
|
+
|
|
360
|
+
Badge time limit state for badges with time restrictions
|
|
361
|
+
|
|
362
|
+
___
|
|
363
|
+
|
|
364
|
+
### hide\_locked\_mission
|
|
365
|
+
|
|
366
|
+
• `Optional` **hide\_locked\_mission**: `boolean`
|
|
367
|
+
|
|
368
|
+
Flag from achievement if the mission should be hidden when it is locked, until it's unlocked
|
package/package.json
CHANGED
|
@@ -154,6 +154,7 @@ export const UserAchievementTransform = (items: UserAchievement[]): TMissionOrBa
|
|
|
154
154
|
claim_button_title: r.ach_public_meta.claim_button_title,
|
|
155
155
|
claim_button_action: r.ach_public_meta.claim_button_action,
|
|
156
156
|
badgeTimeLimitState: r.badgeTimeLimitState,
|
|
157
|
+
hide_locked_mission: r.ach_public_meta.hide_locked_mission,
|
|
157
158
|
};
|
|
158
159
|
|
|
159
160
|
if (r.ach_status_id === AchievementStatus.Recurring) {
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from './MiniGames';
|
|
20
20
|
import { ECacheContext, OCache } from './OCache';
|
|
21
21
|
import {
|
|
22
|
+
ActivityTypeLimited,
|
|
22
23
|
CoreUtils,
|
|
23
24
|
GetTranslationsRequest,
|
|
24
25
|
GetTranslationsResponse,
|
|
@@ -460,6 +461,40 @@ class SmarticoAPI {
|
|
|
460
461
|
return results.segments || [];
|
|
461
462
|
}
|
|
462
463
|
|
|
464
|
+
/**
|
|
465
|
+
* Reports an engagement impression event (when engagement content is displayed to the user).
|
|
466
|
+
*/
|
|
467
|
+
public reportEngagementImpression(
|
|
468
|
+
user_ext_id: string,
|
|
469
|
+
engagement_uid: string,
|
|
470
|
+
activityType: ActivityTypeLimited | number,
|
|
471
|
+
): void {
|
|
472
|
+
const message = this.buildMessage<any, any>(user_ext_id, ClassId.CLIENT_ENGAGEMENT_IMPRESSION_REQUEST, {
|
|
473
|
+
engagement_uid,
|
|
474
|
+
activityType,
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
this.send(message).catch(() => {});
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Reports an engagement action event (when user clicks/interacts with engagement content).
|
|
482
|
+
*/
|
|
483
|
+
public reportEngagementAction(
|
|
484
|
+
user_ext_id: string,
|
|
485
|
+
engagement_uid: string,
|
|
486
|
+
activityType: ActivityTypeLimited | number,
|
|
487
|
+
action?: string,
|
|
488
|
+
): void {
|
|
489
|
+
const message = this.buildMessage<any, any>(user_ext_id, ClassId.CLIENT_ENGAGEMENT_ACTION_REQUEST, {
|
|
490
|
+
engagement_uid,
|
|
491
|
+
activityType,
|
|
492
|
+
...(action && { action }),
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
this.send(message).catch(() => {});
|
|
496
|
+
}
|
|
497
|
+
|
|
463
498
|
public async jackpotGet(
|
|
464
499
|
user_ext_id: string,
|
|
465
500
|
filter?: { related_game_id?: string; jp_template_id?: number },
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClassId } from '../Base/ClassId';
|
|
2
|
-
import { CoreUtils } from '../Core';
|
|
2
|
+
import { ActivityTypeLimited, CoreUtils } from '../Core';
|
|
3
3
|
import {
|
|
4
4
|
SAWSpinsCountPush,
|
|
5
5
|
} from '../MiniGames';
|
|
@@ -945,6 +945,67 @@ export class WSAPI {
|
|
|
945
945
|
};
|
|
946
946
|
}
|
|
947
947
|
|
|
948
|
+
/**
|
|
949
|
+
* Reports an impression event for an engagement (when engagement content is displayed to the user).
|
|
950
|
+
* Use this method to track when users view engagement content such as inbox messages, popups.
|
|
951
|
+
* When using for Inbox cases, you need to use message guid as engagement_uid, and pass 31 as activityType.
|
|
952
|
+
*
|
|
953
|
+
* **Example**:
|
|
954
|
+
* ```
|
|
955
|
+
* _smartico.api.reportImpressionEvent({
|
|
956
|
+
* engagement_uid: 'abc123-def456',
|
|
957
|
+
* activityType: 31 // Inbox
|
|
958
|
+
* });
|
|
959
|
+
* ```
|
|
960
|
+
*
|
|
961
|
+
* **Visitor mode: not supported**
|
|
962
|
+
*
|
|
963
|
+
* @param params.engagement_uid - Unique identifier for the engagement
|
|
964
|
+
* @param params.activityType - Type of engagement activity (Popup=30, Inbox=31)
|
|
965
|
+
*/
|
|
966
|
+
public reportImpressionEvent({
|
|
967
|
+
engagement_uid,
|
|
968
|
+
activityType,
|
|
969
|
+
}: {
|
|
970
|
+
engagement_uid: string;
|
|
971
|
+
activityType: ActivityTypeLimited | number;
|
|
972
|
+
}): void {
|
|
973
|
+
this.api.reportEngagementImpression(null, engagement_uid, activityType);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Reports a click/action event for an engagement (when user interacts with engagement content).
|
|
978
|
+
* Use this method to track when users click on or interact with engagement content such as inbox messages, popups.
|
|
979
|
+
* When using for Inbox cases, you need to use message guid as engagement_uid, and pass 31 as activityType, and pass the action/deeplink that was triggered by the user interaction as action.
|
|
980
|
+
*
|
|
981
|
+
*
|
|
982
|
+
* **Example**:
|
|
983
|
+
* ```
|
|
984
|
+
* _smartico.api.reportClickEvent({
|
|
985
|
+
* engagement_uid: 'abc123-def456',
|
|
986
|
+
* activityType: 31 // Inbox,
|
|
987
|
+
* action: 'dp:gf_missions'
|
|
988
|
+
* });
|
|
989
|
+
* ```
|
|
990
|
+
*
|
|
991
|
+
* **Visitor mode: not supported**
|
|
992
|
+
*
|
|
993
|
+
* @param params.engagement_uid - Unique identifier for the engagement
|
|
994
|
+
* @param params.activityType - Type of engagement activity (Popup=30, Inbox=31)
|
|
995
|
+
* @param params.action - Optional action/deeplink that was triggered by the user interaction
|
|
996
|
+
*/
|
|
997
|
+
public reportClickEvent({
|
|
998
|
+
engagement_uid,
|
|
999
|
+
activityType,
|
|
1000
|
+
action,
|
|
1001
|
+
}: {
|
|
1002
|
+
engagement_uid: string;
|
|
1003
|
+
activityType: ActivityTypeLimited | number;
|
|
1004
|
+
action?: string;
|
|
1005
|
+
}): void {
|
|
1006
|
+
this.api.reportEngagementAction(null, engagement_uid, activityType, action);
|
|
1007
|
+
}
|
|
1008
|
+
|
|
948
1009
|
private async updateOnSpin(data: SAWSpinsCountPush) {
|
|
949
1010
|
const templates: TMiniGameTemplate[] = await OCache.use(
|
|
950
1011
|
onUpdateContextKey.Saw,
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -680,6 +680,9 @@ export interface TMissionOrBadge {
|
|
|
680
680
|
|
|
681
681
|
/** Badge time limit state for badges with time restrictions */
|
|
682
682
|
badgeTimeLimitState?: BadgesTimeLimitStates;
|
|
683
|
+
|
|
684
|
+
/** Flag from achievement if the mission should be hidden when it is locked, until it's unlocked */
|
|
685
|
+
hide_locked_mission?: boolean;
|
|
683
686
|
}
|
|
684
687
|
|
|
685
688
|
export interface AchRelatedGame {
|