@dev-crew-berlin/enter-js-utils 0.35.1 → 0.36.1
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.
- package/dist/models/attendee.d.ts +8 -0
- package/dist/models/attendee.js +15 -0
- package/package.json +4 -3
|
@@ -25,6 +25,14 @@ export declare class Attendee {
|
|
|
25
25
|
};
|
|
26
26
|
deleted: boolean;
|
|
27
27
|
constructor(args: AttendeeJSON | string);
|
|
28
|
+
/**
|
|
29
|
+
* creates a bse36 encoded uuid
|
|
30
|
+
* we use base36 encoding because it is more human readable and also shorter
|
|
31
|
+
* so it fits better into an QR-Code
|
|
32
|
+
* @param prefix A prefix - ussually the 1st 3 letters of the instance name are used
|
|
33
|
+
* @returns base36 encoded uuid string
|
|
34
|
+
*/
|
|
35
|
+
static generateID(prefix: string): string;
|
|
28
36
|
toJSON(): AttendeeJSON;
|
|
29
37
|
getRsvpCountForTag(checkinTag: string): number;
|
|
30
38
|
getResponseForTag(checkinTag: string): 'no-response' | 'negative-response' | 'positive-response';
|
package/dist/models/attendee.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
1
2
|
import { Checkins } from './checkins';
|
|
2
3
|
export class Attendee {
|
|
3
4
|
userdata = {};
|
|
@@ -25,6 +26,20 @@ export class Attendee {
|
|
|
25
26
|
this.payment = json.payment;
|
|
26
27
|
this.deleted = json.deleted;
|
|
27
28
|
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* creates a bse36 encoded uuid
|
|
32
|
+
* we use base36 encoding because it is more human readable and also shorter
|
|
33
|
+
* so it fits better into an QR-Code
|
|
34
|
+
* @param prefix A prefix - ussually the 1st 3 letters of the instance name are used
|
|
35
|
+
* @returns base36 encoded uuid string
|
|
36
|
+
*/
|
|
37
|
+
static generateID(prefix) {
|
|
38
|
+
const uuid = uuidv4();
|
|
39
|
+
const guid = BigInt(`0x${uuid.replaceAll('-', '')}`);
|
|
40
|
+
const encoded = guid.toString(36).toUpperCase();
|
|
41
|
+
return `${prefix}-${encoded}`;
|
|
42
|
+
}
|
|
28
43
|
toJSON() {
|
|
29
44
|
// this is exactly what js also provides out of the box
|
|
30
45
|
// but then typescript complains that there is no toJSON function
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev-crew-berlin/enter-js-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.1",
|
|
4
4
|
"description": "utils such as vaildation and other helpers to work with data from the enter app",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@storybook/react": "^6.5.15",
|
|
54
54
|
"@storybook/testing-library": "^0.0.13",
|
|
55
55
|
"@types/node": "^17.0.38",
|
|
56
|
+
"@types/uuid": "^8.3.4",
|
|
56
57
|
"@types/react": "^18.0.10",
|
|
57
58
|
"@types/react-dom": "^18.0.5",
|
|
58
59
|
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
@@ -70,8 +71,8 @@
|
|
|
70
71
|
"react-dom": "^18.1.0"
|
|
71
72
|
},
|
|
72
73
|
"dependencies": {
|
|
73
|
-
"fefe": "^3.2.0",
|
|
74
74
|
"fp-ts": "^2.12.1",
|
|
75
|
-
"styled-jsx": "^5.0.2"
|
|
75
|
+
"styled-jsx": "^5.0.2",
|
|
76
|
+
"uuid": "^9.0.0"
|
|
76
77
|
}
|
|
77
78
|
}
|