@edx/frontend-platform 4.2.0 → 4.4.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/README.md +9 -9
- package/analytics/MockAnalyticsService.js.map +1 -1
- package/analytics/SegmentAnalyticsService.js.map +1 -1
- package/auth/AxiosCsrfTokenService.js.map +1 -1
- package/auth/AxiosJwtAuthService.js +5 -0
- 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/interceptors/createCsrfTokenProviderInterceptor.js.map +1 -1
- package/auth/interceptors/createJwtTokenProviderInterceptor.js.map +1 -1
- package/auth/interceptors/createRetryInterceptor.js.map +1 -1
- package/auth/interface.js.map +1 -1
- package/auth/utils.js +3 -3
- package/auth/utils.js.map +1 -1
- package/config.js.map +1 -1
- package/i18n/countries.js.map +1 -1
- package/i18n/injectIntlWithShim.js.map +1 -1
- package/i18n/languages.js.map +1 -1
- package/i18n/lib.js.map +1 -1
- package/i18n/scripts/intl-imports.js.map +1 -1
- package/i18n/scripts/transifex-utils.js.map +1 -1
- package/initialize.js.map +1 -1
- package/logging/MockLoggingService.js +6 -0
- package/logging/MockLoggingService.js.map +1 -1
- package/logging/NewRelicLoggingService.js +27 -2
- package/logging/NewRelicLoggingService.js.map +1 -1
- package/logging/interface.js +10 -0
- package/logging/interface.js.map +1 -1
- package/package.json +5 -5
- 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/OptionalReduxProvider.js.map +1 -1
- package/react/PageRoute.js.map +1 -1
- package/testing/initializeMockApp.js.map +1 -1
- package/utils.js.map +1 -1
package/auth/interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.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","PropTypes","publish","AUTHENTICATED_USER_TOPIC","AUTHENTICATED_USER_CHANGED","concat","optionsShape","config","shape","BASE_URL","string","isRequired","LMS_BASE_URL","LOGIN_URL","LOGOUT_URL","REFRESH_ACCESS_TOKEN_ENDPOINT","ACCESS_TOKEN_COOKIE_NAME","CSRF_TOKEN_API_PATH","loggingService","logError","func","logInfo","serviceShape","getAuthenticatedHttpClient","getHttpClient","getLoginRedirectUrl","redirectToLogin","getLogoutRedirectUrl","redirectToLogout","getAuthenticatedUser","setAuthenticatedUser","fetchAuthenticatedUser","ensureAuthenticatedUser","hydrateAuthenticatedUser","service","configure","AuthService","options","checkPropTypes","getAuthService","resetAuthService","redirectUrl","authUser","_fetchAuthenticatedUser","_callee","_args","_callee$","_context","_x","_ensureAuthenticatedUser","_callee2","_callee2$","_context2","_hydrateAuthenticatedUser","_callee3","_callee3$","_context3"],"sources":["../../src/auth/interface.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform/auth**\n *\n * Simplifies the process of making authenticated API requests to backend edX services by providing\n * common authN/authZ client code that enables the login/logout flow and handles ensuring the\n * presence of a valid [JWT cookie](https://github.com/openedx/edx-platform/blob/master/openedx/core/djangoapps/oauth_dispatch/docs/decisions/0009-jwt-in-session-cookie.rst).\n *\n * The `initialize` function performs much of the auth configuration for you. If, however, you're\n * not using the `initialize` function, an authenticated API client can be created via:\n *\n * ```\n * import {\n * configure,\n * fetchAuthenticatedUser,\n * getAuthenticatedHttpClient\n * } from '@edx/frontend-platform/auth';\n * import { getConfig } from '@edx/frontend-platform';\n * import { getLoggingService } from '@edx/frontend-platform/logging';\n *\n * configure({\n * loggingService: getLoggingService(),\n * config: getConfig(),\n * });\n *\n * const authenticatedUser = await fetchAuthenticatedUser(); // validates and decodes JWT token\n * const authenticatedHttpClient = getAuthenticatedHttpClient();\n * const response = await getAuthenticatedHttpClient().get(`https://example.com/api/user/data/${authenticatedUser.username}`); // fetching from an authenticated API using user data\n * ```\n *\n * As shown in this example, auth depends on the configuration document and logging.\n *\n * NOTE: The documentation for AxiosJwtAuthService is nearly the same as that for the top-level\n * auth interface, except that it contains some Axios-specific details.\n *\n * @module Auth\n */\nimport PropTypes from 'prop-types';\nimport { publish } from '../pubSub';\n\n/**\n * @constant\n * @private\n */\nexport const AUTHENTICATED_USER_TOPIC = 'AUTHENTICATED_USER';\n\n/**\n * Published when the authenticated user data changes. This can happen when the authentication\n * service determines that the user is authenticated or anonymous, as well as when we fetch\n * additional user account data if the `hydrateAuthenticatedUser` flag has been set in the\n * `initialize` function.\n *\n * @event\n * @see {@link module:Initialization~initialize}\n */\nexport const AUTHENTICATED_USER_CHANGED = `${AUTHENTICATED_USER_TOPIC}.CHANGED`;\n\nconst optionsShape = {\n config: PropTypes.shape({\n BASE_URL: PropTypes.string.isRequired,\n LMS_BASE_URL: PropTypes.string.isRequired,\n LOGIN_URL: PropTypes.string.isRequired,\n LOGOUT_URL: PropTypes.string.isRequired,\n REFRESH_ACCESS_TOKEN_ENDPOINT: PropTypes.string.isRequired,\n ACCESS_TOKEN_COOKIE_NAME: PropTypes.string.isRequired,\n CSRF_TOKEN_API_PATH: PropTypes.string.isRequired,\n }).isRequired,\n loggingService: PropTypes.shape({\n logError: PropTypes.func.isRequired,\n logInfo: PropTypes.func.isRequired,\n }).isRequired,\n};\n\nconst serviceShape = {\n getAuthenticatedHttpClient: PropTypes.func.isRequired,\n getHttpClient: PropTypes.func.isRequired,\n getLoginRedirectUrl: PropTypes.func.isRequired,\n redirectToLogin: PropTypes.func.isRequired,\n getLogoutRedirectUrl: PropTypes.func.isRequired,\n redirectToLogout: PropTypes.func.isRequired,\n getAuthenticatedUser: PropTypes.func.isRequired,\n setAuthenticatedUser: PropTypes.func.isRequired,\n fetchAuthenticatedUser: PropTypes.func.isRequired,\n ensureAuthenticatedUser: PropTypes.func.isRequired,\n hydrateAuthenticatedUser: PropTypes.func.isRequired,\n};\n\nlet service;\n\n/**\n *\n * @param {class} AuthService\n * @param {*} options\n * @returns {AuthService}\n */\nexport function configure(AuthService, options) {\n PropTypes.checkPropTypes(optionsShape, options, 'property', 'Auth');\n service = new AuthService(options);\n PropTypes.checkPropTypes(serviceShape, service, 'property', 'AuthService');\n return service;\n}\n\n/**\n *\n *\n * @returns {AuthService}\n */\nexport function getAuthService() {\n if (!service) {\n throw Error('You must first configure the auth service.');\n }\n\n return service;\n}\n\n/**\n *\n */\nexport function resetAuthService() {\n service = null;\n}\n\n/**\n * Gets the authenticated HTTP client for the service.\n *\n * @param {Object} [options] Optional options for how to configure the authenticated HTTP client\n * @param {boolean} [options.useCache] Whether to use front end caching for all requests made with the returned client\n *\n * @returns {HttpClient}\n */\nexport function getAuthenticatedHttpClient(options = {}) {\n return service.getAuthenticatedHttpClient(options);\n}\n\n/**\n * Gets the unauthenticated HTTP client for the service.\n *\n * @param {Object} [options] Optional options for how to configure the authenticated HTTP client\n * @param {boolean} [options.useCache] Whether to use front end caching for all requests made with the returned client\n *\n * @returns {HttpClient}\n */\nexport function getHttpClient(options = {}) {\n return service.getHttpClient(options);\n}\n\n/**\n * Builds a URL to the login page with a post-login redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLoginRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/login?next=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\nexport function getLoginRedirectUrl(redirectUrl) {\n return service.getLoginRedirectUrl(redirectUrl);\n}\n\n/**\n * Redirects the user to the login page.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\nexport function redirectToLogin(redirectUrl) {\n return service.redirectToLogin(redirectUrl);\n}\n\n/**\n * Builds a URL to the logout page with a post-logout redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLogoutRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/logout?redirect_url=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\nexport function getLogoutRedirectUrl(redirectUrl) {\n return service.getLogoutRedirectUrl(redirectUrl);\n}\n\n/**\n * Redirects the user to the logout page.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\nexport function redirectToLogout(redirectUrl) {\n return service.redirectToLogout(redirectUrl);\n}\n\n/**\n * If it exists, returns the user data representing the currently authenticated user. If the\n * user is anonymous, returns null.\n *\n * @returns {UserData|null}\n */\nexport function getAuthenticatedUser() {\n return service.getAuthenticatedUser();\n}\n\n/**\n * Sets the authenticated user to the provided value.\n *\n * @param {UserData} authUser\n * @emits AUTHENTICATED_USER_CHANGED\n */\nexport function setAuthenticatedUser(authUser) {\n service.setAuthenticatedUser(authUser);\n publish(AUTHENTICATED_USER_CHANGED);\n}\n\n/**\n * Reads the authenticated user's access token. Resolves to null if the user is\n * unauthenticated.\n *\n * @returns {Promise<UserData>|Promise<null>} Resolves to the user's access token if they are\n * logged in.\n */\nexport async function fetchAuthenticatedUser(options = {}) {\n return service.fetchAuthenticatedUser(options);\n}\n\n/**\n * Ensures a user is authenticated. It will redirect to login when not\n * authenticated.\n *\n * @param {string} [redirectUrl=config.BASE_URL] to return user after login when not\n * authenticated.\n * @returns {Promise<UserData>}\n */\nexport async function ensureAuthenticatedUser(redirectUrl) {\n return service.ensureAuthenticatedUser(redirectUrl);\n}\n\n/**\n * Fetches additional user account information for the authenticated user and merges it into the\n * existing authenticatedUser object, available via getAuthenticatedUser().\n *\n * ```\n * console.log(authenticatedUser); // Will be sparse and only contain basic information.\n * await hydrateAuthenticatedUser()\n * const authenticatedUser = getAuthenticatedUser();\n * console.log(authenticatedUser); // Will contain additional user information\n * ```\n *\n * @emits AUTHENTICATED_USER_CHANGED\n */\nexport async function hydrateAuthenticatedUser() {\n await service.hydrateAuthenticatedUser();\n publish(AUTHENTICATED_USER_CHANGED);\n}\n\n/**\n * @name AuthService\n * @interface\n * @memberof module:Auth\n * @property {function} getAuthenticatedHttpClient\n * @property {function} getHttpClient\n * @property {function} getLoginRedirectUrl\n * @property {function} redirectToLogin\n * @property {function} getLogoutRedirectUrl\n * @property {function} redirectToLogout\n * @property {function} getAuthenticatedUser\n * @property {function} setAuthenticatedUser\n * @property {function} fetchAuthenticatedUser\n * @property {function} ensureAuthenticatedUser\n * @property {function} hydrateAuthenticatedUser\n */\n\n/**\n * A configured axios client. See axios docs for more\n * info https://github.com/axios/axios. All the functions\n * below accept isPublic and isCsrfExempt in the request\n * config options. Setting these to true will prevent this\n * client from attempting to refresh the jwt access token\n * or a csrf token respectively.\n *\n * ```\n * // A public endpoint (no jwt token refresh)\n * apiClient.get('/path/to/endpoint', { isPublic: true });\n * ```\n *\n * ```\n * // A csrf exempt endpoint\n * apiClient.post('/path/to/endpoint', { data }, { isCsrfExempt: true });\n * ```\n *\n * @name HttpClient\n * @interface\n * @memberof module:Auth\n * @property {function} get\n * @property {function} head\n * @property {function} options\n * @property {function} delete (csrf protected)\n * @property {function} post (csrf protected)\n * @property {function} put (csrf protected)\n * @property {function} patch (csrf protected)\n */\n\n/**\n * @name UserData\n * @interface\n * @memberof module:Auth\n * @property {string} userId\n * @property {string} username\n * @property {Array} roles\n * @property {boolean} administrator\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,OAAAC,cAAA,GAAAF,OAAA,CAAAG,QAAA,kBAAAC,mBAAA,GAAAJ,OAAA,CAAAK,aAAA,uBAAAC,iBAAA,GAAAN,OAAA,CAAAO,WAAA,8BAAAC,OAAAZ,GAAA,EAAAC,GAAA,EAAAE,KAAA,WAAAR,MAAA,CAAAI,cAAA,CAAAC,GAAA,EAAAC,GAAA,IAAAE,KAAA,EAAAA,KAAA,EAAAU,UAAA,MAAAC,YAAA,MAAAC,QAAA,SAAAf,GAAA,CAAAC,GAAA,WAAAW,MAAA,mBAAAI,GAAA,IAAAJ,MAAA,YAAAA,OAAAZ,GAAA,EAAAC,GAAA,EAAAE,KAAA,WAAAH,GAAA,CAAAC,GAAA,IAAAE,KAAA,gBAAAc,KAAAC,OAAA,EAAAC,OAAA,EAAAC,IAAA,EAAAC,WAAA,QAAAC,cAAA,GAAAH,OAAA,IAAAA,OAAA,CAAAvB,SAAA,YAAA2B,SAAA,GAA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H,SAAA,CAAA1H,MAAA,WAChDwG,OAAO,CAACF,uBAAuB,CAACS,WAAW,CAAC;QAAA;QAAA;UAAA,OAAAW,SAAA,CAAA1E,IAAA;MAAA;IAAA,GAAAwE,QAAA;EAAA,CACpD;EAAA,OAAAD,wBAAA,CAAAjD,KAAA,OAAAD,SAAA;AAAA;AAeD,gBAAsBkC,wBAAwBA,CAAA;EAAA,OAAAoB,yBAAA,CAAArD,KAAA,OAAAD,SAAA;AAAA;;AAK9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,SAAAsD,0BAAA;EAAAA,yBAAA,GAAAxD,iBAAA,eAAAjJ,mBAAA,GAAA8G,IAAA,CApDO,SAAA4F,SAAA;IAAA,OAAA1M,mBAAA,GAAAyB,IAAA,UAAAkL,UAAAC,SAAA;MAAA,kBAAAA,SAAA,CAAAjF,IAAA,GAAAiF,SAAA,CAAAvH,IAAA;QAAA;UAAAuH,SAAA,CAAAvH,IAAA;UAAA,OACCiG,OAAO,CAACD,wBAAwB,EAAE;QAAA;UACxC/B,OAAO,CAACE,0BAA0B,CAAC;QAAC;QAAA;UAAA,OAAAoD,SAAA,CAAA9E,IAAA;MAAA;IAAA,GAAA4E,QAAA;EAAA,CACrC;EAAA,OAAAD,yBAAA,CAAArD,KAAA,OAAAD,SAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"interface.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","PropTypes","publish","AUTHENTICATED_USER_TOPIC","AUTHENTICATED_USER_CHANGED","concat","optionsShape","config","shape","BASE_URL","string","isRequired","LMS_BASE_URL","LOGIN_URL","LOGOUT_URL","REFRESH_ACCESS_TOKEN_ENDPOINT","ACCESS_TOKEN_COOKIE_NAME","CSRF_TOKEN_API_PATH","loggingService","logError","func","logInfo","serviceShape","getAuthenticatedHttpClient","getHttpClient","getLoginRedirectUrl","redirectToLogin","getLogoutRedirectUrl","redirectToLogout","getAuthenticatedUser","setAuthenticatedUser","fetchAuthenticatedUser","ensureAuthenticatedUser","hydrateAuthenticatedUser","service","configure","AuthService","options","checkPropTypes","getAuthService","resetAuthService","redirectUrl","authUser","_fetchAuthenticatedUser","_callee","_args","_callee$","_context","_x","_ensureAuthenticatedUser","_callee2","_callee2$","_context2","_hydrateAuthenticatedUser","_callee3","_callee3$","_context3"],"sources":["../../src/auth/interface.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform/auth**\n *\n * Simplifies the process of making authenticated API requests to backend edX services by providing\n * common authN/authZ client code that enables the login/logout flow and handles ensuring the\n * presence of a valid [JWT cookie](https://github.com/openedx/edx-platform/blob/master/openedx/core/djangoapps/oauth_dispatch/docs/decisions/0009-jwt-in-session-cookie.rst).\n *\n * The `initialize` function performs much of the auth configuration for you. If, however, you're\n * not using the `initialize` function, an authenticated API client can be created via:\n *\n * ```\n * import {\n * configure,\n * fetchAuthenticatedUser,\n * getAuthenticatedHttpClient\n * } from '@edx/frontend-platform/auth';\n * import { getConfig } from '@edx/frontend-platform';\n * import { getLoggingService } from '@edx/frontend-platform/logging';\n *\n * configure({\n * loggingService: getLoggingService(),\n * config: getConfig(),\n * });\n *\n * const authenticatedUser = await fetchAuthenticatedUser(); // validates and decodes JWT token\n * const authenticatedHttpClient = getAuthenticatedHttpClient();\n * const response = await getAuthenticatedHttpClient().get(`https://example.com/api/user/data/${authenticatedUser.username}`); // fetching from an authenticated API using user data\n * ```\n *\n * As shown in this example, auth depends on the configuration document and logging.\n *\n * NOTE: The documentation for AxiosJwtAuthService is nearly the same as that for the top-level\n * auth interface, except that it contains some Axios-specific details.\n *\n * @module Auth\n */\nimport PropTypes from 'prop-types';\nimport { publish } from '../pubSub';\n\n/**\n * @constant\n * @private\n */\nexport const AUTHENTICATED_USER_TOPIC = 'AUTHENTICATED_USER';\n\n/**\n * Published when the authenticated user data changes. This can happen when the authentication\n * service determines that the user is authenticated or anonymous, as well as when we fetch\n * additional user account data if the `hydrateAuthenticatedUser` flag has been set in the\n * `initialize` function.\n *\n * @event\n * @see {@link module:Initialization~initialize}\n */\nexport const AUTHENTICATED_USER_CHANGED = `${AUTHENTICATED_USER_TOPIC}.CHANGED`;\n\nconst optionsShape = {\n config: PropTypes.shape({\n BASE_URL: PropTypes.string.isRequired,\n LMS_BASE_URL: PropTypes.string.isRequired,\n LOGIN_URL: PropTypes.string.isRequired,\n LOGOUT_URL: PropTypes.string.isRequired,\n REFRESH_ACCESS_TOKEN_ENDPOINT: PropTypes.string.isRequired,\n ACCESS_TOKEN_COOKIE_NAME: PropTypes.string.isRequired,\n CSRF_TOKEN_API_PATH: PropTypes.string.isRequired,\n }).isRequired,\n loggingService: PropTypes.shape({\n logError: PropTypes.func.isRequired,\n logInfo: PropTypes.func.isRequired,\n }).isRequired,\n};\n\nconst serviceShape = {\n getAuthenticatedHttpClient: PropTypes.func.isRequired,\n getHttpClient: PropTypes.func.isRequired,\n getLoginRedirectUrl: PropTypes.func.isRequired,\n redirectToLogin: PropTypes.func.isRequired,\n getLogoutRedirectUrl: PropTypes.func.isRequired,\n redirectToLogout: PropTypes.func.isRequired,\n getAuthenticatedUser: PropTypes.func.isRequired,\n setAuthenticatedUser: PropTypes.func.isRequired,\n fetchAuthenticatedUser: PropTypes.func.isRequired,\n ensureAuthenticatedUser: PropTypes.func.isRequired,\n hydrateAuthenticatedUser: PropTypes.func.isRequired,\n};\n\nlet service;\n\n/**\n *\n * @param {class} AuthService\n * @param {*} options\n * @returns {AuthService}\n */\nexport function configure(AuthService, options) {\n PropTypes.checkPropTypes(optionsShape, options, 'property', 'Auth');\n service = new AuthService(options);\n PropTypes.checkPropTypes(serviceShape, service, 'property', 'AuthService');\n return service;\n}\n\n/**\n *\n *\n * @returns {AuthService}\n */\nexport function getAuthService() {\n if (!service) {\n throw Error('You must first configure the auth service.');\n }\n\n return service;\n}\n\n/**\n *\n */\nexport function resetAuthService() {\n service = null;\n}\n\n/**\n * Gets the authenticated HTTP client for the service.\n *\n * @param {Object} [options] Optional options for how to configure the authenticated HTTP client\n * @param {boolean} [options.useCache] Whether to use front end caching for all requests made with the returned client\n *\n * @returns {HttpClient}\n */\nexport function getAuthenticatedHttpClient(options = {}) {\n return service.getAuthenticatedHttpClient(options);\n}\n\n/**\n * Gets the unauthenticated HTTP client for the service.\n *\n * @param {Object} [options] Optional options for how to configure the authenticated HTTP client\n * @param {boolean} [options.useCache] Whether to use front end caching for all requests made with the returned client\n *\n * @returns {HttpClient}\n */\nexport function getHttpClient(options = {}) {\n return service.getHttpClient(options);\n}\n\n/**\n * Builds a URL to the login page with a post-login redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLoginRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/login?next=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\nexport function getLoginRedirectUrl(redirectUrl) {\n return service.getLoginRedirectUrl(redirectUrl);\n}\n\n/**\n * Redirects the user to the login page.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\nexport function redirectToLogin(redirectUrl) {\n return service.redirectToLogin(redirectUrl);\n}\n\n/**\n * Builds a URL to the logout page with a post-logout redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLogoutRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/logout?redirect_url=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\nexport function getLogoutRedirectUrl(redirectUrl) {\n return service.getLogoutRedirectUrl(redirectUrl);\n}\n\n/**\n * Redirects the user to the logout page.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\nexport function redirectToLogout(redirectUrl) {\n return service.redirectToLogout(redirectUrl);\n}\n\n/**\n * If it exists, returns the user data representing the currently authenticated user. If the\n * user is anonymous, returns null.\n *\n * @returns {UserData|null}\n */\nexport function getAuthenticatedUser() {\n return service.getAuthenticatedUser();\n}\n\n/**\n * Sets the authenticated user to the provided value.\n *\n * @param {UserData} authUser\n * @emits AUTHENTICATED_USER_CHANGED\n */\nexport function setAuthenticatedUser(authUser) {\n service.setAuthenticatedUser(authUser);\n publish(AUTHENTICATED_USER_CHANGED);\n}\n\n/**\n * Reads the authenticated user's access token. Resolves to null if the user is\n * unauthenticated.\n *\n * @returns {Promise<UserData>|Promise<null>} Resolves to the user's access token if they are\n * logged in.\n */\nexport async function fetchAuthenticatedUser(options = {}) {\n return service.fetchAuthenticatedUser(options);\n}\n\n/**\n * Ensures a user is authenticated. It will redirect to login when not\n * authenticated.\n *\n * @param {string} [redirectUrl=config.BASE_URL] to return user after login when not\n * authenticated.\n * @returns {Promise<UserData>}\n */\nexport async function ensureAuthenticatedUser(redirectUrl) {\n return service.ensureAuthenticatedUser(redirectUrl);\n}\n\n/**\n * Fetches additional user account information for the authenticated user and merges it into the\n * existing authenticatedUser object, available via getAuthenticatedUser().\n *\n * ```\n * console.log(authenticatedUser); // Will be sparse and only contain basic information.\n * await hydrateAuthenticatedUser()\n * const authenticatedUser = getAuthenticatedUser();\n * console.log(authenticatedUser); // Will contain additional user information\n * ```\n *\n * @emits AUTHENTICATED_USER_CHANGED\n */\nexport async function hydrateAuthenticatedUser() {\n await service.hydrateAuthenticatedUser();\n publish(AUTHENTICATED_USER_CHANGED);\n}\n\n/**\n * @name AuthService\n * @interface\n * @memberof module:Auth\n * @property {function} getAuthenticatedHttpClient\n * @property {function} getHttpClient\n * @property {function} getLoginRedirectUrl\n * @property {function} redirectToLogin\n * @property {function} getLogoutRedirectUrl\n * @property {function} redirectToLogout\n * @property {function} getAuthenticatedUser\n * @property {function} setAuthenticatedUser\n * @property {function} fetchAuthenticatedUser\n * @property {function} ensureAuthenticatedUser\n * @property {function} hydrateAuthenticatedUser\n */\n\n/**\n * A configured axios client. See axios docs for more\n * info https://github.com/axios/axios. All the functions\n * below accept isPublic and isCsrfExempt in the request\n * config options. Setting these to true will prevent this\n * client from attempting to refresh the jwt access token\n * or a csrf token respectively.\n *\n * ```\n * // A public endpoint (no jwt token refresh)\n * apiClient.get('/path/to/endpoint', { isPublic: true });\n * ```\n *\n * ```\n * // A csrf exempt endpoint\n * apiClient.post('/path/to/endpoint', { data }, { isCsrfExempt: true });\n * ```\n *\n * @name HttpClient\n * @interface\n * @memberof module:Auth\n * @property {function} get\n * @property {function} head\n * @property {function} options\n * @property {function} delete (csrf protected)\n * @property {function} post (csrf protected)\n * @property {function} put (csrf protected)\n * @property {function} patch (csrf protected)\n */\n\n/**\n * @name UserData\n * @interface\n * @memberof module:Auth\n * @property {string} userId\n * @property {string} username\n * @property {Array} roles\n * @property {boolean} administrator\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,OAAAC,cAAA,GAAAF,OAAA,CAAAG,QAAA,kBAAAC,mBAAA,GAAAJ,OAAA,CAAAK,aAAA,uBAAAC,iBAAA,GAAAN,OAAA,CAAAO,WAAA,8BAAAC,OAAAZ,GAAA,EAAAC,GAAA,EAAAE,KAAA,WAAAR,MAAA,CAAAI,cAAA,CAAAC,GAAA,EAAAC,GAAA,IAAAE,KAAA,EAAAA,KAAA,EAAAU,UAAA,MAAAC,YAAA,MAAAC,QAAA,SAAAf,GAAA,CAAAC,GAAA,WAAAW,MAAA,mBAAAI,GAAA,IAAAJ,MAAA,YAAAA,OAAAZ,GAAA,EAAAC,GAAA,EAAAE,KAAA,WAAAH,GAAA,CAAAC,GAAA,IAAAE,KAAA,gBAAAc,KAAAC,OAAA,EAAAC,OAAA,EAAAC,IAAA,EAAAC,WAAA,QAAAC,cAAA,GAAAH,OAAA,IAAAA,OAAA,CAAAvB,SAAA,YAAA2B,SAAA,GAAAJ,OAAA,GAAAI,SAAA,EAAAC,SAAA,GAAA7B,MAAA,CAAA8B,MAAA,CAAAH,cAAA,CAAA1B,SAAA,GAAA8B,OAAA,OAAAC,OAAA,CAAAN,WAAA,gB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AwE,QAAA;EAAA,CACpD;EAAA,OAAAD,wBAAA,CAAAjD,KAAA,OAAAD,SAAA;AAAA;AAeD,gBAAsBkC,wBAAwBA,CAAA;EAAA,OAAAoB,yBAAA,CAAArD,KAAA,OAAAD,SAAA;AAAA;;AAK9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,SAAAsD,0BAAA;EAAAA,yBAAA,GAAAxD,iBAAA,eAAAjJ,mBAAA,GAAA8G,IAAA,CApDO,SAAA4F,SAAA;IAAA,OAAA1M,mBAAA,GAAAyB,IAAA,UAAAkL,UAAAC,SAAA;MAAA,kBAAAA,SAAA,CAAAjF,IAAA,GAAAiF,SAAA,CAAAvH,IAAA;QAAA;UAAAuH,SAAA,CAAAvH,IAAA;UAAA,OACCiG,OAAO,CAACD,wBAAwB,CAAC,CAAC;QAAA;UACxC/B,OAAO,CAACE,0BAA0B,CAAC;QAAC;QAAA;UAAA,OAAAoD,SAAA,CAAA9E,IAAA;MAAA;IAAA,GAAA4E,QAAA;EAAA,CACrC;EAAA,OAAAD,yBAAA,CAAArD,KAAA,OAAAD,SAAA;AAAA"}
|
package/auth/utils.js
CHANGED
|
@@ -72,7 +72,7 @@ var processAxiosError = function processAxiosError(axiosErrorObject) {
|
|
|
72
72
|
httpErrorRequestUrl: httpErrorRequestUrl,
|
|
73
73
|
httpErrorRequestMethod: httpErrorRequestMethod
|
|
74
74
|
});
|
|
75
|
-
error.message = "Axios Error (Response): ".concat(status, "
|
|
75
|
+
error.message = "Axios Error (Response): ".concat(status, " - See custom attributes for details.");
|
|
76
76
|
} else if (request) {
|
|
77
77
|
error.customAttributes = _objectSpread(_objectSpread({}, error.customAttributes), {}, {
|
|
78
78
|
httpErrorType: 'api-request-error',
|
|
@@ -82,7 +82,7 @@ var processAxiosError = function processAxiosError(axiosErrorObject) {
|
|
|
82
82
|
});
|
|
83
83
|
// This case occurs most likely because of intermittent internet connection issues
|
|
84
84
|
// but it also, though less often, catches CORS or server configuration problems.
|
|
85
|
-
error.message =
|
|
85
|
+
error.message = 'Axios Error (Request): (Possible local connectivity issue.) See custom attributes for details.';
|
|
86
86
|
} else {
|
|
87
87
|
error.customAttributes = _objectSpread(_objectSpread({}, error.customAttributes), {}, {
|
|
88
88
|
httpErrorType: 'api-request-config-error',
|
|
@@ -90,7 +90,7 @@ var processAxiosError = function processAxiosError(axiosErrorObject) {
|
|
|
90
90
|
httpErrorRequestUrl: httpErrorRequestUrl,
|
|
91
91
|
httpErrorRequestMethod: httpErrorRequestMethod
|
|
92
92
|
});
|
|
93
|
-
error.message =
|
|
93
|
+
error.message = 'Axios Error (Config): See custom attributes for details.';
|
|
94
94
|
}
|
|
95
95
|
return error;
|
|
96
96
|
};
|
package/auth/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["urlRegex","getUrlParts","url","found","match","_found","_slicedToArray","fullUrl","protocol","domain","path","endFilename","endFileExtension","query","hash","e","Error","concat","logFrontendAuthError","loggingService","error","prefixedMessageError","Object","create","message","logError","customAttributes","processAxiosError","axiosErrorObject","request","response","config","_objectSpread","httpErrorType","httpErrorRequestUrl","httpErrorRequestMethod","method","status","data","stringifiedData","JSON","stringify","responseIsHTML","includes","httpErrorResponseData","httpErrorStatus","httpErrorMessage","processAxiosErrorAndThrow"],"sources":["../../src/auth/utils.js"],"sourcesContent":["// Lifted from here: https://regexr.com/3ok5o\nconst urlRegex = /([a-z]{1,2}tps?):\\/\\/((?:(?!(?:\\/|#|\\?|&)).)+)(?:(\\/(?:(?:(?:(?!(?:#|\\?|&)).)+\\/))?))?(?:((?:(?!(?:\\.|$|\\?|#)).)+))?(?:(\\.(?:(?!(?:\\?|$|#)).)+))?(?:(\\?(?:(?!(?:$|#)).)+))?(?:(#.+))?/;\nconst getUrlParts = (url) => {\n const found = url.match(urlRegex);\n try {\n const [\n fullUrl,\n protocol,\n domain,\n path,\n endFilename,\n endFileExtension,\n query,\n hash,\n ] = found;\n\n return {\n fullUrl,\n protocol,\n domain,\n path,\n endFilename,\n endFileExtension,\n query,\n hash,\n };\n } catch (e) {\n throw new Error(`Could not find url parts from ${url}.`);\n }\n};\n\nconst logFrontendAuthError = (loggingService, error) => {\n const prefixedMessageError = Object.create(error);\n prefixedMessageError.message = `[frontend-auth] ${error.message}`;\n loggingService.logError(prefixedMessageError, prefixedMessageError.customAttributes);\n};\n\nconst processAxiosError = (axiosErrorObject) => {\n const error = Object.create(axiosErrorObject);\n const { request, response, config } = error;\n\n if (!config) {\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'unknown-api-request-error',\n };\n return error;\n }\n\n const {\n url: httpErrorRequestUrl,\n method: httpErrorRequestMethod,\n } = config;\n /* istanbul ignore else: difficult to enter the request-only error case in a unit test */\n if (response) {\n const { status, data } = response;\n const stringifiedData = JSON.stringify(data) || '(empty response)';\n const responseIsHTML = stringifiedData.includes('<!DOCTYPE html>');\n // Don't include data if it is just an HTML document, like a 500 error page.\n /* istanbul ignore next */\n const httpErrorResponseData = responseIsHTML ? '<Response is HTML>' : stringifiedData;\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'api-response-error',\n httpErrorStatus: status,\n httpErrorResponseData,\n httpErrorRequestUrl,\n httpErrorRequestMethod,\n };\n error.message = `Axios Error (Response): ${status}
|
|
1
|
+
{"version":3,"file":"utils.js","names":["urlRegex","getUrlParts","url","found","match","_found","_slicedToArray","fullUrl","protocol","domain","path","endFilename","endFileExtension","query","hash","e","Error","concat","logFrontendAuthError","loggingService","error","prefixedMessageError","Object","create","message","logError","customAttributes","processAxiosError","axiosErrorObject","request","response","config","_objectSpread","httpErrorType","httpErrorRequestUrl","httpErrorRequestMethod","method","status","data","stringifiedData","JSON","stringify","responseIsHTML","includes","httpErrorResponseData","httpErrorStatus","httpErrorMessage","processAxiosErrorAndThrow"],"sources":["../../src/auth/utils.js"],"sourcesContent":["// Lifted from here: https://regexr.com/3ok5o\nconst urlRegex = /([a-z]{1,2}tps?):\\/\\/((?:(?!(?:\\/|#|\\?|&)).)+)(?:(\\/(?:(?:(?:(?!(?:#|\\?|&)).)+\\/))?))?(?:((?:(?!(?:\\.|$|\\?|#)).)+))?(?:(\\.(?:(?!(?:\\?|$|#)).)+))?(?:(\\?(?:(?!(?:$|#)).)+))?(?:(#.+))?/;\nconst getUrlParts = (url) => {\n const found = url.match(urlRegex);\n try {\n const [\n fullUrl,\n protocol,\n domain,\n path,\n endFilename,\n endFileExtension,\n query,\n hash,\n ] = found;\n\n return {\n fullUrl,\n protocol,\n domain,\n path,\n endFilename,\n endFileExtension,\n query,\n hash,\n };\n } catch (e) {\n throw new Error(`Could not find url parts from ${url}.`);\n }\n};\n\nconst logFrontendAuthError = (loggingService, error) => {\n const prefixedMessageError = Object.create(error);\n prefixedMessageError.message = `[frontend-auth] ${error.message}`;\n loggingService.logError(prefixedMessageError, prefixedMessageError.customAttributes);\n};\n\nconst processAxiosError = (axiosErrorObject) => {\n const error = Object.create(axiosErrorObject);\n const { request, response, config } = error;\n\n if (!config) {\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'unknown-api-request-error',\n };\n return error;\n }\n\n const {\n url: httpErrorRequestUrl,\n method: httpErrorRequestMethod,\n } = config;\n /* istanbul ignore else: difficult to enter the request-only error case in a unit test */\n if (response) {\n const { status, data } = response;\n const stringifiedData = JSON.stringify(data) || '(empty response)';\n const responseIsHTML = stringifiedData.includes('<!DOCTYPE html>');\n // Don't include data if it is just an HTML document, like a 500 error page.\n /* istanbul ignore next */\n const httpErrorResponseData = responseIsHTML ? '<Response is HTML>' : stringifiedData;\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'api-response-error',\n httpErrorStatus: status,\n httpErrorResponseData,\n httpErrorRequestUrl,\n httpErrorRequestMethod,\n };\n error.message = `Axios Error (Response): ${status} - See custom attributes for details.`;\n } else if (request) {\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'api-request-error',\n httpErrorMessage: error.message,\n httpErrorRequestUrl,\n httpErrorRequestMethod,\n };\n // This case occurs most likely because of intermittent internet connection issues\n // but it also, though less often, catches CORS or server configuration problems.\n error.message = 'Axios Error (Request): (Possible local connectivity issue.) See custom attributes for details.';\n } else {\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'api-request-config-error',\n httpErrorMessage: error.message,\n httpErrorRequestUrl,\n httpErrorRequestMethod,\n };\n error.message = 'Axios Error (Config): See custom attributes for details.';\n }\n\n return error;\n};\n\nconst processAxiosErrorAndThrow = (axiosErrorObject) => {\n throw processAxiosError(axiosErrorObject);\n};\n\nexport {\n getUrlParts,\n logFrontendAuthError,\n processAxiosError,\n processAxiosErrorAndThrow,\n};\n"],"mappings":";;;;;;;;;;;;AAAA;AACA,IAAMA,QAAQ,GAAG,uLAAuL;AACxM,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,GAAG,EAAK;EAC3B,IAAMC,KAAK,GAAGD,GAAG,CAACE,KAAK,CAACJ,QAAQ,CAAC;EACjC,IAAI;IACF,IAAAK,MAAA,GAAAC,cAAA,CASIH,KAAK;MARPI,OAAO,GAAAF,MAAA;MACPG,QAAQ,GAAAH,MAAA;MACRI,MAAM,GAAAJ,MAAA;MACNK,IAAI,GAAAL,MAAA;MACJM,WAAW,GAAAN,MAAA;MACXO,gBAAgB,GAAAP,MAAA;MAChBQ,KAAK,GAAAR,MAAA;MACLS,IAAI,GAAAT,MAAA;IAGN,OAAO;MACLE,OAAO,EAAPA,OAAO;MACPC,QAAQ,EAARA,QAAQ;MACRC,MAAM,EAANA,MAAM;MACNC,IAAI,EAAJA,IAAI;MACJC,WAAW,EAAXA,WAAW;MACXC,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,iBAAiB,EACjBoB,yBAAyB"}
|
package/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["APP_CONFIG_INITIALIZED","CONFIG_CHANGED","publish","subscribe","ensureDefinedConfig","extractRegex","envVar","trim","RegExp","undefined","ENVIRONMENT","process","env","NODE_ENV","config","ACCESS_TOKEN_COOKIE_NAME","ACCOUNT_PROFILE_URL","ACCOUNT_SETTINGS_URL","BASE_URL","PUBLIC_PATH","CREDENTIALS_BASE_URL","CSRF_TOKEN_API_PATH","DISCOVERY_API_BASE_URL","PUBLISHER_BASE_URL","ECOMMERCE_BASE_URL","IGNORED_ERROR_REGEX","LANGUAGE_PREFERENCE_COOKIE_NAME","LEARNING_BASE_URL","LMS_BASE_URL","LOGIN_URL","LOGOUT_URL","STUDIO_BASE_URL","MARKETING_SITE_BASE_URL","ORDER_HISTORY_URL","REFRESH_ACCESS_TOKEN_ENDPOINT","SECURE_COOKIES","SEGMENT_KEY","SITE_NAME","USER_INFO_COOKIE_NAME","LOGO_URL","LOGO_TRADEMARK_URL","LOGO_WHITE_URL","FAVICON_URL","MFE_CONFIG_API_URL","APP_ID","SUPPORT_URL","getConfig","setConfig","newConfig","mergeConfig","Object","assign","ensureConfig","keys","requester","arguments","length","forEach","key","console","warn","concat"],"sources":["../src/config.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform**\n *\n * The configuration module provides utilities for working with an application's configuration\n * document (ConfigDocument). This module uses `process.env` to import configuration variables\n * from the command-line build process. It can be dynamically extended at run-time using a\n * `config` initialization handler. Please see the Initialization documentation for more\n * information on handlers and initialization phases.\n *\n * ```\n * import { getConfig } from '@edx/frontend-platform';\n *\n * const {\n * BASE_URL,\n * LMS_BASE_URL,\n * LOGIN_URL,\n * LOGIN_URL,\n * REFRESH_ACCESS_TOKEN_ENDPOINT,\n * ACCESS_TOKEN_COOKIE_NAME,\n * CSRF_TOKEN_API_PATH,\n * } = getConfig();\n * ```\n *\n * @module Config\n */\n\nimport { APP_CONFIG_INITIALIZED, CONFIG_CHANGED } from './constants';\n\nimport { publish, subscribe } from './pubSub';\nimport { ensureDefinedConfig } from './utils';\n\nfunction extractRegex(envVar) {\n // Convert the environment variable string to a regex, while guarding\n // against a non-string and an empty/whitespace-only string.\n if (typeof envVar === 'string' && envVar.trim() !== '') {\n return new RegExp(envVar);\n }\n return undefined;\n}\n\nconst ENVIRONMENT = process.env.NODE_ENV;\nlet config = {\n ACCESS_TOKEN_COOKIE_NAME: process.env.ACCESS_TOKEN_COOKIE_NAME,\n ACCOUNT_PROFILE_URL: process.env.ACCOUNT_PROFILE_URL,\n ACCOUNT_SETTINGS_URL: process.env.ACCOUNT_SETTINGS_URL,\n BASE_URL: process.env.BASE_URL,\n PUBLIC_PATH: process.env.PUBLIC_PATH || '/',\n CREDENTIALS_BASE_URL: process.env.CREDENTIALS_BASE_URL,\n CSRF_TOKEN_API_PATH: process.env.CSRF_TOKEN_API_PATH,\n DISCOVERY_API_BASE_URL: process.env.DISCOVERY_API_BASE_URL,\n PUBLISHER_BASE_URL: process.env.PUBLISHER_BASE_URL,\n ECOMMERCE_BASE_URL: process.env.ECOMMERCE_BASE_URL,\n ENVIRONMENT,\n IGNORED_ERROR_REGEX: extractRegex(process.env.IGNORED_ERROR_REGEX),\n LANGUAGE_PREFERENCE_COOKIE_NAME: process.env.LANGUAGE_PREFERENCE_COOKIE_NAME,\n LEARNING_BASE_URL: process.env.LEARNING_BASE_URL,\n LMS_BASE_URL: process.env.LMS_BASE_URL,\n LOGIN_URL: process.env.LOGIN_URL,\n LOGOUT_URL: process.env.LOGOUT_URL,\n STUDIO_BASE_URL: process.env.STUDIO_BASE_URL,\n MARKETING_SITE_BASE_URL: process.env.MARKETING_SITE_BASE_URL,\n ORDER_HISTORY_URL: process.env.ORDER_HISTORY_URL,\n REFRESH_ACCESS_TOKEN_ENDPOINT: process.env.REFRESH_ACCESS_TOKEN_ENDPOINT,\n SECURE_COOKIES: ENVIRONMENT !== 'development',\n SEGMENT_KEY: process.env.SEGMENT_KEY,\n SITE_NAME: process.env.SITE_NAME,\n USER_INFO_COOKIE_NAME: process.env.USER_INFO_COOKIE_NAME,\n LOGO_URL: process.env.LOGO_URL,\n LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,\n LOGO_WHITE_URL: process.env.LOGO_WHITE_URL,\n FAVICON_URL: process.env.FAVICON_URL,\n MFE_CONFIG_API_URL: process.env.MFE_CONFIG_API_URL,\n APP_ID: process.env.APP_ID,\n SUPPORT_URL: process.env.SUPPORT_URL,\n};\n\n/**\n * Getter for the application configuration document. This is synchronous and merely returns a\n * reference to an existing object, and is thus safe to call as often as desired. The document\n * should have the following keys at a minimum:\n *\n * @returns {ConfigDocument}\n */\nexport function getConfig() {\n return config;\n}\n\n/**\n * Replaces the existing ConfigDocument. This is not commonly used, but can be helpful for tests.\n *\n * The supplied config document will be tested with `ensureDefinedConfig` to ensure it does not\n * have any `undefined` keys.\n *\n * @param {ConfigDocument} newConfig\n */\nexport function setConfig(newConfig) {\n ensureDefinedConfig(config, 'config');\n config = newConfig;\n publish(CONFIG_CHANGED);\n}\n\n/**\n * Merges additional configuration values into the ConfigDocument returned by `getConfig`. Will\n * override any values that exist with the same keys.\n *\n * ```\n * mergeConfig({\n * NEW_KEY: 'new value',\n * OTHER_NEW_KEY: 'other new value',\n * });\n *\n * If any of the key values are `undefined`, an error will be logged to 'warn'.\n *\n * @param {Object} newConfig\n */\nexport function mergeConfig(newConfig) {\n ensureDefinedConfig(newConfig, 'ProcessEnvConfigService');\n config = Object.assign(config, newConfig);\n publish(CONFIG_CHANGED);\n}\n\n/**\n * A method allowing application code to indicate that particular ConfigDocument keys are required\n * for them to function. This is useful for diagnosing development/deployment issues, primarily,\n * by surfacing misconfigurations early. For instance, if the build process fails to supply an\n * environment variable on the command-line, it's possible that one of the `process.env` variables\n * will be undefined. Should be used in conjunction with `mergeConfig` for custom `ConfigDocument`\n * properties. Requester is for informational/error reporting purposes only.\n *\n * ```\n * ensureConfig(['LMS_BASE_URL', 'LOGIN_URL'], 'MySpecialComponent');\n *\n * // Will log a warning with:\n * // \"App configuration error: LOGIN_URL is required by MySpecialComponent.\"\n * // if LOGIN_URL is undefined, for example.\n * ```\n *\n * *NOTE*: `ensureConfig` waits until `APP_CONFIG_INITIALIZED` is published to verify the existence\n * of the specified properties. This means that this function is compatible with custom `config`\n * phase handlers responsible for loading additional configuration data in the initialization\n * sequence.\n *\n * @param {Array} keys\n * @param {string} [requester='unspecified application code']\n */\nexport function ensureConfig(keys, requester = 'unspecified application code') {\n subscribe(APP_CONFIG_INITIALIZED, () => {\n keys.forEach((key) => {\n if (config[key] === undefined) {\n // eslint-disable-next-line no-console\n console.warn(`App configuration error: ${key} is required by ${requester}.`);\n }\n });\n });\n}\n\n/**\n * An object describing the current application configuration.\n *\n * The implementation loads this document via `process.env` variables.\n *\n * ```\n * {\n * BASE_URL: process.env.BASE_URL,\n * // ... other vars\n * }\n * ```\n *\n * When using Webpack (i.e., normal usage), the build process is responsible for supplying these\n * variables via command-line environment variables. That means they must be supplied at build\n * time.\n *\n * @name ConfigDocument\n * @memberof module:Config\n * @property {string} ACCESS_TOKEN_COOKIE_NAME\n * @property {string} ACCOUNT_PROFILE_URL\n * @property {string} ACCOUNT_SETTINGS_URL\n * @property {string} BASE_URL The URL of the current application.\n * @property {string} CREDENTIALS_BASE_URL\n * @property {string} CSRF_TOKEN_API_PATH\n * @property {string} DISCOVERY_API_BASE_URL\n * @property {string} PUBLISHER_BASE_URL\n * @property {string} ECOMMERCE_BASE_URL\n * @property {string} ENVIRONMENT This is one of: development, production, or test.\n * @property {string} IGNORED_ERROR_REGEX\n * @property {string} LANGUAGE_PREFERENCE_COOKIE_NAME\n * @property {string} LEARNING_BASE_URL\n * @property {string} LMS_BASE_URL\n * @property {string} LOGIN_URL\n * @property {string} LOGOUT_URL\n * @property {string} STUDIO_BASE_URL\n * @property {string} MARKETING_SITE_BASE_URL\n * @property {string} ORDER_HISTORY_URL\n * @property {string} REFRESH_ACCESS_TOKEN_ENDPOINT\n * @property {boolean} SECURE_COOKIES\n * @property {string} SEGMENT_KEY\n * @property {string} SITE_NAME\n * @property {string} USER_INFO_COOKIE_NAME\n * @property {string} LOGO_URL\n * @property {string} LOGO_TRADEMARK_URL\n * @property {string} LOGO_WHITE_URL\n * @property {string} FAVICON_URL\n * @property {string} MFE_CONFIG_API_URL\n * @property {string} APP_ID\n * @property {string} SUPPORT_URL\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;;AAEA,SAASA,sBAAsB,EAAEC,cAAc,QAAQ,aAAa;AAEpE,SAASC,OAAO,EAAEC,SAAS,QAAQ,UAAU;AAC7C,SAASC,mBAAmB,QAAQ,SAAS;AAE7C,SAASC,YAAYA,CAACC,MAAM,EAAE;EAC5B;EACA;EACA,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,CAACC,IAAI,EAAE,KAAK,EAAE,EAAE;IACtD,OAAO,IAAIC,MAAM,CAACF,MAAM,CAAC;EAC3B;EACA,OAAOG,SAAS;AAClB;AAEA,IAAMC,WAAW,GAAGC,OAAO,CAACC,GAAG,CAACC,QAAQ;AACxC,IAAIC,MAAM,GAAG;EACXC,wBAAwB,EAAEJ,OAAO,CAACC,GAAG,CAACG,wBAAwB;EAC9DC,mBAAmB,EAAEL,OAAO,CAACC,GAAG,CAACI,mBAAmB;EACpDC,oBAAoB,EAAEN,OAAO,CAACC,GAAG,CAACK,oBAAoB;EACtDC,QAAQ,EAAEP,OAAO,CAACC,GAAG,CAACM,QAAQ;EAC9BC,WAAW,EAAER,OAAO,CAACC,GAAG,CAACO,WAAW,IAAI,GAAG;EAC3CC,oBAAoB,EAAET,OAAO,CAACC,GAAG,CAACQ,oBAAoB;EACtDC,mBAAmB,EAAEV,OAAO,CAACC,GAAG,CA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,OAAI;MAC9E;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ;;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
1
|
+
{"version":3,"file":"config.js","names":["APP_CONFIG_INITIALIZED","CONFIG_CHANGED","publish","subscribe","ensureDefinedConfig","extractRegex","envVar","trim","RegExp","undefined","ENVIRONMENT","process","env","NODE_ENV","config","ACCESS_TOKEN_COOKIE_NAME","ACCOUNT_PROFILE_URL","ACCOUNT_SETTINGS_URL","BASE_URL","PUBLIC_PATH","CREDENTIALS_BASE_URL","CSRF_TOKEN_API_PATH","DISCOVERY_API_BASE_URL","PUBLISHER_BASE_URL","ECOMMERCE_BASE_URL","IGNORED_ERROR_REGEX","LANGUAGE_PREFERENCE_COOKIE_NAME","LEARNING_BASE_URL","LMS_BASE_URL","LOGIN_URL","LOGOUT_URL","STUDIO_BASE_URL","MARKETING_SITE_BASE_URL","ORDER_HISTORY_URL","REFRESH_ACCESS_TOKEN_ENDPOINT","SECURE_COOKIES","SEGMENT_KEY","SITE_NAME","USER_INFO_COOKIE_NAME","LOGO_URL","LOGO_TRADEMARK_URL","LOGO_WHITE_URL","FAVICON_URL","MFE_CONFIG_API_URL","APP_ID","SUPPORT_URL","getConfig","setConfig","newConfig","mergeConfig","Object","assign","ensureConfig","keys","requester","arguments","length","forEach","key","console","warn","concat"],"sources":["../src/config.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform**\n *\n * The configuration module provides utilities for working with an application's configuration\n * document (ConfigDocument). This module uses `process.env` to import configuration variables\n * from the command-line build process. It can be dynamically extended at run-time using a\n * `config` initialization handler. Please see the Initialization documentation for more\n * information on handlers and initialization phases.\n *\n * ```\n * import { getConfig } from '@edx/frontend-platform';\n *\n * const {\n * BASE_URL,\n * LMS_BASE_URL,\n * LOGIN_URL,\n * LOGIN_URL,\n * REFRESH_ACCESS_TOKEN_ENDPOINT,\n * ACCESS_TOKEN_COOKIE_NAME,\n * CSRF_TOKEN_API_PATH,\n * } = getConfig();\n * ```\n *\n * @module Config\n */\n\nimport { APP_CONFIG_INITIALIZED, CONFIG_CHANGED } from './constants';\n\nimport { publish, subscribe } from './pubSub';\nimport { ensureDefinedConfig } from './utils';\n\nfunction extractRegex(envVar) {\n // Convert the environment variable string to a regex, while guarding\n // against a non-string and an empty/whitespace-only string.\n if (typeof envVar === 'string' && envVar.trim() !== '') {\n return new RegExp(envVar);\n }\n return undefined;\n}\n\nconst ENVIRONMENT = process.env.NODE_ENV;\nlet config = {\n ACCESS_TOKEN_COOKIE_NAME: process.env.ACCESS_TOKEN_COOKIE_NAME,\n ACCOUNT_PROFILE_URL: process.env.ACCOUNT_PROFILE_URL,\n ACCOUNT_SETTINGS_URL: process.env.ACCOUNT_SETTINGS_URL,\n BASE_URL: process.env.BASE_URL,\n PUBLIC_PATH: process.env.PUBLIC_PATH || '/',\n CREDENTIALS_BASE_URL: process.env.CREDENTIALS_BASE_URL,\n CSRF_TOKEN_API_PATH: process.env.CSRF_TOKEN_API_PATH,\n DISCOVERY_API_BASE_URL: process.env.DISCOVERY_API_BASE_URL,\n PUBLISHER_BASE_URL: process.env.PUBLISHER_BASE_URL,\n ECOMMERCE_BASE_URL: process.env.ECOMMERCE_BASE_URL,\n ENVIRONMENT,\n IGNORED_ERROR_REGEX: extractRegex(process.env.IGNORED_ERROR_REGEX),\n LANGUAGE_PREFERENCE_COOKIE_NAME: process.env.LANGUAGE_PREFERENCE_COOKIE_NAME,\n LEARNING_BASE_URL: process.env.LEARNING_BASE_URL,\n LMS_BASE_URL: process.env.LMS_BASE_URL,\n LOGIN_URL: process.env.LOGIN_URL,\n LOGOUT_URL: process.env.LOGOUT_URL,\n STUDIO_BASE_URL: process.env.STUDIO_BASE_URL,\n MARKETING_SITE_BASE_URL: process.env.MARKETING_SITE_BASE_URL,\n ORDER_HISTORY_URL: process.env.ORDER_HISTORY_URL,\n REFRESH_ACCESS_TOKEN_ENDPOINT: process.env.REFRESH_ACCESS_TOKEN_ENDPOINT,\n SECURE_COOKIES: ENVIRONMENT !== 'development',\n SEGMENT_KEY: process.env.SEGMENT_KEY,\n SITE_NAME: process.env.SITE_NAME,\n USER_INFO_COOKIE_NAME: process.env.USER_INFO_COOKIE_NAME,\n LOGO_URL: process.env.LOGO_URL,\n LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,\n LOGO_WHITE_URL: process.env.LOGO_WHITE_URL,\n FAVICON_URL: process.env.FAVICON_URL,\n MFE_CONFIG_API_URL: process.env.MFE_CONFIG_API_URL,\n APP_ID: process.env.APP_ID,\n SUPPORT_URL: process.env.SUPPORT_URL,\n};\n\n/**\n * Getter for the application configuration document. This is synchronous and merely returns a\n * reference to an existing object, and is thus safe to call as often as desired. The document\n * should have the following keys at a minimum:\n *\n * @returns {ConfigDocument}\n */\nexport function getConfig() {\n return config;\n}\n\n/**\n * Replaces the existing ConfigDocument. This is not commonly used, but can be helpful for tests.\n *\n * The supplied config document will be tested with `ensureDefinedConfig` to ensure it does not\n * have any `undefined` keys.\n *\n * @param {ConfigDocument} newConfig\n */\nexport function setConfig(newConfig) {\n ensureDefinedConfig(config, 'config');\n config = newConfig;\n publish(CONFIG_CHANGED);\n}\n\n/**\n * Merges additional configuration values into the ConfigDocument returned by `getConfig`. Will\n * override any values that exist with the same keys.\n *\n * ```\n * mergeConfig({\n * NEW_KEY: 'new value',\n * OTHER_NEW_KEY: 'other new value',\n * });\n *\n * If any of the key values are `undefined`, an error will be logged to 'warn'.\n *\n * @param {Object} newConfig\n */\nexport function mergeConfig(newConfig) {\n ensureDefinedConfig(newConfig, 'ProcessEnvConfigService');\n config = Object.assign(config, newConfig);\n publish(CONFIG_CHANGED);\n}\n\n/**\n * A method allowing application code to indicate that particular ConfigDocument keys are required\n * for them to function. This is useful for diagnosing development/deployment issues, primarily,\n * by surfacing misconfigurations early. For instance, if the build process fails to supply an\n * environment variable on the command-line, it's possible that one of the `process.env` variables\n * will be undefined. Should be used in conjunction with `mergeConfig` for custom `ConfigDocument`\n * properties. Requester is for informational/error reporting purposes only.\n *\n * ```\n * ensureConfig(['LMS_BASE_URL', 'LOGIN_URL'], 'MySpecialComponent');\n *\n * // Will log a warning with:\n * // \"App configuration error: LOGIN_URL is required by MySpecialComponent.\"\n * // if LOGIN_URL is undefined, for example.\n * ```\n *\n * *NOTE*: `ensureConfig` waits until `APP_CONFIG_INITIALIZED` is published to verify the existence\n * of the specified properties. This means that this function is compatible with custom `config`\n * phase handlers responsible for loading additional configuration data in the initialization\n * sequence.\n *\n * @param {Array} keys\n * @param {string} [requester='unspecified application code']\n */\nexport function ensureConfig(keys, requester = 'unspecified application code') {\n subscribe(APP_CONFIG_INITIALIZED, () => {\n keys.forEach((key) => {\n if (config[key] === undefined) {\n // eslint-disable-next-line no-console\n console.warn(`App configuration error: ${key} is required by ${requester}.`);\n }\n });\n });\n}\n\n/**\n * An object describing the current application configuration.\n *\n * The implementation loads this document via `process.env` variables.\n *\n * ```\n * {\n * BASE_URL: process.env.BASE_URL,\n * // ... other vars\n * }\n * ```\n *\n * When using Webpack (i.e., normal usage), the build process is responsible for supplying these\n * variables via command-line environment variables. That means they must be supplied at build\n * time.\n *\n * @name ConfigDocument\n * @memberof module:Config\n * @property {string} ACCESS_TOKEN_COOKIE_NAME\n * @property {string} ACCOUNT_PROFILE_URL\n * @property {string} ACCOUNT_SETTINGS_URL\n * @property {string} BASE_URL The URL of the current application.\n * @property {string} CREDENTIALS_BASE_URL\n * @property {string} CSRF_TOKEN_API_PATH\n * @property {string} DISCOVERY_API_BASE_URL\n * @property {string} PUBLISHER_BASE_URL\n * @property {string} ECOMMERCE_BASE_URL\n * @property {string} ENVIRONMENT This is one of: development, production, or test.\n * @property {string} IGNORED_ERROR_REGEX\n * @property {string} LANGUAGE_PREFERENCE_COOKIE_NAME\n * @property {string} LEARNING_BASE_URL\n * @property {string} LMS_BASE_URL\n * @property {string} LOGIN_URL\n * @property {string} LOGOUT_URL\n * @property {string} STUDIO_BASE_URL\n * @property {string} MARKETING_SITE_BASE_URL\n * @property {string} ORDER_HISTORY_URL\n * @property {string} REFRESH_ACCESS_TOKEN_ENDPOINT\n * @property {boolean} SECURE_COOKIES\n * @property {string} SEGMENT_KEY\n * @property {string} SITE_NAME\n * @property {string} USER_INFO_COOKIE_NAME\n * @property {string} LOGO_URL\n * @property {string} LOGO_TRADEMARK_URL\n * @property {string} LOGO_WHITE_URL\n * @property {string} FAVICON_URL\n * @property {string} MFE_CONFIG_API_URL\n * @property {string} APP_ID\n * @property {string} SUPPORT_URL\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;;AAEA,SAASA,sBAAsB,EAAEC,cAAc,QAAQ,aAAa;AAEpE,SAASC,OAAO,EAAEC,SAAS,QAAQ,UAAU;AAC7C,SAASC,mBAAmB,QAAQ,SAAS;AAE7C,SAASC,YAAYA,CAACC,MAAM,EAAE;EAC5B;EACA;EACA,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,CAACC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;IACtD,OAAO,IAAIC,MAAM,CAACF,MAAM,CAAC;EAC3B;EACA,OAAOG,SAAS;AAClB;AAEA,IAAMC,WAAW,GAAGC,OAAO,CAACC,GAAG,CAACC,QAAQ;AACxC,IAAIC,MAAM,GAAG;EACXC,wBAAwB,EAAEJ,OAAO,CAACC,GAAG,CAACG,wBAAwB;EAC9DC,mBAAmB,EAAEL,OAAO,CAACC,GAAG,CAACI,mBAAmB;EACpDC,oBAAoB,EAAEN,OAAO,CA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3EpD,SAAS,CAACH,sBAAsB,EAAE,YAAM;IACtCqD,IAAI,CAACI,OAAO,CAAC,UAACC,GAAG,EAAK;MACpB,IAAI5C,MAAM,CAAC4C,GAAG,CAAC,KAAKjD,SAAS,EAAE;QAC7B;QACAkD,OAAO,CAACC,IAAI,6BAAAC,MAAA,CAA6BH,GAAG,sBAAAG,MAAA,CAAmBP,SAAS,MAAG,CAAC;MAC9E;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ;;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/i18n/countries.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"countries.js","names":["COUNTRIES","langs","countryLangs","getPrimaryLanguageSubtag","registerLocale","require","getCountryMessages","locale","primaryLanguageSubtag","languageCode","includes","getNames","getCountryList","countryMessages","Object","entries","map","_ref","_ref2","_slicedToArray","code","name"],"sources":["../../src/i18n/countries.js"],"sourcesContent":["/* eslint-disable import/extensions */\nimport COUNTRIES, { langs as countryLangs } from 'i18n-iso-countries';\n\nimport { getPrimaryLanguageSubtag } from './lib';\n\n/*\n * COUNTRY LISTS\n *\n * Lists of country names localized in supported languages.\n *\n * TODO: When we start dynamically loading translations only for the current locale, change this.\n */\n\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ar.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/en.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/es.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/fr.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/zh.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ca.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/he.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/id.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ko.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/pl.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/pt.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ru.json'));\n// COUNTRIES.registerLocale(require('i18n-iso-countries/langs/th.json')); // Doesn't exist in lib.\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/uk.json'));\n\n/**\n * Provides a lookup table of country IDs to country names for the current locale.\n *\n * @memberof module:I18n\n */\nexport function getCountryMessages(locale) {\n const primaryLanguageSubtag = getPrimaryLanguageSubtag(locale);\n const languageCode = countryLangs().includes(primaryLanguageSubtag) ? primaryLanguageSubtag : 'en';\n\n return COUNTRIES.getNames(languageCode);\n}\n\n/**\n * Provides a list of countries represented as objects of the following shape:\n *\n * {\n * key, // The ID of the country\n * name // The localized name of the country\n * }\n *\n * TODO: ARCH-878: The list should be sorted alphabetically in the current locale.\n * This is useful for populating dropdowns.\n *\n * @memberof module:I18n\n */\nexport function getCountryList(locale) {\n const countryMessages = getCountryMessages(locale);\n return Object.entries(countryMessages).map(([code, name]) => ({ code, name }));\n}\n"],"mappings":";;;;;;AAAA;AACA,OAAOA,SAAS,IAAIC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;AAErE,SAASC,wBAAwB,QAAQ,OAAO;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEAH,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrEL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrEL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrEL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrEL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrEL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrEL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrEL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrEL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrEL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrEL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrEL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrE;AACAL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,MAAM,EAAE;EACzC,IAAMC,qBAAqB,GAAGL,wBAAwB,CAACI,MAAM,CAAC;EAC9D,IAAME,YAAY,GAAGP,YAAY,
|
|
1
|
+
{"version":3,"file":"countries.js","names":["COUNTRIES","langs","countryLangs","getPrimaryLanguageSubtag","registerLocale","require","getCountryMessages","locale","primaryLanguageSubtag","languageCode","includes","getNames","getCountryList","countryMessages","Object","entries","map","_ref","_ref2","_slicedToArray","code","name"],"sources":["../../src/i18n/countries.js"],"sourcesContent":["/* eslint-disable import/extensions */\nimport COUNTRIES, { langs as countryLangs } from 'i18n-iso-countries';\n\nimport { getPrimaryLanguageSubtag } from './lib';\n\n/*\n * COUNTRY LISTS\n *\n * Lists of country names localized in supported languages.\n *\n * TODO: When we start dynamically loading translations only for the current locale, change this.\n */\n\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ar.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/en.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/es.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/fr.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/zh.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ca.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/he.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/id.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ko.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/pl.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/pt.json'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ru.json'));\n// COUNTRIES.registerLocale(require('i18n-iso-countries/langs/th.json')); // Doesn't exist in lib.\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/uk.json'));\n\n/**\n * Provides a lookup table of country IDs to country names for the current locale.\n *\n * @memberof module:I18n\n */\nexport function getCountryMessages(locale) {\n const primaryLanguageSubtag = getPrimaryLanguageSubtag(locale);\n const languageCode = countryLangs().includes(primaryLanguageSubtag) ? primaryLanguageSubtag : 'en';\n\n return COUNTRIES.getNames(languageCode);\n}\n\n/**\n * Provides a list of countries represented as objects of the following shape:\n *\n * {\n * key, // The ID of the country\n * name // The localized name of the country\n * }\n *\n * TODO: ARCH-878: The list should be sorted alphabetically in the current locale.\n * This is useful for populating dropdowns.\n *\n * @memberof module:I18n\n */\nexport function getCountryList(locale) {\n const countryMessages = getCountryMessages(locale);\n return Object.entries(countryMessages).map(([code, name]) => ({ code, name }));\n}\n"],"mappings":";;;;;;AAAA;AACA,OAAOA,SAAS,IAAIC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;AAErE,SAASC,wBAAwB,QAAQ,OAAO;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEAH,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,kCAAkC,CAAC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,OAAOO,MAAM,CAACC,OAAO,CAACF,eAAe,CAAC,CAACG,GAAG,CAAC,UAAAC,IAAA;IAAA,IAAAC,KAAA,GAAAC,cAAA,CAAAF,IAAA;MAAEG,IAAI,GAAAF,KAAA;MAAEG,IAAI,GAAAH,KAAA;IAAA,OAAO;MAAEE,IAAI,EAAJA,IAAI;MAAEC,IAAI,EAAJA;IAAK,CAAC;EAAA,CAAC,CAAC;AAChF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injectIntlWithShim.js","names":["React","injectIntl","getLoggingService","intlShape","injectIntlWithShim","WrappedComponent","ShimmedIntlComponent","_React$Component","_inherits","_super","_createSuper","props","_this","_classCallCheck","call","shimmedIntl","Object","create","intl","formatMessage","value","definition","_this$props$intl","undefined","id","error","Error","process","env","NODE_ENV","console","logError","_len","arguments","length","args","Array","_key","apply","concat","_createClass","key","render","createElement","_extends","Component","propTypes","isRequired"],"sources":["../../src/i18n/injectIntlWithShim.jsx"],"sourcesContent":["import React from 'react';\nimport { injectIntl } from 'react-intl';\nimport { getLoggingService, intlShape } from './lib';\n\n/**\n * This function wraps react-intl's injectIntl function in order to add error logging to the intl\n * property's formatMessage function.\n *\n * @memberof I18n\n */\nconst injectIntlWithShim = (WrappedComponent) => {\n class ShimmedIntlComponent extends React.Component {\n constructor(props) {\n super(props);\n this.shimmedIntl = Object.create(this.props.intl, {\n formatMessage: {\n value: (definition, ...args) => {\n if (definition === undefined || definition.id === undefined) {\n const error = new Error('i18n error: An undefined message was supplied to intl.formatMessage.');\n if (process.env.NODE_ENV !== 'production') {\n console.error(error); // eslint-disable-line no-console\n return '!!! Missing message supplied to intl.formatMessage !!!';\n }\n getLoggingService().logError(error);\n return ''; // Fail silently in production\n }\n return this.props.intl.formatMessage(definition, ...args);\n },\n },\n });\n }\n\n render() {\n return <WrappedComponent {...this.props} intl={this.shimmedIntl} />;\n }\n }\n\n ShimmedIntlComponent.propTypes = {\n intl: intlShape.isRequired,\n };\n\n return injectIntl(ShimmedIntlComponent);\n};\n\nexport default injectIntlWithShim;\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,YAAY;AACvC,SAASC,iBAAiB,EAAEC,SAAS,QAAQ,OAAO;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,gBAAgB,EAAK;EAAA,IACzCC,oBAAoB,0BAAAC,gBAAA;IAAAC,SAAA,CAAAF,oBAAA,EAAAC,gBAAA;IAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,oBAAA;IACxB,SAAAA,qBAAYK,KAAK,EAAE;MAAA,IAAAC,KAAA;MAAAC,eAAA,OAAAP,oBAAA;MACjBM,KAAA,GAAAH,MAAA,CAAAK,IAAA,OAAMH,KAAK;MACXC,KAAA,CAAKG,WAAW,GAAGC,MAAM,CAACC,MAAM,CAACL,KAAA,CAAKD,KAAK,CAACO,IAAI,EAAE;QAChDC,aAAa,EAAE;UACbC,KAAK,EAAE,SAAAA,MAACC,UAAU,EAAc;YAAA,IAAAC,gBAAA;YAC9B,IAAID,UAAU,KAAKE,SAAS,IAAIF,UAAU,CAACG,EAAE,KAAKD,SAAS,EAAE;cAC3D,IAAME,KAAK,GAAG,IAAIC,KAAK,CAAC,sEAAsE,CAAC;cAC/F,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;gBACzCC,OAAO,CAACL,KAAK,CAACA,KAAK,CAAC,CAAC,CAAC;gBACtB,OAAO,wDAAwD;cACjE;cACAvB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"injectIntlWithShim.js","names":["React","injectIntl","getLoggingService","intlShape","injectIntlWithShim","WrappedComponent","ShimmedIntlComponent","_React$Component","_inherits","_super","_createSuper","props","_this","_classCallCheck","call","shimmedIntl","Object","create","intl","formatMessage","value","definition","_this$props$intl","undefined","id","error","Error","process","env","NODE_ENV","console","logError","_len","arguments","length","args","Array","_key","apply","concat","_createClass","key","render","createElement","_extends","Component","propTypes","isRequired"],"sources":["../../src/i18n/injectIntlWithShim.jsx"],"sourcesContent":["import React from 'react';\nimport { injectIntl } from 'react-intl';\nimport { getLoggingService, intlShape } from './lib';\n\n/**\n * This function wraps react-intl's injectIntl function in order to add error logging to the intl\n * property's formatMessage function.\n *\n * @memberof I18n\n */\nconst injectIntlWithShim = (WrappedComponent) => {\n class ShimmedIntlComponent extends React.Component {\n constructor(props) {\n super(props);\n this.shimmedIntl = Object.create(this.props.intl, {\n formatMessage: {\n value: (definition, ...args) => {\n if (definition === undefined || definition.id === undefined) {\n const error = new Error('i18n error: An undefined message was supplied to intl.formatMessage.');\n if (process.env.NODE_ENV !== 'production') {\n console.error(error); // eslint-disable-line no-console\n return '!!! Missing message supplied to intl.formatMessage !!!';\n }\n getLoggingService().logError(error);\n return ''; // Fail silently in production\n }\n return this.props.intl.formatMessage(definition, ...args);\n },\n },\n });\n }\n\n render() {\n return <WrappedComponent {...this.props} intl={this.shimmedIntl} />;\n }\n }\n\n ShimmedIntlComponent.propTypes = {\n intl: intlShape.isRequired,\n };\n\n return injectIntl(ShimmedIntlComponent);\n};\n\nexport default injectIntlWithShim;\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,YAAY;AACvC,SAASC,iBAAiB,EAAEC,SAAS,QAAQ,OAAO;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,gBAAgB,EAAK;EAAA,IACzCC,oBAAoB,0BAAAC,gBAAA;IAAAC,SAAA,CAAAF,oBAAA,EAAAC,gBAAA;IAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,oBAAA;IACxB,SAAAA,qBAAYK,KAAK,EAAE;MAAA,IAAAC,KAAA;MAAAC,eAAA,OAAAP,oBAAA;MACjBM,KAAA,GAAAH,MA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MACrE;IAAC;IAAA,OAAAT,oBAAA;EAAA,EAvBgCN,KAAK,CAAC6C,SAAS;EA0BlDvC,oBAAoB,CAACwC,SAAS,GAAG;IAC/B5B,IAAI,EAAEf,SAAS,CAAC4C;EAClB,CAAC;EAED,OAAO9C,UAAU,CAACK,oBAAoB,CAAC;AACzC,CAAC;AAED,eAAeF,kBAAkB"}
|
package/i18n/languages.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"languages.js","names":["LANGUAGES","langs","languageLangs","getPrimaryLanguageSubtag","registerLocale","require","getLanguageMessages","locale","primaryLanguageSubtag","languageCode","includes","getNames","getLanguageList","languageMessages","Object","entries","map","_ref","_ref2","_slicedToArray","code","name"],"sources":["../../src/i18n/languages.js"],"sourcesContent":["/* eslint-disable import/extensions */\nimport LANGUAGES, { langs as languageLangs } from '@cospired/i18n-iso-languages';\n\nimport { getPrimaryLanguageSubtag } from './lib';\n\n/*\n * LANGUAGE LISTS\n *\n * Lists of language names localized in supported languages.\n *\n * TODO: When we start dynamically loading translations only for the current locale, change this.\n * TODO: Also note that a bunch of languages are missing here. They're present but commented out\n * for reference. That's because they're not implemented in this library. If you read this and it's\n * been a while, go check and see if that's changed!\n */\n\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ar.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/en.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/es.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/fr.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/zh.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ca.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/he.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/id.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ko.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pl.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pt.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ru.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/th.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/uk.json'));\n\n/**\n * Provides a lookup table of language IDs to language names for the current locale.\n *\n * @memberof I18n\n */\nexport const getLanguageMessages = (locale) => {\n const primaryLanguageSubtag = getPrimaryLanguageSubtag(locale);\n const languageCode = languageLangs().includes(primaryLanguageSubtag) ? primaryLanguageSubtag : 'en';\n\n return LANGUAGES.getNames(languageCode);\n};\n\n/**\n * Provides a list of languages represented as objects of the following shape:\n *\n * {\n * key, // The ID of the language\n * name // The localized name of the language\n * }\n *\n * TODO: ARCH-878: The list should be sorted alphabetically in the current locale.\n * This is useful for populating dropdowns.\n *\n * @memberof I18n\n */\nexport const getLanguageList = (locale) => {\n const languageMessages = getLanguageMessages(locale);\n return Object.entries(languageMessages).map(([code, name]) => ({ code, name }));\n};\n"],"mappings":";;;;;;AAAA;AACA,OAAOA,SAAS,IAAIC,KAAK,IAAIC,aAAa,QAAQ,8BAA8B;AAEhF,SAASC,wBAAwB,QAAQ,OAAO;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACAH,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAC/EL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAC/EL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAC/E;AACA;AACA;AACA;AACA;AACAL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAC/EL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAC/E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,MAAM,EAAK;EAC7C,IAAMC,qBAAqB,GAAGL,wBAAwB,CAACI,MAAM,CAAC;EAC9D,IAAME,YAAY,GAAGP,aAAa,
|
|
1
|
+
{"version":3,"file":"languages.js","names":["LANGUAGES","langs","languageLangs","getPrimaryLanguageSubtag","registerLocale","require","getLanguageMessages","locale","primaryLanguageSubtag","languageCode","includes","getNames","getLanguageList","languageMessages","Object","entries","map","_ref","_ref2","_slicedToArray","code","name"],"sources":["../../src/i18n/languages.js"],"sourcesContent":["/* eslint-disable import/extensions */\nimport LANGUAGES, { langs as languageLangs } from '@cospired/i18n-iso-languages';\n\nimport { getPrimaryLanguageSubtag } from './lib';\n\n/*\n * LANGUAGE LISTS\n *\n * Lists of language names localized in supported languages.\n *\n * TODO: When we start dynamically loading translations only for the current locale, change this.\n * TODO: Also note that a bunch of languages are missing here. They're present but commented out\n * for reference. That's because they're not implemented in this library. If you read this and it's\n * been a while, go check and see if that's changed!\n */\n\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ar.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/en.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/es.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/fr.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/zh.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ca.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/he.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/id.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ko.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pl.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pt.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ru.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/th.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/uk.json'));\n\n/**\n * Provides a lookup table of language IDs to language names for the current locale.\n *\n * @memberof I18n\n */\nexport const getLanguageMessages = (locale) => {\n const primaryLanguageSubtag = getPrimaryLanguageSubtag(locale);\n const languageCode = languageLangs().includes(primaryLanguageSubtag) ? primaryLanguageSubtag : 'en';\n\n return LANGUAGES.getNames(languageCode);\n};\n\n/**\n * Provides a list of languages represented as objects of the following shape:\n *\n * {\n * key, // The ID of the language\n * name // The localized name of the language\n * }\n *\n * TODO: ARCH-878: The list should be sorted alphabetically in the current locale.\n * This is useful for populating dropdowns.\n *\n * @memberof I18n\n */\nexport const getLanguageList = (locale) => {\n const languageMessages = getLanguageMessages(locale);\n return Object.entries(languageMessages).map(([code, name]) => ({ code, name }));\n};\n"],"mappings":";;;;;;AAAA;AACA,OAAOA,SAAS,IAAIC,KAAK,IAAIC,aAAa,QAAQ,8BAA8B;AAEhF,SAASC,wBAAwB,QAAQ,OAAO;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACAH,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAC/EL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAC/EL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAC/E;AACA;AACA;AACA;AACA;AACAL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAC/EL,SAAS,CAACI,cAAc,CAACC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAC/E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,MAAM,EAAK;EAC7C,IAAMC,qBAAqB,GAAGL,wBAAwB,CAACI,MAAM,CAAC;EAC9D,IAAME,YAAY,GAAGP,aAAa,CAAC,CAAC,CAACQ,QAAQ,CAACF,qBAAqB,CAAC,GAAGA,qBAAqB,GAAG,IAAI;EAEnG,OAAOR,SAAS,CAACW,QAAQ,CAACF,YAAY,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMG,eAAe,GAAG,SAAlBA,eAAeA,CAAIL,MAAM,EAAK;EACzC,IAAMM,gBAAgB,GAAGP,mBAAmB,CAACC,MAAM,CAAC;EACpD,OAAOO,MAAM,CAACC,OAAO,CAACF,gBAAgB,CAAC,CAACG,GAAG,CAAC,UAAAC,IAAA;IAAA,IAAAC,KAAA,GAAAC,cAAA,CAAAF,IAAA;MAAEG,IAAI,GAAAF,KAAA;MAAEG,IAAI,GAAAH,KAAA;IAAA,OAAO;MAAEE,IAAI,EAAJA,IAAI;MAAEC,IAAI,EAAJA;IAAK,CAAC;EAAA,CAAC,CAAC;AACjF,CAAC"}
|
package/i18n/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","names":["PropTypes","Cookies","merge","cookies","supportedLocales","rtlLocales","config","loggingService","messages","intlShape","object","getLoggingService","LOCALE_TOPIC","LOCALE_CHANGED","concat","getCookies","getPrimaryLanguageSubtag","code","split","findSupportedLocale","locale","undefined","getLocale","Error","cookieLangPref","get","LANGUAGE_PREFERENCE_COOKIE_NAME","toLowerCase","global","navigator","language","getMessages","arguments","length","isRtl","includes","handleRtl","document","getElementsByTagName","setAttribute","messagesShape","ar","objectOf","string","en","fr","ca","he","id","pl","ru","th","uk","optionsShape","isRequired","shape","logError","func","oneOfType","arrayOf","mergeMessages","messagesArray","Array","isArray","apply","_toConsumableArray","configure","options","checkPropTypes","ENVIRONMENT","Object","keys","forEach","key","indexOf","console","warn"],"sources":["../../src/i18n/lib.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport Cookies from 'universal-cookie';\nimport merge from 'lodash.merge';\n\nimport '@formatjs/intl-pluralrules/polyfill';\nimport '@formatjs/intl-pluralrules/locale-data/ar';\nimport '@formatjs/intl-pluralrules/locale-data/en';\nimport '@formatjs/intl-pluralrules/locale-data/es';\nimport '@formatjs/intl-pluralrules/locale-data/fr';\nimport '@formatjs/intl-pluralrules/locale-data/zh';\nimport '@formatjs/intl-pluralrules/locale-data/ca';\nimport '@formatjs/intl-pluralrules/locale-data/he';\nimport '@formatjs/intl-pluralrules/locale-data/id';\nimport '@formatjs/intl-pluralrules/locale-data/ko';\nimport '@formatjs/intl-pluralrules/locale-data/pl';\nimport '@formatjs/intl-pluralrules/locale-data/pt';\nimport '@formatjs/intl-pluralrules/locale-data/ru';\nimport '@formatjs/intl-pluralrules/locale-data/th';\nimport '@formatjs/intl-pluralrules/locale-data/uk';\n\nimport '@formatjs/intl-relativetimeformat/polyfill';\nimport '@formatjs/intl-relativetimeformat/locale-data/ar';\nimport '@formatjs/intl-relativetimeformat/locale-data/en';\nimport '@formatjs/intl-relativetimeformat/locale-data/es';\nimport '@formatjs/intl-relativetimeformat/locale-data/fr';\nimport '@formatjs/intl-relativetimeformat/locale-data/zh';\nimport '@formatjs/intl-relativetimeformat/locale-data/ca';\nimport '@formatjs/intl-relativetimeformat/locale-data/he';\nimport '@formatjs/intl-relativetimeformat/locale-data/id';\nimport '@formatjs/intl-relativetimeformat/locale-data/ko';\nimport '@formatjs/intl-relativetimeformat/locale-data/pl';\nimport '@formatjs/intl-relativetimeformat/locale-data/pt';\nimport '@formatjs/intl-relativetimeformat/locale-data/ru';\nimport '@formatjs/intl-relativetimeformat/locale-data/th';\nimport '@formatjs/intl-relativetimeformat/locale-data/uk';\n\nconst cookies = new Cookies();\nconst supportedLocales = [\n 'ar', // Arabic\n // NOTE: 'en' is not included in this list intentionally, since it's the fallback.\n 'es-419', // Spanish, Latin American\n 'fa', // Farsi\n 'fa-ir', // Farsi, Iran\n 'fr', // French\n 'zh-cn', // Chinese, Simplified\n 'ca', // Catalan\n 'he', // Hebrew\n 'id', // Indonesian\n 'ko-kr', // Korean (Korea)\n 'pl', // Polish\n 'pt-br', // Portuguese (Brazil)\n 'ru', // Russian\n 'th', // Thai\n 'uk', // Ukrainian\n];\nconst rtlLocales = [\n 'ar', // Arabic\n 'he', // Hebrew\n 'fa', // Farsi (not currently supported)\n 'fa-ir', // Farsi Iran\n 'ur', // Urdu (not currently supported)\n];\n\nlet config = null;\nlet loggingService = null;\nlet messages = null;\n\n/**\n * @memberof module:Internationalization\n *\n * Prior versions of react-intl (our primary implementation of the i18n service) included a\n * PropTypes-based 'shape' for its `intl` object. This has since been removed. For legacy\n * compatibility, we include an `intlShape` export that is set to PropTypes.object. Usage of this\n * export is deprecated.\n *\n * @deprecated\n */\nexport const intlShape = PropTypes.object;\n\n/**\n *\n * @ignore\n * @returns {LoggingService}\n */\nexport const getLoggingService = () => loggingService;\n\n/**\n * @memberof module:Internationalization\n */\nexport const LOCALE_TOPIC = 'LOCALE';\n\n/**\n * @memberof module:Internationalization\n */\nexport const LOCALE_CHANGED = `${LOCALE_TOPIC}.CHANGED`;\n\n/**\n *\n * @memberof module:Internationalization\n * @returns {Cookies}\n */\nexport function getCookies() {\n return cookies;\n}\n\n/**\n * Some of our dependencies function on primary language subtags, rather than full locales.\n * This function strips a locale down to that first subtag. Depending on the code, this\n * may be 2 or more characters.\n *\n * @param {string} code\n * @memberof module:Internationalization\n */\nexport function getPrimaryLanguageSubtag(code) {\n return code.split('-')[0];\n}\n\n/**\n * Finds the closest supported locale to the one provided. This is done in three steps:\n *\n * 1. Returning the locale itself if its exact language code is supported.\n * 2. Returning the primary language subtag of the language code if it is supported (ar for ar-eg,\n * for instance).\n * 3. Returning 'en' if neither of the above produce a supported locale.\n *\n * @param {string} locale\n * @returns {string}\n * @memberof module:Internationalization\n */\nexport function findSupportedLocale(locale) {\n if (messages[locale] !== undefined) {\n return locale;\n }\n\n if (messages[getPrimaryLanguageSubtag(locale)] !== undefined) {\n return getPrimaryLanguageSubtag(locale);\n }\n\n return 'en';\n}\n\n/**\n * Get the locale from the cookie or, failing that, the browser setting.\n * Gracefully fall back to a more general primary language subtag or to English (en)\n * if we don't support that language.\n *\n * @param {string} locale If a locale is provided, returns the closest supported locale. Optional.\n * @throws An error if i18n has not yet been configured.\n * @returns {string}\n * @memberof module:Internationalization\n */\nexport function getLocale(locale) {\n if (messages === null) {\n throw new Error('getLocale called before configuring i18n. Call configure with messages first.');\n }\n // 1. Explicit application request\n if (locale !== undefined) {\n return findSupportedLocale(locale);\n }\n // 2. User setting in cookie\n const cookieLangPref = cookies\n .get(config.LANGUAGE_PREFERENCE_COOKIE_NAME);\n if (cookieLangPref) {\n return findSupportedLocale(cookieLangPref.toLowerCase());\n }\n // 3. Browser language (default)\n // Note that some browers prefer upper case for the region part of the locale, while others don't.\n // Thus the toLowerCase, for consistency.\n // https://developer.mozilla.org/en-US/docs/Web/API/NavigatorLanguage/language\n return findSupportedLocale(global.navigator.language.toLowerCase());\n}\n\n/**\n * Returns messages for the provided locale, or the user's preferred locale if no argument is\n * provided.\n *\n * @param {string} [locale=getLocale()]\n * @memberof module:Internationalization\n */\nexport function getMessages(locale = getLocale()) {\n return messages[locale];\n}\n\n/**\n * Determines if the provided locale is a right-to-left language.\n *\n * @param {string} locale\n * @memberof module:Internationalization\n */\nexport function isRtl(locale) {\n return rtlLocales.includes(locale);\n}\n\n/**\n * Handles applying the RTL stylesheet and \"dir=rtl\" attribute to the html tag if the current locale\n * is a RTL language.\n *\n * @memberof module:Internationalization\n */\nexport function handleRtl() {\n if (isRtl(getLocale())) {\n global.document.getElementsByTagName('html')[0].setAttribute('dir', 'rtl');\n } else {\n global.document.getElementsByTagName('html')[0].setAttribute('dir', 'ltr');\n }\n}\n\nconst messagesShape = {\n ar: PropTypes.objectOf(PropTypes.string), // Arabic\n en: PropTypes.objectOf(PropTypes.string),\n 'es-419': PropTypes.objectOf(PropTypes.string), // Spanish, Latin American\n fr: PropTypes.objectOf(PropTypes.string), // French\n 'zh-cn': PropTypes.objectOf(PropTypes.string), // Chinese, Simplified\n ca: PropTypes.objectOf(PropTypes.string), // Catalan\n he: PropTypes.objectOf(PropTypes.string), // Hebrew\n id: PropTypes.objectOf(PropTypes.string), // Indonesian\n 'ko-kr': PropTypes.objectOf(PropTypes.string), // Korean (Korea)\n pl: PropTypes.objectOf(PropTypes.string), // Polish\n 'pt-br': PropTypes.objectOf(PropTypes.string), // Portuguese (Brazil)\n ru: PropTypes.objectOf(PropTypes.string), // Russian\n th: PropTypes.objectOf(PropTypes.string), // Thai\n uk: PropTypes.objectOf(PropTypes.string), // Ukrainian\n};\n\nconst optionsShape = {\n config: PropTypes.object.isRequired,\n loggingService: PropTypes.shape({\n logError: PropTypes.func.isRequired,\n }).isRequired,\n messages: PropTypes.oneOfType([\n PropTypes.shape(messagesShape),\n PropTypes.arrayOf(PropTypes.shape(messagesShape)),\n ]).isRequired,\n};\n\n/**\n *\n *\n * @param {Array} [messagesArray=[]]\n * @returns {Object}\n * @memberof module:Internationalization\n */\nexport function mergeMessages(messagesArray = []) {\n return Array.isArray(messagesArray) ? merge({}, ...messagesArray) : {};\n}\n\n/**\n * Configures the i18n library with messages for your application.\n *\n * Logs a warning if it detects a locale it doesn't expect (as defined by the supportedLocales list\n * above), or if an expected locale is not provided.\n *\n * @param {Object} options\n * @param {LoggingService} options.loggingService\n * @param {Object} options.config\n * @param {Object} options.messages\n * @memberof module:Internationalization\n */\nexport function configure(options) {\n PropTypes.checkPropTypes(optionsShape, options, 'property', 'i18n');\n // eslint-disable-next-line prefer-destructuring\n loggingService = options.loggingService;\n // eslint-disable-next-line prefer-destructuring\n config = options.config;\n messages = Array.isArray(options.messages) ? mergeMessages(options.messages) : options.messages;\n\n if (config.ENVIRONMENT !== 'production') {\n Object.keys(messages).forEach((key) => {\n if (supportedLocales.indexOf(key) < 0) {\n console.warn(`Unexpected locale: ${key}`); // eslint-disable-line no-console\n }\n });\n\n supportedLocales.forEach((key) => {\n if (messages[key] === undefined) {\n console.warn(`Missing locale: ${key}`); // eslint-disable-line no-console\n }\n });\n }\n\n handleRtl();\n}\n"],"mappings":";;;;;;AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,OAAO,MAAM,kBAAkB;AACtC,OAAOC,KAAK,MAAM,cAAc;AAEhC,OAAO,qCAAqC;AAC5C,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAClD,OAAO,2CAA2C;AAElD,OAAO,4CAA4C;AACnD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AACzD,OAAO,kDAAkD;AAEzD,IAAMC,OAAO,GAAG,IAAIF,OAAO,EAAE;AAC7B,IAAMG,gBAAgB,GAAG,CACvB,IAAI;AAAE;AACN;AACA,QAAQ;AAAE;AACV,IAAI;AAAE;AACN,OAAO;AAAE;AACT,IAAI;AAAE;AACN,OAAO;AAAE;AACT,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,OAAO;AAAE;AACT,IAAI;AAAE;AACN,OAAO;AAAE;AACT,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI,CAAE;AAAA,CACP;;AACD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I,CAAC/D,QAAQ,CAAC,CAACgE,OAAO,CAAC,UAACC,GAAG,EAAK;MACrC,IAAIrE,gBAAgB,CAACsE,OAAO,CAACD,GAAG,CAAC,GAAG,CAAC,EAAE;QACrCE,OAAO,CAACC,IAAI,uBAAA9D,MAAA,CAAuB2D,GAAG,EAAG,CAAC,CAAC;MAC7C;IACF,CAAC,CAAC;;IAEFrE,gBAAgB,CAACoE,OAAO,CAAC,UAACC,GAAG,EAAK;MAChC,IAAIjE,QAAQ,CAACiE,GAAG,CAAC,KAAKpD,SAAS,EAAE;QAC/BsD,OAAO,CAACC,IAAI,oBAAA9D,MAAA,CAAoB2D,GAAG,EAAG,CAAC,CAAC;MAC1C;IACF,CAAC,CAAC;EACJ;;EAEArC,SAAS,EAAE;AACb"}
|
|
1
|
+
{"version":3,"file":"lib.js","names":["PropTypes","Cookies","merge","cookies","supportedLocales","rtlLocales","config","loggingService","messages","intlShape","object","getLoggingService","LOCALE_TOPIC","LOCALE_CHANGED","concat","getCookies","getPrimaryLanguageSubtag","code","split","findSupportedLocale","locale","undefined","getLocale","Error","cookieLangPref","get","LANGUAGE_PREFERENCE_COOKIE_NAME","toLowerCase","global","navigator","language","getMessages","arguments","length","isRtl","includes","handleRtl","document","getElementsByTagName","setAttribute","messagesShape","ar","objectOf","string","en","fr","ca","he","id","pl","ru","th","uk","optionsShape","isRequired","shape","logError","func","oneOfType","arrayOf","mergeMessages","messagesArray","Array","isArray","apply","_toConsumableArray","configure","options","checkPropTypes","ENVIRONMENT","Object","keys","forEach","key","indexOf","console","warn"],"sources":["../../src/i18n/lib.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport Cookies from 'universal-cookie';\nimport merge from 'lodash.merge';\n\nimport '@formatjs/intl-pluralrules/polyfill';\nimport '@formatjs/intl-pluralrules/locale-data/ar';\nimport '@formatjs/intl-pluralrules/locale-data/en';\nimport '@formatjs/intl-pluralrules/locale-data/es';\nimport '@formatjs/intl-pluralrules/locale-data/fr';\nimport '@formatjs/intl-pluralrules/locale-data/zh';\nimport '@formatjs/intl-pluralrules/locale-data/ca';\nimport '@formatjs/intl-pluralrules/locale-data/he';\nimport '@formatjs/intl-pluralrules/locale-data/id';\nimport '@formatjs/intl-pluralrules/locale-data/ko';\nimport '@formatjs/intl-pluralrules/locale-data/pl';\nimport '@formatjs/intl-pluralrules/locale-data/pt';\nimport '@formatjs/intl-pluralrules/locale-data/ru';\nimport '@formatjs/intl-pluralrules/locale-data/th';\nimport '@formatjs/intl-pluralrules/locale-data/uk';\n\nimport '@formatjs/intl-relativetimeformat/polyfill';\nimport '@formatjs/intl-relativetimeformat/locale-data/ar';\nimport '@formatjs/intl-relativetimeformat/locale-data/en';\nimport '@formatjs/intl-relativetimeformat/locale-data/es';\nimport '@formatjs/intl-relativetimeformat/locale-data/fr';\nimport '@formatjs/intl-relativetimeformat/locale-data/zh';\nimport '@formatjs/intl-relativetimeformat/locale-data/ca';\nimport '@formatjs/intl-relativetimeformat/locale-data/he';\nimport '@formatjs/intl-relativetimeformat/locale-data/id';\nimport '@formatjs/intl-relativetimeformat/locale-data/ko';\nimport '@formatjs/intl-relativetimeformat/locale-data/pl';\nimport '@formatjs/intl-relativetimeformat/locale-data/pt';\nimport '@formatjs/intl-relativetimeformat/locale-data/ru';\nimport '@formatjs/intl-relativetimeformat/locale-data/th';\nimport '@formatjs/intl-relativetimeformat/locale-data/uk';\n\nconst cookies = new Cookies();\nconst supportedLocales = [\n 'ar', // Arabic\n // NOTE: 'en' is not included in this list intentionally, since it's the fallback.\n 'es-419', // Spanish, Latin American\n 'fa', // Farsi\n 'fa-ir', // Farsi, Iran\n 'fr', // French\n 'zh-cn', // Chinese, Simplified\n 'ca', // Catalan\n 'he', // Hebrew\n 'id', // Indonesian\n 'ko-kr', // Korean (Korea)\n 'pl', // Polish\n 'pt-br', // Portuguese (Brazil)\n 'ru', // Russian\n 'th', // Thai\n 'uk', // Ukrainian\n];\nconst rtlLocales = [\n 'ar', // Arabic\n 'he', // Hebrew\n 'fa', // Farsi (not currently supported)\n 'fa-ir', // Farsi Iran\n 'ur', // Urdu (not currently supported)\n];\n\nlet config = null;\nlet loggingService = null;\nlet messages = null;\n\n/**\n * @memberof module:Internationalization\n *\n * Prior versions of react-intl (our primary implementation of the i18n service) included a\n * PropTypes-based 'shape' for its `intl` object. This has since been removed. For legacy\n * compatibility, we include an `intlShape` export that is set to PropTypes.object. Usage of this\n * export is deprecated.\n *\n * @deprecated\n */\nexport const intlShape = PropTypes.object;\n\n/**\n *\n * @ignore\n * @returns {LoggingService}\n */\nexport const getLoggingService = () => loggingService;\n\n/**\n * @memberof module:Internationalization\n */\nexport const LOCALE_TOPIC = 'LOCALE';\n\n/**\n * @memberof module:Internationalization\n */\nexport const LOCALE_CHANGED = `${LOCALE_TOPIC}.CHANGED`;\n\n/**\n *\n * @memberof module:Internationalization\n * @returns {Cookies}\n */\nexport function getCookies() {\n return cookies;\n}\n\n/**\n * Some of our dependencies function on primary language subtags, rather than full locales.\n * This function strips a locale down to that first subtag. Depending on the code, this\n * may be 2 or more characters.\n *\n * @param {string} code\n * @memberof module:Internationalization\n */\nexport function getPrimaryLanguageSubtag(code) {\n return code.split('-')[0];\n}\n\n/**\n * Finds the closest supported locale to the one provided. This is done in three steps:\n *\n * 1. Returning the locale itself if its exact language code is supported.\n * 2. Returning the primary language subtag of the language code if it is supported (ar for ar-eg,\n * for instance).\n * 3. Returning 'en' if neither of the above produce a supported locale.\n *\n * @param {string} locale\n * @returns {string}\n * @memberof module:Internationalization\n */\nexport function findSupportedLocale(locale) {\n if (messages[locale] !== undefined) {\n return locale;\n }\n\n if (messages[getPrimaryLanguageSubtag(locale)] !== undefined) {\n return getPrimaryLanguageSubtag(locale);\n }\n\n return 'en';\n}\n\n/**\n * Get the locale from the cookie or, failing that, the browser setting.\n * Gracefully fall back to a more general primary language subtag or to English (en)\n * if we don't support that language.\n *\n * @param {string} locale If a locale is provided, returns the closest supported locale. Optional.\n * @throws An error if i18n has not yet been configured.\n * @returns {string}\n * @memberof module:Internationalization\n */\nexport function getLocale(locale) {\n if (messages === null) {\n throw new Error('getLocale called before configuring i18n. Call configure with messages first.');\n }\n // 1. Explicit application request\n if (locale !== undefined) {\n return findSupportedLocale(locale);\n }\n // 2. User setting in cookie\n const cookieLangPref = cookies\n .get(config.LANGUAGE_PREFERENCE_COOKIE_NAME);\n if (cookieLangPref) {\n return findSupportedLocale(cookieLangPref.toLowerCase());\n }\n // 3. Browser language (default)\n // Note that some browers prefer upper case for the region part of the locale, while others don't.\n // Thus the toLowerCase, for consistency.\n // https://developer.mozilla.org/en-US/docs/Web/API/NavigatorLanguage/language\n return findSupportedLocale(global.navigator.language.toLowerCase());\n}\n\n/**\n * Returns messages for the provided locale, or the user's preferred locale if no argument is\n * provided.\n *\n * @param {string} [locale=getLocale()]\n * @memberof module:Internationalization\n */\nexport function getMessages(locale = getLocale()) {\n return messages[locale];\n}\n\n/**\n * Determines if the provided locale is a right-to-left language.\n *\n * @param {string} locale\n * @memberof module:Internationalization\n */\nexport function isRtl(locale) {\n return rtlLocales.includes(locale);\n}\n\n/**\n * Handles applying the RTL stylesheet and \"dir=rtl\" attribute to the html tag if the current locale\n * is a RTL language.\n *\n * @memberof module:Internationalization\n */\nexport function handleRtl() {\n if (isRtl(getLocale())) {\n global.document.getElementsByTagName('html')[0].setAttribute('dir', 'rtl');\n } else {\n global.document.getElementsByTagName('html')[0].setAttribute('dir', 'ltr');\n }\n}\n\nconst messagesShape = {\n ar: PropTypes.objectOf(PropTypes.string), // Arabic\n en: PropTypes.objectOf(PropTypes.string),\n 'es-419': PropTypes.objectOf(PropTypes.string), // Spanish, Latin American\n fr: PropTypes.objectOf(PropTypes.string), // French\n 'zh-cn': PropTypes.objectOf(PropTypes.string), // Chinese, Simplified\n ca: PropTypes.objectOf(PropTypes.string), // Catalan\n he: PropTypes.objectOf(PropTypes.string), // Hebrew\n id: PropTypes.objectOf(PropTypes.string), // Indonesian\n 'ko-kr': PropTypes.objectOf(PropTypes.string), // Korean (Korea)\n pl: PropTypes.objectOf(PropTypes.string), // Polish\n 'pt-br': PropTypes.objectOf(PropTypes.string), // Portuguese (Brazil)\n ru: PropTypes.objectOf(PropTypes.string), // Russian\n th: PropTypes.objectOf(PropTypes.string), // Thai\n uk: PropTypes.objectOf(PropTypes.string), // Ukrainian\n};\n\nconst optionsShape = {\n config: PropTypes.object.isRequired,\n loggingService: PropTypes.shape({\n logError: PropTypes.func.isRequired,\n }).isRequired,\n messages: PropTypes.oneOfType([\n PropTypes.shape(messagesShape),\n PropTypes.arrayOf(PropTypes.shape(messagesShape)),\n ]).isRequired,\n};\n\n/**\n *\n *\n * @param {Array} [messagesArray=[]]\n * @returns {Object}\n * @memberof module:Internationalization\n */\nexport function mergeMessages(messagesArray = []) {\n return Array.isArray(messagesArray) ? merge({}, ...messagesArray) : {};\n}\n\n/**\n * Configures the i18n library with messages for your application.\n *\n * Logs a warning if it detects a locale it doesn't expect (as defined by the supportedLocales list\n * above), or if an expected locale is not provided.\n *\n * @param {Object} options\n * @param {LoggingService} options.loggingService\n * @param {Object} options.config\n * @param {Object} options.messages\n * @memberof module:Internationalization\n */\nexport function configure(options) {\n PropTypes.checkPropTypes(optionsShape, options, 'property', 'i18n');\n // eslint-disable-next-line prefer-destructuring\n loggingService = options.loggingService;\n // eslint-disable-next-line prefer-destructuring\n config = options.config;\n messages = Array.isArray(options.messages) ? mergeMessages(options.messages) : options.messages;\n\n if (config.ENVIRONMENT !== 'production') {\n Object.keys(messages).forEach((key) => {\n if (supportedLocales.indexOf(key) < 0) {\n console.warn(`Unexpected locale: ${key}`); // eslint-disable-line no-console\n }\n });\n\n supportedLocales.forEach((key) => {\n if (messages[key] === undefined) {\n console.warn(`Missing locale: ${key}`); // eslint-disable-line no-console\n }\n });\n }\n\n handleRtl();\n}\n"],"mappings":";;;;;;AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,OAAO,MAAM,kBAAkB;AACtC,OAAOC,KAAK,MAAM,cAAc;AAEhC,O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rE,gBAAgB,CAACoE,OAAO,CAAC,UAACC,GAAG,EAAK;MAChC,IAAIjE,QAAQ,CAACiE,GAAG,CAAC,KAAKpD,SAAS,EAAE;QAC/BsD,OAAO,CAACC,IAAI,oBAAA9D,MAAA,CAAoB2D,GAAG,CAAE,CAAC,CAAC,CAAC;MAC1C;IACF,CAAC,CAAC;EACJ;;EAEArC,SAAS,CAAC,CAAC;AACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intl-imports.js","names":["scriptHelpDocument","fs","require","path","camelCase","loggingPrefix","basename","concat","__filename","filesCodeGeneratorNoticeHeader","generateSubdirectoryMessageFile","_ref","directory","log","writeFileSync","i18nDir","importLines","messagesLines","counter","nonEmptyLanguages","messagesDir","files","readdirSync","withFileTypes","sort","jsonFiles","filter","file","isFile","name","endsWith","length","isWritten","forEach","filename","languageCode","replace","reactIntlLanguageCode","toLowerCase","messagesCamelCaseVar","filePath","entries","JSON","parse","readFileSync","encoding","Object","keys","push","e","splice","messagesFileContent","join","generateMainMessagesFile","_ref2","processedDirectories","exportLines","processedDirectory","moduleCamelCaseVariableName","skipMessage","indexFileContent","main","_ref3","directories","pwd","includes","existsSync","lstatSync","isDirectory","map","module","process","argv","slice","text","stdout","write","env","PWD","exports"],"sources":["../../../src/i18n/scripts/intl-imports.js"],"sourcesContent":["#!/usr/bin/env node\n\nconst scriptHelpDocument = `\nNAME\n intl-imports.js — Script to generate the src/i18n/index.js file that exports messages from all the languages for Micro-frontends.\n\nSYNOPSIS\n intl-imports.js [DIRECTORY ...]\n\nDESCRIPTION\n This script is intended to run after 'atlas' has pulled the files.\n \n This expects to run inside a Micro-frontend root directory with the following structure:\n \n frontend-app-learning $ tree src/i18n/\n src/i18n/\n ├── index.js\n └── messages\n ├── frontend-app-example\n │ ├── ar.json\n │ ├── es_419.json\n │ └── zh_CN.json\n ├── frontend-component-footer\n │ ├── ar.json\n │ ├── es_419.json\n │ └── zh_CN.json\n └── frontend-component-header (empty directory)\n \n \n \n With the structure above it's expected to run with the following command in Makefile:\n \n \n $ node_modules/.bin/intl-imports.js frontend-component-footer frontend-component-header frontend-app-example\n \n \n It will generate two type of files:\n \n - Main src/i18n/index.js which overrides the Micro-frontend provided with a sample output of:\n \n \"\"\"\n import messagesFromFrontendComponentFooter from './messages/frontend-component-footer';\n // Skipped import due to missing './messages/frontend-component-footer/index.js' likely due to empty translations.\n import messagesFromFrontendAppExample from './messages/frontend-app-example';\n \n export default [\n messagesFromFrontendComponentFooter,\n messagesFromFrontendAppExample,\n ];\n \"\"\"\n \n - Each sub-directory has src/i18n/messages/frontend-component-header/index.js which is imported by the main file.:\n \n \"\"\"\n import messagesOfArLanguage from './ar.json';\n import messagesOfDeLanguage from './de.json';\n import messagesOfEs419Language from './es_419.json';\n export default {\n 'ar': messagesOfArLanguage,\n 'de': messagesOfDeLanguage,\n 'es-419': messagesOfEs419Language,\n };\n \"\"\"\n`;\n\nconst fs = require('fs');\nconst path = require('path');\nconst camelCase = require('lodash.camelcase');\n\nconst loggingPrefix = path.basename(`${__filename}`); // the name of this JS file\n\n// Header note for generated src/i18n/index.js file\nconst filesCodeGeneratorNoticeHeader = `// This file is generated by the openedx/frontend-platform's \"intl-import.js\" script.\n//\n// Refer to the i18n documents in https://docs.openedx.org/en/latest/developers/references/i18n.html to update\n// the file and use the Micro-frontend i18n pattern in new repositories.\n//\n`;\n\n/**\n * Create frontend-app-example/index.js file with proper imports.\n *\n * @param directory - a directory name containing .json files from Transifex e.g. \"frontend-app-example\".\n * @param log - Mockable process.stdout.write\n * @param writeFileSync - Mockable fs.writeFileSync\n * @param i18nDir - Path to `src/i18n` directory\n *\n * @return object - An object containing directory name and whether its \"index.js\" file was successfully written.\n */\nfunction generateSubdirectoryMessageFile({\n directory,\n log,\n writeFileSync,\n i18nDir,\n}) {\n const importLines = [];\n const messagesLines = [];\n const counter = { nonEmptyLanguages: 0 };\n const messagesDir = `${i18nDir}/messages`; // The directory of Micro-frontend i18n messages\n\n try {\n const files = fs.readdirSync(`${messagesDir}/${directory}`, { withFileTypes: true });\n files.sort(); // Sorting ensures a consistent generated `index.js` order of imports cross-platforms.\n\n const jsonFiles = files.filter(file => file.isFile() && file.name.endsWith('.json'));\n\n if (!jsonFiles.length) {\n log(`${loggingPrefix}: Not creating '${directory}/index.js' because no .json translation files were found.\\n`);\n return {\n directory,\n isWritten: false,\n };\n }\n\n jsonFiles.forEach((file) => {\n const filename = file.name;\n // Gets `fr_CA` from `fr_CA.json`\n const languageCode = filename.replace(/\\.json$/, '');\n // React-friendly language code fr_CA --> fr-ca\n const reactIntlLanguageCode = languageCode.toLowerCase().replace(/_/g, '-');\n // camelCase variable name\n const messagesCamelCaseVar = camelCase(`messages_Of_${languageCode}_Language`);\n const filePath = `${messagesDir}/${directory}/${filename}`;\n\n try {\n const entries = JSON.parse(fs.readFileSync(filePath, { encoding: 'utf8' }));\n\n if (!Object.keys(entries).length) {\n importLines.push(`// Note: Skipped empty '${filename}' messages file.`);\n return; // Skip the language\n }\n } catch (e) {\n importLines.push(`// Error: unable to parse '${filename}' messages file.`);\n log(`${loggingPrefix}: NOTICE: Skipping '${directory}/${filename}' due to error: ${e}.\\n`);\n return; // Skip the language\n }\n\n counter.nonEmptyLanguages += 1;\n importLines.push(`import ${messagesCamelCaseVar} from './${filename}';`);\n messagesLines.splice(1, 0, ` '${reactIntlLanguageCode}': ${messagesCamelCaseVar},`);\n });\n\n if (counter.nonEmptyLanguages) {\n // See the help message above for sample output.\n const messagesFileContent = [\n filesCodeGeneratorNoticeHeader,\n importLines.join('\\n'),\n '\\nexport default {',\n messagesLines.join('\\n'),\n '};\\n',\n ].join('\\n');\n\n writeFileSync(`${messagesDir}/${directory}/index.js`, messagesFileContent);\n return {\n directory,\n isWritten: true,\n };\n }\n log(`${loggingPrefix}: Skipping '${directory}' because no languages were found.\\n`);\n } catch (e) {\n log(`${loggingPrefix}: NOTICE: Skipping '${directory}' due to error: ${e}.\\n`);\n }\n\n return {\n directory,\n isWritten: false,\n };\n}\n\n/**\n * Create main `src/i18n/index.js` messages import file.\n *\n *\n * @param processedDirectories - List of directories with a boolean flag whether its \"index.js\" file is written\n * The format is \"[\\{ directory: \"frontend-component-example\", isWritten: false \\}, ...]\"\n * @param log - Mockable process.stdout.write\n * @param writeFileSync - Mockable fs.writeFileSync\n * @param i18nDir` - Path to `src/i18n` directory\n */\nfunction generateMainMessagesFile({\n processedDirectories,\n log,\n writeFileSync,\n i18nDir,\n}) {\n const importLines = [];\n const exportLines = [];\n\n processedDirectories.forEach(processedDirectory => {\n const { directory, isWritten } = processedDirectory;\n if (isWritten) {\n const moduleCamelCaseVariableName = camelCase(`messages_from_${directory}`);\n importLines.push(`import ${moduleCamelCaseVariableName} from './messages/${directory}';`);\n exportLines.push(` ${moduleCamelCaseVariableName},`);\n } else {\n const skipMessage = `Skipped import due to missing '${directory}/index.js' likely due to empty translations.`;\n importLines.push(`// ${skipMessage}.`);\n log(`${loggingPrefix}: ${skipMessage}\\n`);\n }\n });\n\n // See the help message above for sample output.\n const indexFileContent = [\n filesCodeGeneratorNoticeHeader,\n importLines.join('\\n'),\n '\\nexport default [',\n exportLines.join('\\n'),\n '];\\n',\n ].join('\\n');\n\n writeFileSync(`${i18nDir}/index.js`, indexFileContent);\n}\n\n/*\n * Main function of the file.\n */\nfunction main({\n directories,\n log,\n writeFileSync,\n pwd,\n}) {\n const i18nDir = `${pwd}/src/i18n`; // The Micro-frontend i18n root directory\n\n if (directories.includes('--help') || directories.includes('-h')) {\n log(scriptHelpDocument);\n } else if (!directories.length) {\n log(scriptHelpDocument);\n log(`${loggingPrefix}: Error: A list of directories is required.\\n`);\n } else if (!fs.existsSync(i18nDir) || !fs.lstatSync(i18nDir).isDirectory()) {\n log(scriptHelpDocument);\n log(`${loggingPrefix}: Error: src/i18n directory was not found.\\n`);\n } else {\n const processedDirectories = directories.map(directory => generateSubdirectoryMessageFile({\n directory,\n log,\n writeFileSync,\n i18nDir,\n }));\n generateMainMessagesFile({\n processedDirectories,\n log,\n writeFileSync,\n i18nDir,\n });\n }\n}\n\nif (require.main === module) {\n // Run the main() function if called from the command line.\n main({\n directories: process.argv.slice(2),\n log: text => process.stdout.write(text),\n writeFileSync: fs.writeFileSync,\n pwd: process.env.PWD,\n });\n}\n\nmodule.exports.main = main; // Allow tests to use the main function.\n"],"mappings":"AAAA;AAEA,IAAMA,kBAAkB,suEA6DvB;AAED,IAAMC,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AACxB,IAAMC,IAAI,GAAGD,OAAO,CAAC,MAAM,CAAC;AAC5B,IAAME,SAAS,GAAGF,OAAO,CAAC,kBAAkB,CAAC;AAE7C,IAAMG,aAAa,GAAGF,IAAI,CAACG,QAAQ,IAAAC,MAAA,CAAIC,UAAU,EAAG,CAAC,CAAC;;AAEtD;AACA,IAAMC,8BAA8B,gSAKnC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CAAAC,IAAA,EAKrC;EAAA,IAJDC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IACHC,aAAa,GAAAH,IAAA,CAAbG,aAAa;IACbC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;EAEP,IAAMC,WAAW,GAAG,EAAE;EACtB,IAAMC,aAAa,GAAG,EAAE;EACxB,IAAMC,OAAO,GAAG;IAAEC,iBAAiB,EAAE;EAAE,CAAC;EACxC,IAAMC,WAAW,MAAAb,MAAA,CAAMQ,OAAO,cAAW,CAAC,CAAC;;EAE3C,IAAI;IACF,IAAMM,KAAK,GAAGpB,EAAE,CAACqB,WAAW,IAAAf,MAAA,CAAIa,WAAW,OAAAb,MAAA,CAAIK,SAAS,GAAI;MAAEW,aAAa,EAAE;IAAK,CAAC,CAAC;IACpFF,KAAK,CAACG,IAAI,EAAE,CAAC,CAAC;;IAEd,IAAMC,SAAS,GAAGJ,KAAK,CAACK,MAAM,CAAC,UAAAC,IAAI;MAAA,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,EAAE,SAAAA,IAAA6D,IAAI;MAAA,OAAIH,OAAO,CAACI,MAAM,CAACC,KAAK,CAACF,IAAI,CAAC;IAAA;IACvC5D,aAAa,EAAEb,EAAE,CAACa,aAAa;IAC/BkD,GAAG,EAAEO,OAAO,CAACM,GAAG,CAACC;EACnB,CAAC,CAAC;AACJ;AAEAR,MAAM,CAACS,OAAO,CAAClB,IAAI,GAAGA,IAAI,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"intl-imports.js","names":["scriptHelpDocument","fs","require","path","camelCase","loggingPrefix","basename","concat","__filename","filesCodeGeneratorNoticeHeader","generateSubdirectoryMessageFile","_ref","directory","log","writeFileSync","i18nDir","importLines","messagesLines","counter","nonEmptyLanguages","messagesDir","files","readdirSync","withFileTypes","sort","jsonFiles","filter","file","isFile","name","endsWith","length","isWritten","forEach","filename","languageCode","replace","reactIntlLanguageCode","toLowerCase","messagesCamelCaseVar","filePath","entries","JSON","parse","readFileSync","encoding","Object","keys","push","e","splice","messagesFileContent","join","generateMainMessagesFile","_ref2","processedDirectories","exportLines","processedDirectory","moduleCamelCaseVariableName","skipMessage","indexFileContent","main","_ref3","directories","pwd","includes","existsSync","lstatSync","isDirectory","map","module","process","argv","slice","text","stdout","write","env","PWD","exports"],"sources":["../../../src/i18n/scripts/intl-imports.js"],"sourcesContent":["#!/usr/bin/env node\n\nconst scriptHelpDocument = `\nNAME\n intl-imports.js — Script to generate the src/i18n/index.js file that exports messages from all the languages for Micro-frontends.\n\nSYNOPSIS\n intl-imports.js [DIRECTORY ...]\n\nDESCRIPTION\n This script is intended to run after 'atlas' has pulled the files.\n \n This expects to run inside a Micro-frontend root directory with the following structure:\n \n frontend-app-learning $ tree src/i18n/\n src/i18n/\n ├── index.js\n └── messages\n ├── frontend-app-example\n │ ├── ar.json\n │ ├── es_419.json\n │ └── zh_CN.json\n ├── frontend-component-footer\n │ ├── ar.json\n │ ├── es_419.json\n │ └── zh_CN.json\n └── frontend-component-header (empty directory)\n \n \n \n With the structure above it's expected to run with the following command in Makefile:\n \n \n $ node_modules/.bin/intl-imports.js frontend-component-footer frontend-component-header frontend-app-example\n \n \n It will generate two type of files:\n \n - Main src/i18n/index.js which overrides the Micro-frontend provided with a sample output of:\n \n \"\"\"\n import messagesFromFrontendComponentFooter from './messages/frontend-component-footer';\n // Skipped import due to missing './messages/frontend-component-footer/index.js' likely due to empty translations.\n import messagesFromFrontendAppExample from './messages/frontend-app-example';\n \n export default [\n messagesFromFrontendComponentFooter,\n messagesFromFrontendAppExample,\n ];\n \"\"\"\n \n - Each sub-directory has src/i18n/messages/frontend-component-header/index.js which is imported by the main file.:\n \n \"\"\"\n import messagesOfArLanguage from './ar.json';\n import messagesOfDeLanguage from './de.json';\n import messagesOfEs419Language from './es_419.json';\n export default {\n 'ar': messagesOfArLanguage,\n 'de': messagesOfDeLanguage,\n 'es-419': messagesOfEs419Language,\n };\n \"\"\"\n`;\n\nconst fs = require('fs');\nconst path = require('path');\nconst camelCase = require('lodash.camelcase');\n\nconst loggingPrefix = path.basename(`${__filename}`); // the name of this JS file\n\n// Header note for generated src/i18n/index.js file\nconst filesCodeGeneratorNoticeHeader = `// This file is generated by the openedx/frontend-platform's \"intl-import.js\" script.\n//\n// Refer to the i18n documents in https://docs.openedx.org/en/latest/developers/references/i18n.html to update\n// the file and use the Micro-frontend i18n pattern in new repositories.\n//\n`;\n\n/**\n * Create frontend-app-example/index.js file with proper imports.\n *\n * @param directory - a directory name containing .json files from Transifex e.g. \"frontend-app-example\".\n * @param log - Mockable process.stdout.write\n * @param writeFileSync - Mockable fs.writeFileSync\n * @param i18nDir - Path to `src/i18n` directory\n *\n * @return object - An object containing directory name and whether its \"index.js\" file was successfully written.\n */\nfunction generateSubdirectoryMessageFile({\n directory,\n log,\n writeFileSync,\n i18nDir,\n}) {\n const importLines = [];\n const messagesLines = [];\n const counter = { nonEmptyLanguages: 0 };\n const messagesDir = `${i18nDir}/messages`; // The directory of Micro-frontend i18n messages\n\n try {\n const files = fs.readdirSync(`${messagesDir}/${directory}`, { withFileTypes: true });\n files.sort(); // Sorting ensures a consistent generated `index.js` order of imports cross-platforms.\n\n const jsonFiles = files.filter(file => file.isFile() && file.name.endsWith('.json'));\n\n if (!jsonFiles.length) {\n log(`${loggingPrefix}: Not creating '${directory}/index.js' because no .json translation files were found.\\n`);\n return {\n directory,\n isWritten: false,\n };\n }\n\n jsonFiles.forEach((file) => {\n const filename = file.name;\n // Gets `fr_CA` from `fr_CA.json`\n const languageCode = filename.replace(/\\.json$/, '');\n // React-friendly language code fr_CA --> fr-ca\n const reactIntlLanguageCode = languageCode.toLowerCase().replace(/_/g, '-');\n // camelCase variable name\n const messagesCamelCaseVar = camelCase(`messages_Of_${languageCode}_Language`);\n const filePath = `${messagesDir}/${directory}/${filename}`;\n\n try {\n const entries = JSON.parse(fs.readFileSync(filePath, { encoding: 'utf8' }));\n\n if (!Object.keys(entries).length) {\n importLines.push(`// Note: Skipped empty '${filename}' messages file.`);\n return; // Skip the language\n }\n } catch (e) {\n importLines.push(`// Error: unable to parse '${filename}' messages file.`);\n log(`${loggingPrefix}: NOTICE: Skipping '${directory}/${filename}' due to error: ${e}.\\n`);\n return; // Skip the language\n }\n\n counter.nonEmptyLanguages += 1;\n importLines.push(`import ${messagesCamelCaseVar} from './${filename}';`);\n messagesLines.splice(1, 0, ` '${reactIntlLanguageCode}': ${messagesCamelCaseVar},`);\n });\n\n if (counter.nonEmptyLanguages) {\n // See the help message above for sample output.\n const messagesFileContent = [\n filesCodeGeneratorNoticeHeader,\n importLines.join('\\n'),\n '\\nexport default {',\n messagesLines.join('\\n'),\n '};\\n',\n ].join('\\n');\n\n writeFileSync(`${messagesDir}/${directory}/index.js`, messagesFileContent);\n return {\n directory,\n isWritten: true,\n };\n }\n log(`${loggingPrefix}: Skipping '${directory}' because no languages were found.\\n`);\n } catch (e) {\n log(`${loggingPrefix}: NOTICE: Skipping '${directory}' due to error: ${e}.\\n`);\n }\n\n return {\n directory,\n isWritten: false,\n };\n}\n\n/**\n * Create main `src/i18n/index.js` messages import file.\n *\n *\n * @param processedDirectories - List of directories with a boolean flag whether its \"index.js\" file is written\n * The format is \"[\\{ directory: \"frontend-component-example\", isWritten: false \\}, ...]\"\n * @param log - Mockable process.stdout.write\n * @param writeFileSync - Mockable fs.writeFileSync\n * @param i18nDir` - Path to `src/i18n` directory\n */\nfunction generateMainMessagesFile({\n processedDirectories,\n log,\n writeFileSync,\n i18nDir,\n}) {\n const importLines = [];\n const exportLines = [];\n\n processedDirectories.forEach(processedDirectory => {\n const { directory, isWritten } = processedDirectory;\n if (isWritten) {\n const moduleCamelCaseVariableName = camelCase(`messages_from_${directory}`);\n importLines.push(`import ${moduleCamelCaseVariableName} from './messages/${directory}';`);\n exportLines.push(` ${moduleCamelCaseVariableName},`);\n } else {\n const skipMessage = `Skipped import due to missing '${directory}/index.js' likely due to empty translations.`;\n importLines.push(`// ${skipMessage}.`);\n log(`${loggingPrefix}: ${skipMessage}\\n`);\n }\n });\n\n // See the help message above for sample output.\n const indexFileContent = [\n filesCodeGeneratorNoticeHeader,\n importLines.join('\\n'),\n '\\nexport default [',\n exportLines.join('\\n'),\n '];\\n',\n ].join('\\n');\n\n writeFileSync(`${i18nDir}/index.js`, indexFileContent);\n}\n\n/*\n * Main function of the file.\n */\nfunction main({\n directories,\n log,\n writeFileSync,\n pwd,\n}) {\n const i18nDir = `${pwd}/src/i18n`; // The Micro-frontend i18n root directory\n\n if (directories.includes('--help') || directories.includes('-h')) {\n log(scriptHelpDocument);\n } else if (!directories.length) {\n log(scriptHelpDocument);\n log(`${loggingPrefix}: Error: A list of directories is required.\\n`);\n } else if (!fs.existsSync(i18nDir) || !fs.lstatSync(i18nDir).isDirectory()) {\n log(scriptHelpDocument);\n log(`${loggingPrefix}: Error: src/i18n directory was not found.\\n`);\n } else {\n const processedDirectories = directories.map(directory => generateSubdirectoryMessageFile({\n directory,\n log,\n writeFileSync,\n i18nDir,\n }));\n generateMainMessagesFile({\n processedDirectories,\n log,\n writeFileSync,\n i18nDir,\n });\n }\n}\n\nif (require.main === module) {\n // Run the main() function if called from the command line.\n main({\n directories: process.argv.slice(2),\n log: text => process.stdout.write(text),\n writeFileSync: fs.writeFileSync,\n pwd: process.env.PWD,\n });\n}\n\nmodule.exports.main = main; // Allow tests to use the main function.\n"],"mappings":"AAAA;AAEA,IAAMA,kBAAkB,suEA6DvB;AAED,IAAMC,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AACxB,IAAMC,IAAI,GAAGD,OAAO,CAAC,MAAM,CAAC;AAC5B,IAAME,SAAS,GAAGF,OAAO,CAAC,kBAAkB,CAAC;AAE7C,IAAMG,aAAa,GAAGF,IAAI,CAACG,QAAQ,IAAAC,MAAA,CAAIC,UAAU,CAAE,CAAC,CAAC,CAAC;;AAEtD;AACA,IAAMC,8BAA8B,gSAKnC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CAAAC,IAAA,EAKrC;EAAA,IAJDC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IACHC,aAAa,GAAAH,IAAA,CAAbG,aAAa;IACbC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;EAEP,IAAMC,WAAW,GAAG,EAAE;EACtB,IAAMC,aAAa,GAAG,EAAE;EACxB,IAAMC,OAAO,GAAG;IAAEC,iBAAiB,EAAE;EAAE,CAAC;EACxC,IAAMC,WAAW,MAAAb,MAAA,CAAMQ,OAAO,cAAW,CAAC,CAAC;;EAE3C,IAAI;IACF,IAAMM,KAAK,GAAGpB,EAAE,CAACqB,WAAW,IAAAf,MAAA,CAAIa,WAAW,OAAAb,MAAA,CAAIK,SAAS,GAAI;MAAEW,aAAa,EAAE;IAAK,CAAC,CAAC;IACpFF,KAAK,CAACG,IAAI,CAAC,CAAC,CAAC,CAAC;;IAEd,IAAMC,SAAS,GAAGJ,KAAK,CAACK,MAAM,CAAC,UAAAC,IAAI;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,MAAM,EAAE;EAC3B;EACAT,IAAI,CAAC;IACHE,WAAW,EAAEQ,OAAO,CAACC,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC;IAClC5D,GAAG,EAAE,SAAAA,IAAA6D,IAAI;MAAA,OAAIH,OAAO,CAACI,MAAM,CAACC,KAAK,CAACF,IAAI,CAAC;IAAA;IACvC5D,aAAa,EAAEb,EAAE,CAACa,aAAa;IAC/BkD,GAAG,EAAEO,OAAO,CAACM,GAAG,CAACC;EACnB,CAAC,CAAC;AACJ;AAEAR,MAAM,CAACS,OAAO,CAAClB,IAAI,GAAGA,IAAI,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transifex-utils.js","names":["_toConsumableArray","arr","_arrayWithoutHoles","_iterableToArray","_unsupportedIterableToArray","_nonIterableSpread","TypeError","o","minLen","_arrayLikeToArray","n","Object","prototype","toString","call","slice","constructor","name","Array","from","test","iter","Symbol","iterator","isArray","len","length","i","arr2","fs","require","glob","path","gatherJson","dir","ret","files","sync","concat","forEach","filename","messages","JSON","parse","readFileSync","push","apply","escapeDots","messageId","replace","jsonDir","process","argv","messageObjects","exitCode","Error","loggingPrefix","basename","__filename","bashScriptsPath","hashFile","stdout","write","messageInfo","outputFile","writeFileSync","message","transifexFormatId","id","info","find","mi","key","appendFileSync","string_hash","description","output","defaultMessage","stringify"],"sources":["../../../src/i18n/scripts/transifex-utils.js"],"sourcesContent":["#!/usr/bin/env node\n\nconst fs = require('fs');\nconst glob = require('glob');\nconst path = require('path');\n\n/*\n * See the Makefile for how the required hash file is downloaded from Transifex.\n */\n\n/*\n * Expected input: a directory, possibly containing subdirectories, with .json files. Each .json\n * file is an array of translation triplets (id, description, defaultMessage).\n *\n *\n */\nfunction gatherJson(dir) {\n const ret = [];\n const files = glob.sync(`${dir}/**/*.json`);\n\n files.forEach((filename) => {\n const messages = JSON.parse(fs.readFileSync(filename));\n ret.push(...messages);\n });\n return ret;\n}\n\n// the hash file returns ids whose periods are \"escaped\" (sort of), like this:\n// \"key\": \"profile\\\\.sociallinks\\\\.social\\\\.links\"\n// so our regular messageIds won't match them out of the box\nfunction escapeDots(messageId) {\n return messageId.replace(/\\./g, '\\\\.');\n}\n\nconst jsonDir = process.argv[2];\nconst messageObjects = gatherJson(jsonDir);\n\nif (messageObjects.length === 0) {\n process.exitCode = 1;\n throw new Error('Found no messages');\n}\n\nif (process.argv[3] === '--comments') { // prepare to handle the translator notes\n const loggingPrefix = path.basename(`${__filename}`); // the name of this JS file\n const bashScriptsPath = (\n process.argv[4] && process.argv[4] === '--v3-scripts-path'\n ? './node_modules/@edx/reactifex/bash_scripts'\n : './node_modules/reactifex/bash_scripts');\n\n const hashFile = `${bashScriptsPath}/hashmap.json`;\n process.stdout.write(`${loggingPrefix}: reading hash file ${hashFile}\\n`);\n const messageInfo = JSON.parse(fs.readFileSync(hashFile));\n\n const outputFile = `${bashScriptsPath}/hashed_data.txt`;\n process.stdout.write(`${loggingPrefix}: writing to output file ${outputFile}\\n`);\n fs.writeFileSync(outputFile, '');\n\n messageObjects.forEach((message) => {\n const transifexFormatId = escapeDots(message.id);\n\n const info = messageInfo.find(mi => mi.key === transifexFormatId);\n if (info) {\n fs.appendFileSync(outputFile, `${info.string_hash}|${message.description}\\n`);\n } else {\n process.stdout.write(`${loggingPrefix}: string ${message.id} does not yet exist on transifex!\\n`);\n }\n });\n} else {\n const output = {};\n\n messageObjects.forEach((message) => {\n output[message.id] = message.defaultMessage;\n });\n fs.writeFileSync(process.argv[3], JSON.stringify(output, null, 2));\n}\n"],"mappings":"AAAA;AAAmB,SAAAA,mBAAAC,GAAA,WAAAC,kBAAA,CAAAD,GAAA,KAAAE,gBAAA,CAAAF,GAAA,KAAAG,2BAAA,CAAAH,GAAA,KAAAI,kBAAA;AAAA,SAAAA,mBAAA,cAAAC,SAAA;AAAA,SAAAF,4BAAAG,CAAA,EAAAC,MAAA,SAAAD,CAAA,qBAAAA,CAAA,sBAAAE,iBAAA,CAAAF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,GAAG,
|
|
1
|
+
{"version":3,"file":"transifex-utils.js","names":["_toConsumableArray","arr","_arrayWithoutHoles","_iterableToArray","_unsupportedIterableToArray","_nonIterableSpread","TypeError","o","minLen","_arrayLikeToArray","n","Object","prototype","toString","call","slice","constructor","name","Array","from","test","iter","Symbol","iterator","isArray","len","length","i","arr2","fs","require","glob","path","gatherJson","dir","ret","files","sync","concat","forEach","filename","messages","JSON","parse","readFileSync","push","apply","escapeDots","messageId","replace","jsonDir","process","argv","messageObjects","exitCode","Error","loggingPrefix","basename","__filename","bashScriptsPath","hashFile","stdout","write","messageInfo","outputFile","writeFileSync","message","transifexFormatId","id","info","find","mi","key","appendFileSync","string_hash","description","output","defaultMessage","stringify"],"sources":["../../../src/i18n/scripts/transifex-utils.js"],"sourcesContent":["#!/usr/bin/env node\n\nconst fs = require('fs');\nconst glob = require('glob');\nconst path = require('path');\n\n/*\n * See the Makefile for how the required hash file is downloaded from Transifex.\n */\n\n/*\n * Expected input: a directory, possibly containing subdirectories, with .json files. Each .json\n * file is an array of translation triplets (id, description, defaultMessage).\n *\n *\n */\nfunction gatherJson(dir) {\n const ret = [];\n const files = glob.sync(`${dir}/**/*.json`);\n\n files.forEach((filename) => {\n const messages = JSON.parse(fs.readFileSync(filename));\n ret.push(...messages);\n });\n return ret;\n}\n\n// the hash file returns ids whose periods are \"escaped\" (sort of), like this:\n// \"key\": \"profile\\\\.sociallinks\\\\.social\\\\.links\"\n// so our regular messageIds won't match them out of the box\nfunction escapeDots(messageId) {\n return messageId.replace(/\\./g, '\\\\.');\n}\n\nconst jsonDir = process.argv[2];\nconst messageObjects = gatherJson(jsonDir);\n\nif (messageObjects.length === 0) {\n process.exitCode = 1;\n throw new Error('Found no messages');\n}\n\nif (process.argv[3] === '--comments') { // prepare to handle the translator notes\n const loggingPrefix = path.basename(`${__filename}`); // the name of this JS file\n const bashScriptsPath = (\n process.argv[4] && process.argv[4] === '--v3-scripts-path'\n ? './node_modules/@edx/reactifex/bash_scripts'\n : './node_modules/reactifex/bash_scripts');\n\n const hashFile = `${bashScriptsPath}/hashmap.json`;\n process.stdout.write(`${loggingPrefix}: reading hash file ${hashFile}\\n`);\n const messageInfo = JSON.parse(fs.readFileSync(hashFile));\n\n const outputFile = `${bashScriptsPath}/hashed_data.txt`;\n process.stdout.write(`${loggingPrefix}: writing to output file ${outputFile}\\n`);\n fs.writeFileSync(outputFile, '');\n\n messageObjects.forEach((message) => {\n const transifexFormatId = escapeDots(message.id);\n\n const info = messageInfo.find(mi => mi.key === transifexFormatId);\n if (info) {\n fs.appendFileSync(outputFile, `${info.string_hash}|${message.description}\\n`);\n } else {\n process.stdout.write(`${loggingPrefix}: string ${message.id} does not yet exist on transifex!\\n`);\n }\n });\n} else {\n const output = {};\n\n messageObjects.forEach((message) => {\n output[message.id] = message.defaultMessage;\n });\n fs.writeFileSync(process.argv[3], JSON.stringify(output, null, 2));\n}\n"],"mappings":"AAAA;AAAmB,SAAAA,mBAAAC,GAAA,WAAAC,kBAAA,CAAAD,GAAA,KAAAE,gBAAA,CAAAF,GAAA,KAAAG,2BAAA,CAAAH,GAAA,KAAAI,kBAAA;AAAA,SAAAA,mBAAA,cAAAC,SAAA;AAAA,SAAAF,4BAAAG,CAAA,EAAAC,MAAA,SAAAD,CAAA,qBAAAA,CAAA,sBAAAE,iBAAA,CAAAF,CAAA,EAAAC,MAAA,OAAAE,CAAA,GAAAC,MAAA,CAAAC,SAAA,CAAAC,QAAA,CAAAC,IAAA,CAAAP,CAAA,EAAAQ,KAAA,aAAAL,CAAA,iBAAAH,CAAA,CAAAS,WAAA,EAAAN,CAAA,GAAAH,CAAA,CAAAS,WAAA,CAAAC,IAAA,MAAAP,CAAA,cAAAA,CAAA,mBAAAQ,KAAA,CAAAC,IAAA,CAAAZ,CAAA,OAAAG,CAAA,+DAAAU,IAAA,CAAAV,CAAA,UAAAD,iBAAA,CAAAF,CAAA,EAAAC,MAAA;AAAA,SAAAL,iBAAAkB,IAAA,eAAAC,MAAA,oBAA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