{"version":3,"sources":["loggedInContext.js","App.js","serviceWorker.js","store.js","aws-config.js","index.js"],"names":["loggedInContext","React","createContext","loading","className","DefaultLayout","lazy","Page404","Page500","App","loggedIn","setLoggedIn","useState","username","console","log","useEffect","async","userAuth","Auth","currentAuthenticatedUser","email","attributes","schoolName","reviewAuthenticatedUser","Provider","value","Suspense","fallback","exact","path","name","render","props","Boolean","window","location","hostname","match","initialState","sidebarShow","store","createStore","state","type","rest","awsconfig","aws_appsync_graphqlEndpoint","process","aws_appsync_region","aws_appsync_authenticationType","region","identityPoolRegion","userPoolId","userPoolWebClientId","identityPoolId","Storage","AWSS3","bucket","API","endpoints","endpoint","Amplify","configure","ReactDOM","document","getElementById","navigator","serviceWorker","ready","then","registration","unregister"],"mappings":"4KAAA,WAKA,MAAMA,EALN,OAKwBC,EAAMC,cAAc,MAE7BF,O,8lCCSf,MAAMG,EACJ,qBAAKC,UAAU,mBAAf,SACE,qBAAKA,UAAU,kCAKbC,EAAgBJ,IAAMK,MAAK,IAAM,gEAIjCC,EAAUN,IAAMK,MAAK,IAAM,wDAC3BE,EAAUP,IAAMK,MAAK,IAAM,wDA2DlBG,MAvDf,WAEE,MAAOC,EAAUC,GAAeC,mBAAS,CAAEC,UAAU,IAkBrD,OAjBAC,QAAQC,IAAI,SAAUL,GAEtBM,qBAAU,KACwBC,WAC9B,MAAMC,QAAiBC,IAAKC,2BAC5BN,QAAQC,IAAI,OAAQG,GAChBA,GACFP,EAAY,CACVE,SAAUK,EAASL,SACnBQ,MAAOH,EAASI,WAAWD,MAC3BE,WAAYL,EAASI,WAAW,wBAItCE,KACC,IAGD,cAACxB,EAAA,EAAgByB,SAAjB,CAA0BC,MAAO,CAAEhB,WAAUC,eAA7C,SACE,cAAC,IAAD,UACE,cAAC,IAAMgB,SAAP,CAAgBC,SAAUzB,EAA1B,SACE,eAAC,IAAD,WAqBE,cAAC,IAAD,CAAO0B,OAAK,EAACC,KAAK,OAAOC,KAAK,WAAWC,OAASC,GAAU,cAAC1B,EAAD,IAAa0B,MACzE,cAAC,IAAD,CAAOJ,OAAK,EAACC,KAAK,OAAOC,KAAK,WAAWC,OAASC,GAAU,cAACzB,EAAD,IAAayB,MACzE,cAAC,IAAD,CAAOH,KAAK,IAAIC,KAAK,OAAOC,OAASC,GAAU,cAAC5B,EAAD,IAAmB4B,gBCrE1DC,QACW,cAA7BC,OAAOC,SAASC,UAEe,UAA7BF,OAAOC,SAASC,UAEhBF,OAAOC,SAASC,SAASC,MAAM,2D,sBCbnC,MAAMC,EAAe,CACnBC,aAAa,GAYTC,EAAQC,aATM,WAA8C,IAA7CC,EAA4C,uDAApCJ,GAAc,KAAEK,KAASC,GAAW,uCAC/D,MACO,QADCD,EAEG,IAAKD,KAAUE,GAEfF,KAKEF,Q,SCgBAK,MAhCG,CAEhBC,4BAA4B,GAAD,OAAKC,kFAChCC,mBAAmB,GAAD,OAAKD,aACvBE,+BAAgC,4BAChC/B,KAAM,CAEJgC,OAAO,GAAD,OAAKH,aACXI,mBAAmB,GAAD,OAAKJ,aACvBK,WAAW,GAAD,OAAKL,uBACfM,oBAAoB,GAAD,OAAKN,8BACxBO,eAAe,GAAD,OAAKP,mDAErBQ,QAAS,CACPC,MAAO,CACLC,OAAO,GAAD,OAAKV,aACXG,OAAQ,YACRI,eAAe,GAAD,OAAKP,oDAGvBW,IAAK,CAEHC,UAAW,CACT,CACE7B,KAAM,aACN8B,SAAS,GAAD,OAAKb,gEACbG,OAAO,GAAD,OAAKH,iBCbnBc,IAAQC,UAAUjB,GAElBkB,IAAShC,OACP,cAAC,IAAD,CAAUS,MAAOA,EAAjB,SACE,cAAC,EAAD,MAEFwB,SAASC,eAAe,SHkGpB,kBAAmBC,WACrBA,UAAUC,cAAcC,MAAMC,MAAMC,IAClCA,EAAaC,kB","file":"static/js/main.78f95be0.chunk.js","sourcesContent":["import React from 'react'\n\n// create a context variable for use by child components\n// specifically this will pass down the login state to all components\n// the Login components sets the state and logout function clears it\nconst loggedInContext = React.createContext(null)\n\nexport default loggedInContext\n","import React, { useState, useEffect } from 'react'\nimport loggedInContext from './loggedInContext'\nimport { HashRouter, Route, Switch } from 'react-router-dom'\nimport './scss/style.scss'\nimport 'devextreme/dist/css/dx.dark.css'\nimport { Auth } from 'aws-amplify'\nimport 'devextreme/dist/css/dx.light.compact.css' //ref https://js.devexpress.com/Documentation/Guide/Themes_and_Styles/Predefined_Themes/\nimport './css/dx.generic.BP-brand-colours-v20-2-5.css'\n\n// To use react's \"context\" we need to create a context object,\n// Then wrap a suitable parent in a component,\n// which passes down the context value, and a function to allow children to update it\n// Child components then use the useContext() hook to access or change the context\n// In this app, the context vale is a loggenIn state variable whose value is\n// set in the login components, but can be read by any other component\n\nconst loading = (\n
\n
\n
\n)\n\n// Containers\nconst DefaultLayout = React.lazy(() => import('./layout/DefaultLayout'))\n\n// Pages\n//const Register = React.lazy(() => import('./views/pages/register/Register'))\nconst Page404 = React.lazy(() => import('./views/pages/page404/Page404'))\nconst Page500 = React.lazy(() => import('./views/pages/page500/Page500'))\n// const Marksbook2 = React.lazy(() => import('./components/marksbook/Marksbook2'))\n// const MarksbookPlay = React.lazy(() => import('./components/marksbook/MarksbookPlay'))\n\nfunction App() {\n // changed to a functional component to enable use of hooks (bc)\n const [loggedIn, setLoggedIn] = useState({ username: false }) // when logged in this will have a value like \"brendan\"\n console.log('in App', loggedIn)\n\n useEffect(() => {\n const reviewAuthenticatedUser = async () => {\n const userAuth = await Auth.currentAuthenticatedUser()\n console.log('data', userAuth)\n if (userAuth) {\n setLoggedIn({\n username: userAuth.username,\n email: userAuth.attributes.email,\n schoolName: userAuth.attributes['custom:schoolName'],\n })\n }\n }\n reviewAuthenticatedUser()\n }, [])\n\n return (\n \n \n \n \n {/* } /> */}\n {/* Uncomment if you want a Register form\n }\n /> */}\n {/* }\n />\n }\n /> */}\n } />\n } />\n } />\n \n \n \n \n )\n}\n\nexport default App\n","// In production, we register a service worker to serve assets from local cache.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on the \"N+1\" visit to a page, since previously\n// cached resources are updated in the background.\n\n// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.\n// This link also includes instructions on opting out of this behavior.\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(/^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/),\n)\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location)\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config)\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://goo.gl/SC7cgQ',\n )\n })\n } else {\n // Is not local host. Just register service worker\n registerValidSW(swUrl, config)\n }\n })\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then((registration) => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the old content will have been purged and\n // the fresh content will have been added to the cache.\n // It's the perfect time to display a \"New content is\n // available; please refresh.\" message in your web app.\n console.log('New content is available; please refresh.')\n\n // Execute callback\n if (config.onUpdate) {\n config.onUpdate(registration)\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.')\n\n // Execute callback\n if (config.onSuccess) {\n config.onSuccess(registration)\n }\n }\n }\n }\n }\n })\n .catch((error) => {\n console.error('Error during service worker registration:', error)\n })\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then((response) => {\n // Ensure service worker exists, and that we really are getting a JS file.\n if (\n response.status === 404 ||\n response.headers.get('content-type').indexOf('javascript') === -1\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then((registration) => {\n registration.unregister().then(() => {\n window.location.reload()\n })\n })\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config)\n }\n })\n .catch(() => {\n console.log('No internet connection found. App is running in offline mode.')\n })\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then((registration) => {\n registration.unregister()\n })\n }\n}\n","import { createStore } from 'redux'\n\nconst initialState = {\n sidebarShow: true,\n}\n\nconst changeState = (state = initialState, { type, ...rest }) => {\n switch (type) {\n case 'set':\n return { ...state, ...rest }\n default:\n return state\n }\n}\n\nconst store = createStore(changeState)\nexport default store\n","const awsconfig = {\n // added BC to enable access to Appsync for more complex update queries\n aws_appsync_graphqlEndpoint: `${process.env.REACT_APP_APPSYNC_API}`,\n aws_appsync_region: `${process.env.REACT_APP_REGION}`,\n aws_appsync_authenticationType: 'AMAZON_COGNITO_USER_POOLS',\n Auth: {\n //identityPoolId: `${process.env.REACT_APP_IDENTITY_POOL_ID}`,\n region: `${process.env.REACT_APP_REGION}`,\n identityPoolRegion: `${process.env.REACT_APP_REGION}`,\n userPoolId: `${process.env.REACT_APP_USER_POOL_ID}`,\n userPoolWebClientId: `${process.env.REACT_APP_USER_POOL_CLIENT_ID}`,\n identityPoolId: `${process.env.REACT_APP_IDENTITY_POOL_ID}`,\n },\n Storage: {\n AWSS3: {\n bucket: `${process.env.REACT_APP_UPLOADS_BUCKET}`, //REQUIRED - Amazon S3 bucket name\n region: 'eu-west-2', // there is only one bucket and its in the UK\n identityPoolId: `${process.env.REACT_APP_IDENTITY_POOL_ID}`,\n },\n },\n API: {\n // API added via CDK to enable access to the usetLoginsManager lambda in edsys\n endpoints: [\n {\n name: 'BPAdminAPI',\n endpoint: `${process.env.REACT_APP_BPADMIN_API}`,\n region: `${process.env.REACT_APP_REGION}`,\n },\n ],\n },\n}\n\nexport default awsconfig\n","import 'react-app-polyfill/stable'\nimport 'core-js'\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport App from './App'\nimport * as serviceWorker from './serviceWorker'\nimport { Provider } from 'react-redux'\nimport store from './store'\n\nimport { Amplify } from 'aws-amplify'\nimport awsconfig from './aws-config' // this is where we store the links to the APIs and Cognito\n\n//aws-config takes the place of \"aws-exports\" that Amplify CLI would generate\nAmplify.configure(awsconfig)\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root'),\n)\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: http://bit.ly/CRA-PWA\nserviceWorker.unregister()\n"],"sourceRoot":""}