@edx/frontend-platform 4.6.2 → 4.6.3

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 (229) hide show
  1. package/package.json +1 -1
  2. package/.env.development +0 -30
  3. package/.env.test +0 -30
  4. package/.eslintignore +0 -6
  5. package/.eslintrc.js +0 -28
  6. package/.github/PULL_REQUEST_TEMPLATE.md +0 -13
  7. package/.github/workflows/add-depr-ticket-to-depr-board.yml +0 -19
  8. package/.github/workflows/add-remove-label-on-comment.yml +0 -20
  9. package/.github/workflows/ci.yml +0 -42
  10. package/.github/workflows/commitlint.yml +0 -10
  11. package/.github/workflows/lockfileversion-check.yml +0 -13
  12. package/.github/workflows/manual-publish.yml +0 -43
  13. package/.github/workflows/npm-deprecate.yml +0 -22
  14. package/.github/workflows/release.yml +0 -45
  15. package/.github/workflows/self-assign-issue.yml +0 -12
  16. package/.github/workflows/update-browserslist-db.yml +0 -12
  17. package/.nvmrc +0 -1
  18. package/.releaserc +0 -32
  19. package/catalog-info.yaml +0 -21
  20. package/dist/LICENSE +0 -661
  21. package/dist/README.md +0 -155
  22. package/dist/package.json +0 -86
  23. package/docs/addTagsPlugin.js +0 -10
  24. package/docs/auth-API.md +0 -114
  25. package/docs/decisions/0001-record-architecture-decisions.rst +0 -32
  26. package/docs/decisions/0002-frontend-base-design-goals.rst +0 -222
  27. package/docs/decisions/0003-consolidation-into-frontend-platform.rst +0 -71
  28. package/docs/decisions/0004-axios-caching-implementation.rst +0 -88
  29. package/docs/decisions/0005-token-null-after-successful-refresh.rst +0 -69
  30. package/docs/decisions/0006-middleware-support-for-http-clients.rst +0 -44
  31. package/docs/decisions/0007-javascript-file-configuration.rst +0 -143
  32. package/docs/how_tos/automatic-case-conversion.rst +0 -58
  33. package/docs/how_tos/caching.rst +0 -93
  34. package/docs/how_tos/i18n.rst +0 -305
  35. package/docs/removeExport.js +0 -24
  36. package/docs/template/edx/README.md +0 -12
  37. package/docs/template/edx/publish.js +0 -713
  38. package/docs/template/edx/static/fonts/OpenSans-Bold-webfont.eot +0 -0
  39. package/docs/template/edx/static/fonts/OpenSans-Bold-webfont.svg +0 -1830
  40. package/docs/template/edx/static/fonts/OpenSans-Bold-webfont.woff +0 -0
  41. package/docs/template/edx/static/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  42. package/docs/template/edx/static/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  43. package/docs/template/edx/static/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  44. package/docs/template/edx/static/fonts/OpenSans-Italic-webfont.eot +0 -0
  45. package/docs/template/edx/static/fonts/OpenSans-Italic-webfont.svg +0 -1830
  46. package/docs/template/edx/static/fonts/OpenSans-Italic-webfont.woff +0 -0
  47. package/docs/template/edx/static/fonts/OpenSans-Light-webfont.eot +0 -0
  48. package/docs/template/edx/static/fonts/OpenSans-Light-webfont.svg +0 -1831
  49. package/docs/template/edx/static/fonts/OpenSans-Light-webfont.woff +0 -0
  50. package/docs/template/edx/static/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  51. package/docs/template/edx/static/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  52. package/docs/template/edx/static/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  53. package/docs/template/edx/static/fonts/OpenSans-Regular-webfont.eot +0 -0
  54. package/docs/template/edx/static/fonts/OpenSans-Regular-webfont.svg +0 -1831
  55. package/docs/template/edx/static/fonts/OpenSans-Regular-webfont.woff +0 -0
  56. package/docs/template/edx/static/scripts/linenumber.js +0 -25
  57. package/docs/template/edx/static/scripts/prettify/Apache-License-2.0.txt +0 -202
  58. package/docs/template/edx/static/scripts/prettify/lang-css.js +0 -2
  59. package/docs/template/edx/static/scripts/prettify/prettify.js +0 -28
  60. package/docs/template/edx/static/styles/jsdoc-default.css +0 -356
  61. package/docs/template/edx/static/styles/prettify-jsdoc.css +0 -111
  62. package/docs/template/edx/static/styles/prettify-tomorrow.css +0 -132
  63. package/docs/template/edx/tmpl/augments.tmpl +0 -10
  64. package/docs/template/edx/tmpl/container.tmpl +0 -196
  65. package/docs/template/edx/tmpl/details.tmpl +0 -143
  66. package/docs/template/edx/tmpl/example.tmpl +0 -2
  67. package/docs/template/edx/tmpl/examples.tmpl +0 -13
  68. package/docs/template/edx/tmpl/exceptions.tmpl +0 -32
  69. package/docs/template/edx/tmpl/layout.tmpl +0 -39
  70. package/docs/template/edx/tmpl/mainpage.tmpl +0 -10
  71. package/docs/template/edx/tmpl/members.tmpl +0 -38
  72. package/docs/template/edx/tmpl/method.tmpl +0 -131
  73. package/docs/template/edx/tmpl/modifies.tmpl +0 -14
  74. package/docs/template/edx/tmpl/params.tmpl +0 -131
  75. package/docs/template/edx/tmpl/properties.tmpl +0 -108
  76. package/docs/template/edx/tmpl/returns.tmpl +0 -19
  77. package/docs/template/edx/tmpl/source.tmpl +0 -8
  78. package/docs/template/edx/tmpl/tutorial.tmpl +0 -19
  79. package/docs/template/edx/tmpl/type.tmpl +0 -7
  80. package/env.config.js +0 -8
  81. package/jsdoc.json +0 -36
  82. package/openedx.yaml +0 -12
  83. package/service-interface.png +0 -0
  84. package/src/analytics/MockAnalyticsService.js +0 -71
  85. package/src/analytics/SegmentAnalyticsService.js +0 -243
  86. package/src/analytics/index.js +0 -12
  87. package/src/analytics/interface.js +0 -142
  88. package/src/auth/AxiosCsrfTokenService.js +0 -60
  89. package/src/auth/AxiosJwtAuthService.js +0 -364
  90. package/src/auth/AxiosJwtTokenService.js +0 -134
  91. package/src/auth/LocalForageCache.js +0 -78
  92. package/src/auth/MockAuthService.js +0 -285
  93. package/src/auth/index.js +0 -19
  94. package/src/auth/interceptors/createCsrfTokenProviderInterceptor.js +0 -37
  95. package/src/auth/interceptors/createJwtTokenProviderInterceptor.js +0 -38
  96. package/src/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js +0 -20
  97. package/src/auth/interceptors/createRetryInterceptor.js +0 -72
  98. package/src/auth/interface.js +0 -309
  99. package/src/auth/utils.js +0 -105
  100. package/src/config.js +0 -327
  101. package/src/constants.js +0 -66
  102. package/src/i18n/countries.js +0 -57
  103. package/src/i18n/index.js +0 -123
  104. package/src/i18n/injectIntlWithShim.jsx +0 -45
  105. package/src/i18n/languages.js +0 -60
  106. package/src/i18n/lib.js +0 -282
  107. package/src/i18n/scripts/README.md +0 -29
  108. package/src/i18n/scripts/intl-imports.js +0 -259
  109. package/src/i18n/scripts/transifex-utils.js +0 -75
  110. package/src/index.js +0 -42
  111. package/src/initialize.js +0 -357
  112. package/src/logging/MockLoggingService.js +0 -31
  113. package/src/logging/NewRelicLoggingService.js +0 -181
  114. package/src/logging/index.js +0 -9
  115. package/src/logging/interface.js +0 -110
  116. package/src/pubSub.js +0 -47
  117. package/src/react/AppContext.jsx +0 -24
  118. package/src/react/AppProvider.jsx +0 -93
  119. package/src/react/AuthenticatedPageRoute.jsx +0 -60
  120. package/src/react/ErrorBoundary.jsx +0 -44
  121. package/src/react/ErrorPage.jsx +0 -76
  122. package/src/react/LoginRedirect.jsx +0 -16
  123. package/src/react/OptionalReduxProvider.jsx +0 -28
  124. package/src/react/PageRoute.jsx +0 -31
  125. package/src/react/hooks.js +0 -50
  126. package/src/react/index.js +0 -16
  127. package/src/scripts/GoogleAnalyticsLoader.js +0 -53
  128. package/src/scripts/index.js +0 -2
  129. package/src/testing/index.js +0 -9
  130. package/src/testing/initializeMockApp.js +0 -77
  131. package/src/testing/mockMessages.js +0 -21
  132. package/src/utils.js +0 -167
  133. /package/{dist/analytics → analytics}/MockAnalyticsService.js +0 -0
  134. /package/{dist/analytics → analytics}/MockAnalyticsService.js.map +0 -0
  135. /package/{dist/analytics → analytics}/SegmentAnalyticsService.js +0 -0
  136. /package/{dist/analytics → analytics}/SegmentAnalyticsService.js.map +0 -0
  137. /package/{dist/analytics → analytics}/index.js +0 -0
  138. /package/{dist/analytics → analytics}/index.js.map +0 -0
  139. /package/{dist/analytics → analytics}/interface.js +0 -0
  140. /package/{dist/analytics → analytics}/interface.js.map +0 -0
  141. /package/{dist/auth → auth}/AxiosCsrfTokenService.js +0 -0
  142. /package/{dist/auth → auth}/AxiosCsrfTokenService.js.map +0 -0
  143. /package/{dist/auth → auth}/AxiosJwtAuthService.js +0 -0
  144. /package/{dist/auth → auth}/AxiosJwtAuthService.js.map +0 -0
  145. /package/{dist/auth → auth}/AxiosJwtTokenService.js +0 -0
  146. /package/{dist/auth → auth}/AxiosJwtTokenService.js.map +0 -0
  147. /package/{dist/auth → auth}/LocalForageCache.js +0 -0
  148. /package/{dist/auth → auth}/LocalForageCache.js.map +0 -0
  149. /package/{dist/auth → auth}/MockAuthService.js +0 -0
  150. /package/{dist/auth → auth}/MockAuthService.js.map +0 -0
  151. /package/{dist/auth → auth}/index.js +0 -0
  152. /package/{dist/auth → auth}/index.js.map +0 -0
  153. /package/{dist/auth → auth}/interceptors/createCsrfTokenProviderInterceptor.js +0 -0
  154. /package/{dist/auth → auth}/interceptors/createCsrfTokenProviderInterceptor.js.map +0 -0
  155. /package/{dist/auth → auth}/interceptors/createJwtTokenProviderInterceptor.js +0 -0
  156. /package/{dist/auth → auth}/interceptors/createJwtTokenProviderInterceptor.js.map +0 -0
  157. /package/{dist/auth → auth}/interceptors/createProcessAxiosRequestErrorInterceptor.js +0 -0
  158. /package/{dist/auth → auth}/interceptors/createProcessAxiosRequestErrorInterceptor.js.map +0 -0
  159. /package/{dist/auth → auth}/interceptors/createRetryInterceptor.js +0 -0
  160. /package/{dist/auth → auth}/interceptors/createRetryInterceptor.js.map +0 -0
  161. /package/{dist/auth → auth}/interface.js +0 -0
  162. /package/{dist/auth → auth}/interface.js.map +0 -0
  163. /package/{dist/auth → auth}/utils.js +0 -0
  164. /package/{dist/auth → auth}/utils.js.map +0 -0
  165. /package/{dist/config.js → config.js} +0 -0
  166. /package/{dist/config.js.map → config.js.map} +0 -0
  167. /package/{dist/constants.js → constants.js} +0 -0
  168. /package/{dist/constants.js.map → constants.js.map} +0 -0
  169. /package/{dist/i18n → i18n}/countries.js +0 -0
  170. /package/{dist/i18n → i18n}/countries.js.map +0 -0
  171. /package/{dist/i18n → i18n}/index.js +0 -0
  172. /package/{dist/i18n → i18n}/index.js.map +0 -0
  173. /package/{dist/i18n → i18n}/injectIntlWithShim.js +0 -0
  174. /package/{dist/i18n → i18n}/injectIntlWithShim.js.map +0 -0
  175. /package/{dist/i18n → i18n}/languages.js +0 -0
  176. /package/{dist/i18n → i18n}/languages.js.map +0 -0
  177. /package/{dist/i18n → i18n}/lib.js +0 -0
  178. /package/{dist/i18n → i18n}/lib.js.map +0 -0
  179. /package/{dist/i18n → i18n}/scripts/README.md +0 -0
  180. /package/{dist/i18n → i18n}/scripts/intl-imports.js +0 -0
  181. /package/{dist/i18n → i18n}/scripts/intl-imports.js.map +0 -0
  182. /package/{dist/i18n → i18n}/scripts/transifex-utils.js +0 -0
  183. /package/{dist/i18n → i18n}/scripts/transifex-utils.js.map +0 -0
  184. /package/{dist/index.js → index.js} +0 -0
  185. /package/{dist/index.js.map → index.js.map} +0 -0
  186. /package/{dist/initialize.js → initialize.js} +0 -0
  187. /package/{dist/initialize.js.map → initialize.js.map} +0 -0
  188. /package/{dist/logging → logging}/MockLoggingService.js +0 -0
  189. /package/{dist/logging → logging}/MockLoggingService.js.map +0 -0
  190. /package/{dist/logging → logging}/NewRelicLoggingService.js +0 -0
  191. /package/{dist/logging → logging}/NewRelicLoggingService.js.map +0 -0
  192. /package/{dist/logging → logging}/index.js +0 -0
  193. /package/{dist/logging → logging}/index.js.map +0 -0
  194. /package/{dist/logging → logging}/interface.js +0 -0
  195. /package/{dist/logging → logging}/interface.js.map +0 -0
  196. /package/{dist/pubSub.js → pubSub.js} +0 -0
  197. /package/{dist/pubSub.js.map → pubSub.js.map} +0 -0
  198. /package/{dist/react → react}/AppContext.js +0 -0
  199. /package/{dist/react → react}/AppContext.js.map +0 -0
  200. /package/{dist/react → react}/AppProvider.js +0 -0
  201. /package/{dist/react → react}/AppProvider.js.map +0 -0
  202. /package/{dist/react → react}/AuthenticatedPageRoute.js +0 -0
  203. /package/{dist/react → react}/AuthenticatedPageRoute.js.map +0 -0
  204. /package/{dist/react → react}/ErrorBoundary.js +0 -0
  205. /package/{dist/react → react}/ErrorBoundary.js.map +0 -0
  206. /package/{dist/react → react}/ErrorPage.js +0 -0
  207. /package/{dist/react → react}/ErrorPage.js.map +0 -0
  208. /package/{dist/react → react}/LoginRedirect.js +0 -0
  209. /package/{dist/react → react}/LoginRedirect.js.map +0 -0
  210. /package/{dist/react → react}/OptionalReduxProvider.js +0 -0
  211. /package/{dist/react → react}/OptionalReduxProvider.js.map +0 -0
  212. /package/{dist/react → react}/PageRoute.js +0 -0
  213. /package/{dist/react → react}/PageRoute.js.map +0 -0
  214. /package/{dist/react → react}/hooks.js +0 -0
  215. /package/{dist/react → react}/hooks.js.map +0 -0
  216. /package/{dist/react → react}/index.js +0 -0
  217. /package/{dist/react → react}/index.js.map +0 -0
  218. /package/{dist/scripts → scripts}/GoogleAnalyticsLoader.js +0 -0
  219. /package/{dist/scripts → scripts}/GoogleAnalyticsLoader.js.map +0 -0
  220. /package/{dist/scripts → scripts}/index.js +0 -0
  221. /package/{dist/scripts → scripts}/index.js.map +0 -0
  222. /package/{dist/testing → testing}/index.js +0 -0
  223. /package/{dist/testing → testing}/index.js.map +0 -0
  224. /package/{dist/testing → testing}/initializeMockApp.js +0 -0
  225. /package/{dist/testing → testing}/initializeMockApp.js.map +0 -0
  226. /package/{dist/testing → testing}/mockMessages.js +0 -0
  227. /package/{dist/testing → testing}/mockMessages.js.map +0 -0
  228. /package/{dist/utils.js → utils.js} +0 -0
  229. /package/{dist/utils.js.map → utils.js.map} +0 -0
package/src/utils.js DELETED
@@ -1,167 +0,0 @@
1
- /**
2
- * #### Import members from **@edx/frontend-platform**
3
- *
4
- * @module Utilities
5
- */
6
- import camelCase from 'lodash.camelcase';
7
- import snakeCase from 'lodash.snakecase';
8
-
9
- /**
10
- * This is the underlying function used by camelCaseObject, snakeCaseObject, and convertKeyNames
11
- * above.
12
- *
13
- * Given an object (or array) and a modification function, will perform the function on each key it
14
- * encounters on the object and its tree of children.
15
- *
16
- * The modification function must take a string as an argument and returns a string.
17
- *
18
- * Example:
19
- *
20
- * ```
21
- * (key) => {
22
- * if (key === 'edX') {
23
- * return 'Open edX';
24
- * }
25
- * return key;
26
- * }
27
- * ```
28
- *
29
- * This function will turn any key that matches 'edX' into 'Open edX'. All other keys will be
30
- * passed through unmodified.
31
- *
32
- * Can accept arrays as well as objects, and will perform its conversion on any objects it finds in
33
- * the array.
34
- *
35
- * @param {Object} object
36
- * @param {function} modify
37
- * @returns {Object}
38
- */
39
- export function modifyObjectKeys(object, modify) {
40
- // If the passed in object is not an Object, return it.
41
- if (
42
- object === undefined
43
- || object === null
44
- || (typeof object !== 'object' && !Array.isArray(object))
45
- ) {
46
- return object;
47
- }
48
-
49
- if (Array.isArray(object)) {
50
- return object.map(value => modifyObjectKeys(value, modify));
51
- }
52
-
53
- // Otherwise, process all its keys.
54
- const result = {};
55
- Object.entries(object).forEach(([key, value]) => {
56
- result[modify(key)] = modifyObjectKeys(value, modify);
57
- });
58
- return result;
59
- }
60
-
61
- /**
62
- * Performs a deep conversion to camelCase on all keys in the provided object and its tree of
63
- * children. Uses [lodash.camelcase](https://lodash.com/docs/4.17.15#camelCase) on each key. This
64
- * is commonly used to convert snake_case keys in models from a backend server into camelCase keys
65
- * for use in the JavaScript client.
66
- *
67
- * Can accept arrays as well as objects, and will perform its conversion on any objects it finds in
68
- * the array.
69
- *
70
- * @param {Array|Object} object
71
- * @returns {Array|Object}
72
- */
73
- export function camelCaseObject(object) {
74
- return modifyObjectKeys(object, camelCase);
75
- }
76
-
77
- /**
78
- * Performs a deep conversion to snake_case on all keys in the provided object and its tree of
79
- * children. Uses [lodash.snakecase](https://lodash.com/docs/4.17.15#snakeCase) on each key. This
80
- * is commonly used to convert camelCase keys from the JavaScript app into snake_case keys expected
81
- * by backend servers.
82
- *
83
- * Can accept arrays as well as objects, and will perform its conversion on any objects it finds in
84
- * the array.
85
- *
86
- * @param {Array|Object} object
87
- * @returns {Array|Object}
88
- */
89
- export function snakeCaseObject(object) {
90
- return modifyObjectKeys(object, snakeCase);
91
- }
92
-
93
- /**
94
- * Given a map of key-value pairs, performs a deep conversion key names in the specified object
95
- * _from_ the key _to_ the value. This is useful for updating names in an API request to the names
96
- * used throughout a client application if they happen to differ. It can also be used in the
97
- * reverse - formatting names from the client application to names expected by an API.
98
- *
99
- * ```
100
- * import { convertKeyNames } from '@edx/frontend-base';
101
- *
102
- * // This object can be of any shape or depth with subobjects/arrays.
103
- * const myObject = {
104
- * myKey: 'my value',
105
- * }
106
- *
107
- * const result = convertKeyNames(myObject, { myKey: 'their_key' });
108
- *
109
- * console.log(result) // { their_key: 'my value' }
110
- * ```
111
- *
112
- * Can accept arrays as well as objects, and will perform its conversion on any objects it finds in
113
- * the array.
114
- *
115
- * @param {Array|Object} object
116
- * @param {Object} nameMap
117
- * @returns {Array|Object}
118
- */
119
- export function convertKeyNames(object, nameMap) {
120
- const transformer = key => (nameMap[key] === undefined ? key : nameMap[key]);
121
-
122
- return modifyObjectKeys(object, transformer);
123
- }
124
-
125
- /**
126
- * *Deprecated*: A method which converts the supplied query string into an object of
127
- * key-value pairs and returns it. Defaults to the current query string - should perform like
128
- * [window.searchParams](https://developer.mozilla.org/en-US/docs/Web/API/URL/searchParams)
129
- *
130
- * @deprecated
131
- * @param {string} [search=global.location.search]
132
- * @returns {Object}
133
- */
134
- export function getQueryParameters(search = global.location.search) {
135
- const keyValueFragments = search
136
- .slice(search.indexOf('?') + 1)
137
- .split('&')
138
- .filter(hash => hash !== '');
139
-
140
- return keyValueFragments.reduce((params, keyValueFragment) => {
141
- const split = keyValueFragment.indexOf('=');
142
- const key = keyValueFragment.slice(0, split);
143
- const value = keyValueFragment.slice(split + 1);
144
- return Object.assign(params, { [key]: decodeURIComponent(value) });
145
- }, {});
146
- }
147
-
148
- /**
149
- * This function helps catch a certain class of misconfiguration in which configuration variables
150
- * are not properly defined and/or supplied to a consumer that requires them. Any key that exists
151
- * is still set to "undefined" indicates a misconfiguration further up in the application, and
152
- * should be flagged as an error, and is logged to 'warn'.
153
- *
154
- * Keys that are intended to be falsy should be defined using null, 0, false, etc.
155
- *
156
- * @param {Object} object
157
- * @param {string} requester A human-readable identifier for the code which called this function.
158
- * Used when throwing errors to aid in debugging.
159
- */
160
- export function ensureDefinedConfig(object, requester) {
161
- Object.keys(object).forEach((key) => {
162
- if (object[key] === undefined) {
163
- // eslint-disable-next-line no-console
164
- console.warn(`Module configuration error: ${key} is required by ${requester}.`);
165
- }
166
- });
167
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes