Skip to content

Commit e00ed76

Browse files
committed
Merge branch 'main' into feature/CCM-6834_remove-placeholder-page
2 parents 7cf1acb + 603ec7d commit e00ed76

File tree

82 files changed

+1561
-146
lines changed

Some content is hidden

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

82 files changed

+1561
-146
lines changed

.github/workflows/stage-2-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ on:
3535
env:
3636
AWS_REGION: eu-west-2
3737
TERM: xterm-256color
38+
NEXT_PUBLIC_ENABLE_LETTERS: true
3839

3940
permissions:
4041
id-token: write # This is required for requesting the JWT

.github/workflows/stage-4-acceptance.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ on:
3434

3535
env:
3636
AWS_REGION: eu-west-2
37+
NEXT_PUBLIC_ENABLE_LETTERS: true
3738

3839
permissions:
3940
id-token: write # This is required for requesting the JWT

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pre-commit 3.6.0
44
terraform 1.9.2
55
vale 3.6.0
66
tfsec 1.28.10
7-
nodejs 20.13.1
7+
nodejs 20.18.2
88

99
# ==============================================================================
1010
# The section below is reserved for Docker image versions.

frontend/.env.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# Includes auth pages when building web frontend in production mode.
22
INCLUDE_AUTH_PAGES=''
3+
# Enables letters feature flag
4+
NEXT_PUBLIC_ENABLE_LETTERS=''

frontend/jest.setup.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// https://nextjs.org/docs/app/building-your-application/testing/jest#optional-extend-jest-with-custom-matchers
22
import '@testing-library/jest-dom';
33
import { TextEncoder, TextDecoder } from 'node:util';
4+
import { createMocks } from 'react-idle-timer';
5+
46
/*
57
* A polyfill for fetch API which includes the Request object
68
* this helps solve the issue of the test throwing an error if the `getAmplifyBackendClient` is not mocked out.
@@ -9,3 +11,5 @@ import { TextEncoder, TextDecoder } from 'node:util';
911
import 'whatwg-fetch';
1012

1113
Object.assign(global, { TextDecoder, TextEncoder });
14+
15+
createMocks();

frontend/next.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,23 @@ const nextConfig = (phase) => {
3636
basePath: false,
3737
permanent: false,
3838
},
39+
{
40+
source: `${basePath}/auth/inactive`,
41+
destination: '/auth/inactive',
42+
permanent: false,
43+
basePath: false,
44+
},
3945
];
4046
},
4147

4248
async rewrites() {
4349
if (includeAuthPages) {
4450
return [
51+
{
52+
source: '/auth/inactive',
53+
destination: `http://${domain}${basePath}/auth/idle`,
54+
basePath: false,
55+
},
4556
{
4657
source: '/auth/signout',
4758
destination: `http://${domain}${basePath}/auth/signout`,

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"path": "^0.12.7",
3737
"react": "^19.0.0",
3838
"react-dom": "^19.0.0",
39+
"react-idle-timer": "^5.7.2",
3940
"zod": "^3.23.8"
4041
},
4142
"devDependencies": {

frontend/src/__tests__/app/choose-a-template-type/__snapshots__/page.test.tsx.snap

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,163 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`ChooseATemplateTypePage - LETTER option is hidden when feature flag is not enabled 1`] = `
4+
<DocumentFragment>
5+
<div
6+
class="nhsuk-back-link"
7+
>
8+
<a
9+
class="nhsuk-back-link__link"
10+
href="/templates/manage-templates"
11+
>
12+
<svg
13+
aria-hidden="true"
14+
class="nhsuk-icon nhsuk-icon__chevron-left"
15+
height="24"
16+
viewBox="0 0 24 24"
17+
width="24"
18+
xmlns="http://www.w3.org/2000/svg"
19+
>
20+
<path
21+
d="M8.5 12c0-.3.1-.5.3-.7l5-5c.4-.4 1-.4 1.4 0s.4 1 0 1.4L10.9 12l4.3 4.3c.4.4.4 1 0 1.4s-1 .4-1.4 0l-5-5c-.2-.2-.3-.4-.3-.7z"
22+
/>
23+
</svg>
24+
Back to all templates
25+
</a>
26+
</div>
27+
<main
28+
class="nhsuk-main-wrapper"
29+
id="maincontent"
30+
role="main"
31+
>
32+
<form
33+
action="/action"
34+
>
35+
<input
36+
name="form-id"
37+
readonly=""
38+
type="hidden"
39+
value="choose-a-template-type"
40+
/>
41+
<input
42+
name="csrf_token"
43+
readonly=""
44+
type="hidden"
45+
value="no_token"
46+
/>
47+
<div
48+
class="nhsuk-form-group"
49+
>
50+
<fieldset
51+
class="nhsuk-fieldset"
52+
>
53+
<legend
54+
class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l"
55+
data-testid="templateType-form__legend"
56+
>
57+
<h1
58+
class="nhsuk-fieldset__heading"
59+
>
60+
Choose a template type to create
61+
</h1>
62+
</legend>
63+
<p>
64+
<a
65+
href="/features"
66+
rel="noopener noreferrer"
67+
target="_blank"
68+
>
69+
Learn more about message channels (opens in a new tab)
70+
</a>
71+
</p>
72+
<div
73+
class="nhsuk-form-group"
74+
>
75+
<div
76+
class="nhsuk-hint"
77+
id="templateType--hint"
78+
>
79+
Select one option
80+
</div>
81+
<div
82+
aria-describedby="templateType--hint"
83+
class="nhsuk-radios"
84+
id="templateType"
85+
>
86+
<div
87+
class="nhsuk-radios__item"
88+
>
89+
<input
90+
class="nhsuk-radios__input"
91+
data-testid="NHS_APP-radio"
92+
id="templateType-NHS_APP"
93+
name="templateType"
94+
type="radio"
95+
value="NHS_APP"
96+
/>
97+
<label
98+
class="nhsuk-label nhsuk-radios__label"
99+
for="templateType-NHS_APP"
100+
id="templateType-NHS_APP--label"
101+
>
102+
NHS App message
103+
</label>
104+
</div>
105+
<div
106+
class="nhsuk-radios__item"
107+
>
108+
<input
109+
class="nhsuk-radios__input"
110+
data-testid="EMAIL-radio"
111+
id="templateType-EMAIL"
112+
name="templateType"
113+
type="radio"
114+
value="EMAIL"
115+
/>
116+
<label
117+
class="nhsuk-label nhsuk-radios__label"
118+
for="templateType-EMAIL"
119+
id="templateType-EMAIL--label"
120+
>
121+
Email
122+
</label>
123+
</div>
124+
<div
125+
class="nhsuk-radios__item"
126+
>
127+
<input
128+
class="nhsuk-radios__input"
129+
data-testid="SMS-radio"
130+
id="templateType-SMS"
131+
name="templateType"
132+
type="radio"
133+
value="SMS"
134+
/>
135+
<label
136+
class="nhsuk-label nhsuk-radios__label"
137+
for="templateType-SMS"
138+
id="templateType-SMS--label"
139+
>
140+
Text message (SMS)
141+
</label>
142+
</div>
143+
</div>
144+
</div>
145+
</fieldset>
146+
</div>
147+
<button
148+
aria-disabled="false"
149+
class="nhsuk-button"
150+
data-testid="submit-button"
151+
id="choose-a-template-type-submit-button"
152+
type="submit"
153+
>
154+
Continue
155+
</button>
156+
</form>
157+
</main>
158+
</DocumentFragment>
159+
`;
160+
3161
exports[`ChooseATemplateTypePage 1`] = `
4162
<DocumentFragment>
5163
<div
@@ -140,6 +298,25 @@ exports[`ChooseATemplateTypePage 1`] = `
140298
Text message (SMS)
141299
</label>
142300
</div>
301+
<div
302+
class="nhsuk-radios__item"
303+
>
304+
<input
305+
class="nhsuk-radios__input"
306+
data-testid="LETTER-radio"
307+
id="templateType-LETTER"
308+
name="templateType"
309+
type="radio"
310+
value="LETTER"
311+
/>
312+
<label
313+
class="nhsuk-label nhsuk-radios__label"
314+
for="templateType-LETTER"
315+
id="templateType-LETTER--label"
316+
>
317+
Letter
318+
</label>
319+
</div>
143320
</div>
144321
</div>
145322
</fieldset>

frontend/src/__tests__/app/choose-a-template-type/page.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,13 @@ test('ChooseATemplateTypePage', async () => {
3535

3636
expect(container.asFragment()).toMatchSnapshot();
3737
});
38+
39+
test('ChooseATemplateTypePage - LETTER option is hidden when feature flag is not enabled', async () => {
40+
process.env.NEXT_PUBLIC_ENABLE_LETTERS = 'false';
41+
42+
const page = await ChooseATemplateTypePage();
43+
44+
const container = render(page);
45+
46+
expect(container.asFragment()).toMatchSnapshot();
47+
});

frontend/src/__tests__/app/copy-template/page.test.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ const getTemplateMock = jest.mocked(getTemplate);
2121
describe('CopyTemplatePage', () => {
2222
beforeEach(jest.resetAllMocks);
2323

24-
it('should load page', async () => {
25-
const template: TemplateDTO = {
26-
id: 'template-id',
27-
templateType: TemplateType.EMAIL,
28-
templateStatus: TemplateStatus.NOT_YET_SUBMITTED,
29-
name: 'template-name',
30-
subject: 'template-subject-line',
31-
message: 'template-message',
32-
createdAt: '2025-01-13T10:19:25.579Z',
33-
updatedAt: '2025-01-13T10:19:25.579Z',
34-
};
24+
const template: TemplateDTO = {
25+
id: 'template-id',
26+
templateType: TemplateType.EMAIL,
27+
templateStatus: TemplateStatus.NOT_YET_SUBMITTED,
28+
name: 'template-name',
29+
subject: 'template-subject-line',
30+
message: 'template-message',
31+
createdAt: '2025-01-13T10:19:25.579Z',
32+
updatedAt: '2025-01-13T10:19:25.579Z',
33+
};
3534

35+
it('should load page', async () => {
3636
getTemplateMock.mockResolvedValueOnce(template);
3737

3838
const page = await CopyTemplatePage({

0 commit comments

Comments
 (0)