@glissandoo/lib 1.51.1 → 1.51.2

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.
@@ -19,4 +19,5 @@ export default class EventoPlayer extends PlayerBasic<EventPlayerData> {
19
19
  get history(): import("./types").EventPlayerHistory[];
20
20
  get interested(): true | null;
21
21
  get selected(): boolean | null;
22
+ get isActive(): boolean;
22
23
  }
@@ -56,5 +56,8 @@ class EventoPlayer extends basic_1.default {
56
56
  get selected() {
57
57
  return !(0, lodash_1.isUndefined)(this.data.selected) ? this.data.selected : null;
58
58
  }
59
+ get isActive() {
60
+ return this.exists && this.selected !== false;
61
+ }
59
62
  }
60
63
  exports.default = EventoPlayer;
@@ -1,3 +1,4 @@
1
+ import { InstrumentId } from '../../helpers/instruments';
1
2
  import { LanguagesTypes } from '../../lang';
2
3
  import { DocumentReference, DocumentSnapshot } from '../../types/firestore';
3
4
  import { EventPlayerStatus } from './Player/types';
@@ -45,10 +46,9 @@ export default class Evento extends EventoPromoter<EventData> {
45
46
  tags: string[];
46
47
  media: import("../Repertory/types").ThemeMediaType | null;
47
48
  }[];
48
- get activePlayers(): string[];
49
- playersList({ showAll, order }: {
49
+ playersList({ showAll, order }?: {
50
50
  showAll?: boolean;
51
- order?: string[];
51
+ order?: InstrumentId[];
52
52
  }): {
53
53
  note?: string | null | undefined;
54
54
  reason?: import("./Player/types").EventPlayerReason | null | undefined;
@@ -56,7 +56,7 @@ export default class Evento extends EventoPromoter<EventData> {
56
56
  rollcall: EventPlayerStatus | null;
57
57
  interested: true | null;
58
58
  selected: boolean | null;
59
- mainInstrument: import("../../helpers/instruments").InstrumentId;
59
+ mainInstrument: InstrumentId;
60
60
  username: string;
61
61
  displayName: string;
62
62
  photoURL: string;
@@ -72,7 +72,7 @@ export default class Evento extends EventoPromoter<EventData> {
72
72
  get templateId(): string | null;
73
73
  get repeat(): import("./types").EventRepeatType | null;
74
74
  isPlayer: (userId: string) => boolean;
75
- isPlayerActive: (userId: string) => boolean;
75
+ isPlayerActive: (userId: string) => boolean | null;
76
76
  getPlayer: (userId: string) => EventPlayerBasicData | null;
77
77
  isPlayerConfirmed(player: EventPlayerBasicData): boolean;
78
78
  isPlayerDeclined(player: EventPlayerBasicData): boolean;
@@ -15,13 +15,11 @@ class Evento extends promoter_1.default {
15
15
  constructor(doc, lang = lang_1.defaultLocale) {
16
16
  super(doc, lang);
17
17
  this.isPlayer = (userId) => {
18
- return this.activePlayers.includes(userId);
18
+ return this.playerIds.includes(userId);
19
19
  };
20
20
  this.isPlayerActive = (userId) => {
21
21
  const player = this.getPlayer(userId);
22
- if (!player)
23
- return false;
24
- return this.isSelectionModeClose ? !!player.selected : true;
22
+ return player && player.selected !== false;
25
23
  };
26
24
  this.getPlayer = (userId) => {
27
25
  return userId in this.players ? this.players[userId] : null;
@@ -137,11 +135,8 @@ class Evento extends promoter_1.default {
137
135
  }));
138
136
  return (0, lodash_1.orderBy)(repertory, 'order', 'asc');
139
137
  }
140
- get activePlayers() {
141
- return Object.keys(this.players) || [];
142
- }
143
- playersList({ showAll, order }) {
144
- const players = this.activePlayers.map((playerId) => ({
138
+ playersList({ showAll, order } = {}) {
139
+ const players = this.playerIds.map((playerId) => ({
145
140
  id: playerId,
146
141
  ...this.players[playerId],
147
142
  }));
@@ -153,19 +148,19 @@ class Evento extends promoter_1.default {
153
148
  return orderedPlayers.filter((player) => this.isPlayerActive(player.id));
154
149
  }
155
150
  get confirmedPlayers() {
156
- return this.activePlayers.filter((playerId) => this.isPlayerConfirmed(this.players[playerId]));
151
+ return this.playerIds.filter((playerId) => this.isPlayerConfirmed(this.players[playerId]));
157
152
  }
158
153
  get declinedPlayers() {
159
- return this.activePlayers.filter((playerId) => this.isPlayerDeclined(this.players[playerId]));
154
+ return this.playerIds.filter((playerId) => this.isPlayerDeclined(this.players[playerId]));
160
155
  }
161
156
  get pendingPlayers() {
162
- return this.activePlayers.filter((playerId) => !this.players[playerId].status);
157
+ return this.playerIds.filter((playerId) => !this.players[playerId].status);
163
158
  }
164
159
  get confirmedRollCallPlayers() {
165
- return this.activePlayers.filter((playerId) => this.isPlayerRollCallConfirmed(this.players[playerId]));
160
+ return this.playerIds.filter((playerId) => this.isPlayerRollCallConfirmed(this.players[playerId]));
166
161
  }
167
162
  get declinedRollCallPlayers() {
168
- return this.activePlayers.filter((playerId) => this.isPlayerRollCallDeclined(this.players[playerId]));
163
+ return this.playerIds.filter((playerId) => this.isPlayerRollCallDeclined(this.players[playerId]));
169
164
  }
170
165
  get isRollCalled() {
171
166
  return this.rollCalledAt !== null;
@@ -105,7 +105,7 @@ class User extends basic_1.default {
105
105
  return this.data.appConfig[value];
106
106
  }
107
107
  getNotificationSetting(key) {
108
- return this.data.notificationSettings[key] || false;
108
+ return this.data.notificationSettings[key];
109
109
  }
110
110
  get registerVia() {
111
111
  return this.data.registerVia || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.51.1",
3
+ "version": "1.51.2",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",