@smartico/public-api 0.0.244 → 0.0.246
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/Quiz/MarketsAnswersType.d.ts +22 -0
- package/dist/Raffle/GetDrawResponse.d.ts +5 -0
- package/dist/Raffle/RafflePrizeWinner.d.ts +1 -1
- package/dist/SmarticoAPI.d.ts +2 -1
- package/dist/SmarticoPublicAPI.d.ts +23 -0
- package/dist/Store/BuyShopItemErrorCode.d.ts +10 -0
- package/dist/Store/BuyShopItemRequest.d.ts +4 -0
- package/dist/Store/BuyShopItemResponse.d.ts +4 -0
- package/dist/Store/GetCategoriesShopResponse.d.ts +5 -0
- package/dist/Store/GetShopItemsResponse.d.ts +5 -0
- package/dist/Store/ShopCategory.d.ts +5 -0
- package/dist/Store/ShopCategoryPublicMeta.d.ts +4 -0
- package/dist/Store/ShopItem.d.ts +9 -0
- package/dist/Store/ShopItemPublicMeta.d.ts +10 -0
- package/dist/Store/ShopItemType.d.ts +4 -0
- package/dist/Store/StorItemPruchased.d.ts +6 -0
- package/dist/Store/StoreItemPublicMeta.d.ts +2 -0
- package/dist/Store/StoreItemPurchaseType.d.ts +5 -0
- package/dist/Store/index.d.ts +1 -0
- package/dist/WSAPI/WSAPI.d.ts +2 -1
- package/dist/WSAPI/WSAPITypes.d.ts +2 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +37 -1
- package/dist/index.modern.mjs.map +1 -1
- package/dist/service/index.d.ts +5 -0
- package/dist/service/types/ErrorCodes.d.ts +13 -0
- package/dist/service/types/GRequest.d.ts +16 -0
- package/dist/service/types/GResponse.d.ts +10 -0
- package/dist/service/types/Game/GameAttemptType.d.ts +6 -0
- package/dist/service/types/Game/GameCanPlayType.d.ts +10 -0
- package/dist/service/types/Game/GameExternalStatus.d.ts +6 -0
- package/dist/service/types/Game/GameInfo.d.ts +9 -0
- package/dist/service/types/Game/GamePick.d.ts +90 -0
- package/dist/service/types/Game/GameUtil.d.ts +7 -0
- package/dist/service/types/SmarticoProto/GetTranslationsRequest.d.ts +7 -0
- package/dist/service/types/SmarticoProto/GetTranslationsResponse.d.ts +7 -0
- package/dist/service/types/SmarticoProto/ProtocolMessage.d.ts +5 -0
- package/dist/service/types/SmarticoProto/ProtocolRequest.d.ts +6 -0
- package/dist/service/types/SmarticoProto/ProtocolResponse.d.ts +5 -0
- package/dist/service/types/SmarticoProto/PublicLabelInfo.d.ts +34 -0
- package/dist/service/types/SmarticoProto/PublicProperties.d.ts +11 -0
- package/dist/service/types/SmarticoProto/ResponseIdentify.d.ts +12 -0
- package/dist/service/types/SmarticoProto/SAW/SAWAcknowledgeType.d.ts +5 -0
- package/dist/service/types/SmarticoProto/SAW/SAWBuyInType.d.ts +5 -0
- package/dist/service/types/SmarticoProto/SAW/SAWDoSpinRequest.d.ts +5 -0
- package/dist/service/types/SmarticoProto/SAW/SAWDoSpinResponse.d.ts +15 -0
- package/dist/service/types/SmarticoProto/SAW/SAWGameType.d.ts +10 -0
- package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.d.ts +3 -0
- package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.d.ts +5 -0
- package/dist/service/types/SmarticoProto/SAW/SAWPrize.d.ts +11 -0
- package/dist/service/types/SmarticoProto/SAW/SAWPrizeType.d.ts +8 -0
- package/dist/service/types/SmarticoProto/SAW/SAWPrizeUI.d.ts +13 -0
- package/dist/service/types/SmarticoProto/SAW/SAWTemplate.d.ts +21 -0
- package/dist/service/types/SmarticoProto/SAW/SAWTemplateUI.d.ts +31 -0
- package/dist/service/types/SmarticoProto/SAW/SAWWinSoundType.d.ts +12 -0
- package/dist/service/types/SmarticoProto/TranslationArea.d.ts +9 -0
- package/dist/service/types/User/UserInfo.d.ts +10 -0
- package/dist/util/Util.d.ts +51 -0
- package/docs/classes/WSAPI.md +17 -1
- package/docs/interfaces/RafflePrizeWinner.md +2 -2
- package/docs/interfaces/TStoreItem.md +8 -0
- package/package.json +1 -1
- package/src/Raffle/RafflePrizeWinner.ts +1 -1
- package/src/SmarticoAPI.ts +11 -1
- package/src/Store/StoreItem.ts +15 -0
- package/src/Store/StoreItemPublicMeta.ts +3 -0
- package/src/Store/StoreItemPurchaseType.ts +5 -0
- package/src/Store/StoreItemPurchased.ts +14 -0
- package/src/Store/index.ts +1 -0
- package/src/WSAPI/WSAPI.ts +24 -11
- package/src/WSAPI/WSAPITypes.ts +2 -0
package/src/Store/StoreItem.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IntUtils } from '../IntUtils';
|
|
2
2
|
import { TStoreItem } from '../WSAPI/WSAPITypes';
|
|
3
3
|
import { StoreItemPublicMeta } from './StoreItemPublicMeta';
|
|
4
|
+
import { StoreItemPurchaseType } from './StoreItemPurchaseType';
|
|
4
5
|
import { StoreItemType, StoreItemTypeNamed } from './StoreItemType';
|
|
5
6
|
|
|
6
7
|
export interface StoreItem {
|
|
@@ -12,13 +13,27 @@ export interface StoreItem {
|
|
|
12
13
|
shopPool: number;
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
const mapPurchaseType = (purchaseType: StoreItemPurchaseType) => {
|
|
17
|
+
if (purchaseType === StoreItemPurchaseType.Points) {
|
|
18
|
+
return 'points';
|
|
19
|
+
} else if (purchaseType === StoreItemPurchaseType.Gems) {
|
|
20
|
+
return 'gems';
|
|
21
|
+
} else if (purchaseType === StoreItemPurchaseType.Diamonds) {
|
|
22
|
+
return 'diamonds';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return 'points';
|
|
26
|
+
};
|
|
27
|
+
|
|
15
28
|
export const StoreItemTransform = (items: StoreItem[]): TStoreItem[] => {
|
|
29
|
+
|
|
16
30
|
return items
|
|
17
31
|
.filter((r) => r.id >= 1)
|
|
18
32
|
.map((r) => {
|
|
19
33
|
const x: TStoreItem = {
|
|
20
34
|
id: r.id,
|
|
21
35
|
name: r.itemPublicMeta.name,
|
|
36
|
+
purchase_type: mapPurchaseType(r.itemPublicMeta.purchase_type),
|
|
22
37
|
price: r.itemPublicMeta.price as any as number, // AA: strange why it's string
|
|
23
38
|
image: r.itemPublicMeta.image_url,
|
|
24
39
|
description: r.itemPublicMeta.description,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IntUtils } from '../IntUtils';
|
|
2
2
|
import { TStoreItem } from '../WSAPI/WSAPITypes';
|
|
3
3
|
import { StoreItem } from './StoreItem';
|
|
4
|
+
import { StoreItemPurchaseType } from './StoreItemPurchaseType';
|
|
4
5
|
import { StoreItemTypeNamed } from './StoreItemType';
|
|
5
6
|
|
|
6
7
|
interface StoreItemPurchased extends StoreItem {
|
|
@@ -11,6 +12,18 @@ interface StoreItemPurchased extends StoreItem {
|
|
|
11
12
|
purchased_this_month?: boolean;
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
const mapPurchaseType = (purchaseType: StoreItemPurchaseType) => {
|
|
16
|
+
if (purchaseType === StoreItemPurchaseType.Points) {
|
|
17
|
+
return 'points';
|
|
18
|
+
} else if (purchaseType === StoreItemPurchaseType.Gems) {
|
|
19
|
+
return 'gems';
|
|
20
|
+
} else if (purchaseType === StoreItemPurchaseType.Diamonds) {
|
|
21
|
+
return 'diamonds';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return 'points';
|
|
25
|
+
};
|
|
26
|
+
|
|
14
27
|
export const StoreItemPurchasedTransform = (items: StoreItemPurchased[]): TStoreItem[] => {
|
|
15
28
|
return items
|
|
16
29
|
.filter((r) => r.id >= 1)
|
|
@@ -23,6 +36,7 @@ export const StoreItemPurchasedTransform = (items: StoreItemPurchased[]): TStore
|
|
|
23
36
|
id: r.id,
|
|
24
37
|
name: r.itemPublicMeta.name,
|
|
25
38
|
price: r.itemPublicMeta.price as any as number, // AA: strange why it's string
|
|
39
|
+
purchase_type: mapPurchaseType(r.itemPublicMeta.purchase_type),
|
|
26
40
|
image: r.itemPublicMeta.image_url,
|
|
27
41
|
description: r.itemPublicMeta.description,
|
|
28
42
|
ribbon: r.itemPublicMeta.label_tag === 'custom' ? r.itemPublicMeta.custom_label_tag : r.itemPublicMeta.label_tag,
|
package/src/Store/index.ts
CHANGED
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -53,7 +53,14 @@ import { GetAchievementMapResponse } from '../Missions';
|
|
|
53
53
|
import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
|
|
54
54
|
import { GetRafflesResponse } from '../Raffle/GetRafflesResponse';
|
|
55
55
|
import { InboxCategories } from '../Inbox/InboxCategories';
|
|
56
|
-
import {
|
|
56
|
+
import {
|
|
57
|
+
GetDrawRunRequest,
|
|
58
|
+
GetDrawRunResponse,
|
|
59
|
+
GetRaffleDrawRunsHistoryRequest,
|
|
60
|
+
GetRaffleDrawRunsHistoryResponse,
|
|
61
|
+
RaffleClaimPrizeRequest,
|
|
62
|
+
RaffleClaimPrizeResponse,
|
|
63
|
+
} from '../Raffle';
|
|
57
64
|
import { IntUtils } from '../IntUtils';
|
|
58
65
|
|
|
59
66
|
/** @hidden */
|
|
@@ -558,9 +565,8 @@ export class WSAPI {
|
|
|
558
565
|
return o;
|
|
559
566
|
}
|
|
560
567
|
|
|
561
|
-
|
|
562
568
|
/**
|
|
563
|
-
* Sends the acknowledge request with specific client_request_id from minigame history in order to claim prize
|
|
569
|
+
* Sends the acknowledge request with specific client_request_id from minigame history in order to claim prize
|
|
564
570
|
* **Example**:
|
|
565
571
|
* ```
|
|
566
572
|
* _smartico.api.miniGameWinAcknowledgeRequest('2a189322-31bb-4119-b943-bx7868ff8dc3').then((result) => {
|
|
@@ -568,7 +574,7 @@ export class WSAPI {
|
|
|
568
574
|
* });
|
|
569
575
|
* ```
|
|
570
576
|
*/
|
|
571
|
-
|
|
577
|
+
public async miniGameWinAcknowledgeRequest(request_id: string) {
|
|
572
578
|
return this.api.doAcknowledgeRequest(null, request_id);
|
|
573
579
|
}
|
|
574
580
|
|
|
@@ -763,9 +769,13 @@ export class WSAPI {
|
|
|
763
769
|
onlyFavorite,
|
|
764
770
|
categoryId,
|
|
765
771
|
onUpdate,
|
|
766
|
-
}: {
|
|
767
|
-
|
|
768
|
-
|
|
772
|
+
}: {
|
|
773
|
+
from?: number;
|
|
774
|
+
to?: number;
|
|
775
|
+
onlyFavorite?: boolean;
|
|
776
|
+
categoryId?: InboxCategories;
|
|
777
|
+
onUpdate?: (data: TInboxMessage[]) => void;
|
|
778
|
+
} = {}): Promise<TInboxMessage[]> {
|
|
769
779
|
if (onUpdate) {
|
|
770
780
|
this.onUpdateCallback.set(onUpdateContextKey.InboxMessages, onUpdate);
|
|
771
781
|
}
|
|
@@ -1053,16 +1063,19 @@ export class WSAPI {
|
|
|
1053
1063
|
return result;
|
|
1054
1064
|
}
|
|
1055
1065
|
|
|
1056
|
-
|
|
1057
1066
|
public async getRaffles(): Promise<GetRafflesResponse> {
|
|
1058
1067
|
return await this.api.getRaffles(null);
|
|
1059
1068
|
}
|
|
1060
1069
|
|
|
1061
|
-
public async getDrawRun(payload: GetDrawRunRequest): Promise<GetDrawRunResponse>{
|
|
1070
|
+
public async getDrawRun(payload: GetDrawRunRequest): Promise<GetDrawRunResponse> {
|
|
1062
1071
|
return await this.api.getDrawRun(null, payload);
|
|
1063
1072
|
}
|
|
1064
|
-
|
|
1065
|
-
public async getRaffleDrawRunsHistory(payload: GetRaffleDrawRunsHistoryRequest): Promise<GetRaffleDrawRunsHistoryResponse>{
|
|
1073
|
+
|
|
1074
|
+
public async getRaffleDrawRunsHistory(payload: GetRaffleDrawRunsHistoryRequest): Promise<GetRaffleDrawRunsHistoryResponse> {
|
|
1066
1075
|
return await this.api.getRaffleDrawRunsHistory(null, payload);
|
|
1067
1076
|
}
|
|
1077
|
+
|
|
1078
|
+
public async claimRafflePrize(payload: RaffleClaimPrizeRequest): Promise<RaffleClaimPrizeResponse> {
|
|
1079
|
+
return await this.api.claimRafflePrize(null, payload);
|
|
1080
|
+
}
|
|
1068
1081
|
}
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -470,6 +470,8 @@ export interface TStoreItem {
|
|
|
470
470
|
purchased_this_week?: boolean;
|
|
471
471
|
/** Flag for store item indicating that it was purchased this month */
|
|
472
472
|
purchased_this_month?: boolean;
|
|
473
|
+
/** The type of the purchase */
|
|
474
|
+
purchase_type: 'points' | 'gems' | 'diamonds';
|
|
473
475
|
}
|
|
474
476
|
|
|
475
477
|
/**
|