Skip to content

Commit 19a6dbe

Browse files
authored
Merge pull request #39 from arbrandes/fixup
Adds a couple of fixes on top of the latest development branch.
2 parents 97b2b0f + a09c97b commit 19a6dbe

File tree

329 files changed

+10025
-9734
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

329 files changed

+10025
-9734
lines changed

.eslintignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.vscode
55
coverage
66
dist
7-
config
7+
/config
88
scss
99
node_modules
1010
npm-debug.log

.npmignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
__mocks__
2-
.eslintignore
3-
./.eslintrc.js
2+
./eslint.config.js
43
.github
54
.gitignore
65
*.test.js

README.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,39 @@ Then move the files out of the way (move src to some other sub-dir, mostly) to m
132132

133133
- Cease using `AUTHN_MINIMAL_HEADER`, replace it with an actual minimal header.
134134
- No more using `process.env` in runtime code.
135-
- `SUPPORT_URL` is now optional and the support link in the header is hidden if it's not present.
136135
- Removed dotenv. Use site.config.tsx.
137136
- Removed Purge CSS. We do not believe that Purge CSS works properly with Paragon in general, and it is also fundamentally incompatible with module federation as an architecture.
138137
- Removed `ensureConfig` function. This sort of type safety should happen with TypeScript types in the site config file.
139138
- Removed `ensureDefinedConfig` function. Similar to ensureConfig, this sort of type safety should be handled by TypeScript.
140139
- A number of site config variables now have sensible defaults:
141-
- ACCESS_TOKEN_COOKIE_NAME: 'edx-jwt-cookie-header-payload',
142-
- CSRF_TOKEN_API_PATH: '/csrf/api/v1/token',
143-
- LANGUAGE_PREFERENCE_COOKIE_NAME: 'openedx-language-preference',
144-
- USER_INFO_COOKIE_NAME: 'edx-user-info',
145-
- PUBLIC_PATH: '/',
146-
- ENVIRONMENT: 'production',
140+
- accessTokenCookieName: 'edx-jwt-cookie-header-payload',
141+
- csrfTokenApiPath: '/csrf/api/v1/token',
142+
- languagePreferenceCookieName: 'openedx-language-preference',
143+
- userInfoCookieName: 'edx-user-info',
144+
- publicPath: '/',
145+
- environment: 'production',
147146
- the `basename` and `history` exports have been replaced by function getters: `getBasename` and `getHistory`. This is because it may not be possible to determine the values of the original constants at code initialization time, since our config may arrive asynchronously. This ensures that anyone trying to get these values gets a current value.
148147
- When using MockAuthService, set the authenticated user by calling setAuthenticatedUser after instantiating the service. It's not okay for us to add arbitrary config values to the site config.
149-
- `REFRESH_ACCESS_TOKEN_ENDPOINT` has been replaced with `REFRESH_ACCESS_TOKEN_API_PATH`. It is now a path that defaults to '/login_refresh'. The Auth service assumes it is an endpoint on the LMS, and joins the path with `LMS_BASE_URL`. This change creates more parity with other paths such as `CSRF_TOKEN_API_PATH`.
150-
- `ENABLE_ACCESSIBILITY_PAGE` has been renamed `ACCESSIBILITY_URL` and is now the URL to an accessibility page.
148+
- `REFRESH_ACCESS_TOKEN_ENDPOINT` has been replaced with `refreshAccessTokenApiPath`. It is now a path that defaults to '/login_refresh'. The Auth service assumes it is an endpoint on the LMS, and joins the path with `lmsBaseUrl`. This change creates more parity with other paths such as `csrfTokenApiPath`.
149+
150+
The following config variables have been removed, in favor of defining roles for specific modules, `externalRoutes`, or app-specific custom config as necessary:
151+
152+
- ACCOUNT_PROFILE_URL
153+
- ACCOUNT_SETTINGS_URL
154+
- LEARNING_BASE_URL
155+
- ORDER_HISTORY_URL
156+
- MARKETING_SITE_BASE_URL
157+
- LEARNER_DASHBOARD_URL
158+
- STUDIO_BASE_URL
159+
- ACCESSIBILITY_URL
160+
- PRIVACY_POLICY_URL
161+
- TERMS_OF_SERVICE_URL
162+
- SUPPORT_URL
163+
- SUPPORT_EMAIL
164+
- ECOMMERCE_BASE_URL
165+
- DISCOVERY_API_BASE_URL
166+
- CREDENTIALS_BASE_URL
167+
- PUBLISHER_BASE_URL
151168

152169
# Working with Tutor
153170

docs/decisions/0006-middleware-support-for-http-clients.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ Consumers will install the middleware they want to use and provide it to ``initi
3131
authMiddleware: [axiosCaseConverter, (client) => axiosRetry(client, { retries: 3 })],
3232
});
3333

34-
If a consumer chooses not to use ``initialize`` and instead the ``configure`` function, the middleware can be passed in the options param::
34+
If a consumer chooses not to use ``initialize`` and instead the ``configureAuth`` function, the middleware can be passed in the options param::
3535

36-
configure({
36+
configureAuth({
3737
loggingService: getLoggingService(),
3838
config: getConfig(),
3939
options: {

docs/decisions/0007-javascript-file-configuration.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ The implementation of this uses templatization and string interpolation to
1717
replace any instance of ``process.env.XXXX`` with the value of the environment
1818
variable named ``XXXX``. As an example, in our source code we may write::
1919

20-
const LMS_BASE_URL = process.env.LMS_BASE_URL;
20+
const lmsBaseUrl = process.env.lmsBaseUrl;
2121

2222
After the build process runs, the compiled source code will instead read::
2323

24-
const LMS_BASE_URL = 'http://localhost:18000';
24+
const lmsBaseUrl = 'http://localhost:18000';
2525

2626
Put another way, `process.env` is not actually an object available at runtime,
2727
it's a templatization token that helps the build replace it with a string
@@ -76,7 +76,7 @@ This method makes use of an ``site.config.tsx`` file to supply configuration
7676
variables to an application::
7777

7878
const config = {
79-
LMS_BASE_URL: 'http://localhost:18000',
79+
lmsBaseUrl: 'http://localhost:18000',
8080
BOOLEAN_VAR: false,
8181
NULL_VAR: null,
8282
NUMBER_VAR: 123

docs/decisions/0008-stylesheet-import-in-site-config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ As a best practice, a project should have a top-level SCSS file as a peer to the
2121
The `project.scss` file should import the stylesheet from the shell:
2222

2323
```diff
24-
+ @import '@openedx/frontend-base/shell/index.scss';
24+
+ @import '@openedx/frontend-base/shell/app.scss';
2525

2626
// other styles
2727
```

docs/how_tos/automatic-case-conversion.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ How to: Convert SnakeCase to CamelCase automatically for API Requests
55
Introduction
66
************
77

8-
When using the HTTP client from ``@edx/frontend-platform``, you are making an API request to an
8+
When using the HTTP client from ``@openedx/frontend-base``, you are making an API request to an
99
Open edX service which requires you to handle snake-cased <-> camelCase conversions manually. The manual conversion quickly gets
1010
tedious, and is error prone if you forget to do it.
1111

@@ -26,11 +26,11 @@ as a middleware when calling ``initialize`` in the consumer::
2626
authMiddleware: [axiosCaseConverter],
2727
});
2828

29-
Or, if you choose to use ``configure`` instead::
29+
Or, if you choose to use ``configureAuth`` instead::
3030

3131
import axiosCaseConverter from 'axios-case-converter';
3232

33-
configure({
33+
configureAuth({
3434
loggingService: getLoggingService(),
3535
config: getConfig(),
3636
options: {

docs/how_tos/i18n.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,24 +96,24 @@ Load up your translation files
9696

9797
#. In ``App.jsx``, make the following changes::
9898

99-
import { IntlProvider, getMessages, configure } from '@edx/frontend-platform/i18n';
99+
import { IntlProvider, getMessages, configureI18n } from '@edx/frontend-base';
100100
import messages from './i18n/index'; // A map of all messages by locale
101101

102-
configure({
102+
configureI18n({
103103
messages,
104-
config: getConfig(), // ENVIRONMENT and LANGUAGE_PREFERENCE_COOKIE_NAME are required
104+
config: getConfig(), // environment and languagePreferenceCookieName are required
105105
loggingService: getLoggingService(), // An object with logError and logInfo methods
106106
});
107107

108108
// ...inside ReactDOM.render...
109109
<IntlProvider locale={this.props.locale} messages={}>
110110

111-
#. As of this writing, ``frontend-platform/i18n`` reads the locale from the user language preference cookie, or, if none is found, from the browser's language setting. You can verify everything is working by changing your language preference in your account settings. If you are not logged in, you can change your browser language to one of the languages you have translations for.
111+
#. As of this writing, ``frontend-base`` reads the locale from the user language preference cookie, or, if none is found, from the browser's language setting. You can verify everything is working by changing your language preference in your account settings. If you are not logged in, you can change your browser language to one of the languages you have translations for.
112112

113113

114-
********************
114+
*************************
115115
Migrating to react-intl@5
116-
********************
116+
*************************
117117

118118
Initially ``frontend-platform`` used ``react-intl@2`` but as a part of its ``2.0.0`` release the version has been upgraded to ``react-intl@5``. If your application
119119
used ``frontend-platform`` < ``2.0.0`` and you decided to upgrade, here's a list of breaking changes that you will need to consider during the upgrade:

0 commit comments

Comments
 (0)