-
-
-
- {t("common:cookie-banner-line-1")}
-
-
- -
- {" "}
- {t(
- "common:cookie-banner-list-item-1"
- )}
-
-
-
- {t("common:cookie-banner-line-2")}
-
-
- -
- {t(
- "common:cookie-banner-list-item-2"
- )}
-
- -
- {t(
- "common:cookie-banner-list-item-3"
- )}
-
-
+
+
+
+
+
+
+
+ {t(
+ "common:cookie-banner-line-1"
+ )}
+
+
+ -
+ {" "}
+ {t(
+ "common:cookie-banner-list-item-1"
+ )}
+
+
+
+ {t(
+ "common:cookie-banner-line-2"
+ )}
+
+
+ -
+ {t(
+ "common:cookie-banner-list-item-2"
+ )}
+
+ -
+ {t(
+ "common:cookie-banner-list-item-3"
+ )}
+
+
+
+
+
-
-
-
+
+ ) : (
+ ""
+ )}
+ >
);
};
diff --git a/components/cookiemanager/index.js b/components/cookiemanager/index.js
new file mode 100644
index 00000000..49b8e2f7
--- /dev/null
+++ b/components/cookiemanager/index.js
@@ -0,0 +1,455 @@
+import Link from "next/link";
+import { useRouter } from "next/router";
+import { useContext, useEffect, useState } from "react";
+import useTranslation from "next-translate/useTranslation";
+import { Field, reduxForm } from "redux-form";
+import { parseCookies, setCookie, destroyCookie } from "nookies";
+import { connect } from "react-redux";
+
+import cookie from "cookie-cutter";
+
+const CookieManagementMain = (props) => {
+ let { t } = useTranslation();
+
+ const router = useRouter();
+ const { locale } = router;
+
+ const { handleSubmit } = props;
+
+ const onHandleSubmit = (values) => {
+ Object.assign(values, {
+ "essential": "accepted",
+ "usage": usageState,
+ "communications": communicationsState,
+ "settings": settingsState,
+ });
+
+ let now = new Date();
+ let expDate = new Date(now);
+ expDate.setDate(now.getDate() + 365);
+
+ cookie.set("pinsCookiePolicy", JSON.stringify(values).toString(), {
+ expires: expDate,
+ });
+ cookie.set("planning_casework", true, {
+ expires: expDate,
+ });
+ };
+
+ let cookieCheck = parseCookies();
+
+ let cookieObj =
+ typeof cookieCheck.pinsCookiePolicy == "undefined"
+ ? {}
+ : JSON.parse(cookieCheck.pinsCookiePolicy);
+
+ const [usageState, setUsageState] = useState(
+ typeof cookieCheck.pinsCookiePolicy == "undefined"
+ ? null
+ : cookieObj.usage
+ );
+ const [communicationsState, setCommunicationsState] = useState(
+ typeof cookieCheck.pinsCookiePolicy == "undefined"
+ ? null
+ : cookieObj.communications
+ );
+ const [settingsState, setSettingsState] = useState(
+ typeof cookieCheck.pinsCookiePolicy == "undefined"
+ ? null
+ : cookieObj.settings
+ );
+
+ let updateObj = (key, value) => {
+ switch (key) {
+ case "usage":
+ setUsageState(value);
+ break;
+ case "communications":
+ setCommunicationsState(value);
+ break;
+ case "settings":
+ setSettingsState(value);
+ break;
+ default:
+ // code block
+ }
+ };
+
+ const CookieForm = () => {
+ return (
+
+
+
+
+ {t("cookies:cookie-title-heading")}
+
+
+ {typeof cookieCheck.pinsCookiePolicy == "undefined" ? (
+ <>
+
+
+ {t("cookies:cookie-not-saved-heading")}
+
+
+ {t(
+ "cookies:cookie-not-saved-paragraph"
+ )}
+
+
+ >
+ ) : (
+ ""
+ )}
+
+
+
+ {t("cookies:cookie-intro-paragraph-1")}
+
+
+ {t("cookies:cookie-intro-paragraph-2")}
+
+
+
+ {t("cookies:cookie-intro-paragraph-3")}
+
+
+
+
+
+
+ );
+ };
+
+ return (
+ <>
+
+ >
+ );
+};
+
+const mapStateToProps = (state) => {
+ return {
+ initialValues: {
+ usage: state.accountDetails.cookieObj.usage,
+ communications: state.accountDetails.cookieObj.communications,
+ settings: state.accountDetails.cookieObj.settings,
+ },
+ };
+};
+
+export default connect(mapStateToProps)(
+ reduxForm({
+ form: "CookieManagementForm",
+ enableReinitialize: true,
+ })(CookieManagementMain)
+);
diff --git a/components/footer.js b/components/footer.js
index dd26c902..4ebeaba0 100644
--- a/components/footer.js
+++ b/components/footer.js
@@ -175,15 +175,16 @@ export default function Footer(props) {
-
- {t("common:footer-cookies-link")}
-
+
+
+ {t(
+ "common:footer-cookies-link"
+ )}
+
+
diff --git a/components/homepage/login.js b/components/homepage/login.js
index 44b75db7..09c9b6a6 100644
--- a/components/homepage/login.js
+++ b/components/homepage/login.js
@@ -7,7 +7,6 @@ import { Field, reduxForm } from "redux-form";
import LoadingOverlay from "react-loading-overlay";
import { getLogin } from "../../actions";
import { setLoggedInUserId } from "../../store/accountDetails/action";
-import Cookies from "cookies";
const required = (errorMsg) => (value) =>
value || typeof value === "number" ? undefined : errorMsg;
diff --git a/components/main.js b/components/main.js
index 77401b4b..50a6c56f 100644
--- a/components/main.js
+++ b/components/main.js
@@ -28,8 +28,8 @@ export default function Home({ children, pages }) {
-
- {/* */}
+ {/*
+ */}