Removed proxy and added api calls, has gov gateway auth

This commit is contained in:
2022-01-20 10:56:26 +00:00
parent 6f37064eba
commit 5a536e158c
127 changed files with 5829 additions and 3097 deletions
+28 -23
View File
@@ -2,6 +2,7 @@
ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/
TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502
//TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5
GRANT_TYPE = "client_credentials"
HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
@@ -11,44 +12,34 @@ NEXT_PUBLIC_HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459
//Dev oauth
//CLIENT_ID = e082def0-3453-461f-9a5e-f4ab127dc015
//CLIENT_SECRET = qW.7Q~TSr3sZmLEnJQJPXEdOckb_yo2t1yJmY
// dev
//RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
//RELAYURI = "dev-pedw-ns.servicebus.windows.net"
//RELAYPATH = "dev-pedw-hc"
//SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y="
//SASKEYNAME = "devpedwnspolicy"
//Test Oauth
//CLIENT_ID = 6619ad85-c908-490d-811b-de8c93c0f2aa
//CLIENT_SECRET = qKo7Q~5QvLEplbwnBbint_I5lXqx_-kDm8Vj-
CLIENT_ID = 6619ad85-c908-490d-811b-de8c93c0f2aa
CLIENT_SECRET = qKo7Q~5QvLEplbwnBbint_I5lXqx_-kDm8Vj-
RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
RELAYURI = "test-pedw-ns.servicebus.windows.net"
RELAYPATH = "test-pedw-hc"
//test
//RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
//RELAYURI = "test-pedw-ns.servicebus.windows.net"
//RELAYPATH = "test-pedw-hc"
//SASKEY = "kTLrs9UHwuW9Msc9uNfjf+89qLYT6ly80lK0zdTYJW4="
//SASKEYNAME = "testpedwhcpolicy"
//Preprod Oauth
CLIENT_ID = 75594242-8773-45c7-a3da-85e62485b2f3
CLIENT_SECRET = UDF7Q~OwTLIV7LXPHlIYHSWbJunlBD53ieLt-
//CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
//CLIENT_SECRET = Ioo7Q~RJfhWsE45wPsuHm1CzRk1SppnNN3lZF
//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
//RELAYURI = "pp-pedw-ns.servicebus.windows.net"
//RELAYPATH = "pp-pedw-hc"
//preprod
RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
RELAYURI = "pp-pedw-ns.servicebus.windows.net"
RELAYPATH = "pp-pedw-hc"
//SASKEY = "JzrOYfMTsGBD1cZHH2nkzqsbfDCqg0brO6jyiIDNVPo="
//SASKEYNAME = "pppedwnspolicy"
//Prod Oauth
//CLIENT_ID = 01904c07-9035-4cf9-a535-3945f6e470d2
//CLIENT_SECRET = PRo7Q~GQoKSdARRqF-NOXQDx2Ka8UCINyvagk
//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/
//RELAYURI = "prod-pedw-ns.servicebus.windows.net"
//RELAYPATH = "prod-pedw-hc"
GOOGLE_TAG_MANAGER = GTM-T78CBC3
@@ -64,3 +55,17 @@ I18N_DOMAIN = "cymru.local"
//I18N_DOMAIN ="stage-gwaithcynllunio.gwasanaeth.llyw.cymru"
//I18N_DOMAIN ="pp-gwaithcynllunio.gwasanaeth.llyw.cymru"s
//I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru"
//gov gateway
GG_PROVIDER_CONFIG_ENDPOINT = "https://api.ete.access.service.gov.uk/.well-known/openid-configuration"
GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
GG_CLIENT_SECRET = z1PGLAKPxIhjMBegTdzX22AayIORc1GsCbMQZ6mieBn7zChjzzxup5lkIByEmsYS
GG_REDIRECT_URI = "http://localhost:3000"
NEXT_PUBLIC_GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000"
API_ROOT = "http://localhost:3000"
+191
View File
@@ -0,0 +1,191 @@
import axios from "axios";
import { hashAPIPath } from "./";
const configEndpoint = process.env.GG_PROVIDER_CONFIG_ENDPOINT;
const ggClientID = process.env.GG_CLIENT_ID;
const ggClientSecret = process.env.GG_CLIENT_SECRET;
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
export const getProviderConfig = () => {
return axios
.get(configEndpoint)
.then((res) => res.data)
.catch((error) => {
console.log("error :", error.response);
// return error;
});
};
export const getGGToken = (tokenURL, authCode, redirectUri) => {
const tokenBody =
"grant_type=authorization_code" +
"&code=" +
authCode +
"&redirect_uri=" +
redirectUri;
const basicAuthBase64 = (ggClientID + ":" + ggClientSecret).toString();
//console.log("base64 " + Base64.encode(basicAuthBase64));
const tokenConfig = {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Basic " + Base64.encode(basicAuthBase64),
},
};
return axios
.post(tokenURL, tokenBody, tokenConfig)
.then((res) => res.data)
.catch((error) => {
// if (error.response) {
// console.log(error.response.data);
// console.log(error.response.status);
// console.log(error.response.headers);
// }
return error.response;
});
};
export const getUserInfo = (userInfoURL, authToken) => {
const tokenConfig = {
headers: {
"Authorization": "Bearer " + authToken,
},
};
return axios
.get(userInfoURL, tokenConfig)
.then((res) => res)
.catch((error) => {
//console.log(`Error: ${err?.response?.data}`);
//return error;
});
};
export const getPortalLogin = (emailAddress, token) => {
var queryUrl =
"contacts?$filter=emailaddress1 eq '" +
emailAddress +
"'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname";
return axios
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
});
};
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,
},
};
};
var Base64 = {
_keyStr:
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode: function (e) {
var t = "";
var n, r, i, s, o, u, a;
var f = 0;
e = Base64._utf8_encode(e);
while (f < e.length) {
n = e.charCodeAt(f++);
r = e.charCodeAt(f++);
i = e.charCodeAt(f++);
s = n >> 2;
o = ((n & 3) << 4) | (r >> 4);
u = ((r & 15) << 2) | (i >> 6);
a = i & 63;
if (isNaN(r)) {
u = a = 64;
} else if (isNaN(i)) {
a = 64;
}
t =
t +
this._keyStr.charAt(s) +
this._keyStr.charAt(o) +
this._keyStr.charAt(u) +
this._keyStr.charAt(a);
}
return t;
},
decode: function (e) {
var t = "";
var n, r, i;
var s, o, u, a;
var f = 0;
//e = e.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (f < e.length) {
s = this._keyStr.indexOf(e.charAt(f++));
o = this._keyStr.indexOf(e.charAt(f++));
u = this._keyStr.indexOf(e.charAt(f++));
a = this._keyStr.indexOf(e.charAt(f++));
n = (s << 2) | (o >> 4);
r = ((o & 15) << 4) | (u >> 2);
i = ((u & 3) << 6) | a;
t = t + String.fromCharCode(n);
if (u != 64) {
t = t + String.fromCharCode(r);
}
if (a != 64) {
t = t + String.fromCharCode(i);
}
}
t = Base64._utf8_decode(t);
return t;
},
_utf8_encode: function (e) {
e = e.replace(/\r\n/g, "\n");
var t = "";
for (var n = 0; n < e.length; n++) {
var r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r);
} else if (r > 127 && r < 2048) {
t += String.fromCharCode((r >> 6) | 192);
t += String.fromCharCode((r & 63) | 128);
} else {
t += String.fromCharCode((r >> 12) | 224);
t += String.fromCharCode(((r >> 6) & 63) | 128);
t += String.fromCharCode((r & 63) | 128);
}
}
return t;
},
_utf8_decode: function (e) {
var t = "";
var n = 0;
var r = (c1 = c2 = 0);
while (n < e.length) {
r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r);
n++;
} else if (r > 191 && r < 224) {
c2 = e.charCodeAt(n + 1);
t += String.fromCharCode(((r & 31) << 6) | (c2 & 63));
n += 2;
} else {
c2 = e.charCodeAt(n + 1);
c3 = e.charCodeAt(n + 2);
t += String.fromCharCode(
((r & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)
);
n += 3;
}
}
return t;
},
};
+393 -647
View File
File diff suppressed because it is too large Load Diff
+50
View File
@@ -0,0 +1,50 @@
export const getSelectQuery = (appealTypeName) => {
switch (appealTypeName) {
case "pinswg_advertses":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_procedure,pinswg_questionnaireduedate,statuscode";
break;
case "pinswg_callinss77s":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_startdate,statuscode";
break;
case "pinswg_commonlands":
case "pinswg_environmentalpermittings":
case "pinswg_hedgeshedgerowstreepreservationreplacems":
case "pinswg_miscellaneouscaseworks":
case "pinswg_wayleaves":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode";
break;
case "pinswg_communityinfrastructurelevys117118119s":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_startdate,statuscode";
break;
case "pinswg_compulsorypurchaseorderses":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode";
case "pinswg_dnses":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectdescription,pinswg_projectlocation,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode";
case "pinswg_electricityacts":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode";
case "pinswg_householderappealhases":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_otherpartiesstatement,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
case "pinswg_enforcementnoticeappeals174s":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
case "pinswg_enforcementlistedbuildingconservationaps":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdates,pinswg_statementduedate,statuscode";
case "pinswg_maintenanceoflands217s":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdates,pinswg_statementduedate,statuscode";
case "pinswg_lawfuldevelopmentcertificates":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
case "pinswg_listedbuildingandconservationareaconsens":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_sitepostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
case "pinswg_planningappeals78s":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
case "pinswg_planningconditionss73s79s":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
case "pinswg_planningobligationappeals106s":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatements,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode";
case "pinswg_rows":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode";
break;
default:
return "";
break;
}
};
+4 -3
View File
@@ -82,10 +82,11 @@ let PersonalDetails = (props) => {
let errorsobj = {};
const required = (value) => (value ? undefined : "Is required");
const emailRegex =
/(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi;
const email = (value) =>
value && !/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(value)
? "Invalid email address"
: undefined;
value && !emailRegex.test(value) ? "Invalid email address" : undefined;
const phoneNumber = (value) =>
value &&
!/^(?:(?:\(?(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?(?:\(?0\)?[\s-]?)?)|(?:\(?0))(?:(?:\d{5}\)?[\s-]?\d{4,5})|(?:\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3}))|(?:\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4})|(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}))(?:[\s-]?(?:x|ext\.?|\#)\d{3,4})?$/i.test(
+12 -2
View File
@@ -23,6 +23,7 @@ const RenderTextfield = ({
input,
type,
errorMsg,
disabled,
meta: { touched, error },
...custom
}) => {
@@ -39,6 +40,7 @@ const RenderTextfield = ({
name={name}
id={id}
type={type}
disabled={disabled}
/>
{touched && error && (
<span
@@ -69,6 +71,8 @@ const RegisterForm = (props) => {
value,
setRegisterFormComplete,
setAccountCreatedComplete,
loggedInUserEmail,
emailaddress1,
} = props;
let { t, lang } = useTranslation();
@@ -135,7 +139,8 @@ const RegisterForm = (props) => {
<h2 className="govuk-fieldset__heading">
{t(
"account:register-new-account-sub-heading-1"
)}
)}{" "}
{loggedInUserEmail}
</h2>
</legend>
<Field
@@ -176,6 +181,7 @@ const RegisterForm = (props) => {
label={t(
"account:register-new-account-email-address-label"
)}
disabled
/>
<Field
name="telephone1"
@@ -327,13 +333,16 @@ const RegisterForm = (props) => {
);
};
const mapStateToProps = (state) => {
const mapStateToProps = (state, props) => {
return {
search: state.search,
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
//form: state.form,
initialValues: {
emailaddress1: props.loggedInUserEmail,
},
};
};
@@ -353,6 +362,7 @@ export default connect(
)(
reduxForm({
form: "accountRegisterForm",
enableReinitialize: true,
destroyOnUnmount: false,
})(RegisterForm)
);
+65 -8
View File
@@ -107,10 +107,7 @@ const Breadcrumbs = (props) => {
) : (
""
)}
{router.pathname ==
(router.locale == "cy"
? "/canlyniadauchwilio"
: "/searchresults") ? (
{router.pathname == "/searchresults" ? (
<>
<li className="govuk-breadcrumbs__list-item">
{t("common:breadcrumb-search-results")}
@@ -128,6 +125,28 @@ const Breadcrumbs = (props) => {
) : (
""
)}
{router.pathname == "/myportal/advancedsearch" ? (
<>
<li className="govuk-breadcrumbs__list-item">
<Link
href={
router.locale != "en"
? router.locale + "/myportal"
: "/myportal"
}
>
<a className="govuk-breadcrumbs__link">
{t("common:breadcrumb-my-portal")}
</a>
</Link>
</li>
<li className="govuk-breadcrumbs__list-item">
{t("common:breadcrumb-advanced-search")}
</li>
</>
) : (
""
)}
{router.pathname == "/advancedsearchresults" ? (
<>
{" "}
@@ -156,6 +175,47 @@ const Breadcrumbs = (props) => {
) : (
""
)}
{router.pathname ==
"/myportal/advancedsearchresults" ? (
<>
<li className="govuk-breadcrumbs__list-item">
<Link
href={
router.locale != "en"
? router.locale + "/myportal"
: "/myportal"
}
>
<a className="govuk-breadcrumbs__link">
{t("common:breadcrumb-my-portal")}
</a>
</Link>
</li>
<li className="govuk-breadcrumbs__list-item">
<Link
href={
router.locale != "en"
? router.locale +
"/myportal/advancedsearch"
: "/myportal/advancedsearch"
}
>
<a className="govuk-breadcrumbs__link">
{t(
"common:breadcrumb-advanced-search"
)}
</a>
</Link>
</li>
<li className="govuk-breadcrumbs__list-item">
{t(
"common:breadcrumb-advanced-search-results"
)}
</li>
</>
) : (
""
)}
{router.pathname == "/newappeal" ? (
<>
<li className="govuk-breadcrumbs__list-item">
@@ -442,10 +502,7 @@ const Breadcrumbs = (props) => {
) : (
""
)}
{router.pathname ==
(router.locale == "cy"
? "/manyliondns"
: "/dnsdetails") ? (
{router.pathname == "/dnsdetails" ? (
<>
<li className="govuk-breadcrumbs__list-item">
<Link
+12 -31
View File
@@ -12,11 +12,10 @@ import CryptoJS from "crypto-js";
import {
getBasicSearch,
getBasicSearchDetails,
getSearchDocumentDetails1,
getSearchDocumentHistory1,
getSearchDocumentHistory1Paged,
getSearchDocumentDetails1Paged,
getToken,
getSearchDocumentDetails,
getSearchDocumentHistory,
getSearchDocumentHistoryPaged,
getSearchDocumentDetailsPaged,
} from "../../actions";
import {
@@ -105,9 +104,9 @@ const DocumentDetails = (props) => {
>
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
<a
href={encryptDocReference(
detailsObj.pinswg_isharedocumentreference
)}
href={
detailsObj.pinswg_hashlink
}
>
<span className="results-visually-hidden">
{t(
@@ -191,23 +190,9 @@ const DocumentDetails = (props) => {
);
};
const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY;
const encryptDocReference = (documentRef) => {
var hashlink = CryptoJS.HmacSHA256(
"documents/download/" + documentRef,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return (
"/api/proxy/documents/download/" + documentRef + "?hash=" + hashlink
);
};
useEffect(() => {
const docDetailsObj = async () => {
let docObj = await getSearchDocumentDetails1(incidentid)
let docObj = await getSearchDocumentDetails(incidentid)
.then((data) => {
//console.log(data);
setDocumentDetails(data);
@@ -239,7 +224,7 @@ const DocumentDetails = (props) => {
console.log(historyDetail.pinswg_documentid);
} else {
historyArr.push(
getSearchDocumentHistory1(
getSearchDocumentHistory(
historyDetail.pinswg_documentid
)
);
@@ -252,8 +237,7 @@ const DocumentDetails = (props) => {
}, [incidentid, setDocumentHistory, setDocumentDetails]);
const getDocumentResults = (pageNumber) => {
//console.log(advancedSearch, searchString, pageNumber);
getSearchDocumentDetails1Paged(incidentid, pageNumber)
getSearchDocumentDetailsPaged(incidentid, pageNumber)
.then((data) => {
//console.log(data);
setDocumentDetails(data);
@@ -269,10 +253,7 @@ const DocumentDetails = (props) => {
};
const getDocumentDetails = async () => {
let docObj = await getSearchDocumentDetails1Paged(
incidentid,
pageNumber
)
let docObj = await getSearchDocumentDetailsPaged(incidentid, pageNumber)
.then((data) => {
//console.log(data);
setDocumentDetails(data);
@@ -303,7 +284,7 @@ const DocumentDetails = (props) => {
console.log(historyDetail.pinswg_documentid);
} else {
historyArr.push(
getSearchDocumentHistory1Paged(
getSearchDocumentHistoryPaged(
historyDetail.pinswg_documentid,
pageNumber
)
+1 -6
View File
@@ -73,12 +73,7 @@ const RepresentationList = (props) => {
return (
<div className="govuk-summary-list__row" key={key}>
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
<a
href={
"/api/proxy/documents/download/" +
detailsObj.pinswg_isharedocumentreference
}
>
<a href={detailsObj.pinswg_hashlink}>
<span className="results-visually-hidden">
{t("case:documents-name-label")}:
</span>
+30 -33
View File
@@ -121,23 +121,28 @@ const CaseSummary = (props) => {
] || "not entered"}
</dd>
</div>
{_.has(detailsObj, "pinswg_agentcontactname") ? (
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-agent-label")}
</dt>
<dd className="govuk-summary-list__value">
{_.has(
detailsObj,
"pinswg_agentcontactname"
)
? detailsObj.pinswg_agentcontactname
: ""}
</dd>
</div>
) : (
""
)}
{detailsObj.pinswg_agentcontactname != null &&
(_.has(
detailsObj,
"pinswg_agentcontactname"
) ? (
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-agent-label")}
</dt>
<dd className="govuk-summary-list__value">
{_.has(
detailsObj,
"pinswg_agentcontactname"
)
? detailsObj.pinswg_agentcontactname
: ""}
</dd>
</div>
) : (
""
))}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-site-address-label")}
@@ -235,7 +240,7 @@ const CaseSummary = (props) => {
<div>
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<h1>Not details currently held</h1>
<h1>{t("case:summary-no-details-label")}</h1>
</div>
</div>
</div>
@@ -601,23 +606,15 @@ const CaseSummary = (props) => {
<Link
href={
router.locale == "cy"
? "/achos"
: "/case"
? "/canlyniadauchwilio?q=" +
item.title +
"&lk=1"
: "/searchresults?q=" +
item.title +
"&lk=1"
}
>
<a
onClick={() => {
setCurrentReference({
"currentReference": item.title,
"currentType":
"searchResultsObj",
"incidentid": item.incidentid,
});
}}
className=""
>
{item.title}
</a>
<a className="">{item.title}</a>
</Link>
</li>
);
+43 -38
View File
@@ -128,12 +128,12 @@ const Pinswg_dnsid = (props) => {
transLookup,
'$..[?(@.value=="' +
detailsObj[
"pinswg_procedure@OData.Community.Display.V1.FormattedValue"
"pinswg_choiceofprocedure@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy'
)
: detailsObj[
"pinswg_procedure@OData.Community.Display.V1.FormattedValue"
"pinswg_choiceofprocedure@OData.Community.Display.V1.FormattedValue"
] || ""}
</dd>
</div>
@@ -245,44 +245,49 @@ const Pinswg_dnsid = (props) => {
detailsObj.pinswg_recommendation +
'")].value_cy'
)
: detailsObj.pinswg_recommendation ||
t(
"case:summary-no-date-entered-label"
)}
</dd>
</div>
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-case-website-label"
)}
</dt>
<dd className="govuk-summary-list__value">
{router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
detailsObj.pinswg_webaddress +
'")].value_cy'
)
: (
<a
target="_blank"
rel="noreferrer"
href={
detailsObj.pinswg_webaddress
}
>
{
detailsObj.pinswg_webaddress
}
</a>
) ||
t(
"case:summary-no-date-entered-label"
)}
: detailsObj.pinswg_recommendation}
</dd>
</div>
{detailsObj.pinswg_webaddress != null && (
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-case-website-label"
)}
</dt>
<dd className="govuk-summary-list__value">
{router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
detailsObj.pinswg_webaddress +
'")].value_cy'
)
: (
<a
target="_blank"
rel="noreferrer"
href={
detailsObj.pinswg_webaddress.indexOf(
"https://"
)
? "https://" +
detailsObj.pinswg_webaddress
: detailsObj.pinswg_webaddress
}
>
{
detailsObj.pinswg_webaddress
}
</a>
) ||
t(
"case:summary-no-date-entered-label"
)}
</dd>
</div>
)}
</dl>
</div>
</div>
@@ -250,26 +250,28 @@ const Pinswg_electricityactid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-case-website-label"
)}
</dt>
<dd className="govuk-summary-list__value">
{router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
detailsObj.pinswg_webaddress +
'")].value_cy'
)
: detailsObj.pinswg_webaddress ||
t(
"case:summary-no-date-entered-label"
)}
</dd>
</div>
{detailsObj.pinswg_webaddress != null && (
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-case-website-label"
)}
</dt>
<dd className="govuk-summary-list__value">
{router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
detailsObj.pinswg_webaddress +
'")].value_cy'
)
: detailsObj.pinswg_webaddress ||
t(
"case:summary-no-date-entered-label"
)}
</dd>
</div>
)}
</dl>
</div>
</div>
@@ -250,26 +250,28 @@ const Pinswg_harbourrevisionorderid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-case-website-label"
)}
</dt>
<dd className="govuk-summary-list__value">
{router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
detailsObj.pinswg_webaddress +
'")].value_cy'
)
: detailsObj.pinswg_webaddress ||
t(
"case:summary-no-date-entered-label"
)}
</dd>
</div>
{detailsObj.pinswg_webaddress != null && (
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-case-website-label"
)}
</dt>
<dd className="govuk-summary-list__value">
{router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
detailsObj.pinswg_webaddress +
'")].value_cy'
)
: detailsObj.pinswg_webaddress ||
t(
"case:summary-no-date-entered-label"
)}
</dd>
</div>
)}
</dl>
</div>
</div>
@@ -102,26 +102,28 @@ const Pinswg_transportandworkactid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-case-website-label"
)}
</dt>
<dd className="govuk-summary-list__value">
{router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
detailsObj.pinswg_webaddress +
'")].value_cy'
)
: detailsObj.pinswg_webaddress ||
t(
"case:summary-no-date-entered-label"
)}
</dd>
</div>
{detailsObj.pinswg_webaddress != null && (
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-case-website-label"
)}
</dt>
<dd className="govuk-summary-list__value">
{router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
detailsObj.pinswg_webaddress +
'")].value_cy'
)
: detailsObj.pinswg_webaddress ||
t(
"case:summary-no-date-entered-label"
)}
</dd>
</div>
)}
</dl>
</div>
</div>
+31 -12
View File
@@ -20,7 +20,7 @@ const CookieManagementMain = (props) => {
Object.assign(values, {
"essential": "accepted",
"usage": usageState,
"communications": communicationsState,
// "communications": communicationsState,
"settings": settingsState,
});
@@ -42,14 +42,15 @@ const CookieManagementMain = (props) => {
";expires=Thu, 01 Jan 1970 00:00:01 GMT";
}
usageState == "revoked" && delete_cookie("CookiePolicy", "/"),
delete_cookie("_ga", "/"),
usageState == "revoked" && delete_cookie("_ga", "/"),
delete_cookie("_gid", "/");
cookie.set("planning_casework", true, {
expires: expDate,
path: "/",
});
setSavedState(true);
};
let cookieCheck = parseCookies();
@@ -59,14 +60,16 @@ const CookieManagementMain = (props) => {
? {}
: JSON.parse(cookieCheck.CookiePolicy);
const [savedState, setSavedState] = useState(false);
const [usageState, setUsageState] = useState(
typeof cookieCheck.CookiePolicy == "undefined" ? null : cookieObj.usage
);
const [communicationsState, setCommunicationsState] = useState(
typeof cookieCheck.CookiePolicy == "undefined"
? null
: cookieObj.communications
);
// const [communicationsState, setCommunicationsState] = useState(
// typeof cookieCheck.CookiePolicy == "undefined"
// ? null
// : cookieObj.communications
// );
const [settingsState, setSettingsState] = useState(
typeof cookieCheck.CookiePolicy == "undefined"
? null
@@ -78,9 +81,9 @@ const CookieManagementMain = (props) => {
case "usage":
setUsageState(value);
break;
case "communications":
setCommunicationsState(value);
break;
// case "communications":
// setCommunicationsState(value);
// break;
case "settings":
setSettingsState(value);
break;
@@ -102,6 +105,22 @@ const CookieManagementMain = (props) => {
{t("cookies:cookie-title-heading")}
</h1>
<hr className="govuk-section-break govuk-section-break--visible" />
{savedState && (
<div
id="cookieSettingsMessageSuccess"
className="govuk-inset-text paragraph--type--call-out-message call-out-type-positive-alert-message"
>
<h2 className="govuk-heading-l">
<strong>
{t("cookies:cookie-saved-heading")}
</strong>
</h2>
<p className="govuk-body">
{t("cookies:cookie-saved-paragraph")}
</p>
</div>
)}
{typeof cookieCheck.CookiePolicy == "undefined" ? (
<>
<div className="govuk-inset-text paragraph--type--call-out-message">
@@ -455,7 +474,7 @@ const mapStateToProps = (state) => {
return {
initialValues: {
usage: state.accountDetails.cookieObj.usage,
communications: state.accountDetails.cookieObj.communications,
//communications: state.accountDetails.cookieObj.communications,
settings: state.accountDetails.cookieObj.settings,
},
};
+6 -10
View File
@@ -219,11 +219,9 @@ export default function Footer(props) {
<li className="govuk-footer__inline-list-item">
<Link
href={
router.locale == "cy"
? "/preifatrwydd"
: "/privacy"
}
href={t(
"common:footer-privacy-link"
)}
>
<a
id="aPrivacy"
@@ -238,11 +236,9 @@ export default function Footer(props) {
<li className="govuk-footer__inline-list-item">
<Link
href={
router.locale == "cy"
? "/telerau-ac-amodau"
: "/terms-and-conditions"
}
href={t(
"common:footer-terms-conditions-link"
)}
>
<a
id="aTermsConds"
+22 -20
View File
@@ -101,7 +101,7 @@ export default function AccessibilityCY() {
<li>
Anfonwch neges e-bost at:{" "}
<a
className="govuk-link--no-underline govuk-!-font-weight-bold"
className="govuk-link govuk-link--no-underline govuk-!-font-weight-bold"
href="mailto:PEDW.GwaithAchos@llyw.cymru"
>
PEDW.GwaithAchos@llyw.cymru
@@ -110,7 +110,7 @@ export default function AccessibilityCY() {
<li>
Ffoniwch:{" "}
<a
className="govuk-link--no-underline govuk-!-font-weight-bold"
className="govuk-link govuk-link--no-underline govuk-!-font-weight-bold"
href="tel:03000 604400"
>
03000 604400
@@ -128,7 +128,7 @@ export default function AccessibilityCY() {
ffoniwch ni neu anfonwch neges e-bost atom i gael
cyfarwyddiadau;{" "}
<a
className="govuk-link--no-underline govuk-!-font-weight-bold"
className="govuk-link govuk-link--no-underline govuk-!-font-weight-bold"
href="https://llyw.cymru/penderfyndiadau-cynllunio-ac-amgylchedd-cymru/cysylltwch-ni"
>
Cysylltwch â Ni
@@ -174,9 +174,14 @@ export default function AccessibilityCY() {
<h3>Statws cydymffurfio</h3>
<p>
Maer wefan hon yn cydymffurfion rhannol â Chanllawiau
Hygyrchedd Cynnwys y We (WCAG) fersiwn 2.1 safon Lefel AA,
o ganlyniad ir achosion o ddiffyg
Maer wefan hon yn cydymffurfion rhannol â{" "}
<a
className="govuk-link govuk-link--no-underline govuk-!-font-weight-bold"
href="https://www.w3.org/TR/WCAG21/"
>
Chanllawiau Hygyrchedd Cynnwys y We (WCAG) fersiwn 2.1
</a>{" "}
safon Lefel AA, o ganlyniad ir achosion o ddiffyg
cydymffurfio/eithriadau neur achosion o ddiffyg
cydymffurfio ac eithriadau] a restrir isod.
</p>
@@ -184,26 +189,23 @@ export default function AccessibilityCY() {
<h3>Diffyg cydymffurfio âr rheoliadau hygyrchedd</h3>
<p>
Nid oes testun amgen ar gyfer rhai delweddau, felly ni all
pobl syn defnyddio rhaglen darllen sgrin gael at y
wybodaeth. Mae hyn yn methu maen prawf llwyddiant 1.1.1
(cynnwys nad ywn destun).
</p>
<p>
Bwriadwn ychwanegu testun amgen at yr holl ddelweddau erbyn
mis Medi 2020. Pan fyddwn yn cyhoeddi cynnwys newydd, byddwn
yn sicrhau bod ein defnydd o ddelweddaun bodloni safonau
hygyrchedd.
Mae rhai or dogfennau a gyhoeddir ar-lein trwyr gwasanaeth
hwn yn cynnwys diagramau cynllunio syn dechnegol eu natur i
raddau helaeth. Er y cydnabyddwn efallai na fydd pob agwedd
ar gynnwys or fath yn gwbl hygyrch, rydym wedi ceisio eu
gwella trwy gynyddu maint y testun sylfaenol lle y bon
bosibl, ac ychwanegu disgrifiadau testun ystyrlon i ategu
unrhyw wybodaeth weledol bwysig.
</p>
<h3>Paratoir datganiad hygyrchedd hwn</h3>
<p>
Paratowyd y datganiad hwn ar [TBC]. Fei hadolygwyd
ddiwethaf ar [TBC when signed off].
Paratowyd y datganiad hwn ar 22/11/2021. Fei hadolygwyd
ddiwethaf ar 02/12/2021.
</p>
<p>
{/* <p>
Profwyd y wefan hon ddiwethaf ar [TBC]. Cynhaliwyd y prawf
gan [add name of organisation that carried out test, or
indicate that you did your own testing].
@@ -218,7 +220,7 @@ export default function AccessibilityCY() {
<p>
Gallwch ddarllen yr adroddiad llawn ar y prawf hygyrchedd
[add link to report].
</p>
</p>*/}
</div>
</div>
);
+23 -19
View File
@@ -96,7 +96,7 @@ export default function AccessibilityEN() {
<li>
Email:{" "}
<a
className="govuk-link--no-underline govuk-!-font-weight-bold"
className="govuk-link govuk-link--no-underline govuk-!-font-weight-bold"
href="mailto:PEDW.Casework@gov.wales"
>
PEDW.Casework@gov.wales
@@ -105,7 +105,7 @@ export default function AccessibilityEN() {
<li>
Call:{" "}
<a
className="govuk-link--no-underline govuk-!-font-weight-bold"
className="govuk-link govuk-link--no-underline govuk-!-font-weight-bold"
href="tel:03000 604400"
>
03000 604400
@@ -150,7 +150,7 @@ export default function AccessibilityEN() {
<p>
Find out how to{" "}
<a
className="govuk-link--no-underline govuk-!-font-weight-bold"
className="govuk-link govuk-link--no-underline govuk-!-font-weight-bold"
href="https://gov.wales/planning-and-environment-decisions-wales/contact-us"
>
contact us
@@ -171,33 +171,37 @@ export default function AccessibilityEN() {
<h3>Compliance status</h3>
<p>
This website is partially compliant with the Web Content
Accessibility Guidelines version 2.1 Level AA standard,
due to the non-compliances/the exemptions or the
non-compliances and exemptions] listed below.
This website is partially compliant with the{" "}
<a
className="govuk-link govuk-link--no-underline govuk-!-font-weight-bold"
href="https://www.w3.org/TR/WCAG21/"
>
Web Content Accessibility Guidelines version 2.1
</a>
Level AA standard, due to the non-compliances listed
below.
</p>
<h3>Non-compliance with the accessibility regulations</h3>
<p>
Some images do not have a text alternative, so people using
a screen reader cannot access the information. This fails
WCAG 2.1 success criterion 1.1.1 (non-text content).
</p>
<p>
We plan to add text alternatives for all images by September
2020. When we publish new content well make sure our use of
images meets accessibility standards.
Some documents published online via this service contain
planning diagrams that are largely technical in nature.
While we acknowledge that all aspects of such content may
not be fully accessible, we have endeavoured to improve them
by increasing the base text size where possible, and adding
meaningful text descriptions to supplement any important
visual information.
</p>
<h3>Preparation of this accessibility statement</h3>
<p>
This statement was prepared on [TBC]. It was last reviewed
on [TBC when signed off].
This statement was prepared on 22/11/2021. It was last
reviewed on 02/12/2021.
</p>
<p>
{/* <p>
This website was last tested on [TBC]. The test was carried
out by [add name of organisation that carried out test, or
indicate that you did your own testing].
@@ -212,7 +216,7 @@ export default function AccessibilityEN() {
<p>
You can read the full accessibility test report [add link to
report].
</p>
</p> */}
</div>
</div>
);
File diff suppressed because it is too large Load Diff
+17 -16
View File
@@ -757,20 +757,23 @@ export default function PrivacyEN() {
We provide your information to the relevant Welsh
Minister who make the final decision on the applications
and appeals we examine via:
<ul>
<li>
The Department for Business, Energy, and
Industrial Strategy
</li>
<li>The Department for Transport</li>
<li>
The Department for Environment, Food and Rural
Affairs and
</li>
<li>
The Ministry of Housing, Communities and Local
Government.
</li>
</ul>
</li>
<li>
The Department for Business, Energy, and Industrial
Strategy
</li>
<li>The Department for Transport</li>
<li>
The Department for Environment, Food and Rural Affairs
and
</li>
<li>
The Ministry of Housing, Communities and Local
Government.
</li>
<li>
For fairness to the other parties interested in a case,
we need to share your representations as indicated
@@ -857,9 +860,7 @@ export default function PrivacyEN() {
This will normally be set out in our guidance, but if you
have specific queries or concerns in respect of a particular
case then please contact the case officer who, if necessary,
will discuss the matter with - process to be established,
can this be internal to PEDW or should it be sent up the
line?.
will discuss the matter with PEDW.
</p>
<h3>10. Do we use any data processors? </h3>
<p>
+3
View File
@@ -30,6 +30,9 @@ const Header = (props) => {
"/dnsdetails",
"/404",
"/account/register",
"/myportal/error",
"/accessibility",
"/details-about-cookies",
];
const hasContactLink = [
"/dns",
-1
View File
@@ -92,7 +92,6 @@ let CaseSearch = (props) => {
? "/canlyniadauchwilio"
: "/searchresults",
query: { q: values.basicSearch.trim() },
shallow: true,
});
};
+145 -41
View File
@@ -108,8 +108,15 @@ const RenderPasswordfield = ({
let Login = (props) => {
let { t } = useTranslation();
const { handleSubmit, pristine, reset, submitting, setLoggedInUserId } =
props;
const {
handleSubmit,
pristine,
reset,
submitting,
setLoggedInUserId,
GG_CLIENT_ID,
GG_REDIRECT_URI,
} = props;
const router = useRouter();
const { locale } = router;
@@ -117,6 +124,17 @@ let Login = (props) => {
// const [showSpinnerState, setShowSpinnerState] = useState(false);
const [validLoginID, setValidLoginID] = useState(null);
// console.log(
// "built login url path:",
// props.govGateway.config.authorization_endpoint +
// "?response_type=code&scope=openid&client_id=" +
// GG_CLIENT_ID +
// "&redirect_uri=" +
// GG_REDIRECT_URI +
// "&ui_locales=" +
// (router.locale == "cy" ? "cy" : "en-GB")
// );
// let spinnerState = () => {
// showSpinnerState == true
// ? setShowSpinnerState(false)
@@ -161,13 +179,35 @@ let Login = (props) => {
: "";
}, [cookies.pinsUser, router]);
const govGatwayLoginRedirect = () => {
let ggUrl =
props.govGateway.config.authorization_endpoint +
"?response_type=code&scope=openid&client_id=" +
GG_CLIENT_ID +
"&redirect_uri=" +
GG_REDIRECT_URI +
"&ui_locales=" +
(router.locale == "cy" ? "cy" : "en-GB");
console.log("login Url:", ggUrl);
router.replace(ggUrl);
};
const govGatwayForgottenLink = () => {
let ggUrl =
props.govGateway.config.authorization_endpoint +
"/login/forgot-password";
router.replace(ggUrl);
};
return (
<div className="card" id="login-card">
<form onSubmit={handleSubmit(onHandleSubmit)}>
<div className="card-body active">
<h3 className="heading-small card-heading">
{t("home:login-card-title")}
</h3>
<div className="card-body active">
<h3 className="heading-small card-heading">
{t("home:login-card-title")}
</h3>{" "}
<form onSubmit={handleSubmit(onHandleSubmit)}>
{validLoginID == false && (
<div className="govuk-error-message govuk-form-group--error">
Incorrect username or password
@@ -210,46 +250,109 @@ let Login = (props) => {
/>
<div className="govuk-form-group">
{/* <Link
href={
router.locale == "cy"
? "/fymhorth"
: "/myportal"
}
>
<a className="govuk-button">
{t("home:login-card-button")}
</a>
</Link> */}
<button type="submit" className="govuk-button">
{t("home:login-card-button")}
</button>
</div>
<div className="govuk-form-group govuk-!-margin-top-4">
<p className="govuk-body-s">
{t("home:login-card-register-label")}{" "}
<Link
href={
router.locale == "cy"
? "/cyfrif/cofrestr"
: "/account/register"
}
</form>
<div className="govuk-form-group govuk-!-margin-top-4">
<p className="govuk-body-xs">
<a
onClick={() => {
govGatwayLoginRedirect();
}}
className="govuk-button withChevron govuk-button-cta"
>
{t("home:login-via-gov-gateway-label")}
</a>
</p>
<p className="govuk-body-s">
{t("home:login-card-register-label")}{" "}
<Link
href={
router.locale == "cy"
? "/cyfrif/cofrestr"
: "/account/register"
}
>
<a className="govuk-link--no-underline">
{t("home:login-card-register-link")}
</a>
</Link>
</p>
<p className="govuk-body-s">
<a
onClick={() => {
govGatwayForgottenLink();
}}
className="govuk-link--no-underline"
>
{t("home:login-card-forgotten-label")}{" "}
</a>
</p>
<hr className="govuk-!-margin-bottom-4" />
<p className="govuk-body-s">
{t("home:login-comingsoon-temp-2")}
</p>
<ul>
<li>
<a
className="govuk-link--no-underline"
target="_blank"
href={t("home:login-comingsoon-forms-link-1")}
rel="noreferrer"
>
<a className="govuk-link--no-underline">
{t("home:login-card-register-link")}
</a>
</Link>
</p>
<p className="govuk-body-s">
<Link href="/">
<a className="govuk-link--no-underline">
{t("home:login-card-forgotten-label")}{" "}
</a>
</Link>
</p>
</div>
{t("home:login-comingsoon-forms-label-1")}
</a>
</li>
<li>
{" "}
<a
className="govuk-link--no-underline"
target="_blank"
href={t("home:login-comingsoon-forms-link-2")}
rel="noreferrer"
>
{t("home:login-comingsoon-forms-label-2")}
</a>
</li>
<li>
{" "}
<a
className="govuk-link--no-underline"
target="_blank"
href={t("home:login-comingsoon-forms-link-3")}
rel="noreferrer"
>
{t("home:login-comingsoon-forms-label-3")}
</a>
</li>
<li>
{" "}
<a
className="govuk-link--no-underline"
target="_blank"
href={t("home:login-comingsoon-forms-link-4")}
rel="noreferrer"
>
{t("home:login-comingsoon-forms-label-4")}
</a>
</li>
</ul>
<br />
<p className="govuk-body-s">
{t("home:login-comingsoon-email-link-label")}{" "}
<a
href={"mailto:" + t("home:login-contact-email")}
className="govuk-link--no-underline"
>
{t("home:login-contact-email")}
</a>
</p>
</div>
</form>
</div>
{/* <LoadingOverlay
active={showSpinnerState}
spinner
@@ -271,6 +374,7 @@ const mapStateToProps = (state) => {
watchedCases: state.watchedCases,
myRepresentations: state.myRepresentations,
awaitingSubmission: state.awaitingSubmission,
govGateway: state.govGateway,
};
};
+11 -3
View File
@@ -9,9 +9,10 @@ import Inspectorate from "./homepage/inspectorate";
import CaseComment from "./homepage/casecomment";
import Dns from "./homepage/dns";
export default function MainHome({ children, pages, showLogin }) {
const MainHome = (props) => {
let { t } = useTranslation();
const { showLogin, GG_REDIRECT_URI, GG_CLIENT_ID } = props;
const router = useRouter();
const { locale } = router;
@@ -28,11 +29,18 @@ export default function MainHome({ children, pages, showLogin }) {
<CaseSearch />
<CaseComment />
<Dns />
{showLogin == "true" && <Login />}
{showLogin == "true" && (
<Login
GG_CLIENT_ID={GG_CLIENT_ID}
GG_REDIRECT_URI={GG_REDIRECT_URI}
/>
)}
{/* <Inspectorate /> */}
</div>
</div>
</div>
</main>
);
}
};
export default MainHome;
+122 -39
View File
@@ -9,6 +9,11 @@ import AwaitingSubmission from "./myportal/awaitingsubmission";
import MyRepresentations from "./myportal/myrepresentations";
import WatchedCases from "./myportal/watchedcases";
import YourAccount from "./myportal/youraccount";
import { parseCookies, setCookie, destroyCookie } from "nookies";
import IdleTimer from "react-idle-timer";
import TimeoutModal from "../components/timeoutmodal";
import { useState } from "react";
const MyPortal = (props) => {
let { t } = useTranslation();
@@ -16,49 +21,127 @@ const MyPortal = (props) => {
const router = useRouter();
const { locale } = router;
const [showModal, setShowModal] = useState(false);
const inactiveTimeOut = 12000; // in seconds
const reminderTimeout = 60; // in seconds
let idleTimer = null;
let logoutTimer = null;
let onIdle = () => {
togglePopup();
logoutTimer = setTimeout(() => {
handleLogout();
}, 1000 * reminderTimeout * 1);
};
let togglePopup = () => {
showModal == true ? setShowModal(false) : setShowModal(true);
};
let handleStayLoggedIn = () => {
if (logoutTimer) {
clearTimeout(logoutTimer);
logoutTimer = null;
}
idleTimer.reset();
togglePopup();
};
const handleLogout = () => {
console.log("////////////", "\n", "logout", "\n", "//////////");
destroyCookie({}, "pinsUser"),
window.localStorage.clear(),
router.replace(props.ggLogout);
};
return (
<main className="" id="main-content" role="main">
<div className="servicebanner govuk-!-margin-bottom-4">
<h1>
<img
src={
router.locale == "cy"
? "/assets/images/my-portal-cy.svg"
: "/assets/images/my-portal-en.svg"
}
alt={router.locale == "cy" ? "Fy mhorth" : "My Portal"}
/>
<img
className="pedw_logo"
src="/assets/images/pedw_logo.png"
alt={
router.locale == "cy"
? "Penderfyniadau Cynllunio ac Amgylchedd Cymru"
: "Planning & Environment Decisions Wales"
}
/>
</h1>
</div>
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<div className="flex-container grid-row govuk-body ">
<MakeNewAppeal />
<MyCases myCases={props.myCases} />
<SearchCases />
<AwaitingSubmission
awaitingSubmission={props.awaitingSubmission}
<>
<main className="" id="main-content" role="main">
<div className="servicebanner myportal govuk-!-margin-bottom-4">
<h1>
<img
src={
router.locale == "cy"
? "/assets/images/planning-casework-cy.svg"
: "/assets/images/planning-casework-en.svg"
}
alt={
router.locale == "cy"
? "Fy mhorth"
: "My Portal"
}
/>
<MyRepresentations
myRepresentations={props.myRepresentations}
/>
<WatchedCases watchedCases={props.watchedCases} />
</div>
<div className="flex-container grid-row govuk-body ">
<YourAccount />
</h1>
<div className="serviceBanner_userDetails">
<img
className="user_logo"
src="/assets/images/user.svg"
alt={router.locale == "cy" ? "Defnyddiwr" : "User"}
/>{" "}
<div className="serviceBanner_userDetails_name">
{props.accountDetails.accountDetails.firstname}{" "}
{props.accountDetails.accountDetails.lastname}
</div>
<div>
<Link
href={
router.locale == "cy"
? "/allgofnodi"
: "/logout"
}
>
<a
onClick={() => {
handleLogout();
}}
className="govuk-header__link govuk-!-margin-right-3"
>
{t("common:signout-label")}
</a>
</Link>
</div>
</div>
</div>
</div>
</main>
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<div className="flex-container grid-row govuk-body ">
<MakeNewAppeal />
<MyCases myCases={props.myCases} />
<SearchCases />
<AwaitingSubmission
awaitingSubmission={props.awaitingSubmission}
/>
<MyRepresentations
myRepresentations={props.myRepresentations}
/>
<WatchedCases watchedCases={props.watchedCases} />
</div>
<div className="flex-container grid-row govuk-body ">
<YourAccount />
</div>
</div>
</div>
</main>
<IdleTimer
ref={(ref) => {
idleTimer = ref;
}}
element={document}
stopOnIdle={true}
onActive={console.log(" bbis active", idleTimer)}
onIdle={onIdle}
timeout={1000 * inactiveTimeOut * 1}
/>
<TimeoutModal
remainingCountdown={reminderTimeout}
showModal={showModal}
togglePopup={togglePopup}
handleStayLoggedIn={handleStayLoggedIn}
/>
</>
);
};
+29 -26
View File
@@ -6,7 +6,6 @@ import { setCurrentReference } from "../../store/currentView/action";
import { connect } from "react-redux";
import { parseCookies } from "nookies";
import {
getToken,
getWatchedCasesProxy,
getPortalModuleDetailsProxy,
deleteWatchedCases,
@@ -37,26 +36,21 @@ const TopThree = (props) => {
let showTopThreeArr = showTopThree.value;
const deleteItem = (caseID, topThreeType) => {
let token = getToken();
let cookies = parseCookies();
topThreeType == "watchedCases" &&
deleteWatchedCases(caseID)
.then((data) => data)
.then(() => {
getWatchedCasesProxy(token, cookies.pinsUser).then(
(data) => {
setWatchedCases(data),
getDetails(token, data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
}
);
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
setWatchedCases(data),
getDetails(data, "myWatchedCases").then((data) => {
setWatchedCasesDetails(data);
});
});
});
};
const getDetails = (token, resultsObj, detailsType) => {
const getDetails = (resultsObj, detailsType) => {
//console.log(resultsObj);
let detailsArr = [];
resultsObj = resultsObj.value;
@@ -72,7 +66,6 @@ const TopThree = (props) => {
} else {
detailsArr.push(
getPortalModuleDetailsProxy(
token,
getFormCollectionByID(
searchDetail.pinswg_appealcasetype
).LogicalCollectionName,
@@ -89,6 +82,24 @@ const TopThree = (props) => {
return Promise.all(detailsArr);
};
const getIncidentId = (topThreeType, objArr) => {
switch (topThreeType) {
case "myCases":
return objArr.incidentid;
break;
case "watchedCases":
return objArr._pinswg_watchedcase_value;
break;
case "myRepresentations":
return objArr.ticketnumber;
break;
case "awaitingSubmission":
break;
default:
// code block
}
};
let topThreeOnlyArr = showTopThreeArr.slice(0, 3);
Object.keys(topThreeOnlyArr).map((key, index) => {
topthreeRow.push(
@@ -126,18 +137,10 @@ const TopThree = (props) => {
],
"currentType": topThreeType,
"incidentid":
topThreeType != "watchedCases"
? topThreeType !=
"myRepresentations"
? showTopThreeArr[key]
._pinswg_case_value
: showTopThreeArr[key][
" _pinswg_watchedcase_value"
]
: showTopThreeArr[key][
" _pinswg_watchedcase_value"
],
"incidentid": getIncidentId(
topThreeType,
showTopThreeArr[key]
),
"appealType":
showTopThreeArr[key]
+2 -2
View File
@@ -29,10 +29,10 @@ const ViewAllResults = (props) => {
<Link
href={
router.locale == "cy"
? myportal == "true"
? myportal == true
? "/fymhorth/achos"
: "/achos"
: myportal == "true"
: myportal == true
? "/myportal/case"
: "/case"
}
+81 -24
View File
@@ -9,6 +9,14 @@ import data from "../../data/collections.json";
import LoadingOverlay from "react-loading-overlay";
import transLookup from "../../data/lookuptranslations.json";
const required = (errorMsg) => (value) =>
value || typeof value === "number" ? undefined : errorMsg;
export const minLength = (errorMsg) => (value) =>
value && value.length < 4
? errorMsg //`Must be ${min} characters or more`
: undefined;
let AdvancedSearch = (props) => {
let { t } = useTranslation();
@@ -37,6 +45,53 @@ let AdvancedSearch = (props) => {
? [{}]
: props.LPAData.LPAData.value;
const RenderTextfield = ({
id,
className,
rows,
datafieldname,
name,
label,
input,
hint1,
hint2,
hint3,
meta: { touched, error },
...custom
}) => {
return (
<>
<div className="govuk-form-group">
<div id="basicSearch-hint" className="govuk-hint ">
<label className="govuk-label" htmlFor="caseRef">
{t("search:casereference-label")}
</label>
</div>
<div>
<input
{...input}
className={className}
name={name}
id={id}
/>
{touched && error && (
<span
id={id + "-error"}
className="govuk-error-message govuk-form-group--error"
>
<span className="govuk-visually-hidden">
Error:
</span>{" "}
{error}
</span>
)}
</div>
</div>
</>
);
};
const RenderLPAList = ({
name,
id,
@@ -216,8 +271,6 @@ let AdvancedSearch = (props) => {
);
};
const required = (value) => (value ? undefined : "Required");
// const [showSpinnerState, setShowSpinnerState] = useState(false);
// let spinnerState = () => {
@@ -252,8 +305,8 @@ let AdvancedSearch = (props) => {
router.replace(
(router.locale == "cy"
? "/canlyniadauchwiliouwch"
: "/advancedsearchresults") + searchString,
? "/fymhorth/canlyniadauchwiliouwch"
: "/myportal/advancedsearchresults") + searchString,
null,
{
shallow: true,
@@ -275,27 +328,31 @@ let AdvancedSearch = (props) => {
{t("search:search-title-label")}
</h1>
</legend>
<div className="govuk-form-group">
<label
className="govuk-label"
htmlFor="caseRef"
>
{t(
"search:casereference-label"
)}
</label>
<Field
name="caseRef"
id="caseRef"
component="input"
className="govuk-input govuk-!-width-two-thirds"
label={t(
"search:casereference-label"
)}
errormsg="Appeal type is required"
/>
</div>
<Field
validate={[
minLength(
t(
"myportal:searchcases-validation-minlength"
)
),
]}
className="govuk-input govuk-!-width-two-thirds"
component={RenderTextfield}
id="caseRef"
name="caseRef"
type="text"
aria-describedby="caseRef-hint"
hint1={t(
"myportal:searchcases-card-search-hint"
)}
hint2={t(
"myportal:searchcases-card-search-example-label-1"
)}
hint3={t(
"myportal:searchcases-card-search-example-label-2"
)}
/>
<Field
name="appealTypes"
-1
View File
@@ -260,7 +260,6 @@ const DNSSearchResults = (props) => {
getBasicDNSSearchPaged(pageNumber)
.then((data) => {
//console.log(data);
setSearchResults(data);
return data;
})
+43 -46
View File
@@ -39,7 +39,6 @@ import {
import {
createWatchedCases,
getToken,
getWatchedCasesProxy,
getPortalModuleDetailsProxy,
deleteWatchedCases,
@@ -58,6 +57,7 @@ const SearchResults = (props) => {
watchedCases,
setWatchedCases,
setWatchedCasesDetails,
isLinkedCase,
} = props;
let { t } = useTranslation();
@@ -77,8 +77,6 @@ const SearchResults = (props) => {
const cookies = parseCookies();
const selectWatchedCase = (loggedInUser, incidentID, appealType) => {
let token = getToken();
let updateBody = {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
@@ -88,13 +86,11 @@ const SearchResults = (props) => {
createWatchedCases(updateBody)
.then((data) => data)
.then(() => {
getWatchedCasesProxy(token, cookies.pinsUser).then((data) => {
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
setWatchedCases(data),
getDetails(token, data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
getDetails(data, "myWatchedCases").then((data) => {
setWatchedCasesDetails(data);
});
});
});
};
@@ -109,26 +105,21 @@ const SearchResults = (props) => {
};
const deleteItem = (caseID, topThreeType) => {
let token = getToken();
let cookies = parseCookies();
topThreeType == "watchedCases" &&
deleteWatchedCases(caseID)
.then((data) => data)
.then(() => {
getWatchedCasesProxy(token, cookies.pinsUser).then(
(data) => {
setWatchedCases(data),
getDetails(token, data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
}
);
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
setWatchedCases(data),
getDetails(data, "myWatchedCases").then((data) => {
setWatchedCasesDetails(data);
});
});
});
};
const getDetails = (token, resultsObj, detailsType) => {
const getDetails = (resultsObj, detailsType) => {
//console.log(resultsObj);
let detailsArr = [];
resultsObj = resultsObj.value;
@@ -144,7 +135,6 @@ const SearchResults = (props) => {
} else {
detailsArr.push(
getPortalModuleDetailsProxy(
token,
getFormCollectionByID(
searchDetail.pinswg_appealcasetype
).LogicalCollectionName,
@@ -184,7 +174,7 @@ const SearchResults = (props) => {
<dd className="govuk-summary-list__key govuk-!-font-size-16">
{t("search:searchresults-status-label")}
</dd>
{myportal == "true" && (
{myportal == true && (
<dd className="govuk-summary-list__key govuk-!-font-size-16 govuk-summary-list__action"></dd>
)}
</div>
@@ -201,10 +191,10 @@ const SearchResults = (props) => {
<Link
href={
router.locale == "cy"
? myportal == "true"
? myportal == true
? "/fymhorth/achos"
: "/achos"
: myportal == "true"
: myportal == true
? "/myportal/case"
: "/case"
}
@@ -378,7 +368,7 @@ const SearchResults = (props) => {
"statuscode@OData.Community.Display.V1.FormattedValue"
] || "N/A"}
</dd>
{myportal == "true" && (
{myportal == true && (
<dd className="govuk-summary-list__value govuk-!-font-size-14 govuk-summary-list__action">
{isWatchedCase(item.incidentid).length >
0 ==
@@ -501,27 +491,34 @@ const SearchResults = (props) => {
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<h1 className="govuk-heading-xl govuk-!-margin-bottom-7">
{t("search:searchresults-title-label")}
{isLinkedCase
? t("search:searchresults-title-label-linked-case")
: t("search:searchresults-title-label")}
</h1>
<p className="govuk-body">
{resultsArr.length > 200
? t("search:searchresults-max-count-label")
: t("search:searchresults-count-label", {
count: searchResultsObj["@odata.count"],
})}
.
{advancedSearch != true ? (
<>
<span>
{t("search:searchresults-case-count-label")}{" "}
{" "}
<em>&quot;{searchString}&quot;</em>
</span>
</>
) : (
""
)}
</p>
{!isLinkedCase && (
<p className="govuk-body">
{resultsArr.length > 200
? t("search:searchresults-max-count-label")
: t("search:searchresults-count-label", {
count: searchResultsObj["@odata.count"],
})}
.
{advancedSearch != true ? (
<>
<span>
{t(
"search:searchresults-case-count-label"
)}{" "}
{" "}
<em>&quot;{searchString}&quot;</em>
</span>
</>
) : (
""
)}
</p>
)}
{resultsArr.length > 0 ? (
ResultsView(resultsArr)
) : (
+2
View File
@@ -13,6 +13,7 @@ export default function Search(props) {
advancedSearch,
myportal,
watchedCases,
isLinkedCase,
} = props;
let { t } = useTranslation();
@@ -48,6 +49,7 @@ export default function Search(props) {
}
myportal={myportal}
watchedCases={watchedCases}
isLinkedCase={isLinkedCase}
/>
</div>
</div>
+3 -2
View File
@@ -9,6 +9,7 @@ export default function ServiceBanner() {
<div className="servicebanner">
<h1>
<img
className="govuk-!-margin-top-4"
src={
router.locale == "cy"
? "/assets/images/planning-casework-cy.svg"
@@ -16,7 +17,7 @@ export default function ServiceBanner() {
}
alt="Planning casework"
/>
<img
{/* <img
className="pedw_logo"
src="/assets/images/pedw_logo.png"
alt={
@@ -24,7 +25,7 @@ export default function ServiceBanner() {
? "Penderfyniadau Cynllunio ac Amgylchedd Cymru"
: "Planning & Environment Decisions Wales"
}
/>
/> */}
</h1>
</div>
);
+29
View File
@@ -0,0 +1,29 @@
import React from "react";
import { useState, useEffect } from "react";
const TimeoutModal = (props) => {
const { showModal, handleStayLoggedIn, remainingCountdown } = props;
return (
<div className={showModal == false ? "modal fade" : "modal fade show"}>
<div backdrop="static" className="modal-dialog">
<div className="modal-content">
<h3>
Your session is about to expire in {remainingCountdown}{" "}
seconds due to inactivity. You will be redirected to the
login page.
</h3>
<button
className="govuk-button"
onClick={handleStayLoggedIn}
>
Stay Logged In
</button>
</div>
</div>
<div className="modal-backdrop fade show"></div>
</div>
);
};
export default TimeoutModal;
+2 -1
View File
@@ -1,8 +1,9 @@
import React, { Fragment } from "react";
export const Tracking = ({ googleTagManagerID }) => (
export const Tracking = ({ googleTagManagerID, nonce }) => (
<Fragment>
<script
nonce={nonce}
dangerouslySetInnerHTML={{
__html: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
+19 -3
View File
@@ -27,10 +27,9 @@ export const getFormCollectionByID = (appealTypeID) => {
/*
* Get the details of a case from the appeal type
* @param String token
* @param object searchResultsObj
*/
export const getSearchDetails = (token, searchResultsObj) => {
export const getSearchDetails = (searchResultsObj) => {
//console.log(searchResultsObj);
let detailsArr = [];
@@ -45,7 +44,6 @@ export const getSearchDetails = (token, searchResultsObj) => {
//console.log(formMeta);
detailsArr.push(
getBasicSearchDetails(
token,
formMeta.LogicalCollectionName,
searchDetail.title,
formMeta.PrimaryIdAttribute,
@@ -90,3 +88,21 @@ export const getSearchDetailsPaged = (searchResultsObj) => {
// console.log(detailsArr);
return Promise.all(detailsArr);
};
// export const absoluteUrl = (req, setLocalhost) => {
// var protocol = "https:";
// var host = req
// ? req.headers["x-forwarded-host"] || req.headers["host"]
// : window.location.host;
// if (host.indexOf("localhost") > -1) {
// if (setLocalhost) host = setLocalhost;
// protocol = "http:";
// }
// return {
// protocol: protocol,
// host: host,
// origin: protocol + "//" + host,
// };
// };
+39
View File
@@ -228,6 +228,23 @@
"value": "Planning permission granted",
"value_cy": "Rhoddwyd caniatâd cynllunio",
"pinswg_decision": 846040002
},
{
"value": "Approved with Conditions",
"value_cy": "Cymeradwywyd gydag Amodau",
"pinswg_decision": 846040002
}
],
"pinswg_recommendation": [
{
"value": "Approved with Conditions",
"value_cy": "Cymeradwywyd gydag Amodau",
"pinswg_recommendation": 846040002
},
{
"value": "Dismissed",
"value_cy": "Gwrthodwyd",
"pinswg_recommendation": 846040001
}
],
"pinswg_lpa": [
@@ -394,6 +411,28 @@
"pinswg_procedure": 0
}
],
"pinswg_choiceofprocedure": [
{
"value": "Written representations only with no hearing or inquiry session(s)",
"value_cy": "Sylwadau ysgrifenedig yn unig heb unrhyw sesiwn (sesiynau) gwrandawiad nac ymholiad",
"pinswg_choiceofprocedure": 0
},
{
"value": "Written representations with topic specific hearing session(s)",
"value_cy": "Sylwadau ysgrifenedig gyda sesiwn (sesiynau) gwrandawiad pwnc-benodol",
"pinswg_choiceofprocedure": 0
},
{
"value": "Written representations with topic specific inquiry session(s)",
"value_cy": "Sylwadau ysgrifenedig gyda sesiwn (sesiynau) ymholiad pwnc-benodol",
"pinswg_choiceofprocedure": 0
},
{
"value": "Written representations with topic specific hearing and inquiry session(s)",
"value_cy": "Sylwadau ysgrifenedig gyda sesiwn (sesiynau) gwrandawiad ac ymholi pwnc-benodol",
"pinswg_choiceofprocedure": 0
}
],
"pinswg_isharedocumentlocations": [
{
"value": "Main Party - Pre-Submission Docs",
+3 -2
View File
@@ -9,19 +9,20 @@ module.exports = {
},
],
"pages": {
"*": ["common", "newappeal"],
"*": ["common", "newappeal", "search"],
"/": ["common", "home"],
"/myportal": ["myportal"],
"/myportal/viewall": ["search"],
"/myportal/advancedsearch": ["search"],
"/myportal/searchresults": ["search"],
"/myportal/case": ["case"],
"/advancedsearch": ["search"],
"/advancedsearch": ["search", "myportal"],
"/advancedsearchresults": ["search"],
"/searchresults": ["search"],
"/viewall": ["search"],
"/case": ["case"],
"/myportal/representation": ["case"],
"/myportal/error": ["myportal", "common"],
"/newappeal": ["newappeal"],
"/newappeal/*": ["newappeal"],
"/newappeal/selectappeal": ["newappeal"],
+3 -1
View File
@@ -63,5 +63,7 @@
"summary-withdrawn-date": "Dyddiad tynnu'n ôl",
"summary-written-acceptance-of-notice": "Derbyniad ysgrifenedig o rybudd",
"summary-case-website-label": "Gwefan",
"summary-case-recommendation-label": "Argymhelliad"
"summary-case-recommendation-label": "Argymhelliad",
"summary-no-details-label": "Nid oes unrhyw fanylion ar gael ar hyn o bryd",
"summary-case-relevant-authoritylabel": "Awdurdod perthnasol"
}
+2 -2
View File
@@ -17,9 +17,9 @@
"search-button": "Chwilio",
"submit-and-start": "Cyflwyno a dechrau'r cwrs",
"footer-terms-conditions-link-label": "Telerau ac amodau",
"footer-terms-conditions-link": "/telerau-ac-amodau",
"footer-terms-conditions-link": "https://llyw.cymru/telerau-ac-amodau",
"footer-privacy-link-label": "Preifatrwydd",
"footer-privacy-link": "/preifatrwydd",
"footer-privacy-link": "https://llyw.cymru/gwaith-achos-cynllunio-hysbysiad-preifatrwydd",
"footer-cookies-link": "Cwcis",
"footer-accessibility-link-label": "Hygyrchedd",
"footer-accessibility-link": "/hygyrchedd",
+2
View File
@@ -3,6 +3,8 @@
"cookie-title-heading": "Cwcis ar cynllunio gwaith achos",
"cookie-not-saved-heading": "Nid yw eich dewisiadau cwcis wedi eu cadw eto",
"cookie-not-saved-paragraph": "Mae y gwasanaeth gwaith achos cynllunio yn gosod cwcis pan fyddwch yn ymweld â'n gwefan. Gallwch newid y gosodiadau hyn i'ch dewis chi. Mae angen i chi gadw'r dudalen hon gyda'ch dewisiadau newydd.",
"cookie-saved-heading": "Cafodd eich dewisiadau cwcis eu cadw",
"cookie-saved-paragraph": "Mae y gwasanaeth gwaith achos cynllunio yn gosod cwcis pan fyddwch yn ymweld â'n gwefan. Gallwch newid y gosodiadau hyn i'ch dewis chi.",
"cookie-intro-paragraph-1": "Ffeiliau sy'n cael eu cadw ar eich ffôn, tabled neu gyfrifiadur pan fyddwch yn ymweld â gwefan yw cwcis.",
"cookie-intro-paragraph-2": "Rydym yn defnyddio cwcis i storio gwybodaeth ynghylch sut yr ydych yn defnyddio gwefan y gwasanaeth gwaith achos cynllunio, megis y tudalennau yr ydych yn ymweld â nhw. Nid yw'r cwcis hyn yn cael eu defnyddio i'ch adnabod chi'n bersonol.",
"cookie-intro-paragraph-3": "Rydym yn defnyddio 4 cwci gwahanol. Gallwch ddewis pa fath o gwcis rydych yn hapus i ni eu defnyddio.",
+4 -1
View File
@@ -21,6 +21,7 @@
"login-card-register-link": "Gofrestru",
"login-card-forgotten-label": "Rwyf wedi anghofio fy nghyfrinair",
"login-card-forgotten-link": "Cliciwch yma",
"login-via-gov-gateway-label": "Mewngofnodi trwy Borth y Llywodraeth",
"casesearch-card-title": "Chwilio apeliadau a Datblygiadau o Arwyddocâd Cenedlaethol",
"casesearch-card-search-hint": "Defnyddiwch gyfeimod yr achos neu deitl DAC i chwilio. Bydd cyfeirnod yr achos yn debyg i un o'r canlynol:",
"casesearch-card-search-example-label-1": "APP-A12345-A-21-1234567",
@@ -37,5 +38,7 @@
"inspectorate-card-alt-text": "Yr Arolygiaeth Gynllunio",
"dns-card-title": "Gweld yr holl Ddatblygiadau o Arwyddocâd Cenedlaethol",
"dns-card-paragraph": "Mae Datblygiad o Arwyddocâd Cenedlaethol yn fath o gais cynllunio ar gyfer prosiect seilwaith mawr o bwysigrwydd cenedlaethol.",
"dns-card-button": "Gweld pob cais"
"dns-card-button": "Gweld pob cais",
"logging-in-heading": "Mewngofnodi",
"logging-in-paragraph": "Arhoswch os gwelwch yn dda..."
}
+1 -1
View File
@@ -30,5 +30,5 @@
"norecords-cases": "Nid oes gennych unrhyw achosion",
"norecords-representations": "Nid oes gennych unrhyw sylwadau",
"norecords-watched-cases": "Nid ydych yn gwylio unrhyw achosion",
"norecords-awaiting-submission": "Nid oes gennych unrhyw gyflwyniadau sy'n aros"
"norecords-awaiting-submissions": "Nid oes gennych unrhyw gyflwyniadau sy'n aros"
}
+1
View File
@@ -47,6 +47,7 @@
"clear-button-label": "Cliriwch",
"clear-all-button-label": "Clirio Pob Un",
"searchresults-title-label": "Chwilio am achos",
"searchresults-title-label-linked-case": "Achosion cysylltiedig",
"searchresults-count-label": "Cafodd eich chwiliad {{count}} o ganlyniadau",
"searchresults-max-count-label": "Dychwelodd eich chwiliad fwy na 200 o ganlyniadau. Mireiniwch eich chwiliad. Mae'r 200 achos diweddaraf yn cael eu harddangos",
"searchresults-case-reference-label": "Cyfeirnod yr Achos",
+3 -1
View File
@@ -63,5 +63,7 @@
"summary-withdrawn-date": "Withdrawn Date",
"summary-written-acceptance-of-notice": "Written Acceptance of Notice",
"summary-case-website-label": "Website",
"summary-case-recommendation-label": "Recommendation"
"summary-case-recommendation-label": "Recommendation",
"summary-no-details-label": "No details currently held",
"summary-case-relevant-authoritylabel": "Relevant authority"
}
+3 -3
View File
@@ -4,7 +4,7 @@
"gov-wales-link": "https://www.gov.wales",
"gov-wales-label": "GOV.WALES",
"service-description": "This service is being developed to support online appeals and applications.",
"service-name": "Casework",
"service-name": "Planning Casework",
"service-home-url": "https://planningcasework.service.gov.wales",
"service-name-breadcrumb": "Home",
"new-service-beta": "This is a new service",
@@ -17,9 +17,9 @@
"search-button": "Search",
"submit-and-start": "Submit and start course",
"footer-terms-conditions-link-label": "Terms and conditions",
"footer-terms-conditions-link": "/terms-and-conditions",
"footer-terms-conditions-link": "https://gov.wales/terms-and-conditions",
"footer-privacy-link-label": "Privacy",
"footer-privacy-link": "/privacy",
"footer-privacy-link": "https://gov.wales/planning-casework-privacy-notice",
"footer-cookies-link": "Cookies",
"footer-accessibility-link-label": "Accessibility",
"footer-accessibility-link": "/accessibility",
+2
View File
@@ -3,6 +3,8 @@
"cookie-title-heading": "Cookies on planning casework",
"cookie-not-saved-heading": "Your cookie settings have not yet been saved",
"cookie-not-saved-paragraph": "The planning casework service sets cookies when you visit our website. You can choose to change these settings to your own preferences. You need to save this page with your new choices.",
"cookie-saved-heading": "Your cookie settings were saved",
"cookie-saved-paragraph": "The planning casework service sets cookies when you visit our website. You can choose to change these settings to your own preferences.",
"cookie-intro-paragraph-1": "Cookies are files saved on your phone, tablet or computer when you visit a website.",
"cookie-intro-paragraph-2": "We use cookies to store information about how you use the the planning casework service website, such as the pages you visit. These cookies are not used to identify you personally.",
"cookie-intro-paragraph-3": "We use 4 types of cookie. You can choose which cookies you're happy for us to use.",
+4 -1
View File
@@ -21,6 +21,7 @@
"login-card-register-link": "Register",
"login-card-forgotten-label": "I have forgotten my password",
"login-card-forgotten-link": "Click here",
"login-via-gov-gateway-label": "Log in via Government Gateway",
"casesearch-card-title": "Search appeals and Developments of National Significance",
"casesearch-card-search-hint": "Use the case reference or DNS title to search. Case reference will be similar to one of the following:",
"casesearch-card-search-example-label-1": "APP-A12345-A-21-1234567",
@@ -37,5 +38,7 @@
"inspectorate-card-alt-text": "The Planning Inspectorate",
"dns-card-title": "View all Developments of National Significance ",
"dns-card-paragraph": "A Development of National Significance is a type of planning application for a large infrastructure project of national importance.",
"dns-card-button": "View all applications"
"dns-card-button": "View all applications",
"logging-in-heading": "Logging in",
"logging-in-paragraph": "Please wait..."
}
+1 -1
View File
@@ -30,5 +30,5 @@
"norecords-cases": "You have no cases",
"norecords-representations": "You have no representations",
"norecords-watched-cases": "You are not watching any cases",
"norecords-awaiting-submission": "You have no awaiting submissions"
"norecords-awaiting-submissions": "You have no awaiting submissions"
}
+1
View File
@@ -47,6 +47,7 @@
"clear-button-label": "Clear",
"clear-all-button-label": "Clear all",
"searchresults-title-label": "Search for a case",
"searchresults-title-label-linked-case": "Linked case",
"searchresults-count-label": "Your search returned {{count}} results",
"searchresults-max-count-label": "Your searched returned more than 200 results. Please refine your search. The most recent 200 cases are displayed",
"searchresults-case-reference-label": "Case reference",
+19 -3
View File
@@ -27,14 +27,30 @@ const securityHeaders = [
key: "X-Frame-Options",
value: "SAMEORIGIN",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "X-Permitted-Cross-Domain-Policies",
value: "none",
},
{
key: "Referrer-Policy",
value: "origin-when-cross-origin", //no-referrer
},
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
},
{
key: "Content-Security-Policy",
value: "frame-src 'self'; child-src 'self'",
key: "X-XSS-Protection",
value: "1; mode=block",
},
// {
// key: "Content-Security-Policy",
// value: "frame-src 'self'; child-src 'self';object-src 'none'; script-src 'self' 'https://www.googletagmanager.com' unsafe-inline",
// },
];
module.exports = {
@@ -42,7 +58,7 @@ module.exports = {
return [
{
// Apply these headers to all routes in your application.
source: "/(.*)",
source: "/(.*)?",
headers: securityHeaders,
},
];
+27 -25
View File
@@ -5,61 +5,63 @@
"scripts": {
"dev": "next dev",
"dev:app": "node ./server/server.js",
"build": "next build",
"start": "next start"
"build": "NODE_ENV=production node_modules/next/dist/bin/next build",
"start": "node_modules/next/dist/bin/next start"
},
"dependencies": {
"@webdeb/next-styles": "^1.1.1",
"applicationinsights": "^2.1.3",
"axios": "^0.21.1",
"applicationinsights": "^2.2.0",
"axios": "^0.24.0",
"compression": "^1.7.4",
"cookie-cutter": "^0.2.0",
"cookies": "^0.8.0",
"crypto-js": "^4.1.1",
"date-fns": "^2.25.0",
"date-fns": "^2.28.0",
"dom": "^0.0.3",
"dynamics-web-api": "^1.7.4",
"express": "^4.17.1",
"govuk-frontend": "^3.13.0",
"express": "^4.17.2",
"govuk-frontend": "3.13.0",
"https": "^1.0.0",
"hyco-https": "^1.4.5",
"jsonpath": "^1.1.1",
"jsonpath-plus": "^5.1.0",
"jsonpath-plus": "^6.0.1",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"next": "^11.0.1",
"next-redux-wrapper": "^7.0.2",
"next-translate": "^1.0.7",
"nanoid": "^3.2.0",
"next": "^12.0.8",
"next-redux-wrapper": "^7.0.5",
"next-translate": "^1.2.0",
"nextjs-basic-auth-middleware": "^0.2.1",
"nookies": "^2.5.2",
"path": "^0.12.7",
"pm2": "^5.1.0",
"pm2": "^5.1.2",
"react": "17.0.2",
"react-accessible-accordion": "^3.3.5",
"react-accessible-accordion": "^4.0.0",
"react-autosuggest": "^10.1.0",
"react-cookie-consent": "^6.2.4",
"react-datepicker": "^4.1.1",
"react-cookie-consent": "^7.2.1",
"react-datepicker": "^4.6.0",
"react-dom": "17.0.2",
"react-dropzone": "^11.3.4",
"react-dropzone": "^11.5.1",
"react-idle-timer": "^4.6.4",
"react-loading-overlay": "^1.0.1",
"react-redux": "^7.2.4",
"react-redux": "^7.2.6",
"react-xml-parser": "^1.1.8",
"redux-devtools-extension": "^2.13.9",
"redux-form": "^8.3.7",
"redux-form": "^8.3.8",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"redux-thunk": "^2.4.1",
"sass": "1.32",
"sass-loader": "^12.1.0",
"swr": "^0.5.6",
"webpack": "^5.40.0",
"sass-loader": "^12.4.0",
"swr": "^1.1.2",
"webpack": "^5.66.0",
"xml2js": "^0.4.23",
"xmldom": "^0.6.0",
"xmlhttprequest": "^1.8.0",
"xpath": "^0.0.32"
},
"devDependencies": {
"eslint": "^7.29.0",
"eslint-config-next": "^11.0.1",
"prettier": "2.3.2"
"eslint": "^8.6.0",
"eslint-config-next": "^12.0.8",
"prettier": "2.5.1"
}
}
+4 -5
View File
@@ -1,11 +1,10 @@
// 404.js
import Link from "next/link";
import Head from "next/head";
import Header from "../components/header";
import Banner from "../components/banner";
import CookieBanner from "../components/cookieBanner";
import useTranslation from "next-translate/useTranslation";
import Head from "next/head";
import Link from "next/link";
import CookieBanner from "../components/cookieBanner";
import Footer from "../components/footer";
import Header from "../components/header";
const FourOhFour = (props) => {
let { t, lang } = useTranslation();
+30 -5
View File
@@ -2,6 +2,7 @@ import Document, { Html, Head, Main, NextScript } from "next/document";
import SkipLink from "../components/skiplink";
import { Tracking, TrackingNoScript } from "../components/tracking";
import basicAuthMiddleware from "nextjs-basic-auth-middleware";
import { nanoid } from "nanoid";
class MyDocument extends Document {
static async getInitialProps(ctx) {
@@ -13,7 +14,7 @@ class MyDocument extends Document {
let hasBasicAuth =
typeof process.env.BASIC_AUTH_CREDENTIALS != "undefined";
console.log(hasBasicAuth);
console.log("hasbasicAuth:", hasBasicAuth);
if (ctx.req && ctx.res) {
hasBasicAuth &&
@@ -38,23 +39,47 @@ class MyDocument extends Document {
render() {
const googleTagManagerID = process.env.GOOGLE_TAG_MANAGER || null;
const { useGATracking } = this.props;
const generatedNonce = nanoid();
let csp = ``;
csp += `base-uri 'self';`;
csp += `form-action 'self';`;
csp += `object-src 'self' data:;`;
csp += `script-src 'self' https://www.googletagmanager.com 'nonce-${generatedNonce}' ${
process.env.NODE_ENV != "production" ? " 'unsafe-eval';" : " ;"
}`;
csp += `img-src 'self' https://www.googletagmanager.com https://gov.wales https://www.google-analytics.com 'nonce-${generatedNonce}' data:;`;
csp += `style-src 'self' https://fonts.googleapis.com 'unsafe-inline' data:;`;
return (
<Html lang="en">
<Head>
<meta httpEquiv="Content-Security-Policy" content={csp} />
{useGATracking && (
<Tracking googleTagManagerID={googleTagManagerID} />
<Tracking
googleTagManagerID={googleTagManagerID}
nonce={generatedNonce}
/>
)}
</Head>
<body className="js-enabled">
{useGATracking && (
<TrackingNoScript
nonce={generatedNonce}
googleTagManagerID={googleTagManagerID}
/>
)}
{!process.browser && (
<script>
window.switchDomain = `{process.env.I18N_DOMAIN}`
</script>
<>
<script nonce={generatedNonce}>
window.switchDomain = `{process.env.I18N_DOMAIN}
`
</script>
<script nonce={generatedNonce}>
window.apiRoot = `{process.env.API_ROOT}`
</script>
</>
)}
<SkipLink />
<Main />
+4 -5
View File
@@ -1,10 +1,9 @@
import Link from "next/link";
import Head from "next/head";
import Header from "../components/header";
import Banner from "../components/banner";
import CookieBanner from "../components/cookieBanner";
import useTranslation from "next-translate/useTranslation";
import Head from "next/head";
import Link from "next/link";
import CookieBanner from "../components/cookieBanner";
import Footer from "../components/footer";
import Header from "../components/header";
function Error({ statusCode }, props) {
let { t, lang } = useTranslation();
+7 -16
View File
@@ -1,26 +1,17 @@
import _ from "lodash";
import { useState, useEffect, useRef } from "react";
import useTranslation from "next-translate/useTranslation";
import Head from "next/head";
import { useRouter } from "next/router";
import AccessibilityStatement from "../components/accessibility";
import Breadcrumbs from "../components/breadcrumbs";
import CookieBanner from "../components/cookieBanner";
import Footer from "../components/footer";
import Header from "../components/header";
import ServiceBanner from "../components/servicebanner";
import CookieBanner from "../components/cookieBanner";
import Breadcrumbs from "../components/breadcrumbs";
import Main from "../components/main";
import Footer from "../components/footer";
import Errorpage from "../components/errorpage";
import styles from "../styles/Home.module.css";
import { useSelector, shallowEqual, connect } from "react-redux";
import { wrapper } from "../store/store";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { getIncidents } from "../actions";
import { parseCookies } from "nookies";
import AccessibilityStatement from "../components/accessibility";
const Accessibility = (props) => {
const { footerLinks, pages, showLogin } = props;
let { t, lang } = useTranslation();
ß;
const router = useRouter();
const { locale } = router;
+30 -12
View File
@@ -17,9 +17,10 @@ import jsonpath from "jsonpath";
import { reduxForm, formValueSelector } from "redux-form";
import RegisterForm from "../../components/account/registerform";
import { dehashString, hashAPIPath } from "../../actions";
const Home = (props) => {
const { footerLinks, formData } = props;
const { footerLinks, formData, loggedInUserEmail } = props;
let { t, lang } = useTranslation();
const router = useRouter();
@@ -97,6 +98,9 @@ const Home = (props) => {
setAccountCreatedComplete={
setAccountCreatedComplete
}
loggedInUserEmail={
loggedInUserEmail
}
/>
</div>
{registerFormComplete != true ||
@@ -151,17 +155,31 @@ const Home = (props) => {
);
};
// export const getServerSideProps = wrapper.getServerSideProps(
// (store) =>
// async ({ query, req, res }) => {
// const appealTypeData = await getAppealsTypes();
// const lpaData = await getLPA();
// console.log("appeal types", appealTypeData);
// console.log("lpa typeswwwww", lpaData);
// store.dispatch(setAppealType(appealTypeData));
// store.dispatch(setLPA(lpaData));
// }
// );
export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
// const appealTypeData = await getAppealsTypes();
// const lpaData = await getLPA();
// console.log("appeal types", appealTypeData);
// console.log("lpa typeswwwww", lpaData);
// store.dispatch(setAppealType(appealTypeData));
// store.dispatch(setLPA(lpaData));
let hasRegistrationEmail = typeof query.id != "undefined";
let loginEmailStr = "";
if (hasRegistrationEmail == true) {
loginEmailStr = dehashString(query.id);
console.log(loginEmailStr);
}
return {
props: {
loggedInUserEmail: loginEmailStr,
},
};
}
);
const mapStateToProps = (state) => {
return {
+13 -50
View File
@@ -1,36 +1,18 @@
import _ from "lodash";
import { useState } from "react";
import Head from "next/head";
import Header from "../components/header";
import Banner from "../components/banner";
import CookieBanner from "../components/cookieBanner";
import Breadcrumbs from "../components/breadcrumbs";
import Search from "../components/search";
import Footer from "../components/footer";
import Errorpage from "../components/errorpage";
import styles from "../styles/Home.module.css";
import { useSelector, shallowEqual, connect } from "react-redux";
import { wrapper } from "../store/store";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import Head from "next/head";
import { useRouter } from "next/router";
import { connect } from "react-redux";
import { getAppealsTypes, getLPA } from "../actions";
import Breadcrumbs from "../components/breadcrumbs";
import CookieBanner from "../components/cookieBanner";
import CRMError from "../components/crmError";
import {
setAppealType,
setAppealTypeTitle,
setAppealTypeID,
setAppealLPA,
getAppealTypeObj,
} from "../store/appealType/action";
import {
getAppealsTypes,
getLPA,
updateCase,
createCase,
getToken,
} from "../actions";
import Footer from "../components/footer";
import Header from "../components/header";
import Search from "../components/search";
import { setAppealType } from "../store/appealType/action";
import { setLPA } from "../store/lpa/action";
import { wrapper } from "../store/store";
const Home = (props) => {
const { footerLinks, pages } = props;
@@ -40,7 +22,6 @@ const Home = (props) => {
const { locale } = router;
const { appealtypes } = router.query;
//console.log(props, props.LPAData);
var hasError =
_.has(props.LPAData.LPAData, "errorCode") ||
_.has(props.appealType.appealType, "errorCode")
@@ -139,27 +120,9 @@ const Home = (props) => {
export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
let token = await getToken();
var tokenIssuedAt = new Date();
var tokenExpiryTimeAt = new Date();
tokenExpiryTimeAt.setSeconds(
tokenExpiryTimeAt.getSeconds() + token.expires_in
);
console.log(
"token issued:",
tokenIssuedAt.toUTCString(),
"\n",
"token expires:",
tokenExpiryTimeAt.toUTCString()
);
console.log(token);
token = token.access_token;
const [appealTypeData, lpaData] = await Promise.all([
await getAppealsTypes(token),
await getLPA(token),
await getAppealsTypes(),
await getLPA(),
]);
store.dispatch(setAppealType(appealTypeData));
+14 -28
View File
@@ -1,28 +1,20 @@
import _ from "lodash";
import Head from "next/head";
import Header from "../components/header";
import Banner from "../components/banner";
import CookieBanner from "../components/cookieBanner";
import Breadcrumbs from "../components/breadcrumbs";
import SearchResults from "../components/searchresults";
import Footer from "../components/footer";
import Errorpage from "../components/errorpage";
import styles from "../styles/Home.module.css";
import { useSelector, shallowEqual, connect } from "react-redux";
import { wrapper } from "../store/store";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import jsonpath from "jsonpath";
import data from "../data/collections.json";
import Head from "next/head";
import { useRouter } from "next/router";
import { connect } from "react-redux";
import { getAdvancedSearch } from "../actions";
import Breadcrumbs from "../components/breadcrumbs";
import CookieBanner from "../components/cookieBanner";
import Footer from "../components/footer";
import Header from "../components/header";
import SearchResults from "../components/searchresults";
import { getSearchDetails } from "../components/utils";
import { setSearch, getSearchObj } from "../store/search/action";
import { setSearch } from "../store/search/action";
import {
setSearchResults,
setSearchDetails,
getSearchResultsObj,
setSearchResults,
} from "../store/searchOutput/action";
import { getAdvancedSearch, getBasicSearchDetails, getToken } from "../actions";
import { wrapper } from "../store/store";
const Home = (props) => {
const { footerLinks, pages } = props;
@@ -123,14 +115,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
console.log("query-", query);
//console.log("search array:", Object.entries(query));
let token = await getToken();
token = token.access_token;
const searchResultsObj = await getAdvancedSearch(token, query);
const searchDetailsObj = await getSearchDetails(
token,
searchResultsObj
);
const searchResultsObj = await getAdvancedSearch(query);
const searchDetailsObj = await getSearchDetails(searchResultsObj);
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
+70
View File
@@ -0,0 +1,70 @@
import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken } from "../../../../actions";
const WORDKEY = process.env.HASHKEY;
const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
const tenantId = process.env.TENANT;
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
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 default async function ApiProxy(req, res) {
var token = await getToken();
var docRef = req.query;
console.log(docRef.id);
var queryUrl = "documents/download/" + docRef.id + "?hash=" + docRef.hash;
console.log(WEBAPI_URL + queryUrl);
return axios
.get(
WEBAPI_URL + queryUrl, // + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then((response) => {
console.log(response.headers);
res.status(200);
res.setHeader(
"Content-disposition",
"attachment; filename=" +
response.headers["content-disposition"].split(
"filename="
)[1]
);
res.end(response.data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
+49
View File
@@ -0,0 +1,49 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var token = await getToken();
var queryUrl = "contacts";
var data = JSON.stringify(req.body);
var config = {
method: "post",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
data: data,
};
return axios(config)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
+65
View File
@@ -0,0 +1,65 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var contactid = req.query.contactid;
var appealTypeId = req.query.appealTypeId;
var lpaID = req.query.lpaID;
var queryUrl = "incidents";
var token = await getToken();
var data = JSON.stringify({
"title": "insertion test case",
"caseorigincode": 3,
"customerid_contact@odata.bind": "/contacts(" + contactid + ")",
"pinswg_appealcasetype": appealTypeId,
"pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")",
});
var config = {
method: "post",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
data: data,
};
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: axios(config)
.then(({ data }) => {
console.log(data);
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
return apiResponse;
}
@@ -0,0 +1,49 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var token = await getToken();
var data = JSON.stringify(req.body);
var queryUrl = "pinswg_watchlists";
var config = {
method: "post",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
data: data,
};
return axios(config)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,49 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var myRepresentationsID = req.query.myRepresentationsID;
var token = await getToken();
var queryUrl = "pinswg_representationses(" + myRepresentationsID + ")";
var config = {
method: "delete",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
};
return axios(config)
.then(({ data }) => {
console.log("deleted ");
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,49 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var watchedCaseID = req.query.watchedCaseID;
var token = await getToken();
var queryUrl = "pinswg_watchlists(" + watchedCaseID + ")";
var config = {
method: "delete",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
};
return axios(config)
.then(({ data }) => {
//console.log("deleted watched case - " + watchedCaseID);
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,83 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var searchString = req.query.searchstring;
var token = await getToken();
searchString = _.isEmpty(searchString)
? searchString
: JSON.parse(decodeURI(searchString));
var queryString = "";
queryString +=
_.has(searchString, "q") && searchString.q != null
? "(contains(title, '" +
searchString.q +
"') or contains(ticketnumber,'" +
searchString.q +
"'))"
: "";
queryString +=
_.has(searchString, "lpa") && searchString.lpa != null
? (typeof searchString.q == "undefined" ? "" : " and ") +
"_pinswg_associatedlpa_value eq " +
searchString.lpa
: "";
queryString +=
_.has(searchString, "apt") && searchString.apt != null
? (typeof searchString.q == "undefined" &&
typeof searchString.lpa == "undefined"
? ""
: " and ") +
"pinswg_appealcasetype eq " +
searchString.apt
: "";
var queryUrl =
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" +
queryString +
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
var apiResponse = _.isEmpty(searchString)
? res.status(400).json()
: axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
return apiResponse;
}
@@ -0,0 +1,87 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var searchString = req.query.searchstring;
var pageNumber = req.query.pageNumber;
var token = await getToken();
searchString = _.isEmpty(searchString)
? searchString
: JSON.parse(decodeURI(searchString));
var queryString = "";
queryString +=
_.has(searchString, "q") && searchString.q != null
? "(contains(title, '" +
searchString.q +
"') or contains(ticketnumber,'" +
searchString.q +
"'))"
: "";
queryString +=
_.has(searchString, "lpa") && searchString.lpa != null
? (typeof searchString.q == "undefined" ? "" : " and ") +
"_pinswg_associatedlpa_value eq " +
searchString.lpa
: "";
queryString +=
_.has(searchString, "apt") && searchString.apt != null
? (typeof searchString.q == "undefined" &&
typeof searchString.lpa == "undefined"
? ""
: " and ") +
"pinswg_appealcasetype eq " +
searchString.apt
: "";
var queryUrl =
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" +
queryString +
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true" +
(typeof pageNumber != "undefined"
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
: "");
var apiResponse = _.isEmpty(searchString)
? res.status(400).json()
: axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
return apiResponse;
}
+45
View File
@@ -0,0 +1,45 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
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 caseReference = req.query.caseReference;
var updateFormCollection = req.query.updateFormCollection;
var primaryAttribute = req.query.primaryAttribute;
var token = await getToken();
const queryUrl =
updateFormCollection +
"?$count=true&$select=_" +
primaryAttribute +
"s_value&$filter=pinswg_name eq '" +
caseReference +
"'";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
+50
View File
@@ -0,0 +1,50 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
/**
* @swagger
* /api/endpoint/getappealtypes_api:
* get:
* description: Returns appeal types
* responses:
* 200:
* description:
*
*/
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var token = await getToken();
var queryUrl =
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,45 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeaders, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var token = await getToken();
var queryUrl =
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,53 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
import { getSelectQuery } from "../../../actions/selectQueryTypes";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var caseReference = req.query.caseReference;
var token = await getToken();
var queryUrl =
"pinswg_dnses?$filter=pinswg_name eq '" +
caseReference +
"'&$count=true";
queryUrl = queryUrl + getSelectQuery("pinswg_dnses");
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: typeof caseReference != "undefined" && caseReference.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
@@ -0,0 +1,57 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
import { getSelectQuery } from "../../../actions/selectQueryTypes";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var caseReference = req.query.caseReference;
var token = await getToken();
var queryUrl =
"pinswg_dnses?$filter=pinswg_name eq '" +
caseReference +
"'&$count=true";
queryUrl = queryUrl + getSelectQuery("pinswg_dnses");
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: typeof caseReference != "undefined" && caseReference.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
@@ -0,0 +1,49 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
//console.log(hashlink);
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var pageNumber = req.query.pageNumber;
var token = await getToken();
var queryUrl =
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true" +
(typeof pageNumber != "undefined"
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
: "");
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
+56
View File
@@ -0,0 +1,56 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var searchString = req.query.searchString;
var token = await getToken();
var queryUrl =
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
searchString +
"') or contains(ticketnumber, '" +
searchString +
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: searchString.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
@@ -0,0 +1,53 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
import { getSelectQuery } from "../../../actions/selectQueryTypes";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var appealTypeName = req.query.appealTypeName;
var primaryIdAttribute = req.query.primaryIdAttribute;
var incidentID = req.query.incidentID;
var token = await getToken();
var queryUrl =
appealTypeName +
"?$filter=_" +
primaryIdAttribute +
"s_value eq " +
incidentID +
"&$count=true";
queryUrl = queryUrl + getSelectQuery(appealTypeName);
console.log("query: ", queryUrl, "<<<<end query");
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,58 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
import { getSelectQuery } from "../../../actions/selectQueryTypes";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var appealTypeName = req.query.appealTypeName;
var primaryIdAttribute = req.query.primaryIdAttribute;
var incidentID = req.query.incidentID;
var token = await getToken();
var queryUrl =
appealTypeName +
"?$filter=_" +
primaryIdAttribute +
"s_value eq " +
incidentID +
"&$count=true";
queryUrl = queryUrl + getSelectQuery(appealTypeName);
console.log("query: ", queryUrl, "<<<<end query");
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,58 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
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 searchString = req.query.searchString;
var pageNumber = req.query.pageNumber;
var token = await getToken();
var queryUrl =
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
searchString +
"') or contains(ticketnumber, '" +
searchString +
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true" +
(typeof pageNumber != "undefined"
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
: "");
var apiResponse =
searchString.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] =
dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
@@ -0,0 +1,47 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeaders } from "../../../actions";
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";
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(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
+43
View File
@@ -0,0 +1,43 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var whichForm = req.query.whichForm;
var token = await getToken();
var queryUrl =
"systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode eq 'pinswg_" +
whichForm +
"' and type eq 2)&$count=true&$top=201";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
+43
View File
@@ -0,0 +1,43 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var parentIncidentid = req.query.parentincidentid;
var token = await getToken();
var queryUrl =
"incidents?$count=true&$filter=_parentcaseid_value eq " +
parentIncidentid +
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true &$select=title, incidentid";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
+55
View File
@@ -0,0 +1,55 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
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 pwd = req.query.pwd;
var token = await getToken();
var queryUrl =
"contacts?$filter=emailaddress1 eq '" +
emailAddress +
"' and pinswg_custom_password eq '" +
pwd +
"'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname";
console.log(_.isEmpty(req.query));
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: typeof emailAddress != "undefined" &&
emailAddress.length > 0 &&
typeof pwd != "undefined" &&
pwd.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
+40
View File
@@ -0,0 +1,40 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var token = await getToken();
var queryUrl =
"accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,43 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var whichForm = req.query.whichForm;
var token = await getToken();
var queryUrl =
"EntityDefinitions(LogicalName='pinswg_" +
whichForm +
"')/Attributes?$count=true&$select=LogicalName,RequiredLevel";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
+40
View File
@@ -0,0 +1,40 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
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 loggedInUserId = req.query.loggedInUserId;
var token = await getToken();
var queryUrl =
"incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
loggedInUserId +
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,40 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
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 loggedInUserId = req.query.loggedInUserId;
var token = await getToken();
var queryUrl =
"pinswg_representationses?$filter= _pinswg_contact_value eq " +
loggedInUserId +
"&$count=true&$orderby=createdon desc";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,40 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
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 loggedInUserId = req.query.loggedInUserId;
var token = await getToken();
var queryUrl =
"pinswg_representationses?$filter= _pinswg_contact_value eq " +
loggedInUserId +
"&$count=true&$orderby=createdon desc";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,45 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
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 contactid = req.query.contactid;
var token = await getToken();
var queryUrl =
"contacts(" +
contactid +
")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true";
var apiResponse =
contactid.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
+40
View File
@@ -0,0 +1,40 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
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 whichForm = req.query.whichForm;
var token = await getToken();
var queryUrl =
"EntityDefinitions(LogicalName='pinswg_" +
whichForm +
"')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,42 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
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 appealType = req.query.appealType;
var caseReference = req.query.caseReference;
var token = await getToken();
var queryUrl =
appealType +
"?$filter=pinswg_name eq '" +
caseReference +
"'&$count=true";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,42 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
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 appealType = req.query.appealType;
var caseReference = req.query.caseReference;
var token = await getToken();
var queryUrl =
appealType +
"?$filter=pinswg_name eq '" +
caseReference +
"'&$count=true";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,40 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
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 loggedInUserId = req.query.loggedInUserId;
var token = await getToken();
var queryUrl =
"pinswg_representationses?$filter= _pinswg_case_value eq " +
incidentID +
" and pinswg_publishtoweb eq true&$count=true&$orderby=createdon desc";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,40 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
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 incidentID = req.query.incidentID;
var token = await getToken();
var queryUrl =
"pinswg_representationses?$filter= _pinswg_case_value eq " +
incidentID +
"&$count=true&$orderby=createdon desc";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,67 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
const encryptDocReference = (documentRef) => {
var hashlink = CryptoJS.HmacSHA256(
"documents/download/" + documentRef,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
var hashStr =
"/api/documents/download/" + documentRef + "?hash=" + hashlink;
return hashStr;
};
export default async function ApiProxy(req, res) {
var incidentID = req.query.incidentid;
var token = await getToken();
var queryUrl =
"pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
incidentID +
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
data.value.forEach(function (element) {
element.pinswg_hashlink = encryptDocReference(
element.pinswg_isharedocumentreference
);
});
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,70 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
const encryptDocReference = (documentRef) => {
var hashlink = CryptoJS.HmacSHA256(
"documents/download/" + documentRef,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
var hashStr =
"/api/documents/download/" + documentRef + "?hash=" + hashlink;
return hashStr;
};
export default async function ApiProxy(req, res) {
var pageNumber = req.query.pageNumber;
var incidentID = req.query.incidentid;
var token = await getToken();
var queryUrl =
"pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
incidentID +
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference" +
(typeof pageNumber != "undefined"
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
: "");
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
data.value.forEach(function (element) {
element.pinswg_hashlink = encryptDocReference(
element.pinswg_isharedocumentreference
);
});
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,42 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var documentID = req.query.documentid;
var token = await getToken();
var queryUrl =
"pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
documentID;
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,47 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var documentID = req.query.documentid;
var pageNumber = req.query.pageNumber;
var token = await getToken();
var queryUrl =
"pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
documentID;
// +
// (typeof pageNumber != "undefined"
// ? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
// : "");
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,40 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
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 loggedInUserId = req.query.loggedInUserId;
var token = await getToken();
var queryUrl =
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
loggedInUserId +
"&$count=true&$orderby=createdon desc";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
+40
View File
@@ -0,0 +1,40 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
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 loggedInUserId = req.query.loggedInUserId;
var token = await getToken();
var queryUrl =
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
loggedInUserId +
"&$count=true&$orderby=createdon desc";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -0,0 +1,40 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { azureHeaders, getToken } from "../../../actions";
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 loggedInUserId = req.query.loggedInUserId;
var token = await getToken();
var queryUrl =
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
loggedInUserId +
"&$count=true&$orderby=createdon desc";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
+50
View File
@@ -0,0 +1,50 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var contactId = req.query.contactId;
var token = await getToken();
var data = JSON.stringify(req.body);
var queryUrl = "contacts(" + contactId + ")";
var config = {
method: "patch",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
data: data,
};
return axios(config)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
+52
View File
@@ -0,0 +1,52 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var data = JSON.stringify(req.body);
var appealObj = rea.query.appealObj;
var updateFormCollection = req.query.updateFormCollection;
var queryUrl = updateFormCollection + "(" + appealObj + ")";
var token = await getToken();
var config = {
method: "patch",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
data: data,
};
return axios(config)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}

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