@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 { Injectable, Optional, Inject, PLATFORM_ID } from '@angular/core';
4
4
  import { map, filter, take, takeUntil, distinctUntilChanged, delay, switchMap } from 'rxjs/operators';
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({
@@ -1359,6 +1363,7 @@ LeaguePlayer = __decorate([
1359
1363
  user: nestedModel(User),
1360
1364
  qualification: enumField(Qualification),
1361
1365
  fieldValues: listField(nestedModel(LeaguePlayerFieldValue)),
1366
+ gender: enumField(UserGender),
1362
1367
  }
1363
1368
  })
1364
1369
  ], LeaguePlayer);
@@ -4037,6 +4042,10 @@ class MediaApi {
4037
4042
  if (filters.teamId) {
4038
4043
  params = params.set('team_id', filters.teamId.toString());
4039
4044
  }
4045
+ if (filters.statuses) {
4046
+ const statuses = filters.statuses.map(i => GameStatuses[i]);
4047
+ params = params.set('statuses', statuses.join(','));
4048
+ }
4040
4049
  return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/media/`, { params, observe: 'response' })
4041
4050
  .pipe(map(response => ({
4042
4051
  total: +response.headers.get('X-Page-Count'),
@@ -4547,6 +4556,33 @@ let RugbyGameStatistic = class RugbyGameStatistic extends GameStatisticBase {
4547
4556
  get gameMinutes() {
4548
4557
  return Math.floor(this.gameTime / 60);
4549
4558
  }
4559
+ get conversionKicks() {
4560
+ return (this.conversionGoals || 0) + (this.conversionMisses || 0);
4561
+ }
4562
+ get conversionGoalsPercent() {
4563
+ if (!this.conversionKicks) {
4564
+ return 0;
4565
+ }
4566
+ return Math.floor(1000 * this.conversionGoals / this.conversionKicks) / 10;
4567
+ }
4568
+ get penaltyKicksOnGoal() {
4569
+ return (this.penaltyGoals || 0) + (this.penaltyMisses || 0);
4570
+ }
4571
+ get penaltyGoalsPercent() {
4572
+ if (!this.penaltyKicksOnGoal) {
4573
+ return 0;
4574
+ }
4575
+ return Math.floor(1000 * this.penaltyGoals / this.penaltyKicksOnGoal) / 10;
4576
+ }
4577
+ get dropGoalKicks() {
4578
+ return (this.dropGoals || 0) + (this.dropGoalMisses || 0);
4579
+ }
4580
+ get dropGoalsPercent() {
4581
+ if (!this.dropGoalKicks) {
4582
+ return 0;
4583
+ }
4584
+ return Math.floor(1000 * this.dropGoals / this.dropGoalKicks) / 10;
4585
+ }
4550
4586
  get totalGoals() {
4551
4587
  return (this.conversionGoals || 0) + (this.dropGoals || 0) + (this.penaltyGoals || 0);
4552
4588
  }
@@ -6020,6 +6056,14 @@ class VolleyballGameApi extends GameBaseApi {
6020
6056
  }).toPromise();
6021
6057
  });
6022
6058
  }
6059
+ downloadProtocolAdvanced(gameId, format) {
6060
+ return __awaiter(this, void 0, void 0, function* () {
6061
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_volleyball_game/${gameId}/game_protocol_advanced/`, {
6062
+ params: new HttpParams().set('file_type', format),
6063
+ responseType: 'blob'
6064
+ }).toPromise();
6065
+ });
6066
+ }
6023
6067
  downloadProtocol(gameId, format) {
6024
6068
  return __awaiter(this, void 0, void 0, function* () {
6025
6069
  return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_volleyball_game/${gameId}/game_protocol/`, {
@@ -6352,7 +6396,7 @@ let WaterpoloGameStatistic = class WaterpoloGameStatistic extends GameStatisticB
6352
6396
  return this.ppShots + this.evShots + this.shShots;
6353
6397
  }
6354
6398
  get totalShots() {
6355
- return this.shots + (this.shootoutAttempts || 0);
6399
+ return this.shots + this.shootoutShots;
6356
6400
  }
6357
6401
  get faceOffs() {
6358
6402
  return (this.faceOffWins || 0) + (this.faceOffLosses || 0);
@@ -6401,8 +6445,7 @@ let WaterpoloGameStatistic = class WaterpoloGameStatistic extends GameStatisticB
6401
6445
  this.freeKickShotsBlocked + this.cornerShotsBlocked;
6402
6446
  }
6403
6447
  get totalFouls() {
6404
- return (this.fouls || 0) + (this.penaltyFouls || 0) + (this.attackFouls || 0) + (this.personalFouls || 0) +
6405
- (this.minorPenalties || 0) + (this.majorPenalties || 0) + (this.matchPenalties || 0);
6448
+ return (this.fouls || 0) + (this.personalFouls || 0);
6406
6449
  }
6407
6450
  get totalPenalties() {
6408
6451
  return (this.minorPenalties || 0) + (this.majorPenalties || 0) + (this.matchPenalties || 0);
@@ -6715,6 +6758,14 @@ class PublicTeamApi {
6715
6758
  const params = new HttpParams().set('league_id', leagueId.toString());
6716
6759
  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();
6717
6760
  }
6761
+ getUsers(teamId) {
6762
+ return __awaiter(this, void 0, void 0, function* () {
6763
+ return this.httpClient
6764
+ .get(`${this.configService.get('apiUrl')}/api/v1/public_team/${teamId}/users/`)
6765
+ .pipe(map(data => data.map(item => new TeamUser(item))))
6766
+ .toPromise();
6767
+ });
6768
+ }
6718
6769
  }
6719
6770
  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 });
6720
6771
  PublicTeamApi.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PublicTeamApi, providedIn: 'root' });
@@ -6922,8 +6973,8 @@ const WaterpoloGameLogTypeLocalization = {
6922
6973
  [WaterpoloGameLogTypes.assist]: 'Голевая передача',
6923
6974
  [WaterpoloGameLogTypes.block_shot]: 'Блокировка броска',
6924
6975
  [WaterpoloGameLogTypes.minor_penalty]: 'Удаление на 20 сек.',
6925
- [WaterpoloGameLogTypes.major_penalty]: 'Удаление + 4 мин. штраф',
6926
- [WaterpoloGameLogTypes.match_penalty]: 'Удаление до конца матча',
6976
+ [WaterpoloGameLogTypes.major_penalty]: 'Удаление + 20 сек. штраф',
6977
+ [WaterpoloGameLogTypes.match_penalty]: 'Удаление + 4 мин. штраф',
6927
6978
  [WaterpoloGameLogTypes.foul]: 'Фол',
6928
6979
  [WaterpoloGameLogTypes.penalty_foul]: 'Фол пенальти',
6929
6980
  [WaterpoloGameLogTypes.attack_foul]: 'Фол в нападении',
@@ -7291,9 +7342,10 @@ TournamentJoin1x1Data = __decorate([
7291
7342
  ], TournamentJoin1x1Data);
7292
7343
 
7293
7344
  class CentrifugoService {
7294
- constructor(httpClient, configService) {
7345
+ constructor(httpClient, configService, platformId) {
7295
7346
  this.httpClient = httpClient;
7296
7347
  this.configService = configService;
7348
+ this.platformId = platformId;
7297
7349
  this.channels$ = {};
7298
7350
  this.subscriptions = {};
7299
7351
  this.connectedSubject = new BehaviorSubject(false);
@@ -7302,6 +7354,11 @@ class CentrifugoService {
7302
7354
  return this.connectedSubject;
7303
7355
  }
7304
7356
  listen(channel) {
7357
+ if (!isPlatformBrowser(this.platformId)) {
7358
+ return new Observable(observer => {
7359
+ observer.error('Centrifugo is not available in ssr mode');
7360
+ });
7361
+ }
7305
7362
  if (channel in this.channels$) {
7306
7363
  return this.channels$[channel];
7307
7364
  }
@@ -7322,6 +7379,11 @@ class CentrifugoService {
7322
7379
  }
7323
7380
  }
7324
7381
  connect() {
7382
+ if (!isPlatformBrowser(this.platformId)) {
7383
+ return new Observable(observer => {
7384
+ observer.error('Centrifugo is not available in ssr mode');
7385
+ });
7386
+ }
7325
7387
  if (!this.initializeEngineSubject) {
7326
7388
  this.initializeEngineSubject = new ReplaySubject(1);
7327
7389
  this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/centrifugo_v2/`)
@@ -7346,6 +7408,9 @@ class CentrifugoService {
7346
7408
  }
7347
7409
  publish(channel, message) {
7348
7410
  return __awaiter(this, void 0, void 0, function* () {
7411
+ if (!isPlatformBrowser(this.platformId)) {
7412
+ throw new Error('Centrifugo is not available in ssr mode');
7413
+ }
7349
7414
  const connected = yield this.connect().pipe(filter(item => Boolean(item)), take(1)).toPromise();
7350
7415
  if (!connected) {
7351
7416
  throw new Error('Centrifuge connection error');
@@ -7385,12 +7450,17 @@ class CentrifugoService {
7385
7450
  this.channels$[channel].next(message);
7386
7451
  }
7387
7452
  }
7388
- 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 });
7453
+ 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 });
7389
7454
  CentrifugoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: CentrifugoService, providedIn: 'root' });
7390
7455
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: CentrifugoService, decorators: [{
7391
7456
  type: Injectable,
7392
7457
  args: [{ providedIn: 'root' }]
7393
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: ConfigService }]; } });
7458
+ }], ctorParameters: function () {
7459
+ return [{ type: i1.HttpClient }, { type: ConfigService }, { type: undefined, decorators: [{
7460
+ type: Inject,
7461
+ args: [PLATFORM_ID]
7462
+ }] }];
7463
+ } });
7394
7464
 
7395
7465
  class BaseController {
7396
7466
  constructor() {