@sellout/models 0.0.56 → 0.0.58

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 (76) hide show
  1. package/.dist/graphql/fragments/event.fragment.js +8 -0
  2. package/.dist/graphql/fragments/event.fragment.js.map +1 -1
  3. package/.dist/graphql/mutations/createArtist.mutation.d.ts +2 -0
  4. package/.dist/graphql/mutations/createArtist.mutation.js +52 -0
  5. package/.dist/graphql/mutations/createArtist.mutation.js.map +1 -0
  6. package/.dist/graphql/mutations/createFee.mutation.d.ts +2 -0
  7. package/.dist/graphql/mutations/createFee.mutation.js +30 -0
  8. package/.dist/graphql/mutations/createFee.mutation.js.map +1 -0
  9. package/.dist/graphql/mutations/deleteFee.mutation.d.ts +2 -0
  10. package/.dist/graphql/mutations/deleteFee.mutation.js +13 -0
  11. package/.dist/graphql/mutations/deleteFee.mutation.js.map +1 -0
  12. package/.dist/graphql/mutations/updateArtist.mutation.d.ts +2 -0
  13. package/.dist/graphql/mutations/updateArtist.mutation.js +52 -0
  14. package/.dist/graphql/mutations/updateArtist.mutation.js.map +1 -0
  15. package/.dist/graphql/mutations/updateFee.mutation.d.ts +2 -0
  16. package/.dist/graphql/mutations/updateFee.mutation.js +30 -0
  17. package/.dist/graphql/mutations/updateFee.mutation.js.map +1 -0
  18. package/.dist/graphql/queries/artist.query.js +11 -2
  19. package/.dist/graphql/queries/artist.query.js.map +1 -1
  20. package/.dist/graphql/queries/artists.query.js +11 -10
  21. package/.dist/graphql/queries/artists.query.js.map +1 -1
  22. package/.dist/graphql/queries/fee.query.d.ts +2 -0
  23. package/.dist/graphql/queries/fee.query.js +30 -0
  24. package/.dist/graphql/queries/fee.query.js.map +1 -0
  25. package/.dist/interfaces/IArtist.d.ts +9 -0
  26. package/.dist/interfaces/IArtist.js +9 -0
  27. package/.dist/interfaces/IArtist.js.map +1 -1
  28. package/.dist/interfaces/IArtistPressKit.d.ts +1 -0
  29. package/.dist/interfaces/IEvent.js +1 -1
  30. package/.dist/interfaces/IEvent.js.map +1 -1
  31. package/.dist/interfaces/IEventCustomField.d.ts +4 -1
  32. package/.dist/interfaces/IEventCustomField.js +2 -0
  33. package/.dist/interfaces/IEventCustomField.js.map +1 -1
  34. package/.dist/interfaces/IEventPromotion.d.ts +12 -2
  35. package/.dist/interfaces/IEventPromotion.js +9 -3
  36. package/.dist/interfaces/IEventPromotion.js.map +1 -1
  37. package/.dist/interfaces/IFee.d.ts +5 -6
  38. package/.dist/interfaces/IFee.js +1 -1
  39. package/.dist/interfaces/IFee.js.map +1 -1
  40. package/.dist/interfaces/IPerformance.d.ts +1 -1
  41. package/.dist/schemas/Artist.d.ts +12 -0
  42. package/.dist/schemas/Artist.js +12 -0
  43. package/.dist/schemas/Artist.js.map +1 -1
  44. package/.dist/schemas/Event.d.ts +36 -0
  45. package/.dist/schemas/Event.js +44 -8
  46. package/.dist/schemas/Event.js.map +1 -1
  47. package/.dist/sellout-proto.js +276 -39
  48. package/.dist/utils/EventUtil.d.ts +8 -0
  49. package/.dist/utils/EventUtil.js +68 -36
  50. package/.dist/utils/EventUtil.js.map +1 -1
  51. package/.dist/utils/fee-util-broken-but-why.d.ts +8 -0
  52. package/.dist/utils/fee-util-broken-but-why.js +38 -0
  53. package/.dist/utils/fee-util-broken-but-why.js.map +1 -0
  54. package/package.json +4 -4
  55. package/src/graphql/fragments/event.fragment.ts +8 -0
  56. package/src/graphql/mutations/createArtist.mutation.ts +48 -0
  57. package/src/graphql/mutations/createFee.mutation.ts +26 -0
  58. package/src/graphql/mutations/deleteFee.mutation.ts +9 -0
  59. package/src/graphql/mutations/updateArtist.mutation.ts +48 -0
  60. package/src/graphql/mutations/updateFee.mutation.ts +25 -0
  61. package/src/graphql/queries/artist.query.ts +11 -2
  62. package/src/graphql/queries/artists.query.ts +12 -10
  63. package/src/graphql/queries/fee.query.ts +26 -0
  64. package/src/interfaces/IArtist.ts +11 -1
  65. package/src/interfaces/IArtistPressKit.ts +1 -0
  66. package/src/interfaces/IEvent.ts +1 -1
  67. package/src/interfaces/IEventCustomField.ts +3 -0
  68. package/src/interfaces/IEventPromotion.ts +13 -2
  69. package/src/interfaces/IFee.ts +5 -5
  70. package/src/interfaces/IPerformance.ts +1 -1
  71. package/src/proto/artist.proto +9 -7
  72. package/src/proto/event.proto +13 -5
  73. package/src/schemas/Artist.ts +12 -0
  74. package/src/schemas/Event.ts +44 -8
  75. package/src/utils/EventUtil.ts +129 -44
  76. package/src/utils/fee-util-broken-but-why +36 -0
@@ -1,6 +1,8 @@
1
1
  export enum EventCustomFieldTypeEnum {
2
2
  Text = 'Text',
3
3
  Number = 'Number',
4
+ Address = 'Address',
5
+ Dropdown = 'Dropdown',
4
6
  }
5
7
 
6
8
  export default interface IEventCustomFields {
@@ -12,5 +14,6 @@ export default interface IEventCustomFields {
12
14
  maxValue: number;
13
15
  minValue: number;
14
16
  required: boolean;
17
+ options: string[];
15
18
  active: boolean;
16
19
  }
@@ -1,6 +1,12 @@
1
1
  export enum EventPromotionTypeEnum {
2
- PreSale = "Pre-Sale Code",
3
- Secret = "Secret Code",
2
+ PreSale = "Pre-Sale",
3
+ Unlock = "Unlock",
4
+ Discount = 'Discount',
5
+ }
6
+
7
+ export enum EventPromotionDiscountTypeEnum {
8
+ Flat = "Flat",
9
+ Percent = "Percent",
4
10
  }
5
11
 
6
12
  export default interface IEventPromotion {
@@ -12,4 +18,9 @@ export default interface IEventPromotion {
12
18
  ticketTypeIds: string[];
13
19
  upgradeIds: string[];
14
20
  active: boolean;
21
+ startsAt: number;
22
+ endsAt: number;
23
+ useLimit: number;
24
+ discountType: EventPromotionDiscountTypeEnum;
25
+ discountValue: number;
15
26
  }
@@ -1,7 +1,7 @@
1
1
  export enum FeeTypeEnum {
2
2
  Flat = 'Flat',
3
3
  Percent = 'Percent',
4
- FlatPlusPercent = 'Flat + Percent',
4
+ // FlatPlusPercent = 'Flat + Percent',
5
5
  }
6
6
 
7
7
  export enum FeeAppliedToEnum {
@@ -35,10 +35,10 @@ export default interface IFee {
35
35
  minAppliedToPrice?: number;
36
36
  maxAppliedToPrice?: number;
37
37
  filters?: FeeFilters[];
38
- createdBy: string;
39
- createdAt: number;
40
- updatedBy: string;
41
- updatedAt: number;
38
+ createdBy?: string;
39
+ createdAt?: number;
40
+ updatedBy?: string;
41
+ updatedAt?: number;
42
42
  disabled: boolean;
43
43
  // disableable: boolean;
44
44
  // editable: boolean;
@@ -4,7 +4,7 @@ export interface IPerformanceSchedule {
4
4
  }
5
5
 
6
6
  export default interface IPerformance {
7
- _id?: string;
7
+ _id: string;
8
8
  name?: string;
9
9
  headliningArtistIds?: string[];
10
10
  openingArtistIds?: string[];
@@ -6,13 +6,15 @@ import "common.proto";
6
6
  message Artist {
7
7
  string _id = 1;
8
8
  string name = 2;
9
- repeated string genres = 3;
10
- repeated SocialAccountLink socialAccounts = 4;
11
- repeated ArtistPressKit pressKits = 5;
12
- repeated ArtistContact contacts = 6;
13
- string artistGlobalId = 7;
14
- string orgId = 8;
15
- Metrics metrics = 9;
9
+ string orgId = 3;
10
+ string type = 4;
11
+ repeated string genres = 5;
12
+ repeated SocialAccountLink socialAccounts = 6;
13
+ repeated ArtistPressKit pressKits = 7;
14
+ repeated ArtistContact contacts = 8;
15
+ string artistGlobalId = 9;
16
+ Metrics metrics = 10;
17
+ int32 createdAt = 11;
16
18
  }
17
19
 
18
20
  message SocialAccountLink {
@@ -95,10 +95,12 @@ message EventUpgrade {
95
95
  int32 remainingQty = 4;
96
96
  int32 purchaseLimit = 5;
97
97
  bool complimentary = 6;
98
- repeated string ticketTypeIds = 7;
99
- string imageUrl = 8;
100
- string description = 9;
101
- bool visible = 10;
98
+ string complimentaryWith = 7;
99
+ int32 complimentaryQty = 8;
100
+ repeated string ticketTypeIds = 9;
101
+ string imageUrl = 10;
102
+ string description = 11;
103
+ bool visible = 12;
102
104
  }
103
105
 
104
106
  message EventPromotion {
@@ -110,6 +112,11 @@ message EventPromotion {
110
112
  repeated string ticketTypeIds = 5;
111
113
  repeated string upgradeIds = 6;
112
114
  bool active = 7;
115
+ int32 startsAt = 8;
116
+ int32 endsAt = 9;
117
+ int32 useLimit = 10;
118
+ string discountType = 11;
119
+ int32 discountValue = 12;
113
120
  }
114
121
 
115
122
  message EventCustomFields {
@@ -121,7 +128,8 @@ message EventCustomFields {
121
128
  int32 minValue = 5;
122
129
  int32 maxValue = 6;
123
130
  bool required = 7;
124
- bool active = 8;
131
+ repeated string options = 8;
132
+ bool active = 9;
125
133
  }
126
134
 
127
135
  message TicketExchange {
@@ -2,6 +2,10 @@ import shortid from 'shortid';
2
2
  import Metrics from './Metrics';
3
3
 
4
4
  const ArtistPressKit = {
5
+ _id: {
6
+ type: String,
7
+ default: shortid.generate,
8
+ },
5
9
  title: {
6
10
  type: String,
7
11
  required: false,
@@ -31,6 +35,10 @@ const ArtistPressKit = {
31
35
  };
32
36
 
33
37
  const ArtistContact = {
38
+ _id: {
39
+ type: String,
40
+ default: shortid.generate,
41
+ },
34
42
  firstName: {
35
43
  type: String,
36
44
  required: false,
@@ -58,6 +66,10 @@ const ArtistContact = {
58
66
  };
59
67
 
60
68
  const SocialLink = {
69
+ _id: {
70
+ type: String,
71
+ default: shortid.generate,
72
+ },
61
73
  platform: {
62
74
  type: String,
63
75
  required: false,
@@ -1,5 +1,6 @@
1
1
  import shortid from 'shortid';
2
2
  import { EventAgeEnum, SendQRCodeEnum, EventProcessAsEnum } from '../interfaces/IEvent';
3
+ import { UpgradeTypeComplimentaryWithEnum } from "../interfaces/IEventUpgrade";
3
4
  import Address from './Address';
4
5
  import Metrics from './Metrics';
5
6
 
@@ -41,6 +42,11 @@ const EventCustomFields = {
41
42
  required: true,
42
43
  default: false,
43
44
  },
45
+ options: [{
46
+ type: String,
47
+ required: true,
48
+ default: [],
49
+ }],
44
50
  active: {
45
51
  type: Boolean,
46
52
  required: true,
@@ -59,35 +65,55 @@ const EventPromotion = {
59
65
  },
60
66
  type: {
61
67
  type: String,
62
- required: true
68
+ required: true,
63
69
  },
64
70
  totalQty: {
65
71
  type: Number,
66
- required: true
72
+ required: true,
67
73
  },
68
74
  remainingQty: {
69
75
  type: Number,
70
- required: true
76
+ required: true,
71
77
  },
72
78
  ticketTypeIds: [
73
79
  {
74
80
  type: String,
75
81
  required: true,
76
- default: []
77
- }
82
+ default: [],
83
+ },
78
84
  ],
79
85
  upgradeIds: [
80
86
  {
81
87
  type: String,
82
88
  required: true,
83
- default: []
84
- }
89
+ default: [],
90
+ },
85
91
  ],
86
92
  active: {
87
93
  type: Boolean,
88
94
  required: true,
89
95
  default: true,
90
- }
96
+ },
97
+ startsAt: {
98
+ type: Number,
99
+ required: true,
100
+ },
101
+ endsAt: {
102
+ type: Number,
103
+ required: true,
104
+ },
105
+ useLimit: {
106
+ type: Number,
107
+ required: true,
108
+ },
109
+ discountType: {
110
+ type: String,
111
+ required: true,
112
+ },
113
+ discountValue: {
114
+ type: String,
115
+ required: true,
116
+ },
91
117
  };
92
118
 
93
119
  // I'm not sure why this is here or if we need it
@@ -161,6 +187,16 @@ const EventUpgrade = {
161
187
  required: true,
162
188
  default: false,
163
189
  },
190
+ complimentaryWith: {
191
+ type: String,
192
+ required: false,
193
+ default: UpgradeTypeComplimentaryWithEnum.Order,
194
+ },
195
+ complimentaryQty: {
196
+ type: String,
197
+ required: false,
198
+ default: 1,
199
+ },
164
200
  ticketTypeIds: [
165
201
  {
166
202
  type: String,
@@ -2,69 +2,86 @@ import * as Time from '@sellout/utils/.dist/time';
2
2
 
3
3
  export default {
4
4
  hasBeenAnnouced(event): boolean {
5
- const { schedule: { announceAt } } = event;
5
+ const {
6
+ schedule: { announceAt },
7
+ } = event;
6
8
  const now = Time.now();
7
9
  return announceAt < now;
8
- },
10
+ },
9
11
  isAnnounced(event): boolean {
10
- const { schedule: { announceAt, ticketsAt } } = event;
12
+ const {
13
+ schedule: { announceAt, ticketsAt },
14
+ } = event;
11
15
  const now = Time.now();
12
- return announceAt < now && now < ticketsAt;
16
+ return announceAt < now && now < ticketsAt;
13
17
  },
14
18
  isOnSale(event): boolean {
15
- const { schedule: { ticketsAt, ticketsEndAt } } = event;
19
+ const {
20
+ schedule: { ticketsAt, ticketsEndAt },
21
+ } = event;
16
22
  const now = Time.now();
17
23
  return ticketsAt < now && now < ticketsEndAt;
18
24
  },
19
25
  isInProgress(event): boolean {
20
- const { schedule: { startsAt, endsAt } } = event;
26
+ const {
27
+ schedule: { startsAt, endsAt },
28
+ } = event;
21
29
  const now = Time.now();
22
30
  return startsAt < now && now < endsAt;
23
31
  },
24
32
  saleHasEnded(event): boolean {
25
- const { schedule: { ticketsEndAt } } = event;
33
+ const {
34
+ schedule: { ticketsEndAt },
35
+ } = event;
26
36
  const now = Time.now();
27
37
  return ticketsEndAt < now;
28
38
  },
29
39
  hasEnded(event): boolean {
30
- const { schedule: { endsAt } } = event;
40
+ const {
41
+ schedule: { endsAt },
42
+ } = event;
31
43
  const now = Time.now();
32
44
  return endsAt < now;
33
45
  },
34
- hasActivePreSalePromotions(event): boolean{
35
- return event.promotions
36
- .filter(promotion => promotion.type === 'Pre-Sale Code')
37
- .filter(promotion => promotion.active)
38
- .length > 0;
46
+ hasActivePreSalePromotions(event): boolean {
47
+ return (
48
+ event.promotions
49
+ .filter((promotion) => promotion.type === "Pre-Sale Code")
50
+ .filter((promotion) => promotion.active).length > 0
51
+ );
39
52
  },
40
53
  qrCodeEmailAt(event): number {
41
- const { performances: [performance] } = event;
42
- const { schedule: { doorsAt, startsAt } } = performance;
54
+ const {
55
+ performances: [performance],
56
+ } = event;
57
+ const {
58
+ schedule: { doorsAt, startsAt },
59
+ } = performance;
43
60
 
44
- if(event.sendQRCode === 'Upon Order') {
61
+ if (event.sendQRCode === "Upon Order") {
45
62
  return Time.now();
46
63
  }
47
64
 
48
- if(event.sendQRCode === 'Two Weeks Before Show') {
65
+ if (event.sendQRCode === "Two Weeks Before Show") {
49
66
  const TWO_WEEKS = 14 * 24 * 60 * 60;
50
67
  return startsAt - TWO_WEEKS;
51
68
  }
52
69
 
53
- return doorsAt - (600);
70
+ return doorsAt - 600;
54
71
  },
55
72
  shouldSendOrderReceipt(event): boolean {
56
73
  const now = Time.now();
57
74
  const qrCodeEmailAt = this.qrCodeEmailAt(event);
58
75
 
59
- // Never send a receipt if we are
76
+ // Never send a receipt if we are
60
77
  // send a qr code upon order
61
- if (event.sendQRCode === 'Upon Order') {
78
+ if (event.sendQRCode === "Upon Order") {
62
79
  return false;
63
80
  }
64
81
 
65
82
  // Only send a receipt if QR codes for
66
83
  // the event haven't already gone out
67
- if(qrCodeEmailAt > now) {
84
+ if (qrCodeEmailAt > now) {
68
85
  return true;
69
86
  }
70
87
 
@@ -75,59 +92,61 @@ export default {
75
92
  ****************************************************************************************/
76
93
  venueIds(event): string[] {
77
94
  let venueIds = [event.venueId];
78
- event.performances.forEach(performance => {
79
- venueIds = venueIds.concat(performance.venueStageId)
95
+ event.performances.forEach((performance) => {
96
+ venueIds = venueIds.concat(performance.venueStageId);
80
97
  });
81
98
  venueIds = [...new Set(venueIds)];
82
- venueIds = venueIds.filter(v => !!v);
99
+ venueIds = venueIds.filter((v) => !!v);
83
100
  return venueIds;
84
101
  },
85
102
  seatingId(event): string {
86
- return event._id.replace('_', 'SAMH');
103
+ return event._id.replace("_", "SAMH");
87
104
  },
88
105
  /****************************************************************************************
89
106
  Artist
90
107
  ****************************************************************************************/
91
108
  artistIds(event): string[] {
92
109
  let artistIds = [];
93
- event.performances.forEach(performance => {
110
+ event.performances.forEach((performance) => {
94
111
  artistIds = artistIds
95
112
  .concat(performance.headliningArtistIds)
96
113
  .concat(performance.openingArtistIds);
97
- });
114
+ });
98
115
  artistIds = [...new Set(artistIds)];
99
- artistIds = artistIds.filter(a => !!a);
116
+ artistIds = artistIds.filter((a) => !!a);
100
117
  return artistIds;
101
118
  },
102
119
  headliningArtistIds(event): string[] {
103
120
  let artistIds = [];
104
- event.performances.forEach(performance => {
105
- artistIds = artistIds
106
- .concat(performance.headliningArtistIds)
121
+ event.performances.forEach((performance) => {
122
+ artistIds = artistIds.concat(performance.headliningArtistIds);
107
123
  });
108
124
  artistIds = [...new Set(artistIds)];
109
- artistIds = artistIds.filter(a => !!a);
125
+ artistIds = artistIds.filter((a) => !!a);
110
126
  return artistIds;
111
127
  },
112
128
  openingArtistIds(event): string[] {
113
129
  let artistIds = [];
114
- event.performances.forEach(performance => {
115
- artistIds = artistIds
116
- .concat(performance.openingArtistIds);
130
+ event.performances.forEach((performance) => {
131
+ artistIds = artistIds.concat(performance.openingArtistIds);
117
132
  });
118
133
  artistIds = [...new Set(artistIds)];
119
- artistIds = artistIds.filter(a => !!a);
134
+ artistIds = artistIds.filter((a) => !!a);
120
135
  return artistIds;
121
136
  },
122
137
  /****************************************************************************************
123
138
  Tickets
124
139
  ****************************************************************************************/
125
140
  ticketType(event, ticketTypeId): any {
126
- return event.ticketTypes.find(ticketType => ticketType._id === ticketTypeId);
141
+ return event.ticketTypes.find(
142
+ (ticketType) => ticketType._id === ticketTypeId
143
+ );
127
144
  },
128
145
  remainingTicketQty(event, ticketTypeId: string | null = null): number {
129
146
  if (ticketTypeId) {
130
- let ticketType = event.ticketTypes.find(ticketType => ticketType._id === ticketTypeId);
147
+ let ticketType = event.ticketTypes.find(
148
+ (ticketType) => ticketType._id === ticketTypeId
149
+ );
131
150
  if (!ticketType) return 0;
132
151
  else return ticketType.remainingQty;
133
152
  } else {
@@ -149,20 +168,24 @@ export default {
149
168
  }, {});
150
169
  },
151
170
  getCurrentTierId(event, ticketTypeId: string): string {
152
- const ticketType = event.ticketTypes.find(t => t._id.toString() === ticketTypeId);
171
+ const ticketType = event.ticketTypes.find(
172
+ (t) => t._id.toString() === ticketTypeId
173
+ );
153
174
  const now = Time.now();
154
- const tier = ticketType.tiers.find(tier => tier.startsAt < now && now < tier.endsAt);
175
+ const tier = ticketType.tiers.find(
176
+ (tier) => tier.startsAt < now && now < tier.endsAt
177
+ );
155
178
  return tier._id;
156
- },
179
+ },
157
180
  /****************************************************************************************
158
181
  Upgrades
159
182
  ****************************************************************************************/
160
183
  upgrade(event, upgradeId): any {
161
- return event.upgrades.find(upgrades => upgrades._id === upgradeId);
184
+ return event.upgrades.find((upgrades) => upgrades._id === upgradeId);
162
185
  },
163
186
  remainingUpgradeQty(event, upgradeId: string | null = null): number {
164
187
  if (upgradeId) {
165
- let upgrade = event.upgrades.find(upgrade => upgrade._id === upgradeId);
188
+ let upgrade = event.upgrades.find((upgrade) => upgrade._id === upgradeId);
166
189
  if (!upgrade) return 0;
167
190
  else return upgrade.remainingQty;
168
191
  } else {
@@ -183,4 +206,66 @@ export default {
183
206
  return cur;
184
207
  }, {});
185
208
  },
186
- }
209
+ /****************************************************************************************
210
+ Promotion
211
+ ****************************************************************************************/
212
+ promotion(event, promotionId: string): any {
213
+ return event.promotions.find(
214
+ (promotions) => promotions._id === promotionId
215
+ );
216
+ },
217
+ // remainingUpgradeQty(event, upgradeId: string | null = null): number {
218
+ // if (upgradeId) {
219
+ // let upgrade = event.upgrades.find((upgrade) => upgrade._id === upgradeId);
220
+ // if (!upgrade) return 0;
221
+ // else return upgrade.remainingQty;
222
+ // } else {
223
+ // return event.upgrades.reduce((cur, next) => {
224
+ // return cur + next.remainingQty;
225
+ // }, 0);
226
+ // }
227
+ // },
228
+ // remainingQtyByUpgrades(event): object {
229
+ // return event.upgrades.reduce((cur, upgrade) => {
230
+ // cur[upgrade._id] = this.remainingUpgradeQty(event, upgrade._id);
231
+ // return cur;
232
+ // }, {});
233
+ // },
234
+ // purchaseLimitByUpgrades(event): object {
235
+ // return event.upgrades.reduce((cur, upgrade) => {
236
+ // cur[upgrade._id] = upgrade.purchaseLimit;
237
+ // return cur;
238
+ // }, {});
239
+ // },
240
+ /****************************************************************************************
241
+ Promotion
242
+ ****************************************************************************************/
243
+ customField(event, customFieldId: string): any {
244
+ return event.customFields.find(
245
+ (customField) => customField._id === customFieldId
246
+ );
247
+ },
248
+ // remainingUpgradeQty(event, upgradeId: string | null = null): number {
249
+ // if (upgradeId) {
250
+ // let upgrade = event.upgrades.find((upgrade) => upgrade._id === upgradeId);
251
+ // if (!upgrade) return 0;
252
+ // else return upgrade.remainingQty;
253
+ // } else {
254
+ // return event.upgrades.reduce((cur, next) => {
255
+ // return cur + next.remainingQty;
256
+ // }, 0);
257
+ // }
258
+ // },
259
+ // remainingQtyByUpgrades(event): object {
260
+ // return event.upgrades.reduce((cur, upgrade) => {
261
+ // cur[upgrade._id] = this.remainingUpgradeQty(event, upgrade._id);
262
+ // return cur;
263
+ // }, {});
264
+ // },
265
+ // purchaseLimitByUpgrades(event): object {
266
+ // return event.upgrades.reduce((cur, upgrade) => {
267
+ // cur[upgrade._id] = upgrade.purchaseLimit;
268
+ // return cur;
269
+ // }, {});
270
+ // },
271
+ };
@@ -0,0 +1,36 @@
1
+ import IFee, { FeeAppliedByEnum } from '../interfaces/IFee";
2
+
3
+ export default {
4
+ processingFees(fees: IFee[]) {
5
+ return fees.filter((fee: IFee) => {
6
+ if (fee.appliedBy === FeeAppliedByEnum.Sellout || fee.appliedBy === FeeAppliedByEnum.Stripe) {
7
+ return true;
8
+ }
9
+ return false;
10
+ });
11
+ },
12
+ selloutFees(fees: IFee[]) {
13
+ return fees.filter((fee: IFee) => {
14
+ if (fee.appliedBy === FeeAppliedByEnum.Sellout) {
15
+ return true;
16
+ }
17
+ return false;
18
+ });
19
+ },
20
+ stripeFees(fees: IFee[]) {
21
+ return fees.filter((fee: IFee) => {
22
+ if (fee.appliedBy === FeeAppliedByEnum.Stripe) {
23
+ return false;
24
+ }
25
+ return true;
26
+ });
27
+ },
28
+ promoterFees(fees: IFee[]) {
29
+ return fees.filter((fee: IFee) => {
30
+ if (fee.appliedBy === FeeAppliedByEnum.Sellout || fee.appliedBy === FeeAppliedByEnum.Stripe) {
31
+ return false;
32
+ }
33
+ return true;
34
+ });
35
+ },
36
+ };