@dev-crew-berlin/enter-js-utils 0.95.1 → 0.95.2

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.
@@ -768,6 +768,16 @@ export type components = {
768
768
  */
769
769
  items: components["schemas"]["ItemOption"][];
770
770
  };
771
+ /**
772
+ * DynamicTag
773
+ * @description A tag with color and optional filter
774
+ */
775
+ DynamicTag: {
776
+ /** Color */
777
+ color: string;
778
+ /** @default {} */
779
+ filter?: components["schemas"]["Filter"];
780
+ };
771
781
  /** EmailField */
772
782
  EmailField: {
773
783
  /**
@@ -1007,6 +1017,11 @@ export type components = {
1007
1017
  /** Ext */
1008
1018
  ext: string[] | null;
1009
1019
  };
1020
+ /** Filter */
1021
+ Filter: {
1022
+ /** Query */
1023
+ query: string | null;
1024
+ };
1010
1025
  /** FrontendConfigJSON */
1011
1026
  FrontendConfigJSON: {
1012
1027
  /** Domain */
@@ -1412,6 +1427,8 @@ export type components = {
1412
1427
  * @default false
1413
1428
  */
1414
1429
  deleted: boolean;
1430
+ /** Name */
1431
+ name: string;
1415
1432
  };
1416
1433
  /** PublicEmail */
1417
1434
  PublicEmail: {
@@ -1436,10 +1453,17 @@ export type components = {
1436
1453
  registration: components["schemas"]["PublicRegistrationInfo"];
1437
1454
  /** Guestnamefields */
1438
1455
  guestNameFields: string[];
1439
- /** Tagcolors */
1456
+ /**
1457
+ * Tagcolors
1458
+ * @deprecated
1459
+ */
1440
1460
  tagColors: {
1441
1461
  [key: string]: string;
1442
1462
  };
1463
+ /** Dynamictags */
1464
+ dynamicTags: {
1465
+ [key: string]: components["schemas"]["DynamicTag"];
1466
+ };
1443
1467
  /** Branches */
1444
1468
  branches: {
1445
1469
  [key: string]: components["schemas"]["Branch"];
@@ -11,6 +11,7 @@ export type AttendeeJSON = Omit<components['schemas']['PublicAttendee-Output'],
11
11
  };
12
12
  export declare class Attendee {
13
13
  id: string;
14
+ readonly name: string | undefined;
14
15
  userdata: Map<string, FieldValue>;
15
16
  tags: Set<string>;
16
17
  language: string | null;
@@ -20,17 +21,17 @@ export declare class Attendee {
20
21
  checkin: Map<string, Checkins>;
21
22
  companions: {
22
23
  isCompanion: false;
23
- companionNames?: {
24
+ readonly companionNames?: {
24
25
  [attendeeId: string]: string;
25
26
  };
26
27
  } | {
27
28
  isCompanion: true;
28
29
  mainGuestId: string;
29
- mainGuestName: string;
30
+ readonly mainGuestName: string;
30
31
  };
31
32
  payment: Payment | null;
32
33
  deleted: boolean;
33
- constructor(args: AttendeeJSONInput | string);
34
+ constructor(args: AttendeeJSONInput | AttendeeJSON | string);
34
35
  /**
35
36
  * creates a bse36 encoded uuid
36
37
  * we use base36 encoding because it is more human readable and also shorter
@@ -23,6 +23,7 @@ export class Attendee {
23
23
  }
24
24
  const json = args;
25
25
  this.id = json.id;
26
+ this.name = 'name' in json ? json.name : undefined;
26
27
  this.userdata = new Map(Object.entries(json.userdata ?? {}));
27
28
  this.tags = new Set(json.tags);
28
29
  this.language = json.language;
@@ -67,6 +68,7 @@ export class Attendee {
67
68
  const rsvp = Object.fromEntries(Array.from(this.rsvp).map(([checkinTag, rsvp]) => [checkinTag, rsvp ? rsvp.toJSON() : null]));
68
69
  return {
69
70
  ...this,
71
+ name: this.name ?? '',
70
72
  time: this.time?.toISOString(),
71
73
  branches: Array.from(this.branches),
72
74
  tags: Array.from(this.tags),
@@ -0,0 +1,2 @@
1
+ import { components } from '../generated/api-schema';
2
+ export type DynamicTag = components['schemas']['DynamicTag'];
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { components } from '../generated/api-schema';
2
2
  import { Attendee } from './attendee';
3
3
  import { Branch } from './branch';
4
+ import { DynamicTag } from './dynamic-tag';
4
5
  export type InstanceJSON = components['schemas']['PublicInstance'];
5
6
  export declare class Instance {
6
7
  name: string;
@@ -20,7 +21,7 @@ export declare class Instance {
20
21
  allowRegistrationWithAuthCode: boolean;
21
22
  };
22
23
  guestNameFields: string[];
23
- tagColors: Record<string, string>;
24
+ dynamicTags: Map<string, DynamicTag>;
24
25
  constructor(json: InstanceJSON);
25
26
  toJSON(): InstanceJSON;
26
27
  isRegistrationClosed(): boolean;
@@ -16,11 +16,13 @@ export class Instance {
16
16
  allowRegistrationWithAuthCode: json.registration.allowRegistrationWithAuthCode
17
17
  };
18
18
  this.guestNameFields = json.guestNameFields;
19
- this.tagColors = json.tagColors;
19
+ this.dynamicTags = new Map(Object.entries(json.dynamicTags));
20
20
  }
21
21
  toJSON() {
22
22
  // convert each branch to its json representation
23
23
  const branches = Object.fromEntries(Array.from(this.branches).map(([branchName, branch]) => [branchName, branch.toJSON()]));
24
+ const dynamicTags = Object.fromEntries(this.dynamicTags);
25
+ const tagColors = Object.fromEntries(Array.from(this.dynamicTags).map(([tag, dynamicTag]) => [tag, dynamicTag.color]));
24
26
  return {
25
27
  name: this.name,
26
28
  title: this.title,
@@ -37,7 +39,8 @@ export class Instance {
37
39
  allowRegistrationWithAuthCode: this.registration.allowRegistrationWithAuthCode
38
40
  },
39
41
  guestNameFields: this.guestNameFields,
40
- tagColors: this.tagColors
42
+ tagColors: tagColors,
43
+ dynamicTags: dynamicTags
41
44
  };
42
45
  }
43
46
  isRegistrationClosed() {
@@ -70,6 +73,6 @@ export class Instance {
70
73
  return this.guestNameFields.map(fieldKey => guest.userdata.get(fieldKey) ?? '').join(' ');
71
74
  }
72
75
  getTagColor(tag) {
73
- return this.tagColors[tag] ?? undefined;
76
+ return this.dynamicTags.get(tag)?.color;
74
77
  }
75
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-crew-berlin/enter-js-utils",
3
- "version": "0.95.1",
3
+ "version": "0.95.2",
4
4
  "description": "utils such as vaildation and other helpers to work with data from the enter app",
5
5
  "files": [
6
6
  "dist",