@glissandoo/lib 1.103.8 → 1.104.1

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.8",
3
+ "version": "1.104.1",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -55,7 +55,7 @@
55
55
  "husky": "^8.0.1",
56
56
  "lint-staged": "^12.4.1",
57
57
  "prettier": "^2.2.1",
58
- "supabase": "^2.30.4",
58
+ "supabase": "^2.20.12",
59
59
  "typescript": "^4.9.4"
60
60
  },
61
61
  "lint-staged": {
@@ -31,50 +31,7 @@ export type Database = {
31
31
  Tables: {
32
32
  event: {
33
33
  Row: {
34
- activeInvitationLink: boolean;
35
- coverURL: string | null;
36
- createdAt: string;
37
- createdOn: Database['public']['Enums']['created_on'];
38
- datetime: string;
39
- datetimeEnd: string;
40
- deletedAt: string | null;
41
- deletedBy: string | null;
42
- description: string | null;
43
- descriptionSlate: Json[];
44
- displayName: string | null;
45
- id: string;
46
- invitationLink: string | null;
47
- locality: string | null;
48
- location: unknown;
49
- location_lonlat: Database['public']['CompositeTypes']['lonlat'];
50
- maxAttendance: number | null;
51
- notifyAt: string;
52
- online: boolean;
53
- owner: string | null;
54
- playerIds: string[];
55
- players: Json;
56
34
  promoter: string | null;
57
- relEvents: string[];
58
- repeat: Json | null;
59
- repertory: Json;
60
- repertoryIds: string[];
61
- responseDeadline: Json;
62
- responseDeadlineAt: string;
63
- rollCalledAt: string | null;
64
- rollCalledBy: string | null;
65
- rollCallHistory: Json[];
66
- rollCallReminderAt: string | null;
67
- selectionMode: Database['public']['Enums']['event_selection_mode'] | null;
68
- selectionModeClosedAt: string | null;
69
- shortDynamicLink: string | null;
70
- sites: boolean;
71
- stage: Json | null;
72
- stageTemplateId: string | null;
73
- templateId: string | null;
74
- timezone: string;
75
- type: Database['public']['Enums']['event_type'];
76
- updatedAt: string;
77
- videoURL: string | null;
78
35
  };
79
36
  Insert: {
80
37
  activeInvitationLink: boolean;
@@ -180,48 +137,7 @@ export type Database = {
180
137
  };
181
138
  group: {
182
139
  Row: {
183
- activeInvitationLink: boolean;
184
- addresses: Json[];
185
- administrators: string[];
186
- config: Json;
187
- configSites: Json;
188
- country: string;
189
- createdAt: string;
190
- createdOn: Database['public']['Enums']['created_on'];
191
- customerId: string | null;
192
- deletedAt: string | null;
193
- deletedBy: string | null;
194
- description: string | null;
195
- displayName: string;
196
140
  id: string;
197
- instruments: Json;
198
- intercomId: string | null;
199
- invitationEmails: string[];
200
- invitationLink: string | null;
201
- locality: string;
202
- location: unknown;
203
- location_lonlat: Database['public']['CompositeTypes']['lonlat'];
204
- metadata: Json;
205
- musicStyle: string;
206
- onboardingMessages: Json[];
207
- owner: string | null;
208
- partnershipId: string | null;
209
- photoURL: string;
210
- planId: Database['public']['Enums']['group_plan'];
211
- playerIds: string[];
212
- players: Json;
213
- repertoireTags: Json;
214
- rollcallLink: string | null;
215
- satisfactionIndex: Json;
216
- shortDynamicLink: string | null;
217
- socialNetworks: Json | null;
218
- status: Database['public']['Enums']['group_status'];
219
- subscriptionId: string | null;
220
- templates: Json;
221
- trialEndAt: string | null;
222
- updatedAt: string;
223
- username: string;
224
- visitedDashboardAt: Json;
225
141
  };
226
142
  Insert: {
227
143
  activeInvitationLink: boolean;
@@ -504,7 +420,6 @@ export type Database = {
504
420
  created_at: string | null;
505
421
  id: string;
506
422
  last_accessed_at: string | null;
507
- level: number | null;
508
423
  metadata: Json | null;
509
424
  name: string | null;
510
425
  owner: string | null;
@@ -519,7 +434,6 @@ export type Database = {
519
434
  created_at?: string | null;
520
435
  id?: string;
521
436
  last_accessed_at?: string | null;
522
- level?: number | null;
523
437
  metadata?: Json | null;
524
438
  name?: string | null;
525
439
  owner?: string | null;
@@ -534,7 +448,6 @@ export type Database = {
534
448
  created_at?: string | null;
535
449
  id?: string;
536
450
  last_accessed_at?: string | null;
537
- level?: number | null;
538
451
  metadata?: Json | null;
539
452
  name?: string | null;
540
453
  owner?: string | null;
@@ -554,38 +467,6 @@ export type Database = {
554
467
  }
555
468
  ];
556
469
  };
557
- prefixes: {
558
- Row: {
559
- bucket_id: string;
560
- created_at: string | null;
561
- level: number;
562
- name: string;
563
- updated_at: string | null;
564
- };
565
- Insert: {
566
- bucket_id: string;
567
- created_at?: string | null;
568
- level?: number;
569
- name: string;
570
- updated_at?: string | null;
571
- };
572
- Update: {
573
- bucket_id?: string;
574
- created_at?: string | null;
575
- level?: number;
576
- name?: string;
577
- updated_at?: string | null;
578
- };
579
- Relationships: [
580
- {
581
- foreignKeyName: 'prefixes_bucketId_fkey';
582
- columns: ['bucket_id'];
583
- isOneToOne: false;
584
- referencedRelation: 'buckets';
585
- referencedColumns: ['id'];
586
- }
587
- ];
588
- };
589
470
  s3_multipart_uploads: {
590
471
  Row: {
591
472
  bucket_id: string;
@@ -689,13 +570,6 @@ export type Database = {
689
570
  [_ in never]: never;
690
571
  };
691
572
  Functions: {
692
- add_prefixes: {
693
- Args: {
694
- _bucket_id: string;
695
- _name: string;
696
- };
697
- Returns: undefined;
698
- };
699
573
  can_insert_object: {
700
574
  Args: {
701
575
  bucketid: string;
@@ -705,13 +579,6 @@ export type Database = {
705
579
  };
706
580
  Returns: undefined;
707
581
  };
708
- delete_prefix: {
709
- Args: {
710
- _bucket_id: string;
711
- _name: string;
712
- };
713
- Returns: boolean;
714
- };
715
582
  extension: {
716
583
  Args: {
717
584
  name: string;
@@ -730,24 +597,6 @@ export type Database = {
730
597
  };
731
598
  Returns: string[];
732
599
  };
733
- get_level: {
734
- Args: {
735
- name: string;
736
- };
737
- Returns: number;
738
- };
739
- get_prefix: {
740
- Args: {
741
- name: string;
742
- };
743
- Returns: string;
744
- };
745
- get_prefixes: {
746
- Args: {
747
- name: string;
748
- };
749
- Returns: string[];
750
- };
751
600
  get_size_by_bucket: {
752
601
  Args: Record<PropertyKey, never>;
753
602
  Returns: {
@@ -810,63 +659,6 @@ export type Database = {
810
659
  metadata: Json;
811
660
  }[];
812
661
  };
813
- search_legacy_v1: {
814
- Args: {
815
- prefix: string;
816
- bucketname: string;
817
- limits?: number;
818
- levels?: number;
819
- offsets?: number;
820
- search?: string;
821
- sortcolumn?: string;
822
- sortorder?: string;
823
- };
824
- Returns: {
825
- name: string;
826
- id: string;
827
- updated_at: string;
828
- created_at: string;
829
- last_accessed_at: string;
830
- metadata: Json;
831
- }[];
832
- };
833
- search_v1_optimised: {
834
- Args: {
835
- prefix: string;
836
- bucketname: string;
837
- limits?: number;
838
- levels?: number;
839
- offsets?: number;
840
- search?: string;
841
- sortcolumn?: string;
842
- sortorder?: string;
843
- };
844
- Returns: {
845
- name: string;
846
- id: string;
847
- updated_at: string;
848
- created_at: string;
849
- last_accessed_at: string;
850
- metadata: Json;
851
- }[];
852
- };
853
- search_v2: {
854
- Args: {
855
- prefix: string;
856
- bucket_name: string;
857
- limits?: number;
858
- levels?: number;
859
- start_after?: string;
860
- };
861
- Returns: {
862
- key: string;
863
- name: string;
864
- id: string;
865
- updated_at: string;
866
- created_at: string;
867
- metadata: Json;
868
- }[];
869
- };
870
662
  };
871
663
  Enums: {
872
664
  [_ in never]: never;