@dev-crew-berlin/enter-js-utils 0.32.1 → 0.34.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.
@@ -3,6 +3,10 @@
3
3
  * Do not make direct changes to the file.
4
4
  */
5
5
  export declare type paths = {
6
+ "/health": {
7
+ /** healthcheck to see if api server is running */
8
+ get: operations["healthcheck_health_get"];
9
+ };
6
10
  "/authenticate": {
7
11
  post: operations["login_authenticate_post"];
8
12
  };
@@ -63,17 +67,17 @@ export declare type components = {
63
67
  * @description New attendee was created
64
68
  */
65
69
  AttendeeCreatedEvent: {
70
+ /**
71
+ * Id
72
+ * Format: uuid
73
+ */
74
+ id?: string;
66
75
  /**
67
76
  * Event
68
77
  * @default attendee-created
69
78
  * @enum {string}
70
79
  */
71
80
  event: "attendee-created";
72
- /**
73
- * Id
74
- * Format: uuid
75
- */
76
- id: string;
77
81
  attendee: components["schemas"]["PublicAttendee"];
78
82
  /** Instancename */
79
83
  instanceName: string;
@@ -83,17 +87,17 @@ export declare type components = {
83
87
  * @description Attendee was deleted
84
88
  */
85
89
  AttendeeDeletedEvent: {
90
+ /**
91
+ * Id
92
+ * Format: uuid
93
+ */
94
+ id?: string;
86
95
  /**
87
96
  * Event
88
97
  * @default attendee-deleted
89
98
  * @enum {string}
90
99
  */
91
100
  event: "attendee-deleted";
92
- /**
93
- * Id
94
- * Format: uuid
95
- */
96
- id: string;
97
101
  /** Attendeeid */
98
102
  attendeeId: string;
99
103
  /** Instancename */
@@ -109,17 +113,17 @@ export declare type components = {
109
113
  * Alternatively you can set `is_edit` to trigger email that are sent on edit instead.
110
114
  */
111
115
  AttendeeRespondedEvent: {
116
+ /**
117
+ * Id
118
+ * Format: uuid
119
+ */
120
+ id?: string;
112
121
  /**
113
122
  * Event
114
123
  * @default attendee-responded
115
124
  * @enum {string}
116
125
  */
117
126
  event: "attendee-responded";
118
- /**
119
- * Id
120
- * Format: uuid
121
- */
122
- id: string;
123
127
  /** Instancename */
124
128
  instanceName: string;
125
129
  /** Attendeeid */
@@ -159,17 +163,17 @@ export declare type components = {
159
163
  * @description Attendee was updated. This includes `userdata` but also other data such as `payment`, `rsvp` or `tags`
160
164
  */
161
165
  AttendeeUpdatedEvent: {
166
+ /**
167
+ * Id
168
+ * Format: uuid
169
+ */
170
+ id?: string;
162
171
  /**
163
172
  * Event
164
173
  * @default attendee-updated
165
174
  * @enum {string}
166
175
  */
167
176
  event: "attendee-updated";
168
- /**
169
- * Id
170
- * Format: uuid
171
- */
172
- id: string;
173
177
  /** Instancename */
174
178
  instanceName: string;
175
179
  /** Attendeeid */
@@ -207,6 +211,11 @@ export declare type components = {
207
211
  * @default false
208
212
  */
209
213
  isMetaField: boolean;
214
+ /**
215
+ * Static
216
+ * @default false
217
+ */
218
+ static: boolean;
210
219
  /**
211
220
  * Required
212
221
  * @default false
@@ -217,15 +226,8 @@ export declare type components = {
217
226
  * @default false
218
227
  */
219
228
  hidden: boolean;
220
- /**
221
- * Attendeesonly
222
- * @default false
223
- */
224
- attendeesOnly: boolean;
225
229
  /** Value */
226
230
  value?: string;
227
- /** If */
228
- if?: string;
229
231
  };
230
232
  /** AuthResponse */
231
233
  AuthResponse: {
@@ -291,6 +293,11 @@ export declare type components = {
291
293
  * @default false
292
294
  */
293
295
  isMetaField: boolean;
296
+ /**
297
+ * Static
298
+ * @default false
299
+ */
300
+ static: boolean;
294
301
  /**
295
302
  * Required
296
303
  * @default false
@@ -301,15 +308,8 @@ export declare type components = {
301
308
  * @default false
302
309
  */
303
310
  hidden: boolean;
304
- /**
305
- * Attendeesonly
306
- * @default false
307
- */
308
- attendeesOnly: boolean;
309
311
  /** Value */
310
312
  value?: string;
311
- /** If */
312
- if?: string;
313
313
  };
314
314
  /** CheckboxGroupField */
315
315
  CheckboxGroupField: {
@@ -342,6 +342,11 @@ export declare type components = {
342
342
  * @default false
343
343
  */
344
344
  isMetaField: boolean;
345
+ /**
346
+ * Static
347
+ * @default false
348
+ */
349
+ static: boolean;
345
350
  /**
346
351
  * Required
347
352
  * @default false
@@ -352,15 +357,8 @@ export declare type components = {
352
357
  * @default false
353
358
  */
354
359
  hidden: boolean;
355
- /**
356
- * Attendeesonly
357
- * @default false
358
- */
359
- attendeesOnly: boolean;
360
360
  /** Value */
361
361
  value?: string[];
362
- /** If */
363
- if?: string;
364
362
  /**
365
363
  * Items
366
364
  * @default []
@@ -403,17 +401,17 @@ export declare type components = {
403
401
  * @description A new checkin was created
404
402
  */
405
403
  CheckinCreatedEvent: {
404
+ /**
405
+ * Id
406
+ * Format: uuid
407
+ */
408
+ id?: string;
406
409
  /**
407
410
  * Event
408
411
  * @default checkin-created
409
412
  * @enum {string}
410
413
  */
411
414
  event: "checkin-created";
412
- /**
413
- * Id
414
- * Format: uuid
415
- */
416
- id: string;
417
415
  /** Instancename */
418
416
  instanceName: string;
419
417
  /** Attendeeid */
@@ -427,17 +425,17 @@ export declare type components = {
427
425
  * @description An existing checkin was deleted
428
426
  */
429
427
  CheckinDeletedEvent: {
428
+ /**
429
+ * Id
430
+ * Format: uuid
431
+ */
432
+ id?: string;
430
433
  /**
431
434
  * Event
432
435
  * @default checkin-deleted
433
436
  * @enum {string}
434
437
  */
435
438
  event: "checkin-deleted";
436
- /**
437
- * Id
438
- * Format: uuid
439
- */
440
- id: string;
441
439
  /** Instancename */
442
440
  instanceName: string;
443
441
  /** Attendeeid */
@@ -507,6 +505,11 @@ export declare type components = {
507
505
  * @default false
508
506
  */
509
507
  isMetaField: boolean;
508
+ /**
509
+ * Static
510
+ * @default false
511
+ */
512
+ static: boolean;
510
513
  /**
511
514
  * Required
512
515
  * @default false
@@ -517,18 +520,11 @@ export declare type components = {
517
520
  * @default false
518
521
  */
519
522
  hidden: boolean;
520
- /**
521
- * Attendeesonly
522
- * @default false
523
- */
524
- attendeesOnly: boolean;
525
523
  /**
526
524
  * Value
527
525
  * Format: date-time
528
526
  */
529
527
  value?: string;
530
- /** If */
531
- if?: string;
532
528
  };
533
529
  /** DropdownField */
534
530
  DropdownField: {
@@ -561,6 +557,11 @@ export declare type components = {
561
557
  * @default false
562
558
  */
563
559
  isMetaField: boolean;
560
+ /**
561
+ * Static
562
+ * @default false
563
+ */
564
+ static: boolean;
564
565
  /**
565
566
  * Required
566
567
  * @default false
@@ -571,15 +572,8 @@ export declare type components = {
571
572
  * @default false
572
573
  */
573
574
  hidden: boolean;
574
- /**
575
- * Attendeesonly
576
- * @default false
577
- */
578
- attendeesOnly: boolean;
579
575
  /** Value */
580
576
  value?: string;
581
- /** If */
582
- if?: string;
583
577
  /**
584
578
  * Items
585
579
  * @default []
@@ -617,6 +611,11 @@ export declare type components = {
617
611
  * @default false
618
612
  */
619
613
  isMetaField: boolean;
614
+ /**
615
+ * Static
616
+ * @default false
617
+ */
618
+ static: boolean;
620
619
  /**
621
620
  * Required
622
621
  * @default false
@@ -627,15 +626,8 @@ export declare type components = {
627
626
  * @default false
628
627
  */
629
628
  hidden: boolean;
630
- /**
631
- * Attendeesonly
632
- * @default false
633
- */
634
- attendeesOnly: boolean;
635
629
  /** Value */
636
630
  value?: string;
637
- /** If */
638
- if?: string;
639
631
  /** Min */
640
632
  min?: number;
641
633
  /** Max */
@@ -696,6 +688,11 @@ export declare type components = {
696
688
  * @default false
697
689
  */
698
690
  isMetaField: boolean;
691
+ /**
692
+ * Static
693
+ * @default false
694
+ */
695
+ static: boolean;
699
696
  /**
700
697
  * Required
701
698
  * @default false
@@ -706,15 +703,8 @@ export declare type components = {
706
703
  * @default false
707
704
  */
708
705
  hidden: boolean;
709
- /**
710
- * Attendeesonly
711
- * @default false
712
- */
713
- attendeesOnly: boolean;
714
706
  /** Value */
715
707
  value?: string;
716
- /** If */
717
- if?: string;
718
708
  /** Min */
719
709
  min?: number;
720
710
  /** Max */
@@ -758,6 +748,11 @@ export declare type components = {
758
748
  * @default false
759
749
  */
760
750
  isMetaField: boolean;
751
+ /**
752
+ * Static
753
+ * @default false
754
+ */
755
+ static: boolean;
761
756
  /**
762
757
  * Required
763
758
  * @default false
@@ -768,15 +763,8 @@ export declare type components = {
768
763
  * @default false
769
764
  */
770
765
  hidden: boolean;
771
- /**
772
- * Attendeesonly
773
- * @default false
774
- */
775
- attendeesOnly: boolean;
776
766
  /** Value */
777
767
  value?: string;
778
- /** If */
779
- if?: string;
780
768
  /** Min */
781
769
  min?: number;
782
770
  /** Max */
@@ -835,6 +823,11 @@ export declare type components = {
835
823
  * @default false
836
824
  */
837
825
  isMetaField: boolean;
826
+ /**
827
+ * Static
828
+ * @default false
829
+ */
830
+ static: boolean;
838
831
  /**
839
832
  * Required
840
833
  * @default false
@@ -845,15 +838,8 @@ export declare type components = {
845
838
  * @default false
846
839
  */
847
840
  hidden: boolean;
848
- /**
849
- * Attendeesonly
850
- * @default false
851
- */
852
- attendeesOnly: boolean;
853
841
  /** Value */
854
842
  value?: string;
855
- /** If */
856
- if?: string;
857
843
  /** Min */
858
844
  min?: number;
859
845
  /** Max */
@@ -867,15 +853,6 @@ export declare type components = {
867
853
  */
868
854
  isCompanion: false;
869
855
  };
870
- /** MetaField */
871
- MetaField: {
872
- /** Type */
873
- type: "list" | "checkbox" | "text" | "textfield";
874
- /** Values */
875
- values?: string[];
876
- /** Default */
877
- default?: string;
878
- };
879
856
  /** NumberField */
880
857
  NumberField: {
881
858
  /**
@@ -907,6 +884,11 @@ export declare type components = {
907
884
  * @default false
908
885
  */
909
886
  isMetaField: boolean;
887
+ /**
888
+ * Static
889
+ * @default false
890
+ */
891
+ static: boolean;
910
892
  /**
911
893
  * Required
912
894
  * @default false
@@ -917,15 +899,8 @@ export declare type components = {
917
899
  * @default false
918
900
  */
919
901
  hidden: boolean;
920
- /**
921
- * Attendeesonly
922
- * @default false
923
- */
924
- attendeesOnly: boolean;
925
902
  /** Value */
926
903
  value?: string;
927
- /** If */
928
- if?: string;
929
904
  /** Min */
930
905
  min?: number;
931
906
  /** Max */
@@ -935,6 +910,8 @@ export declare type components = {
935
910
  Payment: {
936
911
  /** Paid */
937
912
  paid: boolean;
913
+ /** Title */
914
+ title?: string;
938
915
  /**
939
916
  * Provider
940
917
  * @enum {string}
@@ -952,17 +929,17 @@ export declare type components = {
952
929
  * This triggers mails that are atomatically sent on payment
953
930
  */
954
931
  PaymentPaidEvent: {
932
+ /**
933
+ * Id
934
+ * Format: uuid
935
+ */
936
+ id?: string;
955
937
  /**
956
938
  * Event
957
939
  * @default payment-paid
958
940
  * @enum {string}
959
941
  */
960
942
  event: "payment-paid";
961
- /**
962
- * Id
963
- * Format: uuid
964
- */
965
- id: string;
966
943
  /** Attendeeid */
967
944
  attendeeId: string;
968
945
  /** Instancename */
@@ -1035,9 +1012,9 @@ export declare type components = {
1035
1012
  registration: components["schemas"]["RegistrationInfo"];
1036
1013
  /** Guestnamefields */
1037
1014
  guestNameFields: string[];
1038
- /** Metafields */
1039
- metaFields: {
1040
- [key: string]: components["schemas"]["MetaField"];
1015
+ /** Tagcolors */
1016
+ tagColors: {
1017
+ [key: string]: string;
1041
1018
  };
1042
1019
  };
1043
1020
  /**
@@ -1091,6 +1068,11 @@ export declare type components = {
1091
1068
  * @default false
1092
1069
  */
1093
1070
  isMetaField: boolean;
1071
+ /**
1072
+ * Static
1073
+ * @default false
1074
+ */
1075
+ static: boolean;
1094
1076
  /**
1095
1077
  * Required
1096
1078
  * @default false
@@ -1101,15 +1083,8 @@ export declare type components = {
1101
1083
  * @default false
1102
1084
  */
1103
1085
  hidden: boolean;
1104
- /**
1105
- * Attendeesonly
1106
- * @default false
1107
- */
1108
- attendeesOnly: boolean;
1109
1086
  /** Value */
1110
1087
  value?: string;
1111
- /** If */
1112
- if?: string;
1113
1088
  /** Itemval */
1114
1089
  itemval?: string;
1115
1090
  };
@@ -1144,6 +1119,11 @@ export declare type components = {
1144
1119
  * @default false
1145
1120
  */
1146
1121
  isMetaField: boolean;
1122
+ /**
1123
+ * Static
1124
+ * @default false
1125
+ */
1126
+ static: boolean;
1147
1127
  /**
1148
1128
  * Required
1149
1129
  * @default false
@@ -1154,15 +1134,8 @@ export declare type components = {
1154
1134
  * @default false
1155
1135
  */
1156
1136
  hidden: boolean;
1157
- /**
1158
- * Attendeesonly
1159
- * @default false
1160
- */
1161
- attendeesOnly: boolean;
1162
1137
  /** Value */
1163
1138
  value?: string;
1164
- /** If */
1165
- if?: string;
1166
1139
  /**
1167
1140
  * Items
1168
1141
  * @default []
@@ -1228,6 +1201,12 @@ export declare type components = {
1228
1201
  * @default false
1229
1202
  */
1230
1203
  isMetaField: boolean;
1204
+ /**
1205
+ * Static
1206
+ * @default true
1207
+ * @enum {boolean}
1208
+ */
1209
+ static: true;
1231
1210
  /**
1232
1211
  * Required
1233
1212
  * @default false
@@ -1238,15 +1217,8 @@ export declare type components = {
1238
1217
  * @default false
1239
1218
  */
1240
1219
  hidden: boolean;
1241
- /**
1242
- * Attendeesonly
1243
- * @default false
1244
- */
1245
- attendeesOnly: boolean;
1246
1220
  /** Value */
1247
1221
  value?: string;
1248
- /** If */
1249
- if?: string;
1250
1222
  };
1251
1223
  /** TextField */
1252
1224
  TextField: {
@@ -1279,6 +1251,11 @@ export declare type components = {
1279
1251
  * @default false
1280
1252
  */
1281
1253
  isMetaField: boolean;
1254
+ /**
1255
+ * Static
1256
+ * @default false
1257
+ */
1258
+ static: boolean;
1282
1259
  /**
1283
1260
  * Required
1284
1261
  * @default false
@@ -1289,15 +1266,8 @@ export declare type components = {
1289
1266
  * @default false
1290
1267
  */
1291
1268
  hidden: boolean;
1292
- /**
1293
- * Attendeesonly
1294
- * @default false
1295
- */
1296
- attendeesOnly: boolean;
1297
1269
  /** Value */
1298
1270
  value?: string;
1299
- /** If */
1300
- if?: string;
1301
1271
  /** Min */
1302
1272
  min?: number;
1303
1273
  /** Max */
@@ -1364,6 +1334,17 @@ export declare type components = {
1364
1334
  };
1365
1335
  };
1366
1336
  export declare type operations = {
1337
+ /** healthcheck to see if api server is running */
1338
+ healthcheck_health_get: {
1339
+ responses: {
1340
+ /** Successful Response */
1341
+ 200: {
1342
+ content: {
1343
+ "application/json": unknown;
1344
+ };
1345
+ };
1346
+ };
1347
+ };
1367
1348
  login_authenticate_post: {
1368
1349
  responses: {
1369
1350
  /** Successful Response */
@@ -27,7 +27,7 @@ export declare class Attendee {
27
27
  constructor(args: AttendeeJSON | string);
28
28
  toJSON(): AttendeeJSON;
29
29
  getRsvpCountForTag(checkinTag: string): number;
30
- getResponseForTag(checkinTag: string): 'no-response' | 'negative-repsone' | 'positive-response';
30
+ getResponseForTag(checkinTag: string): 'no-response' | 'negative-response' | 'positive-response';
31
31
  getCheckinsForTag(checkinTag: string): Checkins;
32
32
  getCheckinCountForTag(checkinTag: string): number;
33
33
  addCheckinForTag(args: {
@@ -49,7 +49,7 @@ export class Attendee {
49
49
  getResponseForTag(checkinTag) {
50
50
  const rsvp = this.rsvp[checkinTag] ?? null;
51
51
  if (rsvp === null) return 'no-response';
52
- return rsvp > 0 ? 'positive-response' : 'negative-repsone';
52
+ return rsvp > 0 ? 'positive-response' : 'negative-response';
53
53
  }
54
54
 
55
55
  getCheckinsForTag(checkinTag) {
@@ -27,9 +27,11 @@ export declare class Instance {
27
27
  editEnd?: Date;
28
28
  };
29
29
  guestNameFields: string[];
30
+ tagColors: Record<string, string>;
30
31
  constructor(json: InstanceJSON);
31
32
  toJSON(): InstanceJSON;
32
33
  isRegistrationClosed(): boolean;
33
34
  canEditRegistration(): boolean;
34
35
  formatName(guest: Attendee): string;
36
+ getTagColor(tag: string): string;
35
37
  }
@@ -1,3 +1,4 @@
1
+ import { theme } from '../lib';
1
2
  export class Instance {
2
3
  constructor(json) {
3
4
  this.name = json.name;
@@ -14,6 +15,7 @@ export class Instance {
14
15
  editEnd: json.registration.editEnd ? new Date(json.registration.editEnd) : undefined
15
16
  };
16
17
  this.guestNameFields = json.guestNameFields;
18
+ this.tagColors = json.tagColors;
17
19
  }
18
20
 
19
21
  toJSON() {
@@ -32,7 +34,7 @@ export class Instance {
32
34
  editEnd: this.registration.editEnd?.toISOString()
33
35
  },
34
36
  guestNameFields: this.guestNameFields,
35
- metaFields: {}
37
+ tagColors: this.tagColors
36
38
  };
37
39
  }
38
40
 
@@ -69,4 +71,8 @@ export class Instance {
69
71
  return this.guestNameFields.map(fieldKey => guest.userdata[fieldKey] ?? '').join(' ');
70
72
  }
71
73
 
74
+ getTagColor(tag) {
75
+ return this.tagColors[tag] ?? theme.colors.enterMediumGrey;
76
+ }
77
+
72
78
  }
@@ -9,7 +9,7 @@ declare type Props = {
9
9
  rsvpCount: number;
10
10
  } | {
11
11
  checkins: Checkin[];
12
- response: 'negative-repsone' | 'no-response';
12
+ response: 'negative-response' | 'no-response';
13
13
  };
14
14
  export declare const CheckinCountIndicator: FunctionComponent<Props>;
15
15
  export {};
@@ -24,7 +24,7 @@ export const CheckinCountIndicator = props => {
24
24
  });
25
25
  return /*#__PURE__*/React.createElement("div", {
26
26
  className: _JSXStyle.dynamic([["103743971", [fonts.primary, colors.enterDarkGrey, colors.enterGreen, colors.enterGreen, colors.enterError, colors.enterError]]]) + " " + 'checkin-count-indicator'
27
- }, props.response === 'negative-repsone' && !hasCheckins ? /*#__PURE__*/React.createElement("div", {
27
+ }, props.response === 'negative-response' && !hasCheckins ? /*#__PURE__*/React.createElement("div", {
28
28
  className: _JSXStyle.dynamic([["103743971", [fonts.primary, colors.enterDarkGrey, colors.enterGreen, colors.enterGreen, colors.enterError, colors.enterError]]]) + " " + 'box-wrapper'
29
29
  }, /*#__PURE__*/React.createElement("span", {
30
30
  className: _JSXStyle.dynamic([["103743971", [fonts.primary, colors.enterDarkGrey, colors.enterGreen, colors.enterGreen, colors.enterError, colors.enterError]]]) + " " + 'decline-box'
@@ -7,7 +7,7 @@ declare const _default: ComponentMeta<React.FunctionComponent<{
7
7
  rsvpCount: number;
8
8
  } | {
9
9
  checkins: Checkin[];
10
- response: "no-response" | "negative-repsone";
10
+ response: "no-response" | "negative-response";
11
11
  }>>;
12
12
  export default _default;
13
13
  export declare const SingleResponse: ComponentStory<React.FunctionComponent<{
@@ -16,7 +16,7 @@ export declare const SingleResponse: ComponentStory<React.FunctionComponent<{
16
16
  rsvpCount: number;
17
17
  } | {
18
18
  checkins: Checkin[];
19
- response: "no-response" | "negative-repsone";
19
+ response: "no-response" | "negative-response";
20
20
  }>>;
21
21
  export declare const Decline: ComponentStory<React.FunctionComponent<{
22
22
  checkins: Checkin[];
@@ -24,7 +24,7 @@ export declare const Decline: ComponentStory<React.FunctionComponent<{
24
24
  rsvpCount: number;
25
25
  } | {
26
26
  checkins: Checkin[];
27
- response: "no-response" | "negative-repsone";
27
+ response: "no-response" | "negative-response";
28
28
  }>>;
29
29
  export declare const NoResponse: ComponentStory<React.FunctionComponent<{
30
30
  checkins: Checkin[];
@@ -32,7 +32,7 @@ export declare const NoResponse: ComponentStory<React.FunctionComponent<{
32
32
  rsvpCount: number;
33
33
  } | {
34
34
  checkins: Checkin[];
35
- response: "no-response" | "negative-repsone";
35
+ response: "no-response" | "negative-response";
36
36
  }>>;
37
37
  export declare const MultipleResponses: ComponentStory<React.FunctionComponent<{
38
38
  checkins: Checkin[];
@@ -40,7 +40,7 @@ export declare const MultipleResponses: ComponentStory<React.FunctionComponent<{
40
40
  rsvpCount: number;
41
41
  } | {
42
42
  checkins: Checkin[];
43
- response: "no-response" | "negative-repsone";
43
+ response: "no-response" | "negative-response";
44
44
  }>>;
45
45
  export declare const CheckinAndResponse: ComponentStory<React.FunctionComponent<{
46
46
  checkins: Checkin[];
@@ -48,7 +48,7 @@ export declare const CheckinAndResponse: ComponentStory<React.FunctionComponent<
48
48
  rsvpCount: number;
49
49
  } | {
50
50
  checkins: Checkin[];
51
- response: "no-response" | "negative-repsone";
51
+ response: "no-response" | "negative-response";
52
52
  }>>;
53
53
  export declare const MultipleCheckinsAndResponse: ComponentStory<React.FunctionComponent<{
54
54
  checkins: Checkin[];
@@ -56,7 +56,7 @@ export declare const MultipleCheckinsAndResponse: ComponentStory<React.FunctionC
56
56
  rsvpCount: number;
57
57
  } | {
58
58
  checkins: Checkin[];
59
- response: "no-response" | "negative-repsone";
59
+ response: "no-response" | "negative-response";
60
60
  }>>;
61
61
  export declare const CheckinsWithDecline: ComponentStory<React.FunctionComponent<{
62
62
  checkins: Checkin[];
@@ -64,7 +64,7 @@ export declare const CheckinsWithDecline: ComponentStory<React.FunctionComponent
64
64
  rsvpCount: number;
65
65
  } | {
66
66
  checkins: Checkin[];
67
- response: "no-response" | "negative-repsone";
67
+ response: "no-response" | "negative-response";
68
68
  }>>;
69
69
  export declare const CheckinWithoutResponse: ComponentStory<React.FunctionComponent<{
70
70
  checkins: Checkin[];
@@ -72,7 +72,7 @@ export declare const CheckinWithoutResponse: ComponentStory<React.FunctionCompon
72
72
  rsvpCount: number;
73
73
  } | {
74
74
  checkins: Checkin[];
75
- response: "no-response" | "negative-repsone";
75
+ response: "no-response" | "negative-response";
76
76
  }>>;
77
77
  export declare const MultipleCheckins: ComponentStory<React.FunctionComponent<{
78
78
  checkins: Checkin[];
@@ -80,5 +80,5 @@ export declare const MultipleCheckins: ComponentStory<React.FunctionComponent<{
80
80
  rsvpCount: number;
81
81
  } | {
82
82
  checkins: Checkin[];
83
- response: "no-response" | "negative-repsone";
83
+ response: "no-response" | "negative-response";
84
84
  }>>;
@@ -19,7 +19,7 @@ SingleResponse.args = {
19
19
  export const Decline = Template.bind({});
20
20
  Decline.args = {
21
21
  checkins: [],
22
- response: 'negative-repsone'
22
+ response: 'negative-response'
23
23
  };
24
24
  export const NoResponse = Template.bind({});
25
25
  NoResponse.args = {
@@ -47,7 +47,7 @@ MultipleCheckinsAndResponse.args = {
47
47
  export const CheckinsWithDecline = Template.bind({});
48
48
  CheckinsWithDecline.args = {
49
49
  checkins: [exampleCheckin],
50
- response: 'negative-repsone'
50
+ response: 'negative-response'
51
51
  };
52
52
  export const CheckinWithoutResponse = Template.bind({});
53
53
  CheckinWithoutResponse.args = {
@@ -11,3 +11,8 @@ export declare const Basic: ComponentStory<React.FunctionComponent<React.InputHT
11
11
  borderColor?: string | undefined;
12
12
  placeholder?: string | undefined;
13
13
  }>>;
14
+ export declare const WhiteText: ComponentStory<React.FunctionComponent<React.InputHTMLAttributes<HTMLInputElement> & {
15
+ textColor?: string | undefined;
16
+ borderColor?: string | undefined;
17
+ placeholder?: string | undefined;
18
+ }>>;
@@ -13,4 +13,14 @@ Basic.args = {
13
13
  textColor: theme.colors.enterDarkGrey,
14
14
  borderColor: theme.colors.enterMediumGrey,
15
15
  placeholder: 'Search'
16
+ };
17
+ export const WhiteText = Template.bind({});
18
+ WhiteText.parameters = {
19
+ backgrounds: {
20
+ default: 'dark'
21
+ }
22
+ };
23
+ WhiteText.args = {
24
+ textColor: 'white',
25
+ borderColor: 'white'
16
26
  };
@@ -5,10 +5,10 @@ declare type Props = {
5
5
  attendee: Attendee;
6
6
  checkinTag: string;
7
7
  plain?: boolean;
8
- labelColor?: string;
9
8
  infoText?: string;
10
9
  formatName: (attendee: Attendee) => string;
11
10
  filterTags?: (tag: string) => boolean;
11
+ getTagColor?: (tag: string) => string;
12
12
  findMainGuest?: (attendeeId: string) => Attendee | undefined;
13
13
  onClick?: (attendeeId: string) => void;
14
14
  };
@@ -9,21 +9,35 @@ export const GuestCard = props => {
9
9
  const filterTags = props.filterTags ?? (() => true);
10
10
 
11
11
  const tags = (props.attendee.tags || []).filter(filterTags);
12
+
13
+ const getTagColor = props.getTagColor ?? (() => undefined);
14
+
12
15
  const onClick = props.onClick ? () => {
13
16
  if (!props.onClick) return;
14
17
  props.onClick(props.attendee.id);
15
18
  } : undefined;
16
19
  return /*#__PURE__*/React.createElement("div", {
20
+ className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + 'guest-card-wrapper'
21
+ }, /*#__PURE__*/React.createElement("div", {
22
+ className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + 'tag-color-list'
23
+ }, tags.map(tag => [tag, getTagColor(tag)]).filter(([, tagColor]) => tagColor).map(([tag, tagColor]) => /*#__PURE__*/React.createElement("div", {
24
+ key: tag,
25
+ title: tag,
26
+ style: {
27
+ backgroundColor: tagColor,
28
+ height: '100%'
29
+ },
30
+ className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + 'tag-color'
31
+ }))), /*#__PURE__*/React.createElement("div", {
17
32
  onClick: onClick,
18
- className: _JSXStyle.dynamic([["2201546649", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.labelColor, props.labelColor]]]) + " " + (cx({
33
+ className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + (cx({
19
34
  'guest-card': true,
20
- plain: props.plain,
21
- labeled: props.labelColor !== undefined
35
+ plain: props.plain
22
36
  }) || "")
23
37
  }, /*#__PURE__*/React.createElement("div", {
24
- className: _JSXStyle.dynamic([["2201546649", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.labelColor, props.labelColor]]])
38
+ className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]])
25
39
  }, /*#__PURE__*/React.createElement("h2", {
26
- className: _JSXStyle.dynamic([["2201546649", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.labelColor, props.labelColor]]]) + " " + 'name'
40
+ className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + 'name'
27
41
  }, props.formatName(props.attendee)), /*#__PURE__*/React.createElement(CompanionInfo, {
28
42
  companionStatus: props.attendee.companions,
29
43
  findMainGuest: props.findMainGuest,
@@ -33,13 +47,13 @@ export const GuestCard = props => {
33
47
  response: props.attendee.getResponseForTag(props.checkinTag),
34
48
  rsvpCount: props.attendee.getRsvpCountForTag(props.checkinTag)
35
49
  })), /*#__PURE__*/React.createElement("div", {
36
- className: _JSXStyle.dynamic([["2201546649", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.labelColor, props.labelColor]]]) + " " + 'tag-list'
50
+ className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + 'tag-list'
37
51
  }, tags.map(tag => /*#__PURE__*/React.createElement(Tag, {
38
52
  key: tag
39
53
  }, tag)), props.infoText && /*#__PURE__*/React.createElement("div", {
40
- className: _JSXStyle.dynamic([["2201546649", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.labelColor, props.labelColor]]]) + " " + 'info'
41
- }, " ", props.infoText)), /*#__PURE__*/React.createElement(_JSXStyle, {
42
- id: "2201546649",
43
- dynamic: [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.labelColor, props.labelColor]
44
- }, `.guest-card.__jsx-style-dynamic-selector{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:start;-webkit-box-align:start;-ms-flex-align:start;align-items:start;border-radius:2px;border:1px solid ${theme.colors.enterGrey};background-color:${theme.colors.enterBackground};font-family:${theme.fonts.primary};padding:1.1em 1em 0.9em;margin:1.5em 0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.plain.__jsx-style-dynamic-selector{border:none;background-color:transparent;}.labeled.__jsx-style-dynamic-selector::before{content:'';position:absolute;top:-1px;right:-1px;width:3px;height:100%;background-color:${props.labelColor};border:1px solid ${props.labelColor};border-radius:0 2px 2px 0;}.name.__jsx-style-dynamic-selector{font-size:1.15em;margin:-0.1em 0 0.3em;}.tag-list.__jsx-style-dynamic-selector{max-width:40%;text-align:right;}.info.__jsx-style-dynamic-selector{display:block;width:100%;text-align:right;}`));
54
+ className: _JSXStyle.dynamic([["4235458019", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]]]) + " " + 'info'
55
+ }, " ", props.infoText))), /*#__PURE__*/React.createElement(_JSXStyle, {
56
+ id: "4235458019",
57
+ dynamic: [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]
58
+ }, `.guest-card-wrapper.__jsx-style-dynamic-selector{border-radius:2px;border:1px solid ${theme.colors.enterGrey};background-color:${theme.colors.enterBackground};font-family:${theme.fonts.primary};margin:1.5em 0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.guest-card.__jsx-style-dynamic-selector{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:start;-webkit-box-align:start;-ms-flex-align:start;align-items:start;padding:1.1em 1em 0.9em;-webkit-flex:1;-ms-flex:1;flex:1;}.tag-color-list.__jsx-style-dynamic-selector{width:0.5em;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.tag-color.__jsx-style-dynamic-selector:first-child{border-top-left-radius:1px;}.tag-color.__jsx-style-dynamic-selector:last-child{border-bottom-left-radius:1px;}.plain.__jsx-style-dynamic-selector{border:none;background-color:transparent;}.name.__jsx-style-dynamic-selector{font-size:1.15em;margin:-0.1em 0 0.3em;}.tag-list.__jsx-style-dynamic-selector{max-width:40%;text-align:right;font-size:0.9em;}.info.__jsx-style-dynamic-selector{display:block;width:100%;text-align:right;}`));
45
59
  };
@@ -5,10 +5,10 @@ declare const _default: ComponentMeta<React.FunctionComponent<{
5
5
  attendee: Attendee;
6
6
  checkinTag: string;
7
7
  plain?: boolean | undefined;
8
- labelColor?: string | undefined;
9
8
  infoText?: string | undefined;
10
9
  formatName: (attendee: Attendee) => string;
11
10
  filterTags?: ((tag: string) => boolean) | undefined;
11
+ getTagColor?: ((tag: string) => string) | undefined;
12
12
  findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
13
13
  onClick?: ((attendeeId: string) => void) | undefined;
14
14
  }>>;
@@ -17,10 +17,10 @@ export declare const WithBackground: ComponentStory<React.FunctionComponent<{
17
17
  attendee: Attendee;
18
18
  checkinTag: string;
19
19
  plain?: boolean | undefined;
20
- labelColor?: string | undefined;
21
20
  infoText?: string | undefined;
22
21
  formatName: (attendee: Attendee) => string;
23
22
  filterTags?: ((tag: string) => boolean) | undefined;
23
+ getTagColor?: ((tag: string) => string) | undefined;
24
24
  findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
25
25
  onClick?: ((attendeeId: string) => void) | undefined;
26
26
  }>>;
@@ -28,10 +28,10 @@ export declare const Plain: ComponentStory<React.FunctionComponent<{
28
28
  attendee: Attendee;
29
29
  checkinTag: string;
30
30
  plain?: boolean | undefined;
31
- labelColor?: string | undefined;
32
31
  infoText?: string | undefined;
33
32
  formatName: (attendee: Attendee) => string;
34
33
  filterTags?: ((tag: string) => boolean) | undefined;
34
+ getTagColor?: ((tag: string) => string) | undefined;
35
35
  findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
36
36
  onClick?: ((attendeeId: string) => void) | undefined;
37
37
  }>>;
@@ -39,10 +39,10 @@ export declare const FilteredTags: ComponentStory<React.FunctionComponent<{
39
39
  attendee: Attendee;
40
40
  checkinTag: string;
41
41
  plain?: boolean | undefined;
42
- labelColor?: string | undefined;
43
42
  infoText?: string | undefined;
44
43
  formatName: (attendee: Attendee) => string;
45
44
  filterTags?: ((tag: string) => boolean) | undefined;
45
+ getTagColor?: ((tag: string) => string) | undefined;
46
46
  findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
47
47
  onClick?: ((attendeeId: string) => void) | undefined;
48
48
  }>>;
@@ -50,10 +50,21 @@ export declare const WithColorLabel: ComponentStory<React.FunctionComponent<{
50
50
  attendee: Attendee;
51
51
  checkinTag: string;
52
52
  plain?: boolean | undefined;
53
- labelColor?: string | undefined;
54
53
  infoText?: string | undefined;
55
54
  formatName: (attendee: Attendee) => string;
56
55
  filterTags?: ((tag: string) => boolean) | undefined;
56
+ getTagColor?: ((tag: string) => string) | undefined;
57
+ findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
58
+ onClick?: ((attendeeId: string) => void) | undefined;
59
+ }>>;
60
+ export declare const WithMultipleColorLabels: ComponentStory<React.FunctionComponent<{
61
+ attendee: Attendee;
62
+ checkinTag: string;
63
+ plain?: boolean | undefined;
64
+ infoText?: string | undefined;
65
+ formatName: (attendee: Attendee) => string;
66
+ filterTags?: ((tag: string) => boolean) | undefined;
67
+ getTagColor?: ((tag: string) => string) | undefined;
57
68
  findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
58
69
  onClick?: ((attendeeId: string) => void) | undefined;
59
70
  }>>;
@@ -61,10 +72,10 @@ export declare const WithInfoText: ComponentStory<React.FunctionComponent<{
61
72
  attendee: Attendee;
62
73
  checkinTag: string;
63
74
  plain?: boolean | undefined;
64
- labelColor?: string | undefined;
65
75
  infoText?: string | undefined;
66
76
  formatName: (attendee: Attendee) => string;
67
77
  filterTags?: ((tag: string) => boolean) | undefined;
78
+ getTagColor?: ((tag: string) => string) | undefined;
68
79
  findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
69
80
  onClick?: ((attendeeId: string) => void) | undefined;
70
81
  }>>;
@@ -72,10 +83,10 @@ export declare const WithCompanion: ComponentStory<React.FunctionComponent<{
72
83
  attendee: Attendee;
73
84
  checkinTag: string;
74
85
  plain?: boolean | undefined;
75
- labelColor?: string | undefined;
76
86
  infoText?: string | undefined;
77
87
  formatName: (attendee: Attendee) => string;
78
88
  filterTags?: ((tag: string) => boolean) | undefined;
89
+ getTagColor?: ((tag: string) => string) | undefined;
79
90
  findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
80
91
  onClick?: ((attendeeId: string) => void) | undefined;
81
92
  }>>;
@@ -83,10 +94,10 @@ export declare const WithCompanionButNoMainGuestInfo: ComponentStory<React.Funct
83
94
  attendee: Attendee;
84
95
  checkinTag: string;
85
96
  plain?: boolean | undefined;
86
- labelColor?: string | undefined;
87
97
  infoText?: string | undefined;
88
98
  formatName: (attendee: Attendee) => string;
89
99
  filterTags?: ((tag: string) => boolean) | undefined;
100
+ getTagColor?: ((tag: string) => string) | undefined;
90
101
  findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
91
102
  onClick?: ((attendeeId: string) => void) | undefined;
92
103
  }>>;
@@ -28,10 +28,27 @@ const attendee = new Attendee({
28
28
  },
29
29
  deleted: false
30
30
  });
31
+ const attendeeWithMultipleTags = new Attendee({
32
+ id: 'my-attendee-2',
33
+ language: 'de',
34
+ tags: ['VIP', 'tester', 'Import-200-02-10'],
35
+ time: new Date('2022-01-01').toISOString(),
36
+ rsvp: {
37
+ default: 1
38
+ },
39
+ checkin: {},
40
+ companions: {
41
+ isCompanion: false
42
+ },
43
+ userdata: {
44
+ name: 'Max Mustermann'
45
+ },
46
+ deleted: false
47
+ });
31
48
  const companion = new Attendee({
32
49
  id: 'my-companion',
33
50
  language: 'de',
34
- tags: ['VIP', 'Import-200-02-10'],
51
+ tags: ['VIP'],
35
52
  time: new Date('2022-01-01').toISOString(),
36
53
  rsvp: {
37
54
  default: 1
@@ -42,10 +59,14 @@ const companion = new Attendee({
42
59
  mainGuestId: 'my-attendee'
43
60
  },
44
61
  userdata: {
45
- name: 'Jhon Doe'
62
+ name: 'John Doe'
46
63
  },
47
64
  deleted: false
48
65
  });
66
+ const tagColors = {
67
+ VIP: theme.colors.enterPink,
68
+ tester: theme.colors.enterCyan
69
+ };
49
70
 
50
71
  const Template = args => /*#__PURE__*/React.createElement(GuestCard, args);
51
72
 
@@ -89,10 +110,27 @@ export const WithColorLabel = Template.bind({});
89
110
  WithColorLabel.args = {
90
111
  attendee: attendee,
91
112
  checkinTag: 'default',
92
- labelColor: theme.colors.enterPink,
93
113
 
94
114
  formatName(attendee) {
95
115
  return attendee.userdata.name?.toString() ?? '';
116
+ },
117
+
118
+ getTagColor(tag) {
119
+ return tagColors[tag] ?? null;
120
+ }
121
+
122
+ };
123
+ export const WithMultipleColorLabels = Template.bind({});
124
+ WithMultipleColorLabels.args = {
125
+ attendee: attendeeWithMultipleTags,
126
+ checkinTag: 'default',
127
+
128
+ formatName(attendee) {
129
+ return attendee.userdata.name?.toString() ?? '';
130
+ },
131
+
132
+ getTagColor(tag) {
133
+ return tagColors[tag] ?? null;
96
134
  }
97
135
 
98
136
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-crew-berlin/enter-js-utils",
3
- "version": "0.32.1",
3
+ "version": "0.34.0",
4
4
  "description": "utils such as vaildation and other helpers to work with data from the enter app",
5
5
  "files": [
6
6
  "dist",