@dev-crew-berlin/enter-js-utils 0.83.0 → 0.84.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.
@@ -53,6 +53,14 @@ export declare class Attendee {
53
53
  checkinId: string;
54
54
  }): Attendee;
55
55
  withUpdates(updates: AttendeeUpdatedEvent['updates']): Attendee;
56
+ getFieldString(fieldKey: string): string;
57
+ /**
58
+ * @deprecated Use `getFieldString` instead
59
+ */
56
60
  getFieldValueString(fieldKey: string): string;
61
+ getFieldNumber(fieldKey: string): number | undefined;
62
+ getFieldNumber(fieldKey: string, fallback: number): number;
63
+ getFieldFlag(fieldKey: string): boolean | undefined;
64
+ getFieldFlag(fieldKey: string, fallback: boolean): boolean;
57
65
  }
58
66
  export {};
@@ -159,8 +159,33 @@ export class Attendee {
159
159
  }
160
160
  return newAttendee;
161
161
  }
162
- getFieldValueString(fieldKey) {
162
+ getFieldString(fieldKey) {
163
163
  const fieldValue = this.userdata.get(fieldKey);
164
164
  return fieldValue?.toString() ?? '';
165
165
  }
166
+
167
+ /**
168
+ * @deprecated Use `getFieldString` instead
169
+ */
170
+ getFieldValueString(fieldKey) {
171
+ return this.getFieldString(fieldKey);
172
+ }
173
+ getFieldNumber(fieldKey, fallback) {
174
+ const fieldValue = this.userdata.get(fieldKey);
175
+ switch (typeof fieldValue) {
176
+ case 'number':
177
+ return fieldValue;
178
+ case 'string':
179
+ // eslint-disable-next-line no-case-declarations
180
+ const parsed = parseFloat(fieldValue);
181
+ return Number.isNaN(parsed) ? fallback : parsed;
182
+ default:
183
+ return fallback;
184
+ }
185
+ }
186
+ getFieldFlag(fieldKey, fallback) {
187
+ const fieldValue = this.userdata.get(fieldKey);
188
+ if (typeof fieldValue === 'boolean') return fieldValue;
189
+ return fallback;
190
+ }
166
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-crew-berlin/enter-js-utils",
3
- "version": "0.83.0",
3
+ "version": "0.84.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",