{"version":3,"sources":["shared/helpers/Addhocs/index.js","services/Notification/index.js","services/Loading/index.js","app/services/Apollo/index.js","app/index.js","app/services/Auth/index.js","serviceWorker.js","index.js","app/services/Apollo/cache.js","services/Client/schemas/queries/user.js","services/Client/schemas/queries/client/index.js","services/Client/schemas/queries/course.js","services/Client/schemas/queries/slider.js","services/Client/schemas/queries/field.js","services/Client/schemas/queries/school.js","services/Client/schemas/queries/chapter.js","services/Client/schemas/queries/section.js","services/Client/schemas/queries/resource.js","services/Client/schemas/queries/collection.js","services/Client/schemas/queries/course_collections.js","services/Client/schemas/queries/course_field.js","services/Client/schemas/queries/course_tag.js","services/Client/schemas/queries/section_resources.js","services/Client/schemas/queries/instructor.js","services/Client/schemas/queries/index.js","app/services/Auth/auth-config.js","services/Client/schemas/mutations/file.js","services/Client/schemas/mutations/user.js","services/Client/schemas/mutations/course_collection.js","services/Client/schemas/mutations/collection.js","services/Client/schemas/mutations/index.js","services/Client/useQuery.js","services/Client/useQueryPaginated.js","services/Client/useMutation.js","services/Client/usePagination.js"],"names":["addHocs","component","hocs","result","forEach","hoc","Body","data","useQuery","event","type","get","message","opened","handleClose","notificationVar","__typename","React","useEffect","timer","setTimeout","clearTimeout","textColor","iconPath","className","fill","viewBox","fillRule","clipRule","d","onClick","Loading","style","background","size","color","errorLink","onError","graphQLErrors","networkError","forward","operation","map","extensions","locations","path","console","log","code","Apollo","App","useMsal","instance","inProgress","AsyncTokenLookup","a","getAllAccounts","accounts","account","acquireTokenSilent","loginSilentRequest","accessToken","InteractionRequiredAuthError","acquireTokenRedirect","loginRequest","withToken","setContext","_","headers","cache","new_token","Authorization","httpLink","createHttpLink","uri","process","client","ApolloClient","link","from","connectToDevTools","InMemoryCache","typePolicies","Query","fields","showLoginModal","read","showLoginModalVar","notification","page","pageVar","pageSize","pageSizeVar","apollo_token","apollo_token_var","ApolloProvider","Main","lazy","Notification","fallback","element","msalInstance","PublicClientApplication","msalConfig","Boolean","window","location","hostname","match","ReactDOM","render","document","getElementById","navigator","serviceWorker","ready","then","registration","unregister","catch","error","makeVar","schema","gql","NOTIFICATION","ALERT","UPLOADING","USER_ENABLED","FOLDER_OWNER","FILE_DOWNLOADS","SHOW_DOWNLOAD","SHARE_ID","SHARE_TYPE","SHOW_USER_SHARE_MODAL","SHOW_LOGIN_MODAL","TOKEN","IS_LOGGED_IN","uploading","alert","folderOwner","userEnabled","fileDownloads","showDownload","shareId","shareType","showUserShareModal","token","isLoggedIn","course_schema","field_schema","school_schema","course_tag_schema","instructor_schema","schemas","user","course","slider","field","school","section","chapter","resource","section_resources","collection","course_collections","course_field","course_tag","instructor","auth","clientId","authority","navigateToLoginRequestUrl","cacheLocation","storeAuthStateInCookie","scopes","prompt","CREATE","DELETE","file","course_collection","useQueryWrapper","variables","fetchPolicy","skip","rest","queries","loading","fetchMore","propTypes","PropTypes","string","isRequired","query","URLSearchParams","useLocation","search","pageIndex","parseInt","take","useMutationWrapper","update","onCompleted","useMutation","mutations","returnedData","updateData","queryEvent","writeQuery","mutate","func","usePagination","useState","setFetchPolicy","useApolloClient","changeFetchPolicy","useCallback","fp","newVisitedPages","isFetchNetwork","find","o","view","checkInVisited","push","addToVisited","writeData","paginatedViews","store","object"],"mappings":"kLAAaA,EAAU,SAACC,EAAWC,GACjC,IAAIC,EAASF,EAIb,OAHAC,EAAKE,SAAQ,SAACC,GACZF,EAASE,EAAIF,MAERA,G,yCC0GMG,EAxGF,WACX,IAAQC,EAASC,YAAS,CAAEC,MAAO,iBAA3BF,KACFG,EAAOC,IAAIJ,EAAM,oBAAqB,IACtCK,EAAUD,IAAIJ,EAAM,uBAAwB,IAC5CM,EAASF,IAAIJ,EAAM,sBAAuB,IAE1CO,EAAc,WAClBC,YAAgB,CACdH,QAAS,GACTF,KAAM,GACNG,QAAQ,EACRG,WAAY,kBAahB,GARAC,IAAMC,WAAU,WACd,GAAIL,EAAQ,CACV,IAAMM,EAAQC,YAAW,WACvBN,MACC,KACH,OAAO,kBAAMO,aAAaF,SAGzB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AMhF,GACvDiN,GACFD,EAAgBM,KAAK,CACnBF,KAAMpN,EACNgF,KAAMA,EACNzE,WAAY,mBAqBdgN,CAAaN,EAAgBD,EAAiBhI,EAAMhF,GAEpD6M,EADWI,EAAiB,eAAiB,eAE7C9I,EAAOqJ,UAAU,CAAE1N,KAAM,CAAE2N,eAAgBT,QAGtC,CAAEnC,eAGX4B,EAActB,UAAY,CACxBuC,MAAOtC,IAAUuC,OAAOrC,Y","file":"static/js/main.444415f9.chunk.js","sourcesContent":["export const addHocs = (component, hocs) => {\n let result = component;\n hocs.forEach((hoc) => {\n result = hoc(result);\n });\n return result;\n};\n\nexport default { addHocs };\n","import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport get from \"lodash/get\";\n\nimport { useQuery } from \"services/Client\";\nimport { notificationVar } from \"app/services/Apollo/cache\";\n\nconst Body = () => {\n const { data } = useQuery({ event: \"notification\" });\n const type = get(data, \"notification.type\", \"\");\n const message = get(data, \"notification.message\", \"\");\n const opened = get(data, \"notification.opened\", \"\");\n\n const handleClose = () => {\n notificationVar({\n message: \"\",\n type: \"\",\n opened: false,\n __typename: \"notification\",\n })\n return;\n };\n\n React.useEffect(() => {\n if (opened) {\n const timer = setTimeout(() => {\n handleClose();\n }, 5000);\n return () => clearTimeout(timer);\n }\n });\n if (!type || !message || !opened) return
;\n\n const textColor =\n type === \"success\"\n ? \"text-green-400\"\n : type === \"danger\"\n ? \"text-red-400\"\n : type === \"warning\"\n ? \"text-yellow-400\"\n : \"\";\n\n const iconPath =\n type === \"success\"\n ? \"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\"\n : type === \"danger\"\n ? \"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\"\n : type === \"warning\"\n ? \"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\"\n : \"\";\n\n return (\n
\n \n
\n
\n
\n
\n \n \n \n
\n
\n

\n {message}\n

\n {/*

\n Anyone with a link can now view this file.\n

*/}\n
\n
\n \n \n \n \n \n
\n
\n
\n
\n
\n
\n );\n};\nBody.propTypes = {\n store: PropTypes.object.isRequired,\n};\n\nexport default Body;\n","import React from \"react\";\nimport ClipLoader from \"react-spinners/BounceLoader\";\n\nexport default function Loading() {\n return (\n \n \n \n );\n}\n","import React, { useEffect, useState } from \"react\";\nimport get from \"lodash/get\";\nimport {\n ApolloClient,\n InMemoryCache,\n ApolloProvider,\n createHttpLink,\n from,\n gql,\n} from \"@apollo/client\";\nimport { setContext } from \"@apollo/client/link/context\";\nimport { onError } from \"@apollo/client/link/error\";\nimport { useMsal } from \"@azure/msal-react\";\n\nimport { InteractionRequiredAuthError } from \"@azure/msal-browser\";\nimport {\n loginRequest,\n loginSilentRequest,\n} from \"../../services/Auth/auth-config\";\nimport {\n showLoginModalVar,\n notificationVar,\n apollo_token_var,\n pageVar,\n pageSizeVar,\n} from \"./cache\";\n// const msalInstance = new PublicClientApplication(msalConfig);\n\n// const cache = new InMemoryCache();\n\nconst errorLink = onError(\n ({ graphQLErrors, networkError, forward, operation }) => {\n if (graphQLErrors) {\n graphQLErrors.map(\n ({ message, extensions, locations, path }) =>\n console.log(\n `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}, Extension: ${extensions.code}`\n )\n // forward(operation)\n );\n }\n\n if (networkError) {\n console.log(`[Network error]: ${networkError}`);\n // forward(operation);\n // window.location.reload();\n }\n forward(operation);\n }\n);\n\nconst Apollo = (App) =>\n function Apolloed() {\n const { instance, inProgress } = useMsal();\n\n const AsyncTokenLookup = async () => {\n const accounts = await instance.getAllAccounts();\n\n const account = get(accounts, \"[0]\");\n if (account && inProgress === \"none\") {\n try {\n const result = await instance.acquireTokenSilent({\n ...loginSilentRequest,\n account,\n });\n return result.accessToken;\n } catch (err) {\n if (err instanceof InteractionRequiredAuthError) {\n // fallback to interaction when silent call fails\n return instance.acquireTokenRedirect(loginRequest);\n }\n }\n }\n };\n const withToken = setContext(async (_, { headers, cache }) => {\n const new_token = await AsyncTokenLookup()\n return {\n headers: {\n ...headers,\n Authorization: new_token ? `Bearer ${new_token}` : null,\n },\n };\n });\n\n const httpLink = createHttpLink({\n uri: process.env.REACT_APP_BACKEND_URI,\n });\n\n const client = new ApolloClient({\n link: from([errorLink, withToken, httpLink]),\n connectToDevTools:true,\n cache: new InMemoryCache({\n typePolicies: {\n Query: {\n fields: {\n // course: {\n // keyArgs: [\"where\"],\n // merge(existing = [], incoming) {\n // return [...existing, ...incoming];\n // },\n // },\n showLoginModal: {\n read() {\n return showLoginModalVar();\n },\n },\n notification: {\n read() {\n return notificationVar();\n },\n },\n page: {\n read() {\n return pageVar();\n },\n },\n pageSize: {\n read() {\n return pageSizeVar();\n },\n },\n apollo_token: {\n read() {\n return apollo_token_var();\n },\n },\n },\n },\n },\n }),\n });\n\n // useEffect(() => {\n // if (!!accounts[0]) {\n // (async () => {\n // await client.resetStore(); //clear Apollo cache when user loggs off\n // })();\n // }\n // }, [accounts]); // eslint-disable-line react-hooks/exhaustive-deps\n\n return (\n \n \n \n );\n };\n\nexport default Apollo;\n","import React, { Fragment, Suspense, lazy } from \"react\";\n\nimport { addHocs } from \"shared/helpers/Addhocs\";\nimport Notification from \"services/Notification\";\nimport Loading from \"services/Loading\";\n\nimport Apollo from \"./services/Apollo\";\nimport Auth from \"./services/Auth\";\n\nimport { Routes, Route } from \"react-router\";\nimport { HashRouter as Router } from \"react-router-dom\";\n\nconst Main = lazy(() => import(\"layouts/Main\"));\n\nconst App = () => {\n return (\n \n \n {/* */}\n \n }>\n \n } />\n \n \n \n \n );\n};\nexport default addHocs(App, [Apollo, Auth]);\n","import React from \"react\";\nimport { MsalProvider } from \"@azure/msal-react\";\nimport { PublicClientApplication } from \"@azure/msal-browser\";\n\nimport { msalConfig } from \"./auth-config\";\n\nexport default function Auth(App) {\n return function AuthWrapper() {\n const msalInstance = new PublicClientApplication(msalConfig);\n return (\n \n \n \n );\n };\n}\n","// This optional code is used to register a service worker.\n// register() is not called by default.\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 subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\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.0/8 are considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\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.href);\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://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. 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 if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && 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 && 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 headers: { 'Service-Worker': 'script' }\n })\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.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(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready\n .then(registration => {\n registration.unregister();\n })\n .catch(error => {\n console.error(error.message);\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from 'app/index.js';\n// import * as Sentry from \"@sentry/react\";\n// import { Integrations } from \"@sentry/tracing\";\nimport \"./index.css\";\nimport * as serviceWorker from './serviceWorker';\n\n// Sentry.init({\n// dsn: \"https://c123c8c6e0ee4413ab8f59c7e31db6e0@o377703.ingest.sentry.io/5623343\",\n// integrations: [new Integrations.BrowserTracing()],\n \n// // We recommend adjusting this value in production, or using tracesSampler\n// // for finer control\n// tracesSampleRate: 1.0,\n// });\nReactDOM.render(, document.getElementById('root'));\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: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n","import { makeVar } from \"@apollo/client\";\nexport const showLoginModalVar = makeVar(false);\nexport const notificationVar = makeVar(null);\nexport const apollo_token_var = makeVar(\"\");\nexport const pageVar = makeVar(0);\nexport const pageSizeVar = makeVar(6);\n\n\nconst localVariables = { showLoginModalVar, notificationVar, apollo_token_var };\nexport default localVariables;\n","import gql from \"graphql-tag\";\n\nexport const USER = gql`\n query user($where: user_bool_exp) {\n user(where: $where) {\n id\n created_at\n updated_at\n email\n }\n }\n`;\n\n\nconst schema = {\n \"user.get.one\": USER,\n};\nexport default schema;\n","import gql from \"graphql-tag\";\n\nexport const DISPLAY_ALERT = gql`\n {\n displayAlert @client\n alertMessage @client\n variant @client\n }\n`;\n\nexport const NOTIFICATION = gql`\n {\n notification @client {\n type\n message\n opened\n }\n }\n`;\n\nexport const ALERT = gql`\n {\n alert @client {\n type\n message\n opened\n }\n }\n`;\n\nexport const UPLOADING = gql`\n {\n uploading @client\n }\n`;\n\nexport const USER_ENABLED = gql`\n {\n userEnabled @client\n }\n`;\n\nexport const FOLDER_OWNER = gql`\n {\n folderOwner @client\n }\n`;\n\nexport const FILE_DOWNLOADS = gql`\n {\n fileDownloads @client {\n id\n filename\n progress\n }\n }\n`;\n\nexport const SHOW_DOWNLOAD = gql`\n {\n showDownload @client\n }\n`;\n\nexport const SHARE_ID = gql`\n {\n shareId @client\n }\n`;\n\nexport const SHARE_TYPE = gql`\n {\n shareType @client\n }\n`;\nexport const SHOW_USER_SHARE_MODAL = gql`\n {\n showUserShareModal @client\n }\n`;\n\nexport const SHOW_LOGIN_MODAL = gql`\n {\n showLoginModal @client\n }\n`;\n\nexport const TOKEN = gql`\n {\n token @client\n }\n`;\n\nexport const IS_LOGGED_IN = gql`\n {\n isLoggedIn @client\n }\n`;\n\nexport const PAGE = gql`\n {\n page @client\n }\n`;\n\nexport const PAGESIZE = gql`\n {\n pageSize @client\n }\n`;\n\n\n\nconst schema = {\n page:PAGE,\n pageSize: PAGESIZE,\n notification: NOTIFICATION,\n uploading: UPLOADING,\n alert: ALERT,\n folderOwner: FOLDER_OWNER,\n userEnabled: USER_ENABLED,\n fileDownloads: FILE_DOWNLOADS,\n showDownload: SHOW_DOWNLOAD,\n shareId: SHARE_ID,\n shareType: SHARE_TYPE,\n showUserShareModal: SHOW_USER_SHARE_MODAL,\n token: TOKEN,\n isLoggedIn: IS_LOGGED_IN,\n showLoginModal: SHOW_LOGIN_MODAL,\n};\n\nexport default schema;\n","import gql from \"graphql-tag\";\n\nexport const COURSES = gql`\n query course($where: course_bool_exp, $offset: Int, $limit: Int) {\n course(where: $where, offset: $offset, limit: $limit) {\n id\n created_at\n updated_at\n name\n description\n views\n img\n field {\n name\n }\n school {\n id\n name\n }\n }\n }\n`;\nconst COURSE_BY_PK = gql`\n query course_by_pk($id: uuid!) {\n course_by_pk(id: $id) {\n id\n course_instructors {\n instructor {\n firstName\n lastName\n bio\n position\n profile_picture\n }\n }\n course_tags {\n tag {\n id\n name\n }\n }\n school {\n id\n name\n }\n description\n img\n name\n }\n }\n`;\nconst COURSE_AGGREGATE = gql`\n query course_aggregate {\n course_aggregate {\n aggregate {\n count\n }\n }\n }\n`;\n\nconst course_schema = {\n \"course.get.many\": COURSES,\n \"course.get.one\": COURSE_BY_PK,\n \"course.get.count\": COURSE_AGGREGATE\n};\nexport default course_schema;\n","import gql from \"graphql-tag\";\n\nexport const SLIDER_ITEMS = gql`\n query slider {\n slider {\n id\n created_at\n updated_at\n title\n body\n img\n link\n }\n }\n`;\n\nconst course_schema = {\n \"slider.get.many\": SLIDER_ITEMS,\n};\nexport default course_schema\n","import gql from \"graphql-tag\";\n\nexport const FIELDS = gql`\n query field {\n field {\n id\n created_at\n updated_at\n name\n }\n }\n`;\n\nconst field_schema = {\n \"field.get.many\": FIELDS,\n};\nexport default field_schema;\n","import gql from \"graphql-tag\";\n\nexport const SCHOOLS = gql`\n query school {\n school {\n id\n created_at\n updated_at\n name\n }\n }\n`;\n\nconst school_schema = {\n \"school.get.many\": SCHOOLS,\n};\nexport default school_schema;\n","import gql from \"graphql-tag\";\n\nexport const CHAPTER = gql`\n query chapter(\n $where: chapter_bool_exp\n $resource_order_by: [section_resources_order_by!]\n $limit: Int\n $offset: Int\n ) {\n chapter(\n where: $where\n order_by: { order: asc }\n limit: $limit\n offset: $offset\n ) {\n id\n created_at\n updated_at\n name\n order\n description\n course {\n id\n name\n }\n chapter_instructors {\n instructor {\n firstName\n id\n lastName\n position\n profile_picture\n }\n }\n sections(order_by: { order: asc }) {\n id\n name\n section_resources(order_by: { order: asc }) {\n label\n order\n resource {\n id\n path\n type\n }\n }\n }\n }\n }\n`;\nconst CHAPTER_BY_PK = gql`\n query chapter_by_pk($id: uuid!) {\n chapter_by_pk(id: $id) {\n id\n created_at\n updated_at\n name\n order\n description\n }\n }\n`;\n\nconst CHAPTER_AGGREGATE = gql`\n query chapter_aggregate($where: chapter_bool_exp!) {\n chapter_aggregate(where: $where) {\n aggregate {\n count\n }\n }\n }\n`;\n\nconst schema = {\n \"chapter.get.many\": CHAPTER,\n \"chapter.get.one\": CHAPTER_BY_PK,\n \"chapter.aggregate\": CHAPTER_AGGREGATE,\n};\nexport default schema;\n","import gql from \"graphql-tag\";\n\nexport const SECTION = gql`\n query section(\n $where: section_bool_exp\n $order_by: [section_order_by!]\n $limit: Int\n $offset: Int\n ) {\n section(\n where: $where\n order_by: $order_by\n limit: $limit\n offset: $offset\n ) {\n id\n created_at\n updated_at\n name\n order\n description\n section_resources {\n label\n resource {\n id\n path\n type\n }\n }\n }\n }\n`;\nconst SECTION_BY_PK = gql`\n query section_by_pk($id: uuid!) {\n section_by_pk(id: $id) {\n id\n created_at\n updated_at\n name\n order\n description\n section_resources {\n label\n resource {\n id\n path\n type\n }\n }\n }\n }\n`;\n\nconst course_schema = {\n \"section.get.many\": SECTION,\n \"section.get.one\": SECTION_BY_PK,\n};\nexport default course_schema;\n","import gql from \"graphql-tag\";\n\nexport const RESOURCE = gql`\n query resource(\n $where: resource_bool_exp\n $order_by: [resource_order_by!]\n $limit: Int\n $offset: Int\n ) {\n resource(\n where: $where\n order_by: $order_by\n limit: $limit\n offset: $offset\n ) {\n id\n path\n type\n }\n }\n`;\n\nconst course_schema = {\n \"resource.get.many\": RESOURCE,\n};\nexport default course_schema;\n","import gql from \"graphql-tag\";\n\nexport const COLLECTIONS = gql`\n query collection($where: collection_bool_exp) {\n collection(where: $where) {\n id\n created_at\n updated_at\n name\n }\n }\n`;\nconst COLLECTION_BY_PK = gql`\n query collection_by_pk($id: uuid!) {\n collection_by_pk(id: $id) {\n id\n created_at\n updated_at\n name\n }\n }\n`;\n\nconst course_schema = {\n \"collection.get.many\": COLLECTIONS,\n \"collection.get.one\": COLLECTION_BY_PK,\n};\nexport default course_schema;\n","import gql from \"graphql-tag\";\n\nexport const COURSE_COLLECTIONS = gql`\n query course_collection(\n $where: course_collection_bool_exp\n $order_by: [course_collection_order_by!]\n $limit: Int\n $offset: Int\n ) {\n course_collection(\n where: $where\n order_by: $order_by\n limit: $limit\n offset: $offset\n ) {\n id\n created_at\n updated_at\n course {\n id\n created_at\n updated_at\n name\n description\n views\n img\n field {\n name\n }\n school {\n id\n name\n }\n }\n collection {\n id\n name\n }\n }\n }\n`;\nconst COURSE_COLLECTIONS_BY_PK = gql`\n query course_collection_by_pk($id: uuid!) {\n course_collection_by_pk(id: $id) {\n id\n created_at\n updated_at\n order\n label\n course {\n id\n name\n }\n collection {\n id\n name\n }\n }\n }\n`;\n\nconst COURSE_COLLECTIONS_COUNT = gql`\n query course_collection_aggregate($where: course_collection_bool_exp) {\n course_collection_aggregate(where: $where) {\n aggregate {\n count\n }\n }\n }\n`;\n\nconst COURSE_COLLECTIONS_AGGREGATE = gql`\n query course_collection_aggregate($where: course_collection_bool_exp) {\n course_collection_aggregate(where: $where) {\n aggregate {\n count\n }\n nodes {\n collectionId\n collection {\n id\n name\n }\n }\n }\n }\n`;\n\nconst course_schema = {\n \"course.collections.get.many\": COURSE_COLLECTIONS,\n \"course.collections.get.one\": COURSE_COLLECTIONS_BY_PK,\n \"course.collections.count\": COURSE_COLLECTIONS_COUNT,\n \"course.collections.aggregate\": COURSE_COLLECTIONS_AGGREGATE,\n};\nexport default course_schema;\n","import gql from \"graphql-tag\";\n\nexport const COURSE_FIELD = gql`\n query course_field(\n $where: course_field_bool_exp\n $order_by: [course_field_order_by!]\n $limit: Int\n $offset: Int\n ) {\n course_field(\n where: $where\n order_by: $order_by\n limit: $limit\n offset: $offset\n ) {\n id\n created_at\n updated_at\n course {\n id\n created_at\n updated_at\n name\n description\n views\n img\n field {\n name\n }\n school {\n id\n name\n }\n }\n field {\n id\n name\n }\n }\n }\n`;\n\n\nconst course_schema = {\n \"course.field.get.many\": COURSE_FIELD,\n};\nexport default course_schema;\n","import gql from \"graphql-tag\";\n\nexport const COURSE_TAGS = gql`\n query course_tags($where: course_tags_bool_exp) {\n course_tags(where: $where) {\n course {\n id\n name\n }\n tag {\n name\n }\n }\n }\n`;\nconst course_tag_schema = {\n \"course.tag.get.many\": COURSE_TAGS,\n};\nexport default course_tag_schema;\n","import gql from \"graphql-tag\";\n\nexport const SECTION_RESOURCES = gql`\n query section_resources(\n $where: section_resources_bool_exp\n $order_by: [section_resources_order_by!]\n $limit: Int\n $offset: Int\n ) {\n section_resources(\n where: $where\n order_by: $order_by\n limit: $limit\n offset: $offset\n ) {\n id\n created_at\n updated_at\n order\n label\n resource {\n id\n path\n type\n }\n section {\n id\n name\n }\n }\n }\n`;\nconst SECTION_RESOURCES_BY_PK = gql`\n query section_resources_by_pk($id: uuid!) {\n section_resources_by_pk(id: $id) {\n id\n created_at\n updated_at\n order\n label\n resource {\n id\n path\n type\n }\n section {\n id\n name\n }\n }\n }\n`;\n\nconst course_schema = {\n \"section.resources.get.many\": SECTION_RESOURCES,\n \"section.resources.get.one\": SECTION_RESOURCES_BY_PK,\n};\nexport default course_schema;\n","import gql from \"graphql-tag\";\nexport const INSTRUCTORS = gql`\n query instructor($where: instructor_bool_exp, $offset: Int, $limit: Int) {\n instructor(where: $where, offset: $offset, limit: $limit) {\n id\n firstName\n lastName\n profile_picture\n bio\n instructor_courses {\n course {\n id\n name\n }\n }\n }\n }\n`;\nconst instructor_schema = {\n \"instructor.get.many\": INSTRUCTORS,\n};\nexport default instructor_schema;\n","import user from \"./user\";\nimport client from \"./client\";\nimport course from \"./course\";\nimport slider from \"./slider\";\nimport field from \"./field\";\nimport school from \"./school\";\nimport chapter from \"./chapter\";\nimport section from \"./section\";\nimport resource from \"./resource\";\nimport collection from \"./collection\";\nimport course_collections from \"./course_collections\";\nimport course_field from \"./course_field\";\nimport course_tag from \"./course_tag\";\nimport section_resources from \"./section_resources\";\nimport instructor from \"./instructor\";\nconst schemas = {\n ...user,\n ...client,\n ...course,\n ...slider,\n ...field,\n ...school,\n ...section,\n ...chapter,\n ...resource,\n ...section_resources,\n ...collection,\n ...course_collections,\n ...course_field,\n ...course_tag,\n ...instructor,\n};\nexport default schemas;\n","export const msalConfig = {\n auth: {\n clientId: \"2dd25b9c-b65f-47fd-8510-c34f30ff0827\",\n authority:\n \"https://login.microsoftonline.com/39626157-a047-4689-87a2-6fa645cb5cb7\",\n // redirectUri: \"http://localhost:3000/\",\n navigateToLoginRequestUrl: true,\n },\n cache: {\n cacheLocation: \"localStorage\", // This configures where your cache will be stored\n storeAuthStateInCookie: false, // Set this to \"true\" if you are having issues on IE11 or Edge\n },\n};\n\n// Add here scopes for id token to be used at MS Identity Platform endpoints.\nexport const loginRequest = {\n scopes: [\"2dd25b9c-b65f-47fd-8510-c34f30ff0827/user.read\"],\n prompt: \"select_account\",\n};\n\nexport const loginSilentRequest = {\n scopes: [\"2dd25b9c-b65f-47fd-8510-c34f30ff0827/user.read\"],\n};","import gql from \"graphql-tag\";\n\nexport const CREATE = gql`\n mutation insert_collection_one($object: collection_insert_input!) {\n insert_collection_one(object: $object) {\n id\n created_at\n updated_at\n name\n userId\n }\n }\n`;\n\nexport const DELETE = gql`\n mutation delete_collection_by_pk($id: uuid!) {\n delete_collection_by_pk(id: $id) {\n id\n created_at\n updated_at\n name\n userId\n }\n }\n`;\n\nexport const UPDATE = gql`\n mutation update_collection_by_pk(\n $pk_columns: collection_pk_columns_input!\n $_set: collection_set_input\n ) {\n update_chapter_by_pk(pk_columns: $pk_columns, _set: $_set) {\n id\n created_at\n updated_at\n name\n userId\n }\n }\n`;\n\nconst schema = {\n \"collection.create\": CREATE,\n \"collection.update\": UPDATE,\n \"collection.delete\": DELETE,\n};\nexport default schema;\n","import gql from \"graphql-tag\";\n\nexport const USER_UPDATE = gql`\n mutation updateUser($where: UserWhereInput, $data: UserWhereInput) {\n updateUser(where: $where, data: $data) {\n id\n email\n firstName\n lastName\n picture\n lastLogin\n confirmed\n }\n }\n`;\n\nexport const USER_CHANGE_PASSWORD = gql`\n mutation changePassword($where: UserWhereInput, $data: UserWhereInput) {\n changePassword(where: $where, data: $data) {\n id\n }\n }\n`;\n\nexport const USER_RESET_PASSWORD = gql`\n mutation resetPassword($where: UserWhereInput) {\n resetPassword(where: $where) {\n id\n }\n }\n`;\n\nexport const USER_CREATE_MANY = gql`\n mutation createUsers($data: [UserWhereInput], $groups: [GroupWhereInput]) {\n createUsers(data: $data, groups: $groups)\n }\n`;\n\nexport const USERS_FROM_FILE = gql`\n mutation usersFromFile($file: Upload!) {\n usersFromFile(file: $file) {\n email\n firstName\n lastName\n }\n }\n`;\n\nexport const INVALIDATE_TOKEN = gql`\n mutation invalidateToken {\n invalidateToken\n }\n`;\n\nexport default {\n \"user.update\": USER_UPDATE,\n \"user.change.password\": USER_CHANGE_PASSWORD,\n \"user.password.reset\": USER_RESET_PASSWORD,\n \"user.create.many\": USER_CREATE_MANY,\n \"users.from.file\": USERS_FROM_FILE,\n \"token.invalidate\": INVALIDATE_TOKEN,\n};\n","import gql from \"graphql-tag\";\n\nexport const INSERT_COURSE_COLLECTION_ONE = gql`\n mutation insert_course_collection_one(\n $object: course_collection_insert_input!\n ) {\n insert_course_collection_one(object: $object) {\n id\n created_at\n updated_at\n course {\n id\n name\n img\n school {\n name\n }\n }\n collection {\n id\n name\n }\n }\n }\n`;\n\nconst schema = {\n \"course.collection.create.one\": INSERT_COURSE_COLLECTION_ONE,\n};\nexport default schema;\n","import gql from \"graphql-tag\";\n\nexport const INSERT_COLLECTION_ONE = gql`\n mutation insert_collection_one($object: collection_insert_input!) {\n insert_collection_one(object: $object) {\n id\n created_at\n updated_at\n name\n }\n }\n`;\n\nconst schema = {\n \"collection.create.one\": INSERT_COLLECTION_ONE,\n};\nexport default schema;\n","import file from \"./file\";\nimport user from \"./user\";\nimport course_collection from \"./course_collection\";\nimport collection from \"./collection\";\n\nconst schema = {\n ...user,\n ...file,\n ...course_collection,\n ...collection\n};\n\nexport default schema\n","import PropTypes from \"prop-types\";\nimport { useQuery } from '@apollo/client';\n\nimport queries from \"./schemas/queries\";\n\nfunction useQueryWrapper({ event, variables, fetchPolicy, skip, ...rest }) {\n const { loading, error, data, fetchMore } = useQuery(queries[event], {\n variables,\n fetchPolicy,\n skip,\n ...rest\n });\n // if (loading) {\n // return \"\";\n // }\n if (error) return `Error, ${error.message}`;\n\n return { data, loading, fetchMore };\n}\n\nuseQueryWrapper.propTypes = {\n event: PropTypes.string.isRequired,\n};\n\nexport default useQueryWrapper;\n","import PropTypes from \"prop-types\";\nimport { useQuery } from '@apollo/client';\nimport { useLocation } from \"react-router-dom\";\n// import usePagination from \"./usePagination\";\nimport queries from \"./schemas/queries\";\n\nfunction useQueryWrapper({ event, variables, skip, fetchPolicy }) {\n function useQueryParams() {\n return new URLSearchParams(useLocation().search);\n }\n const query = useQueryParams();\n const pageIndex = parseInt(query.get(\"page\"));\n const pageSize = parseInt(query.get(\"pageSize\"));\n\n // const { fetchPolicy } = usePagination({ event, page: pageIndex });\n\n const { loading, error, data } = useQuery(queries[event], {\n variables: { ...variables, take: pageSize, skip: pageIndex * pageSize },\n fetchPolicy,\n skip,\n });\n\n if (error) return `Error, ${error.message}`;\n\n return { data, loading, pageSize };\n}\n\nuseQueryWrapper.propTypes = {\n event: PropTypes.string.isRequired,\n};\n\nexport default useQueryWrapper;\n","import PropTypes from \"prop-types\";\nimport { useMutation } from \"@apollo/client\";\nimport { notificationVar } from \"app/services/Apollo/cache\";\n\nimport mutations from \"./schemas/mutations\";\nimport queries from \"./schemas/queries\";\n\nfunction useMutationWrapper({\n event,\n update = () => null,\n onCompleted = () => null,\n}) {\n const [mutate] = useMutation(mutations[event], {\n update(cache, { data: returnedData }) {\n const updateData = update({ data: returnedData }, cache);\n if (!updateData) return;\n const { event: queryEvent, variables, data } = updateData;\n cache.writeQuery({\n query: queries[queryEvent],\n variables,\n data,\n });\n },\n onCompleted,\n onError({ graphQLErrors }) {\n notificationVar({\n message: graphQLErrors.map(\n ({ message, extensions, locations, path }) => extensions.code\n ),\n type: \"danger\",\n opened: true,\n __typename: \"notification\",\n });\n },\n });\n\n // if (loading) {\n // if (event === \"file.upload.one\") {\n // client.writeData({\n // data: {\n // uploading: true\n // }\n // });\n // }\n // }\n // if (error) return `Error, ${error.message}`;\n return { mutate };\n}\n\nuseMutationWrapper.propTypes = {\n event: PropTypes.string.isRequired,\n update: PropTypes.func,\n};\n\nexport default useMutationWrapper;\n","import { useState, useEffect, useCallback } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { get, find } from \"lodash\";\nimport { useApolloClient } from '@apollo/client';\n\nimport { useQuery } from \"services/Client\";\n\nfunction addToVisited(isFetchNetwork, newVisitedPages, page, event) {\n if (isFetchNetwork) {\n newVisitedPages.push({\n view: event,\n page: page,\n __typename: \"paginatedViews\",\n });\n }\n}\n\nfunction checkInVisited(newVisitedPages, page, event) {\n return !find(newVisitedPages, (o) => o.page === page && o.view === event);\n}\n\nfunction usePagination({ event, page }) {\n const [fetchPolicy, setFetchPolicy] = useState(\"network-only\");\n const { data } = useQuery({ event: \"paginatedViews\" });\n const client = useApolloClient();\n\n const changeFetchPolicy = useCallback((fp) => {\n setFetchPolicy(fp);\n }, []);\n\n useEffect(() => {\n const newVisitedPages = get(data, \"paginatedViews\", []);\n const isFetchNetwork = checkInVisited(newVisitedPages, page, event);\n addToVisited(isFetchNetwork, newVisitedPages, page, event);\n const fp = isFetchNetwork ? \"network-only\" : \"cache-first\";\n changeFetchPolicy(fp);\n client.writeData({ data: { paginatedViews: newVisitedPages } });\n });\n\n return { fetchPolicy };\n}\n\nusePagination.propTypes = {\n store: PropTypes.object.isRequired,\n};\n\nexport default usePagination;\n"],"sourceRoot":""}