@myclub_se/data-access 3.1.1 → 3.1.3

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 (29) hide show
  1. package/esm2022/lib/api-models/api-member-team.mjs +1 -1
  2. package/esm2022/lib/api-models/api-search-team.mjs +1 -1
  3. package/esm2022/lib/authentication/authentication.interceptor.mjs +15 -28
  4. package/esm2022/lib/models/member-team.mjs +4 -2
  5. package/esm2022/lib/models/search-team.mjs +4 -2
  6. package/esm2022/lib/services/activity.service.mjs +84 -50
  7. package/esm2022/lib/services/bookable.service.mjs +113 -67
  8. package/esm2022/lib/services/booking-calendar.service.mjs +282 -130
  9. package/esm2022/lib/services/factories/member-team-factory.mjs +2 -2
  10. package/esm2022/lib/services/factories/search-team-factory.mjs +2 -2
  11. package/esm2022/lib/services/feature-flags.service.mjs +16 -8
  12. package/esm2022/lib/services/member.service.mjs +9 -8
  13. package/esm2022/lib/services/team.service.mjs +7 -5
  14. package/esm2022/lib/store/effects/token.effects.mjs +4 -3
  15. package/fesm2022/myclub_se-data-access.mjs +531 -296
  16. package/fesm2022/myclub_se-data-access.mjs.map +1 -1
  17. package/lib/api-models/api-member-team.d.ts +1 -0
  18. package/lib/api-models/api-search-team.d.ts +1 -0
  19. package/lib/authentication/authentication.interceptor.d.ts +3 -3
  20. package/lib/models/member-team.d.ts +2 -1
  21. package/lib/models/search-team.d.ts +2 -1
  22. package/lib/services/activity.service.d.ts +57 -55
  23. package/lib/services/bookable.service.d.ts +10 -5
  24. package/lib/services/booking-calendar.service.d.ts +25 -12
  25. package/lib/services/feature-flags.service.d.ts +2 -1
  26. package/lib/services/member.service.d.ts +1 -1
  27. package/lib/services/team.service.d.ts +1 -1
  28. package/lib/store/effects/token.effects.d.ts +1 -1
  29. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
- import * as i1 from '@angular/common/http';
2
- import { HttpErrorResponse, HttpParams, HttpRequest, HTTP_INTERCEPTORS } from '@angular/common/http';
3
- import { map, catchError, tap, switchMap, take, exhaustMap as exhaustMap$1, mergeMap as mergeMap$1, filter as filter$1, finalize } from 'rxjs/operators';
4
- import { of, BehaviorSubject, from, throwError, exhaustMap, mergeMap, forkJoin, catchError as catchError$1, withLatestFrom, concatMap, concat, filter, tap as tap$1, ReplaySubject, Observable } from 'rxjs';
5
1
  import * as i0 from '@angular/core';
6
2
  import { InjectionToken, Injectable, Inject, inject, NgModule } from '@angular/core';
7
- import * as i1$2 from '@ngrx/store';
8
- import { createAction, props, createFeatureSelector, createSelector, Store, createReducer, on, select, StoreModule } from '@ngrx/store';
3
+ import * as i1 from '@angular/common/http';
4
+ import { HttpErrorResponse, HttpParams, HttpRequest, HTTP_INTERCEPTORS } from '@angular/common/http';
9
5
  import * as i2 from '@ngrx/effects';
10
6
  import { Actions, createEffect, ofType, EffectsModule } from '@ngrx/effects';
7
+ import * as i1$2 from '@ngrx/store';
8
+ import { createAction, props, createFeatureSelector, createSelector, Store, createReducer, on, select, StoreModule } from '@ngrx/store';
9
+ import { of, BehaviorSubject, from, throwError, exhaustMap, mergeMap, forkJoin, catchError as catchError$1, withLatestFrom, concatMap, concat, filter, tap as tap$1 } from 'rxjs';
10
+ import { map, catchError, tap, switchMap, take, exhaustMap as exhaustMap$1, mergeMap as mergeMap$1, filter as filter$1, finalize } from 'rxjs/operators';
11
11
  import { FormGroup, FormControl, Validators, FormArray } from '@angular/forms';
12
12
  import moment from 'moment';
13
13
  import moment$1 from 'moment/moment';
@@ -1759,19 +1759,21 @@ class SearchTeam {
1759
1759
  club_name;
1760
1760
  name;
1761
1761
  section_name;
1762
+ show_memberships;
1762
1763
  static asFormGroup(team) {
1763
1764
  return new FormGroup({
1764
1765
  id: new FormControl(team?.id || ''),
1765
1766
  name: new FormControl(team?.name || '', Validators.required),
1766
1767
  });
1767
1768
  }
1768
- constructor(club, section, id, club_name, name, section_name) {
1769
+ constructor(club, section, id, club_name, name, section_name, show_memberships) {
1769
1770
  this.club = club;
1770
1771
  this.section = section;
1771
1772
  this.id = id;
1772
1773
  this.club_name = club_name;
1773
1774
  this.name = name;
1774
1775
  this.section_name = section_name;
1776
+ this.show_memberships = show_memberships;
1775
1777
  }
1776
1778
  }
1777
1779
 
@@ -3424,7 +3426,8 @@ class MemberTeam {
3424
3426
  name;
3425
3427
  phone;
3426
3428
  section_name;
3427
- constructor(club, section, id, email, has_extra_members, name, phone, section_name) {
3429
+ show_memberships;
3430
+ constructor(club, section, id, email, has_extra_members, name, phone, section_name, show_memberships) {
3428
3431
  this.club = club;
3429
3432
  this.section = section;
3430
3433
  this.id = id;
@@ -3433,6 +3436,7 @@ class MemberTeam {
3433
3436
  this.name = name;
3434
3437
  this.phone = phone;
3435
3438
  this.section_name = section_name;
3439
+ this.show_memberships = show_memberships;
3436
3440
  }
3437
3441
  }
3438
3442
 
@@ -3960,7 +3964,7 @@ const clubFactory = (apiClub) => new Club(apiClub.id, apiClub.name);
3960
3964
 
3961
3965
  const sectionFactory = (apiSection) => new Section(apiSection.id, apiSection.name);
3962
3966
 
3963
- const searchTeamFactory = (apiSearchTeam) => new SearchTeam(apiSearchTeam.club ? clubFactory(apiSearchTeam.club) : undefined, apiSearchTeam.section ? sectionFactory(apiSearchTeam.section) : undefined, apiSearchTeam.id, apiSearchTeam.club_name, apiSearchTeam.name, apiSearchTeam.section_name);
3967
+ const searchTeamFactory = (apiSearchTeam) => new SearchTeam(apiSearchTeam.club ? clubFactory(apiSearchTeam.club) : undefined, apiSearchTeam.section ? sectionFactory(apiSearchTeam.section) : undefined, apiSearchTeam.id, apiSearchTeam.club_name, apiSearchTeam.name, apiSearchTeam.section_name, apiSearchTeam.show_memberships);
3964
3968
 
3965
3969
  const bookingCalendarFactory = (apiBookingCalendar) => new BookingCalendar(apiBookingCalendar.id, apiBookingCalendar.club_id, apiBookingCalendar.section_id, apiBookingCalendar.team_id, apiBookingCalendar.club_name, apiBookingCalendar.name, apiBookingCalendar.section_name, apiBookingCalendar.team_name, apiBookingCalendar.status, apiBookingCalendar.max_application_number, apiBookingCalendar.allow_team_export, apiBookingCalendar.allow_repeated_bookings, apiBookingCalendar.is_default, apiBookingCalendar.available_for_teams && apiBookingCalendar.available_for_teams.length ? apiBookingCalendar.available_for_teams.map((apiSearchTeam) => searchTeamFactory(apiSearchTeam)) : [], apiBookingCalendar.bookable_groups && apiBookingCalendar.bookable_groups.length ? apiBookingCalendar.bookable_groups.map((apiBookableGroup) => bookableGroupFactory(apiBookableGroup)) : [], apiBookingCalendar.type, apiBookingCalendar.type_display);
3966
3970
 
@@ -4058,7 +4062,7 @@ const memberPublicFormFactory = (apiMemberPublicForm) => {
4058
4062
  ? apiMemberPublicForm.teams.map((team) => searchTeamFactory(team)) : [], apiMemberPublicForm.url);
4059
4063
  };
4060
4064
 
4061
- const memberTeamFactory = (apiMemberTeam) => new MemberTeam(clubFactory(apiMemberTeam.club), apiMemberTeam.section ? sectionFactory(apiMemberTeam.section) : null, apiMemberTeam.id, apiMemberTeam.email, apiMemberTeam.has_extra_members, apiMemberTeam.name, apiMemberTeam.phone, apiMemberTeam.section_name);
4065
+ const memberTeamFactory = (apiMemberTeam) => new MemberTeam(clubFactory(apiMemberTeam.club), apiMemberTeam.section ? sectionFactory(apiMemberTeam.section) : null, apiMemberTeam.id, apiMemberTeam.email, apiMemberTeam.has_extra_members, apiMemberTeam.name, apiMemberTeam.phone, apiMemberTeam.section_name, apiMemberTeam.show_memberships);
4062
4066
 
4063
4067
  const memberTeamThroughFactory = (apiMemberTeamThrough) => new MemberTeamThrough(apiMemberTeamThrough.id, apiMemberTeamThrough.created, apiMemberTeamThrough.date_hidden, apiMemberTeamThrough.image, apiMemberTeamThrough.leader, memberFactory(apiMemberTeamThrough.member), apiMemberTeamThrough.role_id, apiMemberTeamThrough.show_on_web, apiMemberTeamThrough.updated);
4064
4068
 
@@ -4276,17 +4280,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
4276
4280
  }]
4277
4281
  }], ctorParameters: () => [{ type: ApiService }] });
4278
4282
 
4279
- const MEMBER_ACTIVITY_ATTENDANCE_PATH = ':memberId/activities/activity/:activityId/attendance/';
4280
- const MEMBER_ACTIVITY_INVITE_PATH = ':memberId/activities/:activityInviteId/';
4281
- const MEMBER_ACTIVITY_PATH = ':memberId/activities/activity/:activityId/';
4282
- const MEMBER_ACTIVITY_INVITES_PATH = ':memberId/activities/';
4283
- const MEMBER_CALENDAR_PATH = ':memberId/activities/calendar/';
4284
- const MEMBER_OPEN_ACTIVITIES_PATH = ':memberId/open-activities/';
4285
- const MEMBER_OPEN_ACTIVITIES_ACTIVITY_TYPES_PATH = ':memberId/open-activities/types/';
4286
- const MEMBER_OPEN_ACTIVITIES_ACTIVITY_LOCATIONS_PATH = ':memberId/open-activities/locations/';
4287
- const MEMBER_OPEN_ACTIVITY_PATH = ':memberId/open-activities/:activityId/';
4288
- const MEMBER_OPEN_ACTIVITY_RESPOND_PATH = ':memberId/open-activities/:activityId/respond/';
4289
- const MEMBER_OPEN_ACTIVITY_RESPOND_WITH_DATA_PATH = ':memberId/open-activities/:activityId/respond-data/';
4290
4283
  const PUBLIC_ACTIVITY_INVITE_PATH = 'activities/:id/:token/';
4291
4284
  const PUBLIC_OPEN_ACTIVITIES_PATH = 'open-activities/';
4292
4285
  const PUBLIC_OPEN_ACTIVITIES_ACTIVITY_TYPES_PATH = 'open-activities/types/';
@@ -4295,6 +4288,16 @@ const PUBLIC_OPEN_ACTIVITY_PATH = 'open-activities/:activityId/';
4295
4288
  const PUBLIC_OPEN_ACTIVITY_RESPOND_PATH = 'open-activities/:activityId/respond/';
4296
4289
  const PUBLIC_OPEN_ACTIVITY_RESPOND_WITH_DATA_PATH = 'open-activities/:activityId/respond-data/';
4297
4290
  const PUBLIC_OPEN_ACTIVITY_INVITE_PATH = 'open-activities/invites/:activityId/';
4291
+ const CLUB_ACTIVITY_SETTINGS_PATH = ':clubId/activities/settings/';
4292
+ const CLUB_ACTIVITY_LOCATIONS_PATH = ':clubId/activities/locations/';
4293
+ const CLUB_ACTIVITY_LOCATION_PATH = ':clubId/activities/locations/:locationId/';
4294
+ const CLUB_ACTIVITY_TYPES_PATH = ':clubId/activities/types/';
4295
+ const CLUB_ACTIVITY_TYPE_PATH = ':clubId/activities/types/:typeId/';
4296
+ const SECTION_ACTIVITY_SETTINGS_PATH = ':sectionId/activities/settings/';
4297
+ const SECTION_ACTIVITY_LOCATIONS_PATH = ':sectionId/activities/locations/';
4298
+ const SECTION_ACTIVITY_LOCATION_PATH = ':sectionId/activities/locations/:locationId/';
4299
+ const SECTION_ACTIVITY_TYPES_PATH = ':sectionId/activities/types/';
4300
+ const SECTION_ACTIVITY_TYPE_PATH = ':sectionId/activities/types/:typeId/';
4298
4301
  const TEAM_ACTIVITIES_PATH = ':teamId/activities/';
4299
4302
  const TEAM_ACTIVITY_INVITES_PATH = ':teamId/activities/:activityId/invites/';
4300
4303
  const TEAM_ACTIVITY_INVITE_PATH = ':teamId/activities/:activityId/invites/:activityInviteId/';
@@ -4304,19 +4307,23 @@ const TEAM_ACTIVITY_PARTICIPANTS_PATH = ':teamId/activities/:activityId/particip
4304
4307
  const TEAM_ACTIVITY_PATH = ':teamId/activities/:id/';
4305
4308
  const TEAM_ACTIVITY_QR_CODE_PATH = ':teamId/activities/:id/qr-code/';
4306
4309
  const TEAM_ACTIVITY_SETTINGS_PATH = ':teamId/activities/settings/';
4307
- const SECTION_ACTIVITY_SETTINGS_PATH = ':sectionId/activities/settings/';
4308
- const CLUB_ACTIVITY_SETTINGS_PATH = ':clubId/activities/settings/';
4309
4310
  const TEAM_ACTIVITY_TYPES_PATH = ':teamId/activities/types/';
4310
- const TEAM_CALENDAR_PATH = ':teamId/activities/calendar/';
4311
- const CLUB_ACTIVITY_LOCATIONS_PATH = ':clubId/activities/locations/';
4312
- const CLUB_ACTIVITY_LOCATION_PATH = ':clubId/activities/locations/:locationId/';
4313
- const CLUB_ACTIVITY_TYPES_PATH = ':clubId/activities/types/';
4314
- const CLUB_ACTIVITY_TYPE_PATH = ':clubId/activities/types/:typeId/';
4315
4311
  const TEAM_ACTIVITY_LOCATIONS_PATH = ':teamId/activities/locations/';
4316
- const SECTION_ACTIVITY_LOCATIONS_PATH = ':sectionId/activities/locations/';
4317
- const SECTION_ACTIVITY_LOCATION_PATH = ':sectionId/activities/locations/:locationId/';
4318
- const SECTION_ACTIVITY_TYPES_PATH = ':sectionId/activities/types/';
4319
- const SECTION_ACTIVITY_TYPE_PATH = ':sectionId/activities/types/:typeId/';
4312
+ const TEAM_CALENDAR_PATH = ':teamId/activities/calendar/';
4313
+ const MEMBER_ACTIVITY_ATTENDANCE_PATH = ':memberId/activities/activity/:activityId/attendance/';
4314
+ const MEMBER_ACTIVITY_INVITE_PATH = ':memberId/activities/:activityInviteId/';
4315
+ const MEMBER_ACTIVITY_PATH = ':memberId/activities/activity/:activityId/';
4316
+ const MEMBER_ACTIVITY_INVITES_PATH = ':memberId/activities/';
4317
+ const MEMBER_CALENDAR_PATH = ':memberId/activities/calendar/';
4318
+ const MEMBER_OPEN_ACTIVITIES_PATH = ':memberId/open-activities/';
4319
+ const MEMBER_OPEN_ACTIVITIES_ACTIVITY_TYPES_PATH = ':memberId/open-activities/types/';
4320
+ const MEMBER_OPEN_ACTIVITIES_ACTIVITY_LOCATIONS_PATH = ':memberId/open-activities/locations/';
4321
+ const MEMBER_OPEN_ACTIVITY_PATH = ':memberId/open-activities/:activityId/';
4322
+ const MEMBER_OPEN_ACTIVITY_RESPOND_PATH = ':memberId/open-activities/:activityId/respond/';
4323
+ const MEMBER_OPEN_ACTIVITY_RESPOND_WITH_DATA_PATH = ':memberId/open-activities/:activityId/respond-data/';
4324
+ const MEMBER_ACTIVITY_SETTINGS_PATH = ':memberId/activities/settings/';
4325
+ const MEMBER_ACTIVITY_TYPES_PATH = ':memberId/activities/types/';
4326
+ const MEMBER_ACTIVITY_LOCATIONS_PATH = ':memberId/activities/locations/';
4320
4327
  class ActivityService {
4321
4328
  apiService;
4322
4329
  activityLocationCollection;
@@ -4466,14 +4473,17 @@ class ActivityService {
4466
4473
  return this.apiService
4467
4474
  .getResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITY_QR_CODE_PATH, { teamId, id });
4468
4475
  }
4469
- getActivityLocations(role, clubOrSectionOrTeamId, force = false) {
4470
- if (role == Role.ClubAdmin) {
4471
- return this.getClubActivityLocations(clubOrSectionOrTeamId, force);
4472
- }
4473
- else if (role == Role.SectionAdmin) {
4474
- return this.getSectionActivityLocations(clubOrSectionOrTeamId, force);
4476
+ getActivityLocations(role, itemId, force = false) {
4477
+ switch (role) {
4478
+ case Role.ClubAdmin:
4479
+ return this.getClubActivityLocations(itemId, force);
4480
+ case Role.SectionAdmin:
4481
+ return this.getSectionActivityLocations(itemId, force);
4482
+ case Role.TeamAdmin:
4483
+ return this.getTeamActivityLocations(itemId, force);
4484
+ default:
4485
+ return this.getMemberActivityLocations(itemId, force);
4475
4486
  }
4476
- return this.getTeamActivityLocations(clubOrSectionOrTeamId, force);
4477
4487
  }
4478
4488
  getTeamActivityLocations(teamId, force = false) {
4479
4489
  if (this.activityLocationResponseDate && this.activityLocationResponseDate > sub(new Date(), { hours: 1 }) && !force) {
@@ -4485,6 +4495,16 @@ class ActivityService {
4485
4495
  this.activityLocationCollection = activityLocationCollection;
4486
4496
  }));
4487
4497
  }
4498
+ getMemberActivityLocations(memberId, force = false) {
4499
+ if (this.activityLocationResponseDate && this.activityLocationResponseDate > sub(new Date(), { hours: 1 }) && !force) {
4500
+ return of(this.activityLocationCollection);
4501
+ }
4502
+ return this.apiService
4503
+ .getCollection(activityLocationFactory, Role.MemberAdmin, MEMBER_ACTIVITY_LOCATIONS_PATH, { memberId }, { params: { limit: 'null' } }).pipe(tap((activityLocationCollection) => {
4504
+ this.activityLocationResponseDate = new Date();
4505
+ this.activityLocationCollection = activityLocationCollection;
4506
+ }));
4507
+ }
4488
4508
  getClubActivityLocations(clubId, force = false) {
4489
4509
  if (this.activityLocationResponseDate && this.activityLocationResponseDate > sub(new Date(), { hours: 1 }) && !force) {
4490
4510
  return of(this.activityLocationCollection);
@@ -4506,10 +4526,12 @@ class ActivityService {
4506
4526
  }));
4507
4527
  }
4508
4528
  updateActivityLocation(role, clubOrSectionOrTeamId, location) {
4509
- if (role === Role.ClubAdmin) {
4510
- return this.updateClubActivityLocation(clubOrSectionOrTeamId, location);
4529
+ switch (role) {
4530
+ case Role.ClubAdmin:
4531
+ return this.updateClubActivityLocation(clubOrSectionOrTeamId, location);
4532
+ default:
4533
+ return this.updateSectionActivityLocation(clubOrSectionOrTeamId, location);
4511
4534
  }
4512
- return this.updateSectionActivityLocation(clubOrSectionOrTeamId, location);
4513
4535
  }
4514
4536
  updateClubActivityLocation(clubId, location) {
4515
4537
  return this.apiService
@@ -4543,14 +4565,17 @@ class ActivityService {
4543
4565
  activityId
4544
4566
  }, { params: { limit: 'null' } });
4545
4567
  }
4546
- getActivitySettings(role, clubOrSectionOrTeamId) {
4547
- if (role === Role.ClubAdmin) {
4548
- return this.getClubActivitySettings(clubOrSectionOrTeamId);
4549
- }
4550
- else if (role == Role.SectionAdmin) {
4551
- return this.getSectionActivitySettings(clubOrSectionOrTeamId);
4568
+ getActivitySettings(role, itemId) {
4569
+ switch (role) {
4570
+ case Role.ClubAdmin:
4571
+ return this.getClubActivitySettings(itemId);
4572
+ case Role.SectionAdmin:
4573
+ return this.getSectionActivitySettings(itemId);
4574
+ case Role.TeamAdmin:
4575
+ return this.getTeamActivitySettings(itemId);
4576
+ default:
4577
+ return this.getMemberActivitySettings(itemId);
4552
4578
  }
4553
- return this.getTeamActivitySettings(clubOrSectionOrTeamId);
4554
4579
  }
4555
4580
  getTeamActivitySettings(teamId) {
4556
4581
  return this.apiService
@@ -4558,6 +4583,10 @@ class ActivityService {
4558
4583
  teamId
4559
4584
  });
4560
4585
  }
4586
+ getMemberActivitySettings(memberId) {
4587
+ return this.apiService
4588
+ .getResource(activitySettingsFactory, Role.MemberAdmin, MEMBER_ACTIVITY_SETTINGS_PATH, { memberId });
4589
+ }
4561
4590
  getSectionActivitySettings(sectionId) {
4562
4591
  return this.apiService
4563
4592
  .getResource(activitySettingsFactory, Role.SectionAdmin, SECTION_ACTIVITY_SETTINGS_PATH, {
@@ -4570,19 +4599,26 @@ class ActivityService {
4570
4599
  clubId,
4571
4600
  });
4572
4601
  }
4573
- getActivityTypes(role, clubOrSectionOrTeamId) {
4574
- if (role === Role.ClubAdmin) {
4575
- return this.getClubActivityTypes(clubOrSectionOrTeamId);
4576
- }
4577
- else if (role === Role.SectionAdmin) {
4578
- return this.getSectionActivityTypes(clubOrSectionOrTeamId);
4602
+ getActivityTypes(role, itemId) {
4603
+ switch (role) {
4604
+ case Role.ClubAdmin:
4605
+ return this.getClubActivityTypes(itemId);
4606
+ case Role.SectionAdmin:
4607
+ return this.getSectionActivityTypes(itemId);
4608
+ case Role.TeamAdmin:
4609
+ return this.getTeamActivityTypes(itemId);
4610
+ default:
4611
+ return this.getMemberActivityTypes(itemId);
4579
4612
  }
4580
- return this.getTeamActivityTypes(clubOrSectionOrTeamId);
4581
4613
  }
4582
4614
  getTeamActivityTypes(teamId) {
4583
4615
  return this.apiService
4584
4616
  .getCollection(activityTypeFactory, Role.TeamAdmin, TEAM_ACTIVITY_TYPES_PATH, { teamId }, { params: { limit: 'null' } });
4585
4617
  }
4618
+ getMemberActivityTypes(memberId) {
4619
+ return this.apiService
4620
+ .getCollection(activityTypeFactory, Role.MemberAdmin, MEMBER_ACTIVITY_TYPES_PATH, { memberId }, { params: { limit: 'null' } });
4621
+ }
4586
4622
  getClubActivityTypes(clubId) {
4587
4623
  return this.apiService
4588
4624
  .getCollection(activityTypeFactory, Role.ClubAdmin, CLUB_ACTIVITY_TYPES_PATH, { clubId }, { params: { limit: 'null' } });
@@ -4592,10 +4628,12 @@ class ActivityService {
4592
4628
  .getCollection(activityTypeFactory, Role.SectionAdmin, SECTION_ACTIVITY_TYPES_PATH, { sectionId }, { params: { limit: 'null' } });
4593
4629
  }
4594
4630
  updateActivityType(role, clubOrSectionOrTeamId, activityType) {
4595
- if (role === Role.ClubAdmin) {
4596
- return this.updateClubActivityType(clubOrSectionOrTeamId, activityType);
4631
+ switch (role) {
4632
+ case Role.ClubAdmin:
4633
+ return this.updateClubActivityType(clubOrSectionOrTeamId, activityType);
4634
+ default:
4635
+ return this.updateSectionActivityType(clubOrSectionOrTeamId, activityType);
4597
4636
  }
4598
- return this.updateSectionActivityType(clubOrSectionOrTeamId, activityType);
4599
4637
  }
4600
4638
  updateClubActivityType(clubId, activityType) {
4601
4639
  return this.apiService
@@ -4783,10 +4821,6 @@ const CLUB_BOOKABLE_GROUP_PATH = ':clubId/activities/bookables/groups/:groupId/'
4783
4821
  const CLUB_BOOKABLE_TAGS_PATH = ':clubId/activities/bookables/tags/';
4784
4822
  const CLUB_BOOKABLE_TAG_PATH = ':clubId/activities/bookables/tags/:tagId/';
4785
4823
  const CLUB_BOOKABLE_PARTS_PATH = ':clubId/activities/bookables/:bookableId/parts/';
4786
- const TEAM_BOOKABLES_PATH = ':teamId/activities/bookables/';
4787
- const TEAM_BOOKABLE_GROUPS_PATH = ':teamId/activities/bookables/groups/';
4788
- const TEAM_BOOKABLE_TAGS_PATH = ':teamId/activities/bookables/tags/';
4789
- const TEAM_BOOKABLE_PARTS_PATH = ':teamId/activities/bookables/:bookableId/parts/';
4790
4824
  const SECTION_BOOKABLES_PATH = ':sectionId/activities/bookables/';
4791
4825
  const SECTION_BOOKABLE_PATH = ':sectionId/activities/bookables/:bookableId/';
4792
4826
  const SECTION_BOOKABLE_GROUPS_PATH = ':sectionId/activities/bookables/groups/';
@@ -4794,25 +4828,40 @@ const SECTION_BOOKABLE_GROUP_PATH = ':sectionId/activities/bookables/groups/:gro
4794
4828
  const SECTION_BOOKABLE_TAGS_PATH = ':sectionId/activities/bookables/tags/';
4795
4829
  const SECTION_BOOKABLE_TAG_PATH = ':sectionId/activities/bookables/tags/:tagId/';
4796
4830
  const SECTION_BOOKABLE_PARTS_PATH = ':sectionId/activities/bookables/:bookableId/parts/';
4831
+ const TEAM_BOOKABLES_PATH = ':teamId/activities/bookables/';
4832
+ const TEAM_BOOKABLE_GROUPS_PATH = ':teamId/activities/bookables/groups/';
4833
+ const TEAM_BOOKABLE_TAGS_PATH = ':teamId/activities/bookables/tags/';
4834
+ const TEAM_BOOKABLE_PARTS_PATH = ':teamId/activities/bookables/:bookableId/parts/';
4835
+ const MEMBER_BOOKABLES_PATH = ':memberId/activities/bookables/';
4836
+ const MEMBER_BOOKABLE_GROUPS_PATH = ':memberId/activities/bookables/groups/';
4837
+ const MEMBER_BOOKABLE_TAGS_PATH = ':memberId/activities/bookables/tags/';
4838
+ const MEMBER_BOOKABLE_PARTS_PATH = ':memberId/activities/bookables/:bookableId/parts/';
4797
4839
  class BookableService {
4798
4840
  apiService;
4799
4841
  constructor(apiService) {
4800
4842
  this.apiService = apiService;
4801
4843
  }
4802
4844
  // region Bookable Items
4803
- getBookableItems(role, clubOrSectionOrTeamId) {
4804
- if (role == Role.ClubAdmin) {
4805
- return this.getClubBookableItems(clubOrSectionOrTeamId);
4806
- }
4807
- else if (role == Role.SectionAdmin) {
4808
- return this.getSectionBookableItems(clubOrSectionOrTeamId);
4845
+ getBookableItems(role, itemId) {
4846
+ switch (role) {
4847
+ case Role.ClubAdmin:
4848
+ return this.getClubBookableItems(itemId);
4849
+ case Role.SectionAdmin:
4850
+ return this.getSectionBookableItems(itemId);
4851
+ case Role.TeamAdmin:
4852
+ return this.getTeamBookableItems(itemId);
4853
+ default:
4854
+ return this.getMemberBookableItems(itemId);
4809
4855
  }
4810
- return this.getTeamBookableItems(clubOrSectionOrTeamId);
4811
4856
  }
4812
4857
  getTeamBookableItems(teamId) {
4813
4858
  return this.apiService
4814
4859
  .getCollection(bookableItemFactory, Role.TeamAdmin, TEAM_BOOKABLES_PATH, { teamId }, { params: { limit: 'null' } });
4815
4860
  }
4861
+ getMemberBookableItems(memberId) {
4862
+ return this.apiService
4863
+ .getCollection(bookableItemFactory, Role.MemberAdmin, MEMBER_BOOKABLES_PATH, { memberId }, { params: { limit: 'null' } });
4864
+ }
4816
4865
  getClubBookableItems(clubId) {
4817
4866
  return this.apiService
4818
4867
  .getCollection(bookableItemFactory, Role.ClubAdmin, CLUB_BOOKABLES_PATH, { clubId }, { params: { limit: 'null' } });
@@ -4822,10 +4871,12 @@ class BookableService {
4822
4871
  .getCollection(bookableItemFactory, Role.SectionAdmin, SECTION_BOOKABLES_PATH, { sectionId }, { params: { limit: 'null' } });
4823
4872
  }
4824
4873
  updateBookableItem(role, clubOrSectionOrTeamId, bookableItem) {
4825
- if (role === Role.ClubAdmin) {
4826
- return this.updateClubBookableItem(clubOrSectionOrTeamId, bookableItem);
4874
+ switch (role) {
4875
+ case Role.ClubAdmin:
4876
+ return this.updateClubBookableItem(clubOrSectionOrTeamId, bookableItem);
4877
+ default:
4878
+ return this.updateSectionBookableItem(clubOrSectionOrTeamId, bookableItem);
4827
4879
  }
4828
- return this.updateSectionBookableItem(clubOrSectionOrTeamId, bookableItem);
4829
4880
  }
4830
4881
  updateClubBookableItem(clubId, bookableItem) {
4831
4882
  return this.apiService
@@ -4842,10 +4893,12 @@ class BookableService {
4842
4893
  }, bookableItem);
4843
4894
  }
4844
4895
  createBookableItem(role, clubOrSectionOrTeamId, bookableItem) {
4845
- if (role === Role.ClubAdmin) {
4846
- return this.createClubBookableItem(clubOrSectionOrTeamId, bookableItem);
4896
+ switch (role) {
4897
+ case Role.ClubAdmin:
4898
+ return this.createClubBookableItem(clubOrSectionOrTeamId, bookableItem);
4899
+ default:
4900
+ return this.createSectionBookableItem(clubOrSectionOrTeamId, bookableItem);
4847
4901
  }
4848
- return this.createSectionBookableItem(clubOrSectionOrTeamId, bookableItem);
4849
4902
  }
4850
4903
  createClubBookableItem(clubId, bookableItem) {
4851
4904
  delete bookableItem.id;
@@ -4863,14 +4916,17 @@ class BookableService {
4863
4916
  }
4864
4917
  // endregion
4865
4918
  // region Bookable Groups
4866
- getBookableGroups(role, clubOrSectionOrTeamId) {
4867
- if (role == Role.ClubAdmin) {
4868
- return this.getClubBookableGroups(clubOrSectionOrTeamId);
4919
+ getBookableGroups(role, itemId) {
4920
+ switch (role) {
4921
+ case Role.ClubAdmin:
4922
+ return this.getClubBookableGroups(itemId);
4923
+ case Role.SectionAdmin:
4924
+ return this.getSectionBookableGroups(itemId);
4925
+ case Role.TeamAdmin:
4926
+ return this.getTeamBookableGroups(itemId);
4927
+ default:
4928
+ return this.getMemberBookableGroups(itemId);
4869
4929
  }
4870
- else if (role == Role.SectionAdmin) {
4871
- return this.getSectionBookableGroups(clubOrSectionOrTeamId);
4872
- }
4873
- return this.getTeamBookableGroups(clubOrSectionOrTeamId);
4874
4930
  }
4875
4931
  getClubBookableGroups(clubId) {
4876
4932
  return this.apiService
@@ -4884,11 +4940,17 @@ class BookableService {
4884
4940
  return this.apiService
4885
4941
  .getCollection(bookableGroupFactory, Role.TeamAdmin, TEAM_BOOKABLE_GROUPS_PATH, { teamId }, { params: { limit: 'null' } });
4886
4942
  }
4943
+ getMemberBookableGroups(memberId) {
4944
+ return this.apiService
4945
+ .getCollection(bookableGroupFactory, Role.MemberAdmin, MEMBER_BOOKABLE_GROUPS_PATH, { memberId }, { params: { limit: 'null' } });
4946
+ }
4887
4947
  updateBookableGroup(role, clubOrSectionOrTeamId, bookableGroup) {
4888
- if (role === Role.ClubAdmin) {
4889
- return this.updateClubBookableGroup(clubOrSectionOrTeamId, bookableGroup);
4948
+ switch (role) {
4949
+ case Role.ClubAdmin:
4950
+ return this.updateClubBookableGroup(clubOrSectionOrTeamId, bookableGroup);
4951
+ default:
4952
+ return this.updateSectionBookableGroup(clubOrSectionOrTeamId, bookableGroup);
4890
4953
  }
4891
- return this.updateSectionBookableGroup(clubOrSectionOrTeamId, bookableGroup);
4892
4954
  }
4893
4955
  updateClubBookableGroup(clubId, bookableGroup) {
4894
4956
  return this.apiService
@@ -4905,10 +4967,12 @@ class BookableService {
4905
4967
  }, bookableGroup);
4906
4968
  }
4907
4969
  createBookableGroup(role, clubOrSectionOrTeamId, bookableGroup) {
4908
- if (role === Role.ClubAdmin) {
4909
- return this.createClubBookableGroup(clubOrSectionOrTeamId, bookableGroup);
4970
+ switch (role) {
4971
+ case Role.ClubAdmin:
4972
+ return this.createClubBookableGroup(clubOrSectionOrTeamId, bookableGroup);
4973
+ default:
4974
+ return this.createSectionBookableGroup(clubOrSectionOrTeamId, bookableGroup);
4910
4975
  }
4911
- return this.createSectionBookableGroup(clubOrSectionOrTeamId, bookableGroup);
4912
4976
  }
4913
4977
  createClubBookableGroup(clubId, bookableGroup) {
4914
4978
  delete bookableGroup.id;
@@ -4926,14 +4990,17 @@ class BookableService {
4926
4990
  }
4927
4991
  // endregion
4928
4992
  // region Bookable Tags
4929
- getBookableTags(role, clubOrSectionOrTeamId) {
4930
- if (role == Role.ClubAdmin) {
4931
- return this.getClubBookableTags(clubOrSectionOrTeamId);
4993
+ getBookableTags(role, itemId) {
4994
+ switch (role) {
4995
+ case Role.ClubAdmin:
4996
+ return this.getClubBookableTags(itemId);
4997
+ case Role.SectionAdmin:
4998
+ return this.getSectionBookableTags(itemId);
4999
+ case Role.TeamAdmin:
5000
+ return this.getTeamBookableTags(itemId);
5001
+ default:
5002
+ return this.getMemberBookableTags(itemId);
4932
5003
  }
4933
- else if (role == Role.SectionAdmin) {
4934
- return this.getSectionBookableTags(clubOrSectionOrTeamId);
4935
- }
4936
- return this.getTeamBookableTags(clubOrSectionOrTeamId);
4937
5004
  }
4938
5005
  getClubBookableTags(clubId) {
4939
5006
  return this.apiService
@@ -4947,41 +5014,49 @@ class BookableService {
4947
5014
  return this.apiService
4948
5015
  .getCollection(bookableTagFactory, Role.TeamAdmin, TEAM_BOOKABLE_TAGS_PATH, { teamId }, { params: { limit: 'null' } });
4949
5016
  }
4950
- createBookableTag(role, clubOrSectionOrTeamId, tag) {
4951
- if (role == Role.ClubAdmin) {
4952
- return this.createClubBookableTag(clubOrSectionOrTeamId, tag);
4953
- }
4954
- else if (role == Role.SectionAdmin) {
4955
- return this.createSectionBookableTag(clubOrSectionOrTeamId, tag);
5017
+ getMemberBookableTags(memberId) {
5018
+ return this.apiService
5019
+ .getCollection(bookableTagFactory, Role.MemberAdmin, MEMBER_BOOKABLE_TAGS_PATH, { memberId }, { params: { limit: 'null' } });
5020
+ }
5021
+ createBookableTag(role, itemId, tag) {
5022
+ switch (role) {
5023
+ case Role.ClubAdmin:
5024
+ return this.createClubBookableTag(itemId, tag);
5025
+ case Role.SectionAdmin:
5026
+ return this.createSectionBookableTag(itemId, tag);
5027
+ case Role.TeamAdmin:
5028
+ return this.createTeamBookableTag(itemId, tag);
5029
+ default:
5030
+ return this.createMemberBookableTag(itemId, tag);
4956
5031
  }
4957
- return this.createTeamBookableTag(clubOrSectionOrTeamId, tag);
4958
5032
  }
4959
5033
  createClubBookableTag(clubId, tag) {
4960
5034
  delete tag.id;
4961
5035
  return this.apiService
4962
- .postResource(bookableTagFactory, Role.ClubAdmin, CLUB_BOOKABLE_TAGS_PATH, {
4963
- clubId,
4964
- }, tag);
5036
+ .postResource(bookableTagFactory, Role.ClubAdmin, CLUB_BOOKABLE_TAGS_PATH, { clubId }, tag);
4965
5037
  }
4966
5038
  createSectionBookableTag(sectionId, tag) {
4967
5039
  delete tag.id;
4968
5040
  return this.apiService
4969
- .postResource(bookableTagFactory, Role.SectionAdmin, SECTION_BOOKABLE_TAGS_PATH, {
4970
- sectionId,
4971
- }, tag);
5041
+ .postResource(bookableTagFactory, Role.SectionAdmin, SECTION_BOOKABLE_TAGS_PATH, { sectionId }, tag);
4972
5042
  }
4973
5043
  createTeamBookableTag(teamId, tag) {
4974
5044
  delete tag.id;
4975
5045
  return this.apiService
4976
- .postResource(bookableTagFactory, Role.TeamAdmin, TEAM_BOOKABLE_TAGS_PATH, {
4977
- teamId,
4978
- }, tag);
5046
+ .postResource(bookableTagFactory, Role.TeamAdmin, TEAM_BOOKABLE_TAGS_PATH, { teamId }, tag);
5047
+ }
5048
+ createMemberBookableTag(memberId, tag) {
5049
+ delete tag.id;
5050
+ return this.apiService
5051
+ .postResource(bookableTagFactory, Role.MemberAdmin, MEMBER_BOOKABLE_TAGS_PATH, { memberId }, tag);
4979
5052
  }
4980
5053
  updateBookableTag(role, clubOrSectionOrTeamId, tag) {
4981
- if (role == Role.ClubAdmin) {
4982
- return this.updateClubBookableTag(clubOrSectionOrTeamId, tag);
5054
+ switch (role) {
5055
+ case Role.ClubAdmin:
5056
+ return this.updateClubBookableTag(clubOrSectionOrTeamId, tag);
5057
+ default:
5058
+ return this.updateSectionBookableTag(clubOrSectionOrTeamId, tag);
4983
5059
  }
4984
- return this.updateSectionBookableTag(clubOrSectionOrTeamId, tag);
4985
5060
  }
4986
5061
  updateClubBookableTag(clubId, tag) {
4987
5062
  return this.apiService
@@ -4998,10 +5073,12 @@ class BookableService {
4998
5073
  }, tag);
4999
5074
  }
5000
5075
  deleteBookableTag(role, clubOrSectionOrTeamId, tag) {
5001
- if (role == Role.ClubAdmin) {
5002
- return this.deleteClubBookableTag(clubOrSectionOrTeamId, tag);
5076
+ switch (role) {
5077
+ case Role.ClubAdmin:
5078
+ return this.deleteClubBookableTag(clubOrSectionOrTeamId, tag);
5079
+ default:
5080
+ return this.deleteSectionBookableTag(clubOrSectionOrTeamId, tag);
5003
5081
  }
5004
- return this.deleteSectionBookableTag(clubOrSectionOrTeamId, tag);
5005
5082
  }
5006
5083
  deleteClubBookableTag(clubId, tag) {
5007
5084
  return this.apiService
@@ -5019,14 +5096,17 @@ class BookableService {
5019
5096
  }
5020
5097
  // endregion
5021
5098
  // region Bookable Parts
5022
- getBookableParts(role, clubOrSectionOrTeamId, bookableId) {
5023
- if (role == Role.ClubAdmin) {
5024
- return this.getClubBookableParts(clubOrSectionOrTeamId, bookableId);
5025
- }
5026
- else if (role == Role.SectionAdmin) {
5027
- return this.getSectionBookableParts(clubOrSectionOrTeamId, bookableId);
5099
+ getBookableParts(role, itemId, bookableId) {
5100
+ switch (role) {
5101
+ case Role.ClubAdmin:
5102
+ return this.getClubBookableParts(itemId, bookableId);
5103
+ case Role.SectionAdmin:
5104
+ return this.getSectionBookableParts(itemId, bookableId);
5105
+ case Role.TeamAdmin:
5106
+ return this.getTeamBookableParts(itemId, bookableId);
5107
+ default:
5108
+ return this.getMemberBookableParts(itemId, bookableId);
5028
5109
  }
5029
- return this.getTeamBookableParts(clubOrSectionOrTeamId, bookableId);
5030
5110
  }
5031
5111
  getClubBookableParts(clubId, bookableId) {
5032
5112
  return this.apiService
@@ -5040,6 +5120,10 @@ class BookableService {
5040
5120
  return this.apiService
5041
5121
  .getCollection(bookablePartFactory, Role.TeamAdmin, TEAM_BOOKABLE_PARTS_PATH, { teamId, bookableId }, { params: { limit: 'null' } });
5042
5122
  }
5123
+ getMemberBookableParts(memberId, bookableId) {
5124
+ return this.apiService
5125
+ .getCollection(bookablePartFactory, Role.MemberAdmin, MEMBER_BOOKABLE_PARTS_PATH, { memberId, bookableId }, { params: { limit: 'null' } });
5126
+ }
5043
5127
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: BookableService, deps: [{ token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
5044
5128
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: BookableService, providedIn: 'root' });
5045
5129
  }
@@ -5094,6 +5178,15 @@ const TEAM_BOOKING_CALENDAR_SLOT_SESSION_PATH = ':teamId/activities/sessions/:id
5094
5178
  const TEAM_BOOKING_CALENDAR_SLOT_PATH = ':teamId/activities/slots/:id/';
5095
5179
  const TEAM_BOOKING_CALENDAR_APPLICATION_TIMES_PATH = ':teamId/activities/application-times/';
5096
5180
  const TEAM_BOOKING_CALENDAR_APPLICATION_TIME_PATH = ':teamId/activities/application-times/:id/';
5181
+ const MEMBER_BOOKING_CALENDARS_PATH = ':memberId/activities/booking-calendars/';
5182
+ const MEMBER_BOOKING_CALENDAR_SLOTS_PATH = ':memberId/activities/slots/';
5183
+ const MEMBER_BOOKING_CALENDAR_SLOTS_APPLICATION_TIMES_PATH = ':memberId/activities/slots/application-times/';
5184
+ const MEMBER_BOOKING_SETTINGS_PATH = ':memberId/activities/booking-settings/';
5185
+ const MEMBER_BOOKING_CALENDAR_SLOT_SESSIONS_PATH = ':memberId/activities/sessions/';
5186
+ const MEMBER_BOOKING_CALENDAR_SLOT_SESSION_PATH = ':memberId/activities/sessions/:id/';
5187
+ const MEMBER_BOOKING_CALENDAR_SLOT_PATH = ':memberId/activities/slots/:id/';
5188
+ const MEMBER_BOOKING_CALENDAR_APPLICATION_TIMES_PATH = ':memberId/activities/application-times/';
5189
+ const MEMBER_BOOKING_CALENDAR_APPLICATION_TIME_PATH = ':memberId/activities/application-times/:id/';
5097
5190
  class BookingCalendarService {
5098
5191
  apiService;
5099
5192
  constructor(apiService) {
@@ -5101,10 +5194,12 @@ class BookingCalendarService {
5101
5194
  }
5102
5195
  // region Booking calendar
5103
5196
  createBookingCalendar(role, clubOrSectionOrTeamId, calendar) {
5104
- if (role === Role.ClubAdmin) {
5105
- return this.createClubBookingCalendar(clubOrSectionOrTeamId, calendar);
5197
+ switch (role) {
5198
+ case Role.ClubAdmin:
5199
+ return this.createClubBookingCalendar(clubOrSectionOrTeamId, calendar);
5200
+ default:
5201
+ return this.createSectionBookingCalendar(clubOrSectionOrTeamId, calendar);
5106
5202
  }
5107
- return this.createSectionBookingCalendar(clubOrSectionOrTeamId, calendar);
5108
5203
  }
5109
5204
  createClubBookingCalendar(clubId, calendar) {
5110
5205
  delete calendar.id;
@@ -5120,14 +5215,17 @@ class BookingCalendarService {
5120
5215
  sectionId,
5121
5216
  }, calendar);
5122
5217
  }
5123
- getBookingCalendars(role, clubOrSectionOrTeamId, name = null) {
5124
- if (role == Role.ClubAdmin) {
5125
- return this.getClubBookingCalendars(clubOrSectionOrTeamId, name);
5126
- }
5127
- else if (role == Role.SectionAdmin) {
5128
- return this.getSectionBookingCalendars(clubOrSectionOrTeamId, name);
5218
+ getBookingCalendars(role, itemId, name = null) {
5219
+ switch (role) {
5220
+ case Role.ClubAdmin:
5221
+ return this.getClubBookingCalendars(itemId, name);
5222
+ case Role.SectionAdmin:
5223
+ return this.getSectionBookingCalendars(itemId, name);
5224
+ case Role.TeamAdmin:
5225
+ return this.getTeamBookingCalendars(itemId, name);
5226
+ default:
5227
+ return this.getMemberBookingCalendars(itemId, name);
5129
5228
  }
5130
- return this.getTeamBookingCalendars(clubOrSectionOrTeamId, name);
5131
5229
  }
5132
5230
  getClubBookingCalendars(clubId, name = null) {
5133
5231
  const params = { limit: 'null' };
@@ -5159,11 +5257,23 @@ class BookingCalendarService {
5159
5257
  params
5160
5258
  });
5161
5259
  }
5260
+ getMemberBookingCalendars(memberId, name = null) {
5261
+ const params = { limit: 'null' };
5262
+ if (name) {
5263
+ params['name'] = name;
5264
+ }
5265
+ return this.apiService
5266
+ .getCollection(bookingCalendarFactory, Role.MemberAdmin, MEMBER_BOOKING_CALENDARS_PATH, { memberId }, {
5267
+ params
5268
+ });
5269
+ }
5162
5270
  updateBookingCalendar(role, clubOrSectionOrTeamId, calendar) {
5163
- if (role === Role.ClubAdmin) {
5164
- return this.updateClubBookingCalendar(clubOrSectionOrTeamId, calendar);
5271
+ switch (role) {
5272
+ case Role.ClubAdmin:
5273
+ return this.updateClubBookingCalendar(clubOrSectionOrTeamId, calendar);
5274
+ default:
5275
+ return this.updateSectionBookingCalendar(clubOrSectionOrTeamId, calendar);
5165
5276
  }
5166
- return this.updateSectionBookingCalendar(clubOrSectionOrTeamId, calendar);
5167
5277
  }
5168
5278
  updateClubBookingCalendar(clubId, calendar) {
5169
5279
  return this.apiService
@@ -5180,10 +5290,12 @@ class BookingCalendarService {
5180
5290
  }, calendar);
5181
5291
  }
5182
5292
  deleteBookingCalendar(role, clubOrSectionOrTeamId, id) {
5183
- if (role === Role.ClubAdmin) {
5184
- return this.deleteClubBookingCalendar(clubOrSectionOrTeamId, id);
5293
+ switch (role) {
5294
+ case Role.ClubAdmin:
5295
+ return this.deleteClubBookingCalendar(clubOrSectionOrTeamId, id);
5296
+ default:
5297
+ return this.deleteSectionBookingCalendar(clubOrSectionOrTeamId, id);
5185
5298
  }
5186
- return this.deleteSectionBookingCalendar(clubOrSectionOrTeamId, id);
5187
5299
  }
5188
5300
  deleteClubBookingCalendar(clubId, id) {
5189
5301
  return this.apiService
@@ -5202,10 +5314,12 @@ class BookingCalendarService {
5202
5314
  // endregion
5203
5315
  // region Booking calendar slot
5204
5316
  createBookingCalendarSlot(role, clubOrSectionOrTeamId, slot) {
5205
- if (role === Role.ClubAdmin) {
5206
- return this.createClubBookingCalendarSlot(clubOrSectionOrTeamId, slot);
5317
+ switch (role) {
5318
+ case Role.ClubAdmin:
5319
+ return this.createClubBookingCalendarSlot(clubOrSectionOrTeamId, slot);
5320
+ default:
5321
+ return this.createSectionBookingCalendarSlot(clubOrSectionOrTeamId, slot);
5207
5322
  }
5208
- return this.createSectionBookingCalendarSlot(clubOrSectionOrTeamId, slot);
5209
5323
  }
5210
5324
  createClubBookingCalendarSlot(clubId, slot) {
5211
5325
  delete slot.id;
@@ -5221,14 +5335,17 @@ class BookingCalendarService {
5221
5335
  sectionId,
5222
5336
  }, slot);
5223
5337
  }
5224
- getBookingCalendarSlots(role, clubOrSectionOrTeamId, bookingSlotFilter) {
5225
- if (role == Role.ClubAdmin) {
5226
- return this.getClubBookingCalendarSlots(clubOrSectionOrTeamId, bookingSlotFilter);
5227
- }
5228
- else if (role == Role.SectionAdmin) {
5229
- return this.getSectionBookingCalendarSlots(clubOrSectionOrTeamId, bookingSlotFilter);
5338
+ getBookingCalendarSlots(role, itemId, bookingSlotFilter) {
5339
+ switch (role) {
5340
+ case Role.ClubAdmin:
5341
+ return this.getClubBookingCalendarSlots(itemId, bookingSlotFilter);
5342
+ case Role.SectionAdmin:
5343
+ return this.getSectionBookingCalendarSlots(itemId, bookingSlotFilter);
5344
+ case Role.TeamAdmin:
5345
+ return this.getTeamBookingCalendarSlots(itemId, bookingSlotFilter);
5346
+ default:
5347
+ return this.getMemberBookingCalendarSlots(itemId, bookingSlotFilter);
5230
5348
  }
5231
- return this.getTeamBookingCalendarSlots(clubOrSectionOrTeamId, bookingSlotFilter);
5232
5349
  }
5233
5350
  getClubBookingCalendarSlots(clubId, bookingSlotFilter) {
5234
5351
  const params = bookingSlotFilter.toParams();
@@ -5251,14 +5368,24 @@ class BookingCalendarService {
5251
5368
  params
5252
5369
  });
5253
5370
  }
5254
- getBookingCalendarSlot(role, clubOrSectionOrTeamId, slotId) {
5255
- if (role == Role.ClubAdmin) {
5256
- return this.getClubBookingCalendarSlot(clubOrSectionOrTeamId, slotId);
5257
- }
5258
- else if (role == Role.SectionAdmin) {
5259
- return this.getSectionBookingCalendarSlot(clubOrSectionOrTeamId, slotId);
5371
+ getMemberBookingCalendarSlots(memberId, bookingSlotFilter) {
5372
+ const params = bookingSlotFilter.toParams();
5373
+ return this.apiService
5374
+ .getCollection(bookingCalendarSlotFactory, Role.MemberAdmin, MEMBER_BOOKING_CALENDAR_SLOTS_PATH, { memberId }, {
5375
+ params
5376
+ });
5377
+ }
5378
+ getBookingCalendarSlot(role, itemId, slotId) {
5379
+ switch (role) {
5380
+ case Role.ClubAdmin:
5381
+ return this.getClubBookingCalendarSlot(itemId, slotId);
5382
+ case Role.SectionAdmin:
5383
+ return this.getSectionBookingCalendarSlot(itemId, slotId);
5384
+ case Role.TeamAdmin:
5385
+ return this.getTeamBookingCalendarSlot(itemId, slotId);
5386
+ default:
5387
+ return this.getMemberBookingCalendarSlot(itemId, slotId);
5260
5388
  }
5261
- return this.getTeamBookingCalendarSlot(clubOrSectionOrTeamId, slotId);
5262
5389
  }
5263
5390
  getClubBookingCalendarSlot(clubId, slotId) {
5264
5391
  return this.apiService
@@ -5281,14 +5408,24 @@ class BookingCalendarService {
5281
5408
  id: slotId
5282
5409
  });
5283
5410
  }
5284
- getBookingCalendarApplicationTimeSlots(role, clubOrSectionOrTeamId, bookingSlotFilter) {
5285
- if (role == Role.ClubAdmin) {
5286
- return this.getClubBookingCalendarApplicationTimeSlots(clubOrSectionOrTeamId, bookingSlotFilter);
5287
- }
5288
- else if (role == Role.SectionAdmin) {
5289
- return this.getSectionBookingCalendarApplicationTimeSlots(clubOrSectionOrTeamId, bookingSlotFilter);
5411
+ getMemberBookingCalendarSlot(memberId, slotId) {
5412
+ return this.apiService
5413
+ .getResource(bookingCalendarSlotFactory, Role.MemberAdmin, MEMBER_BOOKING_CALENDAR_SLOT_PATH, {
5414
+ memberId,
5415
+ id: slotId
5416
+ });
5417
+ }
5418
+ getBookingCalendarApplicationTimeSlots(role, itemId, bookingSlotFilter) {
5419
+ switch (role) {
5420
+ case Role.ClubAdmin:
5421
+ return this.getClubBookingCalendarApplicationTimeSlots(itemId, bookingSlotFilter);
5422
+ case Role.SectionAdmin:
5423
+ return this.getSectionBookingCalendarApplicationTimeSlots(itemId, bookingSlotFilter);
5424
+ case Role.TeamAdmin:
5425
+ return this.getTeamBookingCalendarApplicationTimeSlots(itemId, bookingSlotFilter);
5426
+ default:
5427
+ return this.getMemberBookingCalendarApplicationTimeSlots(itemId, bookingSlotFilter);
5290
5428
  }
5291
- return this.getTeamBookingCalendarApplicationTimeSlots(clubOrSectionOrTeamId, bookingSlotFilter);
5292
5429
  }
5293
5430
  getClubBookingCalendarApplicationTimeSlots(clubId, bookingSlotFilter) {
5294
5431
  const params = bookingSlotFilter.toParams();
@@ -5311,14 +5448,24 @@ class BookingCalendarService {
5311
5448
  params
5312
5449
  });
5313
5450
  }
5314
- getBookingCalendarApplicationTimes(role, clubOrSectionOrTeamId, bookingSlotFilter) {
5315
- if (role == Role.ClubAdmin) {
5316
- return this.getClubBookingCalendarApplicationTimes(clubOrSectionOrTeamId, bookingSlotFilter);
5317
- }
5318
- else if (role == Role.SectionAdmin) {
5319
- return this.getSectionBookingCalendarApplicationTimes(clubOrSectionOrTeamId, bookingSlotFilter);
5451
+ getMemberBookingCalendarApplicationTimeSlots(memberId, bookingSlotFilter) {
5452
+ const params = bookingSlotFilter.toParams();
5453
+ return this.apiService
5454
+ .getCollection(bookingCalendarSlotFactory, Role.MemberAdmin, MEMBER_BOOKING_CALENDAR_SLOTS_APPLICATION_TIMES_PATH, { memberId }, {
5455
+ params
5456
+ });
5457
+ }
5458
+ getBookingCalendarApplicationTimes(role, itemId, bookingSlotFilter) {
5459
+ switch (role) {
5460
+ case Role.ClubAdmin:
5461
+ return this.getClubBookingCalendarApplicationTimes(itemId, bookingSlotFilter);
5462
+ case Role.SectionAdmin:
5463
+ return this.getSectionBookingCalendarApplicationTimes(itemId, bookingSlotFilter);
5464
+ case Role.TeamAdmin:
5465
+ return this.getTeamBookingCalendarApplicationTimes(itemId, bookingSlotFilter);
5466
+ default:
5467
+ return this.getMemberBookingCalendarApplicationTimes(itemId, bookingSlotFilter);
5320
5468
  }
5321
- return this.getTeamBookingCalendarApplicationTimes(clubOrSectionOrTeamId, bookingSlotFilter);
5322
5469
  }
5323
5470
  getClubBookingCalendarApplicationTimes(clubId, bookingSlotFilter) {
5324
5471
  const params = bookingSlotFilter.toParams();
@@ -5341,11 +5488,20 @@ class BookingCalendarService {
5341
5488
  params
5342
5489
  });
5343
5490
  }
5491
+ getMemberBookingCalendarApplicationTimes(memberId, bookingSlotFilter) {
5492
+ const params = bookingSlotFilter.toParams();
5493
+ return this.apiService
5494
+ .getCollection(bookingCalendarApplicationTimeFactory, Role.MemberAdmin, MEMBER_BOOKING_CALENDAR_APPLICATION_TIMES_PATH, { memberId }, {
5495
+ params
5496
+ });
5497
+ }
5344
5498
  copyBookingCalendarSlots(role, clubOrSectionOrTeamId, weekRelativeIndexes, onlyCopySlots = false, weekdays = [], bookingSlotFilter) {
5345
- if (role === Role.ClubAdmin) {
5346
- return this.copyClubBookingCalendarSlots(clubOrSectionOrTeamId, weekRelativeIndexes, onlyCopySlots, weekdays, bookingSlotFilter);
5499
+ switch (role) {
5500
+ case Role.ClubAdmin:
5501
+ return this.copyClubBookingCalendarSlots(clubOrSectionOrTeamId, weekRelativeIndexes, onlyCopySlots, weekdays, bookingSlotFilter);
5502
+ default:
5503
+ return this.copySectionBookingCalendarSlots(clubOrSectionOrTeamId, weekRelativeIndexes, onlyCopySlots, weekdays, bookingSlotFilter);
5347
5504
  }
5348
- return this.copySectionBookingCalendarSlots(clubOrSectionOrTeamId, weekRelativeIndexes, onlyCopySlots, weekdays, bookingSlotFilter);
5349
5505
  }
5350
5506
  copyClubBookingCalendarSlots(clubId, weekRelativeIndexes, onlyCopySlots = false, weekdays = [], bookingSlotFilter) {
5351
5507
  const params = bookingSlotFilter.toParams();
@@ -5370,10 +5526,12 @@ class BookingCalendarService {
5370
5526
  });
5371
5527
  }
5372
5528
  clearBookingCalendarSlots(role, clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, shouldDeleteRepeatingSlots = false, weekdays = [], bookingSlotFilter) {
5373
- if (role === Role.ClubAdmin) {
5374
- return this.clearClubBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions, shouldDeleteRepeatingSlots, weekdays, bookingSlotFilter);
5529
+ switch (role) {
5530
+ case Role.ClubAdmin:
5531
+ return this.clearClubBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions, shouldDeleteRepeatingSlots, weekdays, bookingSlotFilter);
5532
+ default:
5533
+ return this.clearSectionBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions, shouldDeleteRepeatingSlots, weekdays, bookingSlotFilter);
5375
5534
  }
5376
- return this.clearSectionBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions, shouldDeleteRepeatingSlots, weekdays, bookingSlotFilter);
5377
5535
  }
5378
5536
  clearClubBookingCalendarSlots(clubId, currentWeekStartDate, weekRelativeIndexes, onlyDeleteSessions = false, shouldDeleteRepeatingSlots = false, weekdays = [], bookingSlotFilter) {
5379
5537
  const params = bookingSlotFilter.toParams();
@@ -5404,13 +5562,14 @@ class BookingCalendarService {
5404
5562
  });
5405
5563
  }
5406
5564
  syncBookingCalendarSlots(role, clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, bookingSlotFilter) {
5407
- if (role == Role.ClubAdmin) {
5408
- return this.syncClubBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, bookingSlotFilter);
5409
- }
5410
- else if (role == Role.SectionAdmin) {
5411
- return this.syncSectionBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, bookingSlotFilter);
5565
+ switch (role) {
5566
+ case Role.ClubAdmin:
5567
+ return this.syncClubBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, bookingSlotFilter);
5568
+ case Role.SectionAdmin:
5569
+ return this.syncSectionBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, bookingSlotFilter);
5570
+ default:
5571
+ return this.syncTeamBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, bookingSlotFilter);
5412
5572
  }
5413
- return this.syncTeamBookingCalendarSlots(clubOrSectionOrTeamId, currentWeekStartDate, weekRelativeIndexes, bookingSlotFilter);
5414
5573
  }
5415
5574
  syncClubBookingCalendarSlots(clubId, currentWeekStartDate, weekRelativeIndexes, bookingSlotFilter) {
5416
5575
  const params = bookingSlotFilter.toParams();
@@ -5437,10 +5596,12 @@ class BookingCalendarService {
5437
5596
  }, { params });
5438
5597
  }
5439
5598
  updateBookingCalendarSlot(role, clubOrSectionOrTeamId, slot) {
5440
- if (role === Role.ClubAdmin) {
5441
- return this.updateClubBookingCalendarSlot(clubOrSectionOrTeamId, slot);
5599
+ switch (role) {
5600
+ case Role.ClubAdmin:
5601
+ return this.updateClubBookingCalendarSlot(clubOrSectionOrTeamId, slot);
5602
+ default:
5603
+ return this.updateSectionBookingCalendarSlot(clubOrSectionOrTeamId, slot);
5442
5604
  }
5443
- return this.updateSectionBookingCalendarSlot(clubOrSectionOrTeamId, slot);
5444
5605
  }
5445
5606
  updateClubBookingCalendarSlot(clubId, slot) {
5446
5607
  return this.apiService
@@ -5457,10 +5618,12 @@ class BookingCalendarService {
5457
5618
  }, slot);
5458
5619
  }
5459
5620
  deleteBookingCalendarSlot(role, clubOrSectionOrTeamId, id) {
5460
- if (role === Role.ClubAdmin) {
5461
- return this.deleteClubBookingCalendarSlot(clubOrSectionOrTeamId, id);
5621
+ switch (role) {
5622
+ case Role.ClubAdmin:
5623
+ return this.deleteClubBookingCalendarSlot(clubOrSectionOrTeamId, id);
5624
+ default:
5625
+ return this.deleteSectionBookingCalendarSlot(clubOrSectionOrTeamId, id);
5462
5626
  }
5463
- return this.deleteSectionBookingCalendarSlot(clubOrSectionOrTeamId, id);
5464
5627
  }
5465
5628
  deleteClubBookingCalendarSlot(clubId, id) {
5466
5629
  return this.apiService
@@ -5477,10 +5640,12 @@ class BookingCalendarService {
5477
5640
  });
5478
5641
  }
5479
5642
  deleteBookingCalendarSlotRepeatable(role, clubOrSectionOrTeamId, id, deleteUntilDate) {
5480
- if (role === Role.ClubAdmin) {
5481
- return this.deleteClubBookingCalendarSlotRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
5643
+ switch (role) {
5644
+ case Role.ClubAdmin:
5645
+ return this.deleteClubBookingCalendarSlotRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
5646
+ default:
5647
+ return this.deleteSectionBookingCalendarSlotRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
5482
5648
  }
5483
- return this.deleteSectionBookingCalendarSlotRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
5484
5649
  }
5485
5650
  deleteClubBookingCalendarSlotRepeatable(clubId, id, deleteUntilDate) {
5486
5651
  return this.apiService
@@ -5498,14 +5663,17 @@ class BookingCalendarService {
5498
5663
  }
5499
5664
  // endregion
5500
5665
  // region Booking calendar slot session
5501
- createBookingCalendarSlotSession(role, clubOrSectionOrTeamId, session) {
5502
- if (role === Role.ClubAdmin) {
5503
- return this.createClubBookingCalendarSlotSession(clubOrSectionOrTeamId, session);
5504
- }
5505
- else if (role === Role.SectionAdmin) {
5506
- return this.createSectionBookingCalendarSlotSession(clubOrSectionOrTeamId, session);
5666
+ createBookingCalendarSlotSession(role, itemId, session) {
5667
+ switch (role) {
5668
+ case Role.ClubAdmin:
5669
+ return this.createClubBookingCalendarSlotSession(itemId, session);
5670
+ case Role.SectionAdmin:
5671
+ return this.createSectionBookingCalendarSlotSession(itemId, session);
5672
+ case Role.TeamAdmin:
5673
+ return this.createTeamBookingCalendarSlotSession(itemId, session);
5674
+ default:
5675
+ return this.createMemberBookingCalendarSlotSession(itemId, session);
5507
5676
  }
5508
- return this.createTeamBookingCalendarSlotSession(clubOrSectionOrTeamId, session);
5509
5677
  }
5510
5678
  createClubBookingCalendarSlotSession(clubId, session) {
5511
5679
  delete session.id;
@@ -5524,18 +5692,24 @@ class BookingCalendarService {
5524
5692
  createTeamBookingCalendarSlotSession(teamId, session) {
5525
5693
  delete session.id;
5526
5694
  return this.apiService
5527
- .postResource(bookingCalendarSlotSessionFactory, Role.TeamAdmin, TEAM_BOOKING_CALENDAR_SLOT_SESSIONS_PATH, {
5528
- teamId,
5529
- }, session);
5695
+ .postResource(bookingCalendarSlotSessionFactory, Role.TeamAdmin, TEAM_BOOKING_CALENDAR_SLOT_SESSIONS_PATH, { teamId }, session);
5530
5696
  }
5531
- updateBookingCalendarSlotSession(role, clubOrSectionOrTeamId, session) {
5532
- if (role === Role.ClubAdmin) {
5533
- return this.updateClubBookingCalendarSlotSession(clubOrSectionOrTeamId, session);
5534
- }
5535
- else if (role === Role.SectionAdmin) {
5536
- return this.updateSectionBookingCalendarSlotSession(clubOrSectionOrTeamId, session);
5697
+ createMemberBookingCalendarSlotSession(memberId, session) {
5698
+ delete session.id;
5699
+ return this.apiService
5700
+ .postResource(bookingCalendarSlotSessionFactory, Role.MemberAdmin, MEMBER_BOOKING_CALENDAR_SLOT_SESSIONS_PATH, { memberId }, session);
5701
+ }
5702
+ updateBookingCalendarSlotSession(role, itemId, session) {
5703
+ switch (role) {
5704
+ case Role.ClubAdmin:
5705
+ return this.updateClubBookingCalendarSlotSession(itemId, session);
5706
+ case Role.SectionAdmin:
5707
+ return this.updateSectionBookingCalendarSlotSession(itemId, session);
5708
+ case Role.TeamAdmin:
5709
+ return this.updateTeamBookingCalendarSlotSession(itemId, session);
5710
+ default:
5711
+ return this.updateMemberBookingCalendarSlotSession(itemId, session);
5537
5712
  }
5538
- return this.updateTeamBookingCalendarSlotSession(clubOrSectionOrTeamId, session);
5539
5713
  }
5540
5714
  updateClubBookingCalendarSlotSession(clubId, session) {
5541
5715
  return this.apiService
@@ -5558,14 +5732,24 @@ class BookingCalendarService {
5558
5732
  id: session.id,
5559
5733
  }, session);
5560
5734
  }
5561
- deleteBookingCalendarSlotSession(role, clubOrSectionOrTeamId, id) {
5562
- if (role == Role.ClubAdmin) {
5563
- return this.deleteClubBookingCalendarSlotSession(clubOrSectionOrTeamId, id);
5564
- }
5565
- else if (role == Role.SectionAdmin) {
5566
- return this.deleteSectionBookingCalendarSlotSession(clubOrSectionOrTeamId, id);
5735
+ updateMemberBookingCalendarSlotSession(memberId, session) {
5736
+ return this.apiService
5737
+ .updateResource(bookingCalendarSlotSessionFactory, Role.MemberAdmin, MEMBER_BOOKING_CALENDAR_SLOT_SESSION_PATH, {
5738
+ memberId,
5739
+ id: session.id,
5740
+ }, session);
5741
+ }
5742
+ deleteBookingCalendarSlotSession(role, itemId, id) {
5743
+ switch (role) {
5744
+ case Role.ClubAdmin:
5745
+ return this.deleteClubBookingCalendarSlotSession(itemId, id);
5746
+ case Role.SectionAdmin:
5747
+ return this.deleteSectionBookingCalendarSlotSession(itemId, id);
5748
+ case Role.TeamAdmin:
5749
+ return this.deleteTeamBookingCalendarSlotSession(itemId, id);
5750
+ default:
5751
+ return this.deleteMemberBookingCalendarSlotSession(itemId, id);
5567
5752
  }
5568
- return this.deleteTeamBookingCalendarSlotSession(clubOrSectionOrTeamId, id);
5569
5753
  }
5570
5754
  deleteClubBookingCalendarSlotSession(clubId, id) {
5571
5755
  return this.apiService
@@ -5588,11 +5772,20 @@ class BookingCalendarService {
5588
5772
  id
5589
5773
  });
5590
5774
  }
5775
+ deleteMemberBookingCalendarSlotSession(memberId, id) {
5776
+ return this.apiService
5777
+ .deleteResource(Role.MemberAdmin, MEMBER_BOOKING_CALENDAR_SLOT_SESSION_PATH, {
5778
+ memberId,
5779
+ id
5780
+ });
5781
+ }
5591
5782
  deleteBookingCalendarSlotSessionRepeatable(role, clubOrSectionOrTeamId, id, deleteUntilDate) {
5592
- if (role === Role.ClubAdmin) {
5593
- return this.deleteClubBookingCalendarSlotSessionRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
5783
+ switch (role) {
5784
+ case Role.ClubAdmin:
5785
+ return this.deleteClubBookingCalendarSlotSessionRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
5786
+ default:
5787
+ return this.deleteSectionBookingCalendarSlotSessionRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
5594
5788
  }
5595
- return this.deleteSectionBookingCalendarSlotSessionRepeatable(clubOrSectionOrTeamId, id, deleteUntilDate);
5596
5789
  }
5597
5790
  deleteClubBookingCalendarSlotSessionRepeatable(clubId, id, deleteUntilDate) {
5598
5791
  return this.apiService
@@ -5610,14 +5803,17 @@ class BookingCalendarService {
5610
5803
  }
5611
5804
  // endregion
5612
5805
  // region Booking Setting
5613
- getBookingSettings(role, clubOrSectionOrTeamId) {
5614
- if (role == Role.ClubAdmin) {
5615
- return this.getClubBookingSettings(clubOrSectionOrTeamId);
5806
+ getBookingSettings(role, itemId) {
5807
+ switch (role) {
5808
+ case Role.ClubAdmin:
5809
+ return this.getClubBookingSettings(itemId);
5810
+ case Role.SectionAdmin:
5811
+ return this.getSectionBookingSettings(itemId);
5812
+ case Role.TeamAdmin:
5813
+ return this.getTeamBookingSettings(itemId);
5814
+ default:
5815
+ return this.getMemberBookingSettings(itemId);
5616
5816
  }
5617
- else if (role == Role.SectionAdmin) {
5618
- return this.getSectionBookingSettings(clubOrSectionOrTeamId);
5619
- }
5620
- return this.getTeamBookingSettings(clubOrSectionOrTeamId);
5621
5817
  }
5622
5818
  getClubBookingSettings(clubId) {
5623
5819
  return this.apiService
@@ -5631,14 +5827,21 @@ class BookingCalendarService {
5631
5827
  return this.apiService
5632
5828
  .getResource(bookingSettingsFactory, Role.TeamAdmin, TEAM_BOOKING_SETTINGS_PATH, { teamId });
5633
5829
  }
5634
- updateBookingSettings(role, clubOrSectionOrTeamId, bookingSettings) {
5635
- if (role == Role.ClubAdmin) {
5636
- return this.updateClubBookingSettings(clubOrSectionOrTeamId, bookingSettings);
5637
- }
5638
- else if (role == Role.SectionAdmin) {
5639
- return this.updateSectionBookingSettings(clubOrSectionOrTeamId, bookingSettings);
5830
+ getMemberBookingSettings(memberId) {
5831
+ return this.apiService
5832
+ .getResource(bookingSettingsFactory, Role.MemberAdmin, MEMBER_BOOKING_SETTINGS_PATH, { memberId });
5833
+ }
5834
+ updateBookingSettings(role, itemId, bookingSettings) {
5835
+ switch (role) {
5836
+ case Role.ClubAdmin:
5837
+ return this.updateClubBookingSettings(itemId, bookingSettings);
5838
+ case Role.SectionAdmin:
5839
+ return this.updateSectionBookingSettings(itemId, bookingSettings);
5840
+ case Role.TeamAdmin:
5841
+ return this.updateTeamBookingSettings(itemId, bookingSettings);
5842
+ default:
5843
+ return this.updateMemberBookingSettings(itemId, bookingSettings);
5640
5844
  }
5641
- return this.updateTeamBookingSettings(clubOrSectionOrTeamId, bookingSettings);
5642
5845
  }
5643
5846
  updateClubBookingSettings(clubId, bookingSettings) {
5644
5847
  return this.apiService
@@ -5658,16 +5861,23 @@ class BookingCalendarService {
5658
5861
  teamId,
5659
5862
  }, bookingSettings);
5660
5863
  }
5864
+ updateMemberBookingSettings(memberId, bookingSettings) {
5865
+ return this.apiService
5866
+ .updateResource(bookingSettingsFactory, Role.MemberAdmin, MEMBER_BOOKING_SETTINGS_PATH, { memberId }, bookingSettings);
5867
+ }
5661
5868
  // endregion
5662
5869
  // region Booking Calendar Application Times
5663
- updateBookingCalendarApplicationTime(role, clubOrSectionOrTeamId, availableTime) {
5664
- if (role == Role.ClubAdmin) {
5665
- return this.updateClubBookingCalendarApplicationTime(clubOrSectionOrTeamId, availableTime);
5870
+ updateBookingCalendarApplicationTime(role, itemId, availableTime) {
5871
+ switch (role) {
5872
+ case Role.ClubAdmin:
5873
+ return this.updateClubBookingCalendarApplicationTime(itemId, availableTime);
5874
+ case Role.SectionAdmin:
5875
+ return this.updateSectionBookingCalendarApplicationTime(itemId, availableTime);
5876
+ case Role.TeamAdmin:
5877
+ return this.updateTeamBookingCalendarApplicationTime(itemId, availableTime);
5878
+ default:
5879
+ return this.updateMemberBookingCalendarApplicationTime(itemId, availableTime);
5666
5880
  }
5667
- else if (role == Role.SectionAdmin) {
5668
- return this.updateSectionBookingCalendarApplicationTime(clubOrSectionOrTeamId, availableTime);
5669
- }
5670
- return this.updateTeamBookingCalendarApplicationTime(clubOrSectionOrTeamId, availableTime);
5671
5881
  }
5672
5882
  updateClubBookingCalendarApplicationTime(clubId, availableTime) {
5673
5883
  return this.apiService
@@ -5690,6 +5900,13 @@ class BookingCalendarService {
5690
5900
  id: availableTime.id,
5691
5901
  }, availableTime);
5692
5902
  }
5903
+ updateMemberBookingCalendarApplicationTime(memberId, availableTime) {
5904
+ return this.apiService
5905
+ .updateResource(bookingCalendarApplicationTimeFactory, Role.MemberAdmin, MEMBER_BOOKING_CALENDAR_APPLICATION_TIME_PATH, {
5906
+ memberId,
5907
+ id: availableTime.id,
5908
+ }, availableTime);
5909
+ }
5693
5910
  createTeamBookingCalendarApplicationTime(teamId, availableTime) {
5694
5911
  delete availableTime.id;
5695
5912
  return this.apiService
@@ -5697,14 +5914,22 @@ class BookingCalendarService {
5697
5914
  teamId,
5698
5915
  }, availableTime);
5699
5916
  }
5700
- deleteBookingCalendarApplicationTime(role, clubOrSectionOrTeamId, availableTimeId) {
5701
- if (role == Role.ClubAdmin) {
5702
- return this.deleteClubBookingCalendarApplicationTime(clubOrSectionOrTeamId, availableTimeId);
5703
- }
5704
- else if (role == Role.SectionAdmin) {
5705
- return this.deleteSectionBookingCalendarApplicationTime(clubOrSectionOrTeamId, availableTimeId);
5917
+ createMemberBookingCalendarApplicationTime(memberId, availableTime) {
5918
+ delete availableTime.id;
5919
+ return this.apiService
5920
+ .postResource(bookingCalendarApplicationTimeFactory, Role.MemberAdmin, MEMBER_BOOKING_CALENDAR_APPLICATION_TIMES_PATH, { memberId }, availableTime);
5921
+ }
5922
+ deleteBookingCalendarApplicationTime(role, itemId, availableTimeId) {
5923
+ switch (role) {
5924
+ case Role.ClubAdmin:
5925
+ return this.deleteClubBookingCalendarApplicationTime(itemId, availableTimeId);
5926
+ case Role.SectionAdmin:
5927
+ return this.deleteSectionBookingCalendarApplicationTime(itemId, availableTimeId);
5928
+ case Role.TeamAdmin:
5929
+ return this.deleteTeamBookingCalendarApplicationTime(itemId, availableTimeId);
5930
+ default:
5931
+ return this.deleteMemberBookingCalendarApplicationTime(itemId, availableTimeId);
5706
5932
  }
5707
- return this.deleteTeamBookingCalendarApplicationTime(clubOrSectionOrTeamId, availableTimeId);
5708
5933
  }
5709
5934
  deleteClubBookingCalendarApplicationTime(clubId, id) {
5710
5935
  return this.apiService
@@ -5727,13 +5952,22 @@ class BookingCalendarService {
5727
5952
  id
5728
5953
  });
5729
5954
  }
5955
+ deleteMemberBookingCalendarApplicationTime(memberId, id) {
5956
+ return this.apiService
5957
+ .deleteResource(Role.MemberAdmin, MEMBER_BOOKING_CALENDAR_APPLICATION_TIME_PATH, {
5958
+ memberId,
5959
+ id
5960
+ });
5961
+ }
5730
5962
  // endregion
5731
5963
  // region Overbooked sessions
5732
5964
  getOverbookedSessions(role, clubOrSectionOrTeamId, bookingSlotFilter) {
5733
- if (role == Role.ClubAdmin) {
5734
- return this.getClubOverbookedSessions(clubOrSectionOrTeamId, bookingSlotFilter);
5965
+ switch (role) {
5966
+ case Role.ClubAdmin:
5967
+ return this.getClubOverbookedSessions(clubOrSectionOrTeamId, bookingSlotFilter);
5968
+ default:
5969
+ return this.getSectionOverbookedSessions(clubOrSectionOrTeamId, bookingSlotFilter);
5735
5970
  }
5736
- return this.getSectionOverbookedSessions(clubOrSectionOrTeamId, bookingSlotFilter);
5737
5971
  }
5738
5972
  getClubOverbookedSessions(clubId, bookingSlotFilter) {
5739
5973
  const params = bookingSlotFilter.toParams();
@@ -5752,10 +5986,12 @@ class BookingCalendarService {
5752
5986
  // endregion
5753
5987
  // region Overbooked bookables
5754
5988
  getOverbookedBookables(role, clubOrSectionOrTeamId, bookingSlotFilter) {
5755
- if (role == Role.ClubAdmin) {
5756
- return this.getClubOverbookedBookables(clubOrSectionOrTeamId, bookingSlotFilter);
5989
+ switch (role) {
5990
+ case Role.ClubAdmin:
5991
+ return this.getClubOverbookedBookables(clubOrSectionOrTeamId, bookingSlotFilter);
5992
+ default:
5993
+ return this.getSectionOverbookedBookables(clubOrSectionOrTeamId, bookingSlotFilter);
5757
5994
  }
5758
- return this.getSectionOverbookedBookables(clubOrSectionOrTeamId, bookingSlotFilter);
5759
5995
  }
5760
5996
  getClubOverbookedBookables(clubId, bookingSlotFilter) {
5761
5997
  const params = bookingSlotFilter.toParams();
@@ -5950,19 +6186,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
5950
6186
  const CLUB_FEATURE_FLAGS_PATH = ':clubId/feature-flags/';
5951
6187
  const SECTION_FEATURE_FLAGS_PATH = ':sectionId/feature-flags/';
5952
6188
  const TEAM_FEATURE_FLAGS_PATH = ':teamId/feature-flags/';
6189
+ const MEMBER_FEATURE_FLAGS_PATH = ':memberId/feature-flags/';
5953
6190
  class FeatureFlagsService {
5954
6191
  apiService;
5955
6192
  constructor(apiService) {
5956
6193
  this.apiService = apiService;
5957
6194
  }
5958
- getFeatureFlags(role, clubOrSectionOrTeamId) {
5959
- if (role === Role.ClubAdmin) {
5960
- return this.getClubFeatureFlags(clubOrSectionOrTeamId);
5961
- }
5962
- else if (role === Role.SectionAdmin) {
5963
- return this.getSectionFeatureFlags(clubOrSectionOrTeamId);
6195
+ getFeatureFlags(role, itemId) {
6196
+ switch (role) {
6197
+ case Role.ClubAdmin:
6198
+ return this.getClubFeatureFlags(itemId);
6199
+ case Role.SectionAdmin:
6200
+ return this.getSectionFeatureFlags(itemId);
6201
+ case Role.TeamAdmin:
6202
+ return this.getTeamFeatureFlags(itemId);
6203
+ default:
6204
+ return this.getMemberFeatureFlags(itemId);
5964
6205
  }
5965
- return this.getTeamFeatureFlags(clubOrSectionOrTeamId);
5966
6206
  }
5967
6207
  getClubFeatureFlags(clubId) {
5968
6208
  return this.apiService
@@ -5976,6 +6216,10 @@ class FeatureFlagsService {
5976
6216
  return this.apiService
5977
6217
  .getResource(featureFlagsFactory, Role.TeamAdmin, TEAM_FEATURE_FLAGS_PATH, { teamId });
5978
6218
  }
6219
+ getMemberFeatureFlags(memberId) {
6220
+ return this.apiService
6221
+ .getResource(featureFlagsFactory, Role.MemberAdmin, MEMBER_FEATURE_FLAGS_PATH, { memberId });
6222
+ }
5979
6223
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FeatureFlagsService, deps: [{ token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
5980
6224
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FeatureFlagsService, providedIn: 'root' });
5981
6225
  }
@@ -6209,14 +6453,15 @@ class MemberService {
6209
6453
  return this.apiService
6210
6454
  .updateResource(memberFactory, Role.MemberAdmin, MEMBER_PROFILE_PATH, { memberId }, memberProfile);
6211
6455
  }
6212
- getMembers(role, clubOrSectionOrTeamId) {
6213
- if (role === Role.ClubAdmin) {
6214
- return this.getClubMembers(clubOrSectionOrTeamId);
6215
- }
6216
- else if (role === Role.SectionAdmin) {
6217
- return this.getSectionMembers(clubOrSectionOrTeamId);
6456
+ getMembers(role, itemId) {
6457
+ switch (role) {
6458
+ case Role.ClubAdmin:
6459
+ return this.getClubMembers(itemId);
6460
+ case Role.SectionAdmin:
6461
+ return this.getSectionMembers(itemId);
6462
+ default:
6463
+ return this.getTeamMembers(itemId);
6218
6464
  }
6219
- return this.getTeamMembers(clubOrSectionOrTeamId);
6220
6465
  }
6221
6466
  getClubMembers(clubId) {
6222
6467
  return this.apiService.getCollection(searchMemberFactory, Role.ClubAdmin, CLUB_MEMBERS_PATH, { clubId });
@@ -6565,11 +6810,13 @@ class TeamService {
6565
6810
  deleteTeamLeaderTeamMember(teamId, id) {
6566
6811
  return this.apiService.deleteResource(Role.TeamAdmin, TEAM_LEADER_TEAM_MEMBER_PATH, { teamId, id });
6567
6812
  }
6568
- getTeams(role, clubOrSectionOrTeamId) {
6569
- if (role === Role.ClubAdmin) {
6570
- return this.getClubTeams(clubOrSectionOrTeamId);
6813
+ getTeams(role, itemId) {
6814
+ switch (role) {
6815
+ case Role.ClubAdmin:
6816
+ return this.getClubTeams(itemId);
6817
+ default:
6818
+ return this.getSectionTeams(itemId);
6571
6819
  }
6572
- return this.getSectionTeams(clubOrSectionOrTeamId);
6573
6820
  }
6574
6821
  getClubTeams(clubId) {
6575
6822
  return this.apiService.getCollection(searchTeamFactory, Role.ClubAdmin, CLUB_TEAMS_PATH, { clubId });
@@ -8142,7 +8389,8 @@ class TokenEffects {
8142
8389
  reauthenticateTokenSuccessAction({ payload: token })
8143
8390
  ]), catchError((error) => concat([
8144
8391
  reauthenticateTokenFailureAction({ payload: error }),
8145
- clearCurrentTokenAction()
8392
+ clearCurrentTokenAction(),
8393
+ clearAuthenticationAction()
8146
8394
  ]))))));
8147
8395
  selectPublicMember$ = createEffect(() => this.actions$
8148
8396
  .pipe(ofType(selectPublicMemberAction), exhaustMap(({ payload }) => this.authenticationService.changePublicToken(payload)
@@ -9918,7 +10166,7 @@ class AuthenticationInterceptor {
9918
10166
  store;
9919
10167
  actions$;
9920
10168
  refreshTokenInProgress = false;
9921
- requestQueue = new ReplaySubject(1);
10169
+ refreshTokenSubject = new BehaviorSubject(null);
9922
10170
  constructor(store, actions$) {
9923
10171
  this.store = store;
9924
10172
  this.actions$ = actions$;
@@ -9957,7 +10205,7 @@ class AuthenticationInterceptor {
9957
10205
  return request.clone({
9958
10206
  setHeaders: {
9959
10207
  Authorization: `Bearer ${token}`
9960
- },
10208
+ }
9961
10209
  });
9962
10210
  }
9963
10211
  return request;
@@ -9965,37 +10213,24 @@ class AuthenticationInterceptor {
9965
10213
  handle401Error(request, next) {
9966
10214
  if (!this.refreshTokenInProgress) {
9967
10215
  this.refreshTokenInProgress = true;
9968
- this.requestQueue = new ReplaySubject(1);
10216
+ this.refreshTokenSubject = new BehaviorSubject(null);
9969
10217
  this.store.dispatch(reauthenticateTokenAction());
9970
- return this.actions$
9971
- .pipe(ofType(reauthenticateTokenFailureAction, reauthenticateTokenSuccessAction), take(1), switchMap(action => {
10218
+ return this.actions$.pipe(ofType(reauthenticateTokenFailureAction, reauthenticateTokenSuccessAction), take(1), switchMap(action => {
9972
10219
  this.refreshTokenInProgress = false;
9973
- if (reauthenticateTokenSuccessAction.type === action.type) {
10220
+ if (action.type === reauthenticateTokenSuccessAction.type) {
9974
10221
  const token = action.payload;
9975
- this.requestQueue.next(this.addAuthorizationHeader(request, token.accessToken));
9976
- this.requestQueue.complete();
10222
+ this.refreshTokenSubject.next(token);
9977
10223
  return next.handle(this.addAuthorizationHeader(request, token.accessToken));
9978
10224
  }
9979
10225
  else {
9980
- this.requestQueue.error(new Error('Token re-authentication failed.'));
9981
- this.requestQueue.complete();
9982
- return throwError(() => new Error('Token re-authentication failed.'));
10226
+ const error = new Error('Token re-authentication failed.');
10227
+ this.refreshTokenSubject.error(error);
10228
+ return throwError(() => error);
9983
10229
  }
9984
- }), catchError(error => {
9985
- this.refreshTokenInProgress = false;
9986
- this.requestQueue.error(error);
9987
- this.requestQueue.complete();
9988
- return throwError(() => error);
9989
10230
  }));
9990
10231
  }
9991
10232
  else {
9992
- return new Observable(observer => {
9993
- this.requestQueue.pipe(switchMap((authedRequest) => next.handle(authedRequest))).subscribe({
9994
- next: (event) => observer.next(event),
9995
- error: (err) => observer.error(err),
9996
- complete: () => observer.complete()
9997
- });
9998
- });
10233
+ return this.refreshTokenSubject.pipe(filter$1((token) => token !== null), take(1), switchMap((token) => next.handle(this.addAuthorizationHeader(request, token.accessToken))));
9999
10234
  }
10000
10235
  }
10001
10236
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: AuthenticationInterceptor, deps: [{ token: i1$2.Store }, { token: i2.Actions }], target: i0.ɵɵFactoryTarget.Injectable });