@mtgame/core 2.0.8 → 2.0.9

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 (37) hide show
  1. package/api/media-api.d.ts +2 -1
  2. package/api/public-team-api.d.ts +2 -0
  3. package/api/tournament-api.d.ts +2 -0
  4. package/api/volleyball-game-api.d.ts +1 -0
  5. package/esm2020/api/media-api.mjs +5 -1
  6. package/esm2020/api/public-team-api.mjs +8 -1
  7. package/esm2020/api/tournament-api.mjs +1 -1
  8. package/esm2020/api/volleyball-game-api.mjs +7 -1
  9. package/esm2020/localization/waterpolo-game-log-types.mjs +3 -3
  10. package/esm2020/models/basketball-game-log.mjs +1 -1
  11. package/esm2020/models/game.mjs +1 -1
  12. package/esm2020/models/hockey-game-statistic.mjs +1 -1
  13. package/esm2020/models/hockey-statistic.mjs +1 -1
  14. package/esm2020/models/league-player.mjs +3 -2
  15. package/esm2020/models/league.mjs +5 -1
  16. package/esm2020/models/rugby-game-statistic.mjs +28 -1
  17. package/esm2020/models/tournament-team-user.mjs +1 -1
  18. package/esm2020/models/tournament.mjs +1 -1
  19. package/esm2020/models/user.mjs +1 -1
  20. package/esm2020/models/waterpolo-game-statistic.mjs +3 -4
  21. package/esm2020/services/centrifugo.service.mjs +24 -6
  22. package/fesm2015/mtgame-core.mjs +80 -10
  23. package/fesm2015/mtgame-core.mjs.map +1 -1
  24. package/fesm2020/mtgame-core.mjs +74 -10
  25. package/fesm2020/mtgame-core.mjs.map +1 -1
  26. package/models/basketball-game-log.d.ts +1 -0
  27. package/models/game.d.ts +1 -1
  28. package/models/hockey-game-statistic.d.ts +9 -0
  29. package/models/hockey-statistic.d.ts +9 -0
  30. package/models/league-player.d.ts +2 -1
  31. package/models/league.d.ts +2 -0
  32. package/models/rugby-game-statistic.d.ts +6 -6
  33. package/models/tournament-team-user.d.ts +3 -0
  34. package/models/tournament.d.ts +1 -0
  35. package/models/user.d.ts +2 -0
  36. package/package.json +4 -4
  37. package/services/centrifugo.service.d.ts +2 -1
@@ -4,11 +4,11 @@ import { map, filter, take, takeUntil, distinctUntilChanged, delay, switchMap }
4
4
  import { __decorate } from 'tslib';
5
5
  import * as i1 from '@angular/common/http';
6
6
  import { HttpParams } from '@angular/common/http';
7
- import { BehaviorSubject, Subject, ReplaySubject, of } from 'rxjs';
7
+ import { BehaviorSubject, Observable, Subject, ReplaySubject, of } from 'rxjs';
8
8
  import { Centrifuge } from 'centrifuge';
9
+ import { isPlatformBrowser } from '@angular/common';
9
10
  import { UAParser } from 'ua-parser-js';
10
11
  import * as FingerPrint from '@fingerprintjs/fingerprintjs';
11
- import { isPlatformBrowser } from '@angular/common';
12
12
  import { captureException } from '@sentry/angular';
13
13
  import { FormGroup } from '@angular/forms';
14
14
 
@@ -561,6 +561,10 @@ let League = class League extends BaseModel {
561
561
  get tiktokLink() {
562
562
  return this.socialLinks.find(link => link.indexOf('tiktok.com/') > -1);
563
563
  }
564
+ checkRuDomain() {
565
+ const domainSplit = this.domain.split('.');
566
+ return domainSplit[(domainSplit.length - 1)] === 'ru';
567
+ }
564
568
  };
565
569
  League = __decorate([
566
570
  Model({
@@ -1362,6 +1366,7 @@ LeaguePlayer = __decorate([
1362
1366
  user: nestedModel(User),
1363
1367
  qualification: enumField(Qualification),
1364
1368
  fieldValues: listField(nestedModel(LeaguePlayerFieldValue)),
1369
+ gender: enumField(UserGender),
1365
1370
  }
1366
1371
  })
1367
1372
  ], LeaguePlayer);
@@ -3857,6 +3862,10 @@ class MediaApi {
3857
3862
  if (filters.teamId) {
3858
3863
  params = params.set('team_id', filters.teamId.toString());
3859
3864
  }
3865
+ if (filters.statuses) {
3866
+ const statuses = filters.statuses.map(i => GameStatuses[i]);
3867
+ params = params.set('statuses', statuses.join(','));
3868
+ }
3860
3869
  return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/media/`, { params, observe: 'response' })
3861
3870
  .pipe(map(response => ({
3862
3871
  total: +response.headers.get('X-Page-Count'),
@@ -4340,6 +4349,33 @@ let RugbyGameStatistic = class RugbyGameStatistic extends GameStatisticBase {
4340
4349
  get gameMinutes() {
4341
4350
  return Math.floor(this.gameTime / 60);
4342
4351
  }
4352
+ get conversionKicks() {
4353
+ return (this.conversionGoals || 0) + (this.conversionMisses || 0);
4354
+ }
4355
+ get conversionGoalsPercent() {
4356
+ if (!this.conversionKicks) {
4357
+ return 0;
4358
+ }
4359
+ return Math.floor(1000 * this.conversionGoals / this.conversionKicks) / 10;
4360
+ }
4361
+ get penaltyKicksOnGoal() {
4362
+ return (this.penaltyGoals || 0) + (this.penaltyMisses || 0);
4363
+ }
4364
+ get penaltyGoalsPercent() {
4365
+ if (!this.penaltyKicksOnGoal) {
4366
+ return 0;
4367
+ }
4368
+ return Math.floor(1000 * this.penaltyGoals / this.penaltyKicksOnGoal) / 10;
4369
+ }
4370
+ get dropGoalKicks() {
4371
+ return (this.dropGoals || 0) + (this.dropGoalMisses || 0);
4372
+ }
4373
+ get dropGoalsPercent() {
4374
+ if (!this.dropGoalKicks) {
4375
+ return 0;
4376
+ }
4377
+ return Math.floor(1000 * this.dropGoals / this.dropGoalKicks) / 10;
4378
+ }
4343
4379
  get totalGoals() {
4344
4380
  return (this.conversionGoals || 0) + (this.dropGoals || 0) + (this.penaltyGoals || 0);
4345
4381
  }
@@ -5588,6 +5624,12 @@ class VolleyballGameApi extends GameBaseApi {
5588
5624
  responseType: 'blob'
5589
5625
  }).toPromise();
5590
5626
  }
5627
+ async downloadProtocolAdvanced(gameId, format) {
5628
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_volleyball_game/${gameId}/game_protocol_advanced/`, {
5629
+ params: new HttpParams().set('file_type', format),
5630
+ responseType: 'blob'
5631
+ }).toPromise();
5632
+ }
5591
5633
  async downloadProtocol(gameId, format) {
5592
5634
  return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_volleyball_game/${gameId}/game_protocol/`, {
5593
5635
  params: new HttpParams().set('file_type', format),
@@ -5918,7 +5960,7 @@ let WaterpoloGameStatistic = class WaterpoloGameStatistic extends GameStatisticB
5918
5960
  return this.ppShots + this.evShots + this.shShots;
5919
5961
  }
5920
5962
  get totalShots() {
5921
- return this.shots + (this.shootoutAttempts || 0);
5963
+ return this.shots + this.shootoutShots;
5922
5964
  }
5923
5965
  get faceOffs() {
5924
5966
  return (this.faceOffWins || 0) + (this.faceOffLosses || 0);
@@ -5967,8 +6009,7 @@ let WaterpoloGameStatistic = class WaterpoloGameStatistic extends GameStatisticB
5967
6009
  this.freeKickShotsBlocked + this.cornerShotsBlocked;
5968
6010
  }
5969
6011
  get totalFouls() {
5970
- return (this.fouls || 0) + (this.penaltyFouls || 0) + (this.attackFouls || 0) + (this.personalFouls || 0) +
5971
- (this.minorPenalties || 0) + (this.majorPenalties || 0) + (this.matchPenalties || 0);
6012
+ return (this.fouls || 0) + (this.personalFouls || 0);
5972
6013
  }
5973
6014
  get totalPenalties() {
5974
6015
  return (this.minorPenalties || 0) + (this.majorPenalties || 0) + (this.matchPenalties || 0);
@@ -6269,6 +6310,12 @@ class PublicTeamApi {
6269
6310
  const params = new HttpParams().set('league_id', leagueId.toString());
6270
6311
  return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/public_team/${teamId}/tournament_teams/`, { params }).pipe(map(result => result.map(item => new TournamentTeam(item)))).toPromise();
6271
6312
  }
6313
+ async getUsers(teamId) {
6314
+ return this.httpClient
6315
+ .get(`${this.configService.get('apiUrl')}/api/v1/public_team/${teamId}/users/`)
6316
+ .pipe(map(data => data.map(item => new TeamUser(item))))
6317
+ .toPromise();
6318
+ }
6272
6319
  }
6273
6320
  PublicTeamApi.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PublicTeamApi, deps: [{ token: i1.HttpClient }, { token: ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
6274
6321
  PublicTeamApi.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PublicTeamApi, providedIn: 'root' });
@@ -6476,8 +6523,8 @@ const WaterpoloGameLogTypeLocalization = {
6476
6523
  [WaterpoloGameLogTypes.assist]: 'Голевая передача',
6477
6524
  [WaterpoloGameLogTypes.block_shot]: 'Блокировка броска',
6478
6525
  [WaterpoloGameLogTypes.minor_penalty]: 'Удаление на 20 сек.',
6479
- [WaterpoloGameLogTypes.major_penalty]: 'Удаление + 4 мин. штраф',
6480
- [WaterpoloGameLogTypes.match_penalty]: 'Удаление до конца матча',
6526
+ [WaterpoloGameLogTypes.major_penalty]: 'Удаление + 20 сек. штраф',
6527
+ [WaterpoloGameLogTypes.match_penalty]: 'Удаление + 4 мин. штраф',
6481
6528
  [WaterpoloGameLogTypes.foul]: 'Фол',
6482
6529
  [WaterpoloGameLogTypes.penalty_foul]: 'Фол пенальти',
6483
6530
  [WaterpoloGameLogTypes.attack_foul]: 'Фол в нападении',
@@ -6845,9 +6892,10 @@ TournamentJoin1x1Data = __decorate([
6845
6892
  ], TournamentJoin1x1Data);
6846
6893
 
6847
6894
  class CentrifugoService {
6848
- constructor(httpClient, configService) {
6895
+ constructor(httpClient, configService, platformId) {
6849
6896
  this.httpClient = httpClient;
6850
6897
  this.configService = configService;
6898
+ this.platformId = platformId;
6851
6899
  this.channels$ = {};
6852
6900
  this.subscriptions = {};
6853
6901
  this.connectedSubject = new BehaviorSubject(false);
@@ -6856,6 +6904,11 @@ class CentrifugoService {
6856
6904
  return this.connectedSubject;
6857
6905
  }
6858
6906
  listen(channel) {
6907
+ if (!isPlatformBrowser(this.platformId)) {
6908
+ return new Observable(observer => {
6909
+ observer.error('Centrifugo is not available in ssr mode');
6910
+ });
6911
+ }
6859
6912
  if (channel in this.channels$) {
6860
6913
  return this.channels$[channel];
6861
6914
  }
@@ -6876,6 +6929,11 @@ class CentrifugoService {
6876
6929
  }
6877
6930
  }
6878
6931
  connect() {
6932
+ if (!isPlatformBrowser(this.platformId)) {
6933
+ return new Observable(observer => {
6934
+ observer.error('Centrifugo is not available in ssr mode');
6935
+ });
6936
+ }
6879
6937
  if (!this.initializeEngineSubject) {
6880
6938
  this.initializeEngineSubject = new ReplaySubject(1);
6881
6939
  this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/centrifugo_v2/`)
@@ -6899,6 +6957,9 @@ class CentrifugoService {
6899
6957
  return this.initializeEngineSubject.pipe(filter(item => Boolean(item)), take(1));
6900
6958
  }
6901
6959
  async publish(channel, message) {
6960
+ if (!isPlatformBrowser(this.platformId)) {
6961
+ throw new Error('Centrifugo is not available in ssr mode');
6962
+ }
6902
6963
  const connected = await this.connect().pipe(filter(item => Boolean(item)), take(1)).toPromise();
6903
6964
  if (!connected) {
6904
6965
  throw new Error('Centrifuge connection error');
@@ -6937,12 +6998,15 @@ class CentrifugoService {
6937
6998
  this.channels$[channel].next(message);
6938
6999
  }
6939
7000
  }
6940
- CentrifugoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: CentrifugoService, deps: [{ token: i1.HttpClient }, { token: ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
7001
+ CentrifugoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: CentrifugoService, deps: [{ token: i1.HttpClient }, { token: ConfigService }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
6941
7002
  CentrifugoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: CentrifugoService, providedIn: 'root' });
6942
7003
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: CentrifugoService, decorators: [{
6943
7004
  type: Injectable,
6944
7005
  args: [{ providedIn: 'root' }]
6945
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: ConfigService }]; } });
7006
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: ConfigService }, { type: undefined, decorators: [{
7007
+ type: Inject,
7008
+ args: [PLATFORM_ID]
7009
+ }] }]; } });
6946
7010
 
6947
7011
  class BaseController {
6948
7012
  constructor() {