@carlonicora/nestjs-neo4jsonapi 6.2.0 → 6.4.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/bootstrap/app.module.factory.d.ts.map +1 -1
- package/dist/bootstrap/app.module.factory.js +1 -0
- package/dist/bootstrap/app.module.factory.js.map +1 -1
- package/dist/bootstrap/bootstrap.options.d.ts +20 -0
- package/dist/bootstrap/bootstrap.options.d.ts.map +1 -1
- package/dist/core/email/services/email.service.d.ts +2 -0
- package/dist/core/email/services/email.service.d.ts.map +1 -1
- package/dist/core/email/services/email.service.js +18 -8
- package/dist/core/email/services/email.service.js.map +1 -1
- package/dist/core/email/templates/en/emailAutomation.hbs +24 -0
- package/dist/foundations/auth/controllers/auth.discord.controller.d.ts +1 -1
- package/dist/foundations/auth/controllers/auth.discord.controller.d.ts.map +1 -1
- package/dist/foundations/auth/controllers/auth.discord.controller.js +6 -3
- package/dist/foundations/auth/controllers/auth.discord.controller.js.map +1 -1
- package/dist/foundations/auth/controllers/auth.google.controller.d.ts +1 -1
- package/dist/foundations/auth/controllers/auth.google.controller.d.ts.map +1 -1
- package/dist/foundations/auth/controllers/auth.google.controller.js +6 -3
- package/dist/foundations/auth/controllers/auth.google.controller.js.map +1 -1
- package/dist/foundations/auth/dtos/auth.post.register.dto.d.ts +6 -0
- package/dist/foundations/auth/dtos/auth.post.register.dto.d.ts.map +1 -1
- package/dist/foundations/auth/dtos/auth.post.register.dto.js +36 -0
- package/dist/foundations/auth/dtos/auth.post.register.dto.js.map +1 -1
- package/dist/foundations/auth/events/auth.events.d.ts +7 -0
- package/dist/foundations/auth/events/auth.events.d.ts.map +1 -0
- package/dist/foundations/auth/events/auth.events.js +6 -0
- package/dist/foundations/auth/events/auth.events.js.map +1 -0
- package/dist/foundations/auth/index.d.ts +2 -0
- package/dist/foundations/auth/index.d.ts.map +1 -1
- package/dist/foundations/auth/index.js +3 -1
- package/dist/foundations/auth/index.js.map +1 -1
- package/dist/foundations/auth/services/auth.discord.service.d.ts +6 -2
- package/dist/foundations/auth/services/auth.discord.service.d.ts.map +1 -1
- package/dist/foundations/auth/services/auth.discord.service.js +29 -5
- package/dist/foundations/auth/services/auth.discord.service.js.map +1 -1
- package/dist/foundations/auth/services/auth.google.service.d.ts +6 -2
- package/dist/foundations/auth/services/auth.google.service.d.ts.map +1 -1
- package/dist/foundations/auth/services/auth.google.service.js +29 -5
- package/dist/foundations/auth/services/auth.google.service.js.map +1 -1
- package/dist/foundations/auth/services/auth.service.d.ts +15 -1
- package/dist/foundations/auth/services/auth.service.d.ts.map +1 -1
- package/dist/foundations/auth/services/auth.service.js +58 -10
- package/dist/foundations/auth/services/auth.service.js.map +1 -1
- package/dist/foundations/auth/services/pending-registration.service.d.ts +2 -0
- package/dist/foundations/auth/services/pending-registration.service.d.ts.map +1 -1
- package/dist/foundations/auth/services/pending-registration.service.js.map +1 -1
- package/dist/foundations/email-automation/controllers/email-automation-step.controller.d.ts +22 -0
- package/dist/foundations/email-automation/controllers/email-automation-step.controller.d.ts.map +1 -0
- package/dist/foundations/email-automation/controllers/email-automation-step.controller.js +152 -0
- package/dist/foundations/email-automation/controllers/email-automation-step.controller.js.map +1 -0
- package/dist/foundations/email-automation/controllers/email-automation.controller.d.ts +29 -0
- package/dist/foundations/email-automation/controllers/email-automation.controller.d.ts.map +1 -0
- package/dist/foundations/email-automation/controllers/email-automation.controller.js +183 -0
- package/dist/foundations/email-automation/controllers/email-automation.controller.js.map +1 -0
- package/dist/foundations/email-automation/controllers/email-automation.public.controller.d.ts +20 -0
- package/dist/foundations/email-automation/controllers/email-automation.public.controller.d.ts.map +1 -0
- package/dist/foundations/email-automation/controllers/email-automation.public.controller.js +63 -0
- package/dist/foundations/email-automation/controllers/email-automation.public.controller.js.map +1 -0
- package/dist/foundations/email-automation/cron/email-automation-sender.cron.d.ts +9 -0
- package/dist/foundations/email-automation/cron/email-automation-sender.cron.d.ts.map +1 -0
- package/dist/foundations/email-automation/cron/email-automation-sender.cron.js +44 -0
- package/dist/foundations/email-automation/cron/email-automation-sender.cron.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.dto.d.ts +8 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.dto.js +36 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.dto.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.patch.dto.d.ts +16 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.patch.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.patch.dto.js +72 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.patch.dto.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.post.dto.d.ts +21 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.post.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.post.dto.js +88 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.post.dto.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-unsubscribe.dto.d.ts +11 -0
- package/dist/foundations/email-automation/dtos/email-automation-unsubscribe.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-unsubscribe.dto.js +47 -0
- package/dist/foundations/email-automation/dtos/email-automation-unsubscribe.dto.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation.dto.d.ts +8 -0
- package/dist/foundations/email-automation/dtos/email-automation.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation.dto.js +36 -0
- package/dist/foundations/email-automation/dtos/email-automation.dto.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation.patch.dto.d.ts +16 -0
- package/dist/foundations/email-automation/dtos/email-automation.patch.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation.patch.dto.js +72 -0
- package/dist/foundations/email-automation/dtos/email-automation.patch.dto.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation.post.dto.d.ts +16 -0
- package/dist/foundations/email-automation/dtos/email-automation.post.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation.post.dto.js +72 -0
- package/dist/foundations/email-automation/dtos/email-automation.post.dto.js.map +1 -0
- package/dist/foundations/email-automation/email-automation.module.d.ts +35 -0
- package/dist/foundations/email-automation/email-automation.module.d.ts.map +1 -0
- package/dist/foundations/email-automation/email-automation.module.js +122 -0
- package/dist/foundations/email-automation/email-automation.module.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.d.ts +55 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.js +74 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.meta.d.ts +3 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.meta.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.meta.js +10 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.meta.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-step.d.ts +32 -0
- package/dist/foundations/email-automation/entities/email-automation-step.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-step.js +55 -0
- package/dist/foundations/email-automation/entities/email-automation-step.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-step.meta.d.ts +3 -0
- package/dist/foundations/email-automation/entities/email-automation-step.meta.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-step.meta.js +10 -0
- package/dist/foundations/email-automation/entities/email-automation-step.meta.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.d.ts +11 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.js +15 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.meta.d.ts +6 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.meta.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.meta.js +13 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.meta.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation.d.ts +26 -0
- package/dist/foundations/email-automation/entities/email-automation.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation.js +54 -0
- package/dist/foundations/email-automation/entities/email-automation.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation.meta.d.ts +7 -0
- package/dist/foundations/email-automation/entities/email-automation.meta.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation.meta.js +14 -0
- package/dist/foundations/email-automation/entities/email-automation.meta.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-opt-out.d.ts +9 -0
- package/dist/foundations/email-automation/entities/email-opt-out.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-opt-out.js +17 -0
- package/dist/foundations/email-automation/entities/email-opt-out.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-opt-out.meta.d.ts +3 -0
- package/dist/foundations/email-automation/entities/email-opt-out.meta.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-opt-out.meta.js +10 -0
- package/dist/foundations/email-automation/entities/email-opt-out.meta.js.map +1 -0
- package/dist/foundations/email-automation/index.d.ts +32 -0
- package/dist/foundations/email-automation/index.d.ts.map +1 -0
- package/dist/foundations/email-automation/index.js +56 -0
- package/dist/foundations/email-automation/index.js.map +1 -0
- package/dist/foundations/email-automation/interfaces/email-automation.config.interface.d.ts +49 -0
- package/dist/foundations/email-automation/interfaces/email-automation.config.interface.d.ts.map +1 -0
- package/dist/foundations/email-automation/interfaces/email-automation.config.interface.js +14 -0
- package/dist/foundations/email-automation/interfaces/email-automation.config.interface.js.map +1 -0
- package/dist/foundations/email-automation/repositories/email-automation-enrollment.repository.d.ts +150 -0
- package/dist/foundations/email-automation/repositories/email-automation-enrollment.repository.d.ts.map +1 -0
- package/dist/foundations/email-automation/repositories/email-automation-enrollment.repository.js +379 -0
- package/dist/foundations/email-automation/repositories/email-automation-enrollment.repository.js.map +1 -0
- package/dist/foundations/email-automation/repositories/email-automation-step.repository.d.ts +64 -0
- package/dist/foundations/email-automation/repositories/email-automation-step.repository.d.ts.map +1 -0
- package/dist/foundations/email-automation/repositories/email-automation-step.repository.js +156 -0
- package/dist/foundations/email-automation/repositories/email-automation-step.repository.js.map +1 -0
- package/dist/foundations/email-automation/repositories/email-automation.repository.d.ts +36 -0
- package/dist/foundations/email-automation/repositories/email-automation.repository.d.ts.map +1 -0
- package/dist/foundations/email-automation/repositories/email-automation.repository.js +93 -0
- package/dist/foundations/email-automation/repositories/email-automation.repository.js.map +1 -0
- package/dist/foundations/email-automation/repositories/email-opt-out.repository.d.ts +25 -0
- package/dist/foundations/email-automation/repositories/email-opt-out.repository.d.ts.map +1 -0
- package/dist/foundations/email-automation/repositories/email-opt-out.repository.js +69 -0
- package/dist/foundations/email-automation/repositories/email-opt-out.repository.js.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-renderer.service.d.ts +35 -0
- package/dist/foundations/email-automation/services/email-automation-renderer.service.d.ts.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-renderer.service.js +109 -0
- package/dist/foundations/email-automation/services/email-automation-renderer.service.js.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-sender.service.d.ts +31 -0
- package/dist/foundations/email-automation/services/email-automation-sender.service.d.ts.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-sender.service.js +129 -0
- package/dist/foundations/email-automation/services/email-automation-sender.service.js.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-step.service.d.ts +60 -0
- package/dist/foundations/email-automation/services/email-automation-step.service.d.ts.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-step.service.js +101 -0
- package/dist/foundations/email-automation/services/email-automation-step.service.js.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-trigger.service.d.ts +28 -0
- package/dist/foundations/email-automation/services/email-automation-trigger.service.d.ts.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-trigger.service.js +125 -0
- package/dist/foundations/email-automation/services/email-automation-trigger.service.js.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-unsubscribe.service.d.ts +53 -0
- package/dist/foundations/email-automation/services/email-automation-unsubscribe.service.d.ts.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-unsubscribe.service.js +67 -0
- package/dist/foundations/email-automation/services/email-automation-unsubscribe.service.js.map +1 -0
- package/dist/foundations/email-automation/services/email-automation.service.d.ts +53 -0
- package/dist/foundations/email-automation/services/email-automation.service.d.ts.map +1 -0
- package/dist/foundations/email-automation/services/email-automation.service.js +90 -0
- package/dist/foundations/email-automation/services/email-automation.service.js.map +1 -0
- package/dist/foundations/email-automation/triggers/built-in.triggers.d.ts +10 -0
- package/dist/foundations/email-automation/triggers/built-in.triggers.d.ts.map +1 -0
- package/dist/foundations/email-automation/triggers/built-in.triggers.js +50 -0
- package/dist/foundations/email-automation/triggers/built-in.triggers.js.map +1 -0
- package/dist/foundations/foundations.modules.d.ts +3 -0
- package/dist/foundations/foundations.modules.d.ts.map +1 -1
- package/dist/foundations/foundations.modules.js +7 -1
- package/dist/foundations/foundations.modules.js.map +1 -1
- package/dist/foundations/index.d.ts +1 -0
- package/dist/foundations/index.d.ts.map +1 -1
- package/dist/foundations/index.js +1 -0
- package/dist/foundations/index.js.map +1 -1
- package/dist/foundations/user/entities/user.d.ts +6 -0
- package/dist/foundations/user/entities/user.d.ts.map +1 -1
- package/dist/foundations/user/entities/user.js +7 -0
- package/dist/foundations/user/entities/user.js.map +1 -1
- package/dist/foundations/user/repositories/user.repository.d.ts +9 -0
- package/dist/foundations/user/repositories/user.repository.d.ts.map +1 -1
- package/dist/foundations/user/repositories/user.repository.js +23 -0
- package/dist/foundations/user/repositories/user.repository.js.map +1 -1
- package/dist/foundations/waitlist/dtos/waitlist.post.dto.d.ts +6 -0
- package/dist/foundations/waitlist/dtos/waitlist.post.dto.d.ts.map +1 -1
- package/dist/foundations/waitlist/dtos/waitlist.post.dto.js +36 -0
- package/dist/foundations/waitlist/dtos/waitlist.post.dto.js.map +1 -1
- package/dist/foundations/waitlist/entities/waitlist.d.ts +6 -0
- package/dist/foundations/waitlist/entities/waitlist.d.ts.map +1 -1
- package/dist/foundations/waitlist/entities/waitlist.js +6 -0
- package/dist/foundations/waitlist/entities/waitlist.js.map +1 -1
- package/dist/foundations/waitlist/events/waitlist.events.d.ts +7 -0
- package/dist/foundations/waitlist/events/waitlist.events.d.ts.map +1 -0
- package/dist/foundations/waitlist/events/waitlist.events.js +6 -0
- package/dist/foundations/waitlist/events/waitlist.events.js.map +1 -0
- package/dist/foundations/waitlist/index.d.ts +4 -0
- package/dist/foundations/waitlist/index.d.ts.map +1 -1
- package/dist/foundations/waitlist/index.js +11 -1
- package/dist/foundations/waitlist/index.js.map +1 -1
- package/dist/foundations/waitlist/services/waitlist.service.d.ts +5 -2
- package/dist/foundations/waitlist/services/waitlist.service.d.ts.map +1 -1
- package/dist/foundations/waitlist/services/waitlist.service.js +33 -18
- package/dist/foundations/waitlist/services/waitlist.service.js.map +1 -1
- package/dist/foundations/waitlist/utils/signup-source.d.ts +24 -0
- package/dist/foundations/waitlist/utils/signup-source.d.ts.map +1 -0
- package/dist/foundations/waitlist/utils/signup-source.js +52 -0
- package/dist/foundations/waitlist/utils/signup-source.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConfigService } from "@nestjs/config";
|
|
2
|
+
import { EventEmitter2 } from "@nestjs/event-emitter";
|
|
2
3
|
import { ClsService } from "nestjs-cls";
|
|
3
4
|
import { BaseConfigInterface } from "../../../config/interfaces";
|
|
4
5
|
import { EmailService } from "../../../core/email/services/email.service";
|
|
@@ -16,9 +17,10 @@ export declare class WaitlistService extends AbstractService<Waitlist, typeof Wa
|
|
|
16
17
|
private readonly configService;
|
|
17
18
|
private readonly userRepository;
|
|
18
19
|
private readonly responseLanguage;
|
|
20
|
+
private readonly eventEmitter;
|
|
19
21
|
protected readonly descriptor: import("../../..").EntityDescriptor<Waitlist, {}>;
|
|
20
22
|
private readonly logger;
|
|
21
|
-
constructor(jsonApiService: JsonApiService, waitlistRepository: WaitlistRepository, clsService: ClsService, emailService: EmailService, configService: ConfigService<BaseConfigInterface>, userRepository: UserRepository, responseLanguage: ResponseLanguageService);
|
|
23
|
+
constructor(jsonApiService: JsonApiService, waitlistRepository: WaitlistRepository, clsService: ClsService, emailService: EmailService, configService: ConfigService<BaseConfigInterface>, userRepository: UserRepository, responseLanguage: ResponseLanguageService, eventEmitter: EventEmitter2);
|
|
22
24
|
private get appConfig();
|
|
23
25
|
/**
|
|
24
26
|
* Create a new waitlist entry with typed DTO.
|
|
@@ -64,11 +66,12 @@ export declare class WaitlistService extends AbstractService<Waitlist, typeof Wa
|
|
|
64
66
|
} | null>;
|
|
65
67
|
/**
|
|
66
68
|
* Mark entry as registered after user creates account.
|
|
69
|
+
* Returns the entry it marked, or null when the invite code is unknown.
|
|
67
70
|
*/
|
|
68
71
|
markAsRegistered(params: {
|
|
69
72
|
inviteCode: string;
|
|
70
73
|
userId: string;
|
|
71
|
-
}): Promise<
|
|
74
|
+
}): Promise<Waitlist | null>;
|
|
72
75
|
/**
|
|
73
76
|
* Get waitlist statistics.
|
|
74
77
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waitlist.service.d.ts","sourceRoot":"","sources":["../../../../src/foundations/waitlist/services/waitlist.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"waitlist.service.d.ts","sourceRoot":"","sources":["../../../../src/foundations/waitlist/services/waitlist.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAA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E,MAAM,CAAC;KACf,CAAC;IAIF;;;OAGG;YACW,0BAA0B;CAiCzC"}
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.WaitlistService = void 0;
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
15
|
const config_1 = require("@nestjs/config");
|
|
16
|
+
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
16
17
|
const crypto_1 = require("crypto");
|
|
17
18
|
const nestjs_cls_1 = require("nestjs-cls");
|
|
18
19
|
const email_service_1 = require("../../../core/email/services/email.service");
|
|
@@ -21,16 +22,19 @@ const jsonapi_paginator_1 = require("../../../core/jsonapi/serialisers/jsonapi.p
|
|
|
21
22
|
const jsonapi_service_1 = require("../../../core/jsonapi/services/jsonapi.service");
|
|
22
23
|
const abstract_service_1 = require("../../../core/neo4j/abstracts/abstract.service");
|
|
23
24
|
const user_repository_1 = require("../../user/repositories/user.repository");
|
|
25
|
+
const waitlist_events_1 = require("../events/waitlist.events");
|
|
24
26
|
const waitlist_1 = require("../entities/waitlist");
|
|
25
27
|
const waitlist_repository_1 = require("../repositories/waitlist.repository");
|
|
28
|
+
const signup_source_1 = require("../utils/signup-source");
|
|
26
29
|
let WaitlistService = WaitlistService_1 = class WaitlistService extends abstract_service_1.AbstractService {
|
|
27
|
-
constructor(jsonApiService, waitlistRepository, clsService, emailService, configService, userRepository, responseLanguage) {
|
|
30
|
+
constructor(jsonApiService, waitlistRepository, clsService, emailService, configService, userRepository, responseLanguage, eventEmitter) {
|
|
28
31
|
super(jsonApiService, waitlistRepository, clsService, waitlist_1.WaitlistDescriptor.model);
|
|
29
32
|
this.waitlistRepository = waitlistRepository;
|
|
30
33
|
this.emailService = emailService;
|
|
31
34
|
this.configService = configService;
|
|
32
35
|
this.userRepository = userRepository;
|
|
33
36
|
this.responseLanguage = responseLanguage;
|
|
37
|
+
this.eventEmitter = eventEmitter;
|
|
34
38
|
this.descriptor = waitlist_1.WaitlistDescriptor;
|
|
35
39
|
this.logger = new common_1.Logger(WaitlistService_1.name);
|
|
36
40
|
}
|
|
@@ -66,17 +70,28 @@ let WaitlistService = WaitlistService_1 = class WaitlistService extends abstract
|
|
|
66
70
|
confirmationCode,
|
|
67
71
|
confirmationCodeExpiration: confirmationCodeExpiration.toISOString(),
|
|
68
72
|
status: waitlist_1.WaitlistStatus.Pending,
|
|
73
|
+
...((0, signup_source_1.sanitiseSignupSource)(attributes) ?? {}),
|
|
69
74
|
});
|
|
70
75
|
// Send confirmation email. The recipient is not a user yet: use the requester's language.
|
|
76
|
+
// Without this email the entry can never be confirmed, so a failed send removes the
|
|
77
|
+
// entry again and tells the requester, instead of leaving a ghost that blocks a retry
|
|
78
|
+
// with "already registered".
|
|
71
79
|
const locale = (await this.responseLanguage.resolve()) ?? "en";
|
|
72
80
|
const confirmationLink = `${this.appConfig.url}${locale}/waitlist/confirm/${confirmationCode}`;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
try {
|
|
82
|
+
await this.emailService.sendEmail("waitlistConfirmation", {
|
|
83
|
+
to: email,
|
|
84
|
+
confirmationLink,
|
|
85
|
+
expirationDate: confirmationCodeExpiration.toDateString(),
|
|
86
|
+
expirationTime: confirmationCodeExpiration.toTimeString(),
|
|
87
|
+
expiresAt: confirmationCodeExpiration.toISOString(),
|
|
88
|
+
}, locale);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
this.logger.error(`Failed to send waitlist confirmation to ${email}:`, error);
|
|
92
|
+
await this.repository.delete({ id });
|
|
93
|
+
throw new common_1.HttpException("We could not send the confirmation email, so your sign-up was not saved. Please try again in a few minutes.", common_1.HttpStatus.SERVICE_UNAVAILABLE);
|
|
94
|
+
}
|
|
80
95
|
return this.findById({ id });
|
|
81
96
|
}
|
|
82
97
|
/**
|
|
@@ -109,12 +124,11 @@ let WaitlistService = WaitlistService_1 = class WaitlistService extends abstract
|
|
|
109
124
|
status: waitlist_1.WaitlistStatus.Confirmed,
|
|
110
125
|
confirmedAt,
|
|
111
126
|
});
|
|
127
|
+
const confirmedEntry = { ...entry, confirmedAt, status: waitlist_1.WaitlistStatus.Confirmed };
|
|
128
|
+
const event = { waitlist: confirmedEntry };
|
|
129
|
+
this.eventEmitter.emit(waitlist_events_1.WAITLIST_CONFIRMED_EVENT, event);
|
|
112
130
|
// Notify platform administrators (non-blocking)
|
|
113
|
-
await this.notifyAdminsOfConfirmation(
|
|
114
|
-
...entry,
|
|
115
|
-
confirmedAt,
|
|
116
|
-
status: waitlist_1.WaitlistStatus.Confirmed,
|
|
117
|
-
});
|
|
131
|
+
await this.notifyAdminsOfConfirmation(confirmedEntry);
|
|
118
132
|
return this.findById({ id: entry.id });
|
|
119
133
|
}
|
|
120
134
|
/**
|
|
@@ -181,18 +195,18 @@ let WaitlistService = WaitlistService_1 = class WaitlistService extends abstract
|
|
|
181
195
|
}
|
|
182
196
|
/**
|
|
183
197
|
* Mark entry as registered after user creates account.
|
|
198
|
+
* Returns the entry it marked, or null when the invite code is unknown.
|
|
184
199
|
*/
|
|
185
200
|
async markAsRegistered(params) {
|
|
186
201
|
const entry = await this.waitlistRepository.findByInviteCode({ code: params.inviteCode });
|
|
187
|
-
if (!entry)
|
|
188
|
-
|
|
189
|
-
}
|
|
202
|
+
if (!entry)
|
|
203
|
+
return null;
|
|
190
204
|
await this.waitlistRepository.markAsRegistered({
|
|
191
205
|
id: entry.id,
|
|
192
206
|
userId: params.userId,
|
|
193
207
|
registeredAt: new Date(),
|
|
194
208
|
});
|
|
195
|
-
return
|
|
209
|
+
return entry;
|
|
196
210
|
}
|
|
197
211
|
/**
|
|
198
212
|
* Get waitlist statistics.
|
|
@@ -242,6 +256,7 @@ exports.WaitlistService = WaitlistService = WaitlistService_1 = __decorate([
|
|
|
242
256
|
email_service_1.EmailService,
|
|
243
257
|
config_1.ConfigService,
|
|
244
258
|
user_repository_1.UserRepository,
|
|
245
|
-
response_language_service_1.ResponseLanguageService
|
|
259
|
+
response_language_service_1.ResponseLanguageService,
|
|
260
|
+
event_emitter_1.EventEmitter2])
|
|
246
261
|
], WaitlistService);
|
|
247
262
|
//# sourceMappingURL=waitlist.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waitlist.service.js","sourceRoot":"","sources":["../../../../src/foundations/waitlist/services/waitlist.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA+E;AAC/E,2CAA+C;AAC/C,mCAAoC;AACpC,2CAAwC;AAExC,8EAA0E;AAC1E,6FAAwF;AACxF,2FAAuF;AACvF,oFAAgF;AAChF,qFAAiF;AACjF,6EAAyE;AAEzE,mDAAoF;AACpF,6EAAyE;
|
|
1
|
+
{"version":3,"file":"waitlist.service.js","sourceRoot":"","sources":["../../../../src/foundations/waitlist/services/waitlist.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA+E;AAC/E,2CAA+C;AAC/C,yDAAsD;AACtD,mCAAoC;AACpC,2CAAwC;AAExC,8EAA0E;AAC1E,6FAAwF;AACxF,2FAAuF;AACvF,oFAAgF;AAChF,qFAAiF;AACjF,6EAAyE;AAEzE,+DAA6F;AAC7F,mDAAoF;AACpF,6EAAyE;AACzE,0DAA8D;AAOvD,IAAM,eAAe,uBAArB,MAAM,eAAgB,SAAQ,kCAAkE;IAIrG,YACE,cAA8B,EACb,kBAAsC,EACvD,UAAsB,EACL,YAA0B,EAC1B,aAAiD,EACjD,cAA8B,EAC9B,gBAAyC,EACzC,YAA2B;QAE5C,KAAK,CAAC,cAAc,EAAE,kBAAkB,EAAE,UAAU,EAAE,6BAAkB,CAAC,KAAK,CAAC,CAAC;QAR/D,uBAAkB,GAAlB,kBAAkB,CAAoB;QAEtC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,kBAAa,GAAb,aAAa,CAAoC;QACjD,mBAAc,GAAd,cAAc,CAAgB;QAC9B,qBAAgB,GAAhB,gB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I,IAAI,CAAC;oBAC7F,MAAM,aAAa,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,GAAG,MAAM,0BAA0B,CAAC;oBAE/E,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAC/B,2BAA2B,EAC3B;wBACE,EAAE,EAAE,KAAK,CAAC,KAAK;wBACf,SAAS,EAAE,KAAK,CAAC,IAAI,IAAI,eAAe;wBACxC,SAAS,EAAE,KAAK,CAAC,KAAK;wBACtB,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,WAAW,EAAE;wBAC7C,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,IAAI;wBAC1C,aAAa;qBACd,EACD,MAAM,CACP,CAAC;gBACJ,CAAC;gBAAC,OAAO,UAAU,EAAE,CAAC;oBACpB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iDAAiD,KAAK,CAAC,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;gBACjG,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;CACF,CAAA;AAtRY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCAMO,gCAAc;QACO,wCAAkB;QAC3C,uBAAU;QACS,4BAAY;QACX,sBAAa;QACZ,gCAAc;QACZ,mDAAuB;QAC3B,6BAAa;GAZnC,eAAe,CAsR3B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a visitor came from before signing up (first touch).
|
|
3
|
+
* Stored on waitlist entries and users; every key is optional.
|
|
4
|
+
*/
|
|
5
|
+
export type SignupSource = {
|
|
6
|
+
sourceRef?: string;
|
|
7
|
+
sourceUtmSource?: string;
|
|
8
|
+
sourceUtmMedium?: string;
|
|
9
|
+
sourceUtmCampaign?: string;
|
|
10
|
+
sourceReferrer?: string;
|
|
11
|
+
sourceLandingPath?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const SIGNUP_SOURCE_FIELDS: readonly (keyof SignupSource)[];
|
|
14
|
+
export declare const SIGNUP_SOURCE_MAX_LENGTH = 200;
|
|
15
|
+
/**
|
|
16
|
+
* Picks the six keys, keeps non-empty trimmed strings, truncates to 200; undefined when nothing is left.
|
|
17
|
+
*/
|
|
18
|
+
export declare function sanitiseSignupSource(input: unknown): SignupSource | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* JSON.parse inside try/catch, rejects strings over 4096 chars, then sanitiseSignupSource.
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseSignupSourceParam(raw?: string): SignupSource | undefined;
|
|
23
|
+
export declare function hasSignupSource(record?: Partial<SignupSource> | null): boolean;
|
|
24
|
+
//# sourceMappingURL=signup-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signup-source.d.ts","sourceRoot":"","sources":["../../../../src/foundations/waitlist/utils/signup-source.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,SAAS,CAAC,MAAM,YAAY,CAAC,EAO/D,CAAC;AAEF,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAI5C;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAiB7E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAQ7E;AAED,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,GAAG,OAAO,CAE9E"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SIGNUP_SOURCE_MAX_LENGTH = exports.SIGNUP_SOURCE_FIELDS = void 0;
|
|
4
|
+
exports.sanitiseSignupSource = sanitiseSignupSource;
|
|
5
|
+
exports.parseSignupSourceParam = parseSignupSourceParam;
|
|
6
|
+
exports.hasSignupSource = hasSignupSource;
|
|
7
|
+
exports.SIGNUP_SOURCE_FIELDS = [
|
|
8
|
+
"sourceRef",
|
|
9
|
+
"sourceUtmSource",
|
|
10
|
+
"sourceUtmMedium",
|
|
11
|
+
"sourceUtmCampaign",
|
|
12
|
+
"sourceReferrer",
|
|
13
|
+
"sourceLandingPath",
|
|
14
|
+
];
|
|
15
|
+
exports.SIGNUP_SOURCE_MAX_LENGTH = 200;
|
|
16
|
+
const SIGNUP_SOURCE_PARAM_MAX_LENGTH = 4096;
|
|
17
|
+
/**
|
|
18
|
+
* Picks the six keys, keeps non-empty trimmed strings, truncates to 200; undefined when nothing is left.
|
|
19
|
+
*/
|
|
20
|
+
function sanitiseSignupSource(input) {
|
|
21
|
+
if (!input || typeof input !== "object")
|
|
22
|
+
return undefined;
|
|
23
|
+
const record = input;
|
|
24
|
+
const source = {};
|
|
25
|
+
for (const field of exports.SIGNUP_SOURCE_FIELDS) {
|
|
26
|
+
const value = record[field];
|
|
27
|
+
if (typeof value !== "string")
|
|
28
|
+
continue;
|
|
29
|
+
const trimmed = value.trim();
|
|
30
|
+
if (!trimmed)
|
|
31
|
+
continue;
|
|
32
|
+
source[field] = trimmed.slice(0, exports.SIGNUP_SOURCE_MAX_LENGTH);
|
|
33
|
+
}
|
|
34
|
+
return Object.keys(source).length > 0 ? source : undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* JSON.parse inside try/catch, rejects strings over 4096 chars, then sanitiseSignupSource.
|
|
38
|
+
*/
|
|
39
|
+
function parseSignupSourceParam(raw) {
|
|
40
|
+
if (!raw || raw.length > SIGNUP_SOURCE_PARAM_MAX_LENGTH)
|
|
41
|
+
return undefined;
|
|
42
|
+
try {
|
|
43
|
+
return sanitiseSignupSource(JSON.parse(raw));
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function hasSignupSource(record) {
|
|
50
|
+
return sanitiseSignupSource(record) !== undefined;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=signup-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signup-source.js","sourceRoot":"","sources":["../../../../src/foundations/waitlist/utils/signup-source.ts"],"names":[],"mappings":";;;AA6BA,oDAiBC;AAKD,wDAQC;AAED,0CAEC;AAlDY,QAAA,oBAAoB,GAAoC;IACnE,WAAW;IACX,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,gBAAgB;IAChB,mBAAmB;CACpB,CAAC;AAEW,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAE5C,MAAM,8BAA8B,GAAG,IAAI,CAAC;AAE5C;;GAEG;AACH,SAAgB,oBAAoB,CAAC,KAAc;IACjD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAE1D,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,MAAM,MAAM,GAAiB,EAAE,CAAC;IAEhC,KAAK,MAAM,KAAK,IAAI,4BAAoB,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,SAAS;QAExC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC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