@dev-crew-berlin/enter-js-utils 0.72.0 → 0.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +1 -1
  2. package/dist/generated/api-schema.d.ts +136 -18
  3. package/dist/lib/result.js +0 -1
  4. package/dist/models/attendee.d.ts +16 -15
  5. package/dist/models/attendee.js +43 -25
  6. package/dist/models/branch.d.ts +9 -0
  7. package/dist/models/branch.js +7 -0
  8. package/dist/models/checkin-counter.d.ts +2 -0
  9. package/dist/models/checkin-counter.js +1 -0
  10. package/dist/models/checkin.d.ts +5 -2
  11. package/dist/models/checkin.js +4 -1
  12. package/dist/models/checkins.d.ts +2 -2
  13. package/dist/models/checkins.js +6 -6
  14. package/dist/models/event.d.ts +1 -0
  15. package/dist/models/field.d.ts +9 -0
  16. package/dist/models/index.d.ts +3 -0
  17. package/dist/models/index.js +1 -0
  18. package/dist/models/instance.d.ts +2 -1
  19. package/dist/models/instance.js +6 -3
  20. package/dist/models/rsvp.d.ts +3 -2
  21. package/dist/models/rsvp.js +7 -4
  22. package/dist/ui/button.js +7 -6
  23. package/dist/ui/button.stories.d.ts +16 -59
  24. package/dist/ui/button.stories.js +66 -54
  25. package/dist/ui/checkin-count-indicator.stories.d.ts +14 -84
  26. package/dist/ui/checkin-count-indicator.stories.js +60 -52
  27. package/dist/ui/checkin-progress-bar.js +11 -11
  28. package/dist/ui/checkin-progress-bar.stories.d.ts +12 -59
  29. package/dist/ui/checkin-progress-bar.stories.js +45 -39
  30. package/dist/ui/companion-info.js +6 -6
  31. package/dist/ui/companion-info.stories.d.ts +8 -44
  32. package/dist/ui/companion-info.stories.js +29 -27
  33. package/dist/ui/enter-logo.js +2 -2
  34. package/dist/ui/enter-logo.stories.d.ts +7 -12
  35. package/dist/ui/enter-logo.stories.js +11 -12
  36. package/dist/ui/form-elements/input.js +6 -6
  37. package/dist/ui/form-elements/input.stories.d.ts +8 -15
  38. package/dist/ui/form-elements/input.stories.js +26 -24
  39. package/dist/ui/form-elements/label.js +6 -6
  40. package/dist/ui/form-elements/label.stories.d.ts +6 -5
  41. package/dist/ui/form-elements/label.stories.js +6 -6
  42. package/dist/ui/form-elements/search-input.js +10 -10
  43. package/dist/ui/form-elements/search-input.stories.d.ts +7 -18
  44. package/dist/ui/form-elements/search-input.stories.js +18 -17
  45. package/dist/ui/form-elements/segmented-control.js +8 -8
  46. package/dist/ui/form-elements/segmented-control.stories.d.ts +6 -17
  47. package/dist/ui/form-elements/segmented-control.stories.js +7 -7
  48. package/dist/ui/guest-card.d.ts +2 -1
  49. package/dist/ui/guest-card.js +17 -16
  50. package/dist/ui/guest-card.stories.d.ts +14 -124
  51. package/dist/ui/guest-card.stories.js +93 -76
  52. package/dist/ui/icons/add-guest-icon.stories.d.ts +7 -12
  53. package/dist/ui/icons/add-guest-icon.stories.js +11 -12
  54. package/dist/ui/icons/caret-icon.stories.d.ts +7 -15
  55. package/dist/ui/icons/caret-icon.stories.js +11 -12
  56. package/dist/ui/icons/filter-icon.stories.d.ts +7 -12
  57. package/dist/ui/icons/filter-icon.stories.js +11 -12
  58. package/dist/ui/icons/search-icon.stories.d.ts +7 -12
  59. package/dist/ui/icons/search-icon.stories.js +11 -12
  60. package/dist/ui/icons/settings-icon.stories.d.ts +7 -12
  61. package/dist/ui/icons/settings-icon.stories.js +11 -12
  62. package/dist/ui/icons/sort-list-icon.stories.d.ts +7 -15
  63. package/dist/ui/icons/sort-list-icon.stories.js +11 -12
  64. package/dist/ui/tag.js +5 -5
  65. package/dist/ui/tag.stories.d.ts +6 -9
  66. package/dist/ui/tag.stories.js +6 -6
  67. package/package.json +18 -17
package/README.md CHANGED
@@ -16,7 +16,7 @@ This also contains the dcb colors.
16
16
  ### ui
17
17
 
18
18
  react ui components for enter and dcb apps.
19
- see: https://js-utils-main.mrdcb.vercel.app
19
+ see: https://js-utils-main.dcb-utils.vercel.app
20
20
 
21
21
  ### api-client
22
22
 
@@ -115,7 +115,7 @@ export declare type components = {
115
115
  /** Group */
116
116
  group?: components["schemas"]["EventGroup"] | components["schemas"]["NoGroup"];
117
117
  /** Preconditions */
118
- preconditions?: [components["schemas"]["Filter"], components["schemas"]["RegistrationInfo"]] | null;
118
+ preconditions?: [components["schemas"]["AttendeesSelector"], components["schemas"]["RegistrationInfo"]] | null;
119
119
  /** Instancename */
120
120
  instanceName: string;
121
121
  /** Attendeeid */
@@ -165,7 +165,7 @@ export declare type components = {
165
165
  event?: "attendee-deleted";
166
166
  /** Group */
167
167
  group?: components["schemas"]["EventGroup"] | components["schemas"]["NoGroup"];
168
- preconditions?: components["schemas"]["Filter"] | null;
168
+ preconditions?: components["schemas"]["AttendeesSelector"] | null;
169
169
  /** Attendeeid */
170
170
  attendeeId: string;
171
171
  /** Instancename */
@@ -204,7 +204,7 @@ export declare type components = {
204
204
  event?: "attendee-responded";
205
205
  /** Group */
206
206
  group?: components["schemas"]["EventGroup"] | components["schemas"]["NoGroup"];
207
- preconditions?: components["schemas"]["Preconditions"] | null;
207
+ preconditions?: components["schemas"]["common__events__attendee_responded_event__Preconditions"] | null;
208
208
  /** Instancename */
209
209
  instanceName: string;
210
210
  /** Attendeeid */
@@ -239,6 +239,10 @@ export declare type components = {
239
239
  };
240
240
  companions?: components["schemas"]["RootModel_Union_Companion__MainGuest__-Input"];
241
241
  payment?: components["schemas"]["Payment"] | null;
242
+ /** Branches */
243
+ branches?: string[];
244
+ /** Deletedbranches */
245
+ deletedBranches?: string[];
242
246
  };
243
247
  /**
244
248
  * AttendeeUpdatedEvent
@@ -260,7 +264,7 @@ export declare type components = {
260
264
  /** Group */
261
265
  group?: components["schemas"]["EventGroup"] | components["schemas"]["NoGroup"];
262
266
  /** Preconditions */
263
- preconditions?: [components["schemas"]["Filter"], components["schemas"]["FieldGroup-Input"][]] | null;
267
+ preconditions?: [components["schemas"]["AttendeesSelector"], components["schemas"]["FieldGroup-Input"][]] | null;
264
268
  /** Instancename */
265
269
  instanceName: string;
266
270
  /** Attendeeid */
@@ -272,6 +276,24 @@ export declare type components = {
272
276
  */
273
277
  time?: string;
274
278
  };
279
+ /** AttendeesSelector */
280
+ AttendeesSelector: {
281
+ /** Instancename */
282
+ instanceName: string;
283
+ /**
284
+ * Branchname
285
+ * @default default
286
+ */
287
+ branchName?: string;
288
+ /** @default {} */
289
+ filter?: components["schemas"]["Filter"];
290
+ /**
291
+ * Deleted
292
+ * @default exclude_deleted
293
+ * @enum {string}
294
+ */
295
+ deleted?: "exclude_deleted" | "include_deleted" | "only_deleted";
296
+ };
275
297
  /** AuthCode */
276
298
  AuthCode: {
277
299
  /** Authcode */
@@ -304,6 +326,28 @@ export declare type components = {
304
326
  */
305
327
  suffix?: string;
306
328
  };
329
+ /** Branch */
330
+ Branch: {
331
+ /** Title */
332
+ title: string;
333
+ /**
334
+ * Guestlistlabel
335
+ * @default Guests
336
+ */
337
+ guestlistLabel: string;
338
+ /**
339
+ * Checkincounters
340
+ * @default {
341
+ * "main": {
342
+ * "label": "Main Entrance",
343
+ * "short_label": "🎫"
344
+ * }
345
+ * }
346
+ */
347
+ checkinCounters: {
348
+ [key: string]: components["schemas"]["CheckinCounter"];
349
+ };
350
+ };
307
351
  /** CheckboxField */
308
352
  "CheckboxField-Input": {
309
353
  /**
@@ -510,7 +554,7 @@ export declare type components = {
510
554
  * Checkin
511
555
  * @description The unique event with the time when someone passed a checkpoint
512
556
  */
513
- Checkin: {
557
+ "Checkin-Input": {
514
558
  /**
515
559
  * Id
516
560
  * Format: uuid
@@ -521,6 +565,32 @@ export declare type components = {
521
565
  * Format: date-time
522
566
  */
523
567
  time: string;
568
+ /**
569
+ * Countername
570
+ * @default main
571
+ */
572
+ counterName?: string;
573
+ };
574
+ /**
575
+ * Checkin
576
+ * @description The unique event with the time when someone passed a checkpoint
577
+ */
578
+ "Checkin-Output": {
579
+ /**
580
+ * Id
581
+ * Format: uuid
582
+ */
583
+ id: string;
584
+ /**
585
+ * Time
586
+ * Format: date-time
587
+ */
588
+ time: string;
589
+ /**
590
+ * Countername
591
+ * @default main
592
+ */
593
+ counterName: string;
524
594
  };
525
595
  /** CheckinCount */
526
596
  CheckinCount: {
@@ -535,6 +605,13 @@ export declare type components = {
535
605
  */
536
606
  checkins: number;
537
607
  };
608
+ /** CheckinCounter */
609
+ CheckinCounter: {
610
+ /** Label */
611
+ label: string;
612
+ /** Shortlabel */
613
+ shortLabel: string;
614
+ };
538
615
  /**
539
616
  * CheckinCreatedEvent
540
617
  * @description A new checkin was created
@@ -560,9 +637,9 @@ export declare type components = {
560
637
  instanceName: string;
561
638
  /** Attendeeid */
562
639
  attendeeId: string;
563
- /** Checkintag */
564
- checkinTag: string;
565
- checkin: components["schemas"]["Checkin"];
640
+ /** Branchname */
641
+ branchName: string;
642
+ checkin: components["schemas"]["Checkin-Input"];
566
643
  };
567
644
  /**
568
645
  * CheckinDeletedEvent
@@ -594,8 +671,8 @@ export declare type components = {
594
671
  * Format: uuid
595
672
  */
596
673
  checkinId: string;
597
- /** Checkintag */
598
- checkinTag: string;
674
+ /** Branchname */
675
+ branchName: string;
599
676
  };
600
677
  /**
601
678
  * Checkins
@@ -606,7 +683,7 @@ export declare type components = {
606
683
  * Checkins
607
684
  * @default []
608
685
  */
609
- checkins?: components["schemas"]["Checkin"][];
686
+ checkins?: components["schemas"]["Checkin-Input"][];
610
687
  /**
611
688
  * Deleted
612
689
  * @default []
@@ -622,7 +699,7 @@ export declare type components = {
622
699
  * Checkins
623
700
  * @default []
624
701
  */
625
- checkins: components["schemas"]["Checkin"][];
702
+ checkins: components["schemas"]["Checkin-Output"][];
626
703
  /**
627
704
  * Deleted
628
705
  * @default []
@@ -1117,6 +1194,11 @@ export declare type components = {
1117
1194
  * @default false
1118
1195
  */
1119
1196
  invites?: boolean;
1197
+ /**
1198
+ * Branch
1199
+ * @default default
1200
+ */
1201
+ branch?: string;
1120
1202
  /**
1121
1203
  * Sort Order
1122
1204
  * @default 0
@@ -1300,7 +1382,7 @@ export declare type components = {
1300
1382
  event?: "email-status-updated";
1301
1383
  /** Group */
1302
1384
  group?: components["schemas"]["EventGroup"] | components["schemas"]["NoGroup"];
1303
- preconditions?: components["schemas"]["Filter"] | null;
1385
+ preconditions?: components["schemas"]["AttendeesSelector"] | null;
1304
1386
  /** Instancename */
1305
1387
  instanceName: string;
1306
1388
  /** Attendeeid */
@@ -2007,13 +2089,12 @@ export declare type components = {
2007
2089
  event?: "payment-paid";
2008
2090
  /** Group */
2009
2091
  group?: components["schemas"]["EventGroup"] | components["schemas"]["NoGroup"];
2010
- preconditions?: components["schemas"]["Preconditions"] | null;
2092
+ preconditions?: components["schemas"]["common__events__payment_paid_event__Preconditions"] | null;
2011
2093
  /** Attendeeid */
2012
2094
  attendeeId: string;
2013
2095
  /** Instancename */
2014
2096
  instanceName: string;
2015
2097
  };
2016
- Preconditions: [components["schemas"]["Filter"], [string, components["schemas"]["EmailConfig"]][], components["schemas"]["MailgunConfig"] | components["schemas"]["SmtpConfig"], components["schemas"]["FrontendConfig"]];
2017
2098
  /** PublicAttendee */
2018
2099
  "PublicAttendee-Input": {
2019
2100
  /** Id */
@@ -2051,6 +2132,11 @@ export declare type components = {
2051
2132
  checkin?: {
2052
2133
  [key: string]: components["schemas"]["Checkins-Input"];
2053
2134
  };
2135
+ /**
2136
+ * Branches
2137
+ * @default []
2138
+ */
2139
+ branches?: string[];
2054
2140
  /**
2055
2141
  * @default {
2056
2142
  * "isCompanion": false
@@ -2101,6 +2187,11 @@ export declare type components = {
2101
2187
  checkin: {
2102
2188
  [key: string]: components["schemas"]["Checkins-Output"];
2103
2189
  };
2190
+ /**
2191
+ * Branches
2192
+ * @default []
2193
+ */
2194
+ branches: string[];
2104
2195
  /**
2105
2196
  * @default {
2106
2197
  * "isCompanion": false
@@ -2129,8 +2220,6 @@ export declare type components = {
2129
2220
  name: string;
2130
2221
  /** Title */
2131
2222
  title: string;
2132
- /** Checkins */
2133
- checkins: string[];
2134
2223
  /** Description */
2135
2224
  description: string;
2136
2225
  /** Thumbnail */
@@ -2143,6 +2232,10 @@ export declare type components = {
2143
2232
  tagColors: {
2144
2233
  [key: string]: string;
2145
2234
  };
2235
+ /** Branches */
2236
+ branches: {
2237
+ [key: string]: components["schemas"]["Branch"];
2238
+ };
2146
2239
  };
2147
2240
  /** PublicRegistrationInfo */
2148
2241
  PublicRegistrationInfo: {
@@ -2183,7 +2276,11 @@ export declare type components = {
2183
2276
  userdata: Record<string, unknown>;
2184
2277
  /** Permissions */
2185
2278
  permissions: {
2186
- [key: string]: ("attendees:read" | "attendees:create" | "attendees:write" | "attendees:write:bulk" | "attendees:import" | "attendees:export" | "attendees:delete:soft" | "attendees:delete:final" | "emails:send" | "emails:send:bulk" | "email-config:write" | "pdfs:write" | "pdfs:export" | "payment:write" | "checkins:write" | "branches:read" | "branches:write" | "files:write" | "fields:write" | "fields:read" | "templates:write" | "register-flow:write" | "export-scripts:write" | "instance-info:read" | "instance-info:write" | "domains:manage" | "stats:read" | "stats:write" | "backup:write" | "variables:read" | "variables:write" | "webhooks:read" | "webhooks:write" | "eventlog:read")[];
2279
+ [key: string]: ("attendees:read" | "attendees:create" | "attendees:write" | "attendees:write:bulk" | "attendees:import" | "attendees:export" | "attendees:delete:soft" | "attendees:delete:final" | "emails:send" | "emails:send:bulk" | "email-config:write" | "pdfs:write" | "pdfs:export" | "payment:write" | "checkins:write" | "branches:write" | "files:write" | "fields:write" | "fields:read" | "templates:write" | "register-flow:write" | "export-config:write" | "instance-info:read" | "instance-info:write" | "domains:manage" | "stats:read" | "stats:write" | "backup:write" | "variables:read" | "variables:write" | "webhooks:read" | "webhooks:write" | "eventlog:read")[];
2280
+ };
2281
+ /** Groups */
2282
+ groups: {
2283
+ [key: string]: ("team" | "external")[];
2187
2284
  };
2188
2285
  };
2189
2286
  /** QuestionFields */
@@ -2207,6 +2304,13 @@ export declare type components = {
2207
2304
  tieBreaker?: string;
2208
2305
  /** Personcount */
2209
2306
  personCount: number;
2307
+ /**
2308
+ * Checkincounters
2309
+ * @default [
2310
+ * "main"
2311
+ * ]
2312
+ */
2313
+ checkinCounters?: string[];
2210
2314
  /** Time */
2211
2315
  time: string | null;
2212
2316
  };
@@ -2219,6 +2323,13 @@ export declare type components = {
2219
2323
  tieBreaker: string;
2220
2324
  /** Personcount */
2221
2325
  personCount: number;
2326
+ /**
2327
+ * Checkincounters
2328
+ * @default [
2329
+ * "main"
2330
+ * ]
2331
+ */
2332
+ checkinCounters: string[];
2222
2333
  /** Time */
2223
2334
  time: string | null;
2224
2335
  /** Confirmed */
@@ -2698,6 +2809,8 @@ export declare type components = {
2698
2809
  /** Isprivate */
2699
2810
  isPrivate?: boolean | null;
2700
2811
  };
2812
+ common__events__attendee_responded_event__Preconditions: [components["schemas"]["AttendeesSelector"], [string, components["schemas"]["EmailConfig"]][], components["schemas"]["MailgunConfig"] | components["schemas"]["SmtpConfig"], components["schemas"]["FrontendConfig"]];
2813
+ common__events__payment_paid_event__Preconditions: [components["schemas"]["AttendeesSelector"], [string, components["schemas"]["EmailConfig"]][], components["schemas"]["MailgunConfig"] | components["schemas"]["SmtpConfig"], components["schemas"]["FrontendConfig"]];
2701
2814
  };
2702
2815
  responses: never;
2703
2816
  parameters: never;
@@ -2725,6 +2838,9 @@ export declare type operations = {
2725
2838
  /** Checkin Counts */
2726
2839
  checkin_counts_instances__instance_name__checkin_counts_get: {
2727
2840
  parameters: {
2841
+ query?: {
2842
+ branch?: string;
2843
+ };
2728
2844
  header?: {
2729
2845
  "x-enter-device-name"?: string | null;
2730
2846
  };
@@ -2753,6 +2869,7 @@ export declare type operations = {
2753
2869
  calcualte_custom_counts_instances__instance_name__custom_counts_post: {
2754
2870
  parameters: {
2755
2871
  query?: {
2872
+ branch?: string;
2756
2873
  include_deleted?: boolean;
2757
2874
  };
2758
2875
  header?: {
@@ -2947,6 +3064,7 @@ export declare type operations = {
2947
3064
  attendee_list_instances__instance_name__attendees_get: {
2948
3065
  parameters: {
2949
3066
  query?: {
3067
+ branch?: string;
2950
3068
  filter?: string | null;
2951
3069
  include_deleted?: boolean;
2952
3070
  };
@@ -40,7 +40,6 @@ export function combineResults(results) {
40
40
  ) // also the typechecker does not resolve this so we just tell him its fine and hope there are no errors
41
41
  };
42
42
  }
43
-
44
43
  return {
45
44
  success: false,
46
45
  error: results.map(result => asFailure(result)?.error).filter(failure => failure !== undefined) // the typechecker does not resolve this so we just tell him its fine and hope there are no errors
@@ -7,12 +7,13 @@ export declare type AttendeeJSON = components['schemas']['PublicAttendee-Output'
7
7
  declare type AttendeeJSONInput = components['schemas']['PublicAttendee-Input'];
8
8
  export declare class Attendee {
9
9
  id: string;
10
- userdata: Record<string, FieldValue>;
11
- tags: string[];
10
+ userdata: Map<string, FieldValue>;
11
+ tags: Set<string>;
12
12
  language: string | null;
13
13
  time: Date;
14
- rsvp: Record<string, Rsvp | null>;
15
- checkin: Record<string, Checkins>;
14
+ branches: Set<string>;
15
+ rsvp: Map<string, Rsvp | null>;
16
+ checkin: Map<string, Checkins>;
16
17
  companions: {
17
18
  isCompanion: false;
18
19
  } | {
@@ -36,20 +37,20 @@ export declare class Attendee {
36
37
  */
37
38
  static generateID(prefix: string): string;
38
39
  toJSON(): AttendeeJSON;
39
- getRsvpCountForTag(checkinTag: string): number;
40
- getResponseForTag(checkinTag: string): 'no-response' | 'negative-response' | 'positive-response';
41
- getCheckinsForTag(checkinTag: string): Checkins;
42
- getCheckinCountForTag(checkinTag: string): number;
43
- addCheckinForTag(args: {
44
- checkinTag: string;
40
+ getRsvpCountForBranch(branchName: string): number;
41
+ getRsvpCount(branchName: string, counterName: string): number;
42
+ getResponseForBranch(branchName: string): 'no-response' | 'negative-response' | 'positive-response';
43
+ getResponse(branchName: string, counterName: string): 'no-response' | 'negative-response' | 'positive-response';
44
+ getCheckinsForBranch(branchName: string): Checkins;
45
+ getCheckinCount(branchName: string, counterName: string): number;
46
+ addCheckinForBranch(args: {
47
+ branchName: string;
45
48
  checkin: Checkin;
46
49
  }): Attendee;
47
- deleteCheckinForTag(args: {
48
- checkinTag: string;
50
+ deleteCheckinForBranch(args: {
51
+ branchName: string;
49
52
  checkinId: string;
50
53
  }): Attendee;
51
- hasRsvp(args: {
52
- checkinTags: string[];
53
- }): boolean;
54
+ getFieldValueString(fieldKey: string): string;
54
55
  }
55
56
  export {};
@@ -2,11 +2,12 @@ import { v4 as uuidv4 } from 'uuid';
2
2
  import { Checkins } from './checkins';
3
3
  import { Rsvp } from './rsvp';
4
4
  export class Attendee {
5
- userdata = {};
6
- tags = [];
5
+ userdata = new Map();
6
+ tags = new Set();
7
7
  language = null;
8
- rsvp = {};
9
- checkin = {};
8
+ branches = new Set();
9
+ rsvp = new Map();
10
+ checkin = new Map();
10
11
  companions = {
11
12
  isCompanion: false
12
13
  };
@@ -20,12 +21,13 @@ export class Attendee {
20
21
  }
21
22
  const json = args;
22
23
  this.id = json.id;
23
- this.userdata = json.userdata;
24
- this.tags = json.tags ?? [];
24
+ this.userdata = new Map(Object.entries(json.userdata ?? {}));
25
+ this.tags = new Set(json.tags);
25
26
  this.language = json.language;
27
+ this.branches = new Set(json.branches);
26
28
  this.time = json.time ? new Date(json.time) : new Date();
27
- this.rsvp = Object.fromEntries(new Map(Object.entries(json.rsvp ?? {}).map(([checkinTag, rsvp]) => [checkinTag, rsvp ? new Rsvp(rsvp) : null])));
28
- this.checkin = Object.fromEntries(new Map(Object.entries(json.checkin ?? {}).map(([checkinTag, checkin]) => [checkinTag, new Checkins(checkin)])));
29
+ this.rsvp = new Map(Object.entries(json.rsvp ?? {}).map(([checkinTag, rsvp]) => [checkinTag, rsvp ? new Rsvp(rsvp) : null]));
30
+ this.checkin = new Map(Object.entries(json.checkin ?? {}).map(([checkinTag, checkin]) => [checkinTag, new Checkins(checkin)]));
29
31
  this.companions = json.companions?.isCompanion ? {
30
32
  isCompanion: true,
31
33
  ...json.companions
@@ -62,45 +64,60 @@ export class Attendee {
62
64
  return {
63
65
  ...this,
64
66
  time: this.time?.toISOString(),
67
+ branches: Array.from(this.branches),
68
+ tags: Array.from(this.tags),
69
+ userdata: Object.fromEntries(this.userdata),
65
70
  checkin,
66
71
  rsvp
67
72
  };
68
73
  }
69
- getRsvpCountForTag(checkinTag) {
70
- const rsvp = this.rsvp[checkinTag];
74
+ getRsvpCountForBranch(branchName) {
75
+ const rsvp = this.rsvp.get(branchName);
71
76
  if (!rsvp) return 0;
72
77
  return rsvp.personCount;
73
78
  }
74
- getResponseForTag(checkinTag) {
75
- const rsvp = this.rsvp[checkinTag] ?? null;
79
+ getRsvpCount(branchName, counterName) {
80
+ const rsvp = this.rsvp.get(branchName);
81
+ if (!rsvp) return 0;
82
+ if (!rsvp.checkinCounters.has(counterName)) return 0;
83
+ return rsvp.personCount;
84
+ }
85
+ getResponseForBranch(branchName) {
86
+ const rsvp = this.rsvp.get(branchName) ?? null;
87
+ if (rsvp === null) return 'no-response';
88
+ return rsvp.confirmed ? 'positive-response' : 'negative-response';
89
+ }
90
+ getResponse(branchName, counterName) {
91
+ const rsvp = this.rsvp.get(branchName) ?? null;
76
92
  if (rsvp === null) return 'no-response';
93
+ if (!rsvp.checkinCounters.has(counterName)) 'no-response';
77
94
  return rsvp.confirmed ? 'positive-response' : 'negative-response';
78
95
  }
79
- getCheckinsForTag(checkinTag) {
80
- return this.checkin[checkinTag] ?? new Checkins({
96
+ getCheckinsForBranch(branchName) {
97
+ return this.checkin.get(branchName) ?? new Checkins({
81
98
  checkins: [],
82
99
  deleted: []
83
100
  });
84
101
  }
85
- getCheckinCountForTag(checkinTag) {
86
- const checkins = this.checkin[checkinTag];
102
+ getCheckinCount(branchName, counterName) {
103
+ const checkins = this.checkin.get(branchName);
87
104
  if (!checkins) return 0;
88
- return checkins.getActiveCheckins().length;
105
+ return checkins.getActiveCheckins(counterName).length;
89
106
  }
90
- addCheckinForTag(args) {
91
- const exsitingCheckins = this.getCheckinsForTag(args.checkinTag);
107
+ addCheckinForBranch(args) {
108
+ const exsitingCheckins = this.getCheckinsForBranch(args.branchName);
92
109
  const newCheckins = new Checkins();
93
110
  newCheckins.checkins = [args.checkin];
94
111
  const mergedCheckins = exsitingCheckins.merge(newCheckins);
95
112
  const newAttendee = new Attendee(this.toJSON());
96
113
  newAttendee.checkin = {
97
114
  ...this.checkin,
98
- [args.checkinTag]: mergedCheckins
115
+ [args.branchName]: mergedCheckins
99
116
  };
100
117
  return newAttendee;
101
118
  }
102
- deleteCheckinForTag(args) {
103
- const exsitingCheckins = this.getCheckinsForTag(args.checkinTag);
119
+ deleteCheckinForBranch(args) {
120
+ const exsitingCheckins = this.getCheckinsForBranch(args.branchName);
104
121
  const deletedCheckins = new Checkins({
105
122
  checkins: [],
106
123
  deleted: [args.checkinId]
@@ -109,11 +126,12 @@ export class Attendee {
109
126
  const newAttendee = new Attendee(this.toJSON());
110
127
  newAttendee.checkin = {
111
128
  ...this.checkin,
112
- [args.checkinTag]: mergedCheckins
129
+ [args.branchName]: mergedCheckins
113
130
  };
114
131
  return newAttendee;
115
132
  }
116
- hasRsvp(args) {
117
- return args.checkinTags.some(checkinTag => this.getResponseForTag(checkinTag) !== 'no-response');
133
+ getFieldValueString(fieldKey) {
134
+ const fieldValue = this.userdata.get(fieldKey);
135
+ return fieldValue?.toString() ?? '';
118
136
  }
119
137
  }
@@ -0,0 +1,9 @@
1
+ import { components } from '../generated/api-schema';
2
+ import { CheckinCounter } from './checkin-counter';
3
+ export declare type BranchJSON = components['schemas']['Branch'];
4
+ export declare class Branch {
5
+ title: string;
6
+ guestlistLabel: string;
7
+ checkinCounters: Map<string, CheckinCounter>;
8
+ constructor(json: BranchJSON);
9
+ }
@@ -0,0 +1,7 @@
1
+ export class Branch {
2
+ constructor(json) {
3
+ this.title = json.title;
4
+ this.guestlistLabel = json.guestlistLabel;
5
+ this.checkinCounters = new Map(Object.entries(json.checkinCounters));
6
+ }
7
+ }
@@ -0,0 +1,2 @@
1
+ import { components } from '../generated/api-schema';
2
+ export declare type CheckinCounter = components['schemas']['CheckinCounter'];
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,11 @@
1
1
  import { components } from '../generated/api-schema';
2
- export declare type CheckinJSON = components['schemas']['Checkin'];
2
+ export declare type CheckinJSON = components['schemas']['Checkin-Output'];
3
+ declare type CheckinJSONInput = components['schemas']['Checkin-Input'];
3
4
  export declare class Checkin {
4
5
  id: string;
5
6
  time: Date;
6
- constructor(json: CheckinJSON);
7
+ counterName: string;
8
+ constructor(json: CheckinJSONInput);
7
9
  toJSON(): CheckinJSON;
8
10
  }
11
+ export {};
@@ -1,12 +1,15 @@
1
1
  export class Checkin {
2
+ counterName = 'main';
2
3
  constructor(json) {
3
4
  this.id = json.id;
4
5
  this.time = new Date(json.time);
6
+ this.counterName = json.counterName ?? 'main';
5
7
  }
6
8
  toJSON() {
7
9
  return {
8
10
  id: this.id,
9
- time: this.time.toISOString()
11
+ time: this.time.toISOString(),
12
+ counterName: this.counterName
10
13
  };
11
14
  }
12
15
  }
@@ -4,10 +4,10 @@ export declare type CheckinsJSON = components['schemas']['Checkins-Output'];
4
4
  declare type CheckinsJSONInput = components['schemas']['Checkins-Input'];
5
5
  export declare class Checkins {
6
6
  checkins: Checkin[];
7
- deleted: string[];
7
+ deleted: Set<string>;
8
8
  constructor(json?: CheckinsJSONInput);
9
9
  toJSON(): CheckinsJSON;
10
- getActiveCheckins(): Checkin[];
10
+ getActiveCheckins(counterName?: string): Checkin[];
11
11
  merge(otherCheckin: Checkins): Checkins;
12
12
  }
13
13
  export {};
@@ -1,28 +1,28 @@
1
1
  import { Checkin } from './checkin';
2
2
  export class Checkins {
3
3
  checkins = [];
4
- deleted = [];
4
+ deleted = new Set();
5
5
  constructor(json) {
6
6
  // if constructor is called without params use default values
7
7
  if (!json) return;
8
8
  this.checkins = (json.checkins ?? []).map(checkinJSON => new Checkin(checkinJSON));
9
- this.deleted = json.deleted ?? [];
9
+ this.deleted = new Set(json.deleted);
10
10
  }
11
11
  toJSON() {
12
12
  return {
13
13
  checkins: this.checkins.map(checkin => checkin.toJSON()),
14
- deleted: this.deleted
14
+ deleted: Array.from(this.deleted)
15
15
  };
16
16
  }
17
- getActiveCheckins() {
18
- return this.checkins.filter(c => !this.deleted.includes(c.id));
17
+ getActiveCheckins(counterName = 'main') {
18
+ return this.checkins.filter(checkin => checkin.counterName === counterName && !this.deleted.has(checkin.id));
19
19
  }
20
20
  merge(otherCheckin) {
21
21
  const checkins = new Map([...this.checkins, ...otherCheckin.checkins].map(checkin => [checkin.id, checkin])).values();
22
22
  const deleted = new Set([...this.deleted, ...otherCheckin.deleted]);
23
23
  const newCheckins = new Checkins();
24
24
  newCheckins.checkins = Array.from(checkins);
25
- newCheckins.deleted = Array.from(deleted);
25
+ newCheckins.deleted = deleted;
26
26
  return newCheckins;
27
27
  }
28
28
  }
@@ -5,6 +5,7 @@ export declare type AttendeeRespondedEvent = components['schemas']['AttendeeResp
5
5
  export declare type AttendeeDeletedEvent = components['schemas']['AttendeeDeletedEvent'];
6
6
  export declare type AttendeeAuthCodeRequestedEvent = components['schemas']['AttendeeAuthCodeRequested'];
7
7
  export declare type EmailUnsubscribedEvent = components['schemas']['EmailUnsubscribedEvent'];
8
+ export declare type EmailStatusUpdatedEvent = components['schemas']['EmailStatusUpdatedEvent'];
8
9
  export declare type CheckinCreatedEvent = components['schemas']['CheckinCreatedEvent'];
9
10
  export declare type CheckinDeletedEvent = components['schemas']['CheckinDeletedEvent'];
10
11
  export declare type PaymentPaidEvent = components['schemas']['PaymentPaidEvent'];