refactor(newappeal): add side-effect facade wrappers (Slice 3)
This commit is contained in:
@@ -12,9 +12,6 @@ import {
|
||||
setFormComplete
|
||||
} from "../../store/appealType/action";
|
||||
import BuildCheckRow from "./buildcheckrow";
|
||||
|
||||
import { generateAppealPDF } from "../../actions/services/documentService";
|
||||
import { sendCaseCompleteMessage } from "../../actions/services/portalService";
|
||||
import {
|
||||
bytesToSize,
|
||||
getThumbnailIconByExtension,
|
||||
@@ -25,6 +22,10 @@ import {
|
||||
dedupeFilesListByName,
|
||||
removeDuplicatesByKey
|
||||
} from "../../lib/newappeal/fileListHelpers";
|
||||
import {
|
||||
generateAppealPDFEffect,
|
||||
sendCaseCompleteMessageEffect
|
||||
} from "../../lib/newappeal/journeyEffects";
|
||||
|
||||
let BuildCheckSection = (props) => {
|
||||
useEffect(() => {
|
||||
@@ -153,7 +154,7 @@ let BuildCheckSection = (props) => {
|
||||
|
||||
confirmSections
|
||||
? (setFinaliseAppealProcess(true),
|
||||
await generateAppealPDF(
|
||||
await generateAppealPDFEffect(
|
||||
pdfObj,
|
||||
props.props.accountDetails.containerID,
|
||||
props.appealType.caseReference.ticketnumber,
|
||||
@@ -163,7 +164,7 @@ let BuildCheckSection = (props) => {
|
||||
)
|
||||
.then((data) => {
|
||||
console.log("have generated pdf:", data);
|
||||
sendCaseCompleteMessage(
|
||||
sendCaseCompleteMessageEffect(
|
||||
props.props.accountDetails.containerID,
|
||||
props.appealType.caseReference.ticketnumber,
|
||||
props.props.accountDetails.accountDetails
|
||||
@@ -209,7 +210,7 @@ let BuildCheckSection = (props) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const pdfBlob = await generateAppealPDF(
|
||||
const pdfBlob = await generateAppealPDFEffect(
|
||||
pdfObj,
|
||||
containerID,
|
||||
caseRef,
|
||||
|
||||
@@ -4,9 +4,11 @@ import { useRouter } from "next/router";
|
||||
import { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { formValueSelector, reduxForm } from "redux-form";
|
||||
import { uploadFiles } from "../../actions/services/documentService";
|
||||
import { sendEmail } from "../../actions/services/notifyService";
|
||||
import { mergeWithExistingFilesList } from "../../lib/newappeal/fileListHelpers";
|
||||
import {
|
||||
uploadAppealFilesEffect,
|
||||
sendPartialSaveEmailEffect
|
||||
} from "../../lib/newappeal/journeyEffects";
|
||||
import {
|
||||
normalizeYesNoBooleans,
|
||||
removeNullKeys,
|
||||
@@ -120,7 +122,7 @@ let BuildSection = (props) => {
|
||||
// _.includes(key, "pinswg_fileUpload") == true && delete dataObj[key];
|
||||
// }
|
||||
|
||||
await uploadFiles(
|
||||
await uploadAppealFilesEffect(
|
||||
dataObj,
|
||||
fileListObj,
|
||||
props.props.accountDetails.containerID,
|
||||
@@ -271,7 +273,7 @@ let BuildSection = (props) => {
|
||||
// );
|
||||
|
||||
sendSavedEmail == true &&
|
||||
sendEmail(
|
||||
sendPartialSaveEmailEffect(
|
||||
router.locale != "en" ? templateIdCY : templateId,
|
||||
emailAddress,
|
||||
personalisation,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
|
||||
import { useEffect } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { formValueSelector } from "redux-form";
|
||||
import { sendEmail } from "../../actions/services/notifyService";
|
||||
import { sendCompletionEmailEffect } from "../../lib/newappeal/journeyEffects";
|
||||
import { normalizeYesNoBooleans } from "../../lib/newappeal/payloadCleanup";
|
||||
import { setCurrentSection } from "../../store/appealType/action";
|
||||
import { getFormCollectionByID } from "../utils";
|
||||
@@ -50,7 +50,12 @@ let CompleteAppeal = (props) => {
|
||||
"emailAddress": props.props.accountDetails.loggedinUserEmail,
|
||||
"linkExpiry": 10 * 60
|
||||
};
|
||||
sendEmail(templateId, emailAddress, personalisation, reference);
|
||||
sendCompletionEmailEffect(
|
||||
templateId,
|
||||
emailAddress,
|
||||
personalisation,
|
||||
reference
|
||||
);
|
||||
|
||||
// sendCaseCompleteMessage(
|
||||
// props.props.accountDetails.containerID,
|
||||
|
||||
@@ -4,7 +4,7 @@ Base branch for this tracker: `refactor`
|
||||
|
||||
## Status
|
||||
|
||||
Current slice: Slice 3 — Side Effect Facade
|
||||
Current slice: Slice 4 — BuildSection UI Extraction
|
||||
Status: READY TO START
|
||||
|
||||
---
|
||||
@@ -41,7 +41,7 @@ Status: COMPLETE
|
||||
|
||||
### Slice 3 — Side Effect Facade
|
||||
|
||||
Status: NOT STARTED
|
||||
Status: COMPLETE
|
||||
|
||||
- Wrap existing service calls
|
||||
- No logic changes
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import { uploadFiles } from "../../actions/services/documentService";
|
||||
import { sendEmail } from "../../actions/services/notifyService";
|
||||
import { sendCaseCompleteMessage } from "../../actions/services/portalService";
|
||||
import { generateAppealPDF } from "../../actions/services/documentService";
|
||||
|
||||
export const uploadAppealFilesEffect = (
|
||||
dataObj,
|
||||
fileListObj,
|
||||
containerID,
|
||||
caseReference
|
||||
) => {
|
||||
return uploadFiles(dataObj, fileListObj, containerID, caseReference);
|
||||
};
|
||||
|
||||
export const sendPartialSaveEmailEffect = (
|
||||
templateId,
|
||||
emailAddress,
|
||||
personalisation,
|
||||
reference
|
||||
) => {
|
||||
return sendEmail(templateId, emailAddress, personalisation, reference);
|
||||
};
|
||||
|
||||
export const sendCompletionEmailEffect = (
|
||||
templateId,
|
||||
emailAddress,
|
||||
personalisation,
|
||||
reference
|
||||
) => {
|
||||
return sendEmail(templateId, emailAddress, personalisation, reference);
|
||||
};
|
||||
|
||||
export const generateAppealPDFEffect = (
|
||||
pdfObj,
|
||||
containerID,
|
||||
caseReference,
|
||||
appealType,
|
||||
filesList,
|
||||
options
|
||||
) => {
|
||||
return generateAppealPDF(
|
||||
pdfObj,
|
||||
containerID,
|
||||
caseReference,
|
||||
appealType,
|
||||
filesList,
|
||||
options
|
||||
);
|
||||
};
|
||||
|
||||
export const sendCaseCompleteMessageEffect = (
|
||||
containerID,
|
||||
caseReference,
|
||||
typeOfInvolvement
|
||||
) => {
|
||||
return sendCaseCompleteMessage(
|
||||
containerID,
|
||||
caseReference,
|
||||
typeOfInvolvement
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user