Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 54 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"copy-webpack-plugin": "^14.0.0",
"cssnano": "^8.0.2",
"cssnano-preset-default": "^8.0.2",
"editorconfig-checker": "^6.1.1",
"editorconfig-checker": "^6.2.0",
"eslint": "^9.39.4",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-import-x": "^4.17.1",
Expand Down
5 changes: 4 additions & 1 deletion src/server/i18n/translations/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@
"linkSent": "Rydym wedi anfon dolen i [[email]] y gallwch ei defnyddio i ailafael yn y ffurflen hon o fewn [[saveAndExitExpiryDays]] diwrnod.",
"repeatSave": "Os hoffech gadw eich cynnydd eto ar ôl ailafael yn eich ffurflen, bydd angen i chi ailadrodd y broses gadw er mwyn cynhyrchu dolen newydd.",
"checkSpam": "Gwiriwch eich ffolder sbam os na fyddwch wedi cael e-bost ar ôl ychydig funudau.",
"closeWindow": "Gallwch gau'r ffenestr hon."
"closeWindow": "Gallwch gau'r ffenestr hon.",
"answersSaved": "Mae eich atebion wedi'u cadw am [[days]] o ddiwrnodau.",
"emailedLinkForSignIn": "Rydym wedi anfon dolen atoch drwy e-bost fel y gallwch fewngofnodi a pharhau â'ch ffurflen '[[formName]]' yn ddiweddarach.",
"back": "Yn ôl i reoli eich ffurflen"
},
"resumeError": {
"pageTitle": "Ni allwch ailafael yn eich ffurflen",
Expand Down
5 changes: 4 additions & 1 deletion src/server/i18n/translations/en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@
"linkSent": "We have sent a link to [[email]] which you can use to resume this form within [[saveAndExitExpiryDays]] days.",
"repeatSave": "If you want to save your progress again after resuming your form, you will need to repeat the save process to generate a new link.",
"checkSpam": "Check your spam folder if you have not received an email after a few minutes.",
"closeWindow": "You can close this window."
"closeWindow": "You can close this window.",
"answersSaved": "Your answers have been saved for [[days]] days.",
"emailedLinkForSignIn": "We’ve emailed you a link so you can sign in and continue your '[[formName]]' form later.",
"back": "Back to manage your form"
},
"resumeError": {
"pageTitle": "You cannot resume your form",
Expand Down
48 changes: 46 additions & 2 deletions src/server/messaging/mappers/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { config } from '~/src/config/index.js'
const baseUrl = config.get('baseUrl')

/**
* For legacy V1 save-and-exit
* @param { string } formId
* @param { string } formTitle
* @param { string } email
Expand All @@ -20,7 +21,7 @@ const baseUrl = config.get('baseUrl')
* @param { FormStatus } [status]
* @returns {SaveAndExitMessage}
*/
export function saveAndExitMapper(
export function saveAndExitV1Mapper(
formId,
formTitle,
email,
Expand Down Expand Up @@ -60,6 +61,49 @@ export function saveAndExitMapper(
}

/**
* @import { SaveAndExitMessage, SaveAndExitMessageData, SecurityQuestionsEnum } from '@defra/forms-model'
* For V2 save-and-exit
* @param { string } formId
* @param { string } formTitle
* @param { string } email
* @param {{ sub: string, issuer: string }} auth
* @param { FormState } state
* @param { FormStatus } [status]
* @returns {SaveAndExitV2Message}
*/
export function saveAndExitV2Mapper(
formId,
formTitle,
email,
auth,
state,
status
) {
/** @type {SaveAndExitV2MessageData} */
const data = {
form: {
id: formId,
title: formTitle,
status: status ?? FormStatus.Live,
isPreview: !!status,
baseUrl
},
email,
auth,
state
}
const now = new Date()
return {
schemaVersion: SubmissionEventMessageSchemaVersion.V1,
category: SubmissionEventMessageCategory.RUNNER,
source: SubmissionEventMessageSource.FORMS_RUNNER,
type: SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT_V2,
createdAt: now,
data,
messageCreatedAt: now
}
}

/**
* @import { SaveAndExitMessage, SaveAndExitV2Message, SaveAndExitMessageData, SaveAndExitV2MessageData, SecurityQuestionsEnum } from '@defra/forms-model'
* @import { FormState } from '@defra/forms-engine-plugin/engine/types.js'
*/
Loading
Loading