@edx/frontend-platform 3.6.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analytics/MockAnalyticsService.js +31 -19
- package/analytics/MockAnalyticsService.js.map +1 -1
- package/analytics/SegmentAnalyticsService.js +53 -57
- package/analytics/SegmentAnalyticsService.js.map +1 -1
- package/analytics/index.js.map +1 -1
- package/analytics/interface.js +9 -9
- package/analytics/interface.js.map +1 -1
- package/auth/AxiosCsrfTokenService.js +36 -58
- package/auth/AxiosCsrfTokenService.js.map +1 -1
- package/auth/AxiosJwtAuthService.js +105 -150
- package/auth/AxiosJwtAuthService.js.map +1 -1
- package/auth/AxiosJwtTokenService.js +101 -148
- package/auth/AxiosJwtTokenService.js.map +1 -1
- package/auth/LocalForageCache.js +89 -108
- package/auth/LocalForageCache.js.map +1 -1
- package/auth/MockAuthService.js +114 -43
- package/auth/MockAuthService.js.map +1 -1
- package/auth/index.js.map +1 -1
- package/auth/interceptors/createCsrfTokenProviderInterceptor.js +35 -50
- package/auth/interceptors/createCsrfTokenProviderInterceptor.js.map +1 -1
- package/auth/interceptors/createJwtTokenProviderInterceptor.js +33 -47
- package/auth/interceptors/createJwtTokenProviderInterceptor.js.map +1 -1
- package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js +15 -27
- package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js.map +1 -1
- package/auth/interceptors/createRetryInterceptor.js +75 -105
- package/auth/interceptors/createRetryInterceptor.js.map +1 -1
- package/auth/interface.js +41 -58
- package/auth/interface.js.map +1 -1
- package/auth/utils.js +22 -40
- package/auth/utils.js.map +1 -1
- package/config.js +6 -7
- package/config.js.map +1 -1
- package/constants.js +8 -8
- package/constants.js.map +1 -1
- package/i18n/countries.js +9 -15
- package/i18n/countries.js.map +1 -1
- package/i18n/index.js +1 -0
- package/i18n/index.js.map +1 -1
- package/i18n/injectIntlWithShim.js +4 -28
- package/i18n/injectIntlWithShim.js.map +1 -1
- package/i18n/languages.js +11 -17
- package/i18n/languages.js.map +1 -1
- package/i18n/lib.js +64 -56
- package/i18n/lib.js.map +1 -1
- package/i18n/scripts/transifex-utils.js +5 -20
- package/i18n/scripts/transifex-utils.js.map +1 -1
- package/index.js.map +1 -1
- package/initialize.js +176 -228
- package/initialize.js.map +1 -1
- package/logging/MockLoggingService.js +15 -9
- package/logging/MockLoggingService.js.map +1 -1
- package/logging/NewRelicLoggingService.js +9 -33
- package/logging/NewRelicLoggingService.js.map +1 -1
- package/logging/index.js.map +1 -1
- package/logging/interface.js +7 -6
- package/logging/interface.js.map +1 -1
- package/package.json +4 -4
- package/pubSub.js +4 -3
- package/pubSub.js.map +1 -1
- package/react/AppContext.js +1 -1
- package/react/AppContext.js.map +1 -1
- package/react/AppProvider.js +13 -23
- package/react/AppProvider.js.map +1 -1
- package/react/AuthenticatedPageRoute.js +5 -13
- package/react/AuthenticatedPageRoute.js.map +1 -1
- package/react/ErrorBoundary.js +4 -21
- package/react/ErrorBoundary.js.map +1 -1
- package/react/ErrorPage.js +7 -17
- package/react/ErrorPage.js.map +1 -1
- package/react/LoginRedirect.js +1 -1
- package/react/LoginRedirect.js.map +1 -1
- package/react/OptionalReduxProvider.js +2 -4
- package/react/OptionalReduxProvider.js.map +1 -1
- package/react/PageRoute.js +3 -3
- package/react/PageRoute.js.map +1 -1
- package/react/hooks.js +2 -6
- package/react/hooks.js.map +1 -1
- package/react/index.js +1 -0
- package/react/index.js.map +1 -1
- package/testing/index.js +1 -0
- package/testing/index.js.map +1 -1
- package/testing/initializeMockApp.js +11 -11
- package/testing/initializeMockApp.js.map +1 -1
- package/testing/mockMessages.js.map +1 -1
- package/utils.js +15 -24
- package/utils.js.map +1 -1
package/initialize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","names":["createBrowserHistory","createMemoryHistory","publish","getConfig","mergeConfig","configure","configureLogging","getLoggingService","NewRelicLoggingService","logError","configureAnalytics","SegmentAnalyticsService","identifyAnonymousUser","identifyAuthenticatedUser","getAuthenticatedHttpClient","configureAuth","ensureAuthenticatedUser","fetchAuthenticatedUser","hydrateAuthenticatedUser","getAuthenticatedUser","AxiosJwtAuthService","configureI18n","APP_PUBSUB_INITIALIZED","APP_CONFIG_INITIALIZED","APP_AUTH_INITIALIZED","APP_I18N_INITIALIZED","APP_LOGGING_INITIALIZED","APP_ANALYTICS_INITIALIZED","APP_READY","APP_INIT_ERROR","configureCache","history","window","basename","PUBLIC_PATH","initError","error","auth","requireUser","hydrateUser","global","location","href","runtimeConfig","MFE_CONFIG_API_URL","APP_ID","apiConfig","headers","accept","apiService","params","URLSearchParams","append","url","toString","get","data","console","message","analytics","authenticatedUser","userId","applyOverrideHandlers","overrides","noOp","pubSub","config","logging","i18n","ready","initialize","loggingService","analyticsService","authService","authMiddleware","requireAuthenticatedUser","messages","handlers","overrideHandlers","middleware","httpClient","isRedirecting"],"sources":["../src/initialize.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform**\n *\n * The initialization module provides a function for managing an application's initialization\n * lifecycle. It also provides constants and default handler implementations.\n *\n * ```\n * import {\n * initialize,\n * APP_INIT_ERROR,\n * APP_READY,\n * subscribe,\n * } from '@edx/frontend-platform';\n * import { AppProvider, ErrorPage, PageRoute } from '@edx/frontend-platform/react';\n * import React from 'react';\n * import ReactDOM from 'react-dom';\n * import { Switch } from 'react-router-dom';\n *\n * subscribe(APP_READY, () => {\n * ReactDOM.render(\n * <AppProvider store={configureStore()}>\n * <Header />\n * <main>\n * <Switch>\n * <PageRoute exact path=\"/\" component={PaymentPage} />\n * </Switch>\n * </main>\n * <Footer />\n * </AppProvider>,\n * document.getElementById('root'),\n * );\n * });\n *\n * subscribe(APP_INIT_ERROR, (error) => {\n * ReactDOM.render(<ErrorPage message={error.message} />, document.getElementById('root'));\n * });\n *\n * initialize({\n * messages: [appMessages],\n * requireAuthenticatedUser: true,\n * hydrateAuthenticatedUser: true,\n * });\n\n```\n * @module Initialization\n */\n\nimport { createBrowserHistory, createMemoryHistory } from 'history';\nimport {\n publish,\n} from './pubSub';\n// eslint-disable-next-line import/no-cycle\nimport {\n getConfig, mergeConfig,\n} from './config';\nimport {\n configure as configureLogging, getLoggingService, NewRelicLoggingService, logError,\n} from './logging';\nimport {\n configure as configureAnalytics, SegmentAnalyticsService, identifyAnonymousUser, identifyAuthenticatedUser,\n} from './analytics';\nimport {\n getAuthenticatedHttpClient,\n configure as configureAuth,\n ensureAuthenticatedUser,\n fetchAuthenticatedUser,\n hydrateAuthenticatedUser,\n getAuthenticatedUser,\n AxiosJwtAuthService,\n} from './auth';\nimport { configure as configureI18n } from './i18n';\nimport {\n APP_PUBSUB_INITIALIZED,\n APP_CONFIG_INITIALIZED,\n APP_AUTH_INITIALIZED,\n APP_I18N_INITIALIZED,\n APP_LOGGING_INITIALIZED,\n APP_ANALYTICS_INITIALIZED,\n APP_READY, APP_INIT_ERROR,\n} from './constants';\nimport configureCache from './auth/LocalForageCache';\n\n/**\n * A browser history or memory history object created by the [history](https://github.com/ReactTraining/history)\n * package. Applications are encouraged to use this history object, rather than creating their own,\n * as behavior may be undefined when managing history via multiple mechanisms/instances. Note that\n * in environments where browser history may be inaccessible due to `window` being undefined, this\n * falls back to memory history.\n */\nexport const history = (typeof window !== 'undefined')\n ? createBrowserHistory({\n basename: getConfig().PUBLIC_PATH,\n }) : createMemoryHistory();\n\n/**\n * The default handler for the initialization lifecycle's `initError` phase. Logs the error to the\n * LoggingService using `logError`\n *\n * @see {@link module:frontend-platform/logging~logError}\n * @param {*} error\n */\nexport async function initError(error) {\n logError(error);\n}\n\n/**\n * The default handler for the initialization lifecycle's `auth` phase.\n *\n * The handler has several responsibilities:\n * - Determining the user's authentication state (authenticated or anonymous)\n * - Optionally redirecting to login if the application requires an authenticated user.\n * - Optionally loading additional user information via the application's user account data\n * endpoint.\n *\n * @param {boolean} requireUser Whether or not we should redirect to login if a user is not\n * authenticated.\n * @param {boolean} hydrateUser Whether or not we should fetch additional user account data.\n */\nexport async function auth(requireUser, hydrateUser) {\n if (requireUser) {\n await ensureAuthenticatedUser(global.location.href);\n } else {\n await fetchAuthenticatedUser();\n }\n\n if (hydrateUser && getAuthenticatedUser() !== null) {\n // We intentionally do not await the promise returned by hydrateAuthenticatedUser. All the\n // critical data is returned as part of fetch/ensureAuthenticatedUser above, and anything else\n // is a nice-to-have for application code.\n hydrateAuthenticatedUser();\n }\n}\n/*\n * Set or overrides configuration through an API.\n * This method allows runtime configuration.\n * Set a basic configuration when an error happen and allow initError and display the ErrorPage.\n */\n\nexport async function runtimeConfig() {\n try {\n const { MFE_CONFIG_API_URL, APP_ID } = getConfig();\n\n if (MFE_CONFIG_API_URL) {\n const apiConfig = { headers: { accept: 'application/json' } };\n const apiService = await configureCache();\n\n const params = new URLSearchParams();\n params.append('mfe', APP_ID);\n const url = `${MFE_CONFIG_API_URL}?${params.toString()}`;\n\n const { data } = await apiService.get(url, apiConfig);\n mergeConfig(data);\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error with config API', error.message);\n }\n}\n\n/**\n * The default handler for the initialization lifecycle's `analytics` phase.\n *\n * The handler is responsible for identifying authenticated and anonymous users with the analytics\n * service. This is a pre-requisite for sending analytics events, thus, we do it during the\n * initialization sequence so that analytics is ready once the application's UI code starts to load.\n *\n */\nexport async function analytics() {\n const authenticatedUser = getAuthenticatedUser();\n if (authenticatedUser && authenticatedUser.userId) {\n identifyAuthenticatedUser(authenticatedUser.userId);\n } else {\n await identifyAnonymousUser();\n }\n}\n\nfunction applyOverrideHandlers(overrides) {\n const noOp = async () => { };\n return {\n pubSub: noOp,\n config: noOp,\n logging: noOp,\n auth,\n analytics,\n i18n: noOp,\n ready: noOp,\n initError,\n ...overrides, // This will override any same-keyed handlers from above.\n };\n}\n\n/**\n * Invokes the application initialization sequence.\n *\n * The sequence proceeds through a number of lifecycle phases, during which pertinent services are\n * configured.\n *\n * Using the `handlers` option, lifecycle phase handlers can be overridden to perform custom\n * functionality. Note that while these override handlers _do_ replace the default handler\n * functionality for analytics, auth, and initError (the other phases have no default\n * functionality), they do _not_ override the configuration of the actual services that those\n * handlers leverage.\n *\n * Some services can be overridden via the loggingService and analyticsService options. The other\n * services (auth and i18n) cannot currently be overridden.\n *\n * The following lifecycle phases exist:\n *\n * - pubSub: A no-op by default.\n * - config: A no-op by default.\n * - logging: A no-op by default.\n * - auth: Uses the 'auth' handler defined above.\n * - analytics: Uses the 'analytics' handler defined above.\n * - i18n: A no-op by default.\n * - ready: A no-op by default.\n * - initError: Uses the 'initError' handler defined above.\n *\n * @param {Object} [options]\n * @param {*} [options.loggingService=NewRelicLoggingService] The `LoggingService` implementation\n * to use.\n * @param {*} [options.analyticsService=SegmentAnalyticsService] The `AnalyticsService`\n * implementation to use.\n * @param {*} [options.authMiddleware=[]] An array of middleware to apply to http clients in the auth service.\n * @param {*} [options.requireAuthenticatedUser=false] If true, turns on automatic login\n * redirection for unauthenticated users. Defaults to false, meaning that by default the\n * application will allow anonymous/unauthenticated sessions.\n * @param {*} [options.hydrateAuthenticatedUser=false] If true, makes an API call to the user\n * account endpoint (`${App.config.LMS_BASE_URL}/api/user/v1/accounts/${username}`) to fetch\n * detailed account information for the authenticated user. This data is merged into the return\n * value of `getAuthenticatedUser`, overriding any duplicate keys that already exist. Defaults to\n * false, meaning that no additional account information will be loaded.\n * @param {*} [options.messages] A i18n-compatible messages object, or an array of such objects. If\n * an array is provided, duplicate keys are resolved with the last-one-in winning.\n * @param {*} [options.handlers={}] An optional object of handlers which can be used to replace the\n * default behavior of any part of the startup sequence. It can also be used to add additional\n * initialization behavior before or after the rest of the sequence.\n */\nexport async function initialize({\n loggingService = NewRelicLoggingService,\n analyticsService = SegmentAnalyticsService,\n authService = AxiosJwtAuthService,\n authMiddleware = [],\n requireAuthenticatedUser: requireUser = false,\n hydrateAuthenticatedUser: hydrateUser = false,\n messages,\n handlers: overrideHandlers = {},\n}) {\n const handlers = applyOverrideHandlers(overrideHandlers);\n try {\n // Pub/Sub\n await handlers.pubSub();\n publish(APP_PUBSUB_INITIALIZED);\n\n // Configuration\n await handlers.config();\n await runtimeConfig();\n publish(APP_CONFIG_INITIALIZED);\n\n // Logging\n configureLogging(loggingService, {\n config: getConfig(),\n });\n await handlers.logging();\n publish(APP_LOGGING_INITIALIZED);\n\n // Authentication\n configureAuth(authService, {\n loggingService: getLoggingService(),\n config: getConfig(),\n middleware: authMiddleware,\n });\n\n await handlers.auth(requireUser, hydrateUser);\n publish(APP_AUTH_INITIALIZED);\n\n // Analytics\n configureAnalytics(analyticsService, {\n config: getConfig(),\n loggingService: getLoggingService(),\n httpClient: getAuthenticatedHttpClient(),\n });\n await handlers.analytics();\n publish(APP_ANALYTICS_INITIALIZED);\n\n // Internationalization\n configureI18n({\n messages,\n config: getConfig(),\n loggingService: getLoggingService(),\n });\n await handlers.i18n();\n publish(APP_I18N_INITIALIZED);\n\n // Application Ready\n await handlers.ready();\n publish(APP_READY);\n } catch (error) {\n if (!error.isRedirecting) {\n // Initialization Error\n await handlers.initError(error);\n publish(APP_INIT_ERROR, error);\n }\n }\n}\n"],"mappings":";;;;;;;;+CACA,oJ;;;;;;AADA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,oBAAT,EAA+BC,mBAA/B,QAA0D,SAA1D;AACA,SACEC,OADF,QAEO,UAFP,C,CAGA;;AACA,SACEC,SADF,EACaC,WADb,QAEO,UAFP;AAGA,SACEC,SAAS,IAAIC,gBADf,EACiCC,iBADjC,EACoDC,sBADpD,EAC4EC,QAD5E,QAEO,WAFP;AAGA,SACEJ,SAAS,IAAIK,kBADf,EACmCC,uBADnC,EAC4DC,qBAD5D,EACmFC,yBADnF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qD,aA5DR;cAAA;cAAA;YAAA;;YAAA;YAAA,OA8DKJ,QAAQ,CAAC1C,SAAT,cA9DL;;UAAA;YA+DDjC,OAAO,CAAC2B,cAAD,eAAP;;UA/DC;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C"}
|
|
1
|
+
{"version":3,"file":"initialize.js","names":["_regeneratorRuntime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","defineProperty","obj","key","desc","value","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","makeInvokeMethod","tryCatch","fn","arg","type","call","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","method","_invoke","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","_typeof","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","done","methodName","undefined","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","val","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","_catch","thrown","delegateYield","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","args","arguments","apply","createBrowserHistory","createMemoryHistory","publish","getConfig","mergeConfig","configure","configureLogging","getLoggingService","NewRelicLoggingService","logError","configureAnalytics","SegmentAnalyticsService","identifyAnonymousUser","identifyAuthenticatedUser","getAuthenticatedHttpClient","configureAuth","ensureAuthenticatedUser","fetchAuthenticatedUser","hydrateAuthenticatedUser","getAuthenticatedUser","AxiosJwtAuthService","configureI18n","APP_PUBSUB_INITIALIZED","APP_CONFIG_INITIALIZED","APP_AUTH_INITIALIZED","APP_I18N_INITIALIZED","APP_LOGGING_INITIALIZED","APP_ANALYTICS_INITIALIZED","APP_READY","APP_INIT_ERROR","configureCache","history","window","basename","PUBLIC_PATH","initError","_x","_initError","_callee2","_callee2$","_context2","auth","_x2","_x3","_auth","_callee3","requireUser","hydrateUser","_callee3$","_context3","global","location","href","runtimeConfig","_runtimeConfig","_callee4","_getConfig","MFE_CONFIG_API_URL","APP_ID","apiConfig","apiService","params","url","_yield$apiService$get","data","_callee4$","_context4","headers","accept","URLSearchParams","append","concat","toString","get","t0","console","message","analytics","_analytics","_callee5","authenticatedUser","_callee5$","_context5","userId","applyOverrideHandlers","overrides","noOp","_ref","_callee","_callee$","_context","_objectSpread","pubSub","config","logging","i18n","ready","initialize","_x4","_initialize","_callee6","_ref2","_ref2$loggingService","loggingService","_ref2$analyticsServic","analyticsService","_ref2$authService","authService","_ref2$authMiddleware","authMiddleware","_ref2$requireAuthenti","_ref2$hydrateAuthenti","messages","_ref2$handlers","overrideHandlers","handlers","_callee6$","_context6","requireAuthenticatedUser","middleware","httpClient","isRedirecting"],"sources":["../src/initialize.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform**\n *\n * The initialization module provides a function for managing an application's initialization\n * lifecycle. It also provides constants and default handler implementations.\n *\n * ```\n * import {\n * initialize,\n * APP_INIT_ERROR,\n * APP_READY,\n * subscribe,\n * } from '@edx/frontend-platform';\n * import { AppProvider, ErrorPage, PageRoute } from '@edx/frontend-platform/react';\n * import React from 'react';\n * import ReactDOM from 'react-dom';\n * import { Switch } from 'react-router-dom';\n *\n * subscribe(APP_READY, () => {\n * ReactDOM.render(\n * <AppProvider store={configureStore()}>\n * <Header />\n * <main>\n * <Switch>\n * <PageRoute exact path=\"/\" component={PaymentPage} />\n * </Switch>\n * </main>\n * <Footer />\n * </AppProvider>,\n * document.getElementById('root'),\n * );\n * });\n *\n * subscribe(APP_INIT_ERROR, (error) => {\n * ReactDOM.render(<ErrorPage message={error.message} />, document.getElementById('root'));\n * });\n *\n * initialize({\n * messages: [appMessages],\n * requireAuthenticatedUser: true,\n * hydrateAuthenticatedUser: true,\n * });\n\n```\n * @module Initialization\n */\n\nimport { createBrowserHistory, createMemoryHistory } from 'history';\nimport {\n publish,\n} from './pubSub';\n// eslint-disable-next-line import/no-cycle\nimport {\n getConfig, mergeConfig,\n} from './config';\nimport {\n configure as configureLogging, getLoggingService, NewRelicLoggingService, logError,\n} from './logging';\nimport {\n configure as configureAnalytics, SegmentAnalyticsService, identifyAnonymousUser, identifyAuthenticatedUser,\n} from './analytics';\nimport {\n getAuthenticatedHttpClient,\n configure as configureAuth,\n ensureAuthenticatedUser,\n fetchAuthenticatedUser,\n hydrateAuthenticatedUser,\n getAuthenticatedUser,\n AxiosJwtAuthService,\n} from './auth';\nimport { configure as configureI18n } from './i18n';\nimport {\n APP_PUBSUB_INITIALIZED,\n APP_CONFIG_INITIALIZED,\n APP_AUTH_INITIALIZED,\n APP_I18N_INITIALIZED,\n APP_LOGGING_INITIALIZED,\n APP_ANALYTICS_INITIALIZED,\n APP_READY, APP_INIT_ERROR,\n} from './constants';\nimport configureCache from './auth/LocalForageCache';\n\n/**\n * A browser history or memory history object created by the [history](https://github.com/ReactTraining/history)\n * package. Applications are encouraged to use this history object, rather than creating their own,\n * as behavior may be undefined when managing history via multiple mechanisms/instances. Note that\n * in environments where browser history may be inaccessible due to `window` being undefined, this\n * falls back to memory history.\n */\nexport const history = (typeof window !== 'undefined')\n ? createBrowserHistory({\n basename: getConfig().PUBLIC_PATH,\n }) : createMemoryHistory();\n\n/**\n * The default handler for the initialization lifecycle's `initError` phase. Logs the error to the\n * LoggingService using `logError`\n *\n * @see {@link module:frontend-platform/logging~logError}\n * @param {*} error\n */\nexport async function initError(error) {\n logError(error);\n}\n\n/**\n * The default handler for the initialization lifecycle's `auth` phase.\n *\n * The handler has several responsibilities:\n * - Determining the user's authentication state (authenticated or anonymous)\n * - Optionally redirecting to login if the application requires an authenticated user.\n * - Optionally loading additional user information via the application's user account data\n * endpoint.\n *\n * @param {boolean} requireUser Whether or not we should redirect to login if a user is not\n * authenticated.\n * @param {boolean} hydrateUser Whether or not we should fetch additional user account data.\n */\nexport async function auth(requireUser, hydrateUser) {\n if (requireUser) {\n await ensureAuthenticatedUser(global.location.href);\n } else {\n await fetchAuthenticatedUser();\n }\n\n if (hydrateUser && getAuthenticatedUser() !== null) {\n // We intentionally do not await the promise returned by hydrateAuthenticatedUser. All the\n // critical data is returned as part of fetch/ensureAuthenticatedUser above, and anything else\n // is a nice-to-have for application code.\n hydrateAuthenticatedUser();\n }\n}\n/*\n * Set or overrides configuration through an API.\n * This method allows runtime configuration.\n * Set a basic configuration when an error happen and allow initError and display the ErrorPage.\n */\n\nexport async function runtimeConfig() {\n try {\n const { MFE_CONFIG_API_URL, APP_ID } = getConfig();\n\n if (MFE_CONFIG_API_URL) {\n const apiConfig = { headers: { accept: 'application/json' } };\n const apiService = await configureCache();\n\n const params = new URLSearchParams();\n params.append('mfe', APP_ID);\n const url = `${MFE_CONFIG_API_URL}?${params.toString()}`;\n\n const { data } = await apiService.get(url, apiConfig);\n mergeConfig(data);\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error with config API', error.message);\n }\n}\n\n/**\n * The default handler for the initialization lifecycle's `analytics` phase.\n *\n * The handler is responsible for identifying authenticated and anonymous users with the analytics\n * service. This is a pre-requisite for sending analytics events, thus, we do it during the\n * initialization sequence so that analytics is ready once the application's UI code starts to load.\n *\n */\nexport async function analytics() {\n const authenticatedUser = getAuthenticatedUser();\n if (authenticatedUser && authenticatedUser.userId) {\n identifyAuthenticatedUser(authenticatedUser.userId);\n } else {\n await identifyAnonymousUser();\n }\n}\n\nfunction applyOverrideHandlers(overrides) {\n const noOp = async () => { };\n return {\n pubSub: noOp,\n config: noOp,\n logging: noOp,\n auth,\n analytics,\n i18n: noOp,\n ready: noOp,\n initError,\n ...overrides, // This will override any same-keyed handlers from above.\n };\n}\n\n/**\n * Invokes the application initialization sequence.\n *\n * The sequence proceeds through a number of lifecycle phases, during which pertinent services are\n * configured.\n *\n * Using the `handlers` option, lifecycle phase handlers can be overridden to perform custom\n * functionality. Note that while these override handlers _do_ replace the default handler\n * functionality for analytics, auth, and initError (the other phases have no default\n * functionality), they do _not_ override the configuration of the actual services that those\n * handlers leverage.\n *\n * Some services can be overridden via the loggingService and analyticsService options. The other\n * services (auth and i18n) cannot currently be overridden.\n *\n * The following lifecycle phases exist:\n *\n * - pubSub: A no-op by default.\n * - config: A no-op by default.\n * - logging: A no-op by default.\n * - auth: Uses the 'auth' handler defined above.\n * - analytics: Uses the 'analytics' handler defined above.\n * - i18n: A no-op by default.\n * - ready: A no-op by default.\n * - initError: Uses the 'initError' handler defined above.\n *\n * @param {Object} [options]\n * @param {*} [options.loggingService=NewRelicLoggingService] The `LoggingService` implementation\n * to use.\n * @param {*} [options.analyticsService=SegmentAnalyticsService] The `AnalyticsService`\n * implementation to use.\n * @param {*} [options.authMiddleware=[]] An array of middleware to apply to http clients in the auth service.\n * @param {*} [options.requireAuthenticatedUser=false] If true, turns on automatic login\n * redirection for unauthenticated users. Defaults to false, meaning that by default the\n * application will allow anonymous/unauthenticated sessions.\n * @param {*} [options.hydrateAuthenticatedUser=false] If true, makes an API call to the user\n * account endpoint (`${App.config.LMS_BASE_URL}/api/user/v1/accounts/${username}`) to fetch\n * detailed account information for the authenticated user. This data is merged into the return\n * value of `getAuthenticatedUser`, overriding any duplicate keys that already exist. Defaults to\n * false, meaning that no additional account information will be loaded.\n * @param {*} [options.messages] A i18n-compatible messages object, or an array of such objects. If\n * an array is provided, duplicate keys are resolved with the last-one-in winning.\n * @param {*} [options.handlers={}] An optional object of handlers which can be used to replace the\n * default behavior of any part of the startup sequence. It can also be used to add additional\n * initialization behavior before or after the rest of the sequence.\n */\nexport async function initialize({\n loggingService = NewRelicLoggingService,\n analyticsService = SegmentAnalyticsService,\n authService = AxiosJwtAuthService,\n authMiddleware = [],\n requireAuthenticatedUser: requireUser = false,\n hydrateAuthenticatedUser: hydrateUser = false,\n messages,\n handlers: overrideHandlers = {},\n}) {\n const handlers = applyOverrideHandlers(overrideHandlers);\n try {\n // Pub/Sub\n await handlers.pubSub();\n publish(APP_PUBSUB_INITIALIZED);\n\n // Configuration\n await handlers.config();\n await runtimeConfig();\n publish(APP_CONFIG_INITIALIZED);\n\n // Logging\n configureLogging(loggingService, {\n config: getConfig(),\n });\n await handlers.logging();\n publish(APP_LOGGING_INITIALIZED);\n\n // Authentication\n configureAuth(authService, {\n loggingService: getLoggingService(),\n config: getConfig(),\n middleware: authMiddleware,\n });\n\n await handlers.auth(requireUser, hydrateUser);\n publish(APP_AUTH_INITIALIZED);\n\n // Analytics\n configureAnalytics(analyticsService, {\n config: getConfig(),\n loggingService: getLoggingService(),\n httpClient: getAuthenticatedHttpClient(),\n });\n await handlers.analytics();\n publish(APP_ANALYTICS_INITIALIZED);\n\n // Internationalization\n configureI18n({\n messages,\n config: getConfig(),\n loggingService: getLoggingService(),\n });\n await handlers.i18n();\n publish(APP_I18N_INITIALIZED);\n\n // Application Ready\n await handlers.ready();\n publish(APP_READY);\n } catch (error) {\n if (!error.isRedirecting) {\n // Initialization Error\n await handlers.initError(error);\n publish(APP_INIT_ERROR, error);\n }\n }\n}\n"],"mappings":";;;;;;+CACA,qJAAAA,mBAAA,YAAAA,oBAAA,WAAAC,OAAA,SAAAA,OAAA,OAAAC,EAAA,GAAAC,MAAA,CAAAC,SAAA,EAAAC,MAAA,GAAAH,EAAA,CAAAI,cAAA,EAAAC,cAAA,GAAAJ,MAAA,CAAAI,cAAA,cAAAC,GAAA,EAAAC,GAAA,EAAAC,IAAA,IAAAF,GAAA,CAAAC,GAAA,IAAAC,IAAA,CAAAC,KAAA,KAAAC,OAAA,wBAAAC,MAAA,GAAAA,MAAA,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AAA,CAAApG,KAAA,OAAAD,SAAA;AAAA"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
3
3
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
4
|
-
|
|
5
4
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
8
|
/**
|
|
10
9
|
* The MockLoggingService implements both logInfo and logError as jest mock functions via
|
|
11
10
|
* jest.fn(). It has no other functionality.
|
|
@@ -15,11 +14,18 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
15
14
|
*/
|
|
16
15
|
var MockLoggingService = /*#__PURE__*/_createClass(function MockLoggingService() {
|
|
17
16
|
_classCallCheck(this, MockLoggingService);
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Implemented as a jest.fn()
|
|
19
|
+
*
|
|
20
|
+
* @memberof MockLoggingService
|
|
21
|
+
*/
|
|
19
22
|
_defineProperty(this, "logInfo", jest.fn());
|
|
20
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Implemented as a jest.fn()
|
|
25
|
+
*
|
|
26
|
+
* @memberof MockLoggingService
|
|
27
|
+
*/
|
|
21
28
|
_defineProperty(this, "logError", jest.fn());
|
|
22
29
|
});
|
|
23
|
-
|
|
24
30
|
export default MockLoggingService;
|
|
25
31
|
//# sourceMappingURL=MockLoggingService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockLoggingService.js","names":["MockLoggingService","jest","fn"],"sources":["../../src/logging/MockLoggingService.js"],"sourcesContent":["/**\n * The MockLoggingService implements both logInfo and logError as jest mock functions via\n * jest.fn(). It has no other functionality.\n *\n * @implements {LoggingService}\n * @memberof module:Logging\n */\nclass MockLoggingService {\n /**\n * Implemented as a jest.fn()\n *\n * @memberof MockLoggingService\n */\n logInfo = jest.fn();\n\n /**\n * Implemented as a jest.fn()\n *\n * @memberof MockLoggingService\n */\n logError = jest.fn();\n}\n\nexport default MockLoggingService;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"MockLoggingService.js","names":["MockLoggingService","_createClass","_classCallCheck","_defineProperty","jest","fn"],"sources":["../../src/logging/MockLoggingService.js"],"sourcesContent":["/**\n * The MockLoggingService implements both logInfo and logError as jest mock functions via\n * jest.fn(). It has no other functionality.\n *\n * @implements {LoggingService}\n * @memberof module:Logging\n */\nclass MockLoggingService {\n /**\n * Implemented as a jest.fn()\n *\n * @memberof MockLoggingService\n */\n logInfo = jest.fn();\n\n /**\n * Implemented as a jest.fn()\n *\n * @memberof MockLoggingService\n */\n logError = jest.fn();\n}\n\nexport default MockLoggingService;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAOMA,kBAAkB,gBAAAC,YAAA,UAAAD,mBAAA;EAAAE,eAAA,OAAAF,kBAAA;EACtB;AACF;AACA;AACA;AACA;EAJEG,eAAA,kBAKUC,IAAI,CAACC,EAAE,EAAE;EAEnB;AACF;AACA;AACA;AACA;EAJEF,eAAA,mBAKWC,IAAI,CAACC,EAAE,EAAE;AAAA;AAGtB,eAAeL,kBAAkB"}
|
|
@@ -1,43 +1,33 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
|
|
3
2
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
-
|
|
5
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
-
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
7
4
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
-
|
|
9
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
-
|
|
11
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
10
|
/**
|
|
16
11
|
* NewRelic will not log an error if it is too long.
|
|
17
12
|
*
|
|
18
13
|
* @ignore
|
|
19
14
|
*/
|
|
20
15
|
export var MAX_ERROR_LENGTH = 4000;
|
|
21
|
-
|
|
22
16
|
function fixErrorLength(error) {
|
|
23
17
|
if (error.message && error.message.length > MAX_ERROR_LENGTH) {
|
|
24
18
|
var processedError = Object.create(error);
|
|
25
19
|
processedError.message = processedError.message.substring(0, MAX_ERROR_LENGTH);
|
|
26
20
|
return processedError;
|
|
27
21
|
}
|
|
28
|
-
|
|
29
22
|
if (typeof error === 'string' && error.length > MAX_ERROR_LENGTH) {
|
|
30
23
|
return error.substring(0, MAX_ERROR_LENGTH);
|
|
31
24
|
}
|
|
32
|
-
|
|
33
25
|
return error;
|
|
34
26
|
}
|
|
35
|
-
/* Constants used as New Relic page action names. */
|
|
36
|
-
|
|
37
27
|
|
|
28
|
+
/* Constants used as New Relic page action names. */
|
|
38
29
|
var pageActionNameInfo = 'INFO';
|
|
39
30
|
var pageActionNameIgnoredError = 'IGNORED_ERROR';
|
|
40
|
-
|
|
41
31
|
function sendPageAction(actionName, message, customAttributes) {
|
|
42
32
|
if (process.env.NODE_ENV === 'development') {
|
|
43
33
|
console.log(message, customAttributes); // eslint-disable-line
|
|
@@ -49,7 +39,6 @@ function sendPageAction(actionName, message, customAttributes) {
|
|
|
49
39
|
}, customAttributes));
|
|
50
40
|
}
|
|
51
41
|
}
|
|
52
|
-
|
|
53
42
|
function sendError(error, customAttributes) {
|
|
54
43
|
if (process.env.NODE_ENV === 'development') {
|
|
55
44
|
console.error(error, customAttributes); // eslint-disable-line
|
|
@@ -59,6 +48,7 @@ function sendError(error, customAttributes) {
|
|
|
59
48
|
window.newrelic.noticeError(fixErrorLength(error), customAttributes);
|
|
60
49
|
}
|
|
61
50
|
}
|
|
51
|
+
|
|
62
52
|
/**
|
|
63
53
|
* The NewRelicLoggingService is a concrete implementation of the logging service interface that
|
|
64
54
|
* sends messages to NewRelic that can be seen in NewRelic Browser and NewRelic Insights. When in
|
|
@@ -92,12 +82,9 @@ function sendError(error, customAttributes) {
|
|
|
92
82
|
* @implements {LoggingService}
|
|
93
83
|
* @memberof module:Logging
|
|
94
84
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
85
|
var NewRelicLoggingService = /*#__PURE__*/function () {
|
|
98
86
|
function NewRelicLoggingService(options) {
|
|
99
87
|
_classCallCheck(this, NewRelicLoggingService);
|
|
100
|
-
|
|
101
88
|
var config = options ? options.config : undefined;
|
|
102
89
|
/*
|
|
103
90
|
String which is an explicit error message regex. If an error message matches the regex, the error
|
|
@@ -118,9 +105,9 @@ var NewRelicLoggingService = /*#__PURE__*/function () {
|
|
|
118
105
|
'This error should not match anything!'.match(x);
|
|
119
106
|
For edx.org, add new error message regexes in edx-internal YAML as needed.
|
|
120
107
|
*/
|
|
121
|
-
|
|
122
108
|
this.ignoredErrorRegexes = config ? config.IGNORED_ERROR_REGEX : undefined;
|
|
123
109
|
}
|
|
110
|
+
|
|
124
111
|
/**
|
|
125
112
|
*
|
|
126
113
|
*
|
|
@@ -128,26 +115,22 @@ var NewRelicLoggingService = /*#__PURE__*/function () {
|
|
|
128
115
|
* @param {*} [customAttributes={}]
|
|
129
116
|
* @memberof NewRelicLoggingService
|
|
130
117
|
*/
|
|
131
|
-
|
|
132
|
-
|
|
133
118
|
_createClass(NewRelicLoggingService, [{
|
|
134
119
|
key: "logInfo",
|
|
135
120
|
value: function logInfo(infoStringOrErrorObject) {
|
|
136
121
|
var customAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
137
122
|
var message = infoStringOrErrorObject;
|
|
138
123
|
var customAttrs = customAttributes;
|
|
139
|
-
|
|
140
124
|
if (_typeof(infoStringOrErrorObject) === 'object' && 'message' in infoStringOrErrorObject) {
|
|
141
125
|
/* Caller has passed in an error object to be logged as a page action. */
|
|
142
|
-
|
|
143
126
|
/* Extract the attributes and the message. */
|
|
144
127
|
var infoCustomAttributes = infoStringOrErrorObject.customAttributes || {};
|
|
145
128
|
customAttrs = _objectSpread(_objectSpread({}, infoCustomAttributes), customAttributes);
|
|
146
129
|
message = infoStringOrErrorObject.message;
|
|
147
130
|
}
|
|
148
|
-
|
|
149
131
|
sendPageAction(pageActionNameInfo, message, customAttrs);
|
|
150
132
|
}
|
|
133
|
+
|
|
151
134
|
/**
|
|
152
135
|
*
|
|
153
136
|
*
|
|
@@ -155,28 +138,23 @@ var NewRelicLoggingService = /*#__PURE__*/function () {
|
|
|
155
138
|
* @param {*} [customAttributes={}]
|
|
156
139
|
* @memberof NewRelicLoggingService
|
|
157
140
|
*/
|
|
158
|
-
|
|
159
141
|
}, {
|
|
160
142
|
key: "logError",
|
|
161
143
|
value: function logError(errorStringOrObject) {
|
|
162
144
|
var customAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
163
145
|
var errorCustomAttributes = errorStringOrObject.customAttributes || {};
|
|
164
|
-
|
|
165
146
|
var allCustomAttributes = _objectSpread(_objectSpread({}, errorCustomAttributes), customAttributes);
|
|
166
|
-
|
|
167
147
|
if (Object.keys(allCustomAttributes).length === 0) {
|
|
168
148
|
// noticeError expects undefined if there are no custom attributes.
|
|
169
149
|
allCustomAttributes = undefined;
|
|
170
150
|
}
|
|
151
|
+
|
|
171
152
|
/*
|
|
172
153
|
Separate the errors into ignored errors and other errors.
|
|
173
154
|
Ignored errors are logged via adding a page action.
|
|
174
155
|
Other errors are logged via noticeError and count as "JS Errors" for the application.
|
|
175
156
|
*/
|
|
176
|
-
|
|
177
|
-
|
|
178
157
|
var errorMessage = errorStringOrObject.message || (typeof errorStringOrObject === 'string' ? errorStringOrObject : '');
|
|
179
|
-
|
|
180
158
|
if (this.ignoredErrorRegexes && errorMessage.match(this.ignoredErrorRegexes)) {
|
|
181
159
|
/* ignored error */
|
|
182
160
|
sendPageAction(pageActionNameIgnoredError, errorMessage, allCustomAttributes);
|
|
@@ -186,9 +164,7 @@ var NewRelicLoggingService = /*#__PURE__*/function () {
|
|
|
186
164
|
}
|
|
187
165
|
}
|
|
188
166
|
}]);
|
|
189
|
-
|
|
190
167
|
return NewRelicLoggingService;
|
|
191
168
|
}();
|
|
192
|
-
|
|
193
169
|
export { NewRelicLoggingService as default };
|
|
194
170
|
//# sourceMappingURL=NewRelicLoggingService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewRelicLoggingService.js","names":["MAX_ERROR_LENGTH","fixErrorLength","error","message","length","processedError","Object","create","substring","pageActionNameInfo","pageActionNameIgnoredError","sendPageAction","actionName","customAttributes","process","env","NODE_ENV","console","log","window","newrelic","addPageAction","sendError","noticeError","NewRelicLoggingService","options","config","undefined","ignoredErrorRegexes","IGNORED_ERROR_REGEX","infoStringOrErrorObject","customAttrs","infoCustomAttributes","errorStringOrObject","errorCustomAttributes","allCustomAttributes","keys","errorMessage","match"],"sources":["../../src/logging/NewRelicLoggingService.js"],"sourcesContent":["/**\n * NewRelic will not log an error if it is too long.\n *\n * @ignore\n */\nexport const MAX_ERROR_LENGTH = 4000;\n\nfunction fixErrorLength(error) {\n if (error.message && error.message.length > MAX_ERROR_LENGTH) {\n const processedError = Object.create(error);\n processedError.message = processedError.message.substring(0, MAX_ERROR_LENGTH);\n return processedError;\n }\n if (typeof error === 'string' && error.length > MAX_ERROR_LENGTH) {\n return error.substring(0, MAX_ERROR_LENGTH);\n }\n return error;\n}\n\n/* Constants used as New Relic page action names. */\nconst pageActionNameInfo = 'INFO';\nconst pageActionNameIgnoredError = 'IGNORED_ERROR';\n\nfunction sendPageAction(actionName, message, customAttributes) {\n if (process.env.NODE_ENV === 'development') {\n console.log(message, customAttributes); // eslint-disable-line\n }\n if (window && typeof window.newrelic !== 'undefined') {\n window.newrelic.addPageAction(actionName, { message, ...customAttributes });\n }\n}\n\nfunction sendError(error, customAttributes) {\n if (process.env.NODE_ENV === 'development') {\n console.error(error, customAttributes); // eslint-disable-line\n }\n if (window && typeof window.newrelic !== 'undefined') {\n window.newrelic.noticeError(fixErrorLength(error), customAttributes);\n }\n}\n\n/**\n * The NewRelicLoggingService is a concrete implementation of the logging service interface that\n * sends messages to NewRelic that can be seen in NewRelic Browser and NewRelic Insights. When in\n * development mode, all messages will instead be sent to the console.\n *\n * When you use `logError`, your errors will be checked to see if they're ignored *or* not.\n * Not-ignored errors will appear under \"JS errors\" for your Browser application.\n *\n * ```\n * SELECT * from JavaScriptError WHERE errorStatus is not null SINCE 10 days ago\n * ```\n *\n * Ignored errors will appear in New Relic Insights as page actions, which can be queried:\n *\n * ```\n * SELECT * from PageAction WHERE actionName = 'IGNORED_ERROR' SINCE 1 hour ago\n * ```\n *\n * When using `logInfo`, these only appear in New Relic Insights when querying for page actions as\n * follows:\n *\n * ```\n * SELECT * from PageAction WHERE actionName = 'INFO' SINCE 1 hour ago\n * ```\n *\n * You can also add your own custom metrics as an additional argument, or see the code to find\n * other standard custom attributes.\n *\n * Requires the NewRelic Browser JavaScript snippet.\n *\n * @implements {LoggingService}\n * @memberof module:Logging\n */\nexport default class NewRelicLoggingService {\n constructor(options) {\n const config = options ? options.config : undefined;\n /*\n String which is an explicit error message regex. If an error message matches the regex, the error\n is considered an *ignored* error and submitted to New Relic as a page action - not an error.\n\n Ignored error regexes are configured per frontend application (MFE).\n\n The regex for all ignored errors are represented in the .env files as a single string. If you need to\n ignore multiple errors, use the standard `|` regex syntax.\n\n For example, here's a .env line which ignores two specific errors:\n\n IGNORED_ERROR_REGEX='^\\\\[frontend-auth\\\\] Unimportant Error|Specific non-critical error #[\\\\d]+'\n\n This example would ignore errors with the following messages:\n\n [frontend-app-generic] - Specific non-critical error #45678 happened.\n [frontend-app-generic] - Specific non-critical error #93475 happened.\n [frontend-auth] Unimportant Error: Browser strangeness occurred.\n\n To test your regex additions, use a JS CLI environment (such as node) and run code like this:\n\n x = new RegExp('^\\\\[frontend-auth\\\\] Unimportant Error|Specific non-critical error #[\\\\d]+');\n '[frontend-app-generic] - Specific non-critical error #45678 happened.'.match(x);\n '[frontend-auth] Unimportant Error: Browser strangeness occurred.'.match(x);\n 'This error should not match anything!'.match(x);\n\n For edx.org, add new error message regexes in edx-internal YAML as needed.\n */\n this.ignoredErrorRegexes = config ? config.IGNORED_ERROR_REGEX : undefined;\n }\n\n /**\n *\n *\n * @param {*} infoStringOrErrorObject\n * @param {*} [customAttributes={}]\n * @memberof NewRelicLoggingService\n */\n logInfo(infoStringOrErrorObject, customAttributes = {}) {\n let message = infoStringOrErrorObject;\n let customAttrs = customAttributes;\n if (typeof infoStringOrErrorObject === 'object' && 'message' in infoStringOrErrorObject) {\n /* Caller has passed in an error object to be logged as a page action. */\n /* Extract the attributes and the message. */\n const infoCustomAttributes = infoStringOrErrorObject.customAttributes || {};\n customAttrs = { ...infoCustomAttributes, ...customAttributes };\n message = infoStringOrErrorObject.message;\n }\n sendPageAction(pageActionNameInfo, message, customAttrs);\n }\n\n /**\n *\n *\n * @param {*} errorStringOrObject\n * @param {*} [customAttributes={}]\n * @memberof NewRelicLoggingService\n */\n logError(errorStringOrObject, customAttributes = {}) {\n const errorCustomAttributes = errorStringOrObject.customAttributes || {};\n let allCustomAttributes = { ...errorCustomAttributes, ...customAttributes };\n if (Object.keys(allCustomAttributes).length === 0) {\n // noticeError expects undefined if there are no custom attributes.\n allCustomAttributes = undefined;\n }\n\n /*\n Separate the errors into ignored errors and other errors.\n Ignored errors are logged via adding a page action.\n Other errors are logged via noticeError and count as \"JS Errors\" for the application.\n */\n const errorMessage = errorStringOrObject.message || (typeof errorStringOrObject === 'string' ? errorStringOrObject : '');\n if (this.ignoredErrorRegexes && errorMessage.match(this.ignoredErrorRegexes)) {\n /* ignored error */\n sendPageAction(pageActionNameIgnoredError, errorMessage, allCustomAttributes);\n } else {\n /* error! */\n sendError(errorStringOrObject, allCustomAttributes);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMA,gBAAgB,GAAG,IAAzB;;AAEP,SAASC,cAAT,CAAwBC,KAAxB,EAA+B;EAC7B,IAAIA,KAAK,CAACC,OAAN,IAAiBD,KAAK,CAACC,OAAN,CAAcC,MAAd,GAAuBJ,gBAA5C,EAA8D;IAC5D,IAAMK,cAAc,GAAGC,MAAM,CAACC,MAAP,CAAcL,KAAd,CAAvB;IACAG,cAAc,CAACF,OAAf,GAAyBE,cAAc,CAACF,OAAf,CAAuBK,SAAvB,CAAiC,CAAjC,EAAoCR,gBAApC,CAAzB;IACA,OAAOK,cAAP;EACD;;EACD,IAAI,OAAOH,KAAP,KAAiB,QAAjB,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;;MACA,IAAI,KAAKL,mBAAL,IAA4BS,YAAY,CAACC,KAAb,CAAmB,KAAKV,mBAAxB,CAAhC,EAA8E;QAC5E;QACAjB,cAAc,CAACD,0BAAD,EAA6B2B,YAA7B,EAA2CF,mBAA3C,CAAd;MACD,CAHD,MAGO;QACL;QACAb,SAAS,CAACW,mBAAD,EAAsBE,mBAAtB,CAAT;MACD;IACF;;;;;;SAlFkBX,sB"}
|
|
1
|
+
{"version":3,"file":"NewRelicLoggingService.js","names":["MAX_ERROR_LENGTH","fixErrorLength","error","message","length","processedError","Object","create","substring","pageActionNameInfo","pageActionNameIgnoredError","sendPageAction","actionName","customAttributes","process","env","NODE_ENV","console","log","window","newrelic","addPageAction","_objectSpread","sendError","noticeError","NewRelicLoggingService","options","_classCallCheck","config","undefined","ignoredErrorRegexes","IGNORED_ERROR_REGEX","_createClass","key","value","logInfo","infoStringOrErrorObject","arguments","customAttrs","_typeof","infoCustomAttributes","logError","errorStringOrObject","errorCustomAttributes","allCustomAttributes","keys","errorMessage","match","default"],"sources":["../../src/logging/NewRelicLoggingService.js"],"sourcesContent":["/**\n * NewRelic will not log an error if it is too long.\n *\n * @ignore\n */\nexport const MAX_ERROR_LENGTH = 4000;\n\nfunction fixErrorLength(error) {\n if (error.message && error.message.length > MAX_ERROR_LENGTH) {\n const processedError = Object.create(error);\n processedError.message = processedError.message.substring(0, MAX_ERROR_LENGTH);\n return processedError;\n }\n if (typeof error === 'string' && error.length > MAX_ERROR_LENGTH) {\n return error.substring(0, MAX_ERROR_LENGTH);\n }\n return error;\n}\n\n/* Constants used as New Relic page action names. */\nconst pageActionNameInfo = 'INFO';\nconst pageActionNameIgnoredError = 'IGNORED_ERROR';\n\nfunction sendPageAction(actionName, message, customAttributes) {\n if (process.env.NODE_ENV === 'development') {\n console.log(message, customAttributes); // eslint-disable-line\n }\n if (window && typeof window.newrelic !== 'undefined') {\n window.newrelic.addPageAction(actionName, { message, ...customAttributes });\n }\n}\n\nfunction sendError(error, customAttributes) {\n if (process.env.NODE_ENV === 'development') {\n console.error(error, customAttributes); // eslint-disable-line\n }\n if (window && typeof window.newrelic !== 'undefined') {\n window.newrelic.noticeError(fixErrorLength(error), customAttributes);\n }\n}\n\n/**\n * The NewRelicLoggingService is a concrete implementation of the logging service interface that\n * sends messages to NewRelic that can be seen in NewRelic Browser and NewRelic Insights. When in\n * development mode, all messages will instead be sent to the console.\n *\n * When you use `logError`, your errors will be checked to see if they're ignored *or* not.\n * Not-ignored errors will appear under \"JS errors\" for your Browser application.\n *\n * ```\n * SELECT * from JavaScriptError WHERE errorStatus is not null SINCE 10 days ago\n * ```\n *\n * Ignored errors will appear in New Relic Insights as page actions, which can be queried:\n *\n * ```\n * SELECT * from PageAction WHERE actionName = 'IGNORED_ERROR' SINCE 1 hour ago\n * ```\n *\n * When using `logInfo`, these only appear in New Relic Insights when querying for page actions as\n * follows:\n *\n * ```\n * SELECT * from PageAction WHERE actionName = 'INFO' SINCE 1 hour ago\n * ```\n *\n * You can also add your own custom metrics as an additional argument, or see the code to find\n * other standard custom attributes.\n *\n * Requires the NewRelic Browser JavaScript snippet.\n *\n * @implements {LoggingService}\n * @memberof module:Logging\n */\nexport default class NewRelicLoggingService {\n constructor(options) {\n const config = options ? options.config : undefined;\n /*\n String which is an explicit error message regex. If an error message matches the regex, the error\n is considered an *ignored* error and submitted to New Relic as a page action - not an error.\n\n Ignored error regexes are configured per frontend application (MFE).\n\n The regex for all ignored errors are represented in the .env files as a single string. If you need to\n ignore multiple errors, use the standard `|` regex syntax.\n\n For example, here's a .env line which ignores two specific errors:\n\n IGNORED_ERROR_REGEX='^\\\\[frontend-auth\\\\] Unimportant Error|Specific non-critical error #[\\\\d]+'\n\n This example would ignore errors with the following messages:\n\n [frontend-app-generic] - Specific non-critical error #45678 happened.\n [frontend-app-generic] - Specific non-critical error #93475 happened.\n [frontend-auth] Unimportant Error: Browser strangeness occurred.\n\n To test your regex additions, use a JS CLI environment (such as node) and run code like this:\n\n x = new RegExp('^\\\\[frontend-auth\\\\] Unimportant Error|Specific non-critical error #[\\\\d]+');\n '[frontend-app-generic] - Specific non-critical error #45678 happened.'.match(x);\n '[frontend-auth] Unimportant Error: Browser strangeness occurred.'.match(x);\n 'This error should not match anything!'.match(x);\n\n For edx.org, add new error message regexes in edx-internal YAML as needed.\n */\n this.ignoredErrorRegexes = config ? config.IGNORED_ERROR_REGEX : undefined;\n }\n\n /**\n *\n *\n * @param {*} infoStringOrErrorObject\n * @param {*} [customAttributes={}]\n * @memberof NewRelicLoggingService\n */\n logInfo(infoStringOrErrorObject, customAttributes = {}) {\n let message = infoStringOrErrorObject;\n let customAttrs = customAttributes;\n if (typeof infoStringOrErrorObject === 'object' && 'message' in infoStringOrErrorObject) {\n /* Caller has passed in an error object to be logged as a page action. */\n /* Extract the attributes and the message. */\n const infoCustomAttributes = infoStringOrErrorObject.customAttributes || {};\n customAttrs = { ...infoCustomAttributes, ...customAttributes };\n message = infoStringOrErrorObject.message;\n }\n sendPageAction(pageActionNameInfo, message, customAttrs);\n }\n\n /**\n *\n *\n * @param {*} errorStringOrObject\n * @param {*} [customAttributes={}]\n * @memberof NewRelicLoggingService\n */\n logError(errorStringOrObject, customAttributes = {}) {\n const errorCustomAttributes = errorStringOrObject.customAttributes || {};\n let allCustomAttributes = { ...errorCustomAttributes, ...customAttributes };\n if (Object.keys(allCustomAttributes).length === 0) {\n // noticeError expects undefined if there are no custom attributes.\n allCustomAttributes = undefined;\n }\n\n /*\n Separate the errors into ignored errors and other errors.\n Ignored errors are logged via adding a page action.\n Other errors are logged via noticeError and count as \"JS Errors\" for the application.\n */\n const errorMessage = errorStringOrObject.message || (typeof errorStringOrObject === 'string' ? errorStringOrObject : '');\n if (this.ignoredErrorRegexes && errorMessage.match(this.ignoredErrorRegexes)) {\n /* ignored error */\n sendPageAction(pageActionNameIgnoredError, errorMessage, allCustomAttributes);\n } else {\n /* error! */\n sendError(errorStringOrObject, allCustomAttributes);\n }\n }\n}\n"],"mappings":";;;;;;;;;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QAC9DV,OAAO,GAAGiC,uBAAuB,CAACjC,OAAO;MAC3C;MACAQ,cAAc,CAACF,kBAAkB,EAAEN,OAAO,EAAEmC,WAAW,CAAC;IAC1D;;IAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE;IAAAL,GAAA;IAAAC,KAAA,EAOA,SAAAO,SAASC,mBAAmB,EAAyB;MAAA,IAAvB7B,gBAAgB,GAAAwB,SAAA,CAAAjC,MAAA,QAAAiC,SAAA,QAAAR,SAAA,GAAAQ,SAAA,MAAG,CAAC,CAAC;MACjD,IAAMM,qBAAqB,GAAGD,mBAAmB,CAAC7B,gBAAgB,IAAI,CAAC,CAAC;MACxE,IAAI+B,mBAAmB,GAAAtB,aAAA,CAAAA,aAAA,KAAQqB,qBAAqB,GAAK9B,gBAAgB,CAAE;MAC3E,IAAIP,MAAM,CAACuC,IAAI,CAACD,mBAAmB,CAAC,CAACxC,MAAM,KAAK,CAAC,EAAE;QACjD;QACAwC,mBAAmB,GAAGf,SAAS;MACjC;;MAEA;AACJ;AACA;AACA;AACA;MACI,IAAMiB,YAAY,GAAGJ,mBAAmB,CAACvC,OAAO,KAAK,OAAOuC,mBAAmB,KAAK,QAAQ,GAAGA,mBAAmB,GAAG,EAAE,CAAC;MACxH,IAAI,IAAI,CAACZ,mBAAmB,IAAIgB,YAAY,CAACC,KAAK,CAAC,IAAI,CAACjB,mBAAmB,CAAC,EAAE;QAC5E;QACAnB,cAAc,CAACD,0BAA0B,EAAEoC,YAAY,EAAEF,mBAAmB,CAAC;MAC/E,CAAC,MAAM;QACL;QACArB,SAAS,CAACmB,mBAAmB,EAAEE,mBAAmB,CAAC;MACrD;IACF;EAAC;EAAA,OAAAnB,sBAAA;AAAA;AAAA,SAlFkBA,sBAAsB,IAAAuB,OAAA"}
|
package/logging/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getLoggingService","resetLoggingService","configure","logInfo","logError","default","NewRelicLoggingService","MockLoggingService"],"sources":["../../src/logging/index.js"],"sourcesContent":["export {\n getLoggingService,\n resetLoggingService,\n configure,\n logInfo,\n logError,\n} from './interface';\nexport { default as NewRelicLoggingService } from './NewRelicLoggingService';\nexport { default as MockLoggingService } from './MockLoggingService';\n"],"mappings":"AAAA,SACEA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["getLoggingService","resetLoggingService","configure","logInfo","logError","default","NewRelicLoggingService","MockLoggingService"],"sources":["../../src/logging/index.js"],"sourcesContent":["export {\n getLoggingService,\n resetLoggingService,\n configure,\n logInfo,\n logError,\n} from './interface';\nexport { default as NewRelicLoggingService } from './NewRelicLoggingService';\nexport { default as MockLoggingService } from './MockLoggingService';\n"],"mappings":"AAAA,SACEA,iBAAiB,EACjBC,mBAAmB,EACnBC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,aAAa;AACpB,SAASC,OAAO,IAAIC,sBAAsB,QAAQ,0BAA0B;AAC5E,SAASD,OAAO,IAAIE,kBAAkB,QAAQ,sBAAsB"}
|
package/logging/interface.js
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
*
|
|
26
26
|
* @module Logging
|
|
27
27
|
*/
|
|
28
|
+
|
|
28
29
|
import PropTypes from 'prop-types';
|
|
29
30
|
var optionsShape = {
|
|
30
31
|
config: PropTypes.object.isRequired
|
|
@@ -34,16 +35,17 @@ var serviceShape = {
|
|
|
34
35
|
logError: PropTypes.func.isRequired
|
|
35
36
|
};
|
|
36
37
|
var service = null;
|
|
38
|
+
|
|
37
39
|
/**
|
|
38
40
|
*
|
|
39
41
|
*/
|
|
40
|
-
|
|
41
42
|
export function configure(LoggingService, options) {
|
|
42
43
|
PropTypes.checkPropTypes(optionsShape, options, 'property', 'Logging');
|
|
43
44
|
service = new LoggingService(options);
|
|
44
45
|
PropTypes.checkPropTypes(serviceShape, service, 'property', 'LoggingService');
|
|
45
46
|
return service;
|
|
46
47
|
}
|
|
48
|
+
|
|
47
49
|
/**
|
|
48
50
|
* Logs a message to the 'info' log level. Can accept custom attributes as a property of the error
|
|
49
51
|
* object, or as an optional second parameter.
|
|
@@ -51,10 +53,10 @@ export function configure(LoggingService, options) {
|
|
|
51
53
|
* @param {string|Error} infoStringOrErrorObject
|
|
52
54
|
* @param {Object} [customAttributes={}]
|
|
53
55
|
*/
|
|
54
|
-
|
|
55
56
|
export function logInfo(infoStringOrErrorObject, customAttributes) {
|
|
56
57
|
return service.logInfo(infoStringOrErrorObject, customAttributes);
|
|
57
58
|
}
|
|
59
|
+
|
|
58
60
|
/**
|
|
59
61
|
* Logs a message to the 'error' log level. Can accept custom attributes as a property of the error
|
|
60
62
|
* object, or as an optional second parameter.
|
|
@@ -62,31 +64,30 @@ export function logInfo(infoStringOrErrorObject, customAttributes) {
|
|
|
62
64
|
* @param {string|Error} errorStringOrObject
|
|
63
65
|
* @param {Object} [customAttributes={}]
|
|
64
66
|
*/
|
|
65
|
-
|
|
66
67
|
export function logError(errorStringOrObject, customAttributes) {
|
|
67
68
|
return service.logError(errorStringOrObject, customAttributes);
|
|
68
69
|
}
|
|
70
|
+
|
|
69
71
|
/**
|
|
70
72
|
*
|
|
71
73
|
* @throws {Error} Thrown if the logging service has not yet been configured via {@link configure}.
|
|
72
74
|
* @returns {LoggingService}
|
|
73
75
|
*/
|
|
74
|
-
|
|
75
76
|
export function getLoggingService() {
|
|
76
77
|
if (!service) {
|
|
77
78
|
throw Error('You must first configure the logging service.');
|
|
78
79
|
}
|
|
79
|
-
|
|
80
80
|
return service;
|
|
81
81
|
}
|
|
82
|
+
|
|
82
83
|
/**
|
|
83
84
|
* Sets the configured logging service back to null.
|
|
84
85
|
*
|
|
85
86
|
*/
|
|
86
|
-
|
|
87
87
|
export function resetLoggingService() {
|
|
88
88
|
service = null;
|
|
89
89
|
}
|
|
90
|
+
|
|
90
91
|
/**
|
|
91
92
|
* @name LoggingService
|
|
92
93
|
* @interface
|
package/logging/interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","names":["PropTypes","optionsShape","config","object","isRequired","serviceShape","logInfo","func","logError","service","configure","LoggingService","options","checkPropTypes","infoStringOrErrorObject","customAttributes","errorStringOrObject","getLoggingService","Error","resetLoggingService"],"sources":["../../src/logging/interface.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform/logging**\n *\n * Contains a shared interface for logging information. (The default implementation is in\n * NewRelicLoggingService.js.) When in development mode, all messages will instead be sent to the console.\n *\n * The `initialize` function performs much of the logging configuration for you. If, however,\n * you're not using the `initialize` function, logging (via New Relic) can be configured via:\n *\n * ```\n * import { configure, NewRelicLoggingService, logInfo, logError } from '@edx/frontend-platform/logging';\n * import { geConfig } from '@edx/frontend-platform';\n *\n * configureLogging(NewRelicLoggingService, {\n * config: getConfig(),\n * });\n *\n * logInfo('Just so you know...');\n * logInfo(new Error('Unimportant error'), { type: 'unimportant' });\n * logError('Uhoh!');\n * logError(new Error('Uhoh error!'));\n * ```\n *\n * As shown in this example, logging depends on the configuration document.\n *\n * @module Logging\n */\n\nimport PropTypes from 'prop-types';\n\nconst optionsShape = {\n config: PropTypes.object.isRequired,\n};\n\nconst serviceShape = {\n logInfo: PropTypes.func.isRequired,\n logError: PropTypes.func.isRequired,\n};\n\nlet service = null;\n\n/**\n *\n */\nexport function configure(LoggingService, options) {\n PropTypes.checkPropTypes(optionsShape, options, 'property', 'Logging');\n service = new LoggingService(options);\n PropTypes.checkPropTypes(serviceShape, service, 'property', 'LoggingService');\n return service;\n}\n\n/**\n * Logs a message to the 'info' log level. Can accept custom attributes as a property of the error\n * object, or as an optional second parameter.\n *\n * @param {string|Error} infoStringOrErrorObject\n * @param {Object} [customAttributes={}]\n */\nexport function logInfo(infoStringOrErrorObject, customAttributes) {\n return service.logInfo(infoStringOrErrorObject, customAttributes);\n}\n\n/**\n * Logs a message to the 'error' log level. Can accept custom attributes as a property of the error\n * object, or as an optional second parameter.\n *\n * @param {string|Error} errorStringOrObject\n * @param {Object} [customAttributes={}]\n */\nexport function logError(errorStringOrObject, customAttributes) {\n return service.logError(errorStringOrObject, customAttributes);\n}\n\n/**\n *\n * @throws {Error} Thrown if the logging service has not yet been configured via {@link configure}.\n * @returns {LoggingService}\n */\nexport function getLoggingService() {\n if (!service) {\n throw Error('You must first configure the logging service.');\n }\n return service;\n}\n\n/**\n * Sets the configured logging service back to null.\n *\n */\nexport function resetLoggingService() {\n service = null;\n}\n\n/**\n * @name LoggingService\n * @interface\n * @memberof module:Logging\n * @property {function} logError\n * @property {function} logInfo\n */\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"file":"interface.js","names":["PropTypes","optionsShape","config","object","isRequired","serviceShape","logInfo","func","logError","service","configure","LoggingService","options","checkPropTypes","infoStringOrErrorObject","customAttributes","errorStringOrObject","getLoggingService","Error","resetLoggingService"],"sources":["../../src/logging/interface.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform/logging**\n *\n * Contains a shared interface for logging information. (The default implementation is in\n * NewRelicLoggingService.js.) When in development mode, all messages will instead be sent to the console.\n *\n * The `initialize` function performs much of the logging configuration for you. If, however,\n * you're not using the `initialize` function, logging (via New Relic) can be configured via:\n *\n * ```\n * import { configure, NewRelicLoggingService, logInfo, logError } from '@edx/frontend-platform/logging';\n * import { geConfig } from '@edx/frontend-platform';\n *\n * configureLogging(NewRelicLoggingService, {\n * config: getConfig(),\n * });\n *\n * logInfo('Just so you know...');\n * logInfo(new Error('Unimportant error'), { type: 'unimportant' });\n * logError('Uhoh!');\n * logError(new Error('Uhoh error!'));\n * ```\n *\n * As shown in this example, logging depends on the configuration document.\n *\n * @module Logging\n */\n\nimport PropTypes from 'prop-types';\n\nconst optionsShape = {\n config: PropTypes.object.isRequired,\n};\n\nconst serviceShape = {\n logInfo: PropTypes.func.isRequired,\n logError: PropTypes.func.isRequired,\n};\n\nlet service = null;\n\n/**\n *\n */\nexport function configure(LoggingService, options) {\n PropTypes.checkPropTypes(optionsShape, options, 'property', 'Logging');\n service = new LoggingService(options);\n PropTypes.checkPropTypes(serviceShape, service, 'property', 'LoggingService');\n return service;\n}\n\n/**\n * Logs a message to the 'info' log level. Can accept custom attributes as a property of the error\n * object, or as an optional second parameter.\n *\n * @param {string|Error} infoStringOrErrorObject\n * @param {Object} [customAttributes={}]\n */\nexport function logInfo(infoStringOrErrorObject, customAttributes) {\n return service.logInfo(infoStringOrErrorObject, customAttributes);\n}\n\n/**\n * Logs a message to the 'error' log level. Can accept custom attributes as a property of the error\n * object, or as an optional second parameter.\n *\n * @param {string|Error} errorStringOrObject\n * @param {Object} [customAttributes={}]\n */\nexport function logError(errorStringOrObject, customAttributes) {\n return service.logError(errorStringOrObject, customAttributes);\n}\n\n/**\n *\n * @throws {Error} Thrown if the logging service has not yet been configured via {@link configure}.\n * @returns {LoggingService}\n */\nexport function getLoggingService() {\n if (!service) {\n throw Error('You must first configure the logging service.');\n }\n return service;\n}\n\n/**\n * Sets the configured logging service back to null.\n *\n */\nexport function resetLoggingService() {\n service = null;\n}\n\n/**\n * @name LoggingService\n * @interface\n * @memberof module:Logging\n * @property {function} logError\n * @property {function} logInfo\n */\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,YAAY;AAElC,IAAMC,YAAY,GAAG;EACnBC,MAAM,EAAEF,SAAS,CAACG,MAAM,CAACC;AAC3B,CAAC;AAED,IAAMC,YAAY,GAAG;EACnBC,OAAO,EAAEN,SAAS,CAACO,IAAI,CAACH,UAAU;EAClCI,QAAQ,EAAER,SAAS,CAACO,IAAI,CAACH;AAC3B,CAAC;AAED,IAAIK,OAAO,GAAG,IAAI;;AAElB;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAACC,cAAc,EAAEC,OAAO,EAAE;EACjDZ,SAAS,CAACa,cAAc,CAACZ,YAAY,EAAEW,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC;EACtEH,OAAO,GAAG,IAAIE,cAAc,CAACC,OAAO,CAAC;EACrCZ,SAAS,CAACa,cAAc,CAACR,YAAY,EAAEI,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC;EAC7E,OAAOA,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASH,OAAOA,CAACQ,uBAAuB,EAAEC,gBAAgB,EAAE;EACjE,OAAON,OAAO,CAACH,OAAO,CAACQ,uBAAuB,EAAEC,gBAAgB,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASP,QAAQA,CAACQ,mBAAmB,EAAED,gBAAgB,EAAE;EAC9D,OAAON,OAAO,CAACD,QAAQ,CAACQ,mBAAmB,EAAED,gBAAgB,CAAC;AAChE;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,iBAAiBA,CAAA,EAAG;EAClC,IAAI,CAACR,OAAO,EAAE;IACZ,MAAMS,KAAK,CAAC,+CAA+C,CAAC;EAC9D;EACA,OAAOT,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASU,mBAAmBA,CAAA,EAAG;EACpCV,OAAO,GAAG,IAAI;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edx/frontend-platform",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Foundational application framework for Open edX micro-frontend applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@edx/brand": "npm:@edx/brand-openedx@1.2.0",
|
|
35
35
|
"@edx/browserslist-config": "1.1.1",
|
|
36
|
-
"@edx/frontend-build": "12.
|
|
37
|
-
"@edx/paragon": "20.28.
|
|
36
|
+
"@edx/frontend-build": "12.7.0",
|
|
37
|
+
"@edx/paragon": "20.28.5",
|
|
38
38
|
"@testing-library/react-hooks": "^8.0.1",
|
|
39
39
|
"axios-mock-adapter": "1.21.2",
|
|
40
|
-
"core-js": "3.29.
|
|
40
|
+
"core-js": "3.29.1",
|
|
41
41
|
"enzyme": "3.11.0",
|
|
42
42
|
"enzyme-adapter-react-16": "1.15.7",
|
|
43
43
|
"husky": "8.0.3",
|
package/pubSub.js
CHANGED
|
@@ -16,31 +16,32 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @module PubSub
|
|
18
18
|
*/
|
|
19
|
+
|
|
19
20
|
import PubSub from 'pubsub-js';
|
|
21
|
+
|
|
20
22
|
/**
|
|
21
23
|
*
|
|
22
24
|
* @param {string} type
|
|
23
25
|
* @param {function} callback
|
|
24
26
|
* @returns {string} A subscription token that can be passed to `unsubscribe`
|
|
25
27
|
*/
|
|
26
|
-
|
|
27
28
|
export function subscribe(type, callback) {
|
|
28
29
|
return PubSub.subscribe(type, callback);
|
|
29
30
|
}
|
|
31
|
+
|
|
30
32
|
/**
|
|
31
33
|
*
|
|
32
34
|
* @param {string} token A subscription token provided by `subscribe`
|
|
33
35
|
*/
|
|
34
|
-
|
|
35
36
|
export function unsubscribe(token) {
|
|
36
37
|
return PubSub.unsubscribe(token);
|
|
37
38
|
}
|
|
39
|
+
|
|
38
40
|
/**
|
|
39
41
|
*
|
|
40
42
|
* @param {string} type
|
|
41
43
|
* @param {Object} data
|
|
42
44
|
*/
|
|
43
|
-
|
|
44
45
|
export function publish(type, data) {
|
|
45
46
|
return PubSub.publish(type, data);
|
|
46
47
|
}
|
package/pubSub.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pubSub.js","names":["PubSub","subscribe","type","callback","unsubscribe","token","publish","data"],"sources":["../src/pubSub.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform**\n *\n * The PubSub module is a thin wrapper around the base functionality of\n * [PubSubJS](https://github.com/mroderick/PubSubJS). For the sake of simplicity and not relying\n * too heavily on implementation-specific features, it maintains a fairly simple API (subscribe,\n * unsubscribe, and publish).\n *\n * Publish/Subscribe events should be used mindfully, especially in relation to application UI\n * frameworks like React. Given React's unidirectional data flow and prop/state management\n * capabilities, using a pub/sub mechanism is at odds with that framework's best practices.\n *\n * That said, we use pub/sub in our application initialization sequence to allow applications to\n * hook into the initialization lifecycle, and we also use them to publish when the application\n * state has changed, i.e., when the config document or user's authentication state have changed.\n *\n * @module PubSub\n */\n\nimport PubSub from 'pubsub-js';\n\n/**\n *\n * @param {string} type\n * @param {function} callback\n * @returns {string} A subscription token that can be passed to `unsubscribe`\n */\nexport function subscribe(type, callback) {\n return PubSub.subscribe(type, callback);\n}\n\n/**\n *\n * @param {string} token A subscription token provided by `subscribe`\n */\nexport function unsubscribe(token) {\n return PubSub.unsubscribe(token);\n}\n\n/**\n *\n * @param {string} type\n * @param {Object} data\n */\nexport function publish(type, data) {\n return PubSub.publish(type, data);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"file":"pubSub.js","names":["PubSub","subscribe","type","callback","unsubscribe","token","publish","data"],"sources":["../src/pubSub.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform**\n *\n * The PubSub module is a thin wrapper around the base functionality of\n * [PubSubJS](https://github.com/mroderick/PubSubJS). For the sake of simplicity and not relying\n * too heavily on implementation-specific features, it maintains a fairly simple API (subscribe,\n * unsubscribe, and publish).\n *\n * Publish/Subscribe events should be used mindfully, especially in relation to application UI\n * frameworks like React. Given React's unidirectional data flow and prop/state management\n * capabilities, using a pub/sub mechanism is at odds with that framework's best practices.\n *\n * That said, we use pub/sub in our application initialization sequence to allow applications to\n * hook into the initialization lifecycle, and we also use them to publish when the application\n * state has changed, i.e., when the config document or user's authentication state have changed.\n *\n * @module PubSub\n */\n\nimport PubSub from 'pubsub-js';\n\n/**\n *\n * @param {string} type\n * @param {function} callback\n * @returns {string} A subscription token that can be passed to `unsubscribe`\n */\nexport function subscribe(type, callback) {\n return PubSub.subscribe(type, callback);\n}\n\n/**\n *\n * @param {string} token A subscription token provided by `subscribe`\n */\nexport function unsubscribe(token) {\n return PubSub.unsubscribe(token);\n}\n\n/**\n *\n * @param {string} type\n * @param {Object} data\n */\nexport function publish(type, data) {\n return PubSub.publish(type, data);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,WAAW;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAACC,IAAI,EAAEC,QAAQ,EAAE;EACxC,OAAOH,MAAM,CAACC,SAAS,CAACC,IAAI,EAAEC,QAAQ,CAAC;AACzC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAACC,KAAK,EAAE;EACjC,OAAOL,MAAM,CAACI,WAAW,CAACC,KAAK,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CAACJ,IAAI,EAAEK,IAAI,EAAE;EAClC,OAAOP,MAAM,CAACM,OAAO,CAACJ,IAAI,EAAEK,IAAI,CAAC;AACnC"}
|
package/react/AppContext.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* `AppContext` provides data from `App` in a way that React components can readily consume, even
|
|
4
5
|
* if it's mutable data. `AppContext` contains the following data structure:
|
|
@@ -15,7 +16,6 @@ import React from 'react';
|
|
|
15
16
|
* `AppContext` is used in a React application like any other `[React Context](https://reactjs.org/docs/context.html)
|
|
16
17
|
* @memberof module:React
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
19
|
var AppContext = /*#__PURE__*/React.createContext({
|
|
20
20
|
authenticatedUser: null,
|
|
21
21
|
config: {}
|
package/react/AppContext.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppContext.js","names":["React","AppContext","createContext","authenticatedUser","config"],"sources":["../../src/react/AppContext.jsx"],"sourcesContent":["import React from 'react';\n\n/**\n * `AppContext` provides data from `App` in a way that React components can readily consume, even\n * if it's mutable data. `AppContext` contains the following data structure:\n *\n * ```\n * {\n * authenticatedUser: <THE App.authenticatedUser OBJECT>,\n * config: <THE App.config OBJECT>\n * }\n * ```\n * If the `App.authenticatedUser` or `App.config` data changes, `AppContext` will be updated\n * accordingly and pass those changes onto React components using the context.\n *\n * `AppContext` is used in a React application like any other `[React Context](https://reactjs.org/docs/context.html)\n * @memberof module:React\n */\nconst AppContext = React.createContext({\n authenticatedUser: null,\n config: {},\n});\n\nexport default AppContext;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"AppContext.js","names":["React","AppContext","createContext","authenticatedUser","config"],"sources":["../../src/react/AppContext.jsx"],"sourcesContent":["import React from 'react';\n\n/**\n * `AppContext` provides data from `App` in a way that React components can readily consume, even\n * if it's mutable data. `AppContext` contains the following data structure:\n *\n * ```\n * {\n * authenticatedUser: <THE App.authenticatedUser OBJECT>,\n * config: <THE App.config OBJECT>\n * }\n * ```\n * If the `App.authenticatedUser` or `App.config` data changes, `AppContext` will be updated\n * accordingly and pass those changes onto React components using the context.\n *\n * `AppContext` is used in a React application like any other `[React Context](https://reactjs.org/docs/context.html)\n * @memberof module:React\n */\nconst AppContext = React.createContext({\n authenticatedUser: null,\n config: {},\n});\n\nexport default AppContext;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,UAAU,gBAAGD,KAAK,CAACE,aAAa,CAAC;EACrCC,iBAAiB,EAAE,IAAI;EACvBC,MAAM,EAAE,CAAC;AACX,CAAC,CAAC;AAEF,eAAeH,UAAU"}
|