Merged PR 2162: refactor actions

Related work items: #21996
This commit is contained in:
Robert Bond
2026-03-13 05:51:45 +00:00
185 changed files with 4031 additions and 3533 deletions
+11
View File
@@ -50,3 +50,14 @@ pages/admin/logchecker.js
pages/baracuda.html pages/baracuda.html
pages/holding-min.html pages/holding-min.html
pages/holding.html pages/holding.html
# Cline / AI-assistant governance artifacts (keep local-only)
.clinerules
.clinerules/
CONTRIBUTING_AI.md
GUARDRAILS.md
ai-prompts/
context/
memory-bank/
workflows/
AI_CONTEXT.md
+6
View File
@@ -0,0 +1,6 @@
# Actions Clients
This folder is reserved for extracted client wrappers from `actions/index.js` as part of the Priority 1 refactor plan.
Phase 1 delivered core helper extraction and compatibility barrel support.
Client-level extraction (`relayClient`, `endpointClient`, `fileClient`, `notifyClient`) is planned for the next increment.
+15
View File
@@ -0,0 +1,15 @@
const port = parseInt(process.env.PORT, 10) || 3000;
export const BASE_URL =
typeof window !== "undefined"
? window.apiRoot
: process.env.API_ROOT || `http://localhost:${port}`;
export const API_PATH = "/api/data/v8.2/";
export const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
export const ACCESS_TOKEN_ENDPOINT = process.env.ACCESS_TOKEN_ENDPOINT;
export const TENANT_ID = process.env.TENANT;
+11
View File
@@ -0,0 +1,11 @@
export const isNonEmptyString = (value) => {
return typeof value === "string" && value.trim().length > 0;
};
export const sanitizeString = (value) => {
return typeof value === "string" ? value.trim() : "";
};
export const escapeODataString = (value) => {
return sanitizeString(value).replace(/'/g, "''");
};
+22
View File
@@ -0,0 +1,22 @@
import CryptoJS from "crypto-js";
const WORDKEY = process.env.HASHKEY;
export const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export const hashString = (stringToHash) => {
let hashedStr = CryptoJS.AES.encrypt(stringToHash, "pedw");
return hashedStr.toString();
};
export const dehashString = (stringToDeHash) => {
let dehashedStr = CryptoJS.AES.decrypt(decodeURI(stringToDeHash), "pedw");
return dehashedStr.toString(CryptoJS.enc.Utf8);
};
+50
View File
@@ -0,0 +1,50 @@
export const azureHeaders = (access_token) => {
return {
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json;odata.metadata=none",
"Prefer": 'odata.include-annotations="*",return=representation',
"Content-Type": "application/json",
"Authorization": "Bearer " + access_token
}
};
};
export const azureHeadersNoOdata = (access_token) => {
return {
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer " + access_token
}
};
};
export const azureHeadersPaged = (access_token) => {
return {
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json;odata.metadata=none",
"Prefer":
'odata.include-annotations="*",return=representation, odata.maxpagesize=10',
"Content-Type": "application/json",
"Authorization": "Bearer " + access_token
}
};
};
export const azureHeadersPagedCustom = (access_token, showNumberOfRecords) => {
return {
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json;odata.metadata=none",
"Prefer":
'odata.include-annotations="*",return=representation, odata.maxpagesize=' +
showNumberOfRecords,
"Content-Type": "application/json",
"Authorization": "Bearer " + access_token
}
};
};
+106
View File
@@ -0,0 +1,106 @@
import _ from "lodash";
const MASK = "[REDACTED]";
const redactString = (value) => {
if (typeof value !== "string") return value;
return value
.replace(
/([a-zA-Z0-9._%+-]{1,})@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g,
`${MASK}@${MASK}`
)
.replace(/Bearer\s+[A-Za-z0-9._\-]+/gi, `Bearer ${MASK}`)
.replace(/("client_secret"\s*:\s*")[^"]+("?)/gi, `$1${MASK}$2`)
.replace(/("access_token"\s*:\s*")[^"]+("?)/gi, `$1${MASK}$2`);
};
export const redactSensitive = (value) => {
if (value == null) return value;
if (typeof value === "string") {
return redactString(value);
}
try {
const json = JSON.stringify(value);
return redactString(json);
} catch (_error) {
return MASK;
}
};
export const getIP = (req) => {
const forwarded = req.headers["x-forwarded-for"];
const ip =
typeof forwarded === "string"
? forwarded.split(/, /)[0]
: req.socket.remoteAddress;
console.info(
"\n====================\n Client IP address: " + ip,
"\n=====================\n"
);
};
export const consoleLogger = (err) => {
console.log(
"\n\n/////////////////////////////////////////////////\nRaw Error " +
redactSensitive(err) +
"\n\n/////////////////////////////////////////////////\n"
);
var errStr =
"\n\n/////////////////////////////////////////////////\nServer Error " +
"\n" +
(_.has(err, "name") ? "Name: " + err.name + "\n" : "") +
(_.has(err, "code") ? "Code: " + err.code + "\n" : "") +
(_.has(err, "query") ? "Query: " + err.query + "\n" : "") +
(_.has(err, "message") ? "Message: " + err.message + "\n" : "") +
(_.has(err, "request.url")
? "request.url: " + err.request.url + "\n"
: "") +
(_.has(err, "response.status") ? "Status: " + err.code + "\n" : "") +
(_.has(err, "response.statusText")
? "\nStatusText: " + err.response.status + "\n"
: "") +
(_.has(err, "response.request.socket.remoteAddress")
? "\nRequest IP: " +
err.response.request.socket.remoteAddress +
"\n"
: "") +
(_.has(err, "response.data.error.message")
? "\nMessage: " +
redactSensitive(err.response.data.error.message) +
"\n"
: "") +
(_.has(err, "response.config.url")
? "\nRequest URL: " + redactSensitive(err.config.url) + "\n"
: "") +
(_.has(err, "response.headers.date")
? "\nRequest Time: " + err.response.headers.date + "\n"
: "") +
(_.has(err, "config.url")
? "\nAxios config url: " + redactSensitive(err.config.url) + "\n"
: "") +
(_.has(err, "config.url")
? "\nAxios message url: " + redactSensitive(err.message) + "\n"
: "") +
(_.has(err, "config.data")
? "\nRequest payload: " + redactSensitive(err.config.data) + "\n"
: "") +
"\n/////////////////////////////////////////////////\n";
console.log(errStr);
};
export const conLog = (err) => {
var errStr =
"\n\n/////////////////////////////////////////////////\nResponse: " +
"\n" +
err +
"\n/////////////////////////////////////////////////\n\n";
console.log(errStr);
return errStr;
};
+42
View File
@@ -0,0 +1,42 @@
import axios from "axios";
import { ACCESS_TOKEN_ENDPOINT, TENANT_ID } from "./env";
import { consoleLogger } from "./logger";
const cache = {};
const tokenBody =
"grant_type=" +
process.env.GRANT_TYPE +
"&client_id=" +
process.env.CLIENT_ID +
"&client_secret=" +
process.env.CLIENT_SECRET +
"&scope=" +
"https://" +
process.env.RELAYURI +
"/.default";
const tokenConfig = {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Cache-Control": "no-cache"
}
};
export const getToken = () => {
return axios
.post(
`${ACCESS_TOKEN_ENDPOINT}${TENANT_ID}/oauth2/v2.0/token`,
tokenBody,
tokenConfig
)
.then((res) => res.data)
.then((data) => {
cache.tokenResponse = data;
return data;
})
.catch((error) => {
consoleLogger(error);
return error;
});
};
+8 -2322
View File
File diff suppressed because it is too large Load Diff
+23
View File
@@ -0,0 +1,23 @@
import {
getPersonalAccount,
getLogin,
updatePassword,
updateAccount,
createAccount,
getEmailAccountCheck,
getPortalLogin,
getPortalLoginProxy,
getPreferredLanguage
} from "./legacyActionsService";
export {
getPersonalAccount,
getLogin,
updatePassword,
updateAccount,
createAccount,
getEmailAccountCheck,
getPortalLogin,
getPortalLoginProxy,
getPreferredLanguage
};
+7
View File
@@ -0,0 +1,7 @@
import {
getNewAppeals,
getNewAppealsPage,
getNewDocumentsPaged
} from "./legacyActionsService";
export { getNewAppeals, getNewAppealsPage, getNewDocumentsPaged };
+41
View File
@@ -0,0 +1,41 @@
import {
getCaseMessage,
getIncidentbyID,
getSIPSEvents,
getSIPSMedia,
getAppealID,
createNewCase,
createNewCaseBlob,
updateCase,
updateCaseBlob,
patchCase,
getCase,
getCaseByID,
getAppealPDFDocs,
getAppealPDFDocument,
getPartSavedAppeal,
getIsPublishedbyID,
getPortalModuleDetails,
getPortalModuleDetailsProxy
} from "./legacyActionsService";
export {
getCaseMessage,
getIncidentbyID,
getSIPSEvents,
getSIPSMedia,
getAppealID,
createNewCase,
createNewCaseBlob,
updateCase,
updateCaseBlob,
patchCase,
getCase,
getCaseByID,
getAppealPDFDocs,
getAppealPDFDocument,
getPartSavedAppeal,
getIsPublishedbyID,
getPortalModuleDetails,
getPortalModuleDetailsProxy
};
+43
View File
@@ -0,0 +1,43 @@
import {
getAwaitingSubmissionFromBlob,
getRepsFromBlob,
getRepsFromBlobProxy,
getAwaitingSubmissionFromBlobProxy,
deleteAwaitingSubmissionsFromBlob,
deleteMyRepresentationsFromBlob,
uploadFiles,
uploadSingleFile,
uploadRepFiles,
generateRepPDF,
generateAppealPDF,
getFilesFromBlob,
getFilesFromBlobproxy,
getFilesFromBlobHashed,
deleteBlob,
deleteRepBlob,
downloadBlob,
getProgressFromBlob,
createContainerProxy
} from "./legacyActionsService";
export {
getAwaitingSubmissionFromBlob,
getRepsFromBlob,
getRepsFromBlobProxy,
getAwaitingSubmissionFromBlobProxy,
deleteAwaitingSubmissionsFromBlob,
deleteMyRepresentationsFromBlob,
uploadFiles,
uploadSingleFile,
uploadRepFiles,
generateRepPDF,
generateAppealPDF,
getFilesFromBlob,
getFilesFromBlobproxy,
getFilesFromBlobHashed,
deleteBlob,
deleteRepBlob,
downloadBlob,
getProgressFromBlob,
createContainerProxy
};
+9
View File
@@ -0,0 +1,9 @@
export * from "./searchService";
export * from "./caseService";
export * from "./accountService";
export * from "./portalService";
export * from "./documentService";
export * from "./referenceDataService";
export * from "./notifyService";
export * from "./adminService";
export * from "./integrationService";
+3
View File
@@ -0,0 +1,3 @@
import { createCRMTask } from "./legacyActionsService";
export { createCRMTask };
File diff suppressed because it is too large Load Diff
+3
View File
@@ -0,0 +1,3 @@
import { sendEmail } from "./legacyActionsService";
export { sendEmail };
+45
View File
@@ -0,0 +1,45 @@
import {
getMyCases,
getMyInvolvements,
getMyLPACases,
getMyRepresentations,
getMyRepresentationsProxy,
getRepresentations,
getRepresentationsProxy,
getWatchedCases,
getWatchedCasesProxy,
getAwaitingSubmission,
getAwaitingSubmissionProxy,
createWatchedCases,
deleteWatchedCases,
deleteMyRepresentations,
deleteAwaitingSubmissions,
sendCaseCompleteMessage,
sendCaseCompleteMessageProxy,
sendRepCompleteMessage,
setRepInvolvment,
setCaseInvolvment
} from "./legacyActionsService";
export {
getMyCases,
getMyInvolvements,
getMyLPACases,
getMyRepresentations,
getMyRepresentationsProxy,
getRepresentations,
getRepresentationsProxy,
getWatchedCases,
getWatchedCasesProxy,
getAwaitingSubmission,
getAwaitingSubmissionProxy,
createWatchedCases,
deleteWatchedCases,
deleteMyRepresentations,
deleteAwaitingSubmissions,
sendCaseCompleteMessage,
sendCaseCompleteMessageProxy,
sendRepCompleteMessage,
setRepInvolvment,
setCaseInvolvment
};
+21
View File
@@ -0,0 +1,21 @@
import {
getAppealsTypes,
getProjectTypes,
getAppealsTypesForNewAppeal,
getLPA,
getFormData,
getMandatoryFields,
getPickLists,
getNotice
} from "./legacyActionsService";
export {
getAppealsTypes,
getProjectTypes,
getAppealsTypesForNewAppeal,
getLPA,
getFormData,
getMandatoryFields,
getPickLists,
getNotice
};
+41
View File
@@ -0,0 +1,41 @@
import {
getBasicSearch,
getAddressSearch,
getAddressSearchPaged,
getBasicSearchPaged,
getAdvancedSearch,
getAdvancedSearchPaged,
getBasicDNSURLSearch,
getBasicDNSSearch,
getBasicDNSSearchPaged,
getDNSCoords,
getDNSList,
getBasicSearchDetails,
getBasicSearchDetailsPaged,
getBasicPartSavedDetails,
getSearchDocumentDetails,
getSearchDocumentTypes,
getSearchDocumentDetailsPaged,
getLinkedCases
} from "./legacyActionsService";
export {
getBasicSearch,
getAddressSearch,
getAddressSearchPaged,
getBasicSearchPaged,
getAdvancedSearch,
getAdvancedSearchPaged,
getBasicDNSURLSearch,
getBasicDNSSearch,
getBasicDNSSearchPaged,
getDNSCoords,
getDNSList,
getBasicSearchDetails,
getBasicSearchDetailsPaged,
getBasicPartSavedDetails,
getSearchDocumentDetails,
getSearchDocumentTypes,
getSearchDocumentDetailsPaged,
getLinkedCases
};
+5 -5
View File
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import React, { useState } from "react"; import React, { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Field, formValueSelector, reduxForm } from "redux-form"; import { Field, formValueSelector, reduxForm } from "redux-form";
import { updatePassword } from "../../actions"; import { updatePassword } from "../../actions/services/accountService";
const RenderTextfield = ({ const RenderTextfield = ({
id, id,
@@ -60,7 +60,7 @@ const ChangePassword = (props) => {
handleSubmit, handleSubmit,
value, value,
setPasswordUpdated, setPasswordUpdated,
passwordUpdated, passwordUpdated
} = props; } = props;
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
@@ -158,7 +158,7 @@ const mapStateToProps = (state) => {
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
//form: state.form, //form: state.form,
}; };
}; };
@@ -167,7 +167,7 @@ const mapDispatchToProps = (dispatch) => {
return { return {
setCurrentSection: (currentSection) => { setCurrentSection: (currentSection) => {
dispatch(setCurrentSection(currentSection)); dispatch(setCurrentSection(currentSection));
}, }
}; };
}; };
@@ -179,6 +179,6 @@ export default connect(
)( )(
reduxForm({ reduxForm({
form: "changepasswordForm", form: "changepasswordForm",
destroyOnUnmount: false, destroyOnUnmount: false
})(ChangePassword) })(ChangePassword)
); );
@@ -3,7 +3,7 @@ import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { updateAccount } from "../../actions"; import { updateAccount } from "../../actions/services/accountService";
import { setCookie } from "nookies"; import { setCookie } from "nookies";
const PersonalDetailsComplete = (props) => { const PersonalDetailsComplete = (props) => {
@@ -11,7 +11,7 @@ const PersonalDetailsComplete = (props) => {
handleSubmit, handleSubmit,
value, value,
setRegisterFormComplete, setRegisterFormComplete,
setAccountCreatedComplete, setAccountCreatedComplete
} = props; } = props;
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
@@ -41,7 +41,7 @@ const PersonalDetailsComplete = (props) => {
console.log("=============== pref lang", prefLang); console.log("=============== pref lang", prefLang);
setCookie(null, "pedw_locale", userLang, { setCookie(null, "pedw_locale", userLang, {
path: "/", path: "/",
maxAge: 60 * 60 * 24 * 365, maxAge: 60 * 60 * 24 * 365
}); });
console.log("Set cookie to:", userLang); console.log("Set cookie to:", userLang);
@@ -79,7 +79,7 @@ const mapStateToProps = (state) => {
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
//form: state.form, //form: state.form,
}; };
}; };
@@ -88,7 +88,7 @@ const mapDispatchToProps = (dispatch) => {
return { return {
setCurrentSection: (currentSection) => { setCurrentSection: (currentSection) => {
dispatch(setCurrentSection(currentSection)); dispatch(setCurrentSection(currentSection));
}, }
}; };
}; };
+10 -7
View File
@@ -8,7 +8,10 @@ import { connect } from "react-redux";
import { setAccCr, setLogout } from "../../store/accountDetails/action"; import { setAccCr, setLogout } from "../../store/accountDetails/action";
import { createAccount, getEmailAccountCheck } from "../../actions"; import {
createAccount,
getEmailAccountCheck
} from "../../actions/services/accountService";
const RegisterComplete = (props) => { const RegisterComplete = (props) => {
const { const {
@@ -18,7 +21,7 @@ const RegisterComplete = (props) => {
value, value,
setRegisterFormComplete, setRegisterFormComplete,
setAccountCreatedComplete, setAccountCreatedComplete,
setAccCr, setAccCr
} = props; } = props;
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
@@ -34,7 +37,7 @@ const RegisterComplete = (props) => {
// was an appellant "pinswg_typeofinvolvement": 846040001, // was an appellant "pinswg_typeofinvolvement": 846040001,
Object.assign(accountBody, { Object.assign(accountBody, {
"pinswg_typeofinvolvement": 846040061, "pinswg_typeofinvolvement": 846040061
}); });
accountBody = _.omit(accountBody, ["custom_password_check"]); accountBody = _.omit(accountBody, ["custom_password_check"]);
@@ -105,9 +108,9 @@ const RegisterComplete = (props) => {
<p className="govuk-body"> <p className="govuk-body">
<a <a
onClick={() => { onClick={() => {
setRegisterFormComplete(false), (setRegisterFormComplete(false),
setAccountCreatedComplete(false), setAccountCreatedComplete(false),
setAccCr(false); setAccCr(false));
}} }}
className="govuk-link" className="govuk-link"
> >
@@ -130,7 +133,7 @@ const mapStateToProps = (state) => {
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
//form: state.form, //form: state.form,
}; };
}; };
@@ -142,7 +145,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
setLogout: () => { setLogout: () => {
dispatch(setLogout()); dispatch(setLogout());
}, }
}; };
}; };
+31 -30
View File
@@ -9,14 +9,15 @@ import { connect } from "react-redux";
import { import {
setSearchResults, setSearchResults,
setSearchDetails, setSearchDetails
} from "../../../store/searchOutput/action"; } from "../../../store/searchOutput/action";
import { getDetailsProxy, getSearchDetailsPaged } from "../../utils"; import { getDetailsProxy, getSearchDetailsPaged } from "../../utils";
import { getAdvancedSearchPaged, getNewAppealsPage } from "../../../actions"; import { getAdvancedSearchPaged } from "../../../actions/services/searchService";
import { getNewAppealsPage } from "../../../actions/services/adminService";
import { import {
setCurrentPage, setCurrentPage,
setCurrentReference, setCurrentReference
} from "../../../store/currentView/action"; } from "../../../store/currentView/action";
function AppealsTab(props) { function AppealsTab(props) {
@@ -86,7 +87,7 @@ function AppealsTab(props) {
searchString, searchString,
selectedOption, selectedOption,
props.setSearchDetails, props.setSearchDetails,
props.setSearchResults, props.setSearchResults
] ]
); );
@@ -105,7 +106,7 @@ function AppealsTab(props) {
orderByState, orderByState,
searchLoaded, searchLoaded,
getSearchPageResults, getSearchPageResults,
router.query, router.query
]); ]);
const ResultsView = (resultsArr) => { const ResultsView = (resultsArr) => {
@@ -225,7 +226,7 @@ function AppealsTab(props) {
item.ticketnumber + item.ticketnumber +
'")]', '")]',
json: searchDetailsObj, json: searchDetailsObj,
eval: true, eval: true
}); });
detailsObj = detailsObj[0] || {}; detailsObj = detailsObj[0] || {};
@@ -246,8 +247,8 @@ function AppealsTab(props) {
? "/fymhorth/achos" ? "/fymhorth/achos"
: "/achos" : "/achos"
: myportal == true : myportal == true
? "/myportal/case" ? "/myportal/case"
: "/case") + : "/case") +
"/" + "/" +
item.ticketnumber item.ticketnumber
} }
@@ -272,10 +273,10 @@ function AppealsTab(props) {
) )
? detailsObj.pinswg_speacialistcaseprocess ? detailsObj.pinswg_speacialistcaseprocess
: detailsObj.hasOwnProperty( : detailsObj.hasOwnProperty(
"pinswg_specialistcaseprocess" "pinswg_specialistcaseprocess"
) )
? detailsObj.pinswg_specialistcaseprocess ? detailsObj.pinswg_specialistcaseprocess
: "", : ""
}); });
}} }}
> >
@@ -314,12 +315,12 @@ function AppealsTab(props) {
) < 0 ) < 0
? detailsObj.pinswg_projectlocation ? detailsObj.pinswg_projectlocation
: router.locale == "cy" : router.locale == "cy"
? detailsObj.pinswg_projectlocation.split( ? detailsObj.pinswg_projectlocation.split(
";" ";"
)[1] )[1]
: detailsObj.pinswg_projectlocation.split( : detailsObj.pinswg_projectlocation.split(
";" ";"
)[0] )[0]
: "" : ""
: ""} : ""}
{_.has( {_.has(
@@ -396,12 +397,12 @@ function AppealsTab(props) {
" " + " " +
item.pinswg_appellantlastname item.pinswg_appellantlastname
: _.has(detailsObj, [ : _.has(detailsObj, [
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue", "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
]) ])
? detailsObj[ ? detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
] ]
: ""} : ""}
</dd> </dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16"> <dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden"> <span className="results-visually-hidden">
@@ -411,7 +412,7 @@ function AppealsTab(props) {
: :
</span> </span>
{_.has(item, [ {_.has(item, [
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue", "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
]) ])
? router.locale == "cy" ? router.locale == "cy"
? jsonpath({ ? jsonpath({
@@ -422,7 +423,7 @@ function AppealsTab(props) {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item[ : item[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
@@ -445,7 +446,7 @@ function AppealsTab(props) {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item[ : item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
@@ -468,7 +469,7 @@ function AppealsTab(props) {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item[ : item[
"statuscode@OData.Community.Display.V1.FormattedValue" "statuscode@OData.Community.Display.V1.FormattedValue"
@@ -555,13 +556,13 @@ const mapDispatchToProps = (dispatch) => {
}, },
setCurrentPage: (currentPage) => { setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage)); dispatch(setCurrentPage(currentPage));
}, }
}; };
}; };
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj
}; };
}; };
+57 -57
View File
@@ -15,177 +15,177 @@ import { sendGAEvent } from "@next/third-parties/google";
import { import {
getSearchDocumentDetails, getSearchDocumentDetails,
getSearchDocumentDetailsPaged, getSearchDocumentDetailsPaged,
getSearchDocumentTypes, getSearchDocumentTypes
getNewDocumentsPaged, } from "../../../actions/services/searchService";
} from "../../../actions"; import { getNewDocumentsPaged } from "../../../actions/services/adminService";
import { setCurrentPage } from "../../../store/currentView/action"; import { setCurrentPage } from "../../../store/currentView/action";
import { setDocumentDetails } from "../../../store/searchOutput/action"; import { setDocumentDetails } from "../../../store/searchOutput/action";
const getDocumentTypes = [ const getDocumentTypes = [
{ {
"Value": 846040009, "Value": 846040009,
"Label": "Main Party - Pre-Submission Docs", "Label": "Main Party - Pre-Submission Docs"
}, },
{ {
"Value": 846040000, "Value": 846040000,
"Label": "Main Party - Submission Document", "Label": "Main Party - Submission Document"
}, },
{ {
"Value": 846040001, "Value": 846040001,
"Label": "Main Party - Questionnaire", "Label": "Main Party - Questionnaire"
}, },
{ {
"Value": 846040002, "Value": 846040002,
"Label": "Main Party - Statements", "Label": "Main Party - Statements"
}, },
{ {
"Value": 846040003, "Value": 846040003,
"Label": "Main Party - Comments", "Label": "Main Party - Comments"
}, },
{ {
"Value": 846040004, "Value": 846040004,
"Label": "Main Party - Written Statements of Evidence", "Label": "Main Party - Written Statements of Evidence"
}, },
{ {
"Value": 846040010, "Value": 846040010,
"Label": "Main Party - Environmental Statements", "Label": "Main Party - Environmental Statements"
}, },
{ {
"Value": 846040005, "Value": 846040005,
"Label": "Interested Party Representations", "Label": "Interested Party Representations"
}, },
{ {
"Value": 846040006, "Value": 846040006,
"Label": "Correspondence", "Label": "Correspondence"
}, },
{ {
"Value": 846040008, "Value": 846040008,
"Label": "Inspector Notes", "Label": "Inspector Notes"
}, },
{ {
"Value": 846040007, "Value": 846040007,
"Label": "Final Decision/Report", "Label": "Final Decision/Report"
}, },
{ {
"Value": 846040011, "Value": 846040011,
"Label": "Post Decision Correspondence", "Label": "Post Decision Correspondence"
}, },
{ {
"Value": 846040012, "Value": 846040012,
"Label": "High Court Challenge Correspondence", "Label": "High Court Challenge Correspondence"
}, },
{ {
"Value": 846040013, "Value": 846040013,
"Label": "Event - Correspondence", "Label": "Event - Correspondence"
}, },
{ {
"Value": 846040014, "Value": 846040014,
"Label": "Event - Documents", "Label": "Event - Documents"
}, },
{ {
"Value": 846040015, "Value": 846040015,
"Label": "Pre-Application - General", "Label": "Pre-Application - General"
}, },
{ {
"Value": 846040016, "Value": 846040016,
"Label": "Pre-Application - EIA Screening", "Label": "Pre-Application - EIA Screening"
}, },
{ {
"Value": 846040017, "Value": 846040017,
"Label": "Pre-Application - EIA Scoping", "Label": "Pre-Application - EIA Scoping"
}, },
{ {
"Value": 846040018, "Value": 846040018,
"Label": "EIA Screening", "Label": "EIA Screening"
}, },
{ {
"Value": 846040019, "Value": 846040019,
"Label": "EIA Scoping", "Label": "EIA Scoping"
}, },
{ {
"Value": 846040020, "Value": 846040020,
"Label": "Pre-Application Services Documents", "Label": "Pre-Application Services Documents"
}, },
{ {
"Value": 846040021, "Value": 846040021,
"Label": "Notification", "Label": "Notification"
}, },
{ {
"Value": 846040022, "Value": 846040022,
"Label": "Label":
"Submission - Environmental Statement - written statement and NTS", "Submission - Environmental Statement - written statement and NTS"
}, },
{ {
"Value": 846040023, "Value": 846040023,
"Label": "Submission - Environmental Statement - Appendices", "Label": "Submission - Environmental Statement - Appendices"
}, },
{ {
"Value": 846040024, "Value": 846040024,
"Label": "Submission - Environmental Statement - Figures", "Label": "Submission - Environmental Statement - Figures"
}, },
{ {
"Value": 846040025, "Value": 846040025,
"Label": "Submission - Draft Infrastructure Consent Orders", "Label": "Submission - Draft Infrastructure Consent Orders"
}, },
{ {
"Value": 846040026, "Value": 846040026,
"Label": "Submission - Compulsory Acquisition Information", "Label": "Submission - Compulsory Acquisition Information"
}, },
{ {
"Value": 846040027, "Value": 846040027,
"Label": "Submission - Application Documents", "Label": "Submission - Application Documents"
}, },
{ {
"Value": 846040028, "Value": 846040028,
"Label": "Examination Notices", "Label": "Examination Notices"
}, },
{ {
"Value": 846040029, "Value": 846040029,
"Label": "Local/Marine Impact Reports", "Label": "Local/Marine Impact Reports"
}, },
{ {
"Value": 846040030, "Value": 846040030,
"Label": "Submission - Further Information", "Label": "Submission - Further Information"
}, },
{ {
"Value": 846040031, "Value": 846040031,
"Label": "Formal Variation requests", "Label": "Formal Variation requests"
}, },
{ {
"Value": 846040032, "Value": 846040032,
"Label": "Further Information - Interested Party Representations", "Label": "Further Information - Interested Party Representations"
}, },
{ {
"Value": 846040033, "Value": 846040033,
"Label": "Hearing Statements", "Label": "Hearing Statements"
}, },
{ {
"Value": 846040034, "Value": 846040034,
"Label": "Events - Recordings", "Label": "Events - Recordings"
}, },
{ {
"Value": 846040035, "Value": 846040035,
"Label": "Internal Correspondence", "Label": "Internal Correspondence"
}, },
{ {
"Value": 846040036, "Value": 846040036,
"Label": "Consultation Response", "Label": "Consultation Response"
}, }
]; ];
const getOrigin = [ const getOrigin = [
{ {
"Value": 846040000, "Value": 846040000,
"Label": "MDU", "Label": "MDU"
}, },
{ {
"Value": 846040001, "Value": 846040001,
"Label": "Portal", "Label": "Portal"
}, },
{ {
"Value": 846040002, "Value": 846040002,
"Label": "Manual", "Label": "Manual"
}, }
]; ];
const DocumentsTab = (props) => { const DocumentsTab = (props) => {
@@ -200,7 +200,7 @@ const DocumentsTab = (props) => {
setDocumentDetails, setDocumentDetails,
setCurrentPage, setCurrentPage,
docsOffline, docsOffline,
showFilteredDocs, showFilteredDocs
} = props; } = props;
const router = useRouter(); const router = useRouter();
@@ -236,7 +236,7 @@ const DocumentsTab = (props) => {
setCheckedItems((prev) => ({ setCheckedItems((prev) => ({
...prev, ...prev,
[name]: checked, [name]: checked
})); }));
setSelectAll(false); setSelectAll(false);
}; };
@@ -246,7 +246,7 @@ const DocumentsTab = (props) => {
setCheckedOriginItems((prev) => ({ setCheckedOriginItems((prev) => ({
...prev, ...prev,
[name]: checked, [name]: checked
})); }));
setSelectOriginAll(false); setSelectOriginAll(false);
}; };
@@ -404,7 +404,7 @@ const DocumentsTab = (props) => {
item.Label + item.Label +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item.Label || : item.Label ||
t( t(
@@ -477,7 +477,7 @@ const DocumentsTab = (props) => {
item.Label + item.Label +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item.Label || : item.Label ||
t( t(
@@ -496,7 +496,7 @@ const DocumentsTab = (props) => {
const checkedValues = [ const checkedValues = [
...document.querySelectorAll( ...document.querySelectorAll(
".govuk-checkboxes__input:checked" ".govuk-checkboxes__input:checked"
), )
].map((e) => e.value); ].map((e) => e.value);
const origins = checkedValues const origins = checkedValues
@@ -697,7 +697,7 @@ const DocumentsTab = (props) => {
incidentid + incidentid +
"')]", "')]",
json: item, json: item,
eval: true, eval: true
}); });
detailsObj = item; detailsObj = item;
return ( return (
@@ -831,7 +831,7 @@ const DocumentsTab = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: detailsObj[ : detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
@@ -946,7 +946,7 @@ const DocumentsTab = (props) => {
selectedDocumentType, selectedDocumentType,
selectedWeeks, selectedWeeks,
selectedDocumentOrigin, selectedDocumentOrigin,
props.setDocumentDetails, props.setDocumentDetails
] ]
); );
@@ -1081,7 +1081,7 @@ const DocumentsTab = (props) => {
getOrigin, getOrigin,
getDocumentResults, getDocumentResults,
lang, lang,
selectedWeeks, selectedWeeks
]); ]);
function countFieldValue(obj, field, targetValue) { function countFieldValue(obj, field, targetValue) {
@@ -1166,7 +1166,7 @@ const DocumentsTab = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
...state, ...state
}; };
}; };
@@ -1177,7 +1177,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
setCurrentPage: (currentPage) => { setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage)); dispatch(setCurrentPage(currentPage));
}, }
}; };
}; };
+11 -11
View File
@@ -4,9 +4,9 @@ import Link from "next/link";
import { bytesToSize } from "../../../components/utils"; import { bytesToSize } from "../../../components/utils";
import { import {
deleteMyRepresentationsFromBlob, deleteMyRepresentationsFromBlob,
deleteAwaitingSubmissionsFromBlob, deleteAwaitingSubmissionsFromBlob
sendRepCompleteMessage, } from "../../../actions/services/documentService";
} from "../../../actions"; import { sendRepCompleteMessage } from "../../../actions/services/portalService";
import { formatBlobDates } from "../utils/adminHelper"; import { formatBlobDates } from "../utils/adminHelper";
@@ -74,9 +74,9 @@ export default function StorageTab({ data, repCompleteCount }) {
showRepJson && folder.hasRepJson showRepJson && folder.hasRepJson
? { display: "block" } ? { display: "block" }
: showTmpFile && : showTmpFile &&
folder.hasTmpFile folder.hasTmpFile
? { display: "block" } ? { display: "block" }
: { display: "none" } : { display: "none" }
} }
> >
<h4>{folder.folderPath || "Root"}</h4> <h4>{folder.folderPath || "Root"}</h4>
@@ -150,7 +150,7 @@ export default function StorageTab({ data, repCompleteCount }) {
headers: headers:
{ {
"Content-Type": "Content-Type":
"application/json", "application/json"
}, },
body: JSON.stringify( body: JSON.stringify(
{ {
@@ -159,18 +159,18 @@ export default function StorageTab({ data, repCompleteCount }) {
blobName: blobName:
folder folder
.repJsonBlob .repJsonBlob
.name, .name
} }
), )
} }
); );
const result = const result =
await response.json(); await response.json();
if (response.ok) { if (response.ok) {
alert( (alert(
"repComplete removed!" "repComplete removed!"
), ),
window.location.reload(); window.location.reload());
// Optionally refresh the page or update UI state here // Optionally refresh the page or update UI state here
} else { } else {
alert( alert(
+4 -4
View File
@@ -67,7 +67,7 @@ export async function fetchAdminStorageData() {
const blobWithHash = { const blobWithHash = {
...blob, ...blob,
hashedfilepath, hashedfilepath,
isTmpFile, isTmpFile
}; };
let folderGroup = acc.find( let folderGroup = acc.find(
@@ -80,7 +80,7 @@ export async function fetchAdminStorageData() {
hasRepJson: false, hasRepJson: false,
repJsonBlob: null, repJsonBlob: null,
repComplete: false, repComplete: false,
hasTmpFile: false, hasTmpFile: false
}; };
acc.push(folderGroup); acc.push(folderGroup);
} }
@@ -137,7 +137,7 @@ export async function fetchAdminStorageData() {
? { ? {
id: user.id, id: user.id,
email: user.email, email: user.email,
containers: containersWithHashes, containers: containersWithHashes
} }
: null; : null;
}) })
@@ -150,7 +150,7 @@ export async function fetchAdminStorageData() {
.map((user) => ({ .map((user) => ({
id: user.id, id: user.id,
email: user.email, email: user.email,
created: user.emailVerified?.toLocaleString("en-GB") || "", created: user.emailVerified?.toLocaleString("en-GB") || ""
})); }));
let repCompleteCount = 0; let repCompleteCount = 0;
+19 -19
View File
@@ -12,8 +12,8 @@ import { sendGAEvent } from "@next/third-parties/google";
import { import {
getSearchDocumentDetails, getSearchDocumentDetails,
getSearchDocumentDetailsPaged, getSearchDocumentDetailsPaged,
getSearchDocumentTypes, getSearchDocumentTypes
} from "../../actions"; } from "../../actions/services/searchService";
import { setCurrentPage } from "../../store/currentView/action"; import { setCurrentPage } from "../../store/currentView/action";
import { setDocumentDetails } from "../../store/searchOutput/action"; import { setDocumentDetails } from "../../store/searchOutput/action";
@@ -32,7 +32,7 @@ const DocumentDetails = (props) => {
setDocumentDetails, setDocumentDetails,
setCurrentPage, setCurrentPage,
docsOffline, docsOffline,
showFilteredDocs, showFilteredDocs
} = props; } = props;
const router = useRouter(); const router = useRouter();
@@ -57,7 +57,7 @@ const DocumentDetails = (props) => {
setCheckedItems((prev) => ({ setCheckedItems((prev) => ({
...prev, ...prev,
[name]: checked, [name]: checked
})); }));
setSelectAll(false); setSelectAll(false);
}; };
@@ -132,7 +132,7 @@ const DocumentDetails = (props) => {
? jsonpath({ ? jsonpath({
path: '$..[?(@ && @.value=="All")].value_cy', path: '$..[?(@ && @.value=="All")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: "All"} : "All"}
</option> </option>
@@ -151,7 +151,7 @@ const DocumentDetails = (props) => {
item.pinswg_isharedocumentlocationsLabel + item.pinswg_isharedocumentlocationsLabel +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item.pinswg_isharedocumentlocationsLabel || : item.pinswg_isharedocumentlocationsLabel ||
t( t(
@@ -298,7 +298,7 @@ const DocumentDetails = (props) => {
incidentid + incidentid +
"')]", "')]",
json: item, json: item,
sanbox: {}, sanbox: {}
}); });
detailsObj = item; detailsObj = item;
return ( return (
@@ -330,7 +330,7 @@ const DocumentDetails = (props) => {
} }
key={key} key={key}
onClick={() => { onClick={() => {
toggleDownLoadLink(key), (toggleDownLoadLink(key),
sendGAEvent( sendGAEvent(
"event", "event",
"DownloadedFile", "DownloadedFile",
@@ -338,9 +338,9 @@ const DocumentDetails = (props) => {
caseReference: caseReference:
props.caseReference, props.caseReference,
filename: filename:
detailsObj.pinswg_name, detailsObj.pinswg_name
} }
); ));
}} }}
> >
<span className="results-visually-hidden"> <span className="results-visually-hidden">
@@ -388,7 +388,7 @@ const DocumentDetails = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: detailsObj[ : detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
@@ -554,7 +554,7 @@ const DocumentDetails = (props) => {
item.pinswg_isharedocumentlocationsLabel + item.pinswg_isharedocumentlocationsLabel +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item.pinswg_isharedocumentlocationsLabel || : item.pinswg_isharedocumentlocationsLabel ||
t( t(
@@ -574,7 +574,7 @@ const DocumentDetails = (props) => {
const data = [ const data = [
...document.querySelectorAll( ...document.querySelectorAll(
".govuk-checkboxes__input:checked" ".govuk-checkboxes__input:checked"
), )
].map((e) => e.value); ].map((e) => e.value);
setSelectedDocumentType(data); setSelectedDocumentType(data);
setCurrentPage(1); setCurrentPage(1);
@@ -710,7 +710,7 @@ const DocumentDetails = (props) => {
incidentid + incidentid +
"')]", "')]",
json: item, json: item,
eval: true, eval: true
}); });
detailsObj = item; detailsObj = item;
return ( return (
@@ -827,7 +827,7 @@ const DocumentDetails = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: detailsObj[ : detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
@@ -905,7 +905,7 @@ const DocumentDetails = (props) => {
props.incidentid, props.incidentid,
selectedOption, selectedOption,
selectedDocumentType, selectedDocumentType,
setDocumentDetails, setDocumentDetails
] ]
); );
@@ -1029,7 +1029,7 @@ const DocumentDetails = (props) => {
orderByState, orderByState,
getDocumentTypes, getDocumentTypes,
getDocumentResults, getDocumentResults,
lang, lang
]); ]);
return ( return (
<div className="govuk-grid-row"> <div className="govuk-grid-row">
@@ -1059,7 +1059,7 @@ const DocumentDetails = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
...state, ...state
}; };
}; };
@@ -1070,7 +1070,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
setCurrentPage: (currentPage) => { setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage)); dispatch(setCurrentPage(currentPage));
}, }
}; };
}; };
+5 -1
View File
@@ -6,7 +6,11 @@ import { connect } from "react-redux";
import { reduxForm } from "redux-form"; import { reduxForm } from "redux-form";
import { useSession } from "next-auth/react"; import { useSession } from "next-auth/react";
import { generateRepPDF, sendEmail, uploadRepFiles } from "../../../actions"; import {
generateRepPDF,
uploadRepFiles
} from "../../../actions/services/documentService";
import { sendEmail } from "../../../actions/services/notifyService";
import { formatDates, updateLinks } from "../../../components/utils"; import { formatDates, updateLinks } from "../../../components/utils";
import { import {
setRepresentationCapacity, setRepresentationCapacity,
@@ -7,10 +7,10 @@ import { connect } from "react-redux";
import { useDropzone } from "react-dropzone"; import { useDropzone } from "react-dropzone";
import { import {
createWatchedCases, createWatchedCases,
sendEmail,
sendRepCompleteMessage, sendRepCompleteMessage,
setRepInvolvment, setRepInvolvment
} from "../../../actions"; } from "../../../actions/services/portalService";
import { sendEmail } from "../../../actions/services/notifyService";
import { setRepresentationReset } from "../../../store/currentView/action"; import { setRepresentationReset } from "../../../store/currentView/action";
const RepComplete = (props) => { const RepComplete = (props) => {
@@ -27,7 +27,7 @@ const RepComplete = (props) => {
setSubmitBack, setSubmitBack,
setRepresentationSubmitConfirmation, setRepresentationSubmitConfirmation,
setRepresentationMessageSent, setRepresentationMessageSent,
repFormData, repFormData
} = props; } = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => ( const files = acceptedFiles.map((file) => (
@@ -55,10 +55,10 @@ const RepComplete = (props) => {
"emailAddress": "emailAddress":
props.props.props.props.accountDetails.accountDetails props.props.props.props.accountDetails.accountDetails
.emailaddress1, .emailaddress1,
"linkExpiry": 10 * 60, "linkExpiry": 10 * 60
}; };
props.props.currentView.representationMessageSent != true && (props.props.currentView.representationMessageSent != true &&
(setRepInvolvment( (setRepInvolvment(
props.props.currentView.caseReference.incidentid, props.props.currentView.caseReference.incidentid,
props.props.props.props.accountDetails.accountDetails.contactid props.props.props.props.accountDetails.accountDetails.contactid
@@ -89,10 +89,10 @@ const RepComplete = (props) => {
? props.props.currentView.caseReference.repDetails ? props.props.currentView.caseReference.repDetails
.representationType .representationType
: props.props.currentView.caseReference : props.props.currentView.caseReference
.representationType, .representationType
}), }),
setRepresentationMessageSent(true)), setRepresentationMessageSent(true)),
window.scrollTo({ top: 0, behavior: "smooth" }); window.scrollTo({ top: 0, behavior: "smooth" }));
}); });
return ( return (
<div id="rep-appellant"> <div id="rep-appellant">
@@ -130,7 +130,7 @@ const mapStateToProps = (state) => {
currentView: state.currentView, currentView: state.currentView,
myRepresentations: state.myRepresentations, myRepresentations: state.myRepresentations,
initialValues: state.currentView.caseReference.repDetails, initialValues: state.currentView.caseReference.repDetails,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
//form: state.form, //form: state.form,
}; };
}; };
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import { useState } from "react"; import { useState } from "react";
import { useDropzone } from "react-dropzone"; import { useDropzone } from "react-dropzone";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { generateRepPDF } from "../../../actions"; import { generateRepPDF } from "../../../actions/services/documentService";
import RepComplete from "./representationComplete"; import RepComplete from "./representationComplete";
import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement"; import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement";
import RepLPAQuestionnaireCheck_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78"; import RepLPAQuestionnaireCheck_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78";
@@ -14,7 +14,7 @@ import {
deleteRepBlob, deleteRepBlob,
getFilesFromBlobHashed, getFilesFromBlobHashed,
getFilesFromBlobproxy getFilesFromBlobproxy
} from "../../../actions"; } from "../../../actions/services/documentService";
const LoadingMessage = () => <div>Loading the editor...</div>; const LoadingMessage = () => <div>Loading the editor...</div>;
+5 -5
View File
@@ -6,7 +6,7 @@ import { useEffect, useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { getRepresentations } from "../../actions"; import { getRepresentations } from "../../actions/services/portalService";
import { setRepresentations } from "../../store/searchOutput/action"; import { setRepresentations } from "../../store/searchOutput/action";
import { formatDates } from "../utils"; import { formatDates } from "../utils";
@@ -63,7 +63,7 @@ const RepresentationList = (props) => {
incidentid + incidentid +
"')]", "')]",
json: item, json: item,
eval: true, eval: true
}); });
detailsObj = item; detailsObj = item;
@@ -97,7 +97,7 @@ const RepresentationList = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
sanbox: {}, sanbox: {}
}) })
: detailsObj[ : detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
@@ -216,7 +216,7 @@ const RepresentationList = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
...state, ...state
}; };
}; };
@@ -224,7 +224,7 @@ const mapDispatchToProps = (dispatch) => {
return { return {
setRepresentations: (representationObj) => { setRepresentations: (representationObj) => {
dispatch(setRepresentations(representationObj)); dispatch(setRepresentations(representationObj));
}, }
}; };
}; };
+3 -3
View File
@@ -13,11 +13,11 @@ import MediaDetails from "./media";
import { import {
createWatchedCases, createWatchedCases,
deleteWatchedCases, deleteWatchedCases,
getLinkedCases,
getPortalModuleDetailsProxy,
getWatchedCasesProxy, getWatchedCasesProxy,
setCaseInvolvment setCaseInvolvment
} from "../../actions"; } from "../../actions/services/portalService";
import { getLinkedCases } from "../../actions/services/searchService";
import { getPortalModuleDetailsProxy } from "../../actions/services/caseService";
import { import {
setCurrentLinkedCases, setCurrentLinkedCases,
setCurrentReference, setCurrentReference,
+1 -1
View File
@@ -15,7 +15,7 @@ import {
getFilesFromBlobHashed, getFilesFromBlobHashed,
uploadSingleFile, uploadSingleFile,
getFilesFromBlobproxy getFilesFromBlobproxy
} from "../../actions"; } from "../../actions/services/documentService";
import fieldLookup from "../../data/crmfieldlookuptranslations.json"; import fieldLookup from "../../data/crmfieldlookuptranslations.json";
import pickListLookup from "../../data/picklistLookups.json"; import pickListLookup from "../../data/picklistLookups.json";
@@ -7,7 +7,7 @@ import { connect } from "react-redux";
import { import {
deleteAwaitingSubmissionsFromBlob, deleteAwaitingSubmissionsFromBlob,
getAwaitingSubmissionFromBlobProxy getAwaitingSubmissionFromBlobProxy
} from "../../actions"; } from "../../actions/services/documentService";
import { getFormCollectionByID } from "../../components/utils"; import { getFormCollectionByID } from "../../components/utils";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { import {
+58 -52
View File
@@ -10,22 +10,22 @@ import {
deleteWatchedCases, deleteWatchedCases,
getAwaitingSubmissionProxy, getAwaitingSubmissionProxy,
getPortalModuleDetailsProxy, getPortalModuleDetailsProxy,
getWatchedCasesProxy, getWatchedCasesProxy
} from "../../actions"; } from "../../actions/services/portalService";
import { getFormCollectionByID, getDetailsProxy } from "../../components/utils"; import { getFormCollectionByID, getDetailsProxy } from "../../components/utils";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { import {
setAwaitingSubmission, setAwaitingSubmission,
setAwaitingSubmissionDetails, setAwaitingSubmissionDetails
} from "../../store/awaitingSubmission/action"; } from "../../store/awaitingSubmission/action";
import { setCurrentReference } from "../../store/currentView/action"; import { setCurrentReference } from "../../store/currentView/action";
import { import {
setSearchDetails, setSearchDetails,
setSearchResults, setSearchResults
} from "../../store/searchOutput/action"; } from "../../store/searchOutput/action";
import { import {
setWatchedCases, setWatchedCases,
setWatchedCasesDetails, setWatchedCasesDetails
} from "../../store/watchedCases/action"; } from "../../store/watchedCases/action";
import { planningappeals78_pdf } from "../../components/pdftemplates/planningappeals78_pdf"; import { planningappeals78_pdf } from "../../components/pdftemplates/planningappeals78_pdf";
@@ -47,7 +47,7 @@ const TopThree = (props) => {
setAwaitingSubmissionDetails, setAwaitingSubmissionDetails,
setSearchResults, setSearchResults,
setSearchDetails, setSearchDetails,
showLoginCheck, showLoginCheck
} = props; } = props;
const router = useRouter(); const router = useRouter();
@@ -132,19 +132,19 @@ const TopThree = (props) => {
let newObj = {}; let newObj = {};
return Object.assign(newObj, { return Object.assign(newObj, {
"@odata.count": required.length, "@odata.count": required.length,
"value": required, "value": required
}); });
}; };
let filteredWatchedCases = showWatchedCases(data); let filteredWatchedCases = showWatchedCases(data);
setWatchedCases(filteredWatchedCases), (setWatchedCases(filteredWatchedCases),
getDetailsProxy( getDetailsProxy(
filteredWatchedCases, filteredWatchedCases,
"myWatchedCases" "myWatchedCases"
).then((data) => { ).then((data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
}); }));
}); });
}); });
@@ -156,7 +156,7 @@ const TopThree = (props) => {
.then(() => { .then(() => {
getAwaitingSubmissionProxy(cookies.pinsUser).then( getAwaitingSubmissionProxy(cookies.pinsUser).then(
(data) => { (data) => {
setAwaitingSubmission(data), (setAwaitingSubmission(data),
getDetailsProxy( getDetailsProxy(
data, data,
"awaitingSubmission" "awaitingSubmission"
@@ -166,7 +166,7 @@ const TopThree = (props) => {
// data // data
// ); // );
setAwaitingSubmissionDetails(data); setAwaitingSubmissionDetails(data);
}); }));
} }
); );
}); });
@@ -196,7 +196,7 @@ const TopThree = (props) => {
const res = await fetch("/api/file/generateappealpdfcopy", { const res = await fetch("/api/file/generateappealpdfcopy", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ docProps }), body: JSON.stringify({ docProps })
}); });
if (!res.ok) throw new Error("PDF generation failed"); if (!res.ok) throw new Error("PDF generation failed");
@@ -287,25 +287,25 @@ const TopThree = (props) => {
"&inid=" + "&inid=" +
showTopThreeArr[key].incidentid showTopThreeArr[key].incidentid
: router.locale == "cy" : router.locale == "cy"
? "/fymhorth/achos/" + ? "/fymhorth/achos/" +
showTopThreeArr[key].ticketnumber + showTopThreeArr[key].ticketnumber +
"?key=" + "?key=" +
topThreeType + topThreeType +
"&appealType=" + "&appealType=" +
showTopThreeArr[key] showTopThreeArr[key]
.pinswg_appealcasetype .pinswg_appealcasetype
: "/myportal/case/" + : "/myportal/case/" +
showTopThreeArr[key].ticketnumber + showTopThreeArr[key].ticketnumber +
"?key=" + "?key=" +
topThreeType + topThreeType +
"&appealType=" + "&appealType=" +
showTopThreeArr[key] showTopThreeArr[key]
.pinswg_appealcasetype .pinswg_appealcasetype
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
data-id={index} data-id={index}
onClick={() => { onClick={() => {
setSearchResults( (setSearchResults(
props.props[topThreeType][topThreeType] props.props[topThreeType][topThreeType]
), ),
setSearchDetails( setSearchDetails(
@@ -337,8 +337,8 @@ const TopThree = (props) => {
"appealType": "appealType":
showTopThreeArr[key] showTopThreeArr[key]
.pinswg_appealcasetype, .pinswg_appealcasetype
}); }));
}} }}
> >
{showTopThreeArr[key].pinswg_title} {showTopThreeArr[key].pinswg_title}
@@ -423,7 +423,7 @@ const TopThree = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: showTopThreeArr[key][ : showTopThreeArr[key][
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
@@ -436,26 +436,32 @@ const TopThree = (props) => {
{_.isEmpty(showTopThreeArr[key]) {_.isEmpty(showTopThreeArr[key])
? t("myportal:case-address-not-entered") ? t("myportal:case-address-not-entered")
: _.isEmpty(showTopThreeArr[key]) : _.isEmpty(showTopThreeArr[key])
? t("myportal:case-address-not-entered") ? t("myportal:case-address-not-entered")
: _.isEmpty(showTopThreeArr[key]) : _.isEmpty(showTopThreeArr[key])
? t("myportal:case-address-not-entered") ? t("myportal:case-address-not-entered")
: _.isEmpty( : _.isEmpty(
showTopThreeArr[key].pinswg_siteaddressline1 showTopThreeArr[key]
) .pinswg_siteaddressline1
? t("myportal:case-address-not-entered") )
: showTopThreeArr[key].pinswg_siteaddressline1 + ? t("myportal:case-address-not-entered")
(!_.isEmpty( : showTopThreeArr[key]
showTopThreeArr[key].pinswg_siteaddressline2 .pinswg_siteaddressline1 +
) (!_.isEmpty(
? ", " + showTopThreeArr[key]
showTopThreeArr[key].pinswg_siteaddressline2 .pinswg_siteaddressline2
: "") + )
(!_.isEmpty( ? ", " +
showTopThreeArr[key].pinswg_siteaddresstown showTopThreeArr[key]
) .pinswg_siteaddressline2
? ", " + : "") +
showTopThreeArr[key].pinswg_siteaddresstown (!_.isEmpty(
: "")} showTopThreeArr[key]
.pinswg_siteaddresstown
)
? ", " +
showTopThreeArr[key]
.pinswg_siteaddresstown
: "")}
</div> </div>
{showTopThreeArr[key].pinswg_appellantagent != null && ( {showTopThreeArr[key].pinswg_appellantagent != null && (
<div className="cardModuleReference"> <div className="cardModuleReference">
@@ -495,7 +501,7 @@ const TopThree = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: showTopThreeArr[key][ : showTopThreeArr[key][
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
@@ -591,7 +597,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
setSearchDetails: (searchDetails) => { setSearchDetails: (searchDetails) => {
dispatch(setSearchDetails(searchDetails)); dispatch(setSearchDetails(searchDetails));
}, }
}; };
}; };
+45 -43
View File
@@ -6,30 +6,32 @@ import { parseCookies } from "nookies";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { import {
deleteAwaitingSubmissions, deleteAwaitingSubmissions,
deleteMyRepresentationsFromBlob,
deleteWatchedCases, deleteWatchedCases,
getAwaitingSubmissionProxy, getAwaitingSubmissionProxy,
getPortalModuleDetailsProxy, getWatchedCasesProxy
getRepsFromBlobProxy, } from "../../actions/services/portalService";
getWatchedCasesProxy, import {
} from "../../actions"; deleteMyRepresentationsFromBlob,
getRepsFromBlobProxy
} from "../../actions/services/documentService";
import { consoleLogger } from "../../actions/core/logger";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { import {
setAwaitingSubmission, setAwaitingSubmission,
setAwaitingSubmissionDetails, setAwaitingSubmissionDetails
} from "../../store/awaitingSubmission/action"; } from "../../store/awaitingSubmission/action";
import { import {
setCurrentReference, setCurrentReference,
setCurrentView, setCurrentView,
setRepresentationCapacity, setRepresentationCapacity
} from "../../store/currentView/action"; } from "../../store/currentView/action";
import { import {
setMyRepresentations, setMyRepresentations,
setMyRepresentationsDetails, setMyRepresentationsDetails
} from "../../store/myRepresentations/action"; } from "../../store/myRepresentations/action";
import { import {
setWatchedCases, setWatchedCases,
setWatchedCasesDetails, setWatchedCasesDetails
} from "../../store/watchedCases/action"; } from "../../store/watchedCases/action";
import { getFormCollectionByID, getDetailsProxy } from "../utils"; import { getFormCollectionByID, getDetailsProxy } from "../utils";
@@ -46,7 +48,7 @@ const TopThree = (props) => {
setAwaitingSubmissionDetails, setAwaitingSubmissionDetails,
setMyRepresentations, setMyRepresentations,
setMyRepresentationsDetails, setMyRepresentationsDetails,
setRepresentationCapacity, setRepresentationCapacity
} = props; } = props;
const router = useRouter(); const router = useRouter();
@@ -80,12 +82,12 @@ const TopThree = (props) => {
.then((data) => data) .then((data) => data)
.then(() => { .then(() => {
getWatchedCasesProxy(cookies.pinsUser).then((data) => { getWatchedCasesProxy(cookies.pinsUser).then((data) => {
setWatchedCases(data), (setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then( getDetailsProxy(data, "myWatchedCases").then(
(data) => { (data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
} }
); ));
}); });
}); });
@@ -97,7 +99,7 @@ const TopThree = (props) => {
.then(() => { .then(() => {
getAwaitingSubmissionProxy(cookies.pinsUser).then( getAwaitingSubmissionProxy(cookies.pinsUser).then(
(data) => { (data) => {
setAwaitingSubmission(data), (setAwaitingSubmission(data),
getDetailsProxy( getDetailsProxy(
data, data,
"awaitingSubmission" "awaitingSubmission"
@@ -107,7 +109,7 @@ const TopThree = (props) => {
// data // data
// ); // );
setAwaitingSubmissionDetails(data); setAwaitingSubmissionDetails(data);
}); }));
} }
); );
}); });
@@ -136,12 +138,12 @@ const TopThree = (props) => {
}) })
.catch((error) => { .catch((error) => {
consoleLogger(error); consoleLogger(error);
res.status(400).json(error); return null;
}) })
.then(() => { .then(() => {
setCurrentView({ setCurrentView({
"viewName": "My Representations", "viewName": "My Representations",
"viewKey": "myRepresentations", "viewKey": "myRepresentations"
}); });
}); });
}); });
@@ -211,7 +213,7 @@ const TopThree = (props) => {
style={{ style={{
color: "#0360a6", color: "#0360a6",
cursor: "pointer", cursor: "pointer",
fontWeight: "bold", fontWeight: "bold"
}} }}
data-id={index} data-id={index}
onClick={() => { onClick={() => {
@@ -225,7 +227,7 @@ const TopThree = (props) => {
showTopThreeArr[key].incidentID, showTopThreeArr[key].incidentID,
"appealType": "appealType":
showTopThreeArr[key].appealType, showTopThreeArr[key].appealType,
"repDetails": showTopThreeArr[key], "repDetails": showTopThreeArr[key]
}); });
isLPA && setRepresentationCapacity("LPA"); isLPA && setRepresentationCapacity("LPA");
router.push({ router.push({
@@ -239,8 +241,8 @@ const TopThree = (props) => {
state: "edit", state: "edit",
created: created:
showTopThreeArr[key] showTopThreeArr[key]
.repfile_name, .repfile_name
}, }
}); });
}} }}
> >
@@ -294,7 +296,7 @@ const TopThree = (props) => {
showTopThreeArr[key].representationType + showTopThreeArr[key].representationType +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: showTopThreeArr[key].representationType || ""} : showTopThreeArr[key].representationType || ""}
</div> </div>
@@ -312,27 +314,27 @@ const TopThree = (props) => {
.representationCapacity + .representationCapacity +
'" )].value_cy', '" )].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: jsonpath({ : jsonpath({
path: path:
'$..[?(@ && @.value_cy=="' + '$..[?(@ && @.value_cy=="' +
showTopThreeArr[key] showTopThreeArr[key]
.representationCapacity + .representationCapacity +
'")].value', '")].value',
json: transLookup, json: transLookup,
eval: true, eval: true
}).length > 0 }).length > 0
? jsonpath({ ? jsonpath({
path: path:
'$..[?(@ && @.value_cy=="' + '$..[?(@ && @.value_cy=="' +
showTopThreeArr[key] showTopThreeArr[key]
.representationCapacity + .representationCapacity +
'")].value', '")].value',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: showTopThreeArr[key].representationCapacity} : showTopThreeArr[key].representationCapacity}
</div> </div>
<div className="cardModuleReference"> <div className="cardModuleReference">
<b>{t("myportal:date-raised")}:</b> <b>{t("myportal:date-raised")}:</b>
@@ -352,7 +354,7 @@ const TopThree = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: showTopThreeArr[key][ : showTopThreeArr[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
@@ -400,7 +402,7 @@ const TopThree = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
// currentView: state.currentView, // currentView: state.currentView,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
// search: state.search, // search: state.search,
// searchResultsObj: state.searchResultsObj, // searchResultsObj: state.searchResultsObj,
}; };
@@ -431,7 +433,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
setRepresentationCapacity: (representationCapacity) => { setRepresentationCapacity: (representationCapacity) => {
dispatch(setRepresentationCapacity(representationCapacity)); dispatch(setRepresentationCapacity(representationCapacity));
}, }
}; };
}; };
+12 -12
View File
@@ -4,7 +4,7 @@ import { useMemo, useState } from "react";
import Dropzone from "react-dropzone"; import Dropzone from "react-dropzone";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Field, reduxForm } from "redux-form"; import { Field, reduxForm } from "redux-form";
import { uploadFiles } from "../../actions"; import { uploadFiles } from "../../actions/services/documentService";
import { bytesToSize } from "../utils"; import { bytesToSize } from "../utils";
const required = (errorMsg) => (value) => const required = (errorMsg) => (value) =>
@@ -79,25 +79,25 @@ const baseStyle = {
color: "#bdbdbd", color: "#bdbdbd",
transition: "border .3s ease-in-out", transition: "border .3s ease-in-out",
width: "80%", width: "80%",
margin: "20px auto 30px", margin: "20px auto 30px"
}; };
const activeStyle = { const activeStyle = {
borderColor: "#2196f3", borderColor: "#2196f3"
}; };
const acceptStyle = { const acceptStyle = {
borderColor: "#00e676", borderColor: "#00e676"
}; };
const rejectStyle = { const rejectStyle = {
borderColor: "#ff1744", borderColor: "#ff1744"
}; };
const RenderFileUpload = (field) => { const RenderFileUpload = (field) => {
const files = field.input.value; const files = field.input.value;
const style = useMemo( const style = useMemo(
() => ({ () => ({
...baseStyle, ...baseStyle
// ...(isDragActive ? activeStyle : {}), // ...(isDragActive ? activeStyle : {}),
// ...(isDragAccept ? acceptStyle : {}), // ...(isDragAccept ? acceptStyle : {}),
// ...(isDragReject ? rejectStyle : {}), // ...(isDragReject ? rejectStyle : {}),
@@ -220,7 +220,7 @@ const RenderFileUpload = (field) => {
field.documentTypeCode field.documentTypeCode
)}_${file.name}`, )}_${file.name}`,
{ {
type: file.type, type: file.type
} }
) )
); );
@@ -323,7 +323,7 @@ let UploadFile = (props) => {
t( t(
"myportal:searchcases-validation-minlength" "myportal:searchcases-validation-minlength"
) )
), )
]} ]}
className="govuk-input" className="govuk-input"
component={RenderTextfield} component={RenderTextfield}
@@ -428,11 +428,11 @@ const mapStateToProps = (state) => {
"pinswg_developmentdescription": "something to go here", "pinswg_developmentdescription": "something to go here",
"pinswg_agriculturalholding": 846040000, "pinswg_agriculturalholding": 846040000,
"_pinswg_planningappeals78ids_value": "_pinswg_planningappeals78ids_value":
"50b533aa-43f1-ec11-aade-00224800be9c", "50b533aa-43f1-ec11-aade-00224800be9c"
}, },
initialValues: { initialValues: {
caseReference: "CAS-00764-L0Q9W2", caseReference: "CAS-00764-L0Q9W2"
}, }
}; };
}; };
@@ -447,6 +447,6 @@ export default connect(
reduxForm({ reduxForm({
form: "uploadFileForm", form: "uploadFileForm",
destroyOnUnmount: false, destroyOnUnmount: false,
enableReinitialize: true, // this is needed!! enableReinitialize: true // this is needed!!
})(UploadFile) })(UploadFile)
); );
+8 -5
View File
@@ -9,13 +9,16 @@ import { connect } from "react-redux";
import { import {
deleteAwaitingSubmissionsFromBlob, deleteAwaitingSubmissionsFromBlob,
deleteMyRepresentationsFromBlob, deleteMyRepresentationsFromBlob,
deleteWatchedCases,
getAwaitingSubmissionFromBlobProxy, getAwaitingSubmissionFromBlobProxy,
getRepsFromBlobProxy, getRepsFromBlobProxy
getWatchedCasesProxy, } from "../../actions/services/documentService";
import {
createWatchedCases,
deleteWatchedCases,
getWatchedCases, getWatchedCases,
createWatchedCases getWatchedCasesProxy
} from "../../actions"; } from "../../actions/services/portalService";
import { consoleLogger } from "../../actions/core/logger";
import { getDetailsProxy, getFormCollectionByID } from "../../components/utils"; import { getDetailsProxy, getFormCollectionByID } from "../../components/utils";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { setAwaitingSubmissionFromBlob } from "../../store/awaitingSubmission/action"; import { setAwaitingSubmissionFromBlob } from "../../store/awaitingSubmission/action";
+11 -10
View File
@@ -9,16 +9,17 @@ import xpath from "xpath";
import fieldLookup from "../../data/crmfieldlookuptranslations.json"; import fieldLookup from "../../data/crmfieldlookuptranslations.json";
import { import {
setCurrentSection, setCurrentSection,
setFormComplete, setFormComplete
} from "../../store/appealType/action"; } from "../../store/appealType/action";
import BuildCheckRow from "./buildcheckrow"; import BuildCheckRow from "./buildcheckrow";
import { generateAppealPDF, sendCaseCompleteMessage } from "../../actions"; import { generateAppealPDF } from "../../actions/services/documentService";
import { sendCaseCompleteMessage } from "../../actions/services/portalService";
import { import {
bytesToSize, bytesToSize,
getThumbnailIconByExtension, getThumbnailIconByExtension,
updateLinks, updateLinks,
getDocLink, getDocLink
} from "../utils"; } from "../utils";
let BuildCheckSection = (props) => { let BuildCheckSection = (props) => {
@@ -40,7 +41,7 @@ let BuildCheckSection = (props) => {
setCurrentSection, setCurrentSection,
updateCurrentSection, updateCurrentSection,
mandatoryFieldsData, mandatoryFieldsData,
docsOffline, docsOffline
} = props; } = props;
const parser = new DOMParser(); const parser = new DOMParser();
@@ -118,7 +119,7 @@ let BuildCheckSection = (props) => {
Object.assign(pdfObj, { Object.assign(pdfObj, {
"filesList": buildAppealFilesArray, "filesList": buildAppealFilesArray,
"containerID": props.props.accountDetails.containerID, "containerID": props.props.accountDetails.containerID,
"casefolderID": props.appealType.caseReference.ticketnumber, "casefolderID": props.appealType.caseReference.ticketnumber
}); });
const [confirmSections, setConfirmSections] = useState(false); const [confirmSections, setConfirmSections] = useState(false);
@@ -132,7 +133,7 @@ let BuildCheckSection = (props) => {
let formObj = jsonpath({ let formObj = jsonpath({
path: "$['" + appealtypes + "']", path: "$['" + appealtypes + "']",
json: fieldLookup, json: fieldLookup,
eval: true, eval: true
}); });
let labelTrans = let labelTrans =
@@ -140,7 +141,7 @@ let BuildCheckSection = (props) => {
? jsonpath({ ? jsonpath({
path: '$..[?(@ && @.value=="' + label + '")].value_cy', path: '$..[?(@ && @.value=="' + label + '")].value_cy',
json: formObj, json: formObj,
eval: true, eval: true
}) })
: label; : label;
return labelTrans; return labelTrans;
@@ -393,7 +394,7 @@ const mapStateToProps = (state) => {
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
form: state.form, form: state.form
}; };
}; };
@@ -405,7 +406,7 @@ const mapDispatchToProps = (dispatch) => {
updateCurrentSection: (whichSection) => { updateCurrentSection: (whichSection) => {
dispatch(setCurrentSection(whichSection)); dispatch(setCurrentSection(whichSection));
dispatch(setFormComplete("true")); dispatch(setFormComplete("true"));
}, }
}; };
}; };
@@ -424,6 +425,6 @@ export default connect(
reduxForm({ reduxForm({
form: "appealForm", form: "appealForm",
destroyOnUnmount: false, destroyOnUnmount: false,
enableReinitialize: true, // this is needed!! enableReinitialize: true // this is needed!!
})(BuildCheckSection) })(BuildCheckSection)
); );
+12 -11
View File
@@ -5,13 +5,14 @@ import { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { formValueSelector, reduxForm } from "redux-form"; import { formValueSelector, reduxForm } from "redux-form";
import xpath from "xpath"; import xpath from "xpath";
import { sendEmail, uploadFiles } from "../../actions"; import { uploadFiles } from "../../actions/services/documentService";
import { sendEmail } from "../../actions/services/notifyService";
import { import {
setCurrentSection, setCurrentSection,
setDocumentsList, setDocumentsList,
setFilesForAppeal, setFilesForAppeal,
setNewAppealProgress, setNewAppealProgress,
setFileCount, setFileCount
} from "../../store/appealType/action"; } from "../../store/appealType/action";
import { getFormCollectionByID, getProgressObj, updateLinks } from "../utils"; import { getFormCollectionByID, getProgressObj, updateLinks } from "../utils";
import BuildRow from "./buildrow"; import BuildRow from "./buildrow";
@@ -48,7 +49,7 @@ let BuildSection = (props) => {
setCurrentSection, setCurrentSection,
refno, refno,
gotoSection, gotoSection,
mandatoryFieldsData, mandatoryFieldsData
} = props; } = props;
const documentListObj = props.appealType.documentList; const documentListObj = props.appealType.documentList;
@@ -159,7 +160,7 @@ let BuildSection = (props) => {
typeof filesUploadObj[key][j].name != "undefined" && typeof filesUploadObj[key][j].name != "undefined" &&
buildAppealFilesArray.push({ buildAppealFilesArray.push({
"name": filesUploadObj[key][j].name, "name": filesUploadObj[key][j].name,
"size": filesUploadObj[key][j].size, "size": filesUploadObj[key][j].size
}); });
} }
} }
@@ -220,7 +221,7 @@ let BuildSection = (props) => {
"/contacts(" + props.props.accountDetails.loggedinUserId + ")", "/contacts(" + props.props.accountDetails.loggedinUserId + ")",
"pinswg_name": props.appealType.caseReference.ticketnumber, "pinswg_name": props.appealType.caseReference.ticketnumber,
[updateBindAppealTypeToIncident + "@odata.bind"]: [updateBindAppealTypeToIncident + "@odata.bind"]:
"/incidents(" + incidentId + ")", "/incidents(" + incidentId + ")"
}); });
updateBody = JSON.stringify(updateBody); updateBody = JSON.stringify(updateBody);
@@ -261,7 +262,7 @@ let BuildSection = (props) => {
props.appealType.caseReference.ticketnumber + props.appealType.caseReference.ticketnumber +
"&inid=" + "&inid=" +
props.appealType.caseReference.incidentid, props.appealType.caseReference.incidentid,
"linkExpiry": 10 * 60, "linkExpiry": 10 * 60
}; };
// console.log( // console.log(
@@ -316,7 +317,7 @@ let BuildSection = (props) => {
for (let j in filesUploadObj[key]) { for (let j in filesUploadObj[key]) {
buildAppealFilesArray.push({ buildAppealFilesArray.push({
"name": filesUploadObj[key][j].name, "name": filesUploadObj[key][j].name,
"size": filesUploadObj[key][j].size, "size": filesUploadObj[key][j].size
}); });
} }
} }
@@ -665,14 +666,14 @@ const mapStateToProps = (state, ownProps) => {
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
initialValues: state.appealType.caseReference.caseDetails, initialValues: state.appealType.caseReference.caseDetails,
currentView: state.currentView, currentView: state.currentView
} }
: { : {
search: state.search, search: state.search,
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
currentView: state.currentView, currentView: state.currentView
//form: state.form, //form: state.form,
}; };
}; };
@@ -696,7 +697,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
setFileCount: (fileCount) => { setFileCount: (fileCount) => {
dispatch(setFileCount(fileCount)); dispatch(setFileCount(fileCount));
}, }
}; };
}; };
@@ -758,6 +759,6 @@ export default connect(
form: "appealForm", form: "appealForm",
destroyOnUnmount: false, destroyOnUnmount: false,
enableReinitialize: true, // this is needed!! enableReinitialize: true, // this is needed!!
validate, validate
})(BuildSection) })(BuildSection)
); );
+7 -7
View File
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import { useEffect } from "react"; import { useEffect } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { formValueSelector } from "redux-form"; import { formValueSelector } from "redux-form";
import { sendEmail } from "../../actions"; import { sendEmail } from "../../actions/services/notifyService";
import { setCurrentSection } from "../../store/appealType/action"; import { setCurrentSection } from "../../store/appealType/action";
import { getFormCollectionByID } from "../utils"; import { getFormCollectionByID } from "../utils";
@@ -28,7 +28,7 @@ let CompleteAppeal = (props) => {
"/accounts(" + props.appealType.appealLPA + ")", "/accounts(" + props.appealType.appealLPA + ")",
"pinswg_name": props.appealType.caseReference.ticketnumber, "pinswg_name": props.appealType.caseReference.ticketnumber,
[updateBindAppealTypeToIncident + "@odata.bind"]: [updateBindAppealTypeToIncident + "@odata.bind"]:
"/incidents(" + incidentId + ")", "/incidents(" + incidentId + ")"
}); });
updateBody = JSON.stringify(updateBody); updateBody = JSON.stringify(updateBody);
@@ -53,7 +53,7 @@ let CompleteAppeal = (props) => {
const personalisation = { const personalisation = {
"caseReference": props.appealType.caseReference.ticketnumber, "caseReference": props.appealType.caseReference.ticketnumber,
"emailAddress": props.props.accountDetails.loggedinUserEmail, "emailAddress": props.props.accountDetails.loggedinUserEmail,
"linkExpiry": 10 * 60, "linkExpiry": 10 * 60
}; };
sendEmail(templateId, emailAddress, personalisation, reference); sendEmail(templateId, emailAddress, personalisation, reference);
@@ -73,7 +73,7 @@ let CompleteAppeal = (props) => {
props.props.accountDetails.loggedinUserId, props.props.accountDetails.loggedinUserId,
props.appealType.appealTypeID, props.appealType.appealTypeID,
props.props.accountDetails.loggedinUserEmail, props.props.accountDetails.loggedinUserEmail,
props.props.accountDetails.containerID, props.props.accountDetails.containerID
]); ]);
let { t } = useTranslation(); let { t } = useTranslation();
@@ -87,7 +87,7 @@ let CompleteAppeal = (props) => {
onSubmit, onSubmit,
handleSubmit, handleSubmit,
formTitle, formTitle,
setCurrentSection, setCurrentSection
} = props; } = props;
const currentSection = props.appealType.currentSection; const currentSection = props.appealType.currentSection;
@@ -157,7 +157,7 @@ const mapStateToProps = (state) => {
search: state.search, search: state.search,
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType
//form: state.form, //form: state.form,
}; };
}; };
@@ -166,7 +166,7 @@ const mapDispatchToProps = (dispatch) => {
return { return {
setCurrentSection: (currentSection) => { setCurrentSection: (currentSection) => {
dispatch(setCurrentSection(currentSection)); dispatch(setCurrentSection(currentSection));
}, }
}; };
}; };
+38 -33
View File
@@ -5,12 +5,13 @@ import { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Field, formValueSelector, reduxForm } from "redux-form"; import { Field, formValueSelector, reduxForm } from "redux-form";
import { consoleLogger, createNewCaseBlob } from "../../actions"; import { consoleLogger } from "../../actions/core/logger";
import { createNewCaseBlob } from "../../actions/services/caseService";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { import {
setAppealLPA, setAppealLPA,
setAppealTypeID, setAppealTypeID,
setAppealTypeTitle, setAppealTypeTitle
} from "../../store/appealType/action"; } from "../../store/appealType/action";
import { getFormCollectionByID } from "../utils"; import { getFormCollectionByID } from "../utils";
import Aboutyou from "./aboutyou"; import Aboutyou from "./aboutyou";
@@ -21,7 +22,7 @@ const RenderLPAList = ({
optionsObj, optionsObj,
meta: { touched, error }, meta: { touched, error },
label, label,
errorMsg, errorMsg
}) => { }) => {
let { t } = useTranslation(); let { t } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -71,7 +72,7 @@ const RenderLPAList = ({
optionsObj[key].name + optionsObj[key].name +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: optionsObj[key].name} : optionsObj[key].name}
</option> </option>
@@ -90,7 +91,7 @@ const RenderAppealTypeList = ({
optionsObj, optionsObj,
meta: { touched, error }, meta: { touched, error },
label, label,
errorMsg, errorMsg
}) => { }) => {
let { t } = useTranslation(); let { t } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -133,31 +134,35 @@ const RenderAppealTypeList = ({
_.isEmpty(optionsObj[key]) _.isEmpty(optionsObj[key])
? "" ? ""
: _.isEmpty(optionsObj[key]) : _.isEmpty(optionsObj[key])
? "" ? ""
: _.isEmpty( : _.isEmpty(
optionsObj[key].value optionsObj[key]
) .value
? "" )
: optionsObj[key] ? ""
.attributevalue : optionsObj[key]
.attributevalue
} }
> >
{_.isEmpty(optionsObj[key]) {_.isEmpty(optionsObj[key])
? "" ? ""
: _.isEmpty(optionsObj[key]) : _.isEmpty(optionsObj[key])
? "" ? ""
: _.isEmpty(optionsObj[key].value) : _.isEmpty(
? "" optionsObj[key].value
: router.locale == "cy" )
? jsonpath({ ? ""
path: : router.locale == "cy"
'$..[?(@ && @.value=="' + ? jsonpath({
optionsObj[key].value + path:
'")].value_cy', '$..[?(@ && @.value=="' +
json: transLookup, optionsObj[key]
eval: true, .value +
}) '")].value_cy',
: optionsObj[key].value} json: transLookup,
eval: true
})
: optionsObj[key].value}
</option> </option>
); );
})} })}
@@ -255,7 +260,7 @@ const RenderRadio = ({
{ {
["documentCheckList_" + ["documentCheckList_" +
id]: id]:
custom.requiredDocumentLabel, custom.requiredDocumentLabel
} }
)) ))
: delete docListObj[ : delete docListObj[
@@ -289,7 +294,7 @@ function Radiofield(props) {
form, form,
formProps, formProps,
parentFieldShowOnValue, parentFieldShowOnValue,
validation, validation
} = props; } = props;
let { t } = useTranslation(); let { t } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -401,9 +406,9 @@ let CreateCase = (props) => {
values.appealTypes == "846040004" && values.confirmHASCAS == "true" values.appealTypes == "846040004" && values.confirmHASCAS == "true"
? "846040004" ? "846040004"
: values.appealTypes == "846040004" && : values.appealTypes == "846040004" &&
values.confirmHASCAS == "false" values.confirmHASCAS == "false"
? "846040000" ? "846040000"
: values.appealTypes; : values.appealTypes;
var whichAppealType = whichAppealType; var whichAppealType = whichAppealType;
@@ -570,7 +575,7 @@ const mapStateToProps = (state) => {
search: state.search, search: state.search,
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType
//form: state.form, //form: state.form,
}; };
}; };
@@ -587,7 +592,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
onChangeSelectLPA: (lpaId) => { onChangeSelectLPA: (lpaId) => {
dispatch(setAppealLPA(lpaId)); dispatch(setAppealLPA(lpaId));
}, }
}; };
}; };
@@ -599,6 +604,6 @@ export default connect(
)( )(
reduxForm({ reduxForm({
form: "caseForm", form: "caseForm",
destroyOnUnmount: false, destroyOnUnmount: false
})(CreateCase) })(CreateCase)
); );
+1 -1
View File
@@ -28,7 +28,7 @@ import {
createWatchedCases, createWatchedCases,
deleteWatchedCases, deleteWatchedCases,
getWatchedCasesProxy getWatchedCasesProxy
} from "../../actions"; } from "../../actions/services/portalService";
import RepsOnResults from "./repsonresults"; import RepsOnResults from "./repsonresults";
const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+61 -57
View File
@@ -9,7 +9,10 @@ import transLookup from "../../data/lookuptranslations.json";
import PaginationControl from "./pagination"; import PaginationControl from "./pagination";
import RepsOnResults from "./repsonresults"; import RepsOnResults from "./repsonresults";
import { getBasicDNSSearchPaged, getDNSCoords } from "../../actions"; import {
getBasicDNSSearchPaged,
getDNSCoords
} from "../../actions/services/searchService";
import GoogleMapReact from "google-map-react"; import GoogleMapReact from "google-map-react";
import { parseCookies } from "nookies"; import { parseCookies } from "nookies";
@@ -17,19 +20,19 @@ import OSPoint from "ospoint";
import { import {
createWatchedCases, createWatchedCases,
deleteWatchedCases, deleteWatchedCases,
getWatchedCasesProxy, getWatchedCasesProxy
} from "../../actions"; } from "../../actions/services/portalService";
import { import {
setCurrentPage, setCurrentPage,
setCurrentReference, setCurrentReference
} from "../../store/currentView/action"; } from "../../store/currentView/action";
import { import {
setSearchDetails, setSearchDetails,
setSearchResults, setSearchResults
} from "../../store/searchOutput/action"; } from "../../store/searchOutput/action";
import { import {
setWatchedCases, setWatchedCases,
setWatchedCasesDetails, setWatchedCasesDetails
} from "../../store/watchedCases/action"; } from "../../store/watchedCases/action";
import { getDetailsProxy, getSearchDetailsPaged } from "../utils"; import { getDetailsProxy, getSearchDetailsPaged } from "../utils";
import { signIn, useSession } from "next-auth/react"; import { signIn, useSession } from "next-auth/react";
@@ -49,7 +52,7 @@ const DNSSearchResults = (props) => {
setWatchedCases, setWatchedCases,
setWatchedCasesDetails, setWatchedCasesDetails,
showMap, showMap,
showLoginCheck, showLoginCheck
} = props; } = props;
let { t } = useTranslation(); let { t } = useTranslation();
@@ -159,17 +162,17 @@ const DNSSearchResults = (props) => {
let updateBody = { let updateBody = {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
"pinswg_appealcasetype": +appealType, "pinswg_appealcasetype": +appealType
}; };
createWatchedCases(updateBody) createWatchedCases(updateBody)
.then((data) => data) .then((data) => data)
.then(() => { .then(() => {
getWatchedCasesProxy(cookies.pinsUser).then((data) => { getWatchedCasesProxy(cookies.pinsUser).then((data) => {
setWatchedCases(data), (setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then((data) => { getDetailsProxy(data, "myWatchedCases").then((data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
}); }));
}); });
}); });
}; };
@@ -184,7 +187,7 @@ const DNSSearchResults = (props) => {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
"pinswg_appealcasetype": +appealType, "pinswg_appealcasetype": +appealType,
"pinswg_emailnotifications": true, "pinswg_emailnotifications": true
}; };
console.log("Email signed up"); console.log("Email signed up");
@@ -193,12 +196,12 @@ const DNSSearchResults = (props) => {
.then(() => { .then(() => {
getWatchedCasesProxy(props.accountDetails.loggedinUserId).then( getWatchedCasesProxy(props.accountDetails.loggedinUserId).then(
(data) => { (data) => {
setWatchedCases(data), (setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then( getDetailsProxy(data, "myWatchedCases").then(
(data) => { (data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
} }
); ));
} }
); );
}); });
@@ -211,7 +214,7 @@ const DNSSearchResults = (props) => {
whichIncident + whichIncident +
"')]", "')]",
json: watchedCases, json: watchedCases,
eval: true, eval: true
}); });
return isWatched; return isWatched;
@@ -225,7 +228,7 @@ const DNSSearchResults = (props) => {
"' && @.pinswg_emailnotifications==true)]", "' && @.pinswg_emailnotifications==true)]",
json: watchedCases, json: watchedCases,
eval: true, eval: true
}); });
return isEmail; return isEmail;
}; };
@@ -247,7 +250,7 @@ const DNSSearchResults = (props) => {
let newObj = {}; let newObj = {};
return Object.assign(newObj, { return Object.assign(newObj, {
"@odata.count": required.length, "@odata.count": required.length,
"value": required, "value": required
}); });
}; };
@@ -258,12 +261,12 @@ const DNSSearchResults = (props) => {
var dateB = new Date(b.createdon); var dateB = new Date(b.createdon);
return dateB - dateA; return dateB - dateA;
}); });
setWatchedCases(data), (setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then( getDetailsProxy(data, "myWatchedCases").then(
(data) => { (data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
} }
); ));
}); });
}); });
}; };
@@ -385,7 +388,7 @@ const DNSSearchResults = (props) => {
item.ticketnumber + item.ticketnumber +
'")]', '")]',
json: searchDetailsObj, json: searchDetailsObj,
eval: true, eval: true
}); });
detailsObj = detailsObj[0]; detailsObj = detailsObj[0];
@@ -399,7 +402,7 @@ const DNSSearchResults = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item[ : item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
@@ -427,10 +430,10 @@ const DNSSearchResults = (props) => {
: "/dns/" + : "/dns/" +
item.ticketnumber item.ticketnumber
: myportal == true : myportal == true
? "/myportal/dns/" + ? "/myportal/dns/" +
item.ticketnumber item.ticketnumber
: "/dns/" + : "/dns/" +
item.ticketnumber item.ticketnumber
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
onClick={() => { onClick={() => {
@@ -447,7 +450,7 @@ const DNSSearchResults = (props) => {
item.pinswg_appealcasetype, item.pinswg_appealcasetype,
"showMap": showMap, "showMap": showMap,
"showLoginCheck": "showLoginCheck":
props.showLoginCheck, props.showLoginCheck
}); });
}} }}
> >
@@ -484,32 +487,33 @@ const DNSSearchResults = (props) => {
) < 0 ) < 0
? detailsObj.pinswg_projectlocation ? detailsObj.pinswg_projectlocation
: router.locale == "cy" : router.locale == "cy"
? detailsObj.pinswg_projectlocation.split( ? detailsObj.pinswg_projectlocation.split(
";" ";"
)[1] )[1]
: detailsObj.pinswg_projectlocation.split( : detailsObj.pinswg_projectlocation.split(
";" ";"
)[0] )[0]
: "" : ""
: hasValidKey( : hasValidKey(
item, item,
"pinswg_caseaddress" "pinswg_caseaddress"
) )
? item.pinswg_caseaddress != ? item.pinswg_caseaddress !=
null null
? item.pinswg_caseaddress.indexOf( ? item.pinswg_caseaddress.indexOf(
";" ";"
) < 0 ) < 0
? item.pinswg_caseaddress ? item.pinswg_caseaddress
: router.locale == "cy" : router.locale ==
? item.pinswg_caseaddress.split( "cy"
";" ? item.pinswg_caseaddress.split(
)[1] ";"
: item.pinswg_caseaddress.split( )[1]
";" : item.pinswg_caseaddress.split(
)[0] ";"
: "" )[0]
: ""} : ""
: ""}
{_.has( {_.has(
detailsObj, detailsObj,
@@ -574,7 +578,7 @@ const DNSSearchResults = (props) => {
: :
</span> </span>
{_.has(detailsObj, [ {_.has(detailsObj, [
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue", "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
]) ])
? detailsObj[ ? detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
@@ -589,7 +593,7 @@ const DNSSearchResults = (props) => {
: :
</span> </span>
{_.has(detailsObj, [ {_.has(detailsObj, [
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue", "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
]) ])
? router.locale == "cy" ? router.locale == "cy"
? jsonpath({ ? jsonpath({
@@ -600,7 +604,7 @@ const DNSSearchResults = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: detailsObj[ : detailsObj[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
@@ -623,7 +627,7 @@ const DNSSearchResults = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item[ : item[
"statuscode@OData.Community.Display.V1.FormattedValue" "statuscode@OData.Community.Display.V1.FormattedValue"
@@ -782,7 +786,7 @@ const DNSSearchResults = (props) => {
"&toWatch=" + "&toWatch=" +
item.incidentid + item.incidentid +
"_" + "_" +
item.pinswg_appealcasetype, item.pinswg_appealcasetype
} }
); );
}} }}
@@ -886,7 +890,7 @@ const DNSSearchResults = (props) => {
fieldSortState, fieldSortState,
orderByState, orderByState,
searchLoaded, searchLoaded,
getSearchPageResults, getSearchPageResults
]); ]);
return ( return (
<> <>
@@ -1058,14 +1062,14 @@ const mapDispatchToProps = (dispatch) => {
}, },
setCurrentPage: (currentPage) => { setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage)); dispatch(setCurrentPage(currentPage));
}, }
}; };
}; };
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
// currentView: state.currentView, // currentView: state.currentView,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
// search: state.search, // search: state.search,
// searchResultsObj: state.searchResultsObj, // searchResultsObj: state.searchResultsObj,
}; };
+5 -2
View File
@@ -5,7 +5,10 @@ import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { useCallback, useState } from "react"; import { useCallback, useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { getAdvancedSearchPaged, getBasicSearchPaged } from "../../actions"; import {
getAdvancedSearchPaged,
getBasicSearchPaged
} from "../../actions/services/searchService";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { import {
setCurrentPage, setCurrentPage,
@@ -32,7 +35,7 @@ import {
createWatchedCases, createWatchedCases,
deleteWatchedCases, deleteWatchedCases,
getWatchedCasesProxy getWatchedCasesProxy
} from "../../actions"; } from "../../actions/services/portalService";
import { sendGAEvent } from "@next/third-parties/google"; import { sendGAEvent } from "@next/third-parties/google";
import RepsOnResults from "./repsonresults"; import RepsOnResults from "./repsonresults";
+4 -2
View File
@@ -3,10 +3,12 @@ import { v4 as uuidv4 } from "uuid";
import { import {
getBasicPartSavedDetails, getBasicPartSavedDetails,
getBasicSearchDetails, getBasicSearchDetails,
getBasicSearchDetailsPaged, getBasicSearchDetailsPaged
} from "../../actions/services/searchService";
import {
getPortalModuleDetailsProxy, getPortalModuleDetailsProxy,
getPortalModuleDetails getPortalModuleDetails
} from "../../actions"; } from "../../actions/services/caseService";
import data from "../../data/collections.json"; import data from "../../data/collections.json";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
+13 -11
View File
@@ -2,14 +2,16 @@
import { getSession } from "next-auth/react"; import { getSession } from "next-auth/react";
import { import {
getAppealsTypesForNewAppeal, getAppealsTypesForNewAppeal,
getMandatoryFields,
getPickLists
} from "../../actions/services/referenceDataService";
import {
getAwaitingSubmissionFromBlob, getAwaitingSubmissionFromBlob,
getFilesFromBlob, getFilesFromBlob,
getIP, getProgressFromBlob
getMandatoryFields, } from "../../actions/services/documentService";
getPickLists, import { getPersonalAccount } from "../../actions/services/accountService";
getProgressFromBlob, import { getIP } from "../../actions/core/logger";
getPersonalAccount,
} from "../../actions";
import { readFormXml } from "../forms/readFormXml"; import { readFormXml } from "../forms/readFormXml";
import { requireQueryParams } from "../routing/requireQueryParams"; import { requireQueryParams } from "../routing/requireQueryParams";
@@ -27,7 +29,7 @@ export async function loadMyPortalAppealPage(ctx) {
const required = requireQueryParams(query, [ const required = requireQueryParams(query, [
"appealtypes", "appealtypes",
"apt", "apt",
"casereference", "casereference"
]); ]);
if (!required.ok) { if (!required.ok) {
return { redirect: required.redirect }; return { redirect: required.redirect };
@@ -38,8 +40,8 @@ export async function loadMyPortalAppealPage(ctx) {
return { return {
redirect: { redirect: {
destination: "/auth/signin", destination: "/auth/signin",
permanent: false, permanent: false
}, }
}; };
} }
@@ -56,7 +58,7 @@ export async function loadMyPortalAppealPage(ctx) {
getAppealsTypesForNewAppeal(), getAppealsTypesForNewAppeal(),
getMandatoryFields(query.appealtypes), getMandatoryFields(query.appealtypes),
getPickLists(query.appealtypes), getPickLists(query.appealtypes),
getFilesFromBlob(loggedInUserIdent, query.casereference), getFilesFromBlob(loggedInUserIdent, query.casereference)
]); ]);
const blobProgress = await getProgressFromBlob( const blobProgress = await getProgressFromBlob(
@@ -86,6 +88,6 @@ export async function loadMyPortalAppealPage(ctx) {
blobProgress, blobProgress,
accountDetails, accountDetails,
awaitingSubmissionFromBlob, awaitingSubmissionFromBlob,
xmlStr, xmlStr
}; };
} }
+9 -9
View File
@@ -2,12 +2,12 @@
import { getSession } from "next-auth/react"; import { getSession } from "next-auth/react";
import { import {
getAppealsTypesForNewAppeal, getAppealsTypesForNewAppeal,
getIP,
getMandatoryFields, getMandatoryFields,
getPickLists, getPickLists
getProgressFromBlob, } from "../../actions/services/referenceDataService";
getPersonalAccount, import { getProgressFromBlob } from "../../actions/services/documentService";
} from "../../actions"; import { getPersonalAccount } from "../../actions/services/accountService";
import { getIP } from "../../actions/core/logger";
import { readFormXml } from "../forms/readFormXml"; import { readFormXml } from "../forms/readFormXml";
import { requireQueryParams } from "../routing/requireQueryParams"; import { requireQueryParams } from "../routing/requireQueryParams";
@@ -32,8 +32,8 @@ export async function loadNewAppealPage(ctx) {
return { return {
redirect: { redirect: {
destination: "/auth/signin", destination: "/auth/signin",
permanent: false, permanent: false
}, }
}; };
} }
@@ -46,7 +46,7 @@ export async function loadNewAppealPage(ctx) {
await Promise.all([ await Promise.all([
getAppealsTypesForNewAppeal(), getAppealsTypesForNewAppeal(),
getMandatoryFields(query.appealtypes), getMandatoryFields(query.appealtypes),
getPickLists(query.appealtypes), getPickLists(query.appealtypes)
]); ]);
const blobProgress = await getProgressFromBlob(loggedInUserIdent, query.id); const blobProgress = await getProgressFromBlob(loggedInUserIdent, query.id);
@@ -64,6 +64,6 @@ export async function loadNewAppealPage(ctx) {
pickListData, pickListData,
blobProgress, blobProgress,
accountDetails, accountDetails,
xmlStr, xmlStr
}; };
} }
+6 -3
View File
@@ -23,9 +23,12 @@ import {
setAppealTypeTitle, setAppealTypeTitle,
setAppealTypeID, setAppealTypeID,
setAppealLPA, setAppealLPA,
getAppealTypeObj, getAppealTypeObj
} from "../../store/appealType/action"; } from "../../store/appealType/action";
import { getAppealsTypes, getLPA } from "../../actions"; import {
getAppealsTypes,
getLPA
} from "../../actions/services/referenceDataService";
import { setLPA } from "../../store/lpa/action"; import { setLPA } from "../../store/lpa/action";
import { getSession, useSession } from "next-auth/react"; import { getSession, useSession } from "next-auth/react";
@@ -110,7 +113,7 @@ const mapStateToProps = (state) => {
appealType: state.appealType, appealType: state.appealType,
LPAData: state.LPAData, LPAData: state.LPAData,
form: state.form, form: state.form,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
}; };
}; };
+4 -4
View File
@@ -19,7 +19,7 @@ import { reduxForm, formValueSelector } from "redux-form";
import PersonalDetails from "../../components/account/personaldetails"; import PersonalDetails from "../../components/account/personaldetails";
import { setAccountDetails } from "../../store/accountDetails/action"; import { setAccountDetails } from "../../store/accountDetails/action";
import { getPersonalAccount } from "../../actions"; import { getPersonalAccount } from "../../actions/services/accountService";
import { setCookie } from "nookies"; import { setCookie } from "nookies";
import { getSession, useSession } from "next-auth/react"; import { getSession, useSession } from "next-auth/react";
import NoSessionWarning from "../../components/nosession"; import NoSessionWarning from "../../components/nosession";
@@ -36,8 +36,8 @@ const Home = (props) => {
useState(false); useState(false);
const [accountUpdatedComplete, setAccountUpdatedComplete] = useState(false); const [accountUpdatedComplete, setAccountUpdatedComplete] = useState(false);
setCookie(null, "pinsUser", props.accountDetails.loggedinUserId), (setCookie(null, "pinsUser", props.accountDetails.loggedinUserId),
{ path: "/" }; { path: "/" });
const { data: session, status } = useSession(); const { data: session, status } = useSession();
@@ -133,7 +133,7 @@ const mapStateToProps = (state) => {
appealType: state.appealType, appealType: state.appealType,
LPAData: state.LPAData, LPAData: state.LPAData,
form: state.form, form: state.form,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
}; };
}; };
+2 -1
View File
@@ -17,7 +17,8 @@ import { JSONPath as jsonpath } from "jsonpath-plus";
import { reduxForm, formValueSelector } from "redux-form"; import { reduxForm, formValueSelector } from "redux-form";
import RegisterForm from "../../components/account/registerform"; import RegisterForm from "../../components/account/registerform";
import { dehashString, hashAPIPath, getIP } from "../../actions"; import { dehashString, hashAPIPath } from "../../actions/core/hash";
import { getIP } from "../../actions/core/logger";
import { getSession, useSession, signIn, signOut } from "next-auth/react"; import { getSession, useSession, signIn, signOut } from "next-auth/react";
const Home = (props) => { const Home = (props) => {
+5 -5
View File
@@ -2,7 +2,7 @@ import useTranslation from "next-translate/useTranslation";
import Head from "next/head"; import Head from "next/head";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { getAddressSearch } from "../actions"; import { getAddressSearch } from "../actions/services/searchService";
import SearchResults from "../components/addresssearchresults"; import SearchResults from "../components/addresssearchresults";
import Breadcrumbs from "../components/breadcrumbs"; import Breadcrumbs from "../components/breadcrumbs";
import CookieBanner from "../components/cookieBanner"; import CookieBanner from "../components/cookieBanner";
@@ -125,11 +125,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
props: { props: {
searchResultsObj: { searchResultsObj: {
searchResultsObj: searchResultsObj, searchResultsObj: searchResultsObj,
searchDetailsObj: searchDetailsObj, searchDetailsObj: searchDetailsObj
}, },
currentType: "directResultsObj", currentType: "directResultsObj",
showLoginCheck: showLoginCheck, showLoginCheck: showLoginCheck
}, }
}; };
} }
); );
@@ -145,7 +145,7 @@ const mapStateToProps = (state) => {
myCases: state.myCases, myCases: state.myCases,
watchedCases: state.watchedCases, watchedCases: state.watchedCases,
myRepresentations: state.myRepresentations, myRepresentations: state.myRepresentations,
awaitingSubmission: state.awaitingSubmission, awaitingSubmission: state.awaitingSubmission
}; };
}; };
+9 -9
View File
@@ -13,13 +13,13 @@ import AppealsTab from "../../components/admin/tabs/appeals";
import DocumentsTab from "../../components/admin/tabs/documents"; import DocumentsTab from "../../components/admin/tabs/documents";
import { fetchAdminStorageData } from "../../components/admin/utils/serverside"; import { fetchAdminStorageData } from "../../components/admin/utils/serverside";
import { getNewAppeals } from "../../actions"; import { getNewAppeals } from "../../actions/services/adminService";
import { getSearchDetails } from "../../components/utils"; import { getSearchDetails } from "../../components/utils";
import { import {
setSearchDetails, setSearchDetails,
setSearchResults, setSearchResults
} from "../../store/searchOutput/action"; } from "../../store/searchOutput/action";
import { setCurrentPage } from "../../store/currentView/action"; import { setCurrentPage } from "../../store/currentView/action";
@@ -30,7 +30,7 @@ const StoragePage = (props) => {
repCompleteCount, repCompleteCount,
searchResultsObj, searchResultsObj,
docsOffline, docsOffline,
showFilteredDocs, showFilteredDocs
} = props; } = props;
const [whichTab, setWhichTab] = useState("documents"); const [whichTab, setWhichTab] = useState("documents");
@@ -57,7 +57,7 @@ const StoragePage = (props) => {
"documents", "documents",
"appeals", "appeals",
"storage", "storage",
"accounts", "accounts"
].map((tab) => ( ].map((tab) => (
<li <li
key={tab} key={tab}
@@ -168,7 +168,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
if (![...ALLOWED_IPS, ...LOCALHOST_IPS].includes(ip)) { if (![...ALLOWED_IPS, ...LOCALHOST_IPS].includes(ip)) {
return { return {
redirect: { destination: "/403", permanent: false }, redirect: { destination: "/403", permanent: false }
}; };
} }
@@ -192,8 +192,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
userData, userData,
repCompleteCount, repCompleteCount,
docsOffline: process.env.DOCAPI_OFFLINE || false, docsOffline: process.env.DOCAPI_OFFLINE || false,
showFilteredDocs: process.env.SHOWFILTERDOCS || false, showFilteredDocs: process.env.SHOWFILTERDOCS || false
}, }
}; };
} }
); );
@@ -202,14 +202,14 @@ const mapDispatchToProps = (dispatch) => {
return { return {
setCurrentPage: (currentPage) => { setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage)); dispatch(setCurrentPage(currentPage));
}, }
}; };
}; };
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
console.log("===============================\n state:", state); console.log("===============================\n state:", state);
return { return {
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj
}; };
}; };
+7 -3
View File
@@ -3,7 +3,11 @@ import useTranslation from "next-translate/useTranslation";
import Head from "next/head"; import Head from "next/head";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { getAppealsTypes, getProjectTypes, getLPA } from "../actions"; import {
getAppealsTypes,
getProjectTypes,
getLPA
} from "../actions/services/referenceDataService";
import Breadcrumbs from "../components/breadcrumbs"; import Breadcrumbs from "../components/breadcrumbs";
import CookieBanner from "../components/cookieBanner"; import CookieBanner from "../components/cookieBanner";
import CRMError from "../components/crmError"; import CRMError from "../components/crmError";
@@ -126,7 +130,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
let [appealTypeData, projectTypeData, lpaData] = await Promise.all([ let [appealTypeData, projectTypeData, lpaData] = await Promise.all([
await getAppealsTypes(), await getAppealsTypes(),
await getProjectTypes(), await getProjectTypes(),
await getLPA(), await getLPA()
]); ]);
//const lpaData = require("../data/lpa.json"); //const lpaData = require("../data/lpa.json");
@@ -146,7 +150,7 @@ const mapStateToProps = (state) => {
appealType: state.appealType, appealType: state.appealType,
LPAData: state.LPAData, LPAData: state.LPAData,
//form: state.form, //form: state.form,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
}; };
}; };
+5 -5
View File
@@ -2,7 +2,7 @@ import useTranslation from "next-translate/useTranslation";
import Head from "next/head"; import Head from "next/head";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { getAdvancedSearch } from "../actions"; import { getAdvancedSearch } from "../actions/services/searchService";
import Breadcrumbs from "../components/breadcrumbs"; import Breadcrumbs from "../components/breadcrumbs";
import CookieBanner from "../components/cookieBanner"; import CookieBanner from "../components/cookieBanner";
import Footer from "../components/footer"; import Footer from "../components/footer";
@@ -13,7 +13,7 @@ import { setShowReps } from "../store/currentView/action";
import { setSearch } from "../store/search/action"; import { setSearch } from "../store/search/action";
import { import {
setSearchDetails, setSearchDetails,
setSearchResults, setSearchResults
} from "../store/searchOutput/action"; } from "../store/searchOutput/action";
import ServiceBanner from "../components/servicebanner"; import ServiceBanner from "../components/servicebanner";
import { wrapper } from "../store/store"; import { wrapper } from "../store/store";
@@ -140,8 +140,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setSearch(Object.entries(query))); store.dispatch(setSearch(Object.entries(query)));
return { return {
props: { props: {
showLoginCheck: showLoginCheck, showLoginCheck: showLoginCheck
}, }
}; };
} }
); );
@@ -157,7 +157,7 @@ const mapStateToProps = (state) => {
myCases: state.myCases, myCases: state.myCases,
watchedCases: state.watchedCases, watchedCases: state.watchedCases,
myRepresentations: state.myRepresentations, myRepresentations: state.myRepresentations,
awaitingSubmission: state.awaitingSubmission, awaitingSubmission: state.awaitingSubmission
}; };
}; };
+4 -6
View File
@@ -18,11 +18,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { import { azureHeadersPagedCustom } from "../../../actions/core/headers";
azureHeadersPagedCustom, import { consoleLogger } from "../../../actions/core/logger";
consoleLogger, import { getToken } from "../../../actions/core/token";
getToken,
} from "../../../actions";
import { number } from "prop-types"; import { number } from "prop-types";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -154,7 +152,7 @@ export default async function ApiProxy(req, res) {
let flattened = data.value.map((r) => ({ let flattened = data.value.map((r) => ({
...r, ...r,
ticketnumber: r.pinswg_DocumentIds?.ticketnumber || null, ticketnumber: r.pinswg_DocumentIds?.ticketnumber || null,
publishtoweb: r.pinswg_DocumentIds?.pinswg_publishtoweb || null, publishtoweb: r.pinswg_DocumentIds?.pinswg_publishtoweb || null
})); }));
data.value = flattened; data.value = flattened;
+3 -5
View File
@@ -18,11 +18,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { import { azureHeadersPagedCustom } from "../../../actions/core/headers";
azureHeadersPagedCustom, import { getToken } from "../../../actions/core/token";
consoleLogger, import { consoleLogger } from "../../../actions/core/logger";
getToken,
} from "../../../actions";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+15 -14
View File
@@ -14,7 +14,8 @@ import { PrismaAdapter } from "@next-auth/prisma-adapter";
import { PrismaClient } from "@prisma/client"; import { PrismaClient } from "@prisma/client";
import NextAuth from "next-auth"; import NextAuth from "next-auth";
import EmailProvider from "next-auth/providers/email"; import EmailProvider from "next-auth/providers/email";
import { consoleLogger, getPreferredLanguage } from "../../../actions"; import { consoleLogger } from "../../../actions/core/logger";
import { getPreferredLanguage } from "../../../actions/services/accountService";
const prisma = new PrismaClient(); const prisma = new PrismaClient();
@@ -43,7 +44,7 @@ const parseUrl = (url) => {
host: _url.host, host: _url.host,
path, path,
base, base,
toString: () => base, toString: () => base
}; };
}; };
@@ -127,7 +128,7 @@ const authOptions = (locale, req, res) => {
return res return res
.writeHead(200, { "Content-Type": "application/json" }) .writeHead(200, { "Content-Type": "application/json" })
.json({ url: formURL }); .json({ url: formURL });
}, }
}, },
EmailProvider({ EmailProvider({
maxAge: 2 * 60 * 60, //10 * 60, // Magic links are valid for 10 min only maxAge: 2 * 60 * 60, //10 * 60, // Magic links are valid for 10 min only
@@ -191,7 +192,7 @@ const authOptions = (locale, req, res) => {
// url.split("&token")[1] // url.split("&token")[1]
// : url, // : url,
"linkExpiry": 2 * 60 * 60, "linkExpiry": 2 * 60 * 60
}; };
const reference = "PEDW-SIGNIN"; const reference = "PEDW-SIGNIN";
@@ -208,14 +209,14 @@ const authOptions = (locale, req, res) => {
emailAddress, emailAddress,
{ {
personalisation: personalisation, personalisation: personalisation,
reference: reference, reference: reference
// emailReplyToId: emailReplyToId, // emailReplyToId: emailReplyToId,
} }
) )
//.then((response) => console.log(response)) //.then((response) => console.log(response))
.catch((error) => consoleLogger(error)); .catch((error) => consoleLogger(error));
}, }
}), })
], ],
adapter: PrismaAdapter(prisma), adapter: PrismaAdapter(prisma),
secret: process.env.NEXTAUTH_SECRET, secret: process.env.NEXTAUTH_SECRET,
@@ -226,7 +227,7 @@ const authOptions = (locale, req, res) => {
theme: "dark", theme: "dark",
debug: true, debug: true,
maxAge: 30 * 60, maxAge: 30 * 60,
updateAge: 5 * 60, // 24 hours updateAge: 5 * 60 // 24 hours
}, },
cookies: { cookies: {
callbackUrl: { callbackUrl: {
@@ -234,16 +235,16 @@ const authOptions = (locale, req, res) => {
options: { options: {
sameSite: "lax", sameSite: "lax",
path: "/", path: "/",
secure: true, secure: true
}, }
}, }
}, },
pages: { pages: {
signIn: (locale == "cy" ? "/cy" : "") + "/auth/signin", signIn: (locale == "cy" ? "/cy" : "") + "/auth/signin",
error: (locale == "cy" ? "/cy" : "") + "/auth/error", // Error code passed in query string as ?error= error: (locale == "cy" ? "/cy" : "") + "/auth/error", // Error code passed in query string as ?error=
verifyRequest: verifyRequest:
(locale == "cy" ? "/cy" : "") + "/auth/verify-request", // (used for check email message) (locale == "cy" ? "/cy" : "") + "/auth/verify-request", // (used for check email message)
newUser: (locale == "cy" ? "/cy" : "") + "/account/register", // New users will be directed here on first sign in (leave the property out if not of interest) newUser: (locale == "cy" ? "/cy" : "") + "/account/register" // New users will be directed here on first sign in (leave the property out if not of interest)
}, },
callbacks: { callbacks: {
session: async (session, user) => { session: async (session, user) => {
@@ -275,8 +276,8 @@ const authOptions = (locale, req, res) => {
console.log("the url:", updatedUrl); console.log("the url:", updatedUrl);
return updatedUrl; return updatedUrl;
}, }
}, }
}; };
}; };
+6 -6
View File
@@ -23,7 +23,6 @@
// import axios from "axios"; // import axios from "axios";
// import CryptoJS from "crypto-js"; // import CryptoJS from "crypto-js";
// import { getToken, consoleLogger } from "../../../../actions";
// const WORDKEY = process.env.HASHKEY; // const WORDKEY = process.env.HASHKEY;
// const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT; // const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
@@ -110,7 +109,8 @@
// } // }
import axios from "axios"; import axios from "axios";
import { getToken, consoleLogger } from "../../../../actions"; import { getToken } from "../../../../actions/core/token";
import { consoleLogger } from "../../../../actions/core/logger";
const WEBAPI_URL = const WEBAPI_URL =
process.env.RELAY_ROOT || process.env.RELAY_ROOT ||
@@ -149,9 +149,9 @@ const ApiProxy = async (req, res) => {
"Prefer": "Prefer":
'odata.include-annotations="*",return=representation', 'odata.include-annotations="*",return=representation',
"Content-Type": "application/json", "Content-Type": "application/json",
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token
}, },
responseType: "stream", responseType: "stream"
}); });
}; };
@@ -196,8 +196,8 @@ const ApiProxy = async (req, res) => {
export const config = { export const config = {
api: { api: {
responseLimit: false, responseLimit: false
}, }
}; };
export default ApiProxy; export default ApiProxy;
+22 -26
View File
@@ -1,13 +1,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { import { azureHeaders, azureHeadersPaged } from "../../../actions/core/headers";
getToken, import { consoleLogger } from "../../../actions/core/logger";
azureHeaders, import { getToken } from "../../../actions/core/token";
azureHeadersPaged,
consoleLogger,
sendEmail,
} from "../../../actions";
import { formatDates } from "../../../components/utils"; import { formatDates } from "../../../components/utils";
var NotifyClient = require("notifications-node-client").NotifyClient; var NotifyClient = require("notifications-node-client").NotifyClient;
@@ -79,14 +75,14 @@ const buildNotifyPayloads = (watchlistByEmail) => {
noRef: "No Ref", noRef: "No Ref",
untitled: "Untitled", untitled: "Untitled",
noDate: "No Date", noDate: "No Date",
link: "Link", link: "Link"
}, },
cy: { cy: {
noRef: "Dim Cyfeirnod", noRef: "Dim Cyfeirnod",
untitled: "Heb Deitl", untitled: "Heb Deitl",
noDate: "Dim Dyddiad", noDate: "Dim Dyddiad",
link: "Dolen", link: "Dolen"
}, }
}; };
const t = labels[language] || labels.en; const t = labels[language] || labels.en;
@@ -114,13 +110,13 @@ const buildNotifyPayloads = (watchlistByEmail) => {
en: { en: {
unnamed: "Unnamed Event", unnamed: "Unnamed Event",
noDate: "No Date", noDate: "No Date",
on: "on", on: "on"
}, },
cy: { cy: {
unnamed: "Digwyddiad Heb Enw", unnamed: "Digwyddiad Heb Enw",
noDate: "Dim Dyddiad", noDate: "Dim Dyddiad",
on: "ar", on: "ar"
}, }
}; };
const t = labels[language] || labels.en; const t = labels[language] || labels.en;
@@ -144,14 +140,14 @@ const buildNotifyPayloads = (watchlistByEmail) => {
open: "Open", open: "Open",
to: "to", to: "to",
close: "Close", close: "Close",
na: "N/A", na: "N/A"
}, },
cy: { cy: {
open: "Agor", open: "Agor",
to: "i", to: "i",
close: "Cau", close: "Cau",
na: "Dim ar gael", na: "Dim ar gael"
}, }
}; };
const t = labels[language] || labels.en; const t = labels[language] || labels.en;
@@ -234,7 +230,7 @@ const buildNotifyPayloads = (watchlistByEmail) => {
docSection, docSection,
sipSection, sipSection,
repsSection, repsSection,
caseUnsubscribelink, caseUnsubscribelink
] ]
.filter(Boolean) .filter(Boolean)
.join("\n")}`; .join("\n")}`;
@@ -242,7 +238,7 @@ const buildNotifyPayloads = (watchlistByEmail) => {
.join("\n\n"), .join("\n\n"),
unsubscribeLink: `Unsubscribe by selecting this link if you no longer want to receive any updates ${ unsubscribeLink: `Unsubscribe by selecting this link if you no longer want to receive any updates ${
process.env.NEXTAUTH_URL + "/unsubscribeall/" + contactId process.env.NEXTAUTH_URL + "/unsubscribeall/" + contactId
}`, }`
}; };
const personalisationCY = { const personalisationCY = {
@@ -281,7 +277,7 @@ const buildNotifyPayloads = (watchlistByEmail) => {
docSection, docSection,
sipSection, sipSection,
repsSection, repsSection,
caseUnsubscribelink, caseUnsubscribelink
] ]
.filter(Boolean) .filter(Boolean)
.join("\n")}`; .join("\n")}`;
@@ -289,7 +285,7 @@ const buildNotifyPayloads = (watchlistByEmail) => {
.join("\n\n"), .join("\n\n"),
unsubscribeLink: `Dad-danysgrifiwch drwy ddewis y ddolen hon os nad ydych chi eisiau derbyn unrhyw ddiweddariadau mwyach ${ unsubscribeLink: `Dad-danysgrifiwch drwy ddewis y ddolen hon os nad ydych chi eisiau derbyn unrhyw ddiweddariadau mwyach ${
process.env.NEXTAUTH_URL + "/unsubscribeall/" + contactId process.env.NEXTAUTH_URL + "/unsubscribeall/" + contactId
}`, }`
}; };
return { return {
@@ -305,7 +301,7 @@ const buildNotifyPayloads = (watchlistByEmail) => {
process.env.NEXTAUTH_URL + process.env.NEXTAUTH_URL +
(prefLanguage == 846040001 ? "en" : "cy") + (prefLanguage == 846040001 ? "en" : "cy") +
"/unsubscribeall/" + "/unsubscribeall/" +
contactId, contactId
}; };
}) })
.filter(Boolean); // Remove any nulls from filtered-out users .filter(Boolean); // Remove any nulls from filtered-out users
@@ -348,7 +344,7 @@ export default async function CombinedApiProxy(req, res) {
...doc, ...doc,
pinswg_hashlink: encryptDocReference( pinswg_hashlink: encryptDocReference(
doc.pinswg_isharedocumentreference doc.pinswg_isharedocumentreference
), )
})); }));
} catch (err) { } catch (err) {
consoleLogger( consoleLogger(
@@ -401,7 +397,7 @@ export default async function CombinedApiProxy(req, res) {
...entry, ...entry,
repsPeriods, repsPeriods,
documents, documents,
sipEvents, sipEvents
}; };
}) })
); );
@@ -428,7 +424,7 @@ export default async function CombinedApiProxy(req, res) {
reference: payload.reference, reference: payload.reference,
template_id: payload.template_id, template_id: payload.template_id,
language: language:
payload.pinswg_preferredlanguage == 846040001 ? "en" : "cy", payload.pinswg_preferredlanguage == 846040001 ? "en" : "cy"
}; };
try { try {
@@ -437,7 +433,7 @@ export default async function CombinedApiProxy(req, res) {
payload.email_address, payload.email_address,
{ {
personalisation: payload.personalisation, personalisation: payload.personalisation,
reference: payload.reference, reference: payload.reference
} }
); );
result.status = "success"; result.status = "success";
@@ -455,7 +451,7 @@ export default async function CombinedApiProxy(req, res) {
consoleLogger(error); consoleLogger(error);
res.status(500).json({ res.status(500).json({
error: "An error occurred while retrieving combined data.", error: "An error occurred while retrieving combined data.",
details: error.message || error.toString(), details: error.message || error.toString()
}); });
} }
} }
+3 -1
View File
@@ -1,7 +1,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { getToken, azureHeaders, consoleLogger } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+5 -3
View File
@@ -1,7 +1,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions"; import { azureHeadersPaged } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL = const WEBAPI_URL =
@@ -84,7 +86,7 @@ export default async function ApiProxy(req, res) {
...doc, ...doc,
pinswg_hashlink: encryptDocReference( pinswg_hashlink: encryptDocReference(
doc.pinswg_isharedocumentreference doc.pinswg_isharedocumentreference
), )
})); }));
res.status(200).json({ ...data, value: resultsWithLinks }); res.status(200).json({ ...data, value: resultsWithLinks });
@@ -92,7 +94,7 @@ export default async function ApiProxy(req, res) {
consoleLogger(error); consoleLogger(error);
res.status(500).json({ res.status(500).json({
error: "Failed to fetch document details.", error: "Failed to fetch document details.",
details: error.message || error.toString(), details: error.message || error.toString()
}); });
} }
} }
+4 -2
View File
@@ -1,7 +1,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { getToken, azureHeaders, consoleLogger } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL = const WEBAPI_URL =
@@ -67,7 +69,7 @@ export default async function ApiProxy(req, res) {
consoleLogger(error); consoleLogger(error);
res.status(500).json({ res.status(500).json({
error: "An error occurred while retrieving data.", error: "An error occurred while retrieving data.",
details: error.message || error.toString(), details: error.message || error.toString()
}); });
} }
} }
+3 -1
View File
@@ -1,7 +1,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { getToken, azureHeaders, consoleLogger } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+14 -2
View File
@@ -25,10 +25,19 @@
* description: Failed * description: Failed
*/ */
import { consoleLogger, getPreferredLanguage } from "../../../actions"; import { consoleLogger, redactSensitive } from "../../../actions/core/logger";
import { isNonEmptyString, sanitizeString } from "../../../actions/core/guards";
import { getPreferredLanguage } from "../../../actions/services/accountService";
export default async function ApiProxy(req, res) { export default async function ApiProxy(req, res) {
var data = req.body; var data = req.body;
const emailAddress = sanitizeString(data?.emailAddress);
if (!isNonEmptyString(emailAddress)) {
return res.status(400).json({ error: "emailAddress is required" });
}
data.emailAddress = emailAddress;
if (data?.reference === "PEDW-NEW-CASEREF") { if (data?.reference === "PEDW-NEW-CASEREF") {
try { try {
@@ -49,7 +58,10 @@ export default async function ApiProxy(req, res) {
const notifyClient = new NotifyClient(process.env.NOTIFY_API_KEY); const notifyClient = new NotifyClient(process.env.NOTIFY_API_KEY);
//const emailReplyToId = process.env.EMAIL_REPLY_TO_ID; //const emailReplyToId = process.env.EMAIL_REPLY_TO_ID;
console.log("///////////////\n Sending email \ns//////////////", data); console.log(
"///////////////\n Sending email \ns//////////////",
redactSensitive(data)
);
notifyClient notifyClient
.sendEmail(data.templateId, data.emailAddress, { .sendEmail(data.templateId, data.emailAddress, {
+4 -3
View File
@@ -12,7 +12,8 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { consoleLogger, getToken } from "../../../actions"; import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -46,9 +47,9 @@ export default async function ApiProxy(req, res) {
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json"
}, },
data: data, data: data
}; };
return axios(config) return axios(config)
+4 -4
View File
@@ -44,7 +44,7 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { getToken } from "../../../actions"; import { getToken } from "../../../actions/core/token";
import { getCaseBlob } from "../../../actions/azurestorage"; import { getCaseBlob } from "../../../actions/azurestorage";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -79,7 +79,7 @@ export default async function ApiProxy(req, res) {
"servicestage": 1, "servicestage": 1,
"customerid_contact@odata.bind": "/contacts(" + contactid + ")", "customerid_contact@odata.bind": "/contacts(" + contactid + ")",
"pinswg_appealcasetype": appealTypeId, "pinswg_appealcasetype": appealTypeId,
"pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")", "pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")"
}; };
var newData = Object.assign(data, createCaseBody); var newData = Object.assign(data, createCaseBody);
@@ -97,9 +97,9 @@ export default async function ApiProxy(req, res) {
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json"
}, },
data: JSON.stringify(newData), data: JSON.stringify(newData)
}; };
var apiResponse = _.isEmpty(req.query) var apiResponse = _.isEmpty(req.query)
? res.status(400).json() ? res.status(400).json()
+21 -11
View File
@@ -44,7 +44,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { getToken } from "../../../actions"; import { isNonEmptyString, sanitizeString } from "../../../actions/core/guards";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
import { getCaseBlob } from "../../../actions/azurestorage"; import { getCaseBlob } from "../../../actions/azurestorage";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -66,6 +68,17 @@ const hashAPIPath = (queryPath) => {
export default async function ApiProxy(req, res) { export default async function ApiProxy(req, res) {
var createTaskBody = req.body; var createTaskBody = req.body;
const contactEmail = sanitizeString(createTaskBody?.contactEmail);
const contactSubject = sanitizeString(createTaskBody?.contactSubject);
const contactBody = sanitizeString(createTaskBody?.contactbody);
if (!isNonEmptyString(contactEmail) || !isNonEmptyString(contactSubject)) {
return res.status(400).json({
error: "contactEmail and contactSubject are required"
});
}
var queryUrl = "tasks"; var queryUrl = "tasks";
var token = await getToken(); var token = await getToken();
@@ -81,19 +94,19 @@ export default async function ApiProxy(req, res) {
ceq: "4fddd7e8-7d26-ec11-a97f-00224800e98c", // Inspector Scheduling ceq: "4fddd7e8-7d26-ec11-a97f-00224800e98c", // Inspector Scheduling
other: "8ffabad9-7c26-ec11-a97f-00224800e98c", // Casework other: "8ffabad9-7c26-ec11-a97f-00224800e98c", // Casework
postdec: "1357e457-7e26-ec11-a97f-00224800e98c", // SLT Team postdec: "1357e457-7e26-ec11-a97f-00224800e98c", // SLT Team
comp: "1357e457-7e26-ec11-a97f-00224800e98c", // SLT Team comp: "1357e457-7e26-ec11-a97f-00224800e98c" // SLT Team
}; };
let teamId = teamMap[contactValue]; let teamId = teamMap[contactValue];
const payload = { const payload = {
"subject": `Contact Us Enquiry - ${createTaskBody.contactSubject}`, "subject": `Contact Us Enquiry - ${contactSubject}`,
"description": `From: ${createTaskBody.contactEmail}\n\n${createTaskBody.contactbody}`, "description": `From: ${contactEmail}\n\n${contactBody}`,
"scheduledstart": new Date().toISOString(), "scheduledstart": new Date().toISOString(),
"scheduledend": new Date( "scheduledend": new Date(
new Date().getTime() + 60 * 60000 * 24 new Date().getTime() + 60 * 60000 * 24
).toISOString(), // 30 mins ).toISOString(), // 30 mins
...(teamId && { "ownerid@odata.bind": `/teams(${teamId})` }), ...(teamId && { "ownerid@odata.bind": `/teams(${teamId})` })
}; };
//console.log("/////Create Task:\n", payload, "\n//////////////"); //console.log("/////Create Task:\n", payload, "\n//////////////");
@@ -107,9 +120,9 @@ export default async function ApiProxy(req, res) {
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json"
}, },
data: JSON.stringify(payload), data: JSON.stringify(payload)
}; };
//console.log("/////Create Task config:\n", config, "\n//////////////"); //console.log("/////Create Task config:\n", config, "\n//////////////");
@@ -118,10 +131,7 @@ export default async function ApiProxy(req, res) {
const { data } = await axios(config); const { data } = await axios(config);
return res.status(200).json(data); return res.status(200).json(data);
} catch (error) { } catch (error) {
console.error( consoleLogger(error);
"CRM Task Creation Error:",
error.response?.data || error
);
return res return res
.status(400) .status(400)
.json({ error: "Failed to create CRM task", details: error }); .json({ error: "Failed to create CRM task", details: error });
+6 -5
View File
@@ -12,7 +12,8 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { consoleLogger, getToken } from "../../../actions"; import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -70,8 +71,8 @@ const recordExists = async (incidentId, contactId, token) => {
const res = await axios.get(url, { const res = await axios.get(url, {
headers: { headers: {
Authorization: "Bearer " + token.access_token, Authorization: "Bearer " + token.access_token,
Accept: "application/json", Accept: "application/json"
}, }
}); });
if (res.data.value && res.data.value.length > 0) { if (res.data.value && res.data.value.length > 0) {
@@ -113,9 +114,9 @@ export default async function ApiProxy(req, res) {
Accept: "application/json", Accept: "application/json",
Prefer: 'odata.include-annotations="*",return=representation', Prefer: 'odata.include-annotations="*",return=representation',
Authorization: "Bearer " + token.access_token, Authorization: "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json"
}, },
data: JSON.stringify(data), data: JSON.stringify(data)
}; };
return axios(config) return axios(config)
@@ -12,7 +12,8 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { consoleLogger, getToken } from "../../../actions"; import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -46,8 +47,8 @@ export default async function ApiProxy(req, res) {
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json"
}, }
}; };
return axios(config) return axios(config)
@@ -12,7 +12,8 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { consoleLogger, getToken } from "../../../actions"; import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -46,8 +47,8 @@ export default async function ApiProxy(req, res) {
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json"
}, }
}; };
return axios(config) return axios(config)
+4 -3
View File
@@ -12,7 +12,8 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { consoleLogger, getToken } from "../../../actions"; import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -48,8 +49,8 @@ export default async function ApiProxy(req, res) {
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json"
}, }
}; };
return axios(config) return axios(config)
@@ -19,7 +19,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+70
View File
@@ -0,0 +1,70 @@
/**
* @swagger
* /api/endpoint/getemailaccountcheck_api:
* get:
* tags: [Login]
* description: Returns portal login
* summary: Phase 2
* parameters:
* - name: emailAddress
* in: query
* required: true
* schema:
* type: string
* responses:
* 200:
* description: hello world
*/
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var emailAddress = req.query.emailAddress;
var token = await getToken();
var queryUrl =
"contacts?$filter=emailaddress1 eq '" +
emailAddress +
"'&$count=true&$select=emailaddress1, contactid";
console.log(queryUrl);
// var queryUrl = "contacts/?$count=true&$select=emailaddress1, contactid";
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: typeof emailAddress != "undefined" && emailAddress.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
})
: res.status(400).json();
return apiResponse;
}
+3 -1
View File
@@ -24,7 +24,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions"; import { azureHeadersPaged } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -53,10 +53,10 @@ import _ from "lodash";
import { import {
azureHeadersPagedCustom, azureHeadersPagedCustom,
azureHeadersPaged, azureHeadersPaged,
azureHeaders, azureHeaders
consoleLogger, } from "../../../actions/core/headers";
getToken, import { consoleLogger } from "../../../actions/core/logger";
} from "../../../actions"; import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+3 -1
View File
@@ -30,7 +30,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -18,7 +18,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+3 -1
View File
@@ -11,7 +11,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -19,7 +19,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -12,7 +12,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+3 -1
View File
@@ -19,7 +19,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions"; import { azureHeadersPaged } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -13,7 +13,8 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { consoleLogger, getToken } from "../../../actions"; import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
import { getSelectQuery } from "../../../actions/selectQueryTypes"; import { getSelectQuery } from "../../../actions/selectQueryTypes";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -12,7 +12,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions"; import { azureHeadersPaged } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
import { getSelectQuery } from "../../../actions/selectQueryTypes"; import { getSelectQuery } from "../../../actions/selectQueryTypes";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -43,32 +43,16 @@
*/ */
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { import { azureHeadersPagedCustom } from "../../../actions/core/headers";
azureHeadersPagedCustom, import { getToken } from "../../../actions/core/token";
getToken, import { consoleLogger } from "../../../actions/core/logger";
consoleLogger, import { hashAPIPath } from "../../../actions/core/hash";
} from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL = const WEBAPI_URL =
process.env.RELAY_ROOT || process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
//return "&hash=" + hashlink;
//console.log(hashlink);
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) { export default async function ApiProxy(req, res) {
var pageNumber = req.query.pageNumber; var pageNumber = req.query.pageNumber;
var token = await getToken(); var token = await getToken();
@@ -19,7 +19,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions"; import { azureHeadersPaged } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -1,6 +1,7 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { azureHeadersNoOdata, getToken } from "../../../actions"; import { azureHeadersNoOdata } from "../../../actions/core/headers";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+3 -1
View File
@@ -18,7 +18,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions"; import { azureHeadersPaged } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -18,7 +18,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { JSONPath as jsonpath } from "jsonpath-plus"; import { JSONPath as jsonpath } from "jsonpath-plus";
import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -1,6 +1,8 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -31,7 +31,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
import { getSelectQuery } from "../../../actions/selectQueryTypes"; import { getSelectQuery } from "../../../actions/selectQueryTypes";
import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils"; import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -32,7 +32,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions"; import { azureHeadersPaged } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
import { getSelectQuery } from "../../../actions/selectQueryTypes"; import { getSelectQuery } from "../../../actions/selectQueryTypes";
import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils"; import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+4 -18
View File
@@ -43,30 +43,16 @@
*/ */
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { import { azureHeadersPagedCustom } from "../../../actions/core/headers";
azureHeadersPagedCustom, import { consoleLogger } from "../../../actions/core/logger";
consoleLogger, import { getToken } from "../../../actions/core/token";
getToken, import { hashAPIPath } from "../../../actions/core/hash";
} from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL = const WEBAPI_URL =
process.env.RELAY_ROOT || process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) { export default async function ApiProxy(req, res) {
var searchString = req.query.searchString; var searchString = req.query.searchString;
var pageNumber = req.query.pageNumber; var pageNumber = req.query.pageNumber;
+3 -1
View File
@@ -13,7 +13,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { getToken, azureHeaders, consoleLogger } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+3 -1
View File
@@ -13,7 +13,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { getToken, azureHeaders, consoleLogger } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+3 -1
View File
@@ -18,7 +18,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions"; import { azureHeadersPaged } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+3 -1
View File
@@ -1,6 +1,8 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
import OSPoint from "ospoint"; import OSPoint from "ospoint";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
+3 -1
View File
@@ -1,7 +1,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;

Some files were not shown because too many files have changed in this diff Show More