@dev-crew-berlin/enter-js-utils 0.82.0 → 0.83.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,7 @@ import { Checkin } from './checkin';
3
3
  import { Checkins } from './checkins';
4
4
  import { FieldValue } from './field-value';
5
5
  import { Rsvp } from './rsvp';
6
+ import { AttendeeUpdatedEvent } from './event';
6
7
  export type AttendeeJSON = components['schemas']['PublicAttendee-Output'];
7
8
  type AttendeeJSONInput = components['schemas']['PublicAttendee-Input'];
8
9
  export declare class Attendee {
@@ -51,6 +52,7 @@ export declare class Attendee {
51
52
  branchName: string;
52
53
  checkinId: string;
53
54
  }): Attendee;
55
+ withUpdates(updates: AttendeeUpdatedEvent['updates']): Attendee;
54
56
  getFieldValueString(fieldKey: string): string;
55
57
  }
56
58
  export {};
@@ -124,6 +124,41 @@ export class Attendee {
124
124
  newAttendee.checkin.set(args.branchName, mergedCheckins);
125
125
  return newAttendee;
126
126
  }
127
+ withUpdates(updates) {
128
+ const newAttendee = new Attendee(this.toJSON());
129
+ if (updates.userdata) {
130
+ newAttendee.userdata = new Map([...this.userdata, ...Object.entries(updates.userdata)]);
131
+ }
132
+ if (updates.rsvp) {
133
+ const rsvpUpdates = Object.entries(updates.rsvp).map(([branchName, rsvpJSON]) => [branchName, rsvpJSON ? new Rsvp(rsvpJSON) : null]);
134
+ newAttendee.rsvp = new Map([...this.rsvp, ...rsvpUpdates]);
135
+ }
136
+ if (updates.tags) {
137
+ newAttendee.tags = this.tags.union(new Set(updates.tags));
138
+ }
139
+ if (updates.deletedTags) {
140
+ newAttendee.tags = newAttendee.tags.difference(new Set(updates.deletedTags));
141
+ }
142
+ if (updates.branches) {
143
+ newAttendee.branches = this.branches.union(new Set(updates.branches));
144
+ }
145
+ if (updates.deletedBranches) {
146
+ newAttendee.branches = newAttendee.branches.difference(new Set(updates.deletedBranches));
147
+ }
148
+ if (updates.companions) {
149
+ // TODO: updates.companions type is wrong
150
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
151
+ // @ts-ignore
152
+ newAttendee.companions = updates.companions;
153
+ }
154
+ if (updates.language) {
155
+ newAttendee.language = updates.language;
156
+ }
157
+ if (updates.payment) {
158
+ newAttendee.payment = updates.payment;
159
+ }
160
+ return newAttendee;
161
+ }
127
162
  getFieldValueString(fieldKey) {
128
163
  const fieldValue = this.userdata.get(fieldKey);
129
164
  return fieldValue?.toString() ?? '';
@@ -12,7 +12,7 @@ export const CaretIcon = ({
12
12
  fill: color
13
13
  }, /*#__PURE__*/React.createElement("g", {
14
14
  transform: `rotate(${rotateDeg})`,
15
- "transform-origin": "center"
15
+ transformOrigin: 'center'
16
16
  }, /*#__PURE__*/React.createElement("path", {
17
17
  color: color,
18
18
  fillRule: "evenodd",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-crew-berlin/enter-js-utils",
3
- "version": "0.82.0",
3
+ "version": "0.83.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",
@@ -67,7 +67,7 @@
67
67
  "prettier": "^2.6.2",
68
68
  "react": "^18.3.1",
69
69
  "react-dom": "^18.3.1",
70
- "typescript": "^5.7.2"
70
+ "typescript": "^5.7.3"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "react": "^18.1.0",