{"version":3,"sources":["util/index.ts","components/NormalizedSkuContext/NormalizedSkuContext.tsx","components/NormalizedSkuContext/useNormalizeSku.hook.ts","components/Loading/Loading.tsx","../../../src/utils/index.ts","api.ts","../../../src/utils/HTMLTemplates.ts","components/hooks/useIsWindowSize.ts","components/Identity/contexts/UserPreferencesContext.tsx","images/logov2.png","components/NavBar/Logo.tsx","components/Product/hooks/useProducts.ts","types/index.ts","../../../src/utils/IconLib.ts","components/ErrorBoundary/MinimalAppHeader.js","components/WarningPrompt/WarningPrompt.tsx","onWindowSizeExceeded.ts","components/ContentProtector/restrictDevtoolsInspection.ts","components/ContentProtector/ContentProtector.tsx","components/Identity/hooks/useUserPreferences.ts","App.tsx","components/hooks/useReaderFileType.ts","components/ErrorBoundary/ErrorBoundary.tsx","components/ThemeProvider/ThemeProvider.tsx","components/AppValidator/Invalid.tsx","components/AppValidator/hooks/useAccessValidator.ts","components/AppValidator/AppValidator.tsx","components/AppValidator/hooks/useUrlValidation.ts","index.js"],"names":["doEnableContentProtection","process","removeTrailingSlash","uriComponent","replace","trim","getSearchParam","searchParamName","param","URLSearchParams","window","location","search","get","decodeURIComponent","viewInEdelweiss","sku","open","viewInCommunity","redirectToEdelweiss","a","redirect","delay","isValidUrl","href","match","hasValidSku","length","trackGainsightCustomEvent","eventName","properties","stringifiedProps","Object","keys","JSON","stringify","NormalizedSkuContext","createContext","useNormalizedSkuContext","useContext","useNormalizeSku","params","useParams","useState","isLoading","setIsLoading","normalizedSku","setNormalizedSku","useProducts","getProduct","productIsLoading","product","tenDigitSku","useEffect","isTen","isThirteen","Loading","doShowMessage","loadWithMessage","readerLoading","loadWithoutMessage","id","className","dangerouslySetInnerHTML","__html","DOMPurify","sanitize","api","ApiFetcher","commonApi","getUserPrefsEndpoint","preferenceName","fetchMainData","fetchEPubManifest","m","message","console","warn","fetchEPubPositions","fetchEPubWeights","fetchPDFMetaData","fetchReaderContent","contentUrl","fetch","fetchPDFDoesExist","pdf","fetchEPubDoesExist","epub","fetchDrcAdminWebReaderPreferences","endpoint","preferences","postSkuViewed","post","useIsWindowSize","width","useWindowWidth","isMobile","isTablet","UserPreferencesContext","useUserPreferencesContext","useStyles","makeStyles","theme","space","marginRight","spacing","Logo","classes","src","logo","alt","skus","products","setProducts","error","fetchProducts","find","p","ean","ReaderFileTypeEnum","PDFPaginationEnum","Browser","UserPreferenceTypeEnum","UserPreferenceNameEnum","InvalidErrorTypeEnum","GainsightIdEnum","title","path","MinimalAppHeader","AppBar","position","style","paddingTop","paddingBottom","textAlign","WarningPrompt","header","secondaryMessage","children","marginTop","WarningSharp","fontSize","color","marginBottom","cb","addEventListener","monitor","b","doesAgentMatch","Chrome","Firefox","Safari","Opera","Edge","Unknown","includes","scrollBarOffset","outerWidth","innerWidth","getChromiumZoomPercentage","monitorForChromiumBrowsers","monitorFallback","pattern","navigator","userAgent","restrictDevtoolsInspection","detector","DevtoolsDetector","checkers","elementIdChecker","regToStringChecker","functionToStringChecker","depRegToStringChecker","dateToStringChecker","performanceChecker","removeAnyIframes","iframes","document","getElementsByTagName","remove","addListener","clear","localStorage","sessionStorage","launch","startDevtoolsDetector","ContentProtector","didOpenPrint","setDidOpenPrint","didExceedWindowSizeLimit","setDidExceedWindowSizeLimit","evt","preventDefault","onWindowSizeExceeded","NoPrintingMessage","WindowSizeLimitExceededMessage","RefreshButton","Button","variant","onClick","reload","preferenceDtoFilters","type","PDFViewer","lazy","EPubReader","App","preferencesByType","setPreferencesByType","byType","fetchPreferences","getPreference","name","err","useUserPreferences","NONE","fileType","setFileType","EPUB","PDF","fetchReaderFileType","useReaderFileType","fallback","Provider","value","Reader","ErrorFallback","resetErrorBoundary","role","padding","ErrorBoundary","FallbackComponent","createMuiTheme","props","MuiTypography","lineHeight","palette","primary","main","contrastText","secondary","overrides","MuiDrawer","paper","background","textTransform","MuiAppBar","colorPrimary","backgroundColor","ThemeProvider","redirectToEplusLogin","returnUrl","currentPath","pathname","url","pos","encodeURIComponent","getReturnUrl","loginPath","Invalid","errorType","messages","MissingSku","InvalidUser","InvalidSkuProvided","InvalidAccessToSku","Link","fontWeight","target","rel","getErrorMessages","Unauthorized","fetchIsEntitledToManifest","response","status","Error","json","AppValidator","None","setErrorType","validate","isValid","useAccessValidator","isUrlValidating","setIsUrlValidating","current","nextUrl","useUrlValidation","AppContainer","MissingSkuError","SkuParamChecker","InvalidURLError","navigate","useNavigate","skuParam","ReactDOM","render","StrictMode","CssBaseline","element","getElementById"],"mappings":"wcAEaA,EAA4B,WACxC,OAAOC,GAGKC,EAAsB,SAACC,GACnC,OAAOA,EAAaC,QAAQ,MAAO,IAAIC,QAG3BC,EAAiB,SAACC,GAC9B,IACMC,EADc,IAAIC,gBAAgBC,OAAOC,SAASC,QACfC,IAAIN,GAC7C,OAAKC,EAGEM,mBAAmBZ,EAAoBM,IAFtC,MAKIO,EAAkB,SAACC,GAE/BN,OAAOO,KAAP,UADYhB,6BACZ,iBAA2Be,EAA3B,WAAyC,WAG7BE,EAAkB,SAACF,GAE/BN,OAAOO,KAAP,UADYhB,mCACZ,kBAA4Be,GAAO,WAG7B,SAAeG,IAAtB,+B,4CAAO,4BAAAC,EAAA,4DAC6BnB,8BAC7BoB,EAAW,WAChBX,OAAOO,KAF2BhB,6BAEM,YAHnC,SAMAqB,gBAAM,KANN,uBAQCA,gBAAM,KARP,OASLD,IATK,4D,sBAaA,IAAME,EAAa,WAEzB,OAA4B,OADhBb,OAAOC,SAASa,KACjBC,MAAM,QAGLC,EAAc,SAACV,GAG3B,MADgC,kBAARA,IADS,qBAARA,GAA+B,OAARA,KAEA,KAAfA,EAAIW,QAAgC,KAAfX,EAAIW,SAG9CC,EAA4B,SACxCC,GAEK,IADLC,EACI,uDADuD,GAE3D,GAAKpB,OAAM,UAAX,CACA,IAAMqB,EAC8B,IAAnCC,OAAOC,KAAKH,GAAYH,QAAgBO,KAAKC,UAAUL,GACxDpB,OAAM,UAAc,QAASmB,EAAWE,M,iJCrD5BK,EAAuBC,wBACnC,IAEYC,EAA0B,W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IAAD,OAAKE,IAEbzP,GAAa,KAGZ,IAECD,EACI,cAACY,EAAA,EAAD,IAGDkF,EArER6J,IAASC,OACR,cAAC,IAAMC,WAAP,UACC,cAAC,KAAD,UACC,cAAC,EAAD,UACC,eAACnE,EAAD,WACC,cAACoE,EAAA,EAAD,IACA,eAAC,KAAD,WACC,cAAC,KAAD,CAAO3K,KAAK,QAAQ4K,QAAS,cAACX,GAAD,MAC7B,cAAC,KAAD,CAAOjK,KAAK,IAAI4K,QAAS,cAACV,GAAD,MACzB,cAAC,KAAD,CAAOlK,KAAK,IAAI4K,QAAS,cAACR,GAAD,kBAM9BlH,SAAS2H,eAAe,W","file":"static/js/main.43cdfe3c.chunk.js","sourcesContent":["import { delay } from 'treeline-r2d2bc/utils';\r\n\r\nexport const doEnableContentProtection = (): boolean => {\r\n\treturn process.env.REACT_APP_ENABLE_CONTENT_PROTECTION === 'true';\r\n};\r\n\r\nexport const removeTrailingSlash = (uriComponent: string): string => {\r\n\treturn uriComponent.replace(/\\/$/, '').trim();\r\n};\r\n\r\nexport const getSearchParam = (searchParamName: string): string | null => {\r\n\tconst queryParams = new URLSearchParams(window.location.search);\r\n\tconst param: string | null = queryParams.get(searchParamName);\r\n\tif (!param) {\r\n\t\treturn null;\r\n\t}\r\n\treturn decodeURIComponent(removeTrailingSlash(param));\r\n};\r\n\r\nexport const viewInEdelweiss = (sku: string): void => {\r\n\tconst url = process.env.REACT_APP_EPLUS_URL;\r\n\twindow.open(`${url}/?sku=${sku}&g=4400`, '_blank');\r\n};\r\n\r\nexport const viewInCommunity = (sku: string): void => {\r\n\tconst url = process.env.REACT_APP_COMMUNITY_URL;\r\n\twindow.open(`${url}/title/${sku}`, '_blank');\r\n};\r\n\r\nexport async function redirectToEdelweiss() {\r\n\tconst inspectDetectedRedirectURL = process.env.REACT_APP_EPLUS_URL;\r\n\tconst redirect = () => {\r\n\t\twindow.open(inspectDetectedRedirectURL, '_top');\r\n\t};\r\n\tredirect();\r\n\tawait delay(1000);\r\n\twhile (true) {\r\n\t\tawait delay(500);\r\n\t\tredirect();\r\n\t}\r\n}\r\n\r\nexport const isValidUrl = () => {\r\n\tconst url = window.location.href;\r\n\treturn url.match(/\\/$/) === null;\r\n};\r\n\r\nexport const hasValidSku = (sku: string): boolean => {\r\n\tconst isDefined = typeof sku !== 'undefined' && sku !== null;\r\n\tconst isString = typeof sku === 'string';\r\n\treturn isString && isDefined && (sku.length === 10 || sku.length === 13);\r\n};\r\n\r\nexport const trackGainsightCustomEvent = (\r\n\teventName: string,\r\n\tproperties: { [key: string]: string | boolean | number } = {},\r\n) => {\r\n\tif (!window['aptrinsic']) return;\r\n\tconst stringifiedProps =\r\n\t\tObject.keys(properties).length !== 0 && JSON.stringify(properties);\r\n\twindow['aptrinsic']('track', eventName, stringifiedProps);\r\n};\r\n","import { createContext, useContext } from 'react';\r\n\r\ntype NormalizedSkuContextType = {\r\n\tsku: string;\r\n\thasValidSku: boolean;\r\n};\r\n\r\nexport const NormalizedSkuContext = createContext(\r\n\t{} as NormalizedSkuContextType,\r\n);\r\nexport const useNormalizedSkuContext = (): NormalizedSkuContextType => {\r\n\treturn useContext(NormalizedSkuContext);\r\n};\r\n","import { useEffect, useState } from 'react';\r\nimport { useParams } from 'react-router-dom';\r\nimport { ProductType } from '../../types';\r\nimport useProducts from '../Product/hooks/useProducts';\r\nimport { hasValidSku } from '../../util';\r\n\r\ntype UseNormalizeSkuType = {\r\n\tsku: string;\r\n\tisLoading: boolean;\r\n\tisTen: boolean;\r\n\tisThirteen: boolean;\r\n\tproduct: ProductType | undefined;\r\n\thasValidSku: boolean;\r\n};\r\n\r\nexport default function useNormalizeSku(): UseNormalizeSkuType {\r\n\tconst params = useParams();\r\n\tconst sku = params && params.sku ? params.sku : '';\r\n\tconst [isLoading, setIsLoading] = useState(true);\r\n\tconst [normalizedSku, setNormalizedSku] = useState(sku);\r\n\tconst { getProduct, isLoading: productIsLoading } = useProducts([sku]);\r\n\tconst product = getProduct(sku);\r\n\tconst tenDigitSku = product?.sku;\r\n\r\n\tuseEffect(() => {\r\n\t\tif (productIsLoading) return;\r\n\t\tif (tenDigitSku && tenDigitSku.length === 10) {\r\n\t\t\tsetNormalizedSku(tenDigitSku);\r\n\t\t}\r\n\t\tsetIsLoading(false);\r\n\t}, [tenDigitSku, productIsLoading]);\r\n\r\n\treturn {\r\n\t\tsku: normalizedSku,\r\n\t\tisLoading,\r\n\t\tisTen: normalizedSku.length === 10,\r\n\t\tisThirteen: normalizedSku.length === 13,\r\n\t\tproduct,\r\n\t\thasValidSku: hasValidSku(sku),\r\n\t};\r\n}\r\n","import DOMPurify from 'dompurify';\r\nimport { readerLoading } from 'treeline-r2d2bc/utils/HTMLTemplates';\r\n\r\ntype LoadingProps = {\r\n\tdoShowMessage?: boolean;\r\n};\r\n\r\nexport default function Loading({\r\n\tdoShowMessage = true,\r\n}: LoadingProps): JSX.Element {\r\n\tconst loadWithMessage = `\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t${readerLoading} \r\n\t\t\t\t

Pulling your book from the shelf...

\r\n\t\t\t
\r\n\t\t
\r\n\t`;\r\n\r\n\tconst loadWithoutMessage = `\r\n\t
\r\n\t\t
\r\n\t\t\t${readerLoading} \r\n\t\t\t

\r\n\t\t
\r\n\t
\r\n`;\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t{doShowMessage ? (\r\n\t\t\t\t\r\n\t\t\t) : (\r\n\t\t\t\t\r\n\t\t\t)}\r\n\t\t\r\n\t);\r\n}\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.IS_DEV = exports.delay = void 0;\r\n/**\r\n *\r\n * Timer function that you can 'await' on\r\n */\r\nfunction delay(t, v) {\r\n return new Promise(function (resolve) {\r\n setTimeout(resolve.bind(null, v), t);\r\n });\r\n}\r\nexports.delay = delay;\r\nexports.IS_DEV = process.env.NODE_ENV === \"development\" || process.env.NODE_ENV === \"dev\";\r\n//# sourceMappingURL=index.js.map","import ApiFetcher from '@bit/abovethetreeline.treelineui.api.api-fetcher';\r\nimport { PreferenceDto } from './types';\r\n\r\nconst api = new ApiFetcher(`${process.env.REACT_APP_URL}/`);\r\n\r\nconst commonApi = new ApiFetcher(\r\n\t`${process.env.REACT_APP_TREELINE_COMMON_API_URL}/`,\r\n);\r\n\r\nexport const getUserPrefsEndpoint = (\r\n\tsku: string,\r\n\tpreferenceName: string,\r\n): string => {\r\n\treturn `api/userprefs/${preferenceName}?sku=${sku}`;\r\n};\r\n\r\nexport const fetchMainData = (sku: string) => {\r\n\treturn api.get(getUserPrefsEndpoint(sku, 'maindata'));\r\n};\r\n\r\nexport const fetchEPubManifest = async (sku: string) => {\r\n\ttry {\r\n\t\treturn await api.get(`api/manifest/${sku}/${sku}`);\r\n\t} catch (err) {\r\n\t\tconst m = (err as Error).message;\r\n\t\tconsole.warn('Failed to fetch epub manifest', m);\r\n\t\treturn null;\r\n\t}\r\n};\r\n\r\nexport const fetchEPubPositions = async (sku: string) => {\r\n\ttry {\r\n\t\treturn await api.get(`api/manifest/${sku}/${sku}/positions`);\r\n\t} catch (err) {\r\n\t\tconst m = (err as Error).message;\r\n\t\tconsole.warn('Failed to fetch positions', m);\r\n\t\treturn null;\r\n\t}\r\n};\r\n\r\nexport const fetchEPubWeights = async (sku: string) => {\r\n\ttry {\r\n\t\treturn await api.get(`api/manifest/${sku}/${sku}/weights`);\r\n\t} catch (err) {\r\n\t\tconst m = (err as Error).message;\r\n\t\tconsole.warn('Failed to fetch weights', m);\r\n\t\treturn null;\r\n\t}\r\n};\r\n\r\nexport const fetchPDFMetaData = async (sku: string) => {\r\n\ttry {\r\n\t\treturn await api.get(`api/manifest/${sku}/${sku}/pdf-metadata`);\r\n\t} catch (err) {\r\n\t\tconst m = (err as Error).message;\r\n\t\tconsole.warn('Failed to fetch pdf metadata', m);\r\n\t\treturn null;\r\n\t}\r\n};\r\n\r\nexport const fetchReaderContent = async (contentUrl: string) => {\r\n\ttry {\r\n\t\treturn await fetch(`api/content/${contentUrl}`);\r\n\t} catch (err) {\r\n\t\tconst m = (err as Error).message;\r\n\t\tconsole.warn('Failed to fetch pdf fragment', m);\r\n\t\treturn null;\r\n\t}\r\n};\r\n\r\nexport const fetchPDFDoesExist = async (sku: string) => {\r\n\ttry {\r\n\t\tconst pdf = await fetchPDFMetaData(sku);\r\n\t\treturn pdf && pdf !== null;\r\n\t} catch (err) {\r\n\t\treturn false;\r\n\t}\r\n};\r\n\r\nexport const fetchEPubDoesExist = async (sku: string) => {\r\n\ttry {\r\n\t\tconst epub = await fetchEPubManifest(sku);\r\n\t\treturn epub && epub !== null;\r\n\t} catch (err) {\r\n\t\treturn false;\r\n\t}\r\n};\r\n\r\nexport const fetchDrcAdminWebReaderPreferences = async (\r\n\tsku: string,\r\n): Promise => {\r\n\ttry {\r\n\t\tconst endpoint = `api/galleys/reader/skus/${sku}/admin/settings`;\r\n\t\tconst preferences = await commonApi.get(endpoint);\r\n\t\treturn preferences;\r\n\t} catch (err) {\r\n\t\treturn [];\r\n\t}\r\n};\r\n\r\nexport const postSkuViewed = async (\r\n\tsku: string,\r\n) => {\r\n\ttry {\r\n\t await api.post(`api/content/${sku}/view`);\r\n\t} catch (err) {\r\n\t\tconst m = (err as Error).message;\r\n\t\tconsole.warn('Failed to log title view', m);\r\n\t\treturn null;\r\n\t}\r\n}\r\n\r\nexport default api;\r\n","\"use strict\";\r\n/*\r\n * Copyright 2018-2020 DITA (AM Consulting LLC)\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n *\r\n * Developed on behalf of: Bokbasen AS (https://www.bokbasen.no)\r\n * Licensed to: Bokbasen AS and CAST under one or more contributor license agreements.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.readerError = exports.readerLoading = exports.defaultUpLinkTemplate = exports.simpleUpLinkTemplate = void 0;\r\nconst IconLib = require(\"./IconLib\");\r\nconst simpleUpLinkTemplate = (href, _label, ariaLabel) => `\r\narrow_back_ios\r\n`;\r\nexports.simpleUpLinkTemplate = simpleUpLinkTemplate;\r\nconst defaultUpLinkTemplate = (href, label, ariaLabel) => `\r\n\r\n\r\n ${label}\r\n ${IconLib.icons.home}\r\n\r\n${label}\r\n\r\n`;\r\nexports.defaultUpLinkTemplate = defaultUpLinkTemplate;\r\nexports.readerLoading = `${IconLib.icons.loading}`;\r\nexports.readerError = `\r\n \r\n ${IconLib.icons.error}\r\n \r\n There was an error loading this page.\r\n \r\n \r\n`;\r\n//# sourceMappingURL=HTMLTemplates.js.map","import { useWindowWidth } from '@react-hook/window-size';\r\n\r\nexport type UseIsWindowSizeType = {\r\n\tisMobile: () => boolean;\r\n\tisTablet: () => boolean;\r\n};\r\n\r\nexport default function useIsWindowSize(): UseIsWindowSizeType {\r\n\tconst width: number = useWindowWidth();\r\n\treturn {\r\n\t\tisMobile: (): boolean => width < 650,\r\n\t\tisTablet: (): boolean => width < 900,\r\n\t};\r\n}\r\n","import { createContext, useContext } from 'react';\r\nimport { UseUserPreferencesType } from '../hooks/useUserPreferences';\r\n\r\nconst UserPreferencesContext = createContext(\r\n\t{} as UseUserPreferencesType,\r\n);\r\n\r\nexport const useUserPreferencesContext = () =>\r\n\tuseContext(UserPreferencesContext);\r\n\r\nexport default UserPreferencesContext;\r\n","export default __webpack_public_path__ + \"static/media/logov2.a98a112d.png\";","import logo from '../../images/logov2.png';\r\nimport { makeStyles } from '@material-ui/core/styles';\r\nimport useIsWindowSize from '../hooks/useIsWindowSize';\r\n\r\nconst useStyles = makeStyles(theme => ({\r\n\twidth: {\r\n\t\twidth: '135px',\r\n\t},\r\n\tspace: {\r\n\t\tmarginRight: theme.spacing(2),\r\n\t},\r\n}));\r\n\r\nexport default function Logo(): JSX.Element {\r\n\tconst classes = useStyles();\r\n\tconst { isMobile } = useIsWindowSize();\r\n\r\n\tconst getNames = (): string => {\r\n\t\tif (isMobile()) {\r\n\t\t\treturn classes.width;\r\n\t\t}\r\n\t\treturn `${classes.width} ${classes.space}`;\r\n\t};\r\n\r\n\treturn \"Edelweiss;\r\n}\r\n","import { useState, useEffect } from 'react';\r\nimport { ProductType } from '../../../types';\r\nimport ApiFetcher from '@bit/abovethetreeline.treelineui.api.api-fetcher';\r\n\r\nconst API_URL = process.env.REACT_APP_TREELINE_COMMON_API_URL;\r\nconst api = new ApiFetcher(`${API_URL}/`);\r\n\r\ntype UseProductsType = {\r\n\tisLoading: boolean;\r\n\tproducts: ProductType[];\r\n\tgetProduct: (sku: string) => ProductType | undefined;\r\n};\r\n\r\nexport default function useProducts(skus: string[]): UseProductsType {\r\n\tconst [isLoading, setIsLoading] = useState(true);\r\n\tconst [products, setProducts] = useState([]);\r\n\r\n\tuseEffect(() => {\r\n\t\tconst fetchProducts = async (): Promise => {\r\n\t\t\ttry {\r\n\t\t\t\tsetProducts(await api.post('api/products', skus));\r\n\t\t\t\tsetIsLoading(false);\r\n\t\t\t} catch (err) {\r\n\t\t\t\tconsole.error((err as Error).message);\r\n\t\t\t\tsetProducts([]);\r\n\t\t\t\tsetIsLoading(false);\r\n\t\t\t}\r\n\t\t};\r\n\t\tfetchProducts();\r\n\t\t//eslint-disable-next-line\r\n\t}, [skus.length]);\r\n\r\n\treturn {\r\n\t\tisLoading,\r\n\t\tproducts,\r\n\t\tgetProduct: (sku: string): ProductType | undefined => {\r\n\t\t\treturn products.find(p => p.sku === sku || p.ean === sku);\r\n\t\t},\r\n\t};\r\n}\r\n","export type SettingsType = {\r\n\tfontFamily: FontFamilyType;\r\n\tfontSize: number;\r\n\tlineHeight: number;\r\n\ttextFlow: TextFlowType;\r\n\tappearance: AppearanceType;\r\n};\r\n\r\nexport type TextFlowType = 'colAuto' | 'scroll' | 'colOne';\r\n\r\nexport type TextFlowProperties = {\r\n\tcolumnCount: string;\r\n\tverticalScroll: boolean;\r\n};\r\n\r\nexport type FontFamilyType =\r\n\t| 'Original'\r\n\t| 'serif'\r\n\t| 'sans-serif'\r\n\t| 'opendyslexic';\r\n\r\nexport type AppearanceType =\r\n\t| 'readium-default-on'\r\n\t| 'readium-night-on'\r\n\t| 'readium-sepia-on';\r\n\r\nexport type D2InitialSettingsType = {\r\n\tfontFamily: FontFamilyType;\r\n\tfontSize: number;\r\n\tlineHeight: number;\r\n\tcolumnCount: string;\r\n\tverticalScroll: boolean;\r\n\tappearance: AppearanceType;\r\n};\r\n\r\nexport enum ReaderFileTypeEnum {\r\n\tPDF,\r\n\tEPUB,\r\n\tNONE,\r\n}\r\n\r\nexport enum PDFPaginationEnum {\r\n\tSinglePage = 'singlePage',\r\n\tColAuto = 'colAuto',\r\n\tScrolling = 'scrolling',\r\n}\r\n\r\nexport type PDFMetaDataType = {\r\n\ttotalPagesCount: number;\r\n\ttotalPdfFragmentsCount: number;\r\n\tnumberOfPagesInFragment: number;\r\n\tdefaultPaginationType?: PDFPaginationEnum;\r\n};\r\n\r\nexport type ProductType = {\r\n\tsku: string;\r\n\tean: string;\r\n\tauthor: string;\r\n\tname: string;\r\n\tretailPrice: number;\r\n\tcategory: string;\r\n\tcategoryCode: string;\r\n\tsupplier: string;\r\n\tformatDescription: string;\r\n};\r\n\r\nexport enum Browser {\r\n\tEdge = 'Edge',\r\n\tChrome = 'Chrome',\r\n\tFirefox = 'Firefox',\r\n\tOpera = 'Opera',\r\n\tSafari = 'Safari',\r\n\tUnknown = 'Unknown',\r\n}\r\n\r\nexport type PDFReadPositionType = {\r\n\tpage: number;\r\n\tfragment: number;\r\n\tcreated?: string;\r\n\tpercentOfBookCompleted?: number;\r\n};\r\n\r\nexport enum UserPreferenceTypeEnum {\r\n\tLandingPage = 'landingPage',\r\n}\r\n\r\nexport enum UserPreferenceNameEnum {\r\n\tPreferred = 'preferred',\r\n}\r\n\r\nexport enum InvalidErrorTypeEnum {\r\n\tNone,\r\n\tInvalidUser,\r\n\tMissingSku,\r\n\tInvalidAccessToSku,\r\n\tInvalidSkuProvided,\r\n}\r\n\r\nexport type PreferenceDto = {\r\n\tname: string;\r\n\ttype: string;\r\n\tvalue: string;\r\n};\r\n\r\nexport type SaveReadPositionType = (\r\n\tposition: PDFReadPositionType,\r\n) => Promise;\r\n\r\nexport enum GainsightIdEnum {\r\n\tEpubColorTheme = 'colorTheme',\r\n\tEpubFontFace = 'fontFace',\r\n\tEpubHelp = 'epubHelpAndFeedback',\r\n\tEpubLineSpacing = 'lineSpacing',\r\n\tEpubOpenMainMenu = 'epubOpenMainMenu',\r\n\tEpubOpenSettings = 'epubOpenSettings',\r\n\tEpubSaveBookmark = 'epubSaveBookmark',\r\n\tEpubSavedBookmarks = 'epubSavedBookmarks',\r\n\tEpubTextFlow = 'textFlow',\r\n\tEpubTextSize = 'textSize',\r\n\tEpubTOC = 'epubTOC',\r\n\tHighlightToolbox = 'highlight-toolbox',\r\n\tMainDrawerViewInPreferred = 'mainDrawerViewInPreferredApp',\r\n\tNavBarViewInPreferred = 'navBarViewInPreferredApp',\r\n\tPdfGoToPage = 'pdfGoToPage',\r\n\tPdfHelp = 'pdfHelpAndFeedback',\r\n\tPdfOpenMainMenu = 'pdfOpenMainMenu',\r\n\tPdfOpenSettings = 'pdfOpenSettings',\r\n\tPdfPagination = 'pdfPagination',\r\n\tPdfZoom = 'pdfZoom',\r\n}\r\n\r\nexport type DimensionsType = {\r\n\twidth: number;\r\n\theight: number;\r\n};\r\n","\"use strict\";\r\n/*\r\n * Copyright 2018-2020 DITA (AM Consulting LLC)\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n *\r\n * Developed on behalf of: Bokbasen AS (https://www.bokbasen.no)\r\n * Licensed to: Bokbasen AS and CAST under one or more contributor license agreements.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.icons = exports.iconTemplateColored = exports.VIEWBOX_ATTR = exports.HEIGHT_ATTR = exports.WIDTH_ATTR = void 0;\r\nexports.WIDTH_ATTR = 24;\r\nexports.HEIGHT_ATTR = 24;\r\nexports.VIEWBOX_ATTR = `0 0 24 24`;\r\nconst iconTemplate = (id, title, path, classAttr = `icon`) => `\r\n ${title}\r\n ${path}\r\n`;\r\nconst iconTemplateColored = (id, title, path, classAttr = `icon`, size, fill) => `\r\n ${title}\r\n ${path}\r\n`;\r\nexports.iconTemplateColored = iconTemplateColored;\r\nexports.icons = {\r\n error: iconTemplate(`error-icon`, `Warning`, ``),\r\n home: ``,\r\n expand: iconTemplate(`expand-icon`, `Enter fullscreen`, ``, `icon active-icon`),\r\n loading: iconTemplate(`loading-icon`, `Loading`, ``),\r\n next: iconTemplate(`next-icon`, `Next Chapter`, ``),\r\n previous: iconTemplate(`previous-icon`, `Previous Chapter`, ``),\r\n settings: iconTemplate(`settings-icon`, `Settings`, ``, `icon open`),\r\n toc: iconTemplate(`toc-icon`, `Table of Contents`, ``, `icon open`),\r\n bookmarks: iconTemplate(`toc-icon`, `Bookmarks`, ``, `icon open`),\r\n bookmark: iconTemplate(`toc-icon`, `Bookmark`, ``, `icon open`),\r\n delete: iconTemplate(`delete-icon`, `Delete`, ``, `icon open`),\r\n close: iconTemplate(`close-icon`, `Close`, ``, `icon open`),\r\n text: iconTemplate(`text-icon`, `Text`, ``, `icon open`),\r\n speak: iconTemplate(`speak-icon`, `Speak`, ``, `icon open`),\r\n note: iconTemplate(`note-icon`, `Note`, ``, `icon open`),\r\n highlight: iconTemplate(`highlight-icon`, `Highlight`, ``, `icon open`),\r\n};\r\n//# sourceMappingURL=IconLib.js.map","import Logo from '../NavBar/Logo';\r\nimport { AppBar } from '@material-ui/core';\r\n\r\nexport default function MinimalAppHeader() {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n","import { WarningSharp } from '@material-ui/icons';\r\nimport MinimalAppHeader from '../ErrorBoundary/MinimalAppHeader';\r\n\r\ntype WarningPromptProps = {\r\n\theader: string | JSX.Element;\r\n\tsecondaryMessage?: string | JSX.Element;\r\n\tchildren?: JSX.Element;\r\n};\r\n\r\nfunction WarningPrompt({\r\n\theader,\r\n\tsecondaryMessage,\r\n\tchildren,\r\n}: WarningPromptProps) {\r\n\treturn (\r\n\t\t
\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t{header}\r\n\t\t\t\t
\r\n\t\t\t\t
{secondaryMessage}
\r\n\t\t\t\t{children}\r\n\t\t\t
\r\n\t\t\r\n\t);\r\n}\r\n\r\nexport default WarningPrompt;\r\n","import { delay } from 'treeline-r2d2bc/utils';\r\nimport { Browser } from './types';\r\n\r\nexport default async function onWindowSizeExceeded(\r\n\tcb: () => void,\r\n): Promise {\r\n\twindow.addEventListener('resize', () => monitor(cb), false);\r\n\tawait delay(1000);\r\n\tmonitor(cb);\r\n}\r\n\r\nfunction monitor(cb: () => void): void {\r\n\tif (isChromium(getBrowser())) {\r\n\t\tmonitorForChromiumBrowsers(cb);\r\n\t} else {\r\n\t\tmonitorFallback(cb);\r\n\t}\r\n}\r\n\r\nfunction getBrowser(): Browser {\r\n\tif (doesAgentMatch(/chrome|chromium|crios/i)) {\r\n\t\treturn Browser.Chrome;\r\n\t} else if (doesAgentMatch(/firefox|fxios/i)) {\r\n\t\treturn Browser.Firefox;\r\n\t} else if (doesAgentMatch(/safari/i)) {\r\n\t\treturn Browser.Safari;\r\n\t} else if (doesAgentMatch(/opr\\//i)) {\r\n\t\treturn Browser.Opera;\r\n\t} else if (doesAgentMatch(/edg/i)) {\r\n\t\treturn Browser.Edge;\r\n\t}\r\n\treturn Browser.Unknown;\r\n}\r\n\r\nfunction isChromium(b: Browser): boolean {\r\n\treturn [Browser.Chrome, Browser.Opera, Browser.Edge].includes(b);\r\n}\r\n\r\nfunction doesAgentMatch(pattern: RegExp): boolean {\r\n\treturn navigator.userAgent.match(pattern) !== null;\r\n}\r\n\r\nfunction monitorForChromiumBrowsers(cb: () => void): void {\r\n\tconst zoom = getChromiumZoomPercentage();\r\n\tif (zoom <= 75) {\r\n\t\tcb();\r\n\t}\r\n}\r\n\r\nfunction getChromiumZoomPercentage(): number {\r\n\tconst scrollBarOffset = 0;\r\n\treturn ((window.outerWidth - scrollBarOffset) / window.innerWidth) * 100;\r\n}\r\n\r\nfunction monitorFallback(cb: () => void) {\r\n\tif (window.innerWidth > 2400) {\r\n\t\tcb();\r\n\t}\r\n}\r\n","import { redirectToEdelweiss } from '../../util';\r\nimport { DevtoolsDetector, checkers } from 'devtools-detector';\r\n\r\nexport default function restrictDevtoolsInspection() {\r\n\tstartDevtoolsDetector();\r\n}\r\n\r\nfunction startDevtoolsDetector() {\r\n\tconst detector = new DevtoolsDetector({\r\n\t\tcheckers: [\r\n\t\t\tcheckers.elementIdChecker,\r\n\t\t\tcheckers.regToStringChecker,\r\n\t\t\tcheckers.functionToStringChecker,\r\n\t\t\tcheckers.depRegToStringChecker,\r\n\t\t\tcheckers.dateToStringChecker,\r\n\t\t\tcheckers.performanceChecker,\r\n\t\t],\r\n\t});\r\n\r\n\tdetector.addListener(() => {\r\n\t\tconsole.clear();\r\n\t\twindow.localStorage.clear();\r\n\t\twindow.sessionStorage.clear();\r\n\t\tredirectToEdelweiss();\r\n\t\tremoveAnyIframes();\r\n\t});\r\n\r\n\tdetector.launch();\r\n\r\n\tfunction removeAnyIframes() {\r\n\t\tconst iframes = document.getElementsByTagName('iframe');\r\n\t\tif (iframes[0]) {\r\n\t\t\tiframes[0].remove();\r\n\t\t}\r\n\t\tif (iframes[1]) {\r\n\t\t\tiframes[1].remove();\r\n\t\t}\r\n\t}\r\n}\r\n","import { useEffect, useState } from 'react';\r\nimport WarningPrompt from '../WarningPrompt';\r\nimport Button from '@material-ui/core/Button';\r\nimport onWindowSizeExceeded from '../../onWindowSizeExceeded';\r\nimport { doEnableContentProtection } from '../../util';\r\nimport restrictDevtoolsInspection from './restrictDevtoolsInspection';\r\n\r\ntype ContentProtectorProps = {\r\n\tchildren: JSX.Element;\r\n};\r\n\r\nexport default function ContentProtector({ children }: ContentProtectorProps) {\r\n\tconst [didOpenPrint, setDidOpenPrint] = useState(false);\r\n\tconst [didExceedWindowSizeLimit, setDidExceedWindowSizeLimit] =\r\n\t\tuseState(false);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (doEnableContentProtection()) {\r\n\t\t\trestrictDevtoolsInspection();\r\n\t\t}\r\n\r\n\t\tonPrintDialogOpened(() => {\r\n\t\t\tsetDidOpenPrint(true);\r\n\t\t});\r\n\r\n\t\tonWindowSizeExceeded(() => {\r\n\t\t\tsetDidExceedWindowSizeLimit(true);\r\n\t\t});\r\n\t}, []);\r\n\r\n\tif (didOpenPrint) {\r\n\t\treturn ;\r\n\t}\r\n\r\n\tif (didExceedWindowSizeLimit) {\r\n\t\treturn ;\r\n\t}\r\n\r\n\treturn children;\r\n}\r\n\r\nfunction onPrintDialogOpened(cb: () => void) {\r\n\twindow.addEventListener(\r\n\t\t'beforeprint',\r\n\t\tevt => {\r\n\t\t\tcb && cb();\r\n\t\t\tevt.preventDefault();\r\n\t\t},\r\n\t\tfalse,\r\n\t);\r\n}\r\n\r\nfunction NoPrintingMessage() {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nfunction WindowSizeLimitExceededMessage() {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nfunction RefreshButton() {\r\n\treturn (\r\n\t\t window.location.reload()}>\r\n\t\t\tRefresh\r\n\t\t\r\n\t);\r\n}\r\n","import { useEffect, useState } from 'react';\r\nimport ApiFetcher from '@bit/abovethetreeline.treelineui.api.api-fetcher';\r\nimport { UserPreferenceNameEnum, UserPreferenceTypeEnum } from '../../../types';\r\n\r\nconst API_URL = process.env.REACT_APP_TREELINE_COMMON_API_URL;\r\n\r\nconst api = new ApiFetcher(`${API_URL}/`);\r\n\r\ntype PreferenceDTOFilterType = {\r\n\ttype: UserPreferenceTypeEnum | string;\r\n\tname?: UserPreferenceNameEnum | string;\r\n};\r\n\r\nexport type UseUserPreferencesType = {\r\n\tisLoading: boolean;\r\n\tgetPreference: (\r\n\t\ttype: UserPreferenceTypeEnum,\r\n\t\tname: UserPreferenceNameEnum,\r\n\t) => string;\r\n};\r\n\r\nconst preferenceDtoFilters: PreferenceDTOFilterType[] = [\r\n\t{ type: 'LandingPage' },\r\n];\r\n\r\nconst endpoint = 'api/me/preferences?format=object';\r\n\r\nexport default function useUserPreferences(): UseUserPreferencesType {\r\n\tconst [isLoading, setIsLoading] = useState(true);\r\n\tconst [preferencesByType, setPreferencesByType] = useState({});\r\n\r\n\tuseEffect(() => {\r\n\t\tconst fetchPreferences = async () => {\r\n\t\t\ttry {\r\n\t\t\t\tconst byType = await api.post(endpoint, preferenceDtoFilters);\r\n\t\t\t\tif (typeof byType === 'object' && byType !== null) {\r\n\t\t\t\t\tsetPreferencesByType(byType);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tsetPreferencesByType({});\r\n\t\t\t\t}\r\n\t\t\t} catch (err) {\r\n\t\t\t\tconst message: string = (err as Error).message;\r\n\t\t\t\tconsole.error(message);\r\n\t\t\t\tsetPreferencesByType({});\r\n\t\t\t} finally {\r\n\t\t\t\tsetIsLoading(false);\r\n\t\t\t}\r\n\t\t};\r\n\t\tfetchPreferences();\r\n\t}, []);\r\n\r\n\treturn {\r\n\t\tisLoading,\r\n\t\tgetPreference: (\r\n\t\t\ttype: UserPreferenceTypeEnum,\r\n\t\t\tname: UserPreferenceNameEnum,\r\n\t\t): string => {\r\n\t\t\ttry {\r\n\t\t\t\tif (isLoading) return '';\r\n\t\t\t\tif (preferencesByType[type] && preferencesByType[type][name]) {\r\n\t\t\t\t\treturn preferencesByType[type][name];\r\n\t\t\t\t}\r\n\t\t\t\treturn '';\r\n\t\t\t} catch (err) {\r\n\t\t\t\tconsole.warn(`Failed to access preference at ${type}.${name}`);\r\n\t\t\t\tconsole.warn((err as Error).message);\r\n\t\t\t\treturn '';\r\n\t\t\t}\r\n\t\t},\r\n\t};\r\n}\r\n","import { lazy, Suspense } from 'react';\r\nimport Loading from './components/Loading';\r\nimport useReaderFileType from './components/hooks/useReaderFileType';\r\nimport { ReaderFileTypeEnum } from './types';\r\nimport ContentProtector from './components/ContentProtector';\r\nimport WarningPrompt from './components/WarningPrompt';\r\nimport useUserPreferences from './components/Identity/hooks/useUserPreferences';\r\nimport UserPreferencesContext from './components/Identity/contexts/UserPreferencesContext';\r\nimport { useNormalizedSkuContext } from './components/NormalizedSkuContext';\r\n\r\nconst PDFViewer = lazy(() => import('./components/PDFViewer'));\r\nconst EPubReader = lazy(() => import('./components/EPubReader'));\r\n\r\nexport default function App() {\r\n\tconst preferences = useUserPreferences();\r\n\tconst { sku } = useNormalizedSkuContext();\r\n\tconst { isLoading, fileType } = useReaderFileType(sku);\r\n\r\n\treturn (\r\n\t\t}>\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\ntype ReaderProps = {\r\n\tsku: string;\r\n\tisLoading: boolean;\r\n\tfileType: ReaderFileTypeEnum;\r\n};\r\n\r\nfunction Reader({ sku, isLoading, fileType }: ReaderProps) {\r\n\tif (isLoading) {\r\n\t\treturn ;\r\n\t}\r\n\tif (fileType === ReaderFileTypeEnum.EPUB) {\r\n\t\treturn ;\r\n\t}\r\n\tif (fileType === ReaderFileTypeEnum.PDF) {\r\n\t\treturn ;\r\n\t}\r\n\treturn (\r\n\t\t\r\n\t);\r\n}\r\n","import { useState, useEffect } from 'react';\r\nimport { ReaderFileTypeEnum } from '../../types';\r\nimport { fetchEPubDoesExist, fetchPDFDoesExist } from '../../api';\r\n\r\ntype UseReaderFileType = {\r\n\tisLoading: boolean;\r\n\tfileType: ReaderFileTypeEnum;\r\n};\r\n\r\nexport default function useReaderFileType(sku: string): UseReaderFileType {\r\n\tconst [isLoading, setIsLoading] = useState(true);\r\n\tconst [fileType, setFileType] = useState(\r\n\t\tReaderFileTypeEnum.NONE,\r\n\t);\r\n\r\n\tuseEffect(() => {\r\n\t\tconst fetchReaderFileType = async () => {\r\n\t\t\tif (await fetchEPubDoesExist(sku)) {\r\n\t\t\t\tsetFileType(ReaderFileTypeEnum.EPUB);\r\n\t\t\t} else if (await fetchPDFDoesExist(sku)) {\r\n\t\t\t\tsetFileType(ReaderFileTypeEnum.PDF);\r\n\t\t\t}\r\n\t\t\tsetIsLoading(false);\r\n\t\t};\r\n\t\tfetchReaderFileType();\r\n\t}, [sku]);\r\n\r\n\treturn { isLoading, fileType };\r\n}\r\n","import * as React from 'react';\r\nimport MinimalAppHeader from './MinimalAppHeader';\r\nimport { ErrorBoundary as EB } from 'react-error-boundary';\r\nimport Button from '@material-ui/core/Button';\r\n\r\ntype FallbackProps = {\r\n\terror: Error;\r\n\tresetErrorBoundary?: () => void;\r\n};\r\n\r\nfunction ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {\r\n\tconst alertStyle: React.CSSProperties = {\r\n\t\tpadding: '40px 150px',\r\n\t\ttextAlign: 'center',\r\n\t};\r\n\treturn (\r\n\t\t
\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\t

Something went wrong:

\r\n\t\t\t\t
\r\n\t\t\t\t\t{error.message}\r\n\t\t\t\t
\r\n\t\t\t\t{resetErrorBoundary && (\r\n\t\t\t\t\t\r\n\t\t\t\t)}\r\n\t\t\t
\r\n\t\t
\r\n\t);\r\n}\r\n\r\ntype ErrorBoundaryProps = {\r\n\tchildren: React.ReactNode;\r\n};\r\n\r\nexport default function ErrorBoundary({ children }: ErrorBoundaryProps) {\r\n\treturn {children};\r\n}\r\n","import { ThemeProvider as MuiThemeProvider } from '@material-ui/core/styles';\r\nimport { createMuiTheme } from '@material-ui/core/styles';\r\n\r\nconst theme = createMuiTheme({\r\n\tprops: {\r\n\t\tMuiTypography: {\r\n\t\t\tstyle: {\r\n\t\t\t\tlineHeight: '1',\r\n\t\t\t},\r\n\t\t},\r\n\t},\r\n\tpalette: {\r\n\t\tprimary: {\r\n\t\t\tmain: '#E6EAEB',\r\n\t\t\tcontrastText: '#A3A3A3',\r\n\t\t},\r\n\t\tsecondary: {\r\n\t\t\tmain: '#FFFFFF',\r\n\t\t},\r\n\t},\r\n\toverrides: {\r\n\t\tMuiDrawer: {\r\n\t\t\tpaper: {\r\n\t\t\t\tbackground: '#7C888C',\r\n\t\t\t\tcolor: '#FFFFFF',\r\n\t\t\t\ttextTransform: 'uppercase',\r\n\t\t\t},\r\n\t\t},\r\n\t\tMuiAppBar: {\r\n\t\t\tcolorPrimary: {\r\n\t\t\t\tbackgroundColor: '#332219',\r\n\t\t\t},\r\n\t\t},\r\n\t},\r\n});\r\n\r\nexport default function ThemeProvider({ children }: { children: JSX.Element }) {\r\n\treturn {children};\r\n}\r\n","import { useEffect } from 'react';\r\nimport { InvalidErrorTypeEnum } from '../../types';\r\nimport { getSearchParam } from '../../util';\r\nimport WarningPrompt from '../WarningPrompt';\r\nimport Link from '@material-ui/core/Link';\r\nimport { useNormalizedSkuContext } from '../NormalizedSkuContext';\r\n\r\ntype InvalidProps = {\r\n\terrorType: InvalidErrorTypeEnum;\r\n};\r\n\r\nconst getErrorMessages = (\r\n\terrorType: InvalidErrorTypeEnum,\r\n\tsku: string,\r\n): { header: string; secondary?: string | JSX.Element } => {\r\n\tswitch (errorType) {\r\n\t\tcase InvalidErrorTypeEnum.MissingSku:\r\n\t\t\treturn {\r\n\t\t\t\theader: 'Valid ISBN is required',\r\n\t\t\t\tsecondary:\r\n\t\t\t\t\t'You must append ?sku=isbn to the URL to access the review copy',\r\n\t\t\t};\r\n\t\tcase InvalidErrorTypeEnum.InvalidUser:\r\n\t\t\treturn {\r\n\t\t\t\theader: 'Redirecting to login...',\r\n\t\t\t};\r\n\t\tcase InvalidErrorTypeEnum.InvalidSkuProvided:\r\n\t\t\treturn {\r\n\t\t\t\theader: 'The ISBN is invalid',\r\n\t\t\t\tsecondary:\r\n\t\t\t\t\t'Please input a valid isbn in the URL to access a review copy',\r\n\t\t\t};\r\n\t\tdefault:\r\n\t\tcase InvalidErrorTypeEnum.InvalidAccessToSku:\r\n\t\t\treturn {\r\n\t\t\t\theader: 'Access Required',\r\n\t\t\t\tsecondary: (\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tYour Edelweiss account has not yet been granted\r\n\t\t\t\t\t\t\taccess to this review copy.{' '}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tPlease request access from the publisher here\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t.\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\tIf you feel like you have reached this page in\r\n\t\t\t\t\t\t\terror, please contact support at\r\n\t\t\t\t\t\t\tsupport@abovethetreeline.com\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t),\r\n\t\t\t};\r\n\t}\r\n};\r\n\r\nconst getReturnUrl = (): string => {\r\n\tconst currentPath = window.location.pathname;\r\n\tconst appURL = process.env.REACT_APP_URL as string;\r\n\tlet url = `${appURL}${currentPath}`;\r\n\tconst pos = getSearchParam('pos');\r\n\tif (pos) {\r\n\t\turl = `${url}?pos=${pos}`;\r\n\t}\r\n\treturn encodeURIComponent(url);\r\n};\r\n\r\nconst redirectToEplusLogin = () => {\r\n\tconst { REACT_APP_LOGIN_URL: baseUrl } = process.env;\r\n\tconst returnUrl: string = getReturnUrl();\r\n\tlet loginPath = `${baseUrl}/#Login&returnUrl=${returnUrl}`;\r\n\twindow.location.href = loginPath;\r\n};\r\n\r\nexport default function Invalid({ errorType }: InvalidProps) {\r\n\tconst { sku } = useNormalizedSkuContext();\r\n\tconst messages = getErrorMessages(errorType, sku);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (errorType === InvalidErrorTypeEnum.InvalidUser) {\r\n\t\t\tredirectToEplusLogin();\r\n\t\t}\r\n\t}, [errorType]);\r\n\r\n\treturn (\r\n\t\t
\r\n\t\t\t\r\n\t\t
\r\n\t);\r\n}\r\n","import { useState, useEffect } from 'react';\r\nimport { InvalidErrorTypeEnum } from '../../../types';\r\nimport { useNormalizedSkuContext } from '../../NormalizedSkuContext';\r\n\r\nexport type UseAccessValidatorType = {\r\n\tisValid: boolean;\r\n\tisLoading: boolean;\r\n\terrorType: InvalidErrorTypeEnum;\r\n};\r\n\r\nconst Unauthorized = 'Unauthorized';\r\n\r\nconst fetchIsEntitledToManifest = async (sku: string): Promise => {\r\n\tconst response = await fetch(`api/manifest/${sku}/${sku}/authorized`);\r\n\tif (response.status === 401) {\r\n\t\tthrow new Error(Unauthorized);\r\n\t}\r\n\treturn response.json();\r\n};\r\n\r\nexport default function useAccessValidator(): UseAccessValidatorType {\r\n\tconst [isLoading, setIsLoading] = useState(true);\r\n\tconst [errorType, setErrorType] = useState(\r\n\t\tInvalidErrorTypeEnum.None,\r\n\t);\r\n\tconst { sku } = useNormalizedSkuContext();\r\n\r\n\tconst validate = async (): Promise => {\r\n\t\ttry {\r\n\t\t\tif (!(await fetchIsEntitledToManifest(sku))) {\r\n\t\t\t\tsetErrorType(InvalidErrorTypeEnum.InvalidAccessToSku);\r\n\t\t\t}\r\n\t\t\tsetIsLoading(false);\r\n\t\t} catch (err) {\r\n\t\t\tif ((err as Error).message === Unauthorized) {\r\n\t\t\t\tsetErrorType(InvalidErrorTypeEnum.InvalidUser);\r\n\t\t\t\tsetIsLoading(false);\r\n\t\t\t} else {\r\n\t\t\t\tsetIsLoading(() => {\r\n\t\t\t\t\tthrow err;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tuseEffect(() => {\r\n\t\tvalidate();\r\n\t\t//eslint-disable-next-line\r\n\t}, []);\r\n\r\n\treturn {\r\n\t\tisLoading,\r\n\t\terrorType,\r\n\t\tisValid: errorType === InvalidErrorTypeEnum.None,\r\n\t};\r\n}\r\n","import Invalid from './Invalid';\r\nimport useAccessValidator from './hooks/useAccessValidator';\r\nimport Loading from '../Loading';\r\nimport { useUrlValidation } from './hooks/useUrlValidation';\r\nimport { InvalidErrorTypeEnum } from '../../types';\r\nimport { useNormalizedSkuContext } from '../NormalizedSkuContext';\r\n\r\ntype AppValidatorProps = {\r\n\tchildren: JSX.Element;\r\n};\r\n\r\nexport default function AppValidator({ children }: AppValidatorProps) {\r\n\tconst { isLoading, errorType } = useAccessValidator();\r\n\tconst { isUrlValidating } = useUrlValidation();\r\n\tconst { hasValidSku } = useNormalizedSkuContext();\r\n\r\n\tconst render = () => {\r\n\t\tif (isLoading || isUrlValidating) {\r\n\t\t\treturn ;\r\n\t\t}\r\n\t\tif (!hasValidSku) {\r\n\t\t\treturn ;\r\n\t\t} else if (errorType !== InvalidErrorTypeEnum.None) {\r\n\t\t\treturn ;\r\n\t\t}\r\n\t\treturn children;\r\n\t};\r\n\r\n\treturn render();\r\n}\r\n","import { useState, useEffect } from 'react';\r\nimport { isValidUrl, removeTrailingSlash } from '../../../util';\r\n\r\ntype UseUrlValidationType = {\r\n\tisUrlValidating: boolean;\r\n};\r\n\r\nexport const useUrlValidation = (): UseUrlValidationType => {\r\n\tconst [isUrlValidating, setIsUrlValidating] = useState(true);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (!isValidUrl()) {\r\n\t\t\tconst current = window.location.href;\r\n\t\t\tconst nextUrl = removeTrailingSlash(current);\r\n\t\t\twindow.location.replace(nextUrl);\r\n\t\t}\r\n\t\tsetIsUrlValidating(false);\r\n\t}, []);\r\n\r\n\treturn { isUrlValidating };\r\n};\r\n","import App from './App';\r\nimport CssBaseline from '@material-ui/core/CssBaseline';\r\nimport React, { useEffect, useState } from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport ErrorBoundary from './components/ErrorBoundary';\r\nimport WarningPrompt from './components/WarningPrompt';\r\nimport ThemeProvider from './components/ThemeProvider';\r\nimport AppValidator from './components/AppValidator';\r\nimport Loading from './components/Loading';\r\nimport {\r\n\tNormalizedSkuContext,\r\n\tuseNormalizeSku,\r\n} from './components/NormalizedSkuContext';\r\nimport {\r\n\tBrowserRouter as Router,\r\n\tRoute,\r\n\tRoutes,\r\n\tuseNavigate,\r\n} from 'react-router-dom';\r\nimport { getSearchParam } from './util';\r\nimport 'treeline-r2d2bc/reader.css';\r\nimport './index.css';\r\n\r\nReactDOM.render(\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t} />\r\n\t\t\t\t\t\t} />\r\n\t\t\t\t\t\t} />\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t,\r\n\tdocument.getElementById('root'),\r\n);\r\n\r\nfunction AppContainer() {\r\n\tconst { sku, isLoading, hasValidSku } = useNormalizeSku();\r\n\r\n\tif (isLoading) return ;\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nfunction MissingSkuError() {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nfunction InvalidURLError() {\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n\r\nfunction SkuParamChecker({ children }) {\r\n\tconst [isLoading, setIsLoading] = useState(true);\r\n\r\n\tconst navigate = useNavigate();\r\n\r\n\tuseEffect(() => {\r\n\t\tconst skuParam = getSearchParam('sku');\r\n\t\tif (skuParam) {\r\n\t\t\tnavigate(`/${skuParam}`);\r\n\t\t} else {\r\n\t\t\tsetIsLoading(false);\r\n\t\t}\r\n\t\t//eslint-disable-next-line\r\n\t}, []);\r\n\r\n\tif (isLoading) {\r\n\t\treturn ;\r\n\t}\r\n\r\n\treturn children;\r\n}\r\n"],"sourceRoot":""}