From deb60b835de0730e6fb695d034c4b6e2c4f9d6d6 Mon Sep 17 00:00:00 2001 From: Carlos Date: Wed, 6 Mar 2024 08:22:03 -0500 Subject: [PATCH] add superfluid tokens email --- src/services/notificationService.ts | 8 ++++++++ src/types/notifications.ts | 2 ++ src/utils/validators/segmentAndMetadataValidators.ts | 11 +++++++++++ 3 files changed, 21 insertions(+) diff --git a/src/services/notificationService.ts b/src/services/notificationService.ts index f1c9139..6f39f08 100644 --- a/src/services/notificationService.ts +++ b/src/services/notificationService.ts @@ -24,6 +24,14 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES } let attributes; switch (orttoEventName) { + case NOTIFICATIONS_EVENT_NAMES.USER_SUPER_TOKENS_CRITICAL: + attributes = { + "str:cm:tokensymbol": payload.tokenSymbol, + "str:cm:email": payload.email, + "str:cm:userId": payload.userId, + "str:cm:criticalDate": payload.criticalDate, + } + break; case NOTIFICATIONS_EVENT_NAMES.DONATION_RECEIVED: attributes = { "str:cm:projecttitle": payload.title, diff --git a/src/types/notifications.ts b/src/types/notifications.ts index b45be84..2eeef97 100644 --- a/src/types/notifications.ts +++ b/src/types/notifications.ts @@ -1,4 +1,5 @@ export enum NOTIFICATIONS_EVENT_NAMES { + USER_SUPER_TOKENS_CRITICAL = 'Supertokens critical', DRAFTED_PROJECT_ACTIVATED = 'Draft published', PROJECT_LISTED = 'Project listed', PROJECT_UNLISTED = 'Project unlisted', @@ -47,6 +48,7 @@ export enum NOTIFICATIONS_EVENT_NAMES { } export const ORTTO_EVENT_NAMES = { + [NOTIFICATIONS_EVENT_NAMES.USER_SUPER_TOKENS_CRITICAL]: 'superfluid-balance-warning', [NOTIFICATIONS_EVENT_NAMES.DONATION_RECEIVED]: 'testing-donation-received', [NOTIFICATIONS_EVENT_NAMES.DRAFTED_PROJECT_ACTIVATED]: 'project-created', [NOTIFICATIONS_EVENT_NAMES.PROJECT_LISTED]: 'project-listed', diff --git a/src/utils/validators/segmentAndMetadataValidators.ts b/src/utils/validators/segmentAndMetadataValidators.ts index cc3e8ab..c94b826 100644 --- a/src/utils/validators/segmentAndMetadataValidators.ts +++ b/src/utils/validators/segmentAndMetadataValidators.ts @@ -141,12 +141,23 @@ const givBackReadyClaimSchema = Joi.object({ amount: Joi.string().required(), }); +const superFluidTokenTrackerSchema = Joi.object({ + tokenSymbol: Joi.string().required(), + email: Joi.string().required(), + userId: Joi.number().required(), + criticalDate: Joi.string().required(), +}); + export const SEGMENT_METADATA_SCHEMA_VALIDATOR: { [key: string]: { segment: ObjectSchema | null; metadata: ObjectSchema | null; }; } = { + userSuperTokensCritical: { + metadata: null, + segment: superFluidTokenTrackerSchema, + }, draftedProjectSavedValidator: { metadata: projectTitleProjectLinkSchema, segment: projectRelatedTrackerSchema,