fansunited-sdk-esm 1.3.3 → 1.4.0

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.
Files changed (50) hide show
  1. package/Core/Configurator/Enums/ValidationMessageEnum.d.ts +2 -2
  2. package/Core/Configurator/Models/SDKConfiguraitonModel.d.ts +4 -6
  3. package/Core/Configurator/Types/ConfiguratorTypes.d.ts +3 -0
  4. package/Core/Exception/FansUnitedSdkException.d.ts +1 -1
  5. package/Core/Global/Constants/Constants.d.ts +3 -0
  6. package/Core/Global/Constants/TestConstants.d.ts +148 -0
  7. package/Core/Global/Interfaces/GlobalInterfaces.d.ts +3 -0
  8. package/Core/Global/LocalStorage.d.ts +7 -0
  9. package/Core/Global/Messages/Messages.d.ts +11 -0
  10. package/Core/Global/SDKIdsRemapper.d.ts +40 -0
  11. package/Core/Global/Types/GlobalTypes.d.ts +13 -0
  12. package/Core/Https/ActivityHttps.d.ts +1 -1
  13. package/Core/Https/ClientHttps.d.ts +1 -1
  14. package/Core/Https/LoyaltyHttps.d.ts +4 -0
  15. package/Core/Https/PredictorHttps.d.ts +1 -0
  16. package/Core/Namespaces/Activity/Remapper/ActivityRemapper.d.ts +2 -0
  17. package/Core/Namespaces/Activity/Service/ActivityService.d.ts +2 -2
  18. package/Core/Namespaces/Football/Models/Player/PlayerMarketResultModel.d.ts +6 -0
  19. package/Core/Namespaces/Loyalty/Facade/LoyaltyFacade.d.ts +9 -2
  20. package/Core/Namespaces/Loyalty/Loyalty.d.ts +6 -1
  21. package/Core/Namespaces/Loyalty/Models/Filters/LoyaltyFilters.d.ts +5 -4
  22. package/Core/Namespaces/Loyalty/Models/Filters/RankingsFilters.d.ts +11 -0
  23. package/Core/Namespaces/Loyalty/Models/Leaderboard/LeaderboardRemapper.d.ts +3 -4
  24. package/Core/Namespaces/Loyalty/Models/Rankings/RankingsModel.d.ts +6 -0
  25. package/Core/Namespaces/Loyalty/Models/Rankings/RankingsRemapper.d.ts +6 -0
  26. package/Core/Namespaces/Loyalty/Service/LoyaltyService.d.ts +2 -0
  27. package/Core/Namespaces/Loyalty/Types/LoyaltyTypes.d.ts +2 -0
  28. package/Core/Namespaces/MatchQuiz/Facade/MatchQuizFacade.d.ts +3 -2
  29. package/Core/Namespaces/MatchQuiz/MatchQuiz.d.ts +3 -1
  30. package/Core/Namespaces/MatchQuiz/Models/GameMarketsResults/GameMarketsResults.d.ts +14 -0
  31. package/Core/Namespaces/Predictor/Enums/MarketEnum.d.ts +1 -0
  32. package/Core/Namespaces/Predictor/Enums/StatusEnum.d.ts +1 -1
  33. package/Core/Namespaces/Predictor/Facade/PredictorFacade.d.ts +6 -3
  34. package/Core/Namespaces/Predictor/Models/Predictions/PredictionsFilters.d.ts +1 -0
  35. package/Core/Namespaces/Predictor/Predictor.d.ts +5 -3
  36. package/Core/Namespaces/Predictor/Service/PredictorService.d.ts +12 -6
  37. package/Core/Namespaces/Profile/Builders/OwnProfileBuilder.d.ts +3 -1
  38. package/Core/Namespaces/Profile/Builders/ProfileBuilder.d.ts +4 -2
  39. package/Core/Namespaces/Profile/Models/Stats/ProfileStatsModel.d.ts +2 -0
  40. package/Core/Namespaces/Profile/Models/Stats/SuccessRatePercent.d.ts +3 -0
  41. package/Core/Namespaces/Profile/Models/Stats/SuccessRates.d.ts +7 -0
  42. package/Core/Namespaces/Profile/Profile.d.ts +1 -0
  43. package/Core/Namespaces/TopX/Facade/TopXFacade.d.ts +4 -1
  44. package/Core/Namespaces/TopX/Models/Games/GamesRemapper.d.ts +6 -0
  45. package/Core/Namespaces/TopX/TopX.d.ts +3 -1
  46. package/index.js +17 -15
  47. package/index.js.map +3 -3
  48. package/package.json +1 -1
  49. package/Core/Exception/ErrorMessages.d.ts +0 -3
  50. package/Core/Global/BulkBuilder.d.ts +0 -3
@@ -1,6 +1,6 @@
1
1
  export declare enum ValidationMessageEnum {
2
- API_KEY = "The field apiKey with valid value must be provided to use this SDK",
3
- CLIENT_ID = "The field clientId must be provided to use this SDK",
2
+ API_KEY = "The field apiKey with valid value must be provided to use Fans United JS SDK",
3
+ CLIENT_ID = "The field clientId must be provided to use Fans United JS SDK",
4
4
  LANG_MISSING = "If no lang is passed the default one will be set which is: EN",
5
5
  LANG_INVALID = "This lang value is not supported, the default one will be set which is: EN",
6
6
  ID_SCHEMA_MISSING = "If no idSchema is passed the default one will be set which is: native",
@@ -1,12 +1,10 @@
1
- import { EnvironmentEnum } from "../Enums/EnvironmentEnum";
2
- import { IdSchemaEnum } from "../Enums/IdSchemaEnum";
3
- import { LangEnum } from "../Enums/LangEnum";
1
+ import { EnvironmentType, IdSchemaType, LangType } from "../Types/ConfiguratorTypes";
4
2
  import FansUnitedAuthInterface from "./FansUnitedAuthInterface";
5
3
  export default class SDKConfigurationModel {
6
4
  apiKey: string;
7
- environment: EnvironmentEnum;
8
- idSchema: IdSchemaEnum;
9
5
  clientId: string;
10
- lang: LangEnum;
6
+ environment?: EnvironmentType;
7
+ idSchema?: IdSchemaType;
8
+ lang?: LangType;
11
9
  authProvider: FansUnitedAuthInterface;
12
10
  }
@@ -0,0 +1,3 @@
1
+ export declare type LangType = 'bg' | 'en' | 'ro';
2
+ export declare type IdSchemaType = 'native' | 'enetpulse' | 'sportal365' | 'sportradar';
3
+ export declare type EnvironmentType = 'dev' | 'prod' | 'staging';
@@ -1,4 +1,4 @@
1
- import { ErrorMessages } from "./ErrorMessages";
1
+ import { ErrorMessages } from "../Global/Messages/Messages";
2
2
  export default class FansUnitedSdkException extends Error {
3
3
  constructor(message: ErrorMessages);
4
4
  errorMessage: () => string;
@@ -4,3 +4,6 @@ export declare const ID_TYPES: {
4
4
  sportal365: string;
5
5
  enetpulse: string;
6
6
  };
7
+ export declare const documentationLinks: {
8
+ PREDICTOR_USER_RELATED_OPERATION: string;
9
+ };
@@ -13,3 +13,151 @@ export declare const predictorConfigResponse: {
13
13
  };
14
14
  };
15
15
  };
16
+ export declare const EFBET_MATCH: {
17
+ data: {
18
+ meta: {
19
+ pagination: {
20
+ current_page: number;
21
+ items_per_page: number;
22
+ total_items: number;
23
+ number_of_pages: number;
24
+ };
25
+ };
26
+ data: {
27
+ id: string;
28
+ kickoff_at: string;
29
+ finished_at: any;
30
+ updated_at: string;
31
+ home_team: {
32
+ id: string;
33
+ country: {
34
+ id: string;
35
+ alias: any;
36
+ country_code: string;
37
+ assets: {
38
+ flag: string;
39
+ };
40
+ name: string;
41
+ };
42
+ assets: {
43
+ logo: string;
44
+ };
45
+ national: boolean;
46
+ code: string;
47
+ gender: string;
48
+ name: string;
49
+ full_name: any;
50
+ short_name: any;
51
+ };
52
+ away_team: {
53
+ id: string;
54
+ country: {
55
+ id: string;
56
+ alias: any;
57
+ country_code: string;
58
+ assets: {
59
+ flag: string;
60
+ };
61
+ name: string;
62
+ };
63
+ assets: {
64
+ logo: string;
65
+ };
66
+ national: boolean;
67
+ code: any;
68
+ gender: string;
69
+ name: string;
70
+ full_name: any;
71
+ short_name: any;
72
+ };
73
+ lineups_confirmed: any;
74
+ started_at: any;
75
+ minute: any;
76
+ scores: {
77
+ ft_score: {
78
+ home_goals: any;
79
+ away_goals: any;
80
+ };
81
+ ht_score: {
82
+ home_goals: any;
83
+ away_goals: any;
84
+ };
85
+ aet_score: {
86
+ home_goals: any;
87
+ away_goals: any;
88
+ };
89
+ agg_score: {
90
+ home_goals: any;
91
+ away_goals: any;
92
+ };
93
+ pen_score: {
94
+ home_goals: any;
95
+ away_goals: any;
96
+ };
97
+ };
98
+ context: {
99
+ competition: {
100
+ id: string;
101
+ country: {
102
+ id: string;
103
+ alias: any;
104
+ country_code: string;
105
+ assets: {
106
+ flag: string;
107
+ };
108
+ name: string;
109
+ };
110
+ gender: string;
111
+ assets: {
112
+ logo: string;
113
+ };
114
+ type: string;
115
+ name: string;
116
+ };
117
+ };
118
+ status: {
119
+ type: string;
120
+ sub_type: string;
121
+ };
122
+ }[];
123
+ };
124
+ };
125
+ export declare const FOOTBALL_COMPETITIONS: {
126
+ data: {
127
+ data: ({
128
+ id: string;
129
+ country: {
130
+ id: string;
131
+ alias: any;
132
+ country_code: string;
133
+ assets: {
134
+ flag: string;
135
+ };
136
+ name: string;
137
+ };
138
+ gender: string;
139
+ assets: {
140
+ logo: string;
141
+ };
142
+ type: string;
143
+ name: string;
144
+ } | {
145
+ id: string;
146
+ country: {
147
+ id: string;
148
+ alias: string;
149
+ country_code: string;
150
+ assets: {
151
+ flag: string;
152
+ };
153
+ name: string;
154
+ };
155
+ gender: string;
156
+ assets: {
157
+ logo: any;
158
+ };
159
+ type: string;
160
+ name: string;
161
+ })[];
162
+ };
163
+ };
@@ -0,0 +1,3 @@
1
+ export interface FiltersInterface {
2
+ constructFiltersUrl?: () => string;
3
+ }
@@ -29,7 +29,14 @@ export default class LocalStorage {
29
29
  setFootballCountries: (countries: FootballCountryModel[]) => void;
30
30
  getCompetitions: (filters?: CompetitionFilters) => any;
31
31
  setCompetitions: (competitions: CompetitionBasicModel[]) => void;
32
+ getCompetitionsLength: () => number;
32
33
  getExpirationProfile: () => number;
34
+ /**
35
+ * The purpose of this method is to avoid the posibility of having same competitions store in Local Storage.
36
+ * @param competitions Cached competitions.
37
+ * @returns Unique competitions.
38
+ */
39
+ private makeCompetitionsUnique;
33
40
  private getData;
34
41
  private setData;
35
42
  }
@@ -0,0 +1,11 @@
1
+ export declare enum ErrorMessages {
2
+ LOYALTY_INVALID_TEMPLATE_ID = "Provided template ID does NOT exist! Try again with existing template ID.",
3
+ INVALID_MATCH_ID = "Match id is invalid!",
4
+ INVALID_PLAYER_ID = "Player id is invalid!",
5
+ QUERY_PARAM_MATCH_IDS_EXCEEDED = "Maximum matchIds in PredictionFilters should be 10 or less.",
6
+ INVALID_PREDICTION_MODEL = "The prediction is invalid. Please check again have you passed appropriate prediction model. For more information please visit our offical documentation: \n https://docs.fansunitedmedia.com/sdks/js/match.quiz#gamerelatedoperations"
7
+ }
8
+ export declare const WarningMessages: {
9
+ UNEXPECTED_STATUS_PROP: string;
10
+ UNEXPECTED_TYPE_PROP: string;
11
+ };
@@ -0,0 +1,40 @@
1
+ import SDKConfigurationModel from "../Configurator/Models/SDKConfiguraitonModel";
2
+ import ProfileStatsModel from "../Namespaces/Profile/Models/Stats/ProfileStatsModel";
3
+ export default class SDKIdsRemapper {
4
+ private idMapping;
5
+ private idSchema;
6
+ private readonly native;
7
+ constructor(config: SDKConfigurationModel);
8
+ /**
9
+ * Method is used to remaped competition and team ids from entities in successRates field.
10
+ * @param profileStats Profile stats from Loyalty API.
11
+ * @returns A new successRates with remaped ids keys.
12
+ */
13
+ remapSuccessRatesEntities: (profileStats: ProfileStatsModel) => Promise<ProfileStatsModel>;
14
+ /**
15
+ * Keys for success rates entiteis are ids. This method extracts them in string array.
16
+ * @param record The record containing native ids keys.
17
+ * @returns New list of native ids.
18
+ */
19
+ private getIdsKeys;
20
+ /**
21
+ * Makes a new Map contating key-value native-remapped id.
22
+ * @param nativeIds Native ids from success rates API response.
23
+ * @param idSchemaIds New remapped ids for success rates.
24
+ * @returns New map containing key-value ids.
25
+ */
26
+ private getIdsMap;
27
+ /**
28
+ * Constructs new record with remapped ids for success rates.
29
+ * @param record Old record with native ids keys.
30
+ * @param idsMap Ids map with native ids keys and remapped ids values.
31
+ * @returns New Record with remapped ids keys.
32
+ */
33
+ private setNewRecord;
34
+ /**
35
+ * Calls id mapping facade to fetch id entities from storage or Id Mapping API.
36
+ * @param idsObj Object which key is entity and value is string array of ids.
37
+ * @returns Remapped ids by entities.
38
+ */
39
+ private remapIdsObj;
40
+ }
@@ -0,0 +1,13 @@
1
+ import LoyaltyConfigModel from "../../Namespaces/Loyalty/Models/ClientFeatures/LoyaltyConfigModel";
2
+ import MatchQuizConfigModel from "../../Namespaces/MatchQuiz/Models/Config/MatchQuizConfigModel";
3
+ import TopXConfigModel from "../../Namespaces/TopX/Models/Config/TopXConfigModel";
4
+ import PredictorConfigModel from "../../Namespaces/Predictor/Models/Config/PredictorConfigModel";
5
+ export declare type FeaturesConfigModels = PredictorConfigModel | TopXConfigModel | MatchQuizConfigModel | LoyaltyConfigModel;
6
+ export declare type FilterCase = "user" | "current" | "past" | "matches";
7
+ export declare type IdEntities = {
8
+ competition?: string[];
9
+ team?: string[];
10
+ player?: string[];
11
+ match?: string[];
12
+ };
13
+ export declare type SortOrder = "asc" | "desc";
@@ -14,5 +14,5 @@ export default class ActivityHttps {
14
14
  deleteActivity: (activityId: string) => Promise<boolean>;
15
15
  getOwnActivities: (filters: ActivityFilters, disableCache: boolean) => Promise<PaginationActivities>;
16
16
  getActivitiesForUser: (userId: string, filters: ActivityFilters, disableCache: boolean) => Promise<PaginationActivities>;
17
- getStats: (userId?: string) => Promise<ProfileStatsModel>;
17
+ getStats: (userId?: string, disableCache?: boolean) => Promise<ProfileStatsModel>;
18
18
  }
@@ -1,5 +1,5 @@
1
1
  import SDKConfigurationModel from "../Configurator/Models/SDKConfiguraitonModel";
2
- import { FeaturesConfigModels } from "../Namespaces/Predictor/Service/PredictorService";
2
+ import { FeaturesConfigModels } from "../Global/Types/GlobalTypes";
3
3
  export declare enum FeatureConfigType {
4
4
  PREDICTOR = "predictor",
5
5
  TOP_X = "topX",
@@ -1,14 +1,18 @@
1
1
  import SDKConfiguraitonModel from "../Configurator/Models/SDKConfiguraitonModel";
2
2
  import PaginationModel from "../Global/Models/Pagination/PaginationModel";
3
+ import FootballPaginationModel from "../Namespaces/Football/Models/Pagination/FootballPaginationModel";
3
4
  import LoyaltyFilters from "../Namespaces/Loyalty/Models/Filters/LoyaltyFilters";
5
+ import RankingsFilters from "../Namespaces/Loyalty/Models/Filters/RankingsFilters";
4
6
  import TemplateModel from "../Namespaces/Loyalty/Models/Template/TemplateModel";
5
7
  export default class LoyaltyHttps {
6
8
  private instance;
7
9
  private apiSignInUrl;
8
10
  private templateRemapper;
9
11
  private leaderboardRemapper;
12
+ private rankingsRemapper;
10
13
  constructor(config: SDKConfiguraitonModel);
11
14
  getTemplates: (disableCache: boolean, isPaginated: boolean) => Promise<PaginationModel | TemplateModel[]>;
12
15
  getLeaderboard: (templateId: string, disableCache: boolean, filters: LoyaltyFilters) => Promise<PaginationModel>;
13
16
  getLeaderboardForGame: (gameId: string, disableCache: boolean, filters: LoyaltyFilters) => Promise<PaginationModel>;
17
+ getUserRankings: (userId: string, filters: RankingsFilters, disableCache: boolean) => Promise<FootballPaginationModel>;
14
18
  }
@@ -29,4 +29,5 @@ export default class PredictorHttps {
29
29
  getGamePredictions: (gameId: string, disableCache: boolean, filters?: PredictionsFilters) => Promise<PaginationModel>;
30
30
  getUserGameEditions: (filters: GamesFilters, disableCache: boolean) => Promise<PaginationModel>;
31
31
  getGameResults: (gameId: string, disableCache: boolean, filters?: GamesFilters) => Promise<PaginationModel>;
32
+ getMarketResultsForGame: (gameId: string, disableCache: boolean) => Promise<import("../Namespaces/MatchQuiz/Models/GameMarketsResults/GameMarketsResults").default>;
32
33
  }
@@ -5,4 +5,6 @@ export default class ActivityRemapper {
5
5
  remapSingleResponse: (response: any) => ActivityResponseBody;
6
6
  remapActivitiesResponse: (response: any) => PaginationActivities;
7
7
  remapStatsReponse: (response: any) => ProfileStatsModel;
8
+ private constructNewRecord;
9
+ private remapSuccessRatePercent;
8
10
  }
@@ -1,5 +1,5 @@
1
- import { IdSchemaEnum } from "../../../Configurator/Enums/IdSchemaEnum";
2
1
  import SDKConfigurationModel from "../../../Configurator/Models/SDKConfiguraitonModel";
2
+ import { IdSchemaType } from "../../../Configurator/Types/ConfiguratorTypes";
3
3
  import TagsModel from "../Models/RequestBody/Context/TagsModel";
4
4
  export default class ActivityService {
5
5
  private idSchema;
@@ -13,5 +13,5 @@ export default class ActivityService {
13
13
  * @param tags
14
14
  * @returns Remapped tags from idSchema to native.
15
15
  */
16
- remapTagsIds: (tags: TagsModel[], fromSchema: IdSchemaEnum, toSchema: IdSchemaEnum) => Promise<TagsModel[]>;
16
+ remapTagsIds: (tags: TagsModel[], fromSchema: IdSchemaType, toSchema: IdSchemaType) => Promise<TagsModel[]>;
17
17
  }
@@ -0,0 +1,6 @@
1
+ import FootballCountryModel from "../Country/FootballCountryModel";
2
+ export default class PlayerMarketResultModel {
3
+ id: string;
4
+ name: string;
5
+ country: FootballCountryModel;
6
+ }
@@ -5,17 +5,24 @@ import LoyaltyHttps from "../../../Https/LoyaltyHttps";
5
5
  import LoyaltyFilters from "../Models/Filters/LoyaltyFilters";
6
6
  import ClientBadges from "../Models/Badges/ClientBadges";
7
7
  import TemplateModel from "../Models/Template/TemplateModel";
8
- import { FeaturesConfigModels } from "../../Predictor/Service/PredictorService";
8
+ import { FeaturesConfigModels } from "../../../Global/Types/GlobalTypes";
9
+ import RankingsFilters from "../Models/Filters/RankingsFilters";
10
+ import FootballPaginationModel from "../../Football/Models/Pagination/FootballPaginationModel";
11
+ import ProfileHttps from "../../../Https/ProfileHttps";
12
+ import LocalStorage from "../../../Global/LocalStorage";
9
13
  export default class LoyaltyFacade {
10
14
  private config;
11
15
  private clientHttps;
12
16
  private loyaltyHttps;
13
17
  private loyaltyService;
14
- constructor(config: SDKConfigurationModel, clientHttps: ClientHttps, loyaltyHttps: LoyaltyHttps);
18
+ private profileFacade;
19
+ constructor(config: SDKConfigurationModel, clientHttps: ClientHttps, loyaltyHttps: LoyaltyHttps, profileHttps: ProfileHttps, localStorage: LocalStorage);
15
20
  getConfig: () => Promise<FeaturesConfigModels>;
16
21
  getClientBadges: () => Promise<ClientBadges>;
17
22
  getTemplates: (disableCache?: boolean) => Promise<PaginationModel>;
18
23
  getTemplateById: (templateId: string, disableCache?: boolean) => Promise<TemplateModel>;
19
24
  getLeaderboard: (templateId: string, filters?: LoyaltyFilters, disableCache?: boolean) => Promise<PaginationModel>;
20
25
  getLeaderboardForGame: (gameId: string, filters: LoyaltyFilters, disableCache?: boolean) => Promise<PaginationModel>;
26
+ getOwnRankings: (filters?: RankingsFilters, disableCache?: boolean) => Promise<FootballPaginationModel>;
27
+ getUserRankings: (userId: string, filters?: RankingsFilters, disableCache?: boolean) => Promise<FootballPaginationModel>;
21
28
  }
@@ -3,11 +3,14 @@ import PaginationModel from "../../Global/Models/Pagination/PaginationModel";
3
3
  import LoyaltyFilters from "./Models/Filters/LoyaltyFilters";
4
4
  import ClientBadges from "./Models/Badges/ClientBadges";
5
5
  import TemplateModel from "./Models/Template/TemplateModel";
6
- import { FeaturesConfigModels } from "../Predictor/Service/PredictorService";
6
+ import { FeaturesConfigModels } from "../../Global/Types/GlobalTypes";
7
+ import RankingsFilters from "./Models/Filters/RankingsFilters";
7
8
  export default class Loyalty {
8
9
  private clientHttps;
10
+ private profileHttps;
9
11
  private loyaltyHttps;
10
12
  private loyaltyFacade;
13
+ private localStorage;
11
14
  constructor(config: SDKConfigurationModel);
12
15
  getConfig: () => Promise<FeaturesConfigModels>;
13
16
  getClientBadges: () => Promise<ClientBadges>;
@@ -15,4 +18,6 @@ export default class Loyalty {
15
18
  getTemplateById: (templateId: string, disableCache?: boolean) => Promise<TemplateModel>;
16
19
  getLeaderboard: (templateId: string, filters?: LoyaltyFilters, disableCache?: boolean) => Promise<PaginationModel>;
17
20
  getLeaderboardForGame: (gameId: string, filters?: LoyaltyFilters, disableCache?: boolean) => Promise<PaginationModel>;
21
+ getOwnRankings: (filters?: RankingsFilters, disableCache?: boolean) => Promise<import("../Football/Models/Pagination/FootballPaginationModel").default>;
22
+ getUserRankings: (userId: string, filters?: RankingsFilters, disableCache?: boolean) => Promise<import("../Football/Models/Pagination/FootballPaginationModel").default>;
18
23
  }
@@ -1,6 +1,7 @@
1
- export default class LoyaltyFilters {
2
- limit: number;
3
- page: number;
1
+ import { FiltersInterface } from "../../../../Global/Interfaces/GlobalInterfaces";
2
+ export default class LoyaltyFilters implements FiltersInterface {
3
+ limit?: number;
4
+ page?: number;
4
5
  constructor(filters: any);
5
- constructFiltersUrl: () => string;
6
+ constructFiltersUrl(): string;
6
7
  }
@@ -0,0 +1,11 @@
1
+ import { FiltersInterface } from "../../../../Global/Interfaces/GlobalInterfaces";
2
+ import { SortOrder } from "../../../../Global/Types/GlobalTypes";
3
+ import { RankingsType } from "../../Types/LoyaltyTypes";
4
+ import LoyaltyFilters from "./LoyaltyFilters";
5
+ export default class RankingsFilters extends LoyaltyFilters implements FiltersInterface {
6
+ sortOrder?: SortOrder;
7
+ type?: RankingsType;
8
+ typeIds?: string[];
9
+ constructor(filters: any);
10
+ constructFiltersUrl: () => string;
11
+ }
@@ -1,6 +1,5 @@
1
- import LoyaltyMeta from "../Meta/LoyaltyMeta";
2
- import LeaderboardModel from "./LeaderboardModel";
3
1
  export default class LeaderboardRemapper {
4
- remapMeta: (metaResponse: any) => LoyaltyMeta;
5
- remapResponseData: (dataResponse: any[]) => LeaderboardModel[];
2
+ remapResponse: (response: any) => any;
3
+ private remapMeta;
4
+ private remapData;
6
5
  }
@@ -0,0 +1,6 @@
1
+ import { RankingsType } from "../../Types/LoyaltyTypes";
2
+ import LeaderboardModel from "../Leaderboard/LeaderboardModel";
3
+ export default class RankingsModel extends LeaderboardModel {
4
+ id: string;
5
+ rankType: RankingsType;
6
+ }
@@ -0,0 +1,6 @@
1
+ import FootballPaginationModel from "../../../Football/Models/Pagination/FootballPaginationModel";
2
+ export default class RankingsRemapper {
3
+ remapRankings: (response: any) => FootballPaginationModel;
4
+ private remapMeta;
5
+ private remapData;
6
+ }
@@ -3,6 +3,7 @@ import BadgesModel from "../Models/Badges/BadgesModel";
3
3
  import ClientBadges from "../Models/Badges/ClientBadges";
4
4
  import LeaderboardModel from "../Models/Leaderboard/LeaderboardModel";
5
5
  import TemplateModel from "../Models/Template/TemplateModel";
6
+ import { FiltersType } from "../Types/LoyaltyTypes";
6
7
  export default class LoyaltyService {
7
8
  private idMappingService;
8
9
  private profileNamespace;
@@ -10,5 +11,6 @@ export default class LoyaltyService {
10
11
  remapTemplatesIds: (templates: TemplateModel[]) => Promise<TemplateModel[]>;
11
12
  addProfileModel: (leaderboard: any[]) => Promise<LeaderboardModel[]>;
12
13
  buildClientBadges: (badges: BadgesModel) => ClientBadges;
14
+ initFilters: (filters: any, type: FiltersType) => any;
13
15
  private extractEnabledBadgesId;
14
16
  }
@@ -0,0 +1,2 @@
1
+ export declare type RankingsType = "game" | "template";
2
+ export declare type FiltersType = "loyalty" | "rankings";
@@ -3,16 +3,16 @@ import PaginationModel from "../../../Global/Models/Pagination/PaginationModel";
3
3
  import PredictionRequestModel from "../../Predictor/Models/Predictions/PredictionRequestModel";
4
4
  import PredictionResponseModel from "../../Predictor/Models/Predictions/PredictionResponseModel";
5
5
  import PredictionsFilters from "../../Predictor/Models/Predictions/PredictionsFilters";
6
- import { FeaturesConfigModels } from "../../Predictor/Service/PredictorService";
6
+ import { FeaturesConfigModels } from "../../../Global/Types/GlobalTypes";
7
7
  import GameModel from "../../TopX/Models/Games/GameModel";
8
8
  import GamesFilters from "../../TopX/Models/Games/GamesFilters";
9
9
  import GamesListModel from "../../TopX/Models/Games/GamesListModel";
10
+ import GameMarketsResults from "../Models/GameMarketsResults/GameMarketsResults";
10
11
  export default class MatchQuizFacade {
11
12
  private predictorHttps;
12
13
  private predictorService;
13
14
  private idMapping;
14
15
  private clientHttps;
15
- readonly invalidPredictionModelErrorMessage = "The prediction is invalid. Please check again have you passed appropriate prediction model. For more information please visit our offical documentation: \n https://docs.fansunitedmedia.com/sdks/js/match.quiz#gamerelatedoperations";
16
16
  constructor(config: SDKConfigurationModel);
17
17
  getConfig: () => Promise<FeaturesConfigModels>;
18
18
  play: (matchQuizPrediction: PredictionRequestModel) => Promise<PredictionResponseModel>;
@@ -26,4 +26,5 @@ export default class MatchQuizFacade {
26
26
  getMyGamePrediction: (gameId: string) => Promise<PredictionResponseModel>;
27
27
  getUserGameEditions: (userId: string, filters?: GamesFilters, disableCache?: boolean) => Promise<PaginationModel>;
28
28
  getUserGamePrediction: (userId: string, gameId: string, disableCache?: boolean) => Promise<PredictionResponseModel>;
29
+ getMarketsResultsForGame: (gameId: string, disableCache?: boolean) => Promise<GameMarketsResults>;
29
30
  }
@@ -3,10 +3,11 @@ import PaginationModel from "../../Global/Models/Pagination/PaginationModel";
3
3
  import PredictionRequestModel from "../Predictor/Models/Predictions/PredictionRequestModel";
4
4
  import PredictionResponseModel from "../Predictor/Models/Predictions/PredictionResponseModel";
5
5
  import PredictionsFilters from "../Predictor/Models/Predictions/PredictionsFilters";
6
- import { FeaturesConfigModels } from "../Predictor/Service/PredictorService";
6
+ import { FeaturesConfigModels } from "../../Global/Types/GlobalTypes";
7
7
  import GameModel from "../TopX/Models/Games/GameModel";
8
8
  import GamesFilters from "../TopX/Models/Games/GamesFilters";
9
9
  import GamesListModel from "../TopX/Models/Games/GamesListModel";
10
+ import GameMarketsResults from "./Models/GameMarketsResults/GameMarketsResults";
10
11
  export default class MatchQuiz {
11
12
  private matchQuizFacade;
12
13
  constructor(config: SDKConfigurationModel);
@@ -22,4 +23,5 @@ export default class MatchQuiz {
22
23
  getMyGamePrediction: (gameId: string) => Promise<PredictionResponseModel>;
23
24
  getUserGameEditions: (userId: string, filters?: GamesFilters, disableCache?: boolean) => Promise<PaginationModel>;
24
25
  getUserGamePrediction: (userId: string, gameId: string, disableCache?: boolean) => Promise<PredictionResponseModel>;
26
+ getMarketsResultsForGame: (gameId: string, disableCache?: boolean) => Promise<GameMarketsResults>;
25
27
  }
@@ -0,0 +1,14 @@
1
+ import MatchBasicModel from "../../../Football/Models/Match/MatchBasicModel";
2
+ import PlayerMarketResultModel from "../../../Football/Models/Player/PlayerMarketResultModel";
3
+ import { MarketEnum } from "../../../Predictor/Enums/MarketEnum";
4
+ export declare type MarketsResults = {
5
+ matchId: string;
6
+ market: MarketEnum;
7
+ result: string | string[] | boolean;
8
+ matchModel: MatchBasicModel;
9
+ playerModels?: PlayerMarketResultModel[];
10
+ };
11
+ export default class GameMarketsResults {
12
+ gameId: string;
13
+ results: MarketsResults[];
14
+ }
@@ -33,4 +33,5 @@ export declare enum MarketEnum {
33
33
  export declare const MarketsOverGoals: MarketEnum[];
34
34
  export declare const MarketsOverCorners: MarketEnum[];
35
35
  export declare const playerMarkets: MarketEnum[];
36
+ export declare const endMarkMarkets: MarketEnum[];
36
37
  export declare const playerMarketNobodyPrediction = MarketEnum.PLAYER_SCORE_FIRST_GOAL;
@@ -5,4 +5,4 @@ export declare enum StatusEnum {
5
5
  PARTIALLY_WON = "PARTIALLY_WON",
6
6
  CANCELED = "CANCELED"
7
7
  }
8
- export declare const pastStatuses: string[];
8
+ export declare const pastStatuses: StatusEnum[];
@@ -3,10 +3,11 @@ import ClientHttps from "../../../Https/ClientHttps";
3
3
  import PredictorHttps from "../../../Https/PredictorHttps";
4
4
  import IdMappingService from "../../../IdMapping/IdMappingService";
5
5
  import MatchSummaryModel from "../Models/Summary/MatchSummaryModel";
6
- import PredictorService, { FeaturesConfigModels } from "../Service/PredictorService";
6
+ import PredictorService from "../Service/PredictorService";
7
7
  import PredictionsFilters from "../Models/Predictions/PredictionsFilters";
8
8
  import SDKConfigurationModel from "../../../Configurator/Models/SDKConfiguraitonModel";
9
9
  import PaginationModel from "../../../Global/Models/Pagination/PaginationModel";
10
+ import { FeaturesConfigModels } from "../../../Global/Types/GlobalTypes";
10
11
  export default class PredictorFacade {
11
12
  readonly predictorHttps: PredictorHttps;
12
13
  readonly clientHttps: ClientHttps;
@@ -34,9 +35,11 @@ export default class PredictorFacade {
34
35
  getConfig: () => Promise<FeaturesConfigModels>;
35
36
  deleteFootballPrediction: (predictionId: string) => Promise<boolean>;
36
37
  getMyPredictions: (filters?: PredictionsFilters) => Promise<PaginationModel>;
38
+ getMyPredictionsForMatches: (matchIds: string[], filters: PredictionsFilters) => Promise<PaginationModel>;
37
39
  getMyCurrentPredictions: (filters?: PredictionsFilters) => Promise<PaginationModel>;
38
40
  getMyPastPredictions: (filters?: PredictionsFilters) => Promise<PaginationModel>;
39
41
  getUserPredictions: (userId: string, filters?: PredictionsFilters, disableCache?: boolean) => Promise<PaginationModel>;
40
- getUserCurrentPredictions: (userId: string, filters?: PredictionsFilters) => Promise<PaginationModel>;
41
- getUserPastPredictions: (userId: string, filters?: PredictionsFilters) => Promise<PaginationModel>;
42
+ getUserCurrentPredictions: (userId: string, filters?: PredictionsFilters, disableCache?: boolean) => Promise<PaginationModel>;
43
+ getUserPastPredictions: (userId: string, filters?: PredictionsFilters, disableCache?: boolean) => Promise<PaginationModel>;
44
+ getUserPredictionsForMatches: (userId: string, matchIds: string[], filters?: PredictionsFilters, disableCache?: boolean) => Promise<PaginationModel>;
42
45
  }
@@ -5,6 +5,7 @@ export default class PredictionsFilters {
5
5
  startAfter: string;
6
6
  status: StatusEnum[];
7
7
  type: TypeGames;
8
+ matchIds: string[];
8
9
  constructor(filters: any);
9
10
  constructFiltersUrl: () => string;
10
11
  }
@@ -3,7 +3,7 @@ import MatchSummaryModel from "./Models/Summary/MatchSummaryModel";
3
3
  import { MarketEnum } from "./Enums/MarketEnum";
4
4
  import PredictionsFilters from "./Models/Predictions/PredictionsFilters";
5
5
  import PaginationModel from "../../Global/Models/Pagination/PaginationModel";
6
- import { FeaturesConfigModels } from "./Service/PredictorService";
6
+ import { FeaturesConfigModels } from "../../Global/Types/GlobalTypes";
7
7
  export default class Predictor {
8
8
  private predictorHttps;
9
9
  private clientHttps;
@@ -18,7 +18,9 @@ export default class Predictor {
18
18
  getMyPredictions: (filters?: PredictionsFilters) => Promise<PaginationModel>;
19
19
  getMyCurrentPredictions: (filters?: PredictionsFilters) => Promise<PaginationModel>;
20
20
  getMyPastPredictions: (filters?: PredictionsFilters) => Promise<PaginationModel>;
21
+ getMyPredictionsForMatches: (matchIds: string[], filters?: PredictionsFilters) => Promise<PaginationModel>;
21
22
  getUserPredictions: (userId: string, filters?: PredictionsFilters, disableCache?: boolean) => Promise<PaginationModel>;
22
- getUserCurrentPredictions: (userId: string, filters?: PredictionsFilters) => Promise<PaginationModel>;
23
- getUserPastPredictions: (userId: string, filters?: PredictionsFilters) => Promise<PaginationModel>;
23
+ getUserCurrentPredictions: (userId: string, filters?: PredictionsFilters, disableCache?: boolean) => Promise<PaginationModel>;
24
+ getUserPastPredictions: (userId: string, filters?: PredictionsFilters, disableCache?: boolean) => Promise<PaginationModel>;
25
+ getUserPredictionsForMatches: (userId: string, matchIds: string[], filters?: PredictionsFilters, disableCache?: boolean) => Promise<PaginationModel>;
24
26
  }