@dev-crew-berlin/enter-js-utils 0.81.0 → 0.82.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.
- package/dist/lib/tokens.d.ts +6 -0
- package/dist/lib/tokens.js +14 -0
- package/dist/models/attendee.js +2 -2
- package/dist/models/instance.js +1 -1
- package/package.json +2 -2
package/dist/lib/tokens.d.ts
CHANGED
|
@@ -18,6 +18,12 @@ export type RegistrationToken = {
|
|
|
18
18
|
isExpired: boolean;
|
|
19
19
|
};
|
|
20
20
|
export declare function parseRegistrationToken(tokenString: string | undefined, options: TokenOptions): Result<TokenValidationError, RegistrationToken>;
|
|
21
|
+
export declare function parseTrackingToken(tokenString: string | undefined, options: TokenOptions): Result<TokenValidationError, {
|
|
22
|
+
attendeeId: string;
|
|
23
|
+
emailName: string;
|
|
24
|
+
target: string;
|
|
25
|
+
mailingId: string;
|
|
26
|
+
}>;
|
|
21
27
|
export declare function parseUnsubscribeToken(tokenString: string | undefined, options: TokenOptions): Result<TokenValidationError, {
|
|
22
28
|
emailAddress: string;
|
|
23
29
|
attendeeId: string;
|
package/dist/lib/tokens.js
CHANGED
|
@@ -27,6 +27,20 @@ export function parseRegistrationToken(tokenString, options) {
|
|
|
27
27
|
isExpired
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
export function parseTrackingToken(tokenString, options) {
|
|
31
|
+
const tokenResult = parseJWS(tokenString, options);
|
|
32
|
+
if (!tokenResult.success) return tokenResult;
|
|
33
|
+
const payload = tokenResult.data.payload;
|
|
34
|
+
if (payload.instance_name !== options.instanceName || typeof payload.target !== 'string' || typeof payload.attendee_id !== 'string' || typeof payload.mailing_id !== 'string' || typeof payload.email_name !== 'string') {
|
|
35
|
+
return failure('token_invalid');
|
|
36
|
+
}
|
|
37
|
+
return success({
|
|
38
|
+
attendeeId: payload.attendee_id,
|
|
39
|
+
emailName: payload.email_name,
|
|
40
|
+
target: payload.target,
|
|
41
|
+
mailingId: payload.mailing_id
|
|
42
|
+
});
|
|
43
|
+
}
|
|
30
44
|
export function parseUnsubscribeToken(tokenString, options) {
|
|
31
45
|
const tokenResult = parseJWS(tokenString, options);
|
|
32
46
|
if (!tokenResult.success) return tokenResult;
|
package/dist/models/attendee.js
CHANGED
|
@@ -57,10 +57,10 @@ export class Attendee {
|
|
|
57
57
|
// so we implement it here again by hand
|
|
58
58
|
|
|
59
59
|
// convert each checkin to its json representation
|
|
60
|
-
const checkin = Object.fromEntries(this.checkin
|
|
60
|
+
const checkin = Object.fromEntries(Array.from(this.checkin).map(([checkinTag, checkin]) => [checkinTag, checkin.toJSON()]));
|
|
61
61
|
|
|
62
62
|
// convert each rsvp to its json representation
|
|
63
|
-
const rsvp = Object.fromEntries(this.rsvp
|
|
63
|
+
const rsvp = Object.fromEntries(Array.from(this.rsvp).map(([checkinTag, rsvp]) => [checkinTag, rsvp ? rsvp.toJSON() : null]));
|
|
64
64
|
return {
|
|
65
65
|
...this,
|
|
66
66
|
time: this.time?.toISOString(),
|
package/dist/models/instance.js
CHANGED
|
@@ -20,7 +20,7 @@ export class Instance {
|
|
|
20
20
|
}
|
|
21
21
|
toJSON() {
|
|
22
22
|
// convert each branch to its json representation
|
|
23
|
-
const branches = Object.fromEntries(this.branches
|
|
23
|
+
const branches = Object.fromEntries(Array.from(this.branches).map(([branchName, branch]) => [branchName, branch.toJSON()]));
|
|
24
24
|
return {
|
|
25
25
|
name: this.name,
|
|
26
26
|
title: this.title,
|
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.82.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.
|
|
70
|
+
"typescript": "^5.7.2"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"react": "^18.1.0",
|