From 93b1134d8c4343e0922a8073acc1466c0c400d88 Mon Sep 17 00:00:00 2001 From: Tristan Slater <1631008+trslater@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:44:48 -0700 Subject: [PATCH 1/5] Conver to plain HTML email templates with bare-bones templates --- .../application-submission.controller.ts | 4 +- .../application/application.controller.ts | 4 +- .../notice-of-intent.controller.ts | 4 +- ...pplication-submission-review.controller.ts | 20 +- .../application-submission.controller.ts | 32 ++- ...tice-of-intent-submission-draft.service.ts | 4 +- .../notice-of-intent-submission.controller.ts | 10 +- .../notification-submission.service.ts | 7 +- .../providers/email/status-email.service.ts | 12 +- .../decision-emails.consumer.ts | 12 +- .../status-emails/status-emails.consumer.ts | 12 +- .../decision-emails.consumer.ts | 4 +- .../email-template.service.spec.ts | 22 --- .../email-template.service.ts | 24 --- .../emails/cancelled/application.template.ts | 56 ++---- services/templates/emails/cancelled/index.ts | 2 - .../cancelled/notice-of-intent.template.ts | 56 ++---- .../decision-released/application.template.ts | 93 +++------ .../emails/decision-released/index.ts | 2 - .../notice-of-intent.template.ts | 93 +++------ services/templates/emails/index.ts | 13 ++ .../notifications/srw-notice.template.ts | 115 +++-------- .../emails/partials/footer.template.ts | 20 +- .../emails/partials/header.template.ts | 33 ++-- services/templates/emails/partials/index.ts | 4 - .../partials/notification-only.template.ts | 6 +- .../emails/partials/portal-button.template.ts | 17 +- .../emails/refused-to-forward.template.ts | 64 ++---- .../return-to-lfng/application.template.ts | 56 ++---- .../templates/emails/return-to-lfng/index.ts | 1 - .../emails/returned-as-incomplete.template.ts | 64 ++---- .../submitted-to-alc/application.template.ts | 182 ++++++++---------- .../cove-applicant.template.ts | 72 ++----- .../emails/submitted-to-alc/index.ts | 5 - .../no-review-government.template.ts | 56 ++---- .../noi-applicant.template.ts | 168 +++++++--------- .../noi-government.template.ts | 56 ++---- .../tur-applicant.template.ts | 158 ++++++--------- .../submitted-to-lfng/applicant.template.ts | 102 ++++------ .../submitted-to-lfng/government.template.ts | 87 +++------ .../emails/submitted-to-lfng/index.ts | 2 - .../emails/under-review-by-alc.template.ts | 60 ++---- .../emails/under-review-by-lfng.template.ts | 64 ++---- .../templates/emails/wrong-lfng.template.ts | 60 ++---- 44 files changed, 611 insertions(+), 1327 deletions(-) delete mode 100644 services/libs/common/src/email-template-service/email-template.service.spec.ts delete mode 100644 services/libs/common/src/email-template-service/email-template.service.ts delete mode 100644 services/templates/emails/cancelled/index.ts delete mode 100644 services/templates/emails/decision-released/index.ts create mode 100644 services/templates/emails/index.ts delete mode 100644 services/templates/emails/partials/index.ts delete mode 100644 services/templates/emails/return-to-lfng/index.ts delete mode 100644 services/templates/emails/submitted-to-alc/index.ts delete mode 100644 services/templates/emails/submitted-to-lfng/index.ts diff --git a/services/apps/alcs/src/alcs/application/application-submission/application-submission.controller.ts b/services/apps/alcs/src/alcs/application/application-submission/application-submission.controller.ts index 0446e4a990..7030acd9e2 100644 --- a/services/apps/alcs/src/alcs/application/application-submission/application-submission.controller.ts +++ b/services/apps/alcs/src/alcs/application/application-submission/application-submission.controller.ts @@ -12,7 +12,7 @@ import { Mapper } from 'automapper-core'; import { InjectMapper } from 'automapper-nestjs'; import * as config from 'config'; import { ServiceValidationException } from '../../../../../../libs/common/src/exceptions/base.exception'; -import { generateINCGApplicationHtml } from '../../../../../../templates/emails/return-to-lfng'; +import { template } from '../../../../../../templates/emails/return-to-lfng/application.template'; import { ANY_AUTH_ROLE } from '../../../common/authorization/roles'; import { RolesGuard } from '../../../common/authorization/roles-guard.service'; import { UserRoles } from '../../../common/authorization/roles.decorator'; @@ -144,7 +144,7 @@ export class ApplicationSubmissionController { //Send Email if (primaryContact && submissionGovernment) { await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateINCGApplicationHtml, + template, status: SUBMISSION_STATUS.RETURNED_TO_LG, applicationSubmission: submission, government: submissionGovernment, diff --git a/services/apps/alcs/src/alcs/application/application.controller.ts b/services/apps/alcs/src/alcs/application/application.controller.ts index f66ee885ab..b585714c46 100644 --- a/services/apps/alcs/src/alcs/application/application.controller.ts +++ b/services/apps/alcs/src/alcs/application/application.controller.ts @@ -18,7 +18,7 @@ import { } from '@nestjs/common'; import { ApiOAuth2 } from '@nestjs/swagger'; import * as config from 'config'; -import { generateCANCApplicationHtml } from '../../../../../templates/emails/cancelled'; +import { template } from '../../../../../templates/emails/cancelled/application.template'; import { ROLES_ALLOWED_APPLICATIONS } from '../../common/authorization/roles'; import { RolesGuard } from '../../common/authorization/roles-guard.service'; import { UserRoles } from '../../common/authorization/roles.decorator'; @@ -144,7 +144,7 @@ export class ApplicationController { SUBMISSION_STATUS.IN_PROGRESS ) { await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateCANCApplicationHtml, + template, status: SUBMISSION_STATUS.CANCELLED, applicationSubmission, government: submissionGovernment, diff --git a/services/apps/alcs/src/alcs/notice-of-intent/notice-of-intent.controller.ts b/services/apps/alcs/src/alcs/notice-of-intent/notice-of-intent.controller.ts index 4a58d4afcc..daae6fd1fa 100644 --- a/services/apps/alcs/src/alcs/notice-of-intent/notice-of-intent.controller.ts +++ b/services/apps/alcs/src/alcs/notice-of-intent/notice-of-intent.controller.ts @@ -11,7 +11,7 @@ import { ApiOAuth2 } from '@nestjs/swagger'; import { Mapper } from 'automapper-core'; import { InjectMapper } from 'automapper-nestjs'; import * as config from 'config'; -import { generateCANCNoticeOfIntentHtml } from '../../../../../templates/emails/cancelled'; +import { template } from '../../../../../templates/emails/cancelled/notice-of-intent.template'; import { ROLES_ALLOWED_APPLICATIONS, ROLES_ALLOWED_BOARDS, @@ -111,7 +111,7 @@ export class NoticeOfIntentController { NOI_SUBMISSION_STATUS.IN_PROGRESS ) { await this.statusEmailService.sendNoticeOfIntentStatusEmail({ - generateStatusHtml: generateCANCNoticeOfIntentHtml, + template, status: NOI_SUBMISSION_STATUS.CANCELLED, noticeOfIntentSubmission, government: submissionGovernment, diff --git a/services/apps/alcs/src/portal/application-submission-review/application-submission-review.controller.ts b/services/apps/alcs/src/portal/application-submission-review/application-submission-review.controller.ts index 58d59eaf81..7ff8eb4615 100644 --- a/services/apps/alcs/src/portal/application-submission-review/application-submission-review.controller.ts +++ b/services/apps/alcs/src/portal/application-submission-review/application-submission-review.controller.ts @@ -12,11 +12,11 @@ import { Req, UseGuards, } from '@nestjs/common'; -import { generateRFFGHtml } from '../../../../../templates/emails/refused-to-forward.template'; -import { generateINCMHtml } from '../../../../../templates/emails/returned-as-incomplete.template'; -import { generateSUBMApplicationHtml } from '../../../../../templates/emails/submitted-to-alc'; -import { generateREVGHtml } from '../../../../../templates/emails/under-review-by-lfng.template'; -import { generateWRNGHtml } from '../../../../../templates/emails/wrong-lfng.template'; +import { template as rffgTemplate } from '../../../../../templates/emails/refused-to-forward.template'; +import { template as incmTemplate } from '../../../../../templates/emails/returned-as-incomplete.template'; +import { template as submApplicationTemplate } from '../../../../../templates/emails/submitted-to-alc/application.template'; +import { template as revgTemplate } from '../../../../../templates/emails/under-review-by-lfng.template'; +import { template as wrngTemplate } from '../../../../../templates/emails/wrong-lfng.template'; import { ApplicationDocumentService } from '../../alcs/application/application-document/application-document.service'; import { ApplicationSubmissionStatusService } from '../../alcs/application/application-submission-status/application-submission-status.service'; import { SUBMISSION_STATUS } from '../../alcs/application/application-submission-status/submission-status.dto'; @@ -193,7 +193,7 @@ export class ApplicationSubmissionReviewController { if (primaryContact) { await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateREVGHtml, + template: revgTemplate, status: SUBMISSION_STATUS.IN_REVIEW_BY_LG, applicationSubmission, government: userLocalGovernment, @@ -302,7 +302,7 @@ export class ApplicationSubmissionReviewController { if (primaryContact) { await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateSUBMApplicationHtml, + template: submApplicationTemplate, status: SUBMISSION_STATUS.SUBMITTED_TO_ALC, applicationSubmission: submission, government: userLocalGovernment, @@ -320,7 +320,7 @@ export class ApplicationSubmissionReviewController { if (primaryContact) { await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateRFFGHtml, + template: rffgTemplate, status: SUBMISSION_STATUS.REFUSED_TO_FORWARD_LG, applicationSubmission: submission, government: userLocalGovernment, @@ -412,7 +412,7 @@ export class ApplicationSubmissionReviewController { if (primaryContact) { if (returnDto.reasonForReturn === 'wrongGovernment') { await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateWRNGHtml, + template: wrngTemplate, status: SUBMISSION_STATUS.WRONG_GOV, applicationSubmission, government: userLocalGovernment, @@ -424,7 +424,7 @@ export class ApplicationSubmissionReviewController { if (returnDto.reasonForReturn === 'incomplete') { await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateINCMHtml, + template: incmTemplate, status: SUBMISSION_STATUS.INCOMPLETE, applicationSubmission, government: userLocalGovernment, diff --git a/services/apps/alcs/src/portal/application-submission/application-submission.controller.ts b/services/apps/alcs/src/portal/application-submission/application-submission.controller.ts index 72cb299ad6..08b1bc3c1d 100644 --- a/services/apps/alcs/src/portal/application-submission/application-submission.controller.ts +++ b/services/apps/alcs/src/portal/application-submission/application-submission.controller.ts @@ -14,16 +14,12 @@ import { BaseServiceException, ServiceValidationException, } from '../../../../../libs/common/src/exceptions/base.exception'; -import { generateCANCApplicationHtml } from '../../../../../templates/emails/cancelled'; -import { - generateSUBGNoReviewGovernmentTemplateEmail, - generateSUBGTurApplicantHtml, -} from '../../../../../templates/emails/submitted-to-alc'; -import { generateSUBGCoveApplicantHtml } from '../../../../../templates/emails/submitted-to-alc/cove-applicant.template'; -import { - generateSUBGApplicantHtml, - generateSUBGGovernmentHtml, -} from '../../../../../templates/emails/submitted-to-lfng'; +import { template as cancApplicationTemplate } from '../../../../../templates/emails/cancelled/application.template'; +import { template as subgNoReviewGovernmentTemplate } from '../../../../../templates/emails/submitted-to-alc/no-review-government.template'; +import { template as subgTurApplicantTemplate } from '../../../../../templates/emails/submitted-to-alc/tur-applicant.template'; +import { template as subgCoveApplicantTemplate } from '../../../../../templates/emails/submitted-to-alc/cove-applicant.template'; +import { template as subgApplicantTemplate } from '../../../../../templates/emails/submitted-to-lfng/applicant.template'; +import { template as subgGovernmentTemplate } from '../../../../../templates/emails/submitted-to-lfng/government.template'; import { SUBMISSION_STATUS } from '../../alcs/application/application-submission-status/submission-status.dto'; import { ApplicationService } from '../../alcs/application/application.service'; import { PARENT_TYPE } from '../../alcs/card/card-subtask/card-subtask.dto'; @@ -224,7 +220,7 @@ export class ApplicationSubmissionController { application.status.statusTypeCode !== SUBMISSION_STATUS.IN_PROGRESS ) { await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateCANCApplicationHtml, + template: cancApplicationTemplate, status: SUBMISSION_STATUS.CANCELLED, applicationSubmission: application, government: submissionGovernment, @@ -291,7 +287,7 @@ export class ApplicationSubmissionController { if (matchingType.requiresGovernmentReview) { if (primaryContact) { await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateSUBGApplicantHtml, + template: subgApplicantTemplate, status: SUBMISSION_STATUS.SUBMITTED_TO_LG, applicationSubmission: validatedSubmission, government: submissionGovernment, @@ -303,7 +299,7 @@ export class ApplicationSubmissionController { if (submissionGovernment) { await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateSUBGGovernmentHtml, + template: subgGovernmentTemplate, status: SUBMISSION_STATUS.SUBMITTED_TO_LG, applicationSubmission: validatedSubmission, government: submissionGovernment, @@ -326,13 +322,13 @@ export class ApplicationSubmissionController { matchingType.code === APPLICATION_SUBMISSION_TYPES.TURP || matchingType.code === APPLICATION_SUBMISSION_TYPES.COVE ) { - const generateTemplateFunction = + const template = matchingType.code === APPLICATION_SUBMISSION_TYPES.TURP - ? generateSUBGTurApplicantHtml - : generateSUBGCoveApplicantHtml; + ? subgTurApplicantTemplate + : subgCoveApplicantTemplate; await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateTemplateFunction, + template: template, status: SUBMISSION_STATUS.SUBMITTED_TO_ALC, applicationSubmission: validatedSubmission, government: submissionGovernment, @@ -344,7 +340,7 @@ export class ApplicationSubmissionController { if (submissionGovernment) { await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateSUBGNoReviewGovernmentTemplateEmail, + template: subgNoReviewGovernmentTemplate, status: SUBMISSION_STATUS.SUBMITTED_TO_ALC, applicationSubmission: validatedSubmission, government: submissionGovernment, diff --git a/services/apps/alcs/src/portal/notice-of-intent-submission-draft/notice-of-intent-submission-draft.service.ts b/services/apps/alcs/src/portal/notice-of-intent-submission-draft/notice-of-intent-submission-draft.service.ts index 1c08aa6ba4..d53bf59f5b 100644 --- a/services/apps/alcs/src/portal/notice-of-intent-submission-draft/notice-of-intent-submission-draft.service.ts +++ b/services/apps/alcs/src/portal/notice-of-intent-submission-draft/notice-of-intent-submission-draft.service.ts @@ -2,7 +2,7 @@ import { BaseServiceException } from '@app/common/exceptions/base.exception'; import { BadRequestException, Injectable, Logger } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; -import { generateSUBMNoiGovernmentHtml } from '../../../../../templates/emails/submitted-to-alc/noi-government.template'; +import { template } from '../../../../../templates/emails/submitted-to-alc/noi-government.template'; import { PARENT_TYPE } from '../../alcs/card/card-subtask/card-subtask.dto'; import { LocalGovernmentService } from '../../alcs/local-government/local-government.service'; import { NOI_SUBMISSION_STATUS } from '../../alcs/notice-of-intent/notice-of-intent-submission-status/notice-of-intent-status.dto'; @@ -250,7 +250,7 @@ export class NoticeOfIntentSubmissionDraftService { if (submissionGovernment) { await this.statusEmailService.sendNoticeOfIntentStatusEmail({ - generateStatusHtml: generateSUBMNoiGovernmentHtml, + template, status: NOI_SUBMISSION_STATUS.SUBMITTED_TO_ALC, noticeOfIntentSubmission: savedDraft, government: submissionGovernment, diff --git a/services/apps/alcs/src/portal/notice-of-intent-submission/notice-of-intent-submission.controller.ts b/services/apps/alcs/src/portal/notice-of-intent-submission/notice-of-intent-submission.controller.ts index 74e4b68215..35aad3bd91 100644 --- a/services/apps/alcs/src/portal/notice-of-intent-submission/notice-of-intent-submission.controller.ts +++ b/services/apps/alcs/src/portal/notice-of-intent-submission/notice-of-intent-submission.controller.ts @@ -10,10 +10,8 @@ import { Req, UseGuards, } from '@nestjs/common'; -import { - generateSUBMNoiApplicantHtml, - generateSUBMNoiGovernmentHtml, -} from '../../../../../templates/emails/submitted-to-alc'; +import { template as submNoiApplicantTemplate } from '../../../../../templates/emails/submitted-to-alc/noi-applicant.template'; +import { template as submNoiGovernmentTemplate } from '../../../../../templates/emails/submitted-to-alc/noi-government.template'; import { PARENT_TYPE } from '../../alcs/card/card-subtask/card-subtask.dto'; import { LocalGovernmentService } from '../../alcs/local-government/local-government.service'; import { NOI_SUBMISSION_STATUS } from '../../alcs/notice-of-intent/notice-of-intent-submission-status/notice-of-intent-status.dto'; @@ -191,7 +189,7 @@ export class NoticeOfIntentSubmissionController { if (primaryContact) { await this.statusEmailService.sendNoticeOfIntentStatusEmail({ - generateStatusHtml: generateSUBMNoiApplicantHtml, + template: submNoiApplicantTemplate, status: NOI_SUBMISSION_STATUS.SUBMITTED_TO_ALC, noticeOfIntentSubmission, government: submissionGovernment, @@ -203,7 +201,7 @@ export class NoticeOfIntentSubmissionController { if (submissionGovernment) { await this.statusEmailService.sendNoticeOfIntentStatusEmail({ - generateStatusHtml: generateSUBMNoiGovernmentHtml, + template: submNoiGovernmentTemplate, status: NOI_SUBMISSION_STATUS.SUBMITTED_TO_ALC, noticeOfIntentSubmission, government: submissionGovernment, diff --git a/services/apps/alcs/src/portal/notification-submission/notification-submission.service.ts b/services/apps/alcs/src/portal/notification-submission/notification-submission.service.ts index 4b8f7c0bb6..f31aa220fb 100644 --- a/services/apps/alcs/src/portal/notification-submission/notification-submission.service.ts +++ b/services/apps/alcs/src/portal/notification-submission/notification-submission.service.ts @@ -11,7 +11,7 @@ import { Not, Repository, } from 'typeorm'; -import { generateSRWTemplate } from '../../../../../templates/emails/notifications/srw-notice.template'; +import { template } from '../../../../../templates/emails/notifications/srw-notice.template'; import { SUBMISSION_STATUS } from '../../alcs/application/application-submission-status/submission-status.dto'; import { PARENT_TYPE } from '../../alcs/card/card-subtask/card-subtask.dto'; import { LocalGovernmentService } from '../../alcs/local-government/local-government.service'; @@ -38,6 +38,7 @@ import { NotificationSubmissionUpdateDto, } from './notification-submission.dto'; import { NotificationSubmission } from './notification-submission.entity'; +import { compile } from 'handlebars'; @Injectable() export class NotificationSubmissionService { @@ -462,7 +463,7 @@ export class NotificationSubmissionService { submission.fileNumber, ); - const emailTemplate = generateSRWTemplate({ + const html = compile(template)({ fileNumber: submission.fileNumber, contactName: `${submission.contactFirstName} ${submission.contactLastName}`, status: 'ALC Response Sent', @@ -485,7 +486,7 @@ export class NotificationSubmissionService { } return { - html: emailTemplate.html, + html: html, cc: ccEmails, to: submission.contactEmail!, parentId: notification.uuid, diff --git a/services/apps/alcs/src/providers/email/status-email.service.ts b/services/apps/alcs/src/providers/email/status-email.service.ts index 9f01c965ea..261fece800 100644 --- a/services/apps/alcs/src/providers/email/status-email.service.ts +++ b/services/apps/alcs/src/providers/email/status-email.service.ts @@ -1,6 +1,5 @@ import { CONFIG_TOKEN, IConfig } from '@app/common/config/config.module'; import { Inject, Injectable, Logger, NotFoundException } from '@nestjs/common'; -import { MJMLParseResults } from 'mjml-core'; import { ApplicationDecisionV2Service } from '../../alcs/application-decision/application-decision-v2/application-decision/application-decision-v2.service'; import { ApplicationDecision } from '../../alcs/application-decision/application-decision.entity'; import { SUBMISSION_STATUS } from '../../alcs/application/application-submission-status/submission-status.dto'; @@ -20,6 +19,7 @@ import { NoticeOfIntentSubmission } from '../../portal/notice-of-intent-submissi import { NoticeOfIntentSubmissionService } from '../../portal/notice-of-intent-submission/notice-of-intent-submission.service'; import { FALLBACK_APPLICANT_NAME } from '../../utils/owner.constants'; import { EmailService } from './email.service'; +import { compile } from 'handlebars'; export interface StatusUpdateEmail { fileNumber: string; @@ -36,7 +36,7 @@ export type DocumentEmailData = { }; type BaseStatusEmailData = { - generateStatusHtml: MJMLParseResults; + template: string; government: LocalGovernment | null; parentType: PARENT_TYPE; ccGovernment?: boolean; @@ -182,7 +182,7 @@ export class StatusEmailService { const applicantName = data.applicationSubmission.applicant || FALLBACK_APPLICANT_NAME; - const emailTemplate = data.generateStatusHtml({ + const html = compile(data.template)({ fileNumber, applicantName, childType: @@ -198,7 +198,7 @@ export class StatusEmailService { const parentId = await this.applicationService.getUuid(fileNumber); return { - body: emailTemplate.html, + body: html, subject: `Agricultural Land Commission Application ID: ${fileNumber} (${applicantName})`, parentType: data.parentType, parentId, @@ -222,7 +222,7 @@ export class StatusEmailService { const applicantName = data.noticeOfIntentSubmission.applicant || FALLBACK_APPLICANT_NAME; - const emailTemplate = data.generateStatusHtml({ + const html = compile(data.template)({ fileNumber, applicantName, childType: @@ -238,7 +238,7 @@ export class StatusEmailService { const parentId = await this.noticeOfIntentService.getUuid(fileNumber); return { - body: emailTemplate.html, + body: html, subject: `Agricultural Land Commission NOI ID: ${fileNumber} (${applicantName})`, parentType: data.parentType, parentId, diff --git a/services/apps/alcs/src/queues/scheduler/application/decision-emails/decision-emails.consumer.ts b/services/apps/alcs/src/queues/scheduler/application/decision-emails/decision-emails.consumer.ts index c18abf7f7e..4e4cfc28e3 100644 --- a/services/apps/alcs/src/queues/scheduler/application/decision-emails/decision-emails.consumer.ts +++ b/services/apps/alcs/src/queues/scheduler/application/decision-emails/decision-emails.consumer.ts @@ -3,8 +3,8 @@ import { Logger } from '@nestjs/common'; import * as dayjs from 'dayjs'; import * as timezone from 'dayjs/plugin/timezone'; import * as utc from 'dayjs/plugin/utc'; -import { generateALCDApplicationHtml } from '../../../../../../../templates/emails/decision-released'; -import { generateREVAHtml } from '../../../../../../../templates/emails/under-review-by-alc.template'; +import { template as alcdApplicationTemplate } from '../../../../../../../templates/emails/decision-released/application.template'; +import { template as revaTemplate } from '../../../../../../../templates/emails/under-review-by-alc.template'; import { ApplicationDecisionV2Service } from '../../../../alcs/application-decision/application-decision-v2/application-decision/application-decision-v2.service'; import { ApplicationSubmissionStatusService } from '../../../../alcs/application/application-submission-status/application-submission-status.service'; import { SUBMISSION_STATUS } from '../../../../alcs/application/application-submission-status/submission-status.dto'; @@ -107,10 +107,10 @@ export class ApplicationDecisionEmailConsumer extends WorkerHost { applicationSubmission.status.statusTypeCode === submissionStatus.statusTypeCode ) { - const generateStatusHtml = + const template = submissionStatus.statusTypeCode === SUBMISSION_STATUS.ALC_DECISION - ? generateALCDApplicationHtml - : generateREVAHtml; + ? alcdApplicationTemplate + : revaTemplate; const documents = await this.statusEmailService.getApplicationDecisionDocuments( @@ -123,7 +123,7 @@ export class ApplicationDecisionEmailConsumer extends WorkerHost { parentType: PARENT_TYPE.APPLICATION, primaryContact, ccGovernment: true, - generateStatusHtml, + template, status: submissionStatus.statusTypeCode, documents, ccEmails, diff --git a/services/apps/alcs/src/queues/scheduler/application/status-emails/status-emails.consumer.ts b/services/apps/alcs/src/queues/scheduler/application/status-emails/status-emails.consumer.ts index 2a91c78931..685b7757a1 100644 --- a/services/apps/alcs/src/queues/scheduler/application/status-emails/status-emails.consumer.ts +++ b/services/apps/alcs/src/queues/scheduler/application/status-emails/status-emails.consumer.ts @@ -3,8 +3,8 @@ import { Logger } from '@nestjs/common'; import * as dayjs from 'dayjs'; import * as timezone from 'dayjs/plugin/timezone'; import * as utc from 'dayjs/plugin/utc'; -import { generateALCDApplicationHtml } from '../../../../../../../templates/emails/decision-released'; -import { generateREVAHtml } from '../../../../../../../templates/emails/under-review-by-alc.template'; +import { template as alcdApplicationTemplate } from '../../../../../../../templates/emails/decision-released/application.template'; +import { template as revaTemplate } from '../../../../../../../templates/emails/under-review-by-alc.template'; import { ApplicationSubmissionStatusService } from '../../../../alcs/application/application-submission-status/application-submission-status.service'; import { SUBMISSION_STATUS } from '../../../../alcs/application/application-submission-status/submission-status.dto'; import { ApplicationSubmissionToSubmissionStatus } from '../../../../alcs/application/application-submission-status/submission-status.entity'; @@ -89,10 +89,10 @@ export class ApplicationSubmissionStatusEmailConsumer extends WorkerHost { applicationSubmission.status.statusTypeCode === submissionStatus.statusTypeCode ) { - const generateStatusHtml = + const template = submissionStatus.statusTypeCode === SUBMISSION_STATUS.ALC_DECISION - ? generateALCDApplicationHtml - : generateREVAHtml; + ? alcdApplicationTemplate + : revaTemplate; const documents = submissionStatus.statusTypeCode === SUBMISSION_STATUS.ALC_DECISION @@ -105,7 +105,7 @@ export class ApplicationSubmissionStatusEmailConsumer extends WorkerHost { parentType: PARENT_TYPE.APPLICATION, primaryContact, ccGovernment: true, - generateStatusHtml, + template, status: submissionStatus.statusTypeCode, documents, ccEmails: [], diff --git a/services/apps/alcs/src/queues/scheduler/notice-of-intent/decision-emails.consumer.ts b/services/apps/alcs/src/queues/scheduler/notice-of-intent/decision-emails.consumer.ts index 7fbfb8262f..4bab122214 100644 --- a/services/apps/alcs/src/queues/scheduler/notice-of-intent/decision-emails.consumer.ts +++ b/services/apps/alcs/src/queues/scheduler/notice-of-intent/decision-emails.consumer.ts @@ -3,7 +3,7 @@ import { Logger } from '@nestjs/common'; import * as dayjs from 'dayjs'; import * as timezone from 'dayjs/plugin/timezone'; import * as utc from 'dayjs/plugin/utc'; -import { generateALCDNoticeOfIntentHtml } from '../../../../../../templates/emails/decision-released'; +import { template } from '../../../../../../templates/emails/decision-released/notice-of-intent.template'; import { PARENT_TYPE } from '../../../alcs/card/card-subtask/card-subtask.dto'; import { NoticeOfIntentDecisionV2Service } from '../../../alcs/notice-of-intent-decision/notice-of-intent-decision-v2/notice-of-intent-decision-v2.service'; import { NOI_SUBMISSION_STATUS } from '../../../alcs/notice-of-intent/notice-of-intent-submission-status/notice-of-intent-status.dto'; @@ -55,7 +55,7 @@ export class NoticeOfIntentDecisionEmailsConsumer extends WorkerHost { if (primaryContact) { await this.statusEmailService.sendNoticeOfIntentStatusEmail({ - generateStatusHtml: generateALCDNoticeOfIntentHtml, + template, status: NOI_SUBMISSION_STATUS.ALC_DECISION, noticeOfIntentSubmission: submission, government: submissionGovernment, diff --git a/services/libs/common/src/email-template-service/email-template.service.spec.ts b/services/libs/common/src/email-template-service/email-template.service.spec.ts deleted file mode 100644 index 7f5ac06ba2..0000000000 --- a/services/libs/common/src/email-template-service/email-template.service.spec.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { EmailTemplateService } from './email-template.service'; - -describe('EmailTemplateService', () => { - let service: EmailTemplateService; - - beforeEach(() => { - service = new EmailTemplateService(); - }); - - describe('generateEmailBase', () => { - it('should generate an email base from a template and data', () => { - const template = `Hello {{name}}`; - const data = { name: 'John Smith' }; - const options = {}; - - const result = service.generateEmailBase(template, data, options); - - expect(result.html).toBeDefined(); - expect(result.html).toContain('Hello John Smith'); - }); - }); -}); diff --git a/services/libs/common/src/email-template-service/email-template.service.ts b/services/libs/common/src/email-template-service/email-template.service.ts deleted file mode 100644 index 01f9b0f062..0000000000 --- a/services/libs/common/src/email-template-service/email-template.service.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { compile } from 'handlebars'; -import * as mjml2html from 'mjml'; -import { MJMLParseResults, MJMLParsingOptions } from 'mjml-core'; - -@Injectable() -export class EmailTemplateService { - generateEmailBase( - templateMjml: string, - data?: any, - options?: MJMLParsingOptions, - ): MJMLParseResults { - // prepare template - const compiledTemplate = compile(templateMjml); - - // insert data - const mjml = compiledTemplate(data); - - // render mjml -> html - const htmlOutput = mjml2html(mjml, options); - - return htmlOutput; - } -} diff --git a/services/templates/emails/cancelled/application.template.ts b/services/templates/emails/cancelled/application.template.ts index ed0b973d56..d8edeffeed 100644 --- a/services/templates/emails/cancelled/application.template.ts +++ b/services/templates/emails/cancelled/application.template.ts @@ -1,44 +1,12 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from '../partials'; - -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to advise that the above noted {{ childType }} application has been cancelled and will not be considered further. - - - If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateCANCApplicationHtml = ( - data: StatusUpdateEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; + +export const template = build( + `

+ This email is to advise that the above noted {{ childType }} application has been cancelled and will not be considered further. +

+

+ If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/cancelled/index.ts b/services/templates/emails/cancelled/index.ts deleted file mode 100644 index cf7fa6130d..0000000000 --- a/services/templates/emails/cancelled/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './application.template'; -export * from './notice-of-intent.template'; diff --git a/services/templates/emails/cancelled/notice-of-intent.template.ts b/services/templates/emails/cancelled/notice-of-intent.template.ts index e5923d0e48..f4b16692fa 100644 --- a/services/templates/emails/cancelled/notice-of-intent.template.ts +++ b/services/templates/emails/cancelled/notice-of-intent.template.ts @@ -1,44 +1,12 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from '../partials'; - -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to advise that the above noted {{ childType }} Notice of Intent has been cancelled and will not be considered further. - - - If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateCANCNoticeOfIntentHtml = ( - data: StatusUpdateEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; + +export const template = build( + `

+ This email is to advise that the above noted {{ childType }} Notice of Intent has been cancelled and will not be considered further. +

+

+ If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/decision-released/application.template.ts b/services/templates/emails/decision-released/application.template.ts index 2df5976c14..cd0ca456e2 100644 --- a/services/templates/emails/decision-released/application.template.ts +++ b/services/templates/emails/decision-released/application.template.ts @@ -1,67 +1,28 @@ -import { MJMLParseResults } from 'mjml-core'; -import { - DocumentEmailData, - StatusUpdateEmail, -} from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from '../partials'; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; -type DecisionReleasedStatusEmail = StatusUpdateEmail & { - documents: DocumentEmailData[]; -}; - -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to advise that the Reasons for Decision for the above noted application has been released. - - - You can access the decision document by clicking the link(s) below: - - -
    - {{#each documents}} -
  • {{name}}
  • - {{/each}} -
-
- - The decision can also be accessed via the ALC Portal and Public Search tool. - - - Further correspondence with respect to this application should be directed to the ALC Land Use Planner for your region, found on the ALC website Contact Us page. - - - If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise them of this, and any future, correspondence. - - ${notificationOnly} -
-
- - ${portalButton} - - ${footer()} -
-
-`; - -export const generateALCDApplicationHtml = ( - data: DecisionReleasedStatusEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +export const template = build( + `

+ This email is to advise that the Reasons for Decision for the above noted application has been released. +

+

+ You can access the decision document by clicking the link(s) below: +

+

+

+

+

+ The decision can also be accessed via the ALC Portal and Public Search tool. +

+

+ Further correspondence with respect to this application should be directed to the ALC Land Use Planner for your region, found on the ALC website Contact Us page. +

+

+ If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise them of this, and any future, correspondence. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/decision-released/index.ts b/services/templates/emails/decision-released/index.ts deleted file mode 100644 index cf7fa6130d..0000000000 --- a/services/templates/emails/decision-released/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './application.template'; -export * from './notice-of-intent.template'; diff --git a/services/templates/emails/decision-released/notice-of-intent.template.ts b/services/templates/emails/decision-released/notice-of-intent.template.ts index 2e4112ab62..1579fe3106 100644 --- a/services/templates/emails/decision-released/notice-of-intent.template.ts +++ b/services/templates/emails/decision-released/notice-of-intent.template.ts @@ -1,67 +1,28 @@ -import { MJMLParseResults } from 'mjml-core'; -import { - DocumentEmailData, - StatusUpdateEmail, -} from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { footer, header, notificationOnly, portalButton } from '../partials'; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; -type DecisionReleasedStatusEmail = StatusUpdateEmail & { - documents: DocumentEmailData[]; -}; - -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to advise that the Reasons for Decision for the above noted Notice of Intent (NOI) has been released. - - - You can access the decision document by clicking the link(s) below: - - -
    - {{#each documents}} -
  • {{name}}
  • - {{/each}} -
-
- - The decision can also be accessed via the ALC Portal and Public Search tool. - - - Further correspondence with respect to this NOI should be directed to ALC.Soil@gov.bc.ca. - - - If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise them of this, and any future, correspondence. - - ${notificationOnly} -
-
- - ${portalButton} - - ${footer()} -
-
-`; - -export const generateALCDNoticeOfIntentHtml = ( - data: DecisionReleasedStatusEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +export const template = build( + `

+ This email is to advise that the Reasons for Decision for the above noted Notice of Intent (NOI) has been released. +

+

+ You can access the decision document by clicking the link(s) below: +

+

+

+

+

+ The decision can also be accessed via the ALC Portal and Public Search tool. +

+

+ Further correspondence with respect to this NOI should be directed to ALC.Soil@gov.bc.ca. +

+

+ If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise them of this, and any future, correspondence. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/index.ts b/services/templates/emails/index.ts new file mode 100644 index 0000000000..b78297307e --- /dev/null +++ b/services/templates/emails/index.ts @@ -0,0 +1,13 @@ +import { header } from './partials/header.template'; +import { portalButton } from './partials/portal-button.template'; +import { footer } from './partials/footer.template'; + +export const build = ( + content: string, + includeButton: boolean = true, +): string => ` +${header} +${content} +${includeButton ? portalButton : ''} +${footer} +`; diff --git a/services/templates/emails/notifications/srw-notice.template.ts b/services/templates/emails/notifications/srw-notice.template.ts index 28a7c993d4..a7ab0f51ac 100644 --- a/services/templates/emails/notifications/srw-notice.template.ts +++ b/services/templates/emails/notifications/srw-notice.template.ts @@ -1,88 +1,29 @@ -import { MJMLParseResults } from 'mjml-core'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { footer } from '../partials'; -import * as config from 'config'; +import { build } from '..'; -type SrwNoticeTemplateData = { - contactName: string; - status: string; - dateSubmitted: string; - fileNumber: string; - submittersFileNumber: string; - fileName: string; -}; - -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - - - - Notification ID #SRW{{fileNumber}} - Primary Contact: {{contactName}} - Status: {{status}} - {{dateSubmitted}} - Submitter’s File Number: {{submittersFileNumber}} - - - - - - - - - - - The ALC's attached PDF response is proof that the notification of statutory right of way has been provided for a s. 218 Statutory Right of Way of the Land Title Act as required by s.18.1(2) of the Agricultural Land Commission Act. - - - The ALC's attached PDF response must be appended as an additional document to the LTSA SRW application package. - - - Disclaimer for Transferee(s): - - - This letter is not an approval to use, construct, or remove soil or place fill (including gravel) within the SRW, nor does it compel the ALC to approve construction in the SRW. An application or notice of intent must be submitted to the ALC before starting any construction, fill placement, or soil removal within the SRW. Please consult the ALC for direction. - - - Please refer to ALC Notification ID SRW{{fileNumber}} in all future correspondence with this office. If you are acting on behalf of the transferee, it is your responsibility to advise your client(s) of this, and any future, correspondence. - - - Further correspondence with respect to this notification should be directed to ALC.LUPRT@gov.bc.ca. - - - PROVINCIAL AGRICULTURAL LAND COMMISSION - - - Attachment: {{fileName}} - - - - - ${footer()} - - -`; - -export const generateSRWTemplate = ( - data: SrwNoticeTemplateData, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +export const template = build( + `

+ The ALC's attached PDF response is proof that the notification of statutory right of way has been provided for a s. 218 Statutory Right of Way of the Land Title Act as required by s.18.1(2) of the Agricultural Land Commission Act. +

+

+ The ALC's attached PDF response must be appended as an additional document to the LTSA SRW application package. +

+

+ Disclaimer for Transferee(s): +

+

+ This letter is not an approval to use, construct, or remove soil or place fill (including gravel) within the SRW, nor does it compel the ALC to approve construction in the SRW. An application or notice of intent must be submitted to the ALC before starting any construction, fill placement, or soil removal within the SRW. Please consult the ALC for direction. +

+

+ Please refer to ALC Notification ID SRW{{ fileNumber }} in all future correspondence with this office. If you are acting on behalf of the transferee, it is your responsibility to advise your client(s) of this, and any future, correspondence. +

+

+ Further correspondence with respect to this notification should be directed to ALC.LUPRT@gov.bc.ca. +

+

+ PROVINCIAL AGRICULTURAL LAND COMMISSION +

+

+ Attachment: {{fileName}} +

`, + false, +); diff --git a/services/templates/emails/partials/footer.template.ts b/services/templates/emails/partials/footer.template.ts index 0f045072d0..5a2b745ffb 100644 --- a/services/templates/emails/partials/footer.template.ts +++ b/services/templates/emails/partials/footer.template.ts @@ -1,15 +1,9 @@ import { v4 } from 'uuid'; -export const footer = () => ` - - - Provincial Agricultural Land Commission (gov.bc.ca) - - - Contact: 604-660-7000 - - - - ${v4()} - - `; +export const footer = ` + Provincial Agricultural Land Commission (gov.bc.ca) + Contact: 604-660-7000 + ${v4()} + + +`; diff --git a/services/templates/emails/partials/header.template.ts b/services/templates/emails/partials/header.template.ts index 21b652a49d..74849d9d10 100644 --- a/services/templates/emails/partials/header.template.ts +++ b/services/templates/emails/partials/header.template.ts @@ -1,21 +1,18 @@ import * as config from 'config'; export const header = ` - - - {{ parentTypeLabel }} ID #{{fileNumber}} - Name: {{applicantName}} - Status: {{status}} - - - - - - `; + + + + + + Document + + + {{ parentTypeLabel }} ID #{{ fileNumber }} + Name: {{ applicantName }} + Status: {{ status }} + +`; diff --git a/services/templates/emails/partials/index.ts b/services/templates/emails/partials/index.ts deleted file mode 100644 index d7b8faeabe..0000000000 --- a/services/templates/emails/partials/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './footer.template'; -export * from './header.template'; -export * from './notification-only.template'; -export * from './portal-button.template'; diff --git a/services/templates/emails/partials/notification-only.template.ts b/services/templates/emails/partials/notification-only.template.ts index e8c09a1140..5d6418d85a 100644 --- a/services/templates/emails/partials/notification-only.template.ts +++ b/services/templates/emails/partials/notification-only.template.ts @@ -1,5 +1,5 @@ export const notificationOnly = ` - +

This is an ALC Portal notification only. Please do not reply to this email. - - `; +

+`; diff --git a/services/templates/emails/partials/portal-button.template.ts b/services/templates/emails/partials/portal-button.template.ts index 1ec767e6da..8c8f358a61 100644 --- a/services/templates/emails/partials/portal-button.template.ts +++ b/services/templates/emails/partials/portal-button.template.ts @@ -1,18 +1,5 @@ import * as config from 'config'; export const portalButton = ` - - - - GO TO ALC PORTAL - - - - `; + GO TO ALC PORTAL +`; diff --git a/services/templates/emails/refused-to-forward.template.ts b/services/templates/emails/refused-to-forward.template.ts index bc6f348fab..efb1d68bba 100644 --- a/services/templates/emails/refused-to-forward.template.ts +++ b/services/templates/emails/refused-to-forward.template.ts @@ -1,48 +1,18 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from './partials'; +import { build } from '.'; +import { notificationOnly } from './partials/notification-only.template'; -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to advise that the above noted {{ childType }} application has been reviewed by the {{ governmentName }} which has determined not to forward your application to the Agricultural Land Commission for further review. - - - If you have any questions about this outcome, please contact {{ governmentName }}. - - - If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. - - - Login to the ALC Portal for further information on your application. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateRFFGHtml = (data: StatusUpdateEmail): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +export const template = build( + ` + This email is to advise that the above noted {{ childType }} application has been reviewed by the {{ governmentName }} which has determined not to forward your application to the Agricultural Land Commission for further review. + + + If you have any questions about this outcome, please contact {{ governmentName }}. + + + If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. + + + Login to the ALC Portal for further information on your application. + + ${notificationOnly}`, +); diff --git a/services/templates/emails/return-to-lfng/application.template.ts b/services/templates/emails/return-to-lfng/application.template.ts index 61b783b0f3..a2ac4e90b6 100644 --- a/services/templates/emails/return-to-lfng/application.template.ts +++ b/services/templates/emails/return-to-lfng/application.template.ts @@ -1,44 +1,12 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from '../partials'; - -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to advise that the {{ governmentName }}'s review of the above noted {{ childType }} application requires further attention. The ALC has returned the application to the {{ governmentName }} for their action. - - - Please login to the ALC Portal to view the ALC's comments for the {{ governmentName }}. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateINCGApplicationHtml = ( - data: StatusUpdateEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; + +export const template = build( + `

+ This email is to advise that the {{ governmentName }}'s review of the above noted {{ childType }} application requires further attention. The ALC has returned the application to the {{ governmentName }} for their action. +

+

+ Please login to the ALC Portal to view the ALC's comments for the {{ governmentName }}. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/return-to-lfng/index.ts b/services/templates/emails/return-to-lfng/index.ts deleted file mode 100644 index ca6d3dd119..0000000000 --- a/services/templates/emails/return-to-lfng/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './application.template'; diff --git a/services/templates/emails/returned-as-incomplete.template.ts b/services/templates/emails/returned-as-incomplete.template.ts index ccb5239507..90c46928a0 100644 --- a/services/templates/emails/returned-as-incomplete.template.ts +++ b/services/templates/emails/returned-as-incomplete.template.ts @@ -1,48 +1,18 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from './partials'; +import { build } from '.'; +import { notificationOnly } from './partials/notification-only.template'; -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to advise that the above noted {{ childType }} application is considered to be incomplete by the {{ governmentName }} and consequently it has been returned to the applicant. - - - Please login to the ALC Portal to view the comments left by the {{ governmentName }}. Please review, edit and re-submit the application. - - - NOTE: Re-submitted applications do not require an additional application fee. - - - If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateINCMHtml = (data: StatusUpdateEmail): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +export const template = build( + `

+ This email is to advise that the above noted {{ childType }} application is considered to be incomplete by the {{ governmentName }} and consequently it has been returned to the applicant. +

+

+ Please login to the ALC Portal to view the comments left by the {{ governmentName }}. Please review, edit and re-submit the application. +

+

+ NOTE: Re-submitted applications do not require an additional application fee. +

+

+ If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/submitted-to-alc/application.template.ts b/services/templates/emails/submitted-to-alc/application.template.ts index d84003778d..b222335710 100644 --- a/services/templates/emails/submitted-to-alc/application.template.ts +++ b/services/templates/emails/submitted-to-alc/application.template.ts @@ -1,109 +1,77 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from '../partials'; -import { appFees } from '../submitted-to-lfng'; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; +import { appFees } from '../submitted-to-lfng/applicant.template'; -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - Agricultural Land Commission {{ childType }} Application ID: {{ fileNumber }} ({{ applicantName }}) has been reviewed by the {{ governmentName }} and submitted to the Agricultural Land Commission for further review. - - - APPLICATION FEES - Payable to the Minister of Finance c/o the ALC - - - - Application Type - ALC Portion of Fee +export const template = build( + `

+ Agricultural Land Commission {{ childType }} Application ID: {{ fileNumber }} ({{ applicantName }}) has been reviewed by the {{ governmentName }} and submitted to the Agricultural Land Commission for further review. +

+

+ APPLICATION FEES - Payable to the Minister of Finance c/o the ALC +

+ + + + + + ${appFees + .map((a) => { + return ` + + + - ${appFees - .map((a) => { - return ` - - - - - `; - }) - .join('')} - - - This fee can be paid: -
    -
  1. Cheque: Made payable to the Minister of Finance c/o the ALC
  2. -
  3. Credit card: Over the phone or in-person
  4. -
-
- - Please include your assigned Application ID with your payment. - - - Mailing address: -
- Agricultural Land Commission -
- 201-4940 Canada Way -
- Burnaby, BC, Canada -
- V5G 4K6 -
-
- - Paying via telephone: -
- Tel: 604-660-7000 -
-
- - If you are making a long-distance call to a provincial government agency, you can place your call through Enquiry BC free of charge: -
- In Victoria call: 250-387-6121 -
- Elsewhere in BC call: 1-800-663-7867 -
-
- - The length of processing time for each application varies depending on the type of application, statutory requirements within the Agricultural Land Commission Act, information provided, necessity for site visit or applicant meetings, etc. - - - Please be advised that the Status of the application in the ALC Portal will update and a notification email will be sent out as the application moves through each stage of the application review process. Should the ALC Land Use Planner require any additional information or clarification regarding the application, they will contact you. Further information about the application process can be obtained from the ALC website. - - - If you are an agent acting on behalf of the applicant(s) / landowner(s), it is your responsibility to advise them of this, and any future, correspondence. - - - Please log into the ALC Portal for further updates on the application as it progresses. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateSUBMApplicationHtml = ( - data: StatusUpdateEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; + `; + }) + .join('')} +
Application TypeALC Portion of Fee
${a.type}$${a.fee}
${a.type}$${a.fee}
+

+ This fee can be paid: +

    +
  1. Cheque: Made payable to the Minister of Finance c/o the ALC
  2. +
  3. Credit card: Over the phone or in-person
  4. +
+

+

+ Please include your assigned Application ID with your payment. +

+

+ Mailing address: +
+ Agricultural Land Commission +
+ 201-4940 Canada Way +
+ Burnaby, BC, Canada +
+ V5G 4K6 +
+

+

+ Paying via telephone: +
+ Tel: 604-660-7000 +
+

+

+ If you are making a long-distance call to a provincial government agency, you can place your call through Enquiry BC free of charge: +
+ In Victoria call: 250-387-6121 +
+ Elsewhere in BC call: 1-800-663-7867 +
+

+

+ The length of processing time for each application varies depending on the type of application, statutory requirements within the Agricultural Land Commission Act, information provided, necessity for site visit or applicant meetings, etc. +

+

+ Please be advised that the Status of the application in the ALC Portal will update and a notification email will be sent out as the application moves through each stage of the application review process. Should the ALC Land Use Planner require any additional information or clarification regarding the application, they will contact you. Further information about the application process can be obtained from the ALC website. +

+

+ If you are an agent acting on behalf of the applicant(s) / landowner(s), it is your responsibility to advise them of this, and any future, correspondence. +

+

+ Please log into the ALC Portal for further updates on the application as it progresses. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/submitted-to-alc/cove-applicant.template.ts b/services/templates/emails/submitted-to-alc/cove-applicant.template.ts index 506b1cb247..c85c2b8fce 100644 --- a/services/templates/emails/submitted-to-alc/cove-applicant.template.ts +++ b/services/templates/emails/submitted-to-alc/cove-applicant.template.ts @@ -1,53 +1,21 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from '../partials'; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to acknowledge that the Agricultural Land Commission (ALC) is in receipt of the above noted {{ childType }} application. Please refer to the ALC Application ID in all future correspondence with this office. A copy of this application has been forwarded to the {{ governmentName }} for information purposes. - - - There is no application fee associated with registering a Restrictive Covenant. - - - Please be advised that the status of the application in the ALC Portal will update and a notification email will be sent out as the application moves through each stage of the application review process. Should the ALC Land Use Planner require any additional information or clarification regarding the application, they will contact you. Further information about the application process can be obtained from the ALC website. - - - If you are an agent acting on behalf of the applicant(s) / landowner(s), it is your responsibility to advise them of this, and any future, correspondence. - - - Please log into the ALC Portal for further updates on the application as it progresses. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateSUBGCoveApplicantHtml = ( - data: StatusUpdateEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +export const template = build( + `

+ This email is to acknowledge that the Agricultural Land Commission (ALC) is in receipt of the above noted {{ childType }} application. Please refer to the ALC Application ID in all future correspondence with this office. A copy of this application has been forwarded to the {{ governmentName }} for information purposes. +

+

+ There is no application fee associated with registering a Restrictive Covenant. +

+

+ Please be advised that the status of the application in the ALC Portal will update and a notification email will be sent out as the application moves through each stage of the application review process. Should the ALC Land Use Planner require any additional information or clarification regarding the application, they will contact you. Further information about the application process can be obtained from the ALC website. +

+

+ If you are an agent acting on behalf of the applicant(s) / landowner(s), it is your responsibility to advise them of this, and any future, correspondence. +

+

+ Please log into the ALC Portal for further updates on the application as it progresses. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/submitted-to-alc/index.ts b/services/templates/emails/submitted-to-alc/index.ts deleted file mode 100644 index b3862e78c7..0000000000 --- a/services/templates/emails/submitted-to-alc/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './application.template'; -export * from './noi-applicant.template'; -export * from './noi-government.template'; -export * from './tur-applicant.template'; -export * from './no-review-government.template'; diff --git a/services/templates/emails/submitted-to-alc/no-review-government.template.ts b/services/templates/emails/submitted-to-alc/no-review-government.template.ts index fd74535ec9..f763e95839 100644 --- a/services/templates/emails/submitted-to-alc/no-review-government.template.ts +++ b/services/templates/emails/submitted-to-alc/no-review-government.template.ts @@ -1,44 +1,12 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from '../partials'; - -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - Agricultural Land Commission {{ childType }} Application ID: {{ fileNumber }} ({{ applicantName }}) has been successfully submitted to the Agricultural Land Commission. A read-only copy of the application has been submitted to the {{ governmentName }} for informational purposes. Should the {{ governmentName }} wish to comment on the application, please submit comments directly to the ALC. - - - Please log into the ALC Portal to view the application. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateSUBGNoReviewGovernmentTemplateEmail = ( - data: StatusUpdateEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; + +export const template = build( + `

+ Agricultural Land Commission {{ childType }} Application ID: {{ fileNumber }} ({{ applicantName }}) has been successfully submitted to the Agricultural Land Commission. A read-only copy of the application has been submitted to the {{ governmentName }} for informational purposes. Should the {{ governmentName }} wish to comment on the application, please submit comments directly to the ALC. +

+

+ Please log into the ALC Portal to view the application. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/submitted-to-alc/noi-applicant.template.ts b/services/templates/emails/submitted-to-alc/noi-applicant.template.ts index 0601101c0a..e7dd98507a 100644 --- a/services/templates/emails/submitted-to-alc/noi-applicant.template.ts +++ b/services/templates/emails/submitted-to-alc/noi-applicant.template.ts @@ -1,7 +1,5 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from '../partials'; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; const noiFees = [ { type: 'Removal of Soil', fee: 150 }, @@ -9,100 +7,70 @@ const noiFees = [ { type: 'Placement of Fill/Removal of Soil', fee: 150 }, ]; -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to acknowledge that the Agricultural Land Commission (ALC) is in receipt of the above noted {{ childType }} Notice of Intent (NOI). Please refer to the ALC NOI ID in all future correspondence with this office. A copy of this NOI has been forwarded to the {{ governmentName }} for information purposes. - - - NOTICE OF INTENT FEES - Payable to the Minister of Finance c/o the ALC - - - - NOI Type - ALC Portion of Fee +export const template = build( + `

+ This email is to acknowledge that the Agricultural Land Commission (ALC) is in receipt of the above noted {{ childType }} Notice of Intent (NOI). Please refer to the ALC NOI ID in all future correspondence with this office. A copy of this NOI has been forwarded to the {{ governmentName }} for information purposes. +

+

+ NOTICE OF INTENT FEES - Payable to the Minister of Finance c/o the ALC +

+ + + + + + ${noiFees + .map((a) => { + return ` + + + - ${noiFees - .map((a) => { - return ` - - - - - `; - }) - .join('')} - - - This fee can be paid: -
    -
  1. Cheque: Made payable to the Minister of Finance c/o the ALC
  2. -
  3. Credit card: Over the phone or in-person
  4. -
-
- - Please include your assigned NOI ID with your payment. - - - Mailing address: -
- Agricultural Land Commission -
- 201-4940 Canada Way -
- Burnaby, BC, Canada -
- V5G 4K6 -
-
- - Paying via telephone: -
- Tel: 604-660-7000 -
-
- - If you are making a long-distance call to a provincial government agency, you can place your call through Enquiry BC free of charge: -
- In Victoria call: 250-387-6121 -
- Elsewhere in BC call: 1-800-663-7867 -
-
- - If you are an agent acting on behalf of the applicant(s) / landowner(s), it is your responsibility to advise them of this, and any future, correspondence. - - - Please log into the ALC Portal for further updates on the NOI as it progresses. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateSUBMNoiApplicantHtml = ( - data: StatusUpdateEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; + `; + }) + .join('')} +
NOI TypeALC Portion of Fee
${a.type}$${a.fee}
${a.type}$${a.fee}
+

+ This fee can be paid: +

    +
  1. Cheque: Made payable to the Minister of Finance c/o the ALC
  2. +
  3. Credit card: Over the phone or in-person
  4. +
+

+

+ Please include your assigned NOI ID with your payment. +

+

+ Mailing address: +
+ Agricultural Land Commission +
+ 201-4940 Canada Way +
+ Burnaby, BC, Canada +
+ V5G 4K6 +
+

+

+ Paying via telephone: +
+ Tel: 604-660-7000 +
+

+

+ If you are making a long-distance call to a provincial government agency, you can place your call through Enquiry BC free of charge: +
+ In Victoria call: 250-387-6121 +
+ Elsewhere in BC call: 1-800-663-7867 +
+

+

+ If you are an agent acting on behalf of the applicant(s) / landowner(s), it is your responsibility to advise them of this, and any future, correspondence. +

+

+ Please log into the ALC Portal for further updates on the NOI as it progresses. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/submitted-to-alc/noi-government.template.ts b/services/templates/emails/submitted-to-alc/noi-government.template.ts index 2f90db9f81..331820eec0 100644 --- a/services/templates/emails/submitted-to-alc/noi-government.template.ts +++ b/services/templates/emails/submitted-to-alc/noi-government.template.ts @@ -1,44 +1,12 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from '../partials'; - -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - Agricultural Land Commission {{ childType }} NOI ID: {{ fileNumber }} ({{ applicantName }}) has been successfully submitted to the Agricultural Land Commission. A read-only copy of the Notice of Intent (NOI) has been submitted to the {{ governmentName }} for informational purposes. Should the {{ governmentName}} wish to comment on the NOI, please submit comments directly to the ALC. - - - Please log into the ALC Portal to view the NOI. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateSUBMNoiGovernmentHtml = ( - data: StatusUpdateEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; + +export const template = build( + `

+ Agricultural Land Commission {{ childType }} NOI ID: {{ fileNumber }} ({{ applicantName }}) has been successfully submitted to the Agricultural Land Commission. A read-only copy of the Notice of Intent (NOI) has been submitted to the {{ governmentName }} for informational purposes. Should the {{ governmentName}} wish to comment on the NOI, please submit comments directly to the ALC. +

+

+ Please log into the ALC Portal to view the NOI. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/submitted-to-alc/tur-applicant.template.ts b/services/templates/emails/submitted-to-alc/tur-applicant.template.ts index 3fb5a21e0b..99c34b7bd3 100644 --- a/services/templates/emails/submitted-to-alc/tur-applicant.template.ts +++ b/services/templates/emails/submitted-to-alc/tur-applicant.template.ts @@ -1,96 +1,64 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from '../partials'; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to acknowledge that the Agricultural Land Commission (ALC) is in receipt of the above noted {{ childType }} application. Please refer to the ALC Application ID in all future correspondence with this office. A copy of this application has been forwarded to the {{ governmentName }} for information purposes. - - - APPLICATION FEES - Payable to the Minister of Finance c/o the ALC - - - - Application Type - Application Fee - - - Transportation, Utility, and Recreational Trail Uses - $1500 - - - - This fee can be paid: -
    -
  1. Cheque: Made payable to the Minister of Finance c/o the ALC
  2. -
  3. Credit card: Over the phone or in-person
  4. -
-
- - Please include your assigned Application ID with your payment. - - - Mailing address: -
- Agricultural Land Commission -
- 201-4940 Canada Way -
- Burnaby, BC, Canada -
- V5G 4K6 -
-
- - Paying via telephone: -
- Tel: 604-660-7000 -
-
- - If you are making a long-distance call to a provincial government agency, you can place your call through Enquiry BC free of charge: -
- In Victoria call: 250-387-6121 -
- Elsewhere in BC call: 1-800-663-7867 -
-
- - If you are an agent acting on behalf of the applicant(s) / landowner(s), it is your responsibility to advise them of this, and any future, correspondence. - - - Please log into the ALC Portal for further updates on the application as it progresses. - - ${notificationOnly} -
-
- - ${portalButton} - - ${footer()} -
-
-`; - -export const generateSUBGTurApplicantHtml = ( - data: StatusUpdateEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +export const template = build( + `

+ This email is to acknowledge that the Agricultural Land Commission (ALC) is in receipt of the above noted {{ childType }} application. Please refer to the ALC Application ID in all future correspondence with this office. A copy of this application has been forwarded to the {{ governmentName }} for information purposes. +

+

+ APPLICATION FEES - Payable to the Minister of Finance c/o the ALC +

+ + + + + + + + + +
Application TypeApplication Fee
Transportation, Utility, and Recreational Trail Uses$1500
+

+ This fee can be paid: +

    +
  1. Cheque: Made payable to the Minister of Finance c/o the ALC
  2. +
  3. Credit card: Over the phone or in-person
  4. +
+

+

+ Please include your assigned Application ID with your payment. +

+

+ Mailing address: +
+ Agricultural Land Commission +
+ 201-4940 Canada Way +
+ Burnaby, BC, Canada +
+ V5G 4K6 +
+

+

+ Paying via telephone: +
+ Tel: 604-660-7000 +
+

+

+ If you are making a long-distance call to a provincial government agency, you can place your call through Enquiry BC free of charge: +
+ In Victoria call: 250-387-6121 +
+ Elsewhere in BC call: 1-800-663-7867 +
+

+

+ If you are an agent acting on behalf of the applicant(s) / landowner(s), it is your responsibility to advise them of this, and any future, correspondence. +

+

+ Please log into the ALC Portal for further updates on the application as it progresses. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/submitted-to-lfng/applicant.template.ts b/services/templates/emails/submitted-to-lfng/applicant.template.ts index b31127e8fa..c5dcea267f 100644 --- a/services/templates/emails/submitted-to-lfng/applicant.template.ts +++ b/services/templates/emails/submitted-to-lfng/applicant.template.ts @@ -1,7 +1,5 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from '../partials'; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; export const appFees = [ { type: 'Exclusion', fee: 750 }, @@ -12,67 +10,35 @@ export const appFees = [ { type: 'Inclusion', fee: 0 }, ]; -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to acknowledge that you have submitted the above noted {{ childType }} application to the {{ governmentName }}. - - - - Application Type - {{ governmentName }} Portion of Fee - - ${appFees - .map((a) => { - return ` - - ${a.type} - $${a.fee} - - `; - }) - .join('')} - - - Contact the {{ governmentName }} for its payment options. Please include your assigned Application ID with your payment. - - - NOTE: There is no additional fee for re-submission if the {{ governmentName }} returns your application. - - - If you are an agent acting on behalf of the applicant(s) / landowner(s), it is your responsibility to advise them of this, and any future, correspondence. - - - Please log into the ALC Portal for further updates on the application as it progresses. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateSUBGApplicantHtml = ( - data: StatusUpdateEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +export const template = build(` +

This email is to acknowledge that you have submitted the above noted {{ childType }} application to the {{ governmentName }}. + + + + + + ${appFees + .map((a) => { + return ` + + + + + `; + }) + .join('')} +
Application Type{{ governmentName }} Portion of Fee
${a.type}$${a.fee}
+

+ Contact the {{ governmentName }} for its payment options. Please include your assigned Application ID with your payment. +

+

+ NOTE: There is no additional fee for re-submission if the {{ governmentName }} returns your application. +

+

+ If you are an agent acting on behalf of the applicant(s) / landowner(s), it is your responsibility to advise them of this, and any future, correspondence. +

+

+ Please log into the ALC Portal for further updates on the application as it progresses. +

+${notificationOnly} +`); diff --git a/services/templates/emails/submitted-to-lfng/government.template.ts b/services/templates/emails/submitted-to-lfng/government.template.ts index e355c79ba5..5eb5052a97 100644 --- a/services/templates/emails/submitted-to-lfng/government.template.ts +++ b/services/templates/emails/submitted-to-lfng/government.template.ts @@ -1,61 +1,30 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from '../partials'; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; import { appFees } from './applicant.template'; -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - Agricultural Land Commission {{ childType }} Application ID: {{ fileNumber }} ({{ applicantName }}) has been successfully submitted to the {{ governmentName }}. The Applicant has been instructed to contact the {{ governmentName }} for payment instructions regarding the applicable application fee. - - - - Application Type - {{ governmentName }} Portion of Fee - - ${appFees - .map((a) => { - return ` - - ${a.type} - $${a.fee} - - `; - }) - .join('')} - - - Please log into the ALC Portal to view the application. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateSUBGGovernmentHtml = ( - data: StatusUpdateEmail, -): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +export const template = build( + `

+ Agricultural Land Commission {{ childType }} Application ID: {{ fileNumber }} ({{ applicantName }}) has been successfully submitted to the {{ governmentName }}. The Applicant has been instructed to contact the {{ governmentName }} for payment instructions regarding the applicable application fee. +

+ + + + + + ${appFees + .map((a) => { + return ` + + + + + `; + }) + .join('')} +
Application Type{{ governmentName }} Portion of Fee
${a.type}$${a.fee}
+

+ Please log into the ALC Portal to view the application. +

+ ${notificationOnly} +`, +); diff --git a/services/templates/emails/submitted-to-lfng/index.ts b/services/templates/emails/submitted-to-lfng/index.ts deleted file mode 100644 index f15e9f56ce..0000000000 --- a/services/templates/emails/submitted-to-lfng/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './applicant.template'; -export * from './government.template'; diff --git a/services/templates/emails/under-review-by-alc.template.ts b/services/templates/emails/under-review-by-alc.template.ts index 9b015d0c75..e7971f417b 100644 --- a/services/templates/emails/under-review-by-alc.template.ts +++ b/services/templates/emails/under-review-by-alc.template.ts @@ -1,45 +1,15 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from './partials'; - -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - Your application is now under review by the ALC Commissioners. You may be contacted during this review period if additional information or clarification is required. No further action is required from you at this time. - - - If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. - - - Login to the ALC Portal for further updates on your application as it progresses through the application process. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateREVAHtml = (data: StatusUpdateEmail): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +import { build } from '.'; +import { notificationOnly } from './partials/notification-only.template'; + +export const template = build( + `

+ Your application is now under review by the ALC Commissioners. You may be contacted during this review period if additional information or clarification is required. No further action is required from you at this time. +

+

+ If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. +

+

+ Login to the ALC Portal for further updates on your application as it progresses through the application process. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/under-review-by-lfng.template.ts b/services/templates/emails/under-review-by-lfng.template.ts index c55b195685..55ca7836ab 100644 --- a/services/templates/emails/under-review-by-lfng.template.ts +++ b/services/templates/emails/under-review-by-lfng.template.ts @@ -1,48 +1,18 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from './partials'; +import { build } from '.'; +import { notificationOnly } from './partials/notification-only.template'; -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to advise that the above noted {{ childType }} application has been received by the {{ governmentName }} for review. - - - If you have not already done so, please contact the {{ governmentName }} to determine the preferred form of payment as the application may not be processed until payment is received. - - - If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. - - - Login to the ALC Portal for further updates on your application as it progresses through the application process. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateREVGHtml = (data: StatusUpdateEmail): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +export const template = build( + `

+ This email is to advise that the above noted {{ childType }} application has been received by the {{ governmentName }} for review. +

+

+ If you have not already done so, please contact the {{ governmentName }} to determine the preferred form of payment as the application may not be processed until payment is received. +

+

+ If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. +

+

+ Login to the ALC Portal for further updates on your application as it progresses through the application process. +

+ ${notificationOnly}`, +); diff --git a/services/templates/emails/wrong-lfng.template.ts b/services/templates/emails/wrong-lfng.template.ts index 6ddd3d5484..769d317b52 100644 --- a/services/templates/emails/wrong-lfng.template.ts +++ b/services/templates/emails/wrong-lfng.template.ts @@ -1,45 +1,15 @@ -import { MJMLParseResults } from 'mjml-core'; -import { StatusUpdateEmail } from '../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../libs/common/src/email-template-service/email-template.service'; -import { header, footer, notificationOnly, portalButton } from './partials'; - -const template = ` - - - .line-height div { - line-height: 24px !important; - } - - .align-left { - float: left !important; - } - - - - ${header} - - - - - This email is to advise that the above noted {{ childType }} application does not fall within the jurisdiction of the {{ governmentName }} and consequently it has been returned to the applicant. - - - Please login to the ALC Portal to select the correct Local or First Nation Government jurisdiction and re-submit the application. - - - If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. - - ${notificationOnly} - - - - ${portalButton} - - ${footer()} - - -`; - -export const generateWRNGHtml = (data: StatusUpdateEmail): MJMLParseResults => { - return new EmailTemplateService().generateEmailBase(template, data); -}; +import { build } from '.'; +import { notificationOnly } from './partials/notification-only.template'; + +export const template = build( + `

+ This email is to advise that the above noted {{ childType }} application does not fall within the jurisdiction of the {{ governmentName }} and consequently it has been returned to the applicant. +

+

+ Please login to the ALC Portal to select the correct Local or First Nation Government jurisdiction and re-submit the application. +

+

+ If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. +

+ ${notificationOnly}`, +); From 9e558d9053b2ccc1c5a77593ea910c31206e52f7 Mon Sep 17 00:00:00 2001 From: Tristan Slater <1631008+trslater@users.noreply.github.com> Date: Tue, 10 Sep 2024 08:48:50 -0700 Subject: [PATCH 2/5] Recreate templates --- .../emails/partials/footer.template.ts | 22 ++++++++++++-- .../emails/partials/header.template.ts | 30 +++++++++---------- .../emails/partials/masthead.template.ts | 22 ++++++++++++++ .../emails/partials/portal-button.template.ts | 2 +- .../emails/refused-to-forward.template.ts | 16 +++++----- .../submitted-to-alc/application.template.ts | 2 +- .../noi-applicant.template.ts | 2 +- .../tur-applicant.template.ts | 2 +- .../submitted-to-lfng/applicant.template.ts | 2 +- .../submitted-to-lfng/government.template.ts | 2 +- 10 files changed, 70 insertions(+), 32 deletions(-) create mode 100644 services/templates/emails/partials/masthead.template.ts diff --git a/services/templates/emails/partials/footer.template.ts b/services/templates/emails/partials/footer.template.ts index 5a2b745ffb..5c530b2693 100644 --- a/services/templates/emails/partials/footer.template.ts +++ b/services/templates/emails/partials/footer.template.ts @@ -1,9 +1,25 @@ import { v4 } from 'uuid'; export const footer = ` - Provincial Agricultural Land Commission (gov.bc.ca) - Contact: 604-660-7000 - ${v4()} + + + + + + + +
+ Provincial Agricultural Land Commission (gov.bc.ca) + + Contact: 604-660-7000 +
+ + ${v4()} + `; diff --git a/services/templates/emails/partials/header.template.ts b/services/templates/emails/partials/header.template.ts index 74849d9d10..7761a42de6 100644 --- a/services/templates/emails/partials/header.template.ts +++ b/services/templates/emails/partials/header.template.ts @@ -1,18 +1,18 @@ -import * as config from 'config'; +import { masthead } from './masthead.template'; export const header = ` - - - - - - Document - - - {{ parentTypeLabel }} ID #{{ fileNumber }} - Name: {{ applicantName }} - Status: {{ status }} - + + + + + + Document + + + + +
+ ${masthead} `; diff --git a/services/templates/emails/partials/masthead.template.ts b/services/templates/emails/partials/masthead.template.ts new file mode 100644 index 0000000000..cd5f6ce775 --- /dev/null +++ b/services/templates/emails/partials/masthead.template.ts @@ -0,0 +1,22 @@ +import * as config from 'config'; + +export const masthead = ` + + + + + +
+

{{ parentTypeLabel }} ID #{{ fileNumber }}

+

Name: {{ applicantName }}

+

Status: {{ status }}

+
+ + + + +
+ +
+
+`; diff --git a/services/templates/emails/partials/portal-button.template.ts b/services/templates/emails/partials/portal-button.template.ts index 8c8f358a61..699d88ea4e 100644 --- a/services/templates/emails/partials/portal-button.template.ts +++ b/services/templates/emails/partials/portal-button.template.ts @@ -1,5 +1,5 @@ import * as config from 'config'; export const portalButton = ` - GO TO ALC PORTAL + GO TO ALC PORTAL `; diff --git a/services/templates/emails/refused-to-forward.template.ts b/services/templates/emails/refused-to-forward.template.ts index efb1d68bba..48096122bf 100644 --- a/services/templates/emails/refused-to-forward.template.ts +++ b/services/templates/emails/refused-to-forward.template.ts @@ -2,17 +2,17 @@ import { build } from '.'; import { notificationOnly } from './partials/notification-only.template'; export const template = build( - ` + `

This email is to advise that the above noted {{ childType }} application has been reviewed by the {{ governmentName }} which has determined not to forward your application to the Agricultural Land Commission for further review. - - +

+

If you have any questions about this outcome, please contact {{ governmentName }}. - - +

+

If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence. - - +

+

Login to the ALC Portal for further information on your application. - +

${notificationOnly}`, ); diff --git a/services/templates/emails/submitted-to-alc/application.template.ts b/services/templates/emails/submitted-to-alc/application.template.ts index b222335710..00e7d4b87d 100644 --- a/services/templates/emails/submitted-to-alc/application.template.ts +++ b/services/templates/emails/submitted-to-alc/application.template.ts @@ -9,7 +9,7 @@ export const template = build(

APPLICATION FEES - Payable to the Minister of Finance c/o the ALC

- +
diff --git a/services/templates/emails/submitted-to-alc/noi-applicant.template.ts b/services/templates/emails/submitted-to-alc/noi-applicant.template.ts index e7dd98507a..bdad543e67 100644 --- a/services/templates/emails/submitted-to-alc/noi-applicant.template.ts +++ b/services/templates/emails/submitted-to-alc/noi-applicant.template.ts @@ -14,7 +14,7 @@ export const template = build(

NOTICE OF INTENT FEES - Payable to the Minister of Finance c/o the ALC

-
Application Type ALC Portion of Fee
+
diff --git a/services/templates/emails/submitted-to-alc/tur-applicant.template.ts b/services/templates/emails/submitted-to-alc/tur-applicant.template.ts index 99c34b7bd3..c86a93676b 100644 --- a/services/templates/emails/submitted-to-alc/tur-applicant.template.ts +++ b/services/templates/emails/submitted-to-alc/tur-applicant.template.ts @@ -8,7 +8,7 @@ export const template = build(

APPLICATION FEES - Payable to the Minister of Finance c/o the ALC

-
NOI Type ALC Portion of Fee
+
diff --git a/services/templates/emails/submitted-to-lfng/applicant.template.ts b/services/templates/emails/submitted-to-lfng/applicant.template.ts index c5dcea267f..64b92c6108 100644 --- a/services/templates/emails/submitted-to-lfng/applicant.template.ts +++ b/services/templates/emails/submitted-to-lfng/applicant.template.ts @@ -12,7 +12,7 @@ export const appFees = [ export const template = build(`

This email is to acknowledge that you have submitted the above noted {{ childType }} application to the {{ governmentName }}. -

Application Type Application Fee
+
diff --git a/services/templates/emails/submitted-to-lfng/government.template.ts b/services/templates/emails/submitted-to-lfng/government.template.ts index 5eb5052a97..553a3b1215 100644 --- a/services/templates/emails/submitted-to-lfng/government.template.ts +++ b/services/templates/emails/submitted-to-lfng/government.template.ts @@ -6,7 +6,7 @@ export const template = build( `

Agricultural Land Commission {{ childType }} Application ID: {{ fileNumber }} ({{ applicantName }}) has been successfully submitted to the {{ governmentName }}. The Applicant has been instructed to contact the {{ governmentName }} for payment instructions regarding the applicable application fee.

-
Application Type {{ governmentName }} Portion of Fee
+
From 421b5fe51c7dee63626b226dd570271f5b6d9700 Mon Sep 17 00:00:00 2001 From: Tristan Slater <1631008+trslater@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:00:11 -0700 Subject: [PATCH 3/5] Move fees table to partial --- .../emails/partials/fees-table.template.ts | 17 +++++++++++++++++ .../submitted-to-alc/application.template.ts | 18 ++---------------- .../submitted-to-alc/noi-applicant.template.ts | 18 ++---------------- .../submitted-to-alc/tur-applicant.template.ts | 16 ++++++---------- .../submitted-to-lfng/applicant.template.ts | 18 ++---------------- .../submitted-to-lfng/government.template.ts | 18 ++---------------- 6 files changed, 31 insertions(+), 74 deletions(-) create mode 100644 services/templates/emails/partials/fees-table.template.ts diff --git a/services/templates/emails/partials/fees-table.template.ts b/services/templates/emails/partials/fees-table.template.ts new file mode 100644 index 0000000000..5e7294c072 --- /dev/null +++ b/services/templates/emails/partials/fees-table.template.ts @@ -0,0 +1,17 @@ +export const feesTable = (typeHeading: string, feeHeading: string, feeData) => + `
Application Type {{ governmentName }} Portion of Fee
+ + + + + ${feeData + .map(({ type, fee }) => { + return ` + + + + + `; + }) + .join('')} +
${typeHeading}${feeHeading}
${type}$${fee}
`; diff --git a/services/templates/emails/submitted-to-alc/application.template.ts b/services/templates/emails/submitted-to-alc/application.template.ts index 00e7d4b87d..0003eb6146 100644 --- a/services/templates/emails/submitted-to-alc/application.template.ts +++ b/services/templates/emails/submitted-to-alc/application.template.ts @@ -1,4 +1,5 @@ import { build } from '..'; +import { feesTable } from '../partials/fees-table.template'; import { notificationOnly } from '../partials/notification-only.template'; import { appFees } from '../submitted-to-lfng/applicant.template'; @@ -9,22 +10,7 @@ export const template = build(

APPLICATION FEES - Payable to the Minister of Finance c/o the ALC

- - - - - - ${appFees - .map((a) => { - return ` - - - - - `; - }) - .join('')} -
Application TypeALC Portion of Fee
${a.type}$${a.fee}
+ ${feesTable('Application Type', 'ALC Portion of Fee', appFees)}

This fee can be paid:

    diff --git a/services/templates/emails/submitted-to-alc/noi-applicant.template.ts b/services/templates/emails/submitted-to-alc/noi-applicant.template.ts index bdad543e67..e90e99b813 100644 --- a/services/templates/emails/submitted-to-alc/noi-applicant.template.ts +++ b/services/templates/emails/submitted-to-alc/noi-applicant.template.ts @@ -1,4 +1,5 @@ import { build } from '..'; +import { feesTable } from '../partials/fees-table.template'; import { notificationOnly } from '../partials/notification-only.template'; const noiFees = [ @@ -14,22 +15,7 @@ export const template = build(

    NOTICE OF INTENT FEES - Payable to the Minister of Finance c/o the ALC

    - - - - - - ${noiFees - .map((a) => { - return ` - - - - - `; - }) - .join('')} -
    NOI TypeALC Portion of Fee
    ${a.type}$${a.fee}
    + ${feesTable('NOI Type', 'Fee', noiFees)}

    This fee can be paid:

      diff --git a/services/templates/emails/submitted-to-alc/tur-applicant.template.ts b/services/templates/emails/submitted-to-alc/tur-applicant.template.ts index c86a93676b..8a23ae5e1c 100644 --- a/services/templates/emails/submitted-to-alc/tur-applicant.template.ts +++ b/services/templates/emails/submitted-to-alc/tur-applicant.template.ts @@ -1,6 +1,11 @@ import { build } from '..'; +import { feesTable } from '../partials/fees-table.template'; import { notificationOnly } from '../partials/notification-only.template'; +const turFees = [ + { type: 'Transportation, Utility, and Recreational Trail Uses', fee: 1500 }, +]; + export const template = build( `

      This email is to acknowledge that the Agricultural Land Commission (ALC) is in receipt of the above noted {{ childType }} application. Please refer to the ALC Application ID in all future correspondence with this office. A copy of this application has been forwarded to the {{ governmentName }} for information purposes. @@ -8,16 +13,7 @@ export const template = build(

      APPLICATION FEES - Payable to the Minister of Finance c/o the ALC

      - - - - - - - - - -
      Application TypeApplication Fee
      Transportation, Utility, and Recreational Trail Uses$1500
      + ${feesTable('Application Type', 'Application Fee', turFees)}

      This fee can be paid:

        diff --git a/services/templates/emails/submitted-to-lfng/applicant.template.ts b/services/templates/emails/submitted-to-lfng/applicant.template.ts index 64b92c6108..a55833e5d5 100644 --- a/services/templates/emails/submitted-to-lfng/applicant.template.ts +++ b/services/templates/emails/submitted-to-lfng/applicant.template.ts @@ -1,4 +1,5 @@ import { build } from '..'; +import { feesTable } from '../partials/fees-table.template'; import { notificationOnly } from '../partials/notification-only.template'; export const appFees = [ @@ -12,22 +13,7 @@ export const appFees = [ export const template = build(`

        This email is to acknowledge that you have submitted the above noted {{ childType }} application to the {{ governmentName }}. - - - - - - ${appFees - .map((a) => { - return ` - - - - - `; - }) - .join('')} -
        Application Type{{ governmentName }} Portion of Fee
        ${a.type}$${a.fee}
        +${feesTable('Application Type', '{{ governmentName }} Portion of Fee', appFees)}

        Contact the {{ governmentName }} for its payment options. Please include your assigned Application ID with your payment.

        diff --git a/services/templates/emails/submitted-to-lfng/government.template.ts b/services/templates/emails/submitted-to-lfng/government.template.ts index 553a3b1215..ff87f1e6e0 100644 --- a/services/templates/emails/submitted-to-lfng/government.template.ts +++ b/services/templates/emails/submitted-to-lfng/government.template.ts @@ -1,4 +1,5 @@ import { build } from '..'; +import { feesTable } from '../partials/fees-table.template'; import { notificationOnly } from '../partials/notification-only.template'; import { appFees } from './applicant.template'; @@ -6,22 +7,7 @@ export const template = build( `

        Agricultural Land Commission {{ childType }} Application ID: {{ fileNumber }} ({{ applicantName }}) has been successfully submitted to the {{ governmentName }}. The Applicant has been instructed to contact the {{ governmentName }} for payment instructions regarding the applicable application fee.

        - - - - - - ${appFees - .map((a) => { - return ` - - - - - `; - }) - .join('')} -
        Application Type{{ governmentName }} Portion of Fee
        ${a.type}$${a.fee}
        + ${feesTable('Application Type', '{{ governmentName }} Portion of Fee', appFees)}

        Please log into the ALC Portal to view the application.

        From 6fd0d2bcb948fb68af4b2c2e32c1e9989b1ba3c6 Mon Sep 17 00:00:00 2001 From: Tristan Slater <1631008+trslater@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:08:22 -0700 Subject: [PATCH 4/5] Fix notification emails missing type label --- .../notification-submission/notification-submission.service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/services/apps/alcs/src/portal/notification-submission/notification-submission.service.ts b/services/apps/alcs/src/portal/notification-submission/notification-submission.service.ts index f31aa220fb..05bdc504ae 100644 --- a/services/apps/alcs/src/portal/notification-submission/notification-submission.service.ts +++ b/services/apps/alcs/src/portal/notification-submission/notification-submission.service.ts @@ -464,6 +464,7 @@ export class NotificationSubmissionService { ); const html = compile(template)({ + parentTypeLabel: 'Notification', fileNumber: submission.fileNumber, contactName: `${submission.contactFirstName} ${submission.contactLastName}`, status: 'ALC Response Sent', From e35407fab0a01526401da501f7250e3f7a9f619b Mon Sep 17 00:00:00 2001 From: Tristan Slater <1631008+trslater@users.noreply.github.com> Date: Wed, 11 Sep 2024 08:43:47 -0700 Subject: [PATCH 5/5] Fix tests --- .../application.controller.spec.ts | 4 ++-- ...ation-submission-review.controller.spec.ts | 16 ++++++------- .../application-submission.controller.spec.ts | 24 ++++++++----------- ...ce-of-intent-submission.controller.spec.ts | 10 ++++---- .../email/status-email.service.spec.ts | 7 +++--- .../decision-emails.consumer.spec.ts | 4 ++-- .../status-emails.consumer.spec.ts | 4 ++-- .../decision-emails.consumer.spec.ts | 4 ++-- 8 files changed, 33 insertions(+), 40 deletions(-) diff --git a/services/apps/alcs/src/alcs/application/application.controller.spec.ts b/services/apps/alcs/src/alcs/application/application.controller.spec.ts index f405cb677a..a357a686be 100644 --- a/services/apps/alcs/src/alcs/application/application.controller.spec.ts +++ b/services/apps/alcs/src/alcs/application/application.controller.spec.ts @@ -4,7 +4,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { classes } from 'automapper-classes'; import { AutomapperModule } from 'automapper-nestjs'; import { ClsService } from 'nestjs-cls'; -import { generateCANCApplicationHtml } from '../../../../../templates/emails/cancelled'; +import { template } from '../../../../../templates/emails/cancelled/application.template'; import { initApplicationMockEntity, initMockAssigneeDto, @@ -426,7 +426,7 @@ describe('ApplicationController', () => { 1, ); expect(statusEmailService.sendApplicationStatusEmail).toHaveBeenCalledWith({ - generateStatusHtml: generateCANCApplicationHtml, + template, status: SUBMISSION_STATUS.CANCELLED, applicationSubmission: mockApplicationSubmission, government: mockGovernment, diff --git a/services/apps/alcs/src/portal/application-submission-review/application-submission-review.controller.spec.ts b/services/apps/alcs/src/portal/application-submission-review/application-submission-review.controller.spec.ts index c478ea8e8b..1f148e110d 100644 --- a/services/apps/alcs/src/portal/application-submission-review/application-submission-review.controller.spec.ts +++ b/services/apps/alcs/src/portal/application-submission-review/application-submission-review.controller.spec.ts @@ -2,10 +2,10 @@ import { BaseServiceException } from '@app/common/exceptions/base.exception'; import { createMock, DeepMocked } from '@golevelup/nestjs-testing'; import { Test, TestingModule } from '@nestjs/testing'; import { ClsService } from 'nestjs-cls'; -import { generateRFFGHtml } from '../../../../../templates/emails/refused-to-forward.template'; -import { generateINCMHtml } from '../../../../../templates/emails/returned-as-incomplete.template'; -import { generateSUBMApplicationHtml } from '../../../../../templates/emails/submitted-to-alc'; -import { generateWRNGHtml } from '../../../../../templates/emails/wrong-lfng.template'; +import { template as rffgTemplate } from '../../../../../templates/emails/refused-to-forward.template'; +import { template as incmTemplate } from '../../../../../templates/emails/returned-as-incomplete.template'; +import { template as submApplicationTemplate } from '../../../../../templates/emails/submitted-to-alc/application.template'; +import { template as wrngTemplate } from '../../../../../templates/emails/wrong-lfng.template'; import { mockKeyCloakProviders } from '../../../test/mocks/mockTypes'; import { ApplicationDocument } from '../../alcs/application/application-document/application-document.entity'; import { ApplicationDocumentService } from '../../alcs/application/application-document/application-document.service'; @@ -381,7 +381,7 @@ describe('ApplicationSubmissionReviewController', () => { expect( mockStatusEmailService.sendApplicationStatusEmail, ).toHaveBeenCalledWith({ - generateStatusHtml: generateSUBMApplicationHtml, + template: submApplicationTemplate, status: SUBMISSION_STATUS.SUBMITTED_TO_ALC, applicationSubmission: mockSubmission, government: mockLG, @@ -456,7 +456,7 @@ describe('ApplicationSubmissionReviewController', () => { expect( mockStatusEmailService.sendApplicationStatusEmail, ).toHaveBeenCalledWith({ - generateStatusHtml: generateRFFGHtml, + template: rffgTemplate, status: SUBMISSION_STATUS.REFUSED_TO_FORWARD_LG, applicationSubmission: mockSubmission, government: mockLG, @@ -559,7 +559,7 @@ describe('ApplicationSubmissionReviewController', () => { expect( mockStatusEmailService.sendApplicationStatusEmail, ).toHaveBeenCalledWith({ - generateStatusHtml: generateINCMHtml, + template: incmTemplate, status: SUBMISSION_STATUS.INCOMPLETE, applicationSubmission: mockSubmission, government: mockLG, @@ -638,7 +638,7 @@ describe('ApplicationSubmissionReviewController', () => { expect( mockStatusEmailService.sendApplicationStatusEmail, ).toHaveBeenCalledWith({ - generateStatusHtml: generateWRNGHtml, + template: wrngTemplate, status: SUBMISSION_STATUS.WRONG_GOV, applicationSubmission: mockSubmission, government: mockLG, diff --git a/services/apps/alcs/src/portal/application-submission/application-submission.controller.spec.ts b/services/apps/alcs/src/portal/application-submission/application-submission.controller.spec.ts index b38578711d..5187dd10f1 100644 --- a/services/apps/alcs/src/portal/application-submission/application-submission.controller.spec.ts +++ b/services/apps/alcs/src/portal/application-submission/application-submission.controller.spec.ts @@ -5,15 +5,11 @@ import { classes } from 'automapper-classes'; import { AutomapperModule } from 'automapper-nestjs'; import { ClsService } from 'nestjs-cls'; import { ServiceValidationException } from '../../../../../libs/common/src/exceptions/base.exception'; -import { generateCANCApplicationHtml } from '../../../../../templates/emails/cancelled'; -import { - generateSUBGNoReviewGovernmentTemplateEmail, - generateSUBGTurApplicantHtml, -} from '../../../../../templates/emails/submitted-to-alc'; -import { - generateSUBGApplicantHtml, - generateSUBGGovernmentHtml, -} from '../../../../../templates/emails/submitted-to-lfng'; +import { template as cancApplicationTemplate } from '../../../../../templates/emails/cancelled/application.template'; +import { template as subgNoReviewGovernmentTemplate } from '../../../../../templates/emails/submitted-to-alc/no-review-government.template'; +import { template as subgTurApplicantTemplate } from '../../../../../templates/emails/submitted-to-alc/tur-applicant.template'; +import { template as subgApplicantTemplate } from '../../../../../templates/emails/submitted-to-lfng/applicant.template'; +import { template as subgGovernmentTemplate } from '../../../../../templates/emails/submitted-to-lfng/government.template'; import { mockKeyCloakProviders } from '../../../test/mocks/mockTypes'; import { ApplicationDocumentService } from '../../alcs/application/application-document/application-document.service'; import { ApplicationSubmissionStatusType } from '../../alcs/application/application-submission-status/submission-status-type.entity'; @@ -289,7 +285,7 @@ describe('ApplicationSubmissionController', () => { expect( mockStatusEmailService.sendApplicationStatusEmail, ).toHaveBeenCalledWith({ - generateStatusHtml: generateCANCApplicationHtml, + template: cancApplicationTemplate, status: SUBMISSION_STATUS.CANCELLED, applicationSubmission: mockApplication, government: mockGovernment, @@ -531,7 +527,7 @@ describe('ApplicationSubmissionController', () => { expect( mockStatusEmailService.sendApplicationStatusEmail, ).toHaveBeenCalledWith({ - generateStatusHtml: generateSUBGTurApplicantHtml, + template: subgTurApplicantTemplate, status: SUBMISSION_STATUS.SUBMITTED_TO_ALC, applicationSubmission: mockApplicationSubmission, government: mockGovernment, @@ -542,7 +538,7 @@ describe('ApplicationSubmissionController', () => { expect( mockStatusEmailService.sendApplicationStatusEmail, ).toHaveBeenCalledWith({ - generateStatusHtml: generateSUBGNoReviewGovernmentTemplateEmail, + template: subgNoReviewGovernmentTemplate, status: SUBMISSION_STATUS.SUBMITTED_TO_ALC, applicationSubmission: mockApplicationSubmission, government: mockGovernment, @@ -595,7 +591,7 @@ describe('ApplicationSubmissionController', () => { expect( mockStatusEmailService.sendApplicationStatusEmail, ).toHaveBeenCalledWith({ - generateStatusHtml: generateSUBGApplicantHtml, + template: subgApplicantTemplate, status: SUBMISSION_STATUS.SUBMITTED_TO_LG, applicationSubmission: mockApplicationSubmission, government: mockGovernment, @@ -606,7 +602,7 @@ describe('ApplicationSubmissionController', () => { expect( mockStatusEmailService.sendApplicationStatusEmail, ).toHaveBeenCalledWith({ - generateStatusHtml: generateSUBGGovernmentHtml, + template: subgGovernmentTemplate, status: SUBMISSION_STATUS.SUBMITTED_TO_LG, applicationSubmission: mockApplicationSubmission, government: mockGovernment, diff --git a/services/apps/alcs/src/portal/notice-of-intent-submission/notice-of-intent-submission.controller.spec.ts b/services/apps/alcs/src/portal/notice-of-intent-submission/notice-of-intent-submission.controller.spec.ts index 25872fffc6..ca45f4f055 100644 --- a/services/apps/alcs/src/portal/notice-of-intent-submission/notice-of-intent-submission.controller.spec.ts +++ b/services/apps/alcs/src/portal/notice-of-intent-submission/notice-of-intent-submission.controller.spec.ts @@ -4,10 +4,8 @@ import { Test, TestingModule } from '@nestjs/testing'; import { classes } from 'automapper-classes'; import { AutomapperModule } from 'automapper-nestjs'; import { ClsService } from 'nestjs-cls'; -import { - generateSUBMNoiApplicantHtml, - generateSUBMNoiGovernmentHtml, -} from '../../../../../templates/emails/submitted-to-alc'; +import { template as submNoiApplicantTemplate } from '../../../../../templates/emails/submitted-to-alc/noi-applicant.template'; +import { template as submNoiGovernmentTemplate } from '../../../../../templates/emails/submitted-to-alc/noi-government.template'; import { mockKeyCloakProviders } from '../../../test/mocks/mockTypes'; import { LocalGovernment } from '../../alcs/local-government/local-government.entity'; import { LocalGovernmentService } from '../../alcs/local-government/local-government.service'; @@ -391,7 +389,7 @@ describe('NoticeOfIntentSubmissionController', () => { expect( mockStatusEmailService.sendNoticeOfIntentStatusEmail, ).toHaveBeenCalledWith({ - generateStatusHtml: generateSUBMNoiApplicantHtml, + template: submNoiApplicantTemplate, status: NOI_SUBMISSION_STATUS.SUBMITTED_TO_ALC, noticeOfIntentSubmission: mockSubmission, government: mockGovernment, @@ -402,7 +400,7 @@ describe('NoticeOfIntentSubmissionController', () => { expect( mockStatusEmailService.sendNoticeOfIntentStatusEmail, ).toHaveBeenCalledWith({ - generateStatusHtml: generateSUBMNoiGovernmentHtml, + template: submNoiGovernmentTemplate, status: NOI_SUBMISSION_STATUS.SUBMITTED_TO_ALC, noticeOfIntentSubmission: mockSubmission, government: mockGovernment, diff --git a/services/apps/alcs/src/providers/email/status-email.service.spec.ts b/services/apps/alcs/src/providers/email/status-email.service.spec.ts index 00238d5b5c..659d0ba78f 100644 --- a/services/apps/alcs/src/providers/email/status-email.service.spec.ts +++ b/services/apps/alcs/src/providers/email/status-email.service.spec.ts @@ -2,7 +2,6 @@ import { CONFIG_TOKEN, ConfigModule } from '@app/common/config/config.module'; import { createMock, DeepMocked } from '@golevelup/nestjs-testing'; import { Test, TestingModule } from '@nestjs/testing'; import * as config from 'config'; -import { MJMLParseResults } from 'mjml-core'; import { ApplicationDecisionDocument } from '../../alcs/application-decision/application-decision-document/application-decision-document.entity'; import { ApplicationDecisionV2Service } from '../../alcs/application-decision/application-decision-v2/application-decision/application-decision-v2.service'; import { ApplicationDecision } from '../../alcs/application-decision/application-decision.entity'; @@ -225,7 +224,7 @@ describe('StatusEmailService', () => { it('should call through services to set application email template', async () => { const mockData: ApplicationEmailData = { - generateStatusHtml: () => ({}) as MJMLParseResults, + template: 'test', status: SUBMISSION_STATUS.IN_REVIEW_BY_LG, applicationSubmission: new ApplicationSubmission({ typeCode: 'TURP' }), parentType: 'application' as PARENT_TYPE, @@ -251,7 +250,7 @@ describe('StatusEmailService', () => { it('should call through services to set notice of intent email template', async () => { const mockData: NoticeOfIntentEmailData = { - generateStatusHtml: () => ({}) as MJMLParseResults, + template: 'test', status: NOI_SUBMISSION_STATUS.SUBMITTED_TO_ALC, noticeOfIntentSubmission: new NoticeOfIntentSubmission(), parentType: 'notice-of-intent' as PARENT_TYPE, @@ -280,7 +279,7 @@ describe('StatusEmailService', () => { it('should add CC emails to the send call', async () => { const ccEmails = ['bruce.wayne@fakeemail.com', 'iam.batman@fakeemail.com']; const mockData: NoticeOfIntentEmailData = { - generateStatusHtml: () => ({}) as MJMLParseResults, + template: 'test', status: NOI_SUBMISSION_STATUS.SUBMITTED_TO_ALC, noticeOfIntentSubmission: new NoticeOfIntentSubmission(), parentType: 'notice-of-intent' as PARENT_TYPE, diff --git a/services/apps/alcs/src/queues/scheduler/application/decision-emails/decision-emails.consumer.spec.ts b/services/apps/alcs/src/queues/scheduler/application/decision-emails/decision-emails.consumer.spec.ts index 3b45f3d0fe..8017f23d35 100644 --- a/services/apps/alcs/src/queues/scheduler/application/decision-emails/decision-emails.consumer.spec.ts +++ b/services/apps/alcs/src/queues/scheduler/application/decision-emails/decision-emails.consumer.spec.ts @@ -1,6 +1,6 @@ import { createMock, DeepMocked } from '@golevelup/nestjs-testing'; import { Test, TestingModule } from '@nestjs/testing'; -import { generateALCDApplicationHtml } from '../../../../../../../templates/emails/decision-released'; +import { template } from '../../../../../../../templates/emails/decision-released/application.template'; import { ApplicationDecisionV2Service } from '../../../../alcs/application-decision/application-decision-v2/application-decision/application-decision-v2.service'; import { ApplicationDecision } from '../../../../alcs/application-decision/application-decision.entity'; import { ApplicationSubmissionStatusService } from '../../../../alcs/application/application-submission-status/application-submission-status.service'; @@ -121,7 +121,7 @@ describe('ApplicationDecisionEmailConsumer', () => { parentType: PARENT_TYPE.APPLICATION, primaryContact: mockPrimaryContact, ccGovernment: true, - generateStatusHtml: generateALCDApplicationHtml, + template, status: SUBMISSION_STATUS.ALC_DECISION, documents: mockDocuments, }); diff --git a/services/apps/alcs/src/queues/scheduler/application/status-emails/status-emails.consumer.spec.ts b/services/apps/alcs/src/queues/scheduler/application/status-emails/status-emails.consumer.spec.ts index f0147cdb4d..783a81123e 100644 --- a/services/apps/alcs/src/queues/scheduler/application/status-emails/status-emails.consumer.spec.ts +++ b/services/apps/alcs/src/queues/scheduler/application/status-emails/status-emails.consumer.spec.ts @@ -1,6 +1,6 @@ import { createMock, DeepMocked } from '@golevelup/nestjs-testing'; import { Test, TestingModule } from '@nestjs/testing'; -import { generateREVAHtml } from '../../../../../../../templates/emails/under-review-by-alc.template'; +import { template } from '../../../../../../../templates/emails/under-review-by-alc.template'; import { ApplicationSubmissionStatusService } from '../../../../alcs/application/application-submission-status/application-submission-status.service'; import { SUBMISSION_STATUS } from '../../../../alcs/application/application-submission-status/submission-status.dto'; import { ApplicationSubmissionToSubmissionStatus } from '../../../../alcs/application/application-submission-status/submission-status.entity'; @@ -102,7 +102,7 @@ describe('ApplicationSubmissionStatusEmailConsumer', () => { parentType: PARENT_TYPE.APPLICATION, primaryContact: mockPrimaryContact, ccGovernment: true, - generateStatusHtml: generateREVAHtml, + template, status: SUBMISSION_STATUS.IN_REVIEW_BY_ALC, documents: [], ccEmails: [], diff --git a/services/apps/alcs/src/queues/scheduler/notice-of-intent/decision-emails.consumer.spec.ts b/services/apps/alcs/src/queues/scheduler/notice-of-intent/decision-emails.consumer.spec.ts index fde64828d9..1ae8df3154 100644 --- a/services/apps/alcs/src/queues/scheduler/notice-of-intent/decision-emails.consumer.spec.ts +++ b/services/apps/alcs/src/queues/scheduler/notice-of-intent/decision-emails.consumer.spec.ts @@ -1,6 +1,6 @@ import { createMock, DeepMocked } from '@golevelup/nestjs-testing'; import { Test, TestingModule } from '@nestjs/testing'; -import { generateALCDNoticeOfIntentHtml } from '../../../../../../templates/emails/decision-released'; +import { template } from '../../../../../../templates/emails/decision-released/notice-of-intent.template'; import { PARENT_TYPE } from '../../../alcs/card/card-subtask/card-subtask.dto'; import { LocalGovernment } from '../../../alcs/local-government/local-government.entity'; import { NoticeOfIntentDecisionV2Service } from '../../../alcs/notice-of-intent-decision/notice-of-intent-decision-v2/notice-of-intent-decision-v2.service'; @@ -108,7 +108,7 @@ describe('NoticeOfIntentDecisionEmailsConsumer', () => { parentType: PARENT_TYPE.NOTICE_OF_INTENT, primaryContact: mockPrimaryContact, ccGovernment: true, - generateStatusHtml: generateALCDNoticeOfIntentHtml, + template, status: NOI_SUBMISSION_STATUS.ALC_DECISION, documents: mockDocuments, });