Skip to content

Commit 22f34c8

Browse files
CCM-10283: Tempalte submitted email
1 parent 4f36f0f commit 22f34c8

File tree

69 files changed

+1492
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1492
-120
lines changed

frontend/package.json

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
11
{
2-
"name": "nhs-notify-web-template-management-frontend",
3-
"version": "0.1.0",
4-
"private": true,
5-
"scripts": {
6-
"dev": "next dev",
7-
"build": "next build",
8-
"start": "next start",
9-
"lint": "npm run mock-amplify-outputs && next lint --dir .",
10-
"lint:fix": "npm run lint -- --fix",
11-
"test:unit": "npm run mock-amplify-outputs && jest",
12-
"app:start": "pm2 start npm -- start",
13-
"app:wait": "wait-on -l http://localhost:3000/templates/create-and-submit-templates",
14-
"app:stop": "pm2 kill",
15-
"typecheck": "npm run mock-amplify-outputs && tsc --noEmit",
16-
"create-sandbox": "pm2 start npx -- ampx sandbox",
17-
"destroy-sandbox": "npx ampx sandbox delete --y",
18-
"mock-amplify-outputs": "if [ ! -f ./amplify_outputs.json ]; then echo \"{}\" > ./amplify_outputs.json ; fi"
19-
},
202
"dependencies": {
213
"@aws-amplify/adapter-nextjs": "^1.5.6",
224
"@aws-amplify/ui-react": "^6.9.4",
@@ -27,7 +9,6 @@
279
"jsonwebtoken": "^9.0.2",
2810
"jwt-decode": "^4.0.0",
2911
"markdown-it": "^13.0.2",
30-
"mimetext": "^3.0.27",
3112
"next": "^15.2.3",
3213
"next-client-cookies": "^2.0.1",
3314
"nhs-notify-backend-client": "^0.0.1",
@@ -67,5 +48,23 @@
6748
"typescript": "^5.8.2",
6849
"wait-on": "^8.0.3",
6950
"whatwg-fetch": "^3.6.20"
70-
}
51+
},
52+
"name": "nhs-notify-web-template-management-frontend",
53+
"private": true,
54+
"scripts": {
55+
"app:start": "pm2 start npm -- start",
56+
"app:stop": "pm2 kill",
57+
"app:wait": "wait-on -l http://localhost:3000/templates/create-and-submit-templates",
58+
"build": "next build",
59+
"create-sandbox": "pm2 start npx -- ampx sandbox",
60+
"destroy-sandbox": "npx ampx sandbox delete --y",
61+
"dev": "next dev",
62+
"lint": "npm run mock-amplify-outputs && next lint --dir .",
63+
"lint:fix": "npm run lint -- --fix",
64+
"mock-amplify-outputs": "if [ ! -f ./amplify_outputs.json ]; then echo \"{}\" > ./amplify_outputs.json ; fi",
65+
"start": "next start",
66+
"test:unit": "npm run mock-amplify-outputs && jest",
67+
"typecheck": "npm run mock-amplify-outputs && tsc --noEmit"
68+
},
69+
"version": "0.1.0"
7170
}

frontend/src/__tests__/components/molecules/PreviewTemplateDetails.test.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,21 @@ describe('PreviewTemplateDetailsLetter', () => {
149149
virusScanStatus: 'PASSED',
150150
},
151151
proofs: {
152-
'a.pdf': { fileName: 'a.pdf', virusScanStatus: 'PASSED' },
153-
'b.pdf': { fileName: 'b.pdf', virusScanStatus: 'PASSED' },
154-
'c.pdf': { fileName: 'c.pdf', virusScanStatus: 'FAILED' },
152+
'a.pdf': {
153+
fileName: 'a.pdf',
154+
virusScanStatus: 'PASSED',
155+
supplier: 'MBA',
156+
},
157+
'b.pdf': {
158+
fileName: 'b.pdf',
159+
virusScanStatus: 'PASSED',
160+
supplier: 'MBA',
161+
},
162+
'c.pdf': {
163+
fileName: 'c.pdf',
164+
virusScanStatus: 'FAILED',
165+
supplier: 'MBA',
166+
},
155167
},
156168
},
157169
createdAt: '2025-01-13T10:19:25.579Z',

frontend/src/__tests__/components/molecules/ViewLetterTemplate.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ describe('ViewLetterTemplate component', () => {
2626
'supplier-proof.pdf': {
2727
fileName: 'supplier-proof.pdf',
2828
virusScanStatus: 'PASSED',
29+
supplier: 'MBA',
2930
},
3031
},
3132
},

frontend/src/__tests__/components/organisms/PreviewLetterTemplate.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ describe('PreviewLetterTemplate component', () => {
101101
'your-proof.pdf': {
102102
fileName: 'your-proof.pdf',
103103
virusScanStatus: 'PASSED',
104+
supplier: 'MBA',
104105
},
105106
},
106107
},
@@ -133,6 +134,7 @@ describe('PreviewLetterTemplate component', () => {
133134
'your-proof.pdf': {
134135
fileName: 'your-proof.pdf',
135136
virusScanStatus: 'PASSED',
137+
supplier: 'MBA',
136138
},
137139
},
138140
},

infrastructure/terraform/components/acct/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
| <a name="module_s3bucket_artefacts_us_east_1"></a> [s3bucket\_artefacts\_us\_east\_1](#module\_s3bucket\_artefacts\_us\_east\_1) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v2.0.2 |
4141
| <a name="module_s3bucket_backup_reports"></a> [s3bucket\_backup\_reports](#module\_s3bucket\_backup\_reports) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v1.0.8 |
4242
| <a name="module_s3bucket_data_migration_backups"></a> [s3bucket\_data\_migration\_backups](#module\_s3bucket\_data\_migration\_backups) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v2.0.4 |
43+
| <a name="module_sandbox_ses"></a> [sandbox\_ses](#module\_sandbox\_ses) | ../../modules/ses | n/a |
4344
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | 5.19.0 |
4445
## Outputs
4546

infrastructure/terraform/components/acct/module_sandbox_kms.tf

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,56 @@ data "aws_iam_policy_document" "kms" {
5555
}
5656
}
5757

58+
statement {
59+
sid = "AllowS3"
60+
effect = "Allow"
61+
62+
principals {
63+
type = "Service"
64+
65+
identifiers = [
66+
"s3.amazonaws.com",
67+
]
68+
}
69+
70+
actions = [
71+
"kms:Encrypt*",
72+
"kms:Decrypt*",
73+
"kms:ReEncrypt*",
74+
"kms:GenerateDataKey*",
75+
"kms:Describe*"
76+
]
77+
78+
resources = [
79+
"*",
80+
]
81+
}
82+
83+
statement {
84+
sid = "AllowSES"
85+
effect = "Allow"
86+
87+
principals {
88+
type = "Service"
89+
90+
identifiers = [
91+
"ses.amazonaws.com",
92+
]
93+
}
94+
95+
actions = [
96+
"kms:Encrypt*",
97+
"kms:Decrypt*",
98+
"kms:ReEncrypt*",
99+
"kms:GenerateDataKey*",
100+
"kms:Describe*"
101+
]
102+
103+
resources = [
104+
"*",
105+
]
106+
}
107+
58108
statement {
59109
sid = "AllowLogDeliveryEncrypt"
60110
effect = "Allow"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module "sandbox_ses" {
2+
source = "../../modules/ses"
3+
4+
count = var.support_sandbox_environments ? 1 : 0
5+
6+
aws_account_id = var.aws_account_id
7+
region = var.region
8+
project = var.project
9+
environment = var.environment
10+
component = var.component
11+
12+
kms_key_arn = module.kms_sandbox.0.key_arn
13+
14+
root_domain_name = "sandbox.${aws_route53_zone.main.name}"
15+
16+
zone_id = aws_route53_zone.main.id
17+
18+
use_sftp_letter_supplier_mock = local.use_sftp_letter_supplier_mock
19+
}

infrastructure/terraform/components/app/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
| <a name="input_external_email_domain"></a> [external\_email\_domain](#input\_external\_email\_domain) | Externally managed domain used to create an SES identity for sending emails from. Validation DNS records will need to be manually configured in the DNS provider. | `string` | `null` | no |
3838
| <a name="input_group"></a> [group](#input\_group) | The group variables are being inherited from (often synonmous with account short-name) | `string` | n/a | yes |
3939
| <a name="input_kms_deletion_window"></a> [kms\_deletion\_window](#input\_kms\_deletion\_window) | When a kms key is deleted, how long should it wait in the pending deletion state? | `string` | `"30"` | no |
40-
| <a name="input_letter_suppliers"></a> [letter\_suppliers](#input\_letter\_suppliers) | Letter suppliers enabled in the environment | <pre>map(object({<br/> enable_polling = bool<br/> default_supplier = optional(bool)<br/> }))</pre> | `{}` | no |
40+
| <a name="input_letter_suppliers"></a> [letter\_suppliers](#input\_letter\_suppliers) | Letter suppliers enabled in the environment | <pre>map(object({<br/> email_addresses = list(string)<br/> enable_polling = bool<br/> default_supplier = optional(bool)<br/> }))</pre> | `{}` | no |
4141
| <a name="input_log_retention_in_days"></a> [log\_retention\_in\_days](#input\_log\_retention\_in\_days) | The retention period in days for the Cloudwatch Logs events to be retained, default of 0 is indefinite | `number` | `0` | no |
4242
| <a name="input_observability_account_id"></a> [observability\_account\_id](#input\_observability\_account\_id) | The Observability Account ID that needs access | `string` | n/a | yes |
4343
| <a name="input_parent_acct_environment"></a> [parent\_acct\_environment](#input\_parent\_acct\_environment) | Name of the environment responsible for the acct resources used, affects things like DNS zone. Useful for named dev environments | `string` | `"main"` | no |
@@ -57,6 +57,7 @@
5757
| <a name="module_kms_us_east_1"></a> [kms\_us\_east\_1](#module\_kms\_us\_east\_1) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/kms | v1.0.8 |
5858
| <a name="module_nhse_backup_vault"></a> [nhse\_backup\_vault](#module\_nhse\_backup\_vault) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/aws-backup-source | v2.0.12 |
5959
| <a name="module_s3bucket_cf_logs"></a> [s3bucket\_cf\_logs](#module\_s3bucket\_cf\_logs) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v2.0.2 |
60+
| <a name="module_ses"></a> [ses](#module\_ses) | ../../modules/ses | n/a |
6061
## Outputs
6162

6263
| Name | Description |

infrastructure/terraform/components/app/locals.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@ locals {
22
cloudfront_files_domain_name = "files.${local.root_domain_name}"
33
root_domain_name = "${var.environment}.${local.acct.dns_zone["name"]}"
44
lambdas_source_code_dir = "../../../../lambdas"
5+
6+
mock_letter_supplier_name = "WTMMOCK"
7+
8+
use_sftp_letter_supplier_mock = lookup(var.letter_suppliers, local.mock_letter_supplier_name, null) != null
59
}

infrastructure/terraform/components/app/module_backend_api.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,9 @@ module "backend_api" {
2727
log_subscription_role_arn = local.acct.log_subscription_role_arn
2828

2929
send_to_firehose = true
30+
31+
email_domain = module.ses.domain
32+
33+
mock_letter_supplier_name = local.mock_letter_supplier_name
34+
use_sftp_letter_supplier_mock = lookup(var.letter_suppliers, local.mock_letter_supplier_name, null) != null
3035
}

0 commit comments

Comments
 (0)