@glissandoo/lib 1.103.7 → 1.104.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.
@@ -8,8 +8,9 @@ const orders_1 = require("../../helpers/instruments/orders");
8
8
  const orders_2 = require("../../helpers/musicStyles/orders");
9
9
  const lang_1 = require("../../lang");
10
10
  const basic_1 = __importDefault(require("./Player/basic"));
11
+ const types_1 = require("./Player/types");
11
12
  const promoter_1 = __importDefault(require("./promoter"));
12
- const types_1 = require("./types");
13
+ const types_2 = require("./types");
13
14
  class Evento extends promoter_1.default {
14
15
  constructor(doc, lang = lang_1.defaultLocale) {
15
16
  super(doc, lang);
@@ -121,12 +122,12 @@ class Evento extends promoter_1.default {
121
122
  }
122
123
  get statusByTime() {
123
124
  if (this.isOutDate) {
124
- return types_1.EventStatusByTime.Past;
125
+ return types_2.EventStatusByTime.Past;
125
126
  }
126
127
  if (this.isHappening) {
127
- return types_1.EventStatusByTime.Now;
128
+ return types_2.EventStatusByTime.Now;
128
129
  }
129
- return types_1.EventStatusByTime.Future;
130
+ return types_2.EventStatusByTime.Future;
130
131
  }
131
132
  get repertoryList() {
132
133
  const repertory = Object.keys(this.repertory).map((themeId) => ({
@@ -188,7 +189,7 @@ class Evento extends promoter_1.default {
188
189
  }
189
190
  get responseDeadline() {
190
191
  return (this.data.responseDeadline || {
191
- option: types_1.EventResponseDeadlineOptions.BeforeEvent,
192
+ option: types_2.EventResponseDeadlineOptions.BeforeEvent,
192
193
  customAt: null,
193
194
  });
194
195
  }
@@ -199,10 +200,10 @@ class Evento extends promoter_1.default {
199
200
  return this.data.selectionModeClosedAt || null;
200
201
  }
201
202
  get isSelectionModeClosed() {
202
- return (!(0, lodash_1.isNull)(this.selectionModeClosedAt) && this.selectionMode === types_1.EventSelectionMode.Closed);
203
+ return (!(0, lodash_1.isNull)(this.selectionModeClosedAt) && this.selectionMode === types_2.EventSelectionMode.Closed);
203
204
  }
204
205
  get isSelectionModeOpen() {
205
- return (0, lodash_1.isNull)(this.selectionModeClosedAt) && this.selectionMode === types_1.EventSelectionMode.Open;
206
+ return (0, lodash_1.isNull)(this.selectionModeClosedAt) && this.selectionMode === types_2.EventSelectionMode.Open;
206
207
  }
207
208
  get sites() {
208
209
  return this.data.sites || false;
@@ -213,5 +214,26 @@ class Evento extends promoter_1.default {
213
214
  get attachmentsPath() {
214
215
  return this.data.attachmentsPath || [];
215
216
  }
217
+ get questions() {
218
+ if (!this.data.questions) {
219
+ return {
220
+ [types_1.EventPlayerStatus.Confirmed]: [],
221
+ [types_1.EventPlayerStatus.Declined]: [],
222
+ };
223
+ }
224
+ const confirmedQuestions = types_1.EventPlayerStatus.Confirmed in this.data.questions
225
+ ? this.data.questions[types_1.EventPlayerStatus.Confirmed]
226
+ : [];
227
+ const declinedQuestions = types_1.EventPlayerStatus.Declined in this.data.questions
228
+ ? this.data.questions[types_1.EventPlayerStatus.Declined]
229
+ : [];
230
+ return {
231
+ [types_1.EventPlayerStatus.Confirmed]: confirmedQuestions,
232
+ [types_1.EventPlayerStatus.Declined]: declinedQuestions,
233
+ };
234
+ }
235
+ getQuestionsByStatus(status) {
236
+ return this.questions[status] || [];
237
+ }
216
238
  }
217
239
  exports.default = Evento;
@@ -5,7 +5,7 @@ import { StageTemplate } from '../Group/StageTemplate/types';
5
5
  import { GroupBasicData } from '../Group/types';
6
6
  import { PlayerBasicData } from '../Player/types';
7
7
  import { ThemeBasicData } from '../Repertory/types';
8
- import { EventPlayerReason, EventPlayerStatus } from './Player/types';
8
+ import { EventPlayerAnswers, EventPlayerReason, EventPlayerStatus } from './Player/types';
9
9
  export declare enum EventResponseDeadlineOptions {
10
10
  BeforeEvent = "BeforeEvent",
11
11
  OneHourBefore = "OneHourBefore",
@@ -51,15 +51,28 @@ export interface EventRollcallHistory {
51
51
  changedAt: Timestamp;
52
52
  changedBy: string;
53
53
  }
54
+ export interface EventQuestions {
55
+ id: string;
56
+ title: string;
57
+ answers: {
58
+ id: string;
59
+ text: string;
60
+ }[];
61
+ allowNotes: boolean;
62
+ multiselect: boolean;
63
+ order: number;
64
+ }
54
65
  export interface EventPlayerBasicData extends PlayerBasicData {
55
66
  isGuest: boolean;
56
67
  note?: string | null;
57
- reason?: EventPlayerReason | null;
68
+ questions?: EventPlayerAnswers[];
58
69
  status: EventPlayerStatus | null;
59
70
  rollcall: EventPlayerStatus | null;
71
+ selected: boolean | null;
72
+ /** @deprecated use questions */
73
+ reason?: EventPlayerReason | null;
60
74
  /** @deprecated use status */
61
75
  interested: true | null;
62
- selected: boolean | null;
63
76
  }
64
77
  export interface AEventPlayerBasicData extends EventPlayerBasicData {
65
78
  id: string;
@@ -121,6 +134,7 @@ export interface EventData extends EventPromoterData {
121
134
  sites: boolean;
122
135
  imagesPath: string[];
123
136
  attachmentsPath: string[];
137
+ questions: Record<EventPlayerStatus, EventQuestions[]>;
124
138
  readonly owner: DocumentReference;
125
139
  readonly createdAt: Timestamp;
126
140
  readonly createdOn: CreatedOn;
@@ -1,6 +1,7 @@
1
1
  import { DocumentReference } from '@google-cloud/firestore';
2
2
  import { PlansGroup } from '../../helpers/plans';
3
3
  import { LanguagesTypes } from '../../lang';
4
+ import { EventPlayerStatus } from '../Evento/Player/types';
4
5
  import { DocumentModel } from '../Model';
5
6
  import GroupBasic from './basic';
6
7
  import { CustomGroupInstrument, GroupConfigShowAttendanceToMembers, GroupData, GroupStatus, SocialNetwork } from './types';
@@ -98,4 +99,31 @@ export default class Group extends GroupBasic<GroupData> {
98
99
  get onboardingMessages(): import("./types").GroupOnboardingMessage[];
99
100
  get rollcallLink(): string | null;
100
101
  get subscriptionId(): string | null;
102
+ get questions(): Record<string, import("./types").GroupEventQuestion>;
103
+ get questionsList(): {
104
+ updatedBy: string;
105
+ title: string;
106
+ status: EventPlayerStatus;
107
+ isDefault: boolean;
108
+ answers: {
109
+ id: string;
110
+ text: string;
111
+ }[];
112
+ allowNotes: boolean;
113
+ multiselect: boolean;
114
+ id: string;
115
+ }[];
116
+ getDefaultQuestion(status: EventPlayerStatus): {
117
+ updatedBy: string;
118
+ title: string;
119
+ status: EventPlayerStatus;
120
+ isDefault: boolean;
121
+ answers: {
122
+ id: string;
123
+ text: string;
124
+ }[];
125
+ allowNotes: boolean;
126
+ multiselect: boolean;
127
+ id: string;
128
+ } | undefined;
101
129
  }
@@ -7,12 +7,12 @@ const date_fns_1 = require("date-fns");
7
7
  const lodash_1 = require("lodash");
8
8
  const collections_1 = require("../../helpers/collections");
9
9
  const glissandooAdmin_1 = require("../../helpers/glissandooAdmin");
10
+ const orders_1 = require("../../helpers/instruments/orders");
10
11
  const objects_1 = require("../../helpers/objects");
11
12
  const plans_1 = require("../../helpers/plans");
12
13
  const lang_1 = require("../../lang");
13
14
  const basic_1 = __importDefault(require("./basic"));
14
15
  const types_1 = require("./types");
15
- const orders_1 = require("../../helpers/instruments/orders");
16
16
  class Group extends basic_1.default {
17
17
  constructor(doc, lang = lang_1.defaultLocale) {
18
18
  super(doc, lang);
@@ -253,5 +253,17 @@ class Group extends basic_1.default {
253
253
  get subscriptionId() {
254
254
  return this.data.subscriptionId || null;
255
255
  }
256
+ get questions() {
257
+ return this.data.questions || {};
258
+ }
259
+ get questionsList() {
260
+ return Object.entries(this.questions).map(([id, answers]) => ({
261
+ id,
262
+ ...answers,
263
+ }));
264
+ }
265
+ getDefaultQuestion(status) {
266
+ return this.questionsList.find((q) => q.isDefault && q.status === status);
267
+ }
256
268
  }
257
269
  exports.default = Group;
@@ -3,6 +3,7 @@ import { CustomInstrumentId, DefaultInstrumentId } from '../../helpers/instrumen
3
3
  import { MusicStyleType } from '../../helpers/musicStyles';
4
4
  import { PlansGroup } from '../../helpers/plans';
5
5
  import { CreatedOn } from '../../helpers/types';
6
+ import { EventPlayerStatus } from '../Evento/Player/types';
6
7
  import { EventType } from '../Evento/types';
7
8
  import { PlayerBasicData } from '../Player/types';
8
9
  export interface GroupOnboardingMessage {
@@ -130,6 +131,21 @@ export interface AGroupCustomInstrument extends CustomGroupInstrument {
130
131
  id: CustomInstrumentId;
131
132
  }
132
133
  export type AGroupInstrument = AGroupDefaultInstrument | AGroupCustomInstrument;
134
+ export interface GroupEventQuestion {
135
+ updatedBy: string;
136
+ title: string;
137
+ status: EventPlayerStatus;
138
+ isDefault: boolean;
139
+ answers: {
140
+ id: string;
141
+ text: string;
142
+ }[];
143
+ allowNotes: boolean;
144
+ multiselect: boolean;
145
+ }
146
+ export interface AGroupEventQuestion extends GroupEventQuestion {
147
+ id: string;
148
+ }
133
149
  export type GroupInstruments = Partial<Record<DefaultInstrumentId, DefaultGroupInstrument>> & Record<CustomInstrumentId, CustomGroupInstrument>;
134
150
  export interface GroupData extends GroupBasicData {
135
151
  playerIds: string[];
@@ -169,6 +185,7 @@ export interface GroupData extends GroupBasicData {
169
185
  visitedDashboardAt: Record<string, Timestamp>;
170
186
  onboardingMessages: GroupOnboardingMessage[];
171
187
  subscriptionId: string | null;
188
+ questions: Record<string, GroupEventQuestion>;
172
189
  readonly createdOn: CreatedOn;
173
190
  readonly owner: DocumentReference;
174
191
  readonly createdAt: Timestamp;
@@ -44,6 +44,7 @@ export declare enum NotificationActions {
44
44
  PerformanceEditResponseDeadline = "performance.edit.responseDeadline",
45
45
  PerformanceEditImages = "performance.edit.images",
46
46
  PerformanceEditAttachments = "performance.edit.attachments",
47
+ PerformanceEditQuestions = "performance.edit.questions",
47
48
  PerformanceReminderDatetimeToConfirmed = "performance.reminderDatetime.confirmed",
48
49
  PerformanceReminderDeadlineSoonToPending = "performance.reminderDeadlineSoon.pending",
49
50
  PerformanceReminderDeadlineEndedInSelectionModeOpen = "performance.reminderDeadlineEnded.selectionModeOpen",
@@ -74,6 +75,7 @@ export declare enum NotificationActions {
74
75
  PracticeEditResponseDeadline = "practice.edit.responseDeadline",
75
76
  PracticeEditImages = "practice.edit.images",
76
77
  PracticeEditAttachments = "practice.edit.attachments",
78
+ PracticeEditQuestions = "practice.edit.questions",
77
79
  PracticeReminderDatetimeToConfirmed = "practice.reminderDatetime.confirmed",
78
80
  PracticeReminderDeadlineSoonToPending = "practice.reminderDeadlineSoon.pending",
79
81
  PracticeReminderDeadlineEndedInSelectionModeOpen = "practice.reminderDeadlineEnded.selectionModeOpen",
@@ -94,6 +96,7 @@ export declare enum NotificationActions {
94
96
  PracticesEditResponseDeadline = "practices.edit.responseDeadline",
95
97
  PracticesEditImages = "practices.edit.images",
96
98
  PracticesEditAttachments = "practices.edit.attachments",
99
+ PracticesEditQuestions = "practices.edit.questions",
97
100
  PracticesPlayersAdd = "practices.players.add",
98
101
  PracticesPlayersRemove = "practices.players.remove",
99
102
  ThemeClaimNew = "theme.claim.new",
@@ -41,6 +41,7 @@ var NotificationActions;
41
41
  NotificationActions["PerformanceEditResponseDeadline"] = "performance.edit.responseDeadline";
42
42
  NotificationActions["PerformanceEditImages"] = "performance.edit.images";
43
43
  NotificationActions["PerformanceEditAttachments"] = "performance.edit.attachments";
44
+ NotificationActions["PerformanceEditQuestions"] = "performance.edit.questions";
44
45
  NotificationActions["PerformanceReminderDatetimeToConfirmed"] = "performance.reminderDatetime.confirmed";
45
46
  NotificationActions["PerformanceReminderDeadlineSoonToPending"] = "performance.reminderDeadlineSoon.pending";
46
47
  NotificationActions["PerformanceReminderDeadlineEndedInSelectionModeOpen"] = "performance.reminderDeadlineEnded.selectionModeOpen";
@@ -71,6 +72,7 @@ var NotificationActions;
71
72
  NotificationActions["PracticeEditResponseDeadline"] = "practice.edit.responseDeadline";
72
73
  NotificationActions["PracticeEditImages"] = "practice.edit.images";
73
74
  NotificationActions["PracticeEditAttachments"] = "practice.edit.attachments";
75
+ NotificationActions["PracticeEditQuestions"] = "practice.edit.questions";
74
76
  NotificationActions["PracticeReminderDatetimeToConfirmed"] = "practice.reminderDatetime.confirmed";
75
77
  NotificationActions["PracticeReminderDeadlineSoonToPending"] = "practice.reminderDeadlineSoon.pending";
76
78
  NotificationActions["PracticeReminderDeadlineEndedInSelectionModeOpen"] = "practice.reminderDeadlineEnded.selectionModeOpen";
@@ -91,6 +93,7 @@ var NotificationActions;
91
93
  NotificationActions["PracticesEditResponseDeadline"] = "practices.edit.responseDeadline";
92
94
  NotificationActions["PracticesEditImages"] = "practices.edit.images";
93
95
  NotificationActions["PracticesEditAttachments"] = "practices.edit.attachments";
96
+ NotificationActions["PracticesEditQuestions"] = "practices.edit.questions";
94
97
  NotificationActions["PracticesPlayersAdd"] = "practices.players.add";
95
98
  NotificationActions["PracticesPlayersRemove"] = "practices.players.remove";
96
99
  NotificationActions["ThemeClaimNew"] = "theme.claim.new";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.103.7",
3
+ "version": "1.104.0",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",