"`;
-
-exports[`NewConnectionTemplates show form should render Error message with text error test 1`] = `"
error test
"`;
-
-exports[`NewConnectionTemplates show form should render a confirmation page with given email and company number 1`] = `""`;
-
-exports[`NewConnectionTemplates show form should render a stepper html at stage 1 1`] = `"
Step 1 of 3
"`;
-
-exports[`NewConnectionTemplates show form should render a stepper html at stage 2 1`] = `"
Step 2 of 3
"`;
-
-exports[`NewConnectionTemplates show form should render a stepper html at stage 3 1`] = `"
Step 3 of 3
"`;
-
-exports[`NewConnectionTemplates show form should render a success response page with a single button to return to home 1`] = `""`;
-
-exports[`NewConnectionTemplates show form should render a valid company in filled company test box 1`] = `"Registered Office Address
DIGITAL CATAPULT
Level 9, 101 Euston Road
London
NW1 2RA
Registered Office Address
active
"`;
-
-exports[`NewConnectionTemplates show form should render form with a errormessage and invlaid response 1`] = `""`;
-
-exports[`NewConnectionTemplates show form should render form with a valid repsponse 1`] = `""`;
diff --git a/src/views/common.tsx b/src/views/common.tsx
index 09641240..37fc6b12 100644
--- a/src/views/common.tsx
+++ b/src/views/common.tsx
@@ -4,6 +4,7 @@ type PageProps = {
title: string
heading: string
url: string
+ stylesheets?: string[]
}
type ButtonProps = {
@@ -14,37 +15,39 @@ type ButtonProps = {
disabled?: boolean
outline?: boolean
href?: string
+ fillButton?: boolean
}
type FormButtonProps = {
name: string
- display: string
disabled?: boolean
outline?: boolean
value?: string
+ text?: string
type?: string
+ fillButton?: boolean
}
export const ButtonIcon = (props: ButtonProps): JSX.Element => (
-
-
"`;
+
+exports[`NewInviteTemplates show form should render form with a error message and invalid response 1`] = `""`;
+
+exports[`NewInviteTemplates show form should render form with a valid response 1`] = `""`;
diff --git a/src/views/newConnection/__tests__/newInvite.test.ts b/src/views/newConnection/__tests__/newInvite.test.ts
new file mode 100644
index 00000000..a36788d8
--- /dev/null
+++ b/src/views/newConnection/__tests__/newInvite.test.ts
@@ -0,0 +1,50 @@
+import { expect } from 'chai'
+import { describe, it } from 'mocha'
+
+import { NewInviteTemplates } from '../newInvite.js'
+import { successResponse, testErrorTargetBox, testMessageTargetBox, testSuccessTargetBox } from './fixtures.js'
+
+describe('NewInviteTemplates', () => {
+ describe('show form', () => {
+ it('should render form with a error message and invalid response', async () => {
+ const templates = new NewInviteTemplates()
+ const rendered = await templates.newInviteForm({ feedback: testMessageTargetBox, formStage: 'form' })
+ expect(rendered).to.matchSnapshot()
+ })
+
+ it('should render form with a valid response', async () => {
+ const templates = new NewInviteTemplates()
+ const rendered = await templates.newInviteForm({ feedback: testSuccessTargetBox, formStage: 'form' })
+ expect(rendered).to.matchSnapshot()
+ })
+
+ it('should render a confirmation page with given email and company number', async () => {
+ const templates = new NewInviteTemplates()
+ const rendered = await templates.newInviteForm({
+ feedback: testSuccessTargetBox,
+ formStage: 'confirmation',
+ email: '123@123.com',
+ companyNumber: successResponse.company_number,
+ })
+ expect(rendered).to.matchSnapshot()
+ })
+
+ it('should render a success response page with a single button to return to home', async () => {
+ const templates = new NewInviteTemplates()
+ const rendered = await templates.newInviteForm({ feedback: testSuccessTargetBox, formStage: 'success' })
+ expect(rendered).to.matchSnapshot()
+ })
+
+ it('should a web page with the a form in an empty state', async () => {
+ const templates = new NewInviteTemplates()
+ const rendered = await templates.newInviteFormPage(testMessageTargetBox)
+ expect(rendered).to.matchSnapshot()
+ })
+
+ it('should a web page with the a form in an error state', async () => {
+ const templates = new NewInviteTemplates()
+ const rendered = await templates.newInviteFormPage(testErrorTargetBox)
+ expect(rendered).to.matchSnapshot()
+ })
+ })
+})
diff --git a/src/views/newConnection/__tests__/newInvite.test.ts.snap b/src/views/newConnection/__tests__/newInvite.test.ts.snap
new file mode 100644
index 00000000..f5ba40cb
--- /dev/null
+++ b/src/views/newConnection/__tests__/newInvite.test.ts.snap
@@ -0,0 +1,23 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`NewInviteTemplates show form should a web page with the a form in an empty state 1`] = `"Veritable - New Connection
"`;
+
+exports[`NewInviteTemplates show form should render Error message with text error test 1`] = `"
error test
"`;
+
+exports[`NewInviteTemplates show form should render a confirmation page with given email and company number 1`] = `""`;
+
+exports[`NewInviteTemplates show form should render a stepper html at stage 1 1`] = `"
Step 1 of 3
"`;
+
+exports[`NewInviteTemplates show form should render a stepper html at stage 2 1`] = `"
Step 2 of 3
"`;
+
+exports[`NewInviteTemplates show form should render a stepper html at stage 3 1`] = `"
Step 3 of 3
"`;
+
+exports[`NewInviteTemplates show form should render a success response page with a single button to return to home 1`] = `""`;
+
+exports[`NewInviteTemplates show form should render a valid company in filled company test box 1`] = `"
+ Your connection has been established, but still needs to be verified. You should receive a verification
+ letter at your registered business with instructions on how to do this. A reciprocal verification request
+ has been sent in the post on your behalf to the address on the right to verify their identity
+
+
+
+ )
+ }
+}
diff --git a/src/views/newConnection/newInvite.tsx b/src/views/newConnection/newInvite.tsx
new file mode 100644
index 00000000..43138323
--- /dev/null
+++ b/src/views/newConnection/newInvite.tsx
@@ -0,0 +1,158 @@
+import Html from '@kitajs/html'
+import { singleton } from 'tsyringe'
+import { COMPANY_NUMBER, EMAIL, companyNumberRegex } from '../../models/strings.js'
+import { Page } from '../common.js'
+import { FormFeedback, NewConnectionTemplates } from './base.js'
+
+export type NewInviteFormStage = 'form' | 'confirmation' | 'success'
+
+@singleton()
+export class NewInviteTemplates extends NewConnectionTemplates {
+ constructor() {
+ super()
+ }
+
+ public newInviteFormPage = (feedback: FormFeedback) => {
+ return (
+
+
+ Your connection invitation has been sent. Please wait for their verification. As the post may take 2-3 days
+ to arrive, please wait for their verification and keep updated by viewing the verification status.
+