@dev-crew-berlin/enter-js-utils 0.89.0 → 0.90.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 +1 -0
- package/dist/lib/tokens.js +3 -2
- package/package.json +1 -1
package/dist/lib/tokens.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare function parseUnsubscribeToken(tokenString: string | undefined, o
|
|
|
33
33
|
export declare function parseEmailHtmlToken(tokenString: string | undefined, options: TokenOptions): Result<TokenValidationError, {
|
|
34
34
|
attendeeId: string;
|
|
35
35
|
emailName: string;
|
|
36
|
+
mailingId: string | null;
|
|
36
37
|
}>;
|
|
37
38
|
export declare function readRegistrationToken(getCookie: CookieGetter, options: TokenOptions & RegistrationTokenOptions): Result<TokenValidationError, RegistrationToken>;
|
|
38
39
|
export declare function storeRegistrationToken(token: string, setCookie: CookieSetter, options?: RegistrationTokenOptions): void;
|
package/dist/lib/tokens.js
CHANGED
|
@@ -58,7 +58,7 @@ export function parseEmailHtmlToken(tokenString, options) {
|
|
|
58
58
|
const tokenResult = parseJWS(tokenString, options);
|
|
59
59
|
if (!tokenResult.success) return tokenResult;
|
|
60
60
|
const payload = tokenResult.data.payload;
|
|
61
|
-
if (payload.instance_name !== options.instanceName || typeof payload.attendee_id !== 'string' || typeof payload.email_name !== 'string' || typeof payload.exp !== 'number') {
|
|
61
|
+
if (payload.instance_name !== options.instanceName || typeof payload.attendee_id !== 'string' || typeof payload.email_name !== 'string' || payload.mailing_id != undefined && typeof payload.mailing_id !== 'string' || typeof payload.exp !== 'number') {
|
|
62
62
|
return failure('token_invalid');
|
|
63
63
|
}
|
|
64
64
|
const now = new Date();
|
|
@@ -67,7 +67,8 @@ export function parseEmailHtmlToken(tokenString, options) {
|
|
|
67
67
|
if (isExpired) return failure('token_expired');
|
|
68
68
|
return success({
|
|
69
69
|
attendeeId: payload.attendee_id,
|
|
70
|
-
emailName: payload.email_name
|
|
70
|
+
emailName: payload.email_name,
|
|
71
|
+
mailingId: payload.mailing_id ?? null
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
export function readRegistrationToken(getCookie, options) {
|