@edx/frontend-platform 1.15.6 → 2.1.1
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.map +1 -1
- package/analytics/SegmentAnalyticsService.js.map +1 -1
- package/analytics/index.js.map +1 -1
- package/analytics/interface.js.map +1 -1
- package/auth/AxiosCsrfTokenService.js.map +1 -1
- package/auth/AxiosJwtAuthService.js.map +1 -1
- package/auth/AxiosJwtTokenService.js.map +1 -1
- package/auth/LocalForageCache.js.map +1 -1
- package/auth/MockAuthService.js.map +1 -1
- package/auth/index.js.map +1 -1
- package/auth/interceptors/createCsrfTokenProviderInterceptor.js.map +1 -1
- package/auth/interceptors/createJwtTokenProviderInterceptor.js.map +1 -1
- package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js.map +1 -1
- package/auth/interceptors/createRetryInterceptor.js.map +1 -1
- package/auth/interface.js.map +1 -1
- package/auth/utils.js.map +1 -1
- package/config.js.map +1 -1
- package/constants.js.map +1 -1
- package/i18n/countries.js.map +1 -1
- package/i18n/index.js +12 -18
- package/i18n/index.js.map +1 -1
- package/i18n/injectIntlWithShim.js +2 -2
- package/i18n/injectIntlWithShim.js.map +1 -1
- package/i18n/languages.js.map +1 -1
- package/i18n/lib.js +42 -17
- package/i18n/lib.js.map +1 -1
- package/i18n/scripts/README.md +25 -0
- package/i18n/scripts/transifex-utils.js.map +1 -1
- package/index.js.map +1 -1
- package/initialize.js.map +1 -1
- package/logging/MockLoggingService.js.map +1 -1
- package/logging/NewRelicLoggingService.js.map +1 -1
- package/logging/index.js.map +1 -1
- package/logging/interface.js.map +1 -1
- package/package.json +10 -9
- package/pubSub.js.map +1 -1
- package/react/AppContext.js.map +1 -1
- package/react/AppProvider.js +4 -4
- package/react/AppProvider.js.map +1 -1
- package/react/AuthenticatedPageRoute.js.map +1 -1
- package/react/ErrorBoundary.js.map +1 -1
- package/react/ErrorPage.js.map +1 -1
- package/react/LoginRedirect.js.map +1 -1
- package/react/OptionalReduxProvider.js.map +1 -1
- package/react/PageRoute.js.map +1 -1
- package/react/hooks.js.map +1 -1
- package/react/index.js.map +1 -1
- package/testing/index.js.map +1 -1
- package/testing/initializeMockApp.js.map +1 -1
- package/testing/mockMessages.js.map +1 -1
- package/utils.js.map +1 -1
- package/i18n/scripts/Makefile +0 -39
package/initialize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/initialize.js"],"names":["createBrowserHistory","createMemoryHistory","publish","getConfig","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","history","window","basename","PUBLIC_PATH","initError","error","auth","requireUser","hydrateUser","global","location","href","analytics","authenticatedUser","userId","applyOverrideHandlers","overrides","noOp","pubSub","config","logging","i18n","ready","initialize","loggingService","analyticsService","authService","requireAuthenticatedUser","messages","handlers","overrideHandlers","httpClient","isRedirecting"],"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;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,SAASC,SAAT,QAA0B,UAA1B;AACA,SACEC,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AAS,EADkB;AAEnCkD,cAAAA,cAAc,EAAE/C,iBAAiB,EAFE;AAGnCsD,cAAAA,UAAU,EAAE/C,0BAA0B;AAHH,aAAnB,CAAlB;AAnCG;AAAA,mBAwCG6C,QAAQ,CAACjB,SAAT,EAxCH;;AAAA;AAyCHvC,YAAAA,OAAO,CAACwB,yBAAD,CAAP,CAzCG,CA2CH;;AACAN,YAAAA,aAAa,CAAC;AACZqC,cAAAA,QAAQ,EAARA,QADY;AAEZT,cAAAA,MAAM,EAAE7C,SAAS,EAFL;AAGZkD,cAAAA,cAAc,EAAE/C,iBAAiB;AAHrB,aAAD,CAAb;AA5CG;AAAA,mBAiDGoD,QAAQ,CAACR,IAAT,EAjDH;;AAAA;AAkDHhD,YAAAA,OAAO,CAACsB,oBAAD,CAAP,CAlDG,CAoDH;;AApDG;AAAA,mBAqDGkC,QAAQ,CAACP,KAAT,EArDH;;AAAA;AAsDHjD,YAAAA,OAAO,CAACyB,SAAD,CAAP;AAtDG;AAAA;;AAAA;AAAA;AAAA;;AAAA,gBAwDE,aAAMkC,aAxDR;AAAA;AAAA;AAAA;;AAAA;AAAA,mBA0DKH,QAAQ,CAACzB,SAAT,cA1DL;;AAAA;AA2DD/B,YAAAA,OAAO,CAAC0B,cAAD,eAAP;;AA3DC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","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 { getConfig } 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';\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/**\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.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 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 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 });\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"],"file":"initialize.js"}
|
|
1
|
+
{"version":3,"file":"initialize.js","names":["createBrowserHistory","createMemoryHistory","publish","getConfig","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","history","window","basename","PUBLIC_PATH","initError","error","auth","requireUser","hydrateUser","global","location","href","analytics","authenticatedUser","userId","applyOverrideHandlers","overrides","noOp","pubSub","config","logging","i18n","ready","initialize","loggingService","analyticsService","authService","requireAuthenticatedUser","messages","handlers","overrideHandlers","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 { getConfig } 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';\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/**\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.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 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 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 });\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":";;;;;;;;;;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;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,SAASC,SAAT,QAA0B,UAA1B;AACA,SACEC,SAAS,IAAIC,gBADf,EACiCC,iBADjC,EACoDC,sBADpD,EAC4EC,QAD5E,QAEO,WAFP;AAGA,SACEJ,SAAS,IAAIK,kBADf,EACmCC,uBADnC,EAC4DC,qBAD5D,EACmFC,yBADnF,QAEO,aAFP;AAGA,SACEC,0BADF,EAEET,SAAS,IAAIU,aAFf,EAGEC,uBAHF,EAIEC,sBAJF,EAKEC,wBALF,EAMEC,oBANF,EAOEC,mBAPF,QAQO,QARP;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KAAT,EArDH;;UAAA;YAsDHjD,OAAO,CAACyB,SAAD,CAAP;YAtDG;YAAA;;UAAA;YAAA;YAAA;;YAAA,IAwDE,aAAMkC,aAxDR;cAAA;cAAA;YAAA;;YAAA;YAAA,OA0DKH,QAAQ,CAACzB,SAAT,cA1DL;;UAAA;YA2DD/B,OAAO,CAAC0B,cAAD,eAAP;;UA3DC;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;IACMA,kB;;;mCAMMC,IAAI,CAACC,EAAL,E;;oCAOCD,IAAI,CAACC,EAAL,E;;;AAGb,eAAeF,kBAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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,IAA6BA,KAAK,CAACE,MAAN,GAAeJ,gBAAhD,EAAkE;IAChE,OAAOE,KAAK,CAACM,SAAN,CAAgB,CAAhB,EAAmBR,gBAAnB,CAAP;EACD;;EACD,OAAOE,KAAP;AACD;AAED;;;AACA,IAAMO,kBAAkB,GAAG,MAA3B;AACA,IAAMC,0BAA0B,GAAG,eAAnC;;AAEA,SAASC,cA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;IACF;;;;;;SAlFkBX,sB"}
|
package/logging/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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,iBADF,EAEEC,mBAFF,EAGEC,SAHF,EAIEC,OAJF,EAKEC,QALF,QAMO,aANP;AAOA,SAASC,OAAO,IAAIC,sBAApB,QAAkD,0BAAlD;AACA,SAASD,OAAO,IAAIE,kBAApB,QAA8C,sBAA9C"}
|
package/logging/interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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,SAAP,MAAsB,YAAtB;AAEA,IAAMC,YAAY,GAAG;EACnBC,MAAM,EAAEF,SAAS,CAACG,MAAV,CAAiBC;AADN,CAArB;AAIA,IAAMC,YAAY,GAAG;EACnBC,OAAO,EAAEN,SAAS,CAACO,IAAV,CAAeH,UADL;EAEnBI,QAAQ,EAAER,SAAS,CAACO,IAAV,CAAeH;AAFN,CAArB;AAKA,IAAIK,OAAO,GAAG,IAAd;AAEA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,CAAmBC,cAAnB,EAAmCC,OAAnC,EAA4C;EACjDZ,SAAS,CAACa,cAAV,CAAyBZ,YAAzB,EAAuCW,OAAvC,EAAgD,UAAhD,EAA4D,SAA5D;EACAH,OAAO,GAAG,IAAIE,cAAJ,CAAmBC,OAAnB,CAAV;EACAZ,SAAS,CAACa,cAAV,CAAyBR,YAAzB,EAAuCI,OAAvC,EAAgD,UAAhD,EAA4D,gBAA5D;EACA,OAAOA,OAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASH,OAAT,CAAiBQ,uBAAjB,EAA0CC,gBAA1C,EAA4D;EACjE,OAAON,OAAO,CAACH,OAAR,CAAgBQ,uBAAhB,EAAyCC,gBAAzC,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASP,QAAT,CAAkBQ,mBAAlB,EAAuCD,gBAAvC,EAAyD;EAC9D,OAAON,OAAO,CAACD,QAAR,CAAiBQ,mBAAjB,EAAsCD,gBAAtC,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,iBAAT,GAA6B;EAClC,IAAI,CAACR,OAAL,EAAc;IACZ,MAAMS,KAAK,CAAC,+CAAD,CAAX;EACD;;EACD,OAAOT,OAAP;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASU,mBAAT,GAA+B;EACpCV,OAAO,GAAG,IAAV;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edx/frontend-platform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Foundational application framework for Open edX micro-frontend applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"test:watch": "npm run test -- --watch"
|
|
19
19
|
},
|
|
20
20
|
"bin": {
|
|
21
|
-
"transifex-utils.js": "i18n/scripts/transifex-utils.js"
|
|
22
|
-
"transifex-Makefile": "i18n/scripts/Makefile"
|
|
21
|
+
"transifex-utils.js": "i18n/scripts/transifex-utils.js"
|
|
23
22
|
},
|
|
24
23
|
"repository": {
|
|
25
24
|
"type": "git",
|
|
@@ -33,8 +32,8 @@
|
|
|
33
32
|
"homepage": "https://github.com/edx/frontend-platform#readme",
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@edx/brand": "npm:@edx/brand-openedx@1.1.0",
|
|
36
|
-
"@edx/frontend-build": "9.
|
|
37
|
-
"@edx/paragon": "19.
|
|
35
|
+
"@edx/frontend-build": "9.2.2",
|
|
36
|
+
"@edx/paragon": "19.20.0",
|
|
38
37
|
"axios-mock-adapter": "1.20.0",
|
|
39
38
|
"codecov": "3.8.3",
|
|
40
39
|
"core-js": "3.21.1",
|
|
@@ -42,17 +41,19 @@
|
|
|
42
41
|
"enzyme-adapter-react-16": "1.15.6",
|
|
43
42
|
"husky": "7.0.4",
|
|
44
43
|
"jsdoc": "3.6.10",
|
|
45
|
-
"nodemon": "2.0.
|
|
44
|
+
"nodemon": "2.0.16",
|
|
46
45
|
"prop-types": "15.8.1",
|
|
47
46
|
"react": "16.14.0",
|
|
48
47
|
"react-dom": "16.14.0",
|
|
49
|
-
"react-redux": "7.2.
|
|
50
|
-
"react-router-dom": "5.3.
|
|
48
|
+
"react-redux": "7.2.8",
|
|
49
|
+
"react-router-dom": "5.3.1",
|
|
51
50
|
"redux": "4.1.2",
|
|
52
51
|
"regenerator-runtime": "0.13.9"
|
|
53
52
|
},
|
|
54
53
|
"dependencies": {
|
|
55
54
|
"@cospired/i18n-iso-languages": "2.2.0",
|
|
55
|
+
"@formatjs/intl-pluralrules": "^4.3.3",
|
|
56
|
+
"@formatjs/intl-relativetimeformat": "^10.0.1",
|
|
56
57
|
"axios": "0.26.1",
|
|
57
58
|
"axios-cache-adapter": "2.7.3",
|
|
58
59
|
"form-urlencoded": "4.1.4",
|
|
@@ -67,7 +68,7 @@
|
|
|
67
68
|
"lodash.merge": "4.6.2",
|
|
68
69
|
"lodash.snakecase": "4.1.1",
|
|
69
70
|
"pubsub-js": "1.9.4",
|
|
70
|
-
"react-intl": "
|
|
71
|
+
"react-intl": "^5.25.0",
|
|
71
72
|
"universal-cookie": "4.0.4"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
package/pubSub.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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,MAAP,MAAmB,WAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,CAAmBC,IAAnB,EAAyBC,QAAzB,EAAmC;EACxC,OAAOH,MAAM,CAACC,SAAP,CAAiBC,IAAjB,EAAuBC,QAAvB,CAAP;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASC,WAAT,CAAqBC,KAArB,EAA4B;EACjC,OAAOL,MAAM,CAACI,WAAP,CAAmBC,KAAnB,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,OAAT,CAAiBJ,IAAjB,EAAuBK,IAAvB,EAA6B;EAClC,OAAOP,MAAM,CAACM,OAAP,CAAeJ,IAAf,EAAqBK,IAArB,CAAP;AACD"}
|
package/react/AppContext.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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,KAAP,MAAkB,OAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,UAAU,gBAAGD,KAAK,CAACE,aAAN,CAAoB;EACrCC,iBAAiB,EAAE,IADkB;EAErCC,MAAM,EAAE;AAF6B,CAApB,CAAnB;AAKA,eAAeH,UAAf"}
|
package/react/AppProvider.js
CHANGED
|
@@ -77,15 +77,15 @@ export default function AppProvider(_ref) {
|
|
|
77
77
|
useAppEvent(LOCALE_CHANGED, function () {
|
|
78
78
|
setLocale(getLocale());
|
|
79
79
|
});
|
|
80
|
-
return /*#__PURE__*/React.createElement(
|
|
80
|
+
return /*#__PURE__*/React.createElement(IntlProvider, {
|
|
81
|
+
locale: locale,
|
|
82
|
+
messages: getMessages()
|
|
83
|
+
}, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(AppContext.Provider, {
|
|
81
84
|
value: {
|
|
82
85
|
authenticatedUser: authenticatedUser,
|
|
83
86
|
config: config,
|
|
84
87
|
locale: locale
|
|
85
88
|
}
|
|
86
|
-
}, /*#__PURE__*/React.createElement(IntlProvider, {
|
|
87
|
-
locale: locale,
|
|
88
|
-
messages: getMessages()
|
|
89
89
|
}, /*#__PURE__*/React.createElement(OptionalReduxProvider, {
|
|
90
90
|
store: store
|
|
91
91
|
}, /*#__PURE__*/React.createElement(Router, {
|
package/react/AppProvider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"AppProvider.js","names":["React","useState","PropTypes","Router","OptionalReduxProvider","ErrorBoundary","AppContext","useAppEvent","getAuthenticatedUser","AUTHENTICATED_USER_CHANGED","getConfig","CONFIG_CHANGED","history","getLocale","getMessages","IntlProvider","LOCALE_CHANGED","AppProvider","store","children","config","setConfig","authenticatedUser","setAuthenticatedUser","locale","setLocale","propTypes","object","node","isRequired","defaultProps"],"sources":["../../src/react/AppProvider.jsx"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { Router } from 'react-router-dom';\n\nimport OptionalReduxProvider from './OptionalReduxProvider';\n\nimport ErrorBoundary from './ErrorBoundary';\nimport AppContext from './AppContext';\nimport { useAppEvent } from './hooks';\nimport { getAuthenticatedUser, AUTHENTICATED_USER_CHANGED } from '../auth';\nimport { getConfig } from '../config';\nimport { CONFIG_CHANGED } from '../constants';\nimport { history } from '../initialize';\nimport {\n getLocale,\n getMessages,\n IntlProvider,\n LOCALE_CHANGED,\n} from '../i18n';\n\n/**\n * A wrapper component for React-based micro-frontends to initialize a number of common data/\n * context providers.\n *\n * ```\n * subscribe(APP_READY, () => {\n * ReactDOM.render(\n * <AppProvider>\n * <HelloWorld />\n * </AppProvider>\n * )\n * });\n * ```\n *\n * This will provide the following to HelloWorld:\n * - An error boundary as described above.\n * - An `AppContext` provider for React context data.\n * - IntlProvider for @edx/frontend-i18n internationalization\n * - Optionally a redux `Provider`. Will only be included if a `store` property is passed to\n * `AppProvider`.\n * - A `Router` for react-router.\n *\n * @param {Object} props\n * @param {Object} [props.store] A redux store.\n * @memberof module:React\n */\nexport default function AppProvider({ store, children }) {\n const [config, setConfig] = useState(getConfig());\n const [authenticatedUser, setAuthenticatedUser] = useState(getAuthenticatedUser());\n const [locale, setLocale] = useState(getLocale());\n\n useAppEvent(AUTHENTICATED_USER_CHANGED, () => {\n setAuthenticatedUser(getAuthenticatedUser());\n });\n\n useAppEvent(CONFIG_CHANGED, () => {\n setConfig(getConfig());\n });\n\n useAppEvent(LOCALE_CHANGED, () => {\n setLocale(getLocale());\n });\n\n return (\n <IntlProvider locale={locale} messages={getMessages()}>\n <ErrorBoundary>\n <AppContext.Provider\n value={{ authenticatedUser, config, locale }}\n >\n <OptionalReduxProvider store={store}>\n <Router history={history}>\n <>{children}</>\n </Router>\n </OptionalReduxProvider>\n </AppContext.Provider>\n </ErrorBoundary>\n </IntlProvider>\n );\n}\n\nAppProvider.propTypes = {\n // eslint-disable-next-line react/forbid-prop-types\n store: PropTypes.object,\n children: PropTypes.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CAAX;EAIAH,WAAW,CAACS,cAAD,EAAiB,YAAM;IAChCS,SAAS,CAACZ,SAAS,EAAV,CAAT;EACD,CAFU,CAAX;EAIA,oBACE,oBAAC,YAAD;IAAc,MAAM,EAAEW,MAAtB;IAA8B,QAAQ,EAAEV,WAAW;EAAnD,gBACE,oBAAC,aAAD,qBACE,oBAAC,UAAD,CAAY,QAAZ;IACE,KAAK,EAAE;MAAEQ,iBAAiB,EAAjBA,iBAAF;MAAqBF,MAAM,EAANA,MAArB;MAA6BI,MAAM,EAANA;IAA7B;EADT,gBAGE,oBAAC,qBAAD;IAAuB,KAAK,EAAEN;EAA9B,gBACE,oBAAC,MAAD;IAAQ,OAAO,EAAEN;EAAjB,gBACE,0CAAGO,QAAH,CADF,CADF,CAHF,CADF,CADF,CADF;AAeD;AAEDF,WAAW,CAACS,SAAZ,GAAwB;EACtB;EACAR,KAAK,EAAEhB,SAAS,CAACyB,MAFK;EAGtBR,QAAQ,EAAEjB,SAAS,CAAC0B,IAAV,CAAeC;AAHH,CAAxB;AAMAZ,WAAW,CAACa,YAAZ,GAA2B;EACzBZ,KAAK,EAAE;AADkB,CAA3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"AuthenticatedPageRoute.js","names":["React","useContext","PropTypes","useRouteMatch","AppContext","PageRoute","getLoginRedirectUrl","AuthenticatedPageRoute","redirectUrl","props","authenticatedUser","match","path","exact","strict","sensitive","destination","global","location","href","assign","propTypes","string","defaultProps"],"sources":["../../src/react/AuthenticatedPageRoute.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport { useRouteMatch } from 'react-router-dom';\n\nimport AppContext from './AppContext';\nimport PageRoute from './PageRoute';\nimport { getLoginRedirectUrl } from '../auth';\n\n/**\n * A react-router route that redirects to the login page when the route becomes active and the user\n * is not authenticated. If the application has been initialized with `requireAuthenticatedUser`\n * false, an authenticatedPageRoute can be used to protect a subset of the application's routes,\n * rather than the entire application.\n *\n * It can optionally accept an override URL to redirect to instead of the login page.\n *\n * Like a `PageRoute`, also calls `sendPageEvent` when the route becomes active.\n *\n * @see PageRoute\n * @see {@link module:frontend-platform/analytics~sendPageEvent}\n * @memberof module:React\n * @param {Object} props\n * @param {string} props.redirectUrl The URL anonymous users should be redirected to, rather than\n * viewing the route's contents.\n */\nexport default function AuthenticatedPageRoute({ redirectUrl, ...props }) {\n const { authenticatedUser } = useContext(AppContext);\n\n const match = useRouteMatch({\n // eslint-disable-next-line react/prop-types\n path: props.path,\n // eslint-disable-next-line react/prop-types\n exact: props.exact,\n // eslint-disable-next-line react/prop-types\n strict: props.strict,\n // eslint-disable-next-line react/prop-types\n sensitive: props.sensitive,\n });\n\n if (authenticatedUser === null) {\n if (match) {\n const destination = redirectUrl || getLoginRedirectUrl(global.location.href);\n global.location.assign(destination);\n }\n // This emulates a Route's way of displaying nothing if the route's path doesn't match the\n // current URL.\n return null;\n }\n return (\n <PageRoute {...props} />\n );\n}\n\nAuthenticatedPageRoute.propTypes = {\n redirectUrl: PropTypes.string,\n};\n\nAuthenticatedPageRoute.defaultProps = {\n redirectUrl: null,\n};\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,aAAT,QAA8B,kBAA9B;AAEA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,SAAP,MAAsB,aAAtB;AACA,SAASC,mBAAT,QAAoC,SAApC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,sBAAT,OAA2D;EAAA,IAAzBC,WAAyB,QAAzBA,WAAyB;EAAA,IAATC,KAAS;;EACxE,kBAA8BR,UAAU,CAACG,UAAD,CAAxC;EAAA,IAAQM,iBAAR,eAAQA,iBAAR;;EAEA,IAAMC,KAAK,GAAGR,aAAa,CAAC;IAC1B;IACAS,IAAI,EAAEH,KAAK,CAACG,IAFc;IAG1B;IACAC,KAAK,EAAEJ,KAAK,CAACI,KAJa;IAK1B;IACAC,MAAM,EAAEL,KAAK,CAACK,MANY;IAO1B;IACAC,SAAS,EAAEN,KAAK,CAACM;EARS,CAAD,CAA3B;;EAWA,IAAIL,iBAAiB,KAAK,IAA1B,EAAgC;IAC9B,IAAIC,KAAJ,EAAW;MACT,IAAMK,WAAW,GAAGR,WAAW,IAAIF,mBAAmB,CAACW,MAAM,CAACC,QAAP,CAAgBC,IAAjB,CAAtD;MACAF,MAAM,CAACC,QAAP,CAAgBE,MAAhB,CAAuBJ,WAAvB;IACD,CAJ6B,CAK9B;IACA;;;IACA,OAAO,IAAP;EACD;;EACD,oBACE,oBAAC,SAAD,EAAeP,KAAf,CADF;AAGD;AAEDF,sBAAsB,CAACc,SAAvB,GAAmC;EACjCb,WAAW,EAAEN,SAAS,CAACoB;AADU,CAAnC;AAIAf,sBAAsB,CAACgB,YAAvB,GAAsC;EACpCf,WAAW,EAAE;AADuB,CAAtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","names":["React","Component","PropTypes","logError","ErrorPage","ErrorBoundary","props","state","hasError","error","info","stack","componentStack","children","propTypes","node","defaultProps"],"sources":["../../src/react/ErrorBoundary.jsx"],"sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { logError } from '../logging';\n\nimport ErrorPage from './ErrorPage';\n\n/**\n * Error boundary component used to log caught errors and display the error page.\n *\n * @memberof module:React\n * @extends {Component}\n */\nexport default class ErrorBoundary extends Component {\n constructor(props) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError() {\n // Update state so the next render will show the fallback UI.\n return { hasError: true };\n }\n\n componentDidCatch(error, info) {\n logError(error, { stack: info.componentStack });\n }\n\n render() {\n if (this.state.hasError) {\n return <ErrorPage />;\n }\n\n return this.props.children;\n }\n}\n\nErrorBoundary.propTypes = {\n children: PropTypes.node,\n};\n\nErrorBoundary.defaultProps = {\n children: null,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SAASC,QAAT,QAAyB,YAAzB;AAEA,OAAOC,SAAP,MAAsB,aAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;;IACqBC,a;;;;;EACnB,uBAAYC,KAAZ,EAAmB;IAAA;;IAAA;;IACjB,0BAAMA,KAAN;IACA,MAAKC,KAAL,GAAa;MAAEC,QAAQ,EAAE;IAAZ,CAAb;IAFiB;EAGlB;;;;WAOD,2BAAkBC,KAAlB,EAAyBC,IAAzB,EAA+B;MAC7BP,QAAQ,CAACM,KAAD,EAAQ;QAAEE,KAAK,EAAED,IAAI,CAACE;MAAd,CAAR,CAAR;IACD;;;WAED,kBAAS;MACP,IAAI,KAAKL,KAAL,CAAWC,QAAf,EAAyB;QACvB,oBAAO,oBAAC,SAAD,OAAP;MACD;;MAED,OAAO,KAAKF,KAAL,CAAWO,QAAlB;IACD;;;WAfD,oCAAkC;MAChC;MACA,OAAO;QAAEL,QAAQ,EAAE;MAAZ,CAAP;IACD;;;;EATwCP,S;;SAAtBI,a;AAwBrBA,aAAa,CAACS,SAAd,GAA0B;EACxBD,QAAQ,EAAEX,SAAS,CAACa;AADI,CAA1B;AAIAV,aAAa,CAACW,YAAd,GAA6B;EAC3BH,QAAQ,EAAE;AADiB,CAA7B"}
|
package/react/ErrorPage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"ErrorPage.js","names":["React","Component","PropTypes","Button","Container","Row","Col","FormattedMessage","ErrorPage","global","location","reload","message","props","propTypes","string","defaultProps"],"sources":["../../src/react/ErrorPage.jsx"],"sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport {\n Button, Container, Row, Col,\n} from '@edx/paragon';\n\nimport { FormattedMessage } from '../i18n';\n\n/**\n * An error page that displays a generic message for unexpected errors. Also contains a \"Try\n * Again\" button to refresh the page.\n *\n * @memberof module:React\n * @extends {Component}\n */\nclass ErrorPage extends Component {\n /* istanbul ignore next */\n reload() {\n global.location.reload();\n }\n\n render() {\n const { message } = this.props;\n return (\n <Container fluid className=\"py-5 justify-content-center align-items-start text-center\">\n <Row>\n <Col>\n <p className=\"text-muted\">\n <FormattedMessage\n id=\"unexpected.error.message.text\"\n defaultMessage=\"An unexpected error occurred. Please click the button below to refresh the page.\"\n description=\"error message when an unexpected error occurs\"\n />\n </p>\n {message && (\n <div role=\"alert\" className=\"my-4\">\n <p>{message}</p>\n </div>\n )}\n <Button onClick={this.reload}>\n <FormattedMessage\n id=\"unexpected.error.button.text\"\n defaultMessage=\"Try again\"\n description=\"text for button that tries to reload the app by refreshing the page\"\n />\n </Button>\n </Col>\n </Row>\n </Container>\n );\n }\n}\n\nErrorPage.propTypes = {\n message: PropTypes.string,\n};\n\nErrorPage.defaultProps = {\n message: null,\n};\n\nexport default ErrorPage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SACEC,MADF,EACUC,SADV,EACqBC,GADrB,EAC0BC,GAD1B,QAEO,cAFP;AAIA,SAASC,gBAAT,QAAiC,SAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;IACMC,S;;;;;;;;;;;;;;IACJ;IACA,kBAAS;MACPC,MAAM,CAACC,QAAP,CAAgBC,MAAhB;IACD;;;WAED,kBAAS;MACP,IAAQC,OAAR,GAAoB,KAAKC,KAAzB,CAAQD,OAAR;MACA,oBACE,oBAAC,SAAD;QAAW,KAAK,MAAhB;QAAiB,SAAS,EAAC;MAA3B,gBACE,oBAAC,GAAD,qBACE,oBAAC,GAAD,qBACE;QAAG,SAAS,EAAC;MAAb,gBACE,oBAAC,gBAAD;QACE,EAAE,EAAC,+BADL;QAEE,cAAc,EAAC,kFAFjB;QAGE,WAAW,EAAC;MAHd,EADF,CADF,EAQGA,OAAO,iBACN;QAAK,IAAI,EAAC,OAAV;QAAkB,SAAS,EAAC;MAA5B,gBACE,+BAAIA,OAAJ,CADF,CATJ,eAaE,oBAAC,MAAD;QAAQ,OAAO,EAAE,KAAKD;MAAtB,gBACE,oBAAC,gBAAD;QACE,EAAE,EAAC,8BADL;QAEE,cAAc,EAAC,WAFjB;QAGE,WAAW,EAAC;MAHd,EADF,CAbF,CADF,CADF,CADF;IA2BD;;;;EAnCqBV,S;;AAsCxBO,SAAS,CAACM,SAAV,GAAsB;EACpBF,OAAO,EAAEV,SAAS,CAACa;AADC,CAAtB;AAIAP,SAAS,CAACQ,YAAV,GAAyB;EACvBJ,OAAO,EAAE;AADc,CAAzB;AAIA,eAAeJ,SAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"LoginRedirect.js","names":["useEffect","redirectToLogin","LoginRedirect","global","location","href"],"sources":["../../src/react/LoginRedirect.jsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { redirectToLogin } from '../auth';\n\n/**\n * A React component that, when rendered, redirects to the login page as a side effect. Uses\n * `redirectToLogin` to perform the redirect.\n *\n * @see {@link module:frontend-platform/auth~redirectToLogin}\n * @memberof module:React\n */\nexport default function LoginRedirect() {\n useEffect(() => {\n redirectToLogin(global.location.href);\n }, []);\n return null;\n}\n"],"mappings":"AAAA,SAASA,SAAT,QAA0B,OAA1B;AACA,SAASC,eAAT,QAAgC,SAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,aAAT,GAAyB;EACtCF,SAAS,CAAC,YAAM;IACdC,eAAe,CAACE,MAAM,CAACC,QAAP,CAAgBC,IAAjB,CAAf;EACD,CAFQ,EAEN,EAFM,CAAT;EAGA,OAAO,IAAP;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"OptionalReduxProvider.js","names":["React","PropTypes","Provider","OptionalReduxProvider","store","children","propTypes","object","node","isRequired","defaultProps"],"sources":["../../src/react/OptionalReduxProvider.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Provider } from 'react-redux';\n\n/**\n * @memberof module:React\n * @param {Object} props\n */\nexport default function OptionalReduxProvider({ store, children }) {\n if (store === null) {\n return (\n <>{children}</>\n );\n }\n\n return (\n <Provider store={store}>\n {children}\n </Provider>\n );\n}\n\nOptionalReduxProvider.propTypes = {\n store: PropTypes.object, // eslint-disable-line\n children: PropTypes.node.isRequired,\n};\n\nOptionalReduxProvider.defaultProps = {\n store: null,\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,QAAT,QAAyB,aAAzB;AAEA;AACA;AACA;AACA;;AACA,eAAe,SAASC,qBAAT,OAAoD;EAAA,IAAnBC,KAAmB,QAAnBA,KAAmB;EAAA,IAAZC,QAAY,QAAZA,QAAY;;EACjE,IAAID,KAAK,KAAK,IAAd,EAAoB;IAClB,oBACE,0CAAGC,QAAH,CADF;EAGD;;EAED,oBACE,oBAAC,QAAD;IAAU,KAAK,EAAED;EAAjB,GACGC,QADH,CADF;AAKD;AAEDF,qBAAqB,CAACG,SAAtB,GAAkC;EAChCF,KAAK,EAAEH,SAAS,CAACM,MADe;EACP;EACzBF,QAAQ,EAAEJ,SAAS,CAACO,IAAV,CAAeC;AAFO,CAAlC;AAKAN,qBAAqB,CAACO,YAAtB,GAAqC;EACnCN,KAAK,EAAE;AAD4B,CAArC"}
|
package/react/PageRoute.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"PageRoute.js","names":["React","useEffect","Route","useRouteMatch","sendPageEvent","PageRoute","props","match","path","exact","strict","sensitive","JSON","stringify"],"sources":["../../src/react/PageRoute.jsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React, { useEffect } from 'react';\nimport { Route, useRouteMatch } from 'react-router-dom';\nimport { sendPageEvent } from '../analytics';\n\n/**\n * A react-router Route component that calls `sendPageEvent` when it becomes active.\n *\n * @see {@link module:frontend-platform/analytics~sendPageEvent}\n * @memberof module:React\n * @param {Object} props\n */\nexport default function PageRoute(props) {\n const match = useRouteMatch({\n path: props.path,\n exact: props.exact,\n strict: props.strict,\n sensitive: props.sensitive,\n });\n\n useEffect(() => {\n if (match) {\n sendPageEvent();\n }\n }, [JSON.stringify(match)]);\n\n return (\n <Route {...props} />\n );\n}\n"],"mappings":"AAAA;AACA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,KAAT,EAAgBC,aAAhB,QAAqC,kBAArC;AACA,SAASC,aAAT,QAA8B,cAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,SAAT,CAAmBC,KAAnB,EAA0B;EACvC,IAAMC,KAAK,GAAGJ,aAAa,CAAC;IAC1BK,IAAI,EAAEF,KAAK,CAACE,IADc;IAE1BC,KAAK,EAAEH,KAAK,CAACG,KAFa;IAG1BC,MAAM,EAAEJ,KAAK,CAACI,MAHY;IAI1BC,SAAS,EAAEL,KAAK,CAACK;EAJS,CAAD,CAA3B;EAOAV,SAAS,CAAC,YAAM;IACd,IAAIM,KAAJ,EAAW;MACTH,aAAa;IACd;EACF,CAJQ,EAIN,CAACQ,IAAI,CAACC,SAAL,CAAeN,KAAf,CAAD,CAJM,CAAT;EAMA,oBACE,oBAAC,KAAD,EAAWD,KAAX,CADF;AAGD"}
|
package/react/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"hooks.js","names":["useEffect","subscribe","unsubscribe","useAppEvent","type","callback","subscriptionToken","cleanup"],"sources":["../../src/react/hooks.js"],"sourcesContent":["/* eslint-disable import/prefer-default-export */\nimport { useEffect } from 'react';\nimport { subscribe, unsubscribe } from '../pubSub';\n\n/**\n * A React hook that allows functional components to subscribe to application events. This should\n * be used sparingly - for the most part, Context should be used higher-up in the application to\n * provide necessary data to a given component, rather than utilizing a non-React-like Pub/Sub\n * mechanism.\n *\n * @memberof module:React\n * @param {string} type\n * @param {function} callback\n */\nexport const useAppEvent = (type, callback) => {\n useEffect(() => {\n const subscriptionToken = subscribe(type, callback);\n\n return function cleanup() {\n unsubscribe(subscriptionToken);\n };\n }, []);\n};\n"],"mappings":"AAAA;AACA,SAASA,SAAT,QAA0B,OAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,WAAvC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAACC,IAAD,EAAOC,QAAP,EAAoB;EAC7CL,SAAS,CAAC,YAAM;IACd,IAAMM,iBAAiB,GAAGL,SAAS,CAACG,IAAD,EAAOC,QAAP,CAAnC;IAEA,OAAO,SAASE,OAAT,GAAmB;MACxBL,WAAW,CAACI,iBAAD,CAAX;IACD,CAFD;EAGD,CANQ,EAMN,EANM,CAAT;AAOD,CARM"}
|
package/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","AppContext","AppProvider","AuthenticatedPageRoute","ErrorBoundary","ErrorPage","LoginRedirect","PageRoute","useAppEvent"],"sources":["../../src/react/index.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform/react**\n * The React module provides a variety of React components, hooks, and contexts for use in an\n * application.\n *\n * @module React\n */\n\nexport { default as AppContext } from './AppContext';\nexport { default as AppProvider } from './AppProvider';\nexport { default as AuthenticatedPageRoute } from './AuthenticatedPageRoute';\nexport { default as ErrorBoundary } from './ErrorBoundary';\nexport { default as ErrorPage } from './ErrorPage';\nexport { default as LoginRedirect } from './LoginRedirect';\nexport { default as PageRoute } from './PageRoute';\nexport { useAppEvent } from './hooks';\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,OAAO,IAAIC,UAApB,QAAsC,cAAtC;AACA,SAASD,OAAO,IAAIE,WAApB,QAAuC,eAAvC;AACA,SAASF,OAAO,IAAIG,sBAApB,QAAkD,0BAAlD;AACA,SAASH,OAAO,IAAII,aAApB,QAAyC,iBAAzC;AACA,SAASJ,OAAO,IAAIK,SAApB,QAAqC,aAArC;AACA,SAASL,OAAO,IAAIM,aAApB,QAAyC,iBAAzC;AACA,SAASN,OAAO,IAAIO,SAApB,QAAqC,aAArC;AACA,SAASC,WAAT,QAA4B,SAA5B"}
|
package/testing/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","initializeMockApp","mockMessages"],"sources":["../../src/testing/index.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform/testing**\n * The testing module provides helpers for writing tests in Jest.\n *\n * @module Testing\n */\n\nexport { default as initializeMockApp } from './initializeMockApp';\nexport { default as mockMessages } from './mockMessages';\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,OAAO,IAAIC,iBAApB,QAA6C,qBAA7C;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,gBAAxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"initializeMockApp.js","names":["configure","configureAnalytics","MockAnalyticsService","configureI18n","configureLogging","MockLoggingService","configureAuth","MockAuthService","getConfig","mockMessages","initializeMockApp","messages","authenticatedUser","loggingService","config","authService","analyticsService","httpClient","getAuthenticatedHttpClient"],"sources":["../../src/testing/initializeMockApp.js"],"sourcesContent":["import { configure as configureAnalytics, MockAnalyticsService } from '../analytics';\nimport { configure as configureI18n } from '../i18n';\nimport { configure as configureLogging, MockLoggingService } from '../logging';\nimport { configure as configureAuth, MockAuthService } from '../auth';\nimport { getConfig } from '../config';\nimport mockMessages from './mockMessages';\n\n/**\n * Initializes a mock application for component testing. The mock application includes\n * mock analytics, auth, and logging services, and the real i18n service.\n *\n * See MockAnalyticsService, MockAuthService, and MockLoggingService for mock implementation\n * details. For the most part, the analytics and logging services just implement their functions\n * with jest.fn() and do nothing else, whereas the MockAuthService actually has some behavior\n * implemented, it just doesn't make any HTTP calls.\n *\n * Note that this mock application is not sufficient for testing the full application lifecycle or\n * initialization callbacks/custom handlers as described in the 'initialize' function's\n * documentation. It exists merely to set up the mock services that components themselves tend to\n * interact with most often. It could be extended to allow for setting up custom handlers fairly\n * easily, as this functionality would be more-or-less identical to what the real initialize\n * function does.\n *\n * Example:\n *\n * ```\n * import { initializeMockApp } from '@edx/frontend-platform/testing';\n * import { logInfo } from '@edx/frontend-platform/logging';\n *\n * describe('initializeMockApp', () => {\n * it('mocks things correctly', () => {\n * const { loggingService } = initializeMockApp();\n * logInfo('test', {});\n * expect(loggingService.logInfo).toHaveBeenCalledWith('test', {});\n * });\n * });\n * ```\n *\n * @param {Object} [options]\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 {UserData|null} [options.authenticatedUser] A UserData object representing the\n * authenticated user. This is passed directly to MockAuthService.\n * @memberof module:Testing\n */\nexport default function initializeMockApp({\n messages = mockMessages,\n authenticatedUser = null,\n} = {}) {\n const loggingService = configureLogging(MockLoggingService, {\n config: getConfig(),\n });\n\n const authService = configureAuth(MockAuthService, {\n config: { ...getConfig(), authenticatedUser },\n loggingService,\n });\n\n const analyticsService = configureAnalytics(MockAnalyticsService, {\n config: getConfig(),\n httpClient: authService.getAuthenticatedHttpClient(),\n loggingService,\n });\n\n // The i18n service configure function has no return value, since there isn't a service class.\n configureI18n({\n config: getConfig(),\n loggingService,\n messages,\n });\n\n return {\n analyticsService,\n authService,\n loggingService,\n };\n}\n"],"mappings":";;;;;;AAAA,SAASA,SAAS,IAAIC,kBAAtB,EAA0CC,oBAA1C,QAAsE,cAAtE;AACA,SAASF,SAAS,IAAIG,aAAtB,QAA2C,SAA3C;AACA,SAASH,SAAS,IAAII,gBAAtB,EAAwCC,kBAAxC,QAAkE,YAAlE;AACA,SAASL,SAAS,IAAIM,aAAtB,EAAqCC,eAArC,QAA4D,SAA5D;AACA,SAASC,SAAT,QAA0B,WAA1B;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAEA;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,eAAe,SAASC,iBAAT,GAGP;EAAA,+EAAJ,EAAI;EAAA,yBAFNC,QAEM;EAAA,IAFNA,QAEM,8BAFKF,YAEL;EAAA,iCADNG,iBACM;EAAA,IADNA,iBACM,sCADc,IACd;;EACN,IAAMC,cAAc,GAAGT,gBAAgB,CAACC,kBAAD,EAAqB;IAC1DS,MAAM,EAAEN,SAAS;EADyC,CAArB,CAAvC;EAIA,IAAMO,WAAW,GAAGT,aAAa,CAACC,eAAD,EAAkB;IACjDO,MAAM,kCAAON,SAAS,EAAhB;MAAoBI,iBAAiB,EAAjBA;IAApB,EAD2C;IAEjDC,cAAc,EAAdA;EAFiD,CAAlB,CAAjC;EAKA,IAAMG,gBAAgB,GAAGf,kBAAkB,CAACC,oBAAD,EAAuB;IAChEY,MAAM,EAAEN,SAAS,EAD+C;IAEhES,UAAU,EAAEF,WAAW,CAACG,0BAAZ,EAFoD;IAGhEL,cAAc,EAAdA;EAHgE,CAAvB,CAA3C,CAVM,CAgBN;;EACAV,aAAa,CAAC;IACZW,MAAM,EAAEN,SAAS,EADL;IAEZK,cAAc,EAAdA,cAFY;IAGZF,QAAQ,EAARA;EAHY,CAAD,CAAb;EAMA,OAAO;IACLK,gBAAgB,EAAhBA,gBADK;IAELD,WAAW,EAAXA,WAFK;IAGLF,cAAc,EAAdA;EAHK,CAAP;AAKD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"mockMessages.js","names":["messages","ar","fr","ca","he","id","pl","ru","th","uk"],"sources":["../../src/testing/mockMessages.js"],"sourcesContent":["/**\n * An empty messages object suitable for fulfilling the i18n service's contract.\n * @memberof module:Testing\n */\nconst messages = {\n ar: {},\n 'es-419': {},\n fr: {},\n 'zh-cn': {},\n ca: {},\n he: {},\n id: {},\n 'ko-kr': {},\n pl: {},\n 'pt-br': {},\n ru: {},\n th: {},\n uk: {},\n};\n\nexport default messages;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,IAAMA,QAAQ,GAAG;EACfC,EAAE,EAAE,EADW;EAEf,UAAU,EAFK;EAGfC,EAAE,EAAE,EAHW;EAIf,SAAS,EAJM;EAKfC,EAAE,EAAE,EALW;EAMfC,EAAE,EAAE,EANW;EAOfC,EAAE,EAAE,EAPW;EAQf,SAAS,EARM;EASfC,EAAE,EAAE,EATW;EAUf,SAAS,EAVM;EAWfC,EAAE,EAAE,EAXW;EAYfC,EAAE,EAAE,EAZW;EAafC,EAAE,EAAE;AAbW,CAAjB;AAgBA,eAAeT,QAAf"}
|
package/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["camelCase","snakeCase","modifyObjectKeys","object","modify","undefined","Array","isArray","map","value","result","Object","entries","forEach","key","camelCaseObject","snakeCaseObject","convertKeyNames","nameMap","transformer","getQueryParameters","search","global","location","keyValueFragments","slice","indexOf","split","filter","hash","reduce","params","keyValueFragment","assign","decodeURIComponent","ensureDefinedConfig","requester","keys","console","warn"],"sources":["../src/utils.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform**\n *\n * @module Utilities\n */\nimport camelCase from 'lodash.camelcase';\nimport snakeCase from 'lodash.snakecase';\n\n/**\n * This is the underlying function used by camelCaseObject, snakeCaseObject, and convertKeyNames\n * above.\n *\n * Given an object (or array) and a modification function, will perform the function on each key it\n * encounters on the object and its tree of children.\n *\n * The modification function must take a string as an argument and returns a string.\n *\n * Example:\n *\n * ```\n * (key) => {\n * if (key === 'edX') {\n * return 'Open edX';\n * }\n * return key;\n * }\n * ```\n *\n * This function will turn any key that matches 'edX' into 'Open edX'. All other keys will be\n * passed through unmodified.\n *\n * Can accept arrays as well as objects, and will perform its conversion on any objects it finds in\n * the array.\n *\n * @param {Object} object\n * @param {function} modify\n * @returns {Object}\n */\nexport function modifyObjectKeys(object, modify) {\n // If the passed in object is not an Object, return it.\n if (\n object === undefined\n || object === null\n || (typeof object !== 'object' && !Array.isArray(object))\n ) {\n return object;\n }\n\n if (Array.isArray(object)) {\n return object.map(value => modifyObjectKeys(value, modify));\n }\n\n // Otherwise, process all its keys.\n const result = {};\n Object.entries(object).forEach(([key, value]) => {\n result[modify(key)] = modifyObjectKeys(value, modify);\n });\n return result;\n}\n\n/**\n * Performs a deep conversion to camelCase on all keys in the provided object and its tree of\n * children. Uses [lodash.camelcase](https://lodash.com/docs/4.17.15#camelCase) on each key. This\n * is commonly used to convert snake_case keys in models from a backend server into camelCase keys\n * for use in the JavaScript client.\n *\n * Can accept arrays as well as objects, and will perform its conversion on any objects it finds in\n * the array.\n *\n * @param {Array|Object} object\n * @returns {Array|Object}\n */\nexport function camelCaseObject(object) {\n return modifyObjectKeys(object, camelCase);\n}\n\n/**\n * Performs a deep conversion to snake_case on all keys in the provided object and its tree of\n * children. Uses [lodash.snakecase](https://lodash.com/docs/4.17.15#snakeCase) on each key. This\n * is commonly used to convert camelCase keys from the JavaScript app into snake_case keys expected\n * by backend servers.\n *\n * Can accept arrays as well as objects, and will perform its conversion on any objects it finds in\n * the array.\n *\n * @param {Array|Object} object\n * @returns {Array|Object}\n */\nexport function snakeCaseObject(object) {\n return modifyObjectKeys(object, snakeCase);\n}\n\n/**\n * Given a map of key-value pairs, performs a deep conversion key names in the specified object\n * _from_ the key _to_ the value. This is useful for updating names in an API request to the names\n * used throughout a client application if they happen to differ. It can also be used in the\n * reverse - formatting names from the client application to names expected by an API.\n *\n * ```\n * import { convertKeyNames } from '@edx/frontend-base';\n *\n * // This object can be of any shape or depth with subobjects/arrays.\n * const myObject = {\n * myKey: 'my value',\n * }\n *\n * const result = convertKeyNames(myObject, { myKey: 'their_key' });\n *\n * console.log(result) // { their_key: 'my value' }\n * ```\n *\n * Can accept arrays as well as objects, and will perform its conversion on any objects it finds in\n * the array.\n *\n * @param {Array|Object} object\n * @param {Object} nameMap\n * @returns {Array|Object}\n */\nexport function convertKeyNames(object, nameMap) {\n const transformer = key => (nameMap[key] === undefined ? key : nameMap[key]);\n\n return modifyObjectKeys(object, transformer);\n}\n\n/**\n * *Deprecated*: A method which converts the supplied query string into an object of\n * key-value pairs and returns it. Defaults to the current query string - should perform like\n * [window.searchParams](https://developer.mozilla.org/en-US/docs/Web/API/URL/searchParams)\n *\n * @deprecated\n * @param {string} [search=global.location.search]\n * @returns {Object}\n */\nexport function getQueryParameters(search = global.location.search) {\n const keyValueFragments = search\n .slice(search.indexOf('?') + 1)\n .split('&')\n .filter(hash => hash !== '');\n\n return keyValueFragments.reduce((params, keyValueFragment) => {\n const split = keyValueFragment.indexOf('=');\n const key = keyValueFragment.slice(0, split);\n const value = keyValueFragment.slice(split + 1);\n return Object.assign(params, { [key]: decodeURIComponent(value) });\n }, {});\n}\n\n/**\n * This function helps catch a certain class of misconfiguration in which configuration variables\n * are not properly defined and/or supplied to a consumer that requires them. Any key that exists\n * is still set to \"undefined\" indicates a misconfiguration further up in the application, and\n * should be flagged as an error, and is logged to 'warn'.\n *\n * Keys that are intended to be falsy should be defined using null, 0, false, etc.\n *\n * @param {Object} object\n * @param {string} requester A human-readable identifier for the code which called this function.\n * Used when throwing errors to aid in debugging.\n */\nexport function ensureDefinedConfig(object, requester) {\n Object.keys(object).forEach((key) => {\n if (object[key] === undefined) {\n // eslint-disable-next-line no-console\n console.warn(`Module configuration error: ${key} is required by ${requester}.`);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,kBAAtB;AACA,OAAOC,SAAP,MAAsB,kBAAtB;AAEA;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,OAAO,SAASC,gBAAT,CAA0BC,MAA1B,EAAkCC,MAAlC,EAA0C;EAC/C;EACA,IACED,MAAM,KAAKE,SAAX,IACGF,MAAM,KAAK,IADd,IAEI,QAAOA,MAAP,MAAkB,QAAlB,IAA8B,CAACG,KAAK,CAACC,OAAN,CAAcJ,MAAd,CAHrC,EAIE;IACA,OAAOA,MAAP;EACD;;EAED,IAAIG,KAAK,CAACC,OAAN,CAAcJ,MAAd,CAAJ,EAA2B;IACzB,OAAOA,MAAM,CAACK,GAAP,CAAW,UAAAC,KAAK;MAAA,OAAIP,gBAAgB,CAACO,KAAD,EAAQL,MAAR,CAApB;IAAA,CAAhB,CAAP;EACD,CAZ8C,CAc/C;;;EACA,IAAMM,MAAM,GAAG,EAAf;EACAC,MAAM,CAACC,OAAP,CAAeT,MAAf,EAAuBU,OAAvB,CAA+B,gBAAkB;IAAA;IAAA,IAAhBC,GAAgB;IAAA,IAAXL,KAAW;;IAC/CC,MAAM,CAACN,MAAM,CAACU,GAAD,CAAP,CAAN,GAAsBZ,gBAAgB,CAACO,KAAD,EAAQL,MAAR,CAAtC;EACD,CAFD;EAGA,OAAOM,MAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,eAAT,CAAyBZ,MAAzB,E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Z;IACA,IAAMlB,KAAK,GAAGuB,gBAAgB,CAACP,KAAjB,CAAuBE,KAAK,GAAG,CAA/B,CAAd;IACA,OAAOhB,MAAM,CAACsB,MAAP,CAAcF,MAAd,sBAAyBjB,GAAzB,EAA+BoB,kBAAkB,CAACzB,KAAD,CAAjD,EAAP;EACD,CALM,EAKJ,EALI,CAAP;AAMD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS0B,mBAAT,CAA6BhC,MAA7B,EAAqCiC,SAArC,EAAgD;EACrDzB,MAAM,CAAC0B,IAAP,CAAYlC,MAAZ,EAAoBU,OAApB,CAA4B,UAACC,GAAD,EAAS;IACnC,IAAIX,MAAM,CAACW,GAAD,CAAN,KAAgBT,SAApB,EAA+B;MAC7B;MACAiC,OAAO,CAACC,IAAR,uCAA4CzB,GAA5C,6BAAkEsB,SAAlE;IACD;EACF,CALD;AAMD"}
|
package/i18n/scripts/Makefile
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# For more details about the translation jobs, see https://github.com/edx/frontend-i18n/blob/master/docs/how_tos/i18n.rst
|
|
2
|
-
|
|
3
|
-
transifex_langs = "ar,fr,es_419,zh_CN"
|
|
4
|
-
transifex_utils = ./node_modules/.bin/transifex-utils.js
|
|
5
|
-
transifex_input = ./src/i18n/transifex_input.json
|
|
6
|
-
tx_url1 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transifex_resource)/translation/en/strings/
|
|
7
|
-
tx_url2 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transifex_resource)/source/
|
|
8
|
-
|
|
9
|
-
i18n.extract:
|
|
10
|
-
# Pulling display strings from .jsx files into .json files...
|
|
11
|
-
rm -rf $(transifex_temp)
|
|
12
|
-
npm run-script i18n_extract
|
|
13
|
-
|
|
14
|
-
i18n.concat:
|
|
15
|
-
# Gathering JSON messages into one file...
|
|
16
|
-
$(transifex_utils) $(transifex_temp) $(transifex_input)
|
|
17
|
-
|
|
18
|
-
detect_changed_source_translations:
|
|
19
|
-
# Checking for changed translations...
|
|
20
|
-
git diff --exit-code $(transifex_input)
|
|
21
|
-
|
|
22
|
-
validate-no-uncommitted-package-lock-changes:
|
|
23
|
-
# Checking for package-lock.json changes...
|
|
24
|
-
git diff --exit-code package-lock.json
|
|
25
|
-
|
|
26
|
-
# Push translations to Transifex. Run make extract_translations first.
|
|
27
|
-
push_translations:
|
|
28
|
-
# Pushing strings to Transifex...
|
|
29
|
-
tx push -s
|
|
30
|
-
# Fetching hashes from Transifex...
|
|
31
|
-
./node_modules/reactifex/bash_scripts/get_hashed_strings.sh $(tx_url1)
|
|
32
|
-
# Writing out comments to file...
|
|
33
|
-
$(transifex_utils) $(transifex_temp) --comments
|
|
34
|
-
# Pushing comments to Transifex...
|
|
35
|
-
./node_modules/reactifex/bash_scripts/put_comments.sh $(tx_url2)
|
|
36
|
-
|
|
37
|
-
# Pull translations from Transifex
|
|
38
|
-
pull_translations:
|
|
39
|
-
tx pull -f --mode reviewed --language=$(transifex_langs)
|