richie-education 2.25.0-b2.dev101 → 2.25.0-b2.dev103

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.
@@ -42,7 +42,7 @@ export type DevDemoUser = keyof typeof JOANIE_DEV_DEMO_USER_JWT_TOKENS;
42
42
 
43
43
  export const RICHIE_DUMMY_IS_LOGGED_IN = 'RICHIE_DUMMY_IS_LOGGED_IN';
44
44
 
45
- function getUserInfo(username: DevDemoUser): Maybe<User> {
45
+ function getUserInfo(username: DevDemoUser): User {
46
46
  const accessToken = JOANIE_DEV_DEMO_USER_JWT_TOKENS[username];
47
47
  const JWTPayload: JWTPayload = JSON.parse(base64Decode(accessToken.split('.')[1]));
48
48
 
@@ -78,7 +78,7 @@ const API = (APIConf: LMSBackend | AuthenticationBackend): APILms => {
78
78
  if (!localStorage.getItem(RICHIE_DUMMY_IS_LOGGED_IN)) {
79
79
  return null;
80
80
  }
81
- return getUserInfo(CURRENT_JOANIE_DEV_DEMO_USER) || null;
81
+ return CURRENT_JOANIE_DEV_DEMO_USER ? getUserInfo(CURRENT_JOANIE_DEV_DEMO_USER) : null;
82
82
  },
83
83
  login: () => {
84
84
  localStorage.setItem(RICHIE_DUMMY_IS_LOGGED_IN, 'true');
@@ -0,0 +1,38 @@
1
+ import { mergeWith } from 'lodash-es';
2
+ import * as prodSettings from './settings.prod';
3
+ import * as testSettings from './settings.test';
4
+
5
+ let settingsOverride = {};
6
+ if (process.env.NODE_ENV === 'development') {
7
+ try {
8
+ settingsOverride = require('./settings.local.ts');
9
+ } catch {
10
+ // no local settings found, do nothing
11
+ }
12
+ } else if (process.env.NODE_ENV === 'test') {
13
+ settingsOverride = testSettings;
14
+ }
15
+
16
+ try {
17
+ settingsOverride = require('./settings.local.ts');
18
+ } catch {
19
+ // no local settings found, do nothing
20
+ }
21
+
22
+ const settings = mergeWith({}, prodSettings, settingsOverride);
23
+
24
+ export const {
25
+ API_LIST_DEFAULT_PARAMS,
26
+ EDX_CSRF_TOKEN_COOKIE_NAME,
27
+ RICHIE_USER_TOKEN,
28
+ RICHIE_LTI_ANONYMOUS_USER_ID_CACHE_KEY,
29
+ JOANIE_API_VERSION,
30
+ REACT_QUERY_SETTINGS,
31
+ PAYMENT_SETTINGS,
32
+ CONTRACT_SETTINGS,
33
+ CONTRACT_DOWNLOAD_SETTINGS,
34
+ PER_PAGE,
35
+ MOCK_SERVICE_WORKER_ENABLED,
36
+ DEBUG_UNION_RESOURCES_HOOK,
37
+ CURRENT_JOANIE_DEV_DEMO_USER,
38
+ } = settings;
@@ -0,0 +1,25 @@
1
+ // This configuration file can be overridden with settings.dev.ts file.
2
+ // `$ cp settings.local.dist.ts settings.local.ts`, then change what's needed
3
+ // in local environment in settings.local.ts.
4
+ import { DevDemoUser } from 'api/lms/dummy';
5
+
6
+ // disable react query cache
7
+ // export const REACT_QUERY_SETTINGS = {
8
+ // staleTimes: {
9
+ // session: 0,
10
+ // sessionItems: 0,
11
+ // },
12
+ // };
13
+
14
+ /**
15
+ * Available users:
16
+ * * admin
17
+ * * user0
18
+ * * user1
19
+ * * user2
20
+ * * user3
21
+ * * user4
22
+ * * organization_owner
23
+ * * student_user
24
+ */
25
+ export const CURRENT_JOANIE_DEV_DEMO_USER: DevDemoUser = 'admin';
@@ -1,5 +1,3 @@
1
- import * as defaultDevSettings from './settings.dev.dist';
2
-
3
1
  export const API_LIST_DEFAULT_PARAMS = {
4
2
  limit: '21',
5
3
  offset: '0',
@@ -61,15 +59,5 @@ export const PER_PAGE = {
61
59
  useOrdersEnrollments: DEFAULT_PER_PAGE,
62
60
  };
63
61
 
64
- let devSettings;
65
- try {
66
- devSettings = require('settings.dev.ts');
67
- } catch {
68
- devSettings = defaultDevSettings;
69
- }
70
-
71
62
  export const MOCK_SERVICE_WORKER_ENABLED = false;
72
-
73
- export const DEBUG_UNION_RESOURCES_HOOK = process.env.NODE_ENV !== 'production' && false;
74
-
75
- export const { CURRENT_JOANIE_DEV_DEMO_USER } = devSettings;
63
+ export const DEBUG_UNION_RESOURCES_HOOK = false;
@@ -0,0 +1,16 @@
1
+ // This confiuration file is used for testing.
2
+ // Mostly usefull to test our test tools.
3
+ import { DevDemoUser } from 'api/lms/dummy';
4
+
5
+ /**
6
+ * Available users:
7
+ * * admin
8
+ * * user0
9
+ * * user1
10
+ * * user2
11
+ * * user3
12
+ * * user4
13
+ * * organization_owner
14
+ * * student_user
15
+ */
16
+ export const CURRENT_JOANIE_DEV_DEMO_USER: DevDemoUser = 'admin';
@@ -2,6 +2,7 @@ import { CunninghamProvider } from '@openfun/cunningham-react';
2
2
  import { PropsWithChildren } from 'react';
3
3
  import fetchMock from 'fetch-mock';
4
4
  import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider';
5
+ import { DashboardBreadcrumbsProvider } from 'widgets/Dashboard/contexts/DashboardBreadcrumbsContext';
5
6
  import { IntlWrapper } from './IntlWrapper';
6
7
  import { ReactQueryWrapper } from './ReactQueryWrapper';
7
8
  import { RouterWrapper } from './RouterWrapper';
@@ -26,14 +27,18 @@ export const JoanieSessionWrapper = ({ children }: PropsWithChildren) => {
26
27
 
27
28
  export const JoanieAppWrapper = ({
28
29
  children,
29
- options,
30
- }: PropsWithChildren<{ options?: AppWrapperProps }>) => {
30
+ intlOptions,
31
+ queryOptions,
32
+ routerOptions,
33
+ }: PropsWithChildren<AppWrapperProps>) => {
31
34
  return (
32
- <IntlWrapper {...(options?.intlOptions || { locale: 'en' })}>
35
+ <IntlWrapper {...(intlOptions || { locale: 'en' })}>
33
36
  <CunninghamProvider>
34
- <ReactQueryWrapper {...(options?.queryOptions || {})}>
37
+ <ReactQueryWrapper {...(queryOptions || {})}>
35
38
  <JoanieSessionWrapper>
36
- <RouterWrapper {...options?.routerOptions}>{children}</RouterWrapper>
39
+ <DashboardBreadcrumbsProvider>
40
+ <RouterWrapper {...routerOptions}>{children}</RouterWrapper>
41
+ </DashboardBreadcrumbsProvider>
37
42
  </JoanieSessionWrapper>
38
43
  </ReactQueryWrapper>
39
44
  </CunninghamProvider>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "richie-education",
3
- "version": "2.25.0-b2.dev101",
3
+ "version": "2.25.0-b2.dev103",
4
4
  "description": "A CMS to build learning portals for Open Education",
5
5
  "main": "sandbox/manage.py",
6
6
  "scripts": {
@@ -1,3 +0,0 @@
1
- import { DevDemoUser } from 'api/lms/dummy';
2
-
3
- export const CURRENT_JOANIE_DEV_DEMO_USER: DevDemoUser = 'admin';