diff --git a/.gitignore b/.gitignore
index 0b6d632..1ce182b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,4 +51,3 @@ coverage.xml
dist/
foris-*.tgz
styleguide/
-testUtils
diff --git a/package-lock.json b/package-lock.json
index dee20a9..e6be05b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4874,14 +4874,20 @@
}
},
"node_modules/caniuse-lite": {
- "version": "1.0.30001309",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001309.tgz",
- "integrity": "sha512-Pl8vfigmBXXq+/yUz1jUwULeq9xhMJznzdc/xwl4WclDAuebcTHVefpz8lE/bMI+UN7TOkSSe7B7RnZd6+dzjA==",
+ "version": "1.0.30001441",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001441.tgz",
+ "integrity": "sha512-OyxRR4Vof59I3yGWXws6i908EtGbMzVUi3ganaZQHmydk1iwDhRnvaPG2WaR0KcqrDFKrxVZHULT396LEPhXfg==",
"dev": true,
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/browserslist"
- }
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
+ }
+ ]
},
"node_modules/capture-exit": {
"version": "2.0.0",
@@ -22831,9 +22837,9 @@
"dev": true
},
"caniuse-lite": {
- "version": "1.0.30001309",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001309.tgz",
- "integrity": "sha512-Pl8vfigmBXXq+/yUz1jUwULeq9xhMJznzdc/xwl4WclDAuebcTHVefpz8lE/bMI+UN7TOkSSe7B7RnZd6+dzjA==",
+ "version": "1.0.30001441",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001441.tgz",
+ "integrity": "sha512-OyxRR4Vof59I3yGWXws6i908EtGbMzVUi3ganaZQHmydk1iwDhRnvaPG2WaR0KcqrDFKrxVZHULT396LEPhXfg==",
"dev": true
},
"capture-exit": {
diff --git a/src/common/RebootButton.js b/src/common/RebootButton.js
index fbd16a8..4dceb46 100644
--- a/src/common/RebootButton.js
+++ b/src/common/RebootButton.js
@@ -14,7 +14,7 @@ import { ForisURLs } from "../utils/forisUrls";
import { Button } from "../bootstrap/Button";
import { Modal, ModalHeader, ModalBody, ModalFooter } from "../bootstrap/Modal";
-import { useAlert } from "../alertContext/AlertContext";
+import { useAlert } from "../context/alertContext/AlertContext";
export function RebootButton(props) {
const [triggered, setTriggered] = useState(false);
diff --git a/src/common/WiFiSettings/ResetWiFiSettings.js b/src/common/WiFiSettings/ResetWiFiSettings.js
index 6973a5b..d52b52c 100644
--- a/src/common/WiFiSettings/ResetWiFiSettings.js
+++ b/src/common/WiFiSettings/ResetWiFiSettings.js
@@ -9,7 +9,7 @@ import React, { useEffect, useState } from "react";
import PropTypes from "prop-types";
import { Button } from "../../bootstrap/Button";
-import { useAlert } from "../../alertContext/AlertContext";
+import { useAlert } from "../../context/alertContext/AlertContext";
import { ALERT_TYPES } from "../../bootstrap/Alert";
import { useAPIPost } from "../../api/hooks";
import { API_STATE } from "../../api/utils";
diff --git a/src/alertContext/AlertContext.js b/src/context/alertContext/AlertContext.js
similarity index 93%
rename from src/alertContext/AlertContext.js
rename to src/context/alertContext/AlertContext.js
index bf01371..82f18de 100644
--- a/src/alertContext/AlertContext.js
+++ b/src/context/alertContext/AlertContext.js
@@ -8,8 +8,8 @@
import React, { useState, useContext, useCallback } from "react";
import PropTypes from "prop-types";
-import { Alert, ALERT_TYPES } from "../bootstrap/Alert";
-import { Portal } from "../utils/Portal";
+import { Alert, ALERT_TYPES } from "../../bootstrap/Alert";
+import { Portal } from "../../utils/Portal";
AlertContextProvider.propTypes = {
children: PropTypes.oneOfType([
diff --git a/src/alertContext/AlertContext.md b/src/context/alertContext/AlertContext.md
similarity index 100%
rename from src/alertContext/AlertContext.md
rename to src/context/alertContext/AlertContext.md
diff --git a/src/alertContext/__tests__/AlertContext.test.js b/src/context/alertContext/__tests__/AlertContext.test.js
similarity index 100%
rename from src/alertContext/__tests__/AlertContext.test.js
rename to src/context/alertContext/__tests__/AlertContext.test.js
diff --git a/src/alertContext/__tests__/__snapshots__/AlertContext.test.js.snap b/src/context/alertContext/__tests__/__snapshots__/AlertContext.test.js.snap
similarity index 100%
rename from src/alertContext/__tests__/__snapshots__/AlertContext.test.js.snap
rename to src/context/alertContext/__tests__/__snapshots__/AlertContext.test.js.snap
diff --git a/src/context/customizationContext/CustomizationContext.js b/src/context/customizationContext/CustomizationContext.js
new file mode 100644
index 0000000..9b7bc12
--- /dev/null
+++ b/src/context/customizationContext/CustomizationContext.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2019-2022 CZ.NIC z.s.p.o. (https://www.nic.cz/)
+ *
+ * This is free software, licensed under the GNU General Public License v3.
+ * See /LICENSE for more information.
+ */
+
+import React, { useContext, useEffect } from "react";
+import PropTypes from "prop-types";
+
+import { useAPIGet } from "../../api/hooks";
+import { ForisURLs } from "../../utils/forisUrls";
+
+import { Spinner } from "../../bootstrap/Spinner";
+
+CustomizationContextProvider.propTypes = {
+ children: PropTypes.oneOfType([
+ PropTypes.arrayOf(PropTypes.node),
+ PropTypes.node,
+ ]),
+};
+
+function CustomizationContextProvider({ children }) {
+ const { CustomizationContext } = window;
+ const [getCustomizationResponse, getCustomization] = useAPIGet(
+ ForisURLs.about
+ );
+
+ useEffect(() => {
+ getCustomization();
+ }, [getCustomization]);
+
+ if (getCustomizationResponse.state !== "success") {
+ return
{isCustomized ? CUSTOM : ORIGINAL}
; +}; + +describe("CustomizationContext", () => { + let componentContainer; + beforeEach(() => { + const { container } = render( ++ Description / component for original reForis (other devices) +
++ Description / component for customized reForis (Shield) +
+