@edx/frontend-platform 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/analytics/MockAnalyticsService.js +6 -19
  2. package/analytics/MockAnalyticsService.js.map +1 -1
  3. package/analytics/SegmentAnalyticsService.js +53 -57
  4. package/analytics/SegmentAnalyticsService.js.map +1 -1
  5. package/analytics/index.js.map +1 -1
  6. package/analytics/interface.js +9 -9
  7. package/analytics/interface.js.map +1 -1
  8. package/auth/AxiosCsrfTokenService.js +36 -58
  9. package/auth/AxiosCsrfTokenService.js.map +1 -1
  10. package/auth/AxiosJwtAuthService.js +105 -150
  11. package/auth/AxiosJwtAuthService.js.map +1 -1
  12. package/auth/AxiosJwtTokenService.js +101 -148
  13. package/auth/AxiosJwtTokenService.js.map +1 -1
  14. package/auth/LocalForageCache.js +89 -108
  15. package/auth/LocalForageCache.js.map +1 -1
  16. package/auth/MockAuthService.js +10 -35
  17. package/auth/MockAuthService.js.map +1 -1
  18. package/auth/index.js.map +1 -1
  19. package/auth/interceptors/createCsrfTokenProviderInterceptor.js +35 -50
  20. package/auth/interceptors/createCsrfTokenProviderInterceptor.js.map +1 -1
  21. package/auth/interceptors/createJwtTokenProviderInterceptor.js +33 -47
  22. package/auth/interceptors/createJwtTokenProviderInterceptor.js.map +1 -1
  23. package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js +15 -27
  24. package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js.map +1 -1
  25. package/auth/interceptors/createRetryInterceptor.js +75 -105
  26. package/auth/interceptors/createRetryInterceptor.js.map +1 -1
  27. package/auth/interface.js +41 -58
  28. package/auth/interface.js.map +1 -1
  29. package/auth/utils.js +22 -40
  30. package/auth/utils.js.map +1 -1
  31. package/config.js +6 -7
  32. package/config.js.map +1 -1
  33. package/constants.js +8 -8
  34. package/constants.js.map +1 -1
  35. package/i18n/countries.js +9 -15
  36. package/i18n/countries.js.map +1 -1
  37. package/i18n/index.js +1 -0
  38. package/i18n/index.js.map +1 -1
  39. package/i18n/injectIntlWithShim.js +4 -28
  40. package/i18n/injectIntlWithShim.js.map +1 -1
  41. package/i18n/languages.js +11 -17
  42. package/i18n/languages.js.map +1 -1
  43. package/i18n/lib.js +64 -56
  44. package/i18n/lib.js.map +1 -1
  45. package/i18n/scripts/transifex-utils.js +5 -20
  46. package/i18n/scripts/transifex-utils.js.map +1 -1
  47. package/index.js.map +1 -1
  48. package/initialize.js +176 -228
  49. package/initialize.js.map +1 -1
  50. package/logging/MockLoggingService.js +5 -9
  51. package/logging/MockLoggingService.js.map +1 -1
  52. package/logging/NewRelicLoggingService.js +9 -33
  53. package/logging/NewRelicLoggingService.js.map +1 -1
  54. package/logging/index.js.map +1 -1
  55. package/logging/interface.js +7 -6
  56. package/logging/interface.js.map +1 -1
  57. package/package.json +4 -4
  58. package/pubSub.js +4 -3
  59. package/pubSub.js.map +1 -1
  60. package/react/AppContext.js +1 -1
  61. package/react/AppContext.js.map +1 -1
  62. package/react/AppProvider.js +13 -23
  63. package/react/AppProvider.js.map +1 -1
  64. package/react/AuthenticatedPageRoute.js +5 -13
  65. package/react/AuthenticatedPageRoute.js.map +1 -1
  66. package/react/ErrorBoundary.js +4 -21
  67. package/react/ErrorBoundary.js.map +1 -1
  68. package/react/ErrorPage.js +7 -17
  69. package/react/ErrorPage.js.map +1 -1
  70. package/react/LoginRedirect.js +1 -1
  71. package/react/LoginRedirect.js.map +1 -1
  72. package/react/OptionalReduxProvider.js +2 -4
  73. package/react/OptionalReduxProvider.js.map +1 -1
  74. package/react/PageRoute.js +3 -3
  75. package/react/PageRoute.js.map +1 -1
  76. package/react/hooks.js +2 -6
  77. package/react/hooks.js.map +1 -1
  78. package/react/index.js +1 -0
  79. package/react/index.js.map +1 -1
  80. package/testing/index.js +1 -0
  81. package/testing/index.js.map +1 -1
  82. package/testing/initializeMockApp.js +11 -11
  83. package/testing/initializeMockApp.js.map +1 -1
  84. package/testing/mockMessages.js.map +1 -1
  85. package/utils.js +15 -24
  86. package/utils.js.map +1 -1
package/config.js CHANGED
@@ -23,20 +23,18 @@
23
23
  *
24
24
  * @module Config
25
25
  */
26
+
26
27
  import { APP_CONFIG_INITIALIZED, CONFIG_CHANGED } from './constants';
27
28
  import { publish, subscribe } from './pubSub';
28
29
  import { ensureDefinedConfig } from './utils';
29
-
30
30
  function extractRegex(envVar) {
31
31
  // Convert the environment variable string to a regex, while guarding
32
32
  // against a non-string and an empty/whitespace-only string.
33
33
  if (typeof envVar === 'string' && envVar.trim() !== '') {
34
34
  return new RegExp(envVar);
35
35
  }
36
-
37
36
  return undefined;
38
37
  }
39
-
40
38
  var ENVIRONMENT = process.env.NODE_ENV;
41
39
  var config = {
42
40
  ACCESS_TOKEN_COOKIE_NAME: process.env.ACCESS_TOKEN_COOKIE_NAME,
@@ -72,6 +70,7 @@ var config = {
72
70
  APP_ID: process.env.APP_ID,
73
71
  SUPPORT_URL: process.env.SUPPORT_URL
74
72
  };
73
+
75
74
  /**
76
75
  * Getter for the application configuration document. This is synchronous and merely returns a
77
76
  * reference to an existing object, and is thus safe to call as often as desired. The document
@@ -79,10 +78,10 @@ var config = {
79
78
  *
80
79
  * @returns {ConfigDocument}
81
80
  */
82
-
83
81
  export function getConfig() {
84
82
  return config;
85
83
  }
84
+
86
85
  /**
87
86
  * Replaces the existing ConfigDocument. This is not commonly used, but can be helpful for tests.
88
87
  *
@@ -91,12 +90,12 @@ export function getConfig() {
91
90
  *
92
91
  * @param {ConfigDocument} newConfig
93
92
  */
94
-
95
93
  export function setConfig(newConfig) {
96
94
  ensureDefinedConfig(config, 'config');
97
95
  config = newConfig;
98
96
  publish(CONFIG_CHANGED);
99
97
  }
98
+
100
99
  /**
101
100
  * Merges additional configuration values into the ConfigDocument returned by `getConfig`. Will
102
101
  * override any values that exist with the same keys.
@@ -111,12 +110,12 @@ export function setConfig(newConfig) {
111
110
  *
112
111
  * @param {Object} newConfig
113
112
  */
114
-
115
113
  export function mergeConfig(newConfig) {
116
114
  ensureDefinedConfig(newConfig, 'ProcessEnvConfigService');
117
115
  config = Object.assign(config, newConfig);
118
116
  publish(CONFIG_CHANGED);
119
117
  }
118
+
120
119
  /**
121
120
  * A method allowing application code to indicate that particular ConfigDocument keys are required
122
121
  * for them to function. This is useful for diagnosing development/deployment issues, primarily,
@@ -141,7 +140,6 @@ export function mergeConfig(newConfig) {
141
140
  * @param {Array} keys
142
141
  * @param {string} [requester='unspecified application code']
143
142
  */
144
-
145
143
  export function ensureConfig(keys) {
146
144
  var requester = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'unspecified application code';
147
145
  subscribe(APP_CONFIG_INITIALIZED, function () {
@@ -153,6 +151,7 @@ export function ensureConfig(keys) {
153
151
  });
154
152
  });
155
153
  }
154
+
156
155
  /**
157
156
  * An object describing the current application configuration.
158
157
  *
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","forEach","key","console","warn"],"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,sBAAT,EAAiCC,cAAjC,QAAuD,aAAvD;AAEA,SAASC,OAAT,EAAkBC,SAAlB,QAAmC,UAAnC;AACA,SAASC,mBAAT,QAAoC,SAApC;;AAEA,SAASC,YAAT,CAAsBC,MAAtB,EAA8B;EAC5B;EACA;EACA,IAAI,OAAOA,MAAP,KAAkB,QAAlB,IAA8BA,MAAM,CAACC,IAAP,OAAkB,EAApD,EAAwD;IACtD,OAAO,IAAIC,MAAJ,CAAWF,MAAX,CAAP;EACD;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EACA9C,OAAO,CAACD,cAAD,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASmD,YAAT,CAAsBC,IAAtB,EAAwE;EAAA,IAA5CC,SAA4C,uEAAhC,8BAAgC;EAC7EnD,SAAS,CAACH,sBAAD,EAAyB,YAAM;IACtCqD,IAAI,CAACE,OAAL,CAAa,UAACC,GAAD,EAAS;MACpB,IAAI1C,MAAM,CAAC0C,GAAD,CAAN,KAAgB/C,SAApB,EAA+B;QAC7B;QACAgD,OAAO,CAACC,IAAR,oCAAyCF,GAAzC,6BAA+DF,SAA/D;MACD;IACF,CALD;EAMD,CAPQ,CAAT;AAQD;AAED;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,S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5C,mBAAmB,CAAC4C,SAAS,EAAE,yBAAyB,CAAC;EACzDlC,MAAM,GAAGoC,MAAM,CAACC,MAAM,CAACrC,MAAM,EAAEkC,SAAS,CAAC;EACzC9C,OAAO,CAACD,cAAc,CAAC;AACzB;;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,OAAO,SAASmD,YAAYA,CAACC,IAAI,EAA8C;EAAA,IAA5CC,SAAS,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAA9C,SAAA,GAAA8C,SAAA,MAAG,8BAA8B;EAC3EpD,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,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"}
package/constants.js CHANGED
@@ -1,54 +1,55 @@
1
1
  /** @constant */
2
2
  export var APP_TOPIC = 'APP';
3
3
  export var APP_PUBSUB_INITIALIZED = "".concat(APP_TOPIC, ".PUBSUB_INITIALIZED");
4
+
4
5
  /**
5
6
  * Event published when the application initialization sequence has finished loading any dynamic
6
7
  * configuration setup in a custom config handler.
7
8
  *
8
9
  * @event
9
10
  */
10
-
11
11
  export var APP_CONFIG_INITIALIZED = "".concat(APP_TOPIC, ".CONFIG_INITIALIZED");
12
+
12
13
  /**
13
14
  * Event published when the application initialization sequence has finished determining the user's
14
15
  * authentication state, creating an authenticated API client, and executing auth handlers.
15
16
  *
16
17
  * @event
17
18
  */
18
-
19
19
  export var APP_AUTH_INITIALIZED = "".concat(APP_TOPIC, ".AUTH_INITIALIZED");
20
+
20
21
  /**
21
22
  * Event published when the application initialization sequence has finished initializing
22
23
  * internationalization and executing any i18n handlers.
23
24
  *
24
25
  * @event
25
26
  */
26
-
27
27
  export var APP_I18N_INITIALIZED = "".concat(APP_TOPIC, ".I18N_INITIALIZED");
28
+
28
29
  /**
29
30
  * Event published when the application initialization sequence has finished initializing the
30
31
  * logging service and executing any logging handlers.
31
32
  *
32
33
  * @event
33
34
  */
34
-
35
35
  export var APP_LOGGING_INITIALIZED = "".concat(APP_TOPIC, ".LOGGING_INITIALIZED");
36
+
36
37
  /**
37
38
  * Event published when the application initialization sequence has finished initializing the
38
39
  * analytics service and executing any analytics handlers.
39
40
  *
40
41
  * @event
41
42
  */
42
-
43
43
  export var APP_ANALYTICS_INITIALIZED = "".concat(APP_TOPIC, ".ANALYTICS_INITIALIZED");
44
+
44
45
  /**
45
46
  * Event published when the application initialization sequence has finished. Applications should
46
47
  * subscribe to this event and start rendering the UI when it has fired.
47
48
  *
48
49
  * @event
49
50
  */
50
-
51
51
  export var APP_READY = "".concat(APP_TOPIC, ".READY");
52
+
52
53
  /**
53
54
  * Event published when the application initialization sequence has aborted. This is frequently
54
55
  * used to show an error page when an initialization error has occurred.
@@ -56,10 +57,9 @@ export var APP_READY = "".concat(APP_TOPIC, ".READY");
56
57
  * @see {@link module:React~ErrorPage}
57
58
  * @event
58
59
  */
59
-
60
60
  export var APP_INIT_ERROR = "".concat(APP_TOPIC, ".INIT_ERROR");
61
- /** @constant */
62
61
 
62
+ /** @constant */
63
63
  export var CONFIG_TOPIC = 'CONFIG';
64
64
  export var CONFIG_CHANGED = "".concat(CONFIG_TOPIC, ".CHANGED");
65
65
  //# sourceMappingURL=constants.js.map
package/constants.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["APP_TOPIC","APP_PUBSUB_INITIALIZED","APP_CONFIG_INITIALIZED","APP_AUTH_INITIALIZED","APP_I18N_INITIALIZED","APP_LOGGING_INITIALIZED","APP_ANALYTICS_INITIALIZED","APP_READY","APP_INIT_ERROR","CONFIG_TOPIC","CONFIG_CHANGED"],"sources":["../src/constants.js"],"sourcesContent":["/** @constant */\nexport const APP_TOPIC = 'APP';\n\nexport const APP_PUBSUB_INITIALIZED = `${APP_TOPIC}.PUBSUB_INITIALIZED`;\n\n/**\n * Event published when the application initialization sequence has finished loading any dynamic\n * configuration setup in a custom config handler.\n *\n * @event\n */\nexport const APP_CONFIG_INITIALIZED = `${APP_TOPIC}.CONFIG_INITIALIZED`;\n\n/**\n * Event published when the application initialization sequence has finished determining the user's\n * authentication state, creating an authenticated API client, and executing auth handlers.\n *\n * @event\n */\nexport const APP_AUTH_INITIALIZED = `${APP_TOPIC}.AUTH_INITIALIZED`;\n\n/**\n * Event published when the application initialization sequence has finished initializing\n * internationalization and executing any i18n handlers.\n *\n * @event\n */\nexport const APP_I18N_INITIALIZED = `${APP_TOPIC}.I18N_INITIALIZED`;\n\n/**\n * Event published when the application initialization sequence has finished initializing the\n * logging service and executing any logging handlers.\n *\n * @event\n */\nexport const APP_LOGGING_INITIALIZED = `${APP_TOPIC}.LOGGING_INITIALIZED`;\n\n/**\n * Event published when the application initialization sequence has finished initializing the\n * analytics service and executing any analytics handlers.\n *\n * @event\n */\nexport const APP_ANALYTICS_INITIALIZED = `${APP_TOPIC}.ANALYTICS_INITIALIZED`;\n\n/**\n * Event published when the application initialization sequence has finished. Applications should\n * subscribe to this event and start rendering the UI when it has fired.\n *\n * @event\n */\nexport const APP_READY = `${APP_TOPIC}.READY`;\n\n/**\n * Event published when the application initialization sequence has aborted. This is frequently\n * used to show an error page when an initialization error has occurred.\n *\n * @see {@link module:React~ErrorPage}\n * @event\n */\nexport const APP_INIT_ERROR = `${APP_TOPIC}.INIT_ERROR`;\n\n/** @constant */\nexport const CONFIG_TOPIC = 'CONFIG';\n\nexport const CONFIG_CHANGED = `${CONFIG_TOPIC}.CHANGED`;\n"],"mappings":"AAAA;AACA,OAAO,IAAMA,SAAS,GAAG,KAAlB;AAEP,OAAO,IAAMC,sBAAsB,aAAMD,SAAN,wBAA5B;AAEP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAME,sBAAsB,aAAMF,SAAN,wBAA5B;AAEP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMG,oBAAoB,aAAMH,SAAN,sBAA1B;AAEP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMI,oBAAoB,aAAMJ,SAAN,sBAA1B;AAEP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMK,uBAAuB,aAAML,SAAN,yBAA7B;AAEP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMM,yBAAyB,aAAMN,SAAN,2BAA/B;AAEP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMO,SAAS,aAAMP,SAAN,WAAf;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMQ,cAAc,aAAMR,SAAN,gBAApB;AAEP;;AACA,OAAO,IAAMS,YAAY,GAAG,QAArB;AAEP,OAAO,IAAMC,cAAc,aAAMD,YAAN,aAApB"}
1
+ {"version":3,"file":"constants.js","names":["APP_TOPIC","APP_PUBSUB_INITIALIZED","concat","APP_CONFIG_INITIALIZED","APP_AUTH_INITIALIZED","APP_I18N_INITIALIZED","APP_LOGGING_INITIALIZED","APP_ANALYTICS_INITIALIZED","APP_READY","APP_INIT_ERROR","CONFIG_TOPIC","CONFIG_CHANGED"],"sources":["../src/constants.js"],"sourcesContent":["/** @constant */\nexport const APP_TOPIC = 'APP';\n\nexport const APP_PUBSUB_INITIALIZED = `${APP_TOPIC}.PUBSUB_INITIALIZED`;\n\n/**\n * Event published when the application initialization sequence has finished loading any dynamic\n * configuration setup in a custom config handler.\n *\n * @event\n */\nexport const APP_CONFIG_INITIALIZED = `${APP_TOPIC}.CONFIG_INITIALIZED`;\n\n/**\n * Event published when the application initialization sequence has finished determining the user's\n * authentication state, creating an authenticated API client, and executing auth handlers.\n *\n * @event\n */\nexport const APP_AUTH_INITIALIZED = `${APP_TOPIC}.AUTH_INITIALIZED`;\n\n/**\n * Event published when the application initialization sequence has finished initializing\n * internationalization and executing any i18n handlers.\n *\n * @event\n */\nexport const APP_I18N_INITIALIZED = `${APP_TOPIC}.I18N_INITIALIZED`;\n\n/**\n * Event published when the application initialization sequence has finished initializing the\n * logging service and executing any logging handlers.\n *\n * @event\n */\nexport const APP_LOGGING_INITIALIZED = `${APP_TOPIC}.LOGGING_INITIALIZED`;\n\n/**\n * Event published when the application initialization sequence has finished initializing the\n * analytics service and executing any analytics handlers.\n *\n * @event\n */\nexport const APP_ANALYTICS_INITIALIZED = `${APP_TOPIC}.ANALYTICS_INITIALIZED`;\n\n/**\n * Event published when the application initialization sequence has finished. Applications should\n * subscribe to this event and start rendering the UI when it has fired.\n *\n * @event\n */\nexport const APP_READY = `${APP_TOPIC}.READY`;\n\n/**\n * Event published when the application initialization sequence has aborted. This is frequently\n * used to show an error page when an initialization error has occurred.\n *\n * @see {@link module:React~ErrorPage}\n * @event\n */\nexport const APP_INIT_ERROR = `${APP_TOPIC}.INIT_ERROR`;\n\n/** @constant */\nexport const CONFIG_TOPIC = 'CONFIG';\n\nexport const CONFIG_CHANGED = `${CONFIG_TOPIC}.CHANGED`;\n"],"mappings":"AAAA;AACA,OAAO,IAAMA,SAAS,GAAG,KAAK;AAE9B,OAAO,IAAMC,sBAAsB,MAAAC,MAAA,CAAMF,SAAS,wBAAqB;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMG,sBAAsB,MAAAD,MAAA,CAAMF,SAAS,wBAAqB;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMI,oBAAoB,MAAAF,MAAA,CAAMF,SAAS,sBAAmB;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMK,oBAAoB,MAAAH,MAAA,CAAMF,SAAS,sBAAmB;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMM,uBAAuB,MAAAJ,MAAA,CAAMF,SAAS,yBAAsB;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMO,yBAAyB,MAAAL,MAAA,CAAMF,SAAS,2BAAwB;;AAE7E;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMQ,SAAS,MAAAN,MAAA,CAAMF,SAAS,WAAQ;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMS,cAAc,MAAAP,MAAA,CAAMF,SAAS,gBAAa;;AAEvD;AACA,OAAO,IAAMU,YAAY,GAAG,QAAQ;AAEpC,OAAO,IAAMC,cAAc,MAAAT,MAAA,CAAMQ,YAAY,aAAU"}
package/i18n/countries.js CHANGED
@@ -1,18 +1,13 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
2
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
3
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
11
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
7
  /* eslint-disable import/extensions */
14
8
  import COUNTRIES, { langs as countryLangs } from 'i18n-iso-countries';
15
9
  import { getPrimaryLanguageSubtag } from './lib';
10
+
16
11
  /*
17
12
  * COUNTRY LISTS
18
13
  *
@@ -32,20 +27,21 @@ COUNTRIES.registerLocale(require('i18n-iso-countries/langs/id.json'));
32
27
  COUNTRIES.registerLocale(require('i18n-iso-countries/langs/ko.json'));
33
28
  COUNTRIES.registerLocale(require('i18n-iso-countries/langs/pl.json'));
34
29
  COUNTRIES.registerLocale(require('i18n-iso-countries/langs/pt.json'));
35
- COUNTRIES.registerLocale(require('i18n-iso-countries/langs/ru.json')); // COUNTRIES.registerLocale(require('i18n-iso-countries/langs/th.json')); // Doesn't exist in lib.
36
-
30
+ COUNTRIES.registerLocale(require('i18n-iso-countries/langs/ru.json'));
31
+ // COUNTRIES.registerLocale(require('i18n-iso-countries/langs/th.json')); // Doesn't exist in lib.
37
32
  COUNTRIES.registerLocale(require('i18n-iso-countries/langs/uk.json'));
33
+
38
34
  /**
39
35
  * Provides a lookup table of country IDs to country names for the current locale.
40
36
  *
41
37
  * @memberof module:I18n
42
38
  */
43
-
44
39
  export function getCountryMessages(locale) {
45
40
  var primaryLanguageSubtag = getPrimaryLanguageSubtag(locale);
46
41
  var languageCode = countryLangs().includes(primaryLanguageSubtag) ? primaryLanguageSubtag : 'en';
47
42
  return COUNTRIES.getNames(languageCode);
48
43
  }
44
+
49
45
  /**
50
46
  * Provides a list of countries represented as objects of the following shape:
51
47
  *
@@ -59,14 +55,12 @@ export function getCountryMessages(locale) {
59
55
  *
60
56
  * @memberof module:I18n
61
57
  */
62
-
63
58
  export function getCountryList(locale) {
64
59
  var countryMessages = getCountryMessages(locale);
65
60
  return Object.entries(countryMessages).map(function (_ref) {
66
61
  var _ref2 = _slicedToArray(_ref, 2),
67
- code = _ref2[0],
68
- name = _ref2[1];
69
-
62
+ code = _ref2[0],
63
+ name = _ref2[1];
70
64
  return {
71
65
  code: code,
72
66
  name: name
@@ -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","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,SAAP,IAAoBC,KAAK,IAAIC,YAA7B,QAAiD,oBAAjD;AAEA,SAASC,wBAAT,QAAyC,OAAzC;AAEA;A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ACC,MAAD,CAA1C;EACA,OAAOO,MAAM,CAACC,OAAP,CAAeF,eAAf,EAAgCG,GAAhC,CAAoC;IAAA;IAAA,IAAEC,IAAF;IAAA,IAAQC,IAAR;;IAAA,OAAmB;MAAED,IAAI,EAAJA,IAAF;MAAQC,IAAI,EAAJA;IAAR,CAAnB;EAAA,CAApC,CAAP;AACD"}
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,EAAE,CAACQ,QAAQ,CAACF,qBAAqB,CAAC,GAAGA,qBAAqB,GAAG,IAAI;EAElG,OAAOR,SAAS,CAACW,QAAQ,CAACF,YAAY,CAAC;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,cAAcA,CAACL,MAAM,EAAE;EACrC,IAAMM,eAAe,GAAGP,kBAAkB,CAACC,MAAM,CAAC;EAClD,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"}
package/i18n/index.js CHANGED
@@ -82,6 +82,7 @@
82
82
  * @kind function
83
83
  * @see {@link https://formatjs.io/docs/react-intl/api#useIntl Intl}
84
84
  */
85
+
85
86
  export { createIntl, FormattedDate, FormattedTime, FormattedRelativeTime, FormattedNumber, FormattedPlural, FormattedMessage, defineMessages, IntlProvider, useIntl } from 'react-intl';
86
87
  export { intlShape, configure, getPrimaryLanguageSubtag, getLocale, getMessages, isRtl, handleRtl, LOCALE_CHANGED, LOCALE_TOPIC } from './lib';
87
88
  export { default as injectIntl } from './injectIntlWithShim';
package/i18n/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["createIntl","FormattedDate","FormattedTime","FormattedRelativeTime","FormattedNumber","FormattedPlural","FormattedMessage","defineMessages","IntlProvider","useIntl","intlShape","configure","getPrimaryLanguageSubtag","getLocale","getMessages","isRtl","handleRtl","LOCALE_CHANGED","LOCALE_TOPIC","default","injectIntl","getCountryList","getCountryMessages","getLanguageList","getLanguageMessages"],"sources":["../../src/i18n/index.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform/i18n**\n * The i18n module relies on react-intl and re-exports all of that package's exports.\n *\n * For each locale we want to support, react-intl needs 1) the locale-data, which includes\n * information about how to format numbers, handle plurals, etc., and 2) the translations, as an\n * object holding message id / translated string pairs. A locale string and the messages object are\n * passed into the IntlProvider element that wraps your element hierarchy.\n *\n * Note that react-intl has no way of checking if the translations you give it actually have\n * anything to do with the locale you pass it; it will happily use whatever messages object you pass\n * in. However, if the locale data for the locale you passed into the IntlProvider was not\n * correctly installed with addLocaleData, all of your translations will fall back to the default\n * (in our case English), *even if you gave IntlProvider the correct messages object for that\n * locale*.\n *\n * Messages are provided to this module via the configure() function below.\n *\n *\n * @module Internationalization\n * @see {@link https://github.com/openedx/frontend-platform/blob/master/docs/how_tos/i18n.rst}\n * @see {@link https://formatjs.io/docs/react-intl/components/ Intl} for components exported from this module.\n *\n */\n\n/**\n * @name createIntl\n * @kind function\n * @see {@link https://formatjs.io/docs/react-intl/api#createIntl Intl}\n */\n\n/**\n * @name FormattedDate\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#formatteddate Intl}\n */\n\n/**\n * @name FormattedTime\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#formattedtime Intl}\n */\n\n/**\n * @name FormattedRelativeTime\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#formattedrelativetime Intl}\n */\n\n/**\n * @name FormattedNumber\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#formattednumber Intl}\n */\n\n/**\n * @name FormattedPlural\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#formattedplural Intl}\n */\n\n/**\n * @name FormattedMessage\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#formattedmessage Intl}\n */\n\n/**\n * @name IntlProvider\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#intlprovider Intl}\n */\n\n/**\n * @name defineMessages\n * @kind function\n * @see {@link https://formatjs.io/docs/react-intl/api#definemessagesdefinemessage Intl}\n */\n\n/**\n * @name useIntl\n * @kind function\n * @see {@link https://formatjs.io/docs/react-intl/api#useIntl Intl}\n */\n\nexport {\n createIntl,\n FormattedDate,\n FormattedTime,\n FormattedRelativeTime,\n FormattedNumber,\n FormattedPlural,\n FormattedMessage,\n defineMessages,\n IntlProvider,\n useIntl,\n} from 'react-intl';\n\nexport {\n intlShape,\n configure,\n getPrimaryLanguageSubtag,\n getLocale,\n getMessages,\n isRtl,\n handleRtl,\n LOCALE_CHANGED,\n LOCALE_TOPIC,\n} from './lib';\n\nexport {\n default as injectIntl,\n} from './injectIntlWithShim';\n\nexport {\n getCountryList,\n getCountryMessages,\n} from './countries';\n\nexport {\n getLanguageList,\n getLanguageMessages,\n} from './languages';\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;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AAEA,SACEA,UADF,EAEEC,aAFF,EAGEC,aAHF,EAIEC,qBAJF,EAKEC,eALF,EAMEC,eANF,EAOEC,gBAPF,EAQEC,cARF,EASEC,YATF,EAUEC,OAVF,QAWO,YAXP;AAaA,SACEC,SADF,EAEEC,SAFF,EAGEC,wBAHF,EAIEC,SAJF,EAKEC,WALF,EAMEC,KANF,EAOEC,SAPF,EAQEC,cARF,EASEC,YATF,QAUO,OAVP;AAYA,SACEC,OAAO,IAAIC,UADb,QAEO,sBAFP;AAIA,SACEC,cADF,EAEEC,kBAFF,QAGO,aAHP;AAKA,SACEC,eADF,EAEEC,mBAFF,QAGO,aAHP"}
1
+ {"version":3,"file":"index.js","names":["createIntl","FormattedDate","FormattedTime","FormattedRelativeTime","FormattedNumber","FormattedPlural","FormattedMessage","defineMessages","IntlProvider","useIntl","intlShape","configure","getPrimaryLanguageSubtag","getLocale","getMessages","isRtl","handleRtl","LOCALE_CHANGED","LOCALE_TOPIC","default","injectIntl","getCountryList","getCountryMessages","getLanguageList","getLanguageMessages"],"sources":["../../src/i18n/index.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform/i18n**\n * The i18n module relies on react-intl and re-exports all of that package's exports.\n *\n * For each locale we want to support, react-intl needs 1) the locale-data, which includes\n * information about how to format numbers, handle plurals, etc., and 2) the translations, as an\n * object holding message id / translated string pairs. A locale string and the messages object are\n * passed into the IntlProvider element that wraps your element hierarchy.\n *\n * Note that react-intl has no way of checking if the translations you give it actually have\n * anything to do with the locale you pass it; it will happily use whatever messages object you pass\n * in. However, if the locale data for the locale you passed into the IntlProvider was not\n * correctly installed with addLocaleData, all of your translations will fall back to the default\n * (in our case English), *even if you gave IntlProvider the correct messages object for that\n * locale*.\n *\n * Messages are provided to this module via the configure() function below.\n *\n *\n * @module Internationalization\n * @see {@link https://github.com/openedx/frontend-platform/blob/master/docs/how_tos/i18n.rst}\n * @see {@link https://formatjs.io/docs/react-intl/components/ Intl} for components exported from this module.\n *\n */\n\n/**\n * @name createIntl\n * @kind function\n * @see {@link https://formatjs.io/docs/react-intl/api#createIntl Intl}\n */\n\n/**\n * @name FormattedDate\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#formatteddate Intl}\n */\n\n/**\n * @name FormattedTime\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#formattedtime Intl}\n */\n\n/**\n * @name FormattedRelativeTime\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#formattedrelativetime Intl}\n */\n\n/**\n * @name FormattedNumber\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#formattednumber Intl}\n */\n\n/**\n * @name FormattedPlural\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#formattedplural Intl}\n */\n\n/**\n * @name FormattedMessage\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#formattedmessage Intl}\n */\n\n/**\n * @name IntlProvider\n * @kind class\n * @see {@link https://formatjs.io/docs/react-intl/components/#intlprovider Intl}\n */\n\n/**\n * @name defineMessages\n * @kind function\n * @see {@link https://formatjs.io/docs/react-intl/api#definemessagesdefinemessage Intl}\n */\n\n/**\n * @name useIntl\n * @kind function\n * @see {@link https://formatjs.io/docs/react-intl/api#useIntl Intl}\n */\n\nexport {\n createIntl,\n FormattedDate,\n FormattedTime,\n FormattedRelativeTime,\n FormattedNumber,\n FormattedPlural,\n FormattedMessage,\n defineMessages,\n IntlProvider,\n useIntl,\n} from 'react-intl';\n\nexport {\n intlShape,\n configure,\n getPrimaryLanguageSubtag,\n getLocale,\n getMessages,\n isRtl,\n handleRtl,\n LOCALE_CHANGED,\n LOCALE_TOPIC,\n} from './lib';\n\nexport {\n default as injectIntl,\n} from './injectIntlWithShim';\n\nexport {\n getCountryList,\n getCountryMessages,\n} from './countries';\n\nexport {\n getLanguageList,\n getLanguageMessages,\n} from './languages';\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;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,SACEA,UAAU,EACVC,aAAa,EACbC,aAAa,EACbC,qBAAqB,EACrBC,eAAe,EACfC,eAAe,EACfC,gBAAgB,EAChBC,cAAc,EACdC,YAAY,EACZC,OAAO,QACF,YAAY;AAEnB,SACEC,SAAS,EACTC,SAAS,EACTC,wBAAwB,EACxBC,SAAS,EACTC,WAAW,EACXC,KAAK,EACLC,SAAS,EACTC,cAAc,EACdC,YAAY,QACP,OAAO;AAEd,SACEC,OAAO,IAAIC,UAAU,QAChB,sBAAsB;AAE7B,SACEC,cAAc,EACdC,kBAAkB,QACb,aAAa;AAEpB,SACEC,eAAe,EACfC,mBAAmB,QACd,aAAa"}
@@ -1,78 +1,57 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
-
3
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
-
5
3
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
8
-
4
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
9
5
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
-
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
8
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
12
-
13
9
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
-
15
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
16
-
17
11
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
18
-
19
12
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
20
-
21
13
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
22
-
23
14
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
24
-
25
15
  import React from 'react';
26
16
  import { injectIntl } from 'react-intl';
27
17
  import { getLoggingService, intlShape } from './lib';
18
+
28
19
  /**
29
20
  * This function wraps react-intl's injectIntl function in order to add error logging to the intl
30
21
  * property's formatMessage function.
31
22
  *
32
23
  * @memberof I18n
33
24
  */
34
-
35
25
  var injectIntlWithShim = function injectIntlWithShim(WrappedComponent) {
36
26
  var ShimmedIntlComponent = /*#__PURE__*/function (_React$Component) {
37
27
  _inherits(ShimmedIntlComponent, _React$Component);
38
-
39
28
  var _super = _createSuper(ShimmedIntlComponent);
40
-
41
29
  function ShimmedIntlComponent(props) {
42
30
  var _this;
43
-
44
31
  _classCallCheck(this, ShimmedIntlComponent);
45
-
46
32
  _this = _super.call(this, props);
47
33
  _this.shimmedIntl = Object.create(_this.props.intl, {
48
34
  formatMessage: {
49
35
  value: function value(definition) {
50
36
  var _this$props$intl;
51
-
52
37
  if (definition === undefined || definition.id === undefined) {
53
38
  var error = new Error('i18n error: An undefined message was supplied to intl.formatMessage.');
54
-
55
39
  if (process.env.NODE_ENV !== 'production') {
56
40
  console.error(error); // eslint-disable-line no-console
57
-
58
41
  return '!!! Missing message supplied to intl.formatMessage !!!';
59
42
  }
60
-
61
43
  getLoggingService().logError(error);
62
44
  return ''; // Fail silently in production
63
45
  }
64
-
65
46
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
66
47
  args[_key - 1] = arguments[_key];
67
48
  }
68
-
69
49
  return (_this$props$intl = _this.props.intl).formatMessage.apply(_this$props$intl, [definition].concat(args));
70
50
  }
71
51
  }
72
52
  });
73
53
  return _this;
74
54
  }
75
-
76
55
  _createClass(ShimmedIntlComponent, [{
77
56
  key: "render",
78
57
  value: function render() {
@@ -81,15 +60,12 @@ var injectIntlWithShim = function injectIntlWithShim(WrappedComponent) {
81
60
  }));
82
61
  }
83
62
  }]);
84
-
85
63
  return ShimmedIntlComponent;
86
64
  }(React.Component);
87
-
88
65
  ShimmedIntlComponent.propTypes = {
89
66
  intl: intlShape.isRequired
90
67
  };
91
68
  return injectIntl(ShimmedIntlComponent);
92
69
  };
93
-
94
70
  export default injectIntlWithShim;
95
71
  //# sourceMappingURL=injectIntlWithShim.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"injectIntlWithShim.js","names":["React","injectIntl","getLoggingService","intlShape","injectIntlWithShim","WrappedComponent","ShimmedIntlComponent","props","shimmedIntl","Object","create","intl","formatMessage","value","definition","undefined","id","error","Error","process","env","NODE_ENV","console","logError","args","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,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,YAA3B;AACA,SAASC,iBAAT,EAA4BC,SAA5B,QAA6C,OAA7C;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB,CAACC,gBAAD,EAAsB;EAAA,IACzCC,oBADyC;IAAA;;IAAA;;IAE7C,8BAAYC,KAAZ,EAAmB;MAAA;;MAAA;;MACjB,0BAAMA,KAAN;MACA,MAAKC,WAAL,GAAmBC,MAAM,CAACC,MAAP,CAAc,MAAKH,KAAL,CAAWI,IAAzB,EAA+B;QAChDC,aAAa,EAAE;UACbC,KAAK,EAAE,eAACC,UAAD,EAAyB;YAAA;;YAC9B,IAAIA,UAAU,KAAKC,SAAf,IAA4BD,UAAU,CAACE,EAAX,KAAkBD,SAAlD,EAA6D;cAC3D,IAAME,KAAK,GAAG,IAAIC,KAAJ,CAAU,sEAAV,CAAd;;cACA,IAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;gBACzCC,OAAO,CAACL,KAAR,CAAcA,KAAd,EADyC,CACnB;;gBACtB,OAAO,wDAAP;cACD;;cACDf,iBAAiB,GAAGqB,QAApB,CAA6BN,KAA7B;cACA,OAAO,EAAP,CAP2D,CAOhD;YACZ;;YAT6B,kCAATO,IAAS;cAATA,IAAS;YAAA;;YAU9B,OAAO,0BAAKjB,KAAL,CAAWI,IAAX,EAAgBC,aAAhB,0BAA8BE,UAA9B,SAA6CU,IAA7C,EAAP;UACD;QAZY;MADiC,CAA/B,CAAnB;MAFiB;IAkBlB;;IApB4C;MAAA;MAAA,OAsB7C,kBAAS;QACP,oBAAO,oBAAC,gBAAD,eAAsB,KAAKjB,KAA3B;UAAkC,IAAI,EAAE,KAAKC;QAA7C,GAAP;MACD;IAxB4C;;IAAA;EAAA,EACZR,KAAK,CAACyB,SADM;;EA2B/CnB,oBAAoB,CAACoB,SAArB,GAAiC;IAC/Bf,IAAI,EAAER,SAAS,CAACwB;EADe,CAAjC;EAIA,OAAO1B,UAAU,CAACK,oBAAD,CAAjB;AACD,CAhCD;;AAkCA,eAAeF,kBAAf"}
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,EAAE,CAAC6B,QAAQ,CAACN,KAAK,CAAC;cACnC,OAAO,EAAE,CAAC,CAAC;YACb;YAAC,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAToBC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,OAAAA,IAAA,WAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;cAAJF,IAAI,CAAAE,IAAA,QAAAJ,SAAA,CAAAI,IAAA;YAAA;YAUzB,OAAO,CAAAf,gBAAA,GAAAV,KAAA,CAAKD,KAAK,CAACO,IAAI,EAACC,aAAa,CAAAmB,KAAA,CAAAhB,gBAAA,GAACD,UAAU,EAAAkB,MAAA,CAAKJ,IAAI,EAAC;UAC3D;QACF;MACF,CAAC,CAAC;MAAC,OAAAvB,KAAA;IACL;IAAC4B,YAAA,CAAAlC,oBAAA;MAAAmC,GAAA;MAAArB,KAAA,EAED,SAAAsB,OAAA,EAAS;QACP,oBAAO1C,KAAA,CAAA2C,aAAA,CAACtC,gBAAgB,EAAAuC,QAAA,KAAK,IAAI,CAACjC,KAAK;UAAEO,IAAI,EAAE,IAAI,CAACH;QAAY,GAAG;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 CHANGED
@@ -1,18 +1,13 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
2
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
3
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
11
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
7
  /* eslint-disable import/extensions */
14
8
  import LANGUAGES, { langs as languageLangs } from '@cospired/i18n-iso-languages';
15
9
  import { getPrimaryLanguageSubtag } from './lib';
10
+
16
11
  /*
17
12
  * LANGUAGE LISTS
18
13
  *
@@ -23,18 +18,19 @@ import { getPrimaryLanguageSubtag } from './lib';
23
18
  * for reference. That's because they're not implemented in this library. If you read this and it's
24
19
  * been a while, go check and see if that's changed!
25
20
  */
26
- // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ar.json'));
27
21
 
22
+ // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ar.json'));
28
23
  LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/en.json'));
29
24
  LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/es.json'));
30
- LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/fr.json')); // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/zh.json'));
25
+ LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/fr.json'));
26
+ // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/zh.json'));
31
27
  // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ca.json'));
32
28
  // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/he.json'));
33
29
  // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/id.json'));
34
30
  // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ko.json'));
35
-
36
31
  LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pl.json'));
37
- LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pt.json')); // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ru.json'));
32
+ LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pt.json'));
33
+ // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ru.json'));
38
34
  // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/th.json'));
39
35
  // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/uk.json'));
40
36
 
@@ -43,12 +39,12 @@ LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pt.json'));
43
39
  *
44
40
  * @memberof I18n
45
41
  */
46
-
47
42
  export var getLanguageMessages = function getLanguageMessages(locale) {
48
43
  var primaryLanguageSubtag = getPrimaryLanguageSubtag(locale);
49
44
  var languageCode = languageLangs().includes(primaryLanguageSubtag) ? primaryLanguageSubtag : 'en';
50
45
  return LANGUAGES.getNames(languageCode);
51
46
  };
47
+
52
48
  /**
53
49
  * Provides a list of languages represented as objects of the following shape:
54
50
  *
@@ -62,14 +58,12 @@ export var getLanguageMessages = function getLanguageMessages(locale) {
62
58
  *
63
59
  * @memberof I18n
64
60
  */
65
-
66
61
  export var getLanguageList = function getLanguageList(locale) {
67
62
  var languageMessages = getLanguageMessages(locale);
68
63
  return Object.entries(languageMessages).map(function (_ref) {
69
64
  var _ref2 = _slicedToArray(_ref, 2),
70
- code = _ref2[0],
71
- name = _ref2[1];
72
-
65
+ code = _ref2[0],
66
+ name = _ref2[1];
73
67
  return {
74
68
  code: code,
75
69
  name: name
@@ -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","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,SAAP,IAAoBC,KAAK,IAAIC,aAA7B,QAAkD,8BAAlD;AAEA,SAASC,wBAAT,QAAyC,OAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;AACAH,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,4CAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,4CAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,4CAAD,CAAhC,E,CACA;AACA;AACA;AACA;AACA;;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,4CAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,4CAAD,CAAhC,E,CACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,MAAD,EAAY;EAC7C,IAAMC,qBAAqB,GAAGL,wBAAwB,CAACI,MAAD,CAAtD;EACA,IAAME,YAAY,GAAGP,aAAa,GAAGQ,QAAhB,CAAyBF,qBAAzB,IAAkDA,qBAAlD,GAA0E,IAA/F;EAEA,OAAOR,SAAS,CAACW,QAAV,CAAmBF,YAAnB,CAAP;AACD,CALM;AAOP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMG,eAAe,GAAG,SAAlBA,eAAkB,CAACL,MAAD,EAAY;EACzC,IAAMM,gBAAgB,GAAGP,mBAAmB,CAACC,MAAD,CAA5C;EACA,OAAOO,MAAM,CAACC,OAAP,CAAeF,gBAAf,EAAiCG,GAAjC,CAAqC;IAAA;IAAA,IAAEC,IAAF;IAAA,IAAQC,IAAR;;IAAA,OAAmB;MAAED,IAAI,EAAJA,IAAF;MAAQC,IAAI,EAAJA;IAAR,CAAnB;EAAA,CAArC,CAAP;AACD,CAHM"}
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,EAAE,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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