@glissandoo/lib 1.61.0 → 1.61.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.
Files changed (167) hide show
  1. package/functions/auth.js +2 -1
  2. package/functions/communication.js +2 -1
  3. package/functions/communicationComment.js +2 -1
  4. package/functions/customer.js +2 -1
  5. package/functions/customerGroup.js +2 -1
  6. package/functions/event.js +5 -2
  7. package/functions/eventPlayer.js +5 -2
  8. package/functions/eventRepertory.js +2 -1
  9. package/functions/federation.js +2 -1
  10. package/functions/federationPartnership.js +2 -1
  11. package/functions/group.js +2 -1
  12. package/functions/groupPlayer.js +2 -1
  13. package/functions/groupRepertory.js +2 -1
  14. package/functions/index.js +5 -2
  15. package/functions/jwt.js +2 -1
  16. package/functions/misc.js +2 -1
  17. package/functions/notification.js +2 -1
  18. package/functions/partner.js +2 -1
  19. package/functions/partnership.js +2 -1
  20. package/functions/partnershipGroup.js +2 -1
  21. package/functions/partnershipPlan.js +2 -1
  22. package/functions/regions.js +128 -124
  23. package/functions/subscription.js +2 -1
  24. package/functions/user.js +2 -1
  25. package/helpers/appScenes.js +5 -2
  26. package/helpers/audios.js +9 -5
  27. package/helpers/auth.js +9 -5
  28. package/helpers/badges.js +19 -10
  29. package/helpers/collections.js +5 -2
  30. package/helpers/countries.js +4 -1
  31. package/helpers/dlinks.js +5 -2
  32. package/helpers/errors.js +5 -2
  33. package/helpers/fileSections/index.js +8 -5
  34. package/helpers/fileSections/orders.js +16 -11
  35. package/helpers/glissandooAdmin.js +6 -2
  36. package/helpers/instruments/index.js +6 -3
  37. package/helpers/instruments/lists.js +19 -11
  38. package/helpers/musicStyles/index.js +36 -29
  39. package/helpers/musicStyles/orders.js +179 -174
  40. package/helpers/notifications/index.js +122 -119
  41. package/helpers/notifications/placeholders.js +26 -18
  42. package/helpers/objects.js +23 -15
  43. package/helpers/payments.js +8 -5
  44. package/helpers/plans.js +9 -6
  45. package/helpers/rates.js +6 -2
  46. package/helpers/reasons.js +21 -17
  47. package/helpers/slate.js +12 -5
  48. package/helpers/styles.js +4 -1
  49. package/helpers/ts-extras/array-includes.js +5 -1
  50. package/helpers/ts-extras/as-mutable.js +5 -1
  51. package/helpers/ts-extras/assert-error.js +5 -1
  52. package/helpers/ts-extras/index.js +33 -15
  53. package/helpers/ts-extras/is-defined.js +5 -1
  54. package/helpers/ts-extras/is-empty.js +5 -1
  55. package/helpers/ts-extras/is-finite.js +4 -1
  56. package/helpers/ts-extras/is-infinite.js +5 -1
  57. package/helpers/ts-extras/is-integer.js +4 -1
  58. package/helpers/ts-extras/is-present.js +5 -1
  59. package/helpers/ts-extras/is-safe-integer.js +4 -1
  60. package/helpers/ts-extras/object-entries.js +4 -1
  61. package/helpers/ts-extras/object-from-entries.js +4 -1
  62. package/helpers/ts-extras/object-has-own.js +5 -1
  63. package/helpers/ts-extras/object-keys.js +4 -1
  64. package/helpers/ts-extras/set-has.js +5 -1
  65. package/helpers/types.js +5 -2
  66. package/helpers/utils.d.ts +1 -0
  67. package/helpers/utils.js +23 -8
  68. package/lang/index.js +51 -42
  69. package/models/Communication/Comment/index.js +12 -5
  70. package/models/Communication/Comment/types.js +2 -1
  71. package/models/Communication/index.js +21 -15
  72. package/models/Communication/types.js +7 -4
  73. package/models/Counters/Group/Analytics/index.js +12 -5
  74. package/models/Counters/Group/Analytics/types.js +5 -2
  75. package/models/Counters/Group/index.js +8 -2
  76. package/models/Counters/Group/types.js +2 -1
  77. package/models/Counters/event.js +8 -2
  78. package/models/Counters/index.js +8 -2
  79. package/models/Counters/types.js +2 -1
  80. package/models/Customer/Group/index.js +14 -7
  81. package/models/Customer/Group/types.js +2 -1
  82. package/models/Customer/basic.js +10 -4
  83. package/models/Customer/index.js +11 -5
  84. package/models/Customer/types.js +5 -2
  85. package/models/Evento/Player/basic.js +11 -10
  86. package/models/Evento/Player/index.js +19 -12
  87. package/models/Evento/Player/types.js +7 -4
  88. package/models/Evento/Repertory/index.js +10 -3
  89. package/models/Evento/Repertory/types.js +2 -1
  90. package/models/Evento/basic.js +18 -12
  91. package/models/Evento/index.js +38 -32
  92. package/models/Evento/promoter.js +8 -2
  93. package/models/Evento/tiny.js +9 -9
  94. package/models/Evento/types.js +17 -14
  95. package/models/Federation/Partnership/index.js +10 -3
  96. package/models/Federation/Partnership/types.js +2 -1
  97. package/models/Federation/index.js +13 -7
  98. package/models/Federation/types.js +2 -1
  99. package/models/Group/Analytics/index.js +12 -5
  100. package/models/Group/Analytics/types.js +5 -2
  101. package/models/Group/Event/index.js +12 -6
  102. package/models/Group/Event/types.js +2 -1
  103. package/models/Group/Player/Event/index.js +18 -11
  104. package/models/Group/Player/Event/types.js +2 -1
  105. package/models/Group/Player/Log/index.js +8 -2
  106. package/models/Group/Player/Log/types.js +2 -1
  107. package/models/Group/Player/index.js +25 -18
  108. package/models/Group/Player/types.js +5 -2
  109. package/models/Group/Repertory/File/Section/index.js +16 -12
  110. package/models/Group/Repertory/File/Section/types.js +5 -2
  111. package/models/Group/Repertory/File/index.js +12 -11
  112. package/models/Group/Repertory/File/types.js +2 -1
  113. package/models/Group/Repertory/FilePath/index.js +15 -12
  114. package/models/Group/Repertory/index.js +32 -25
  115. package/models/Group/Repertory/types.js +5 -2
  116. package/models/Group/StageTemplate/index.js +8 -2
  117. package/models/Group/StageTemplate/types.js +2 -1
  118. package/models/Group/basic.js +11 -5
  119. package/models/Group/index.js +47 -41
  120. package/models/Group/types.js +17 -14
  121. package/models/Instrument/group.js +11 -6
  122. package/models/Instrument/index.js +9 -8
  123. package/models/Metrics/index.js +16 -10
  124. package/models/Metrics/types.js +2 -1
  125. package/models/Model/index.js +6 -7
  126. package/models/Model/lang.js +10 -5
  127. package/models/MusicStyle/index.js +10 -9
  128. package/models/Notification/index.js +8 -2
  129. package/models/Notification/types.js +5 -2
  130. package/models/Partner/basic.js +12 -6
  131. package/models/Partner/index.js +10 -4
  132. package/models/Partner/tiny.js +8 -2
  133. package/models/Partner/types.js +5 -2
  134. package/models/Partnership/Group/index.js +12 -5
  135. package/models/Partnership/Group/types.js +2 -1
  136. package/models/Partnership/Partner/Subscription/index.js +15 -8
  137. package/models/Partnership/Partner/Subscription/types.js +5 -2
  138. package/models/Partnership/Partner/index.js +10 -3
  139. package/models/Partnership/Partner/types.js +2 -1
  140. package/models/Partnership/Payment/index.js +8 -2
  141. package/models/Partnership/Payment/types.js +2 -1
  142. package/models/Partnership/Plan/basic.js +18 -12
  143. package/models/Partnership/Plan/index.js +10 -3
  144. package/models/Partnership/Plan/types.js +5 -2
  145. package/models/Partnership/basic.js +10 -4
  146. package/models/Partnership/index.js +11 -5
  147. package/models/Partnership/types.js +7 -4
  148. package/models/Payment/basic.js +13 -7
  149. package/models/Payment/index.js +8 -2
  150. package/models/Payment/types.js +7 -4
  151. package/models/Player/basic.js +10 -4
  152. package/models/Player/types.js +2 -1
  153. package/models/Repertory/basic.js +8 -2
  154. package/models/Repertory/types.js +2 -1
  155. package/models/User/Group/index.js +15 -8
  156. package/models/User/Group/types.js +2 -1
  157. package/models/User/Notification/index.d.ts +1 -1
  158. package/models/User/Notification/index.js +21 -16
  159. package/models/User/Notification/types.js +2 -1
  160. package/models/User/basic.js +10 -4
  161. package/models/User/index.js +24 -18
  162. package/models/User/types.js +15 -12
  163. package/models/WebhookEvent/index.js +8 -2
  164. package/models/WebhookEvent/types.js +5 -2
  165. package/package.json +1 -1
  166. package/types/firestore.js +5 -2
  167. package/types/messagebirdChatWidget.js +2 -1
@@ -1,5 +1,10 @@
1
- import Model from '../../Model';
2
- export default class GroupCounters extends Model {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const Model_1 = __importDefault(require("../../Model"));
7
+ class GroupCounters extends Model_1.default {
3
8
  constructor(doc) {
4
9
  super(doc);
5
10
  }
@@ -46,3 +51,4 @@ export default class GroupCounters extends Model {
46
51
  return this.data.satisfactionIndex || { current: 0, last: 0 };
47
52
  }
48
53
  }
54
+ exports.default = GroupCounters;
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,10 @@
1
- import Counters from './index';
2
- export default class EventDocCounters extends Counters {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const index_1 = __importDefault(require("./index"));
7
+ class EventDocCounters extends index_1.default {
3
8
  constructor(doc) {
4
9
  super(doc);
5
10
  }
@@ -19,3 +24,4 @@ export default class EventDocCounters extends Counters {
19
24
  return this.data.eventsRepertoryCount || 0;
20
25
  }
21
26
  }
27
+ exports.default = EventDocCounters;
@@ -1,5 +1,10 @@
1
- import Model from '../Model';
2
- export default class Counters extends Model {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const Model_1 = __importDefault(require("../Model"));
7
+ class Counters extends Model_1.default {
3
8
  constructor(doc) {
4
9
  super(doc);
5
10
  }
@@ -7,3 +12,4 @@ export default class Counters extends Model {
7
12
  return this.data.count || 0;
8
13
  }
9
14
  }
15
+ exports.default = Counters;
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,14 @@
1
- import { PlansGroup } from '../../../helpers/plans';
2
- import { defaultLocale } from '../../../lang';
3
- import GroupBasic from '../../Group/basic';
4
- export default class CustomerGroup extends GroupBasic {
5
- constructor(doc, lang = defaultLocale) {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const plans_1 = require("../../../helpers/plans");
7
+ const utils_1 = require("../../../helpers/utils");
8
+ const lang_1 = require("../../../lang");
9
+ const basic_1 = __importDefault(require("../../Group/basic"));
10
+ class CustomerGroup extends basic_1.default {
11
+ constructor(doc, lang = lang_1.defaultLocale) {
6
12
  super(doc, lang);
7
13
  }
8
14
  get linkedAt() {
@@ -21,7 +27,7 @@ export default class CustomerGroup extends GroupBasic {
21
27
  return this.data.upgradedMethod || null;
22
28
  }
23
29
  get planId() {
24
- return this.data.planId || PlansGroup.Piano;
30
+ return this.data.planId || plans_1.PlansGroup.Piano;
25
31
  }
26
32
  get planPeriod() {
27
33
  return this.data.planPeriod || null;
@@ -36,6 +42,7 @@ export default class CustomerGroup extends GroupBasic {
36
42
  return this.data.subscriptionStripeId || null;
37
43
  }
38
44
  get customerId() {
39
- return this.ref.path.split('/').at(-3);
45
+ return (0, utils_1.at)(this.ref.path.split('/'), 1) || '';
40
46
  }
41
47
  }
48
+ exports.default = CustomerGroup;
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,11 @@
1
- import { isString } from 'lodash';
2
- import Model from '../Model';
3
- export default class CustomerBasic extends Model {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const lodash_1 = require("lodash");
7
+ const Model_1 = __importDefault(require("../Model"));
8
+ class CustomerBasic extends Model_1.default {
4
9
  constructor(doc) {
5
10
  super(doc);
6
11
  }
@@ -26,7 +31,7 @@ export default class CustomerBasic extends Model {
26
31
  get displayAddress() {
27
32
  const { street, city, postalCode, province, country } = this.address;
28
33
  const fields = [street, postalCode, city, province, country];
29
- return fields.filter((field) => isString(field)).join(', ');
34
+ return fields.filter((field) => (0, lodash_1.isString)(field)).join(', ');
30
35
  }
31
36
  get phone() {
32
37
  return this.data.phone;
@@ -38,3 +43,4 @@ export default class CustomerBasic extends Model {
38
43
  return this.data.CIF || null;
39
44
  }
40
45
  }
46
+ exports.default = CustomerBasic;
@@ -1,7 +1,12 @@
1
- import { CollectionNames } from '../../helpers/collections';
2
- import { getGlissandooAdminEntityURL } from '../../helpers/glissandooAdmin';
3
- import CustomerBasic from './basic';
4
- export default class Customer extends CustomerBasic {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const collections_1 = require("../../helpers/collections");
7
+ const glissandooAdmin_1 = require("../../helpers/glissandooAdmin");
8
+ const basic_1 = __importDefault(require("./basic"));
9
+ class Customer extends basic_1.default {
5
10
  constructor(doc) {
6
11
  super(doc);
7
12
  }
@@ -45,7 +50,7 @@ export default class Customer extends CustomerBasic {
45
50
  return this.data.groupIds || [];
46
51
  }
47
52
  get glissandooAdminUrl() {
48
- return getGlissandooAdminEntityURL(CollectionNames.Customer, this.id);
53
+ return (0, glissandooAdmin_1.getGlissandooAdminEntityURL)(collections_1.CollectionNames.Customer, this.id);
49
54
  }
50
55
  get mrr() {
51
56
  return this.data.mrr || 0;
@@ -54,3 +59,4 @@ export default class Customer extends CustomerBasic {
54
59
  return this.data.manual || false;
55
60
  }
56
61
  }
62
+ exports.default = Customer;
@@ -1,4 +1,7 @@
1
- export var CustomerRoles;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomerRoles = void 0;
4
+ var CustomerRoles;
2
5
  (function (CustomerRoles) {
3
6
  CustomerRoles["Admin"] = "admin";
4
- })(CustomerRoles || (CustomerRoles = {}));
7
+ })(CustomerRoles = exports.CustomerRoles || (exports.CustomerRoles = {}));
@@ -1,8 +1,8 @@
1
- import { isUndefined } from 'lodash';
2
- import { EventPlayerStatus } from './types';
3
- export default class EventoPlayerBasic {
4
- eventId;
5
- data;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lodash_1 = require("lodash");
4
+ const types_1 = require("./types");
5
+ class EventoPlayerBasic {
6
6
  constructor(eventId, data) {
7
7
  this.eventId = eventId;
8
8
  this.data = data;
@@ -38,7 +38,7 @@ export default class EventoPlayerBasic {
38
38
  return this.data.interested || null;
39
39
  }
40
40
  get selected() {
41
- return !isUndefined(this.data.selected) ? this.data.selected : null;
41
+ return !(0, lodash_1.isUndefined)(this.data.selected) ? this.data.selected : null;
42
42
  }
43
43
  get isActive() {
44
44
  return !this.isDiscarded;
@@ -59,18 +59,19 @@ export default class EventoPlayerBasic {
59
59
  return this.selected === null;
60
60
  }
61
61
  get isConfirmed() {
62
- return this.status === EventPlayerStatus.Confirmed;
62
+ return this.status === types_1.EventPlayerStatus.Confirmed;
63
63
  }
64
64
  get isDeclined() {
65
- return this.status === EventPlayerStatus.Declined;
65
+ return this.status === types_1.EventPlayerStatus.Declined;
66
66
  }
67
67
  get isPending() {
68
68
  return this.status === null;
69
69
  }
70
70
  get isRollCallConfirmed() {
71
- return this.rollcall === EventPlayerStatus.Confirmed;
71
+ return this.rollcall === types_1.EventPlayerStatus.Confirmed;
72
72
  }
73
73
  get isRollCallDeclined() {
74
- return this.rollcall === EventPlayerStatus.Declined;
74
+ return this.rollcall === types_1.EventPlayerStatus.Declined;
75
75
  }
76
76
  }
77
+ exports.default = EventoPlayerBasic;
@@ -1,25 +1,31 @@
1
- import { isUndefined } from 'lodash';
2
- import { defaultLocale } from '../../../lang';
3
- import PlayerBasic from '../../Player/basic';
4
- import { EventPlayerStatus } from './types';
5
- export default class EventoPlayer extends PlayerBasic {
6
- constructor(doc, lang = defaultLocale) {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const lodash_1 = require("lodash");
7
+ const utils_1 = require("../../../helpers/utils");
8
+ const lang_1 = require("../../../lang");
9
+ const basic_1 = __importDefault(require("../../Player/basic"));
10
+ const types_1 = require("./types");
11
+ class EventoPlayer extends basic_1.default {
12
+ constructor(doc, lang = lang_1.defaultLocale) {
7
13
  super(doc, lang);
8
14
  }
9
15
  get joinedAt() {
10
16
  return this.data.joinedAt;
11
17
  }
12
18
  get eventId() {
13
- return this.ref.path.split('/').at(-3);
19
+ return (0, utils_1.at)(this.ref.path.split('/'), 1) || '';
14
20
  }
15
21
  get status() {
16
22
  return this.data.status;
17
23
  }
18
24
  get isConfirmed() {
19
- return this.status === EventPlayerStatus.Confirmed;
25
+ return this.status === types_1.EventPlayerStatus.Confirmed;
20
26
  }
21
27
  get isDeclined() {
22
- return this.status === EventPlayerStatus.Declined;
28
+ return this.status === types_1.EventPlayerStatus.Declined;
23
29
  }
24
30
  get isPending() {
25
31
  return this.status === null;
@@ -28,10 +34,10 @@ export default class EventoPlayer extends PlayerBasic {
28
34
  return this.data.rollcall || null;
29
35
  }
30
36
  get isRollCallConfirmed() {
31
- return this.rollcall === EventPlayerStatus.Confirmed;
37
+ return this.rollcall === types_1.EventPlayerStatus.Confirmed;
32
38
  }
33
39
  get isRollCallDeclined() {
34
- return this.rollcall === EventPlayerStatus.Declined;
40
+ return this.rollcall === types_1.EventPlayerStatus.Declined;
35
41
  }
36
42
  get rollCalledAt() {
37
43
  return this.data.rollCalledAt || null;
@@ -49,9 +55,10 @@ export default class EventoPlayer extends PlayerBasic {
49
55
  return this.data.interested || null;
50
56
  }
51
57
  get selected() {
52
- return !isUndefined(this.data.selected) ? this.data.selected : null;
58
+ return !(0, lodash_1.isUndefined)(this.data.selected) ? this.data.selected : null;
53
59
  }
54
60
  get isActive() {
55
61
  return this.exists && this.selected !== false;
56
62
  }
57
63
  }
64
+ exports.default = EventoPlayer;
@@ -1,13 +1,16 @@
1
- export var EventPlayerStatus;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventPlayerReason = exports.EventPlayerStatus = void 0;
4
+ var EventPlayerStatus;
2
5
  (function (EventPlayerStatus) {
3
6
  EventPlayerStatus["Confirmed"] = "confirmed";
4
7
  EventPlayerStatus["Declined"] = "declined";
5
- })(EventPlayerStatus || (EventPlayerStatus = {}));
6
- export var EventPlayerReason;
8
+ })(EventPlayerStatus = exports.EventPlayerStatus || (exports.EventPlayerStatus = {}));
9
+ var EventPlayerReason;
7
10
  (function (EventPlayerReason) {
8
11
  EventPlayerReason["Sick"] = "Sick";
9
12
  EventPlayerReason["Vacation"] = "Vacation";
10
13
  EventPlayerReason["ArrivingLate"] = "ArrivingLate";
11
14
  EventPlayerReason["LeavingEarly"] = "LeavingEarly";
12
15
  EventPlayerReason["Other"] = "Other";
13
- })(EventPlayerReason || (EventPlayerReason = {}));
16
+ })(EventPlayerReason = exports.EventPlayerReason || (exports.EventPlayerReason = {}));
@@ -1,5 +1,11 @@
1
- import Theme from '../../Repertory/basic';
2
- export default class EventoRepertory extends Theme {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("../../../helpers/utils");
7
+ const basic_1 = __importDefault(require("../../Repertory/basic"));
8
+ class EventoRepertory extends basic_1.default {
3
9
  constructor(doc) {
4
10
  super(doc);
5
11
  }
@@ -10,9 +16,10 @@ export default class EventoRepertory extends Theme {
10
16
  return this.data.order || 0;
11
17
  }
12
18
  get eventId() {
13
- return this.ref.path.split('/').at(-3);
19
+ return (0, utils_1.at)(this.ref.path.split('/'), 1) || '';
14
20
  }
15
21
  get isActive() {
16
22
  return this.exists;
17
23
  }
18
24
  }
25
+ exports.default = EventoRepertory;
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +1,14 @@
1
- import { isFuture, isPast } from 'date-fns';
2
- import { defaultLocale, getTranslation } from '../../lang';
3
- import ModelWithLang from '../Model/lang';
4
- import { EventType } from './types';
5
- export default class EventoBasic extends ModelWithLang {
6
- constructor(doc, lang = defaultLocale) {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const date_fns_1 = require("date-fns");
7
+ const lang_1 = require("../../lang");
8
+ const lang_2 = __importDefault(require("../Model/lang"));
9
+ const types_1 = require("./types");
10
+ class EventoBasic extends lang_2.default {
11
+ constructor(doc, lang = lang_1.defaultLocale) {
7
12
  super(doc, lang);
8
13
  }
9
14
  get tinyInfo() {
@@ -34,16 +39,16 @@ export default class EventoBasic extends ModelWithLang {
34
39
  if (this.displayName) {
35
40
  return this.displayName;
36
41
  }
37
- return (getTranslation(this.type, this.lang) || getTranslation('event', this.lang) || 'event');
42
+ return ((0, lang_1.getTranslation)(this.type, this.lang) || (0, lang_1.getTranslation)('event', this.lang) || 'event');
38
43
  }
39
44
  get type() {
40
45
  return this.data.type;
41
46
  }
42
47
  get isPractice() {
43
- return this.type === EventType.Practice;
48
+ return this.type === types_1.EventType.Practice;
44
49
  }
45
50
  get isPerformance() {
46
- return this.type === EventType.Performance;
51
+ return this.type === types_1.EventType.Performance;
47
52
  }
48
53
  get locality() {
49
54
  return this.data.locality;
@@ -61,10 +66,10 @@ export default class EventoBasic extends ModelWithLang {
61
66
  return this.datetimeEnd.seconds - this.datetime.seconds;
62
67
  }
63
68
  get isOutDate() {
64
- return isPast(this.datetimeEnd.toDate());
69
+ return (0, date_fns_1.isPast)(this.datetimeEnd.toDate());
65
70
  }
66
71
  get isHappening() {
67
- return isPast(this.datetime.toDate()) && isFuture(this.datetimeEnd.toDate());
72
+ return (0, date_fns_1.isPast)(this.datetime.toDate()) && (0, date_fns_1.isFuture)(this.datetimeEnd.toDate());
68
73
  }
69
74
  get timezone() {
70
75
  return this.data.timezone || 'Europe/Madrid';
@@ -73,9 +78,10 @@ export default class EventoBasic extends ModelWithLang {
73
78
  return this.data.responseDeadlineAt || this.datetime;
74
79
  }
75
80
  get isResponseAllowed() {
76
- return isFuture(this.responseDeadlineAt.toDate());
81
+ return (0, date_fns_1.isFuture)(this.responseDeadlineAt.toDate());
77
82
  }
78
83
  get selectionMode() {
79
84
  return this.data.selectionMode || null;
80
85
  }
81
86
  }
87
+ exports.default = EventoBasic;
@@ -1,20 +1,33 @@
1
- import { addHours, isPast } from 'date-fns';
2
- import { isNull, isNumber, orderBy } from 'lodash';
3
- import { orderByMusicStyle } from '../../helpers/musicStyles/orders';
4
- import { sortByMatch } from '../../helpers/utils';
5
- import { defaultLocale } from '../../lang';
6
- import EventoPlayerBasic from './Player/basic';
7
- import EventoPromoter from './promoter';
8
- import { EventResponseDeadlineOptions, EventSelectionMode, EventStatusByTime, } from './types';
9
- export default class Evento extends EventoPromoter {
10
- constructor(doc, lang = defaultLocale) {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const date_fns_1 = require("date-fns");
7
+ const lodash_1 = require("lodash");
8
+ const orders_1 = require("../../helpers/musicStyles/orders");
9
+ const utils_1 = require("../../helpers/utils");
10
+ const lang_1 = require("../../lang");
11
+ const basic_1 = __importDefault(require("./Player/basic"));
12
+ const promoter_1 = __importDefault(require("./promoter"));
13
+ const types_1 = require("./types");
14
+ class Evento extends promoter_1.default {
15
+ constructor(doc, lang = lang_1.defaultLocale) {
11
16
  super(doc, lang);
17
+ this.isPlayer = (userId) => {
18
+ return this.playerIds.includes(userId);
19
+ };
20
+ this.getPlayer = (userId) => {
21
+ return userId in this.players
22
+ ? new basic_1.default(this.id, { id: userId, ...this.players[userId] })
23
+ : null;
24
+ };
12
25
  }
13
26
  get maxAttendance() {
14
27
  return this.data.maxAttendance;
15
28
  }
16
29
  get isCapacityCompleted() {
17
- return isNumber(this.maxAttendance) && this.confirmedPlayers.length >= this.maxAttendance;
30
+ return (0, lodash_1.isNumber)(this.maxAttendance) && this.confirmedPlayers.length >= this.maxAttendance;
18
31
  }
19
32
  get location() {
20
33
  return this.data.location;
@@ -96,7 +109,7 @@ export default class Evento extends EventoPromoter {
96
109
  return !this.isDeleted && !this.isOutDate;
97
110
  }
98
111
  get isDeleted() {
99
- return !this.exists || !isNull(this.deletedAt);
112
+ return !this.exists || !(0, lodash_1.isNull)(this.deletedAt);
100
113
  }
101
114
  get stage() {
102
115
  return this.data.stage || null;
@@ -106,19 +119,19 @@ export default class Evento extends EventoPromoter {
106
119
  }
107
120
  get statusByTime() {
108
121
  if (this.isOutDate) {
109
- return EventStatusByTime.Past;
122
+ return types_1.EventStatusByTime.Past;
110
123
  }
111
124
  if (this.isHappening) {
112
- return EventStatusByTime.Now;
125
+ return types_1.EventStatusByTime.Now;
113
126
  }
114
- return EventStatusByTime.Future;
127
+ return types_1.EventStatusByTime.Future;
115
128
  }
116
129
  get repertoryList() {
117
130
  const repertory = Object.keys(this.repertory).map((themeId) => ({
118
131
  ...this.repertory[themeId],
119
132
  id: themeId,
120
133
  }));
121
- return orderBy(repertory, 'order', 'asc');
134
+ return (0, lodash_1.orderBy)(repertory, 'order', 'asc');
122
135
  }
123
136
  playersList({ showAll, order, asObject } = {}) {
124
137
  const players = asObject
@@ -126,10 +139,10 @@ export default class Evento extends EventoPromoter {
126
139
  id,
127
140
  ...player,
128
141
  }))
129
- : Object.entries(this.players).map(([id, player]) => new EventoPlayerBasic(this.id, { id, ...player }));
142
+ : Object.entries(this.players).map(([id, player]) => new basic_1.default(this.id, { id, ...player }));
130
143
  const orderedPlayers = order
131
- ? sortByMatch(players, 'mainInstrument', order)
132
- : orderByMusicStyle(players, 'mainInstrument', this.promoterInfo.musicStyle);
144
+ ? (0, utils_1.sortByMatch)(players, 'mainInstrument', order)
145
+ : (0, orders_1.orderByMusicStyle)(players, 'mainInstrument', this.promoterInfo.musicStyle);
133
146
  if (showAll)
134
147
  return orderedPlayers;
135
148
  return orderedPlayers.filter((player) => player.selected !== false);
@@ -156,7 +169,7 @@ export default class Evento extends EventoPromoter {
156
169
  return this.rollCalledAt !== null;
157
170
  }
158
171
  get isActiveRollCall() {
159
- return isPast(addHours(this.datetime.toDate(), -1));
172
+ return (0, date_fns_1.isPast)((0, date_fns_1.addHours)(this.datetime.toDate(), -1));
160
173
  }
161
174
  get templateId() {
162
175
  return this.data.templateId || null;
@@ -164,30 +177,23 @@ export default class Evento extends EventoPromoter {
164
177
  get repeat() {
165
178
  return this.data.repeat || null;
166
179
  }
167
- isPlayer = (userId) => {
168
- return this.playerIds.includes(userId);
169
- };
170
- getPlayer = (userId) => {
171
- return userId in this.players
172
- ? new EventoPlayerBasic(this.id, { id: userId, ...this.players[userId] })
173
- : null;
174
- };
175
180
  get responseDeadline() {
176
181
  return (this.data.responseDeadline || {
177
- option: EventResponseDeadlineOptions.BeforeEvent,
182
+ option: types_1.EventResponseDeadlineOptions.BeforeEvent,
178
183
  customAt: null,
179
184
  });
180
185
  }
181
186
  get isSelectionMode() {
182
- return !isNull(this.selectionMode);
187
+ return !(0, lodash_1.isNull)(this.selectionMode);
183
188
  }
184
189
  get selectionModeClosedAt() {
185
190
  return this.data.selectionModeClosedAt || null;
186
191
  }
187
192
  get isSelectionModeClosed() {
188
- return (!isNull(this.selectionModeClosedAt) && this.selectionMode === EventSelectionMode.Closed);
193
+ return (!(0, lodash_1.isNull)(this.selectionModeClosedAt) && this.selectionMode === types_1.EventSelectionMode.Closed);
189
194
  }
190
195
  get isSelectionModeOpen() {
191
- return isNull(this.selectionModeClosedAt) && this.selectionMode === EventSelectionMode.Open;
196
+ return (0, lodash_1.isNull)(this.selectionModeClosedAt) && this.selectionMode === types_1.EventSelectionMode.Open;
192
197
  }
193
198
  }
199
+ exports.default = Evento;
@@ -1,5 +1,10 @@
1
- import EventoBasic from './basic';
2
- export default class EventoPromoter extends EventoBasic {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const basic_1 = __importDefault(require("./basic"));
7
+ class EventoPromoter extends basic_1.default {
3
8
  constructor(doc, lang) {
4
9
  super(doc, lang);
5
10
  }
@@ -16,3 +21,4 @@ export default class EventoPromoter extends EventoBasic {
16
21
  return this.data.promoterInfo;
17
22
  }
18
23
  }
24
+ exports.default = EventoPromoter;
@@ -1,9 +1,8 @@
1
- import { getTranslation } from '../../lang';
2
- import { EventType } from './types';
3
- export default class EventoTiny {
4
- lang;
5
- data;
6
- id;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lang_1 = require("../../lang");
4
+ const types_1 = require("./types");
5
+ class EventoTiny {
7
6
  constructor(id, data, lang) {
8
7
  this.id = id;
9
8
  this.data = data;
@@ -16,16 +15,16 @@ export default class EventoTiny {
16
15
  if (this.displayName) {
17
16
  return this.displayName;
18
17
  }
19
- return (getTranslation(this.type, this.lang) || getTranslation('event', this.lang) || this.type);
18
+ return ((0, lang_1.getTranslation)(this.type, this.lang) || (0, lang_1.getTranslation)('event', this.lang) || this.type);
20
19
  }
21
20
  get type() {
22
21
  return this.data.type;
23
22
  }
24
23
  get isPractice() {
25
- return this.type === EventType.Practice;
24
+ return this.type === types_1.EventType.Practice;
26
25
  }
27
26
  get isPerformance() {
28
- return this.type === EventType.Performance;
27
+ return this.type === types_1.EventType.Performance;
29
28
  }
30
29
  get datetime() {
31
30
  return this.data.datetime;
@@ -34,3 +33,4 @@ export default class EventoTiny {
34
33
  return this.data.timezone || 'Europe/Madrid';
35
34
  }
36
35
  }
36
+ exports.default = EventoTiny;