@openedx/frontend-base 1.0.0-alpha.44 → 1.0.0-alpha.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime/config/index.js +1 -0
- package/dist/runtime/config/index.js.map +1 -1
- package/dist/shell/header/Header.js +1 -1
- package/dist/shell/header/Header.js.map +1 -1
- package/dist/shell/header/app.js +13 -3
- package/dist/shell/header/app.js.map +1 -1
- package/dist/shell/header/constants.d.ts +2 -1
- package/dist/shell/header/constants.js +2 -1
- package/dist/shell/header/constants.js.map +1 -1
- package/dist/shell/header/{course-navigation-bar → course-bar}/data/service.d.ts +2 -0
- package/dist/shell/header/{course-navigation-bar → course-bar}/data/service.js +22 -0
- package/dist/shell/header/course-bar/data/service.js.map +1 -0
- package/dist/shell/header/course-bar/masquerade/MasqueradeBar.d.ts +1 -0
- package/dist/shell/header/course-bar/masquerade/MasqueradeBar.js +23 -0
- package/dist/shell/header/course-bar/masquerade/MasqueradeBar.js.map +1 -0
- package/dist/shell/header/course-bar/masquerade/MasqueradeContext.d.ts +3 -0
- package/dist/shell/header/course-bar/masquerade/MasqueradeContext.js +10 -0
- package/dist/shell/header/course-bar/masquerade/MasqueradeContext.js.map +1 -0
- package/dist/shell/header/course-bar/masquerade/StudioLink.d.ts +6 -0
- package/dist/shell/header/course-bar/masquerade/StudioLink.js +27 -0
- package/dist/shell/header/course-bar/masquerade/StudioLink.js.map +1 -0
- package/dist/shell/header/course-bar/masquerade/data/api.d.ts +29 -0
- package/dist/shell/header/course-bar/masquerade/data/api.js +25 -0
- package/dist/shell/header/course-bar/masquerade/data/api.js.map +1 -0
- package/dist/shell/header/course-bar/masquerade/hooks.d.ts +21 -0
- package/dist/shell/header/course-bar/masquerade/hooks.js +212 -0
- package/dist/shell/header/course-bar/masquerade/hooks.js.map +1 -0
- package/dist/shell/header/course-bar/masquerade/index.d.ts +1 -0
- package/dist/shell/header/course-bar/masquerade/index.js +2 -0
- package/dist/shell/header/course-bar/masquerade/index.js.map +1 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/MasqueradeUserNameInput.d.ts +7 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/MasqueradeUserNameInput.js +18 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/MasqueradeUserNameInput.js.map +1 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/MasqueradeWidget.d.ts +1 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/MasqueradeWidget.js +16 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/MasqueradeWidget.js.map +1 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/MasqueradeWidgetOption.d.ts +6 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/MasqueradeWidgetOption.js +18 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/MasqueradeWidgetOption.js.map +1 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/index.d.ts +2 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/index.js +3 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/index.js.map +1 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/messages.d.ts +28 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/messages.js +30 -0
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/messages.js.map +1 -0
- package/dist/shell/header/course-bar/masquerade/messages.d.ts +33 -0
- package/dist/shell/header/course-bar/masquerade/messages.js +35 -0
- package/dist/shell/header/course-bar/masquerade/messages.js.map +1 -0
- package/dist/shell/header/{course-navigation-bar → course-bar/navigation}/CourseTabsNavigation.js +6 -29
- package/dist/shell/header/course-bar/navigation/CourseTabsNavigation.js.map +1 -0
- package/dist/shell/header/{course-navigation-bar → course-bar/navigation}/messages.js +1 -1
- package/dist/shell/header/course-bar/navigation/messages.js.map +1 -0
- package/dist/shell/header/course-bar/utils.d.ts +3 -0
- package/dist/shell/header/course-bar/utils.js +54 -0
- package/dist/shell/header/course-bar/utils.js.map +1 -0
- package/dist/shell/header/index.d.ts +1 -1
- package/dist/shell/header/index.js +1 -1
- package/dist/shell/header/index.js.map +1 -1
- package/dist/shell/index.d.ts +2 -2
- package/dist/shell/index.js +2 -2
- package/dist/shell/index.js.map +1 -1
- package/dist/shell/site.config.dev.js +1 -0
- package/dist/shell/site.config.dev.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/shell/header/course-navigation-bar/CourseTabsNavigation.js.map +0 -1
- package/dist/shell/header/course-navigation-bar/data/service.js.map +0 -1
- package/dist/shell/header/course-navigation-bar/messages.js.map +0 -1
- package/dist/shell/header/course-navigation-bar/utils.d.ts +0 -2
- package/dist/shell/header/course-navigation-bar/utils.js +0 -27
- package/dist/shell/header/course-navigation-bar/utils.js.map +0 -1
- /package/dist/shell/header/{course-navigation-bar → course-bar/navigation}/CourseTabsNavigation.d.ts +0 -0
- /package/dist/shell/header/{course-navigation-bar → course-bar/navigation}/course-tabs-navigation.scss +0 -0
- /package/dist/shell/header/{course-navigation-bar → course-bar/navigation}/messages.d.ts +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { matchPath } from 'react-router-dom';
|
|
2
|
+
import { getActiveRoles, getProvidesAsStrings, getUrlByRouteRole } from '../../../runtime';
|
|
3
|
+
import { providesCourseBarMasqueradeRolesId, providesCourseBarRolesId } from '../constants';
|
|
4
|
+
/*
|
|
5
|
+
* Collects route role strings from all apps that opted into the course bar.
|
|
6
|
+
* Each app declares its roles as a string array:
|
|
7
|
+
*
|
|
8
|
+
* provides: {
|
|
9
|
+
* [providesCourseBarRolesId]: ['org.openedx.frontend.role.learning'],
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
function getCourseBarRoles() {
|
|
13
|
+
return getProvidesAsStrings(providesCourseBarRolesId);
|
|
14
|
+
}
|
|
15
|
+
/*
|
|
16
|
+
* Course-bar roles that additionally enable the masquerade widget. Apps opt
|
|
17
|
+
* in to the masquerade slot per-role on top of their course-bar declaration:
|
|
18
|
+
*
|
|
19
|
+
* provides: {
|
|
20
|
+
* [providesCourseBarRolesId]: ['org.openedx.frontend.role.learning'],
|
|
21
|
+
* [providesCourseBarMasqueradeRolesId]: ['org.openedx.frontend.role.learning'],
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* A role only present in the masquerade list (without a matching course-bar
|
|
25
|
+
* declaration) is ignored — masquerade is a refinement of the course bar,
|
|
26
|
+
* not an independent feature.
|
|
27
|
+
*/
|
|
28
|
+
function getCourseBarMasqueradeRoles() {
|
|
29
|
+
const courseBarRoles = new Set(getCourseBarRoles());
|
|
30
|
+
return getProvidesAsStrings(providesCourseBarMasqueradeRolesId)
|
|
31
|
+
.filter(role => courseBarRoles.has(role));
|
|
32
|
+
}
|
|
33
|
+
export function isCourseBarRoute() {
|
|
34
|
+
const activeRoles = getActiveRoles();
|
|
35
|
+
return getCourseBarRoles().some(role => activeRoles.includes(role));
|
|
36
|
+
}
|
|
37
|
+
export function isCourseBarMasqueradeRoute() {
|
|
38
|
+
const activeRoles = getActiveRoles();
|
|
39
|
+
return getCourseBarMasqueradeRoles().some(role => activeRoles.includes(role));
|
|
40
|
+
}
|
|
41
|
+
/*
|
|
42
|
+
* Whether `pathname` is served by an in-app route (a registered route role
|
|
43
|
+
* with a relative URL). Drives the choice between react-router navigation
|
|
44
|
+
* and a hard `window.location.assign` when the course bar redirects.
|
|
45
|
+
*/
|
|
46
|
+
export function isClientRoute(pathname) {
|
|
47
|
+
return getCourseBarRoles().some(role => {
|
|
48
|
+
const routePath = getUrlByRouteRole(role);
|
|
49
|
+
return routePath !== null
|
|
50
|
+
&& routePath.startsWith('/')
|
|
51
|
+
&& matchPath({ path: routePath, end: false }, pathname) !== null;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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C,UAAU,CAAC,GAAG,CAAC;eACzB,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,KAAK,IAAI,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { matchPath } from 'react-router-dom';\nimport { getActiveRoles, getProvidesAsStrings, getUrlByRouteRole } from '../../../runtime';\nimport { providesCourseBarMasqueradeRolesId, providesCourseBarRolesId } from '../constants';\n\n/*\n * Collects route role strings from all apps that opted into the course bar.\n * Each app declares its roles as a string array:\n *\n * provides: {\n * [providesCourseBarRolesId]: ['org.openedx.frontend.role.learning'],\n * }\n */\nfunction getCourseBarRoles(): string[] {\n return getProvidesAsStrings(providesCourseBarRolesId);\n}\n\n/*\n * Course-bar roles that additionally enable the masquerade widget. Apps opt\n * in to the masquerade slot per-role on top of their course-bar declaration:\n *\n * provides: {\n * [providesCourseBarRolesId]: ['org.openedx.frontend.role.learning'],\n * [providesCourseBarMasqueradeRolesId]: ['org.openedx.frontend.role.learning'],\n * }\n *\n * A role only present in the masquerade list (without a matching course-bar\n * declaration) is ignored — masquerade is a refinement of the course bar,\n * not an independent feature.\n */\nfunction getCourseBarMasqueradeRoles(): string[] {\n const courseBarRoles = new Set(getCourseBarRoles());\n return getProvidesAsStrings(providesCourseBarMasqueradeRolesId)\n .filter(role => courseBarRoles.has(role));\n}\n\nexport function isCourseBarRoute(): boolean {\n const activeRoles = getActiveRoles();\n return getCourseBarRoles().some(role => activeRoles.includes(role));\n}\n\nexport function isCourseBarMasqueradeRoute(): boolean {\n const activeRoles = getActiveRoles();\n return getCourseBarMasqueradeRoles().some(role => activeRoles.includes(role));\n}\n\n/*\n * Whether `pathname` is served by an in-app route (a registered route role\n * with a relative URL). Drives the choice between react-router navigation\n * and a hard `window.location.assign` when the course bar redirects.\n */\nexport function isClientRoute(pathname: string): boolean {\n return getCourseBarRoles().some(role => {\n const routePath = getUrlByRouteRole(role);\n return routePath !== null\n && routePath.startsWith('/')\n && matchPath({ path: routePath, end: false }, pathname) !== null;\n });\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as headerApp } from './app';
|
|
2
|
-
export {
|
|
2
|
+
export { providesCourseBarRolesId, providesCourseBarMasqueradeRolesId } from './constants';
|
|
3
3
|
export { default as Header } from './Header';
|
|
4
4
|
export { default as HelpButton } from './HelpButton';
|
|
5
5
|
export { helpButtonSlotOperation, helpWidgetId } from './helpButtonSlotOperation';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as headerApp } from './app';
|
|
2
|
-
export {
|
|
2
|
+
export { providesCourseBarRolesId, providesCourseBarMasqueradeRolesId } from './constants';
|
|
3
3
|
export { default as Header } from './Header';
|
|
4
4
|
export { default as HelpButton } from './HelpButton';
|
|
5
5
|
export { helpButtonSlotOperation, helpWidgetId } from './helpButtonSlotOperation';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../shell/header/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../shell/header/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,kCAAkC,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC","sourcesContent":["export { default as headerApp } from './app';\nexport { providesCourseBarRolesId, providesCourseBarMasqueradeRolesId } from './constants';\nexport { default as Header } from './Header';\nexport { default as HelpButton } from './HelpButton';\nexport { helpButtonSlotOperation, helpWidgetId } from './helpButtonSlotOperation';\n"]}
|
package/dist/shell/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { default as DefaultLayout } from './DefaultLayout';
|
|
2
2
|
export { default as DefaultMain } from './DefaultMain';
|
|
3
|
-
export { default as shellApp } from './app';
|
|
4
3
|
export { Footer, footerApp } from './footer';
|
|
5
|
-
export {
|
|
4
|
+
export { Header, HelpButton, headerApp, helpButtonSlotOperation, helpWidgetId, providesCourseBarRolesId, providesCourseBarMasqueradeRolesId, } from './header';
|
|
6
5
|
export { homeRole, providesChromelessRolesId } from './constants';
|
|
7
6
|
export { default as LinkMenuItem } from './menus/LinkMenuItem';
|
|
8
7
|
export { default as NavDropdownMenuSlot } from './menus/NavDropdownMenuSlot';
|
|
8
|
+
export { default as shellApp } from './app';
|
package/dist/shell/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { default as DefaultLayout } from './DefaultLayout';
|
|
2
2
|
export { default as DefaultMain } from './DefaultMain';
|
|
3
|
-
export { default as shellApp } from './app';
|
|
4
3
|
export { Footer, footerApp } from './footer';
|
|
5
|
-
export {
|
|
4
|
+
export { Header, HelpButton, headerApp, helpButtonSlotOperation, helpWidgetId, providesCourseBarRolesId, providesCourseBarMasqueradeRolesId, } from './header';
|
|
6
5
|
export { homeRole, providesChromelessRolesId } from './constants';
|
|
7
6
|
export { default as LinkMenuItem } from './menus/LinkMenuItem';
|
|
8
7
|
export { default as NavDropdownMenuSlot } from './menus/NavDropdownMenuSlot';
|
|
8
|
+
export { default as shellApp } from './app';
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/shell/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../shell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../shell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,YAAY,EACZ,wBAAwB,EACxB,kCAAkC,GACnC,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,OAAO,CAAC","sourcesContent":["export { default as DefaultLayout } from './DefaultLayout';\nexport { default as DefaultMain } from './DefaultMain';\nexport { Footer, footerApp } from './footer';\nexport {\n Header,\n HelpButton,\n headerApp,\n helpButtonSlotOperation,\n helpWidgetId,\n providesCourseBarRolesId,\n providesCourseBarMasqueradeRolesId,\n} from './header';\nexport { homeRole, providesChromelessRolesId } from './constants';\nexport { default as LinkMenuItem } from './menus/LinkMenuItem';\nexport { default as NavDropdownMenuSlot } from './menus/NavDropdownMenuSlot';\nexport { default as shellApp } from './app';\n"]}
|
|
@@ -37,6 +37,7 @@ const siteConfig = {
|
|
|
37
37
|
logoutUrl: 'http://local.openedx.io:8000/logout',
|
|
38
38
|
// API URLs
|
|
39
39
|
lmsBaseUrl: 'http://local.openedx.io:8000',
|
|
40
|
+
cmsBaseUrl: 'http://studio.local.openedx.io:8001',
|
|
40
41
|
runtimeConfigJsonUrl: '/api/frontend_site_config/v1/',
|
|
41
42
|
};
|
|
42
43
|
export default siteConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.config.dev.js","sourceRoot":"","sources":["../../shell/site.config.dev.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAc,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC;AAEnD,OAAO,SAAS,CAAC;AAEjB,MAAM,UAAU,GAAe;IAC7B,IAAI,EAAE;QACJ,QAAQ;QACR,SAAS;QACT,SAAS;QACT,UAAU;QACV,UAAU;QACV,YAAY;QACZ,YAAY;QACZ,eAAe;KAChB;IAED,cAAc,EAAE;QACd;YACE,IAAI,EAAE,mCAAmC;YACzC,GAAG,EAAE,4CAA4C;SAClD;QACD;YACE,IAAI,EAAE,mCAAmC;YACzC,GAAG,EAAE,4CAA4C;SAClD;QACD;YACE,IAAI,EAAE,kCAAkC;YACxC,GAAG,EAAE,qCAAqC;SAC3C;KACF;IAED,UAAU;IACV,MAAM,EAAE,OAAO;IACf,QAAQ,EAAE,kBAAkB;IAC5B,OAAO,EAAE,mCAAmC;IAC5C,WAAW,EAAE,gBAAgB,CAAC,WAAW;IAEzC,gBAAgB;IAChB,QAAQ,EAAE,oCAAoC;IAC9C,SAAS,EAAE,qCAAqC;IAEhD,WAAW;IACX,UAAU,EAAE,8BAA8B;IAC1C,oBAAoB,EAAE,+BAA+B;CACtD,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { EnvironmentTypes, SiteConfig } from '../types';\nimport { devFooterApp, devHeaderApp, devHomeApp, devUserApp, slotShowcaseApp } from './dev';\nimport { footerApp, headerApp, shellApp } from '.';\n\nimport './style';\n\nconst siteConfig: SiteConfig = {\n apps: [\n shellApp,\n headerApp,\n footerApp,\n devUserApp,\n devHomeApp,\n devHeaderApp,\n devFooterApp,\n slotShowcaseApp,\n ],\n\n externalRoutes: [\n {\n role: 'org.openedx.frontend.role.profile',\n url: 'http://apps.local.openedx.io:1995/profile/'\n },\n {\n role: 'org.openedx.frontend.role.account',\n url: 'http://apps.local.openedx.io:1997/account/'\n },\n {\n role: 'org.openedx.frontend.role.logout',\n url: 'http://local.openedx.io:8000/logout'\n },\n ],\n\n // General\n siteId: 'shell',\n siteName: 'My Open edX Site',\n baseUrl: 'http://apps.local.openedx.io:8080',\n environment: EnvironmentTypes.DEVELOPMENT,\n\n // Frontend URLs\n loginUrl: 'http://local.openedx.io:8000/login',\n logoutUrl: 'http://local.openedx.io:8000/logout',\n\n // API URLs\n lmsBaseUrl: 'http://local.openedx.io:8000',\n runtimeConfigJsonUrl: '/api/frontend_site_config/v1/',\n};\n\nexport default siteConfig;\n"]}
|
|
1
|
+
{"version":3,"file":"site.config.dev.js","sourceRoot":"","sources":["../../shell/site.config.dev.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAc,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC;AAEnD,OAAO,SAAS,CAAC;AAEjB,MAAM,UAAU,GAAe;IAC7B,IAAI,EAAE;QACJ,QAAQ;QACR,SAAS;QACT,SAAS;QACT,UAAU;QACV,UAAU;QACV,YAAY;QACZ,YAAY;QACZ,eAAe;KAChB;IAED,cAAc,EAAE;QACd;YACE,IAAI,EAAE,mCAAmC;YACzC,GAAG,EAAE,4CAA4C;SAClD;QACD;YACE,IAAI,EAAE,mCAAmC;YACzC,GAAG,EAAE,4CAA4C;SAClD;QACD;YACE,IAAI,EAAE,kCAAkC;YACxC,GAAG,EAAE,qCAAqC;SAC3C;KACF;IAED,UAAU;IACV,MAAM,EAAE,OAAO;IACf,QAAQ,EAAE,kBAAkB;IAC5B,OAAO,EAAE,mCAAmC;IAC5C,WAAW,EAAE,gBAAgB,CAAC,WAAW;IAEzC,gBAAgB;IAChB,QAAQ,EAAE,oCAAoC;IAC9C,SAAS,EAAE,qCAAqC;IAEhD,WAAW;IACX,UAAU,EAAE,8BAA8B;IAC1C,UAAU,EAAE,qCAAqC;IACjD,oBAAoB,EAAE,+BAA+B;CACtD,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { EnvironmentTypes, SiteConfig } from '../types';\nimport { devFooterApp, devHeaderApp, devHomeApp, devUserApp, slotShowcaseApp } from './dev';\nimport { footerApp, headerApp, shellApp } from '.';\n\nimport './style';\n\nconst siteConfig: SiteConfig = {\n apps: [\n shellApp,\n headerApp,\n footerApp,\n devUserApp,\n devHomeApp,\n devHeaderApp,\n devFooterApp,\n slotShowcaseApp,\n ],\n\n externalRoutes: [\n {\n role: 'org.openedx.frontend.role.profile',\n url: 'http://apps.local.openedx.io:1995/profile/'\n },\n {\n role: 'org.openedx.frontend.role.account',\n url: 'http://apps.local.openedx.io:1997/account/'\n },\n {\n role: 'org.openedx.frontend.role.logout',\n url: 'http://local.openedx.io:8000/logout'\n },\n ],\n\n // General\n siteId: 'shell',\n siteName: 'My Open edX Site',\n baseUrl: 'http://apps.local.openedx.io:8080',\n environment: EnvironmentTypes.DEVELOPMENT,\n\n // Frontend URLs\n loginUrl: 'http://local.openedx.io:8000/login',\n logoutUrl: 'http://local.openedx.io:8000/logout',\n\n // API URLs\n lmsBaseUrl: 'http://local.openedx.io:8000',\n cmsBaseUrl: 'http://studio.local.openedx.io:8001',\n runtimeConfigJsonUrl: '/api/frontend_site_config/v1/',\n};\n\nexport default siteConfig;\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export type LocalizedMessages = Record<string, Record<string, string>>;
|
|
|
45
45
|
export type SiteMessages = LocalizedMessages[];
|
|
46
46
|
export interface OptionalSiteConfig {
|
|
47
47
|
environment: EnvironmentTypes;
|
|
48
|
+
cmsBaseUrl: string;
|
|
48
49
|
apps: App[];
|
|
49
50
|
basename: string;
|
|
50
51
|
externalRoutes: ExternalRoute[];
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AA6HA,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,6CAAyB,CAAA;IACzB,+CAA2B,CAAA;IAC3B,iCAAa,CAAA;AACf,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B","sourcesContent":["import { FC, ReactElement, ReactNode } from 'react';\nimport { MessageDescriptor } from 'react-intl';\nimport { RouteObject } from 'react-router';\nimport { SlotOperation } from './runtime/slots/types';\n\n// Apps\n\nexport interface ExternalRoute {\n role: string,\n url: string,\n}\n\nexport type RoleRouteObject = RouteObject & {\n handle?: {\n /**\n * Route roles identify the purpose(s) a route fulfills in the site.\n */\n roles?: string[],\n },\n};\n\nexport type AppConfig = Record<string, unknown>;\n\nexport type AppProvider = FC<{ children?: ReactNode }>;\n\nexport interface App {\n appId: string,\n routes?: RoleRouteObject[],\n providers?: AppProvider[],\n slots?: SlotOperation[],\n externalScripts?: ExternalScriptLoaderClass[],\n config?: AppConfig,\n provides?: Record<string, unknown>,\n}\n\n// External Scripts\n\nexport interface ExternalScriptLoader {\n loadScript(): void,\n}\n\nexport type ExternalScriptLoaderClass = new (data: { config: AppConfig }) => ExternalScriptLoader;\n\n// Site Config\n\nexport interface RequiredSiteConfig {\n siteId: string,\n siteName: string,\n baseUrl: string,\n\n // Backends\n lmsBaseUrl: string,\n\n // Frontends\n loginUrl: string,\n logoutUrl: string,\n}\n\nexport type LocalizedMessages = Record<string, Record<string, string>>;\nexport type SiteMessages = LocalizedMessages[];\n\nexport interface OptionalSiteConfig {\n // Site environment\n environment: EnvironmentTypes,\n\n // Backends\n cmsBaseUrl: string,\n\n // Apps, routes, and URLs\n apps: App[],\n basename: string,\n externalRoutes: ExternalRoute[],\n externalLinkUrlOverrides: string[],\n runtimeConfigJsonUrl: string | null,\n commonAppConfig: AppConfig,\n headerLogoImageUrl: string,\n\n // Theme\n theme: Theme,\n\n // Cookies\n accessTokenCookieName: string,\n languagePreferenceCookieName: string,\n userInfoCookieName: string,\n\n // Paths\n csrfTokenApiPath: string,\n refreshAccessTokenApiPath: string,\n\n // Logging\n ignoredErrorRegex: RegExp | null,\n\n // Analytics\n segmentKey: string | null,\n}\n\nexport type SiteConfig = RequiredSiteConfig & Partial<OptionalSiteConfig>;\n\nexport interface ThemeVariant {\n url: string,\n}\n\nexport interface ThemeDefaults {\n light?: string,\n dark?: string,\n}\n\nexport type ThemeVariants = Record<string, ThemeVariant>;\n\nexport interface Theme {\n core?: ThemeVariant,\n defaults?: ThemeDefaults,\n variants?: ThemeVariants,\n}\n\nexport interface User {\n administrator: boolean,\n email: string,\n name: string,\n roles: string[],\n userId: number,\n username: string,\n avatar: string,\n}\n\nexport enum EnvironmentTypes {\n PRODUCTION = 'production',\n DEVELOPMENT = 'development',\n TEST = 'test',\n}\n\n// Menu Items\n\nexport type MenuItemName = string | MessageDescriptor | ReactElement;\n"]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CourseTabsNavigation.js","sourceRoot":"","sources":["../../../../shell/header/course-navigation-bar/CourseTabsNavigation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,M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KAAK,QAAC,IAAI,EAAC,IAAI,YACxB,MAAC,GAAG,IACF,OAAO,EAAC,MAAM,EACd,SAAS,EAAE,UAAU,aAErB,KAAC,MAAM,CAAC,MAAM,qBAAe,YAAY,GAAG,EAC5C,KAAC,MAAM,CAAC,QAAQ,IAAC,EAAE,EAAC,YAAY,YAE5B,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CACtB,KAAC,GAAG,CAAC,IAAI,cACP,KAAC,GAAG,CAAC,IAAI,oBACH,CAAC,GAAG,CAAC,UAAU;gCACjB,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE;gCAClC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAE,CACpB,IACD,MAAM,EAAE,GAAG,CAAC,KAAK,KAAK,UAAU,YAE/B,GAAG,CAAC,KAAK,IACD,IATE,GAAG,CAAC,KAAK,CAUb,CACZ,CAAC,GAEY,EAClB,KAAC,IAAI,IAAC,EAAE,EAAC,sEAAsE,GAAG,IAC9E,GACI,GACL,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import { useMemo } from 'react';\nimport { Link, matchPath, useLocation, useParams } from 'react-router-dom';\nimport { useQuery } from '@tanstack/react-query';\nimport { Slot, useIntl } from '../../../runtime';\nimport { CourseTab, getCourseHomeCourseMetadata } from './data/service';\nimport { Container, Nav, Navbar, Skeleton } from '@openedx/paragon';\nimport messages from './messages';\nimport { isClientRoute } from './utils';\nimport './course-tabs-navigation.scss';\n\ninterface ResolvedTab extends CourseTab {\n pathname: string,\n clientPath: string | null,\n}\n\n/*\n * Returns the tabId of the tab whose pathname is the longest prefix match\n * against the current path. Uses react-router's matchPath for segment-aware\n * matching.\n *\n * For example, given tabs with paths /course/ (tabId: \"outline\")\n * and /course/dates/ (tabId: \"dates\"):\n *\n * /course/dates/foo -> \"dates\" (longest prefix match)\n * /course/outline -> \"outline\"\n * /courseware -> null (not a segment boundary)\n */\nconst getActiveTabId = (currentPath: string, tabs: ResolvedTab[]): string | null => {\n let best: ResolvedTab | null = null;\n for (const tab of tabs) {\n const match = matchPath({ path: `${tab.pathname}/*`, end: false }, currentPath);\n if (match && (!best || tab.pathname.length > best.pathname.length)) {\n best = tab;\n }\n }\n return best?.tabId ?? null;\n};\n\nconst CourseTabsNavigation = () => {\n const location = useLocation();\n const { courseId = '' } = useParams();\n const intl = useIntl();\n\n const { data = { tabs: [] }, isLoading } = useQuery({\n queryKey: ['org.openedx.frontend.app.header.course-meta', courseId],\n queryFn: () => getCourseHomeCourseMetadata(courseId),\n retry: 2,\n enabled: !!courseId,\n });\n\n const { tabs } = data;\n\n const resolvedTabs: ResolvedTab[] = useMemo(\n () => tabs.map(tab => {\n // Tab URLs from the course_home API are always absolute.\n const pathname = new URL(tab.url).pathname;\n return { ...tab, pathname, clientPath: isClientRoute(pathname) ? pathname : null };\n }),\n [tabs]\n );\n\n const currentTab = useMemo(\n () => resolvedTabs.length > 0 ? getActiveTabId(location.pathname, resolvedTabs) : null,\n [location.pathname, resolvedTabs]\n );\n\n if (isLoading) {\n return <Skeleton className=\"lead mt-3\" />;\n }\n\n if (!courseId || resolvedTabs.length === 0) {\n return null;\n }\n\n return (\n <Navbar expand=\"sm\" className=\"course-tabs-navigation pb-0\" aria-label={intl.formatMessage(messages.courseMaterial)}>\n <Container fluid size=\"xl\">\n <Nav\n variant=\"tabs\"\n activeKey={currentTab}\n >\n <Navbar.Toggle aria-controls=\"course-nav\" />\n <Navbar.Collapse id=\"course-nav\">\n {\n resolvedTabs.map(tab => (\n <Nav.Item key={tab.tabId}>\n <Nav.Link\n {...(tab.clientPath\n ? { to: tab.clientPath, as: Link }\n : { href: tab.url }\n )}\n active={tab.tabId === currentTab}\n >\n {tab.title}\n </Nav.Link>\n </Nav.Item>\n ))\n }\n </Navbar.Collapse>\n <Slot id=\"org.openedx.frontend.slot.header.courseNavigationBar.extraContent.v1\" />\n </Nav>\n </Container>\n </Navbar>\n );\n};\n\nexport default CourseTabsNavigation;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../../../shell/header/course-navigation-bar/data/service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAuBjG,SAAS,iCAAiC,CAAC,QAAqC;IAC9E,MAAM,IAAI,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACvC,OAAO;QACL,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAc,EAAE,EAAE,CAAC,CAAC;YAC/C,KAAK,EAAE,GAAG,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK;YACzD,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,GAAG,EAAE,GAAG,CAAC,GAAG;SACb,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC;AAED,MAAM,UAAgB,2BAA2B,CAAC,QAAgB;;QAChE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,GAAG,CAAC,GAAG,aAAa,EAAE,CAAC,UAAU,oCAAoC,QAAQ,EAAE,CAAC,CAAC;QAErI,OAAO,iCAAiC,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;CAAA","sourcesContent":["import { getSiteConfig, getAuthenticatedHttpClient, camelCaseObject } from '../../../../runtime';\n\n// Raw API response from /api/course_home/course_metadata/\ninterface RawCourseTab {\n tab_id: string,\n title: string,\n url: string,\n}\n\ninterface RawCourseHomeCourseMetadata {\n tabs: RawCourseTab[],\n}\n\nexport interface CourseTab {\n tabId: string,\n title: string,\n url: string,\n}\n\nexport interface CourseHomeCourseMetadata {\n tabs: CourseTab[],\n}\n\nfunction normalizeCourseHomeCourseMetadata(metadata: RawCourseHomeCourseMetadata): CourseHomeCourseMetadata {\n const data = camelCaseObject(metadata);\n return {\n tabs: (data.tabs || []).map((tab: CourseTab) => ({\n tabId: tab.tabId === 'courseware' ? 'outline' : tab.tabId,\n title: tab.title,\n url: tab.url,\n })),\n };\n}\n\nexport async function getCourseHomeCourseMetadata(courseId: string): Promise<CourseHomeCourseMetadata> {\n const { data } = await getAuthenticatedHttpClient().get(`${getSiteConfig().lmsBaseUrl}/api/course_home/course_metadata/${courseId}`);\n\n return normalizeCourseHomeCourseMetadata(data);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../shell/header/course-navigation-bar/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,cAAc,EAAE;QACd,EAAE,EAAE,iEAAiE;QACrE,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,iDAAiD;KAC/D;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '../../../runtime';\n\nconst messages = defineMessages({\n courseMaterial: {\n id: 'org.openedx.frontend.slot.header.courseNavigationBar.tabs.label',\n defaultMessage: 'Course Navigation Bar',\n description: 'The accessible label for course tabs navigation',\n },\n});\n\nexport default messages;\n"]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { matchPath } from 'react-router-dom';
|
|
2
|
-
import { getActiveRoles, getProvidesAsStrings, getUrlByRouteRole } from '../../../runtime';
|
|
3
|
-
import { providesCourseNavigationRolesId } from '../constants';
|
|
4
|
-
/*
|
|
5
|
-
* Collects route role strings from all apps that opted into the course
|
|
6
|
-
* navigation bar feature. Each app declares its roles as a string array:
|
|
7
|
-
*
|
|
8
|
-
* provides: {
|
|
9
|
-
* [providesCourseNavigationRolesId]: ['org.openedx.frontend.role.learning'],
|
|
10
|
-
* }
|
|
11
|
-
*/
|
|
12
|
-
function getCourseNavigationBarRoles() {
|
|
13
|
-
return getProvidesAsStrings(providesCourseNavigationRolesId);
|
|
14
|
-
}
|
|
15
|
-
export function isCourseNavigationRoute() {
|
|
16
|
-
const activeRoles = getActiveRoles();
|
|
17
|
-
return getCourseNavigationBarRoles().some(role => activeRoles.includes(role));
|
|
18
|
-
}
|
|
19
|
-
export function isClientRoute(pathname) {
|
|
20
|
-
return getCourseNavigationBarRoles().some(role => {
|
|
21
|
-
const routePath = getUrlByRouteRole(role);
|
|
22
|
-
return routePath !== null
|
|
23
|
-
&& routePath.startsWith('/')
|
|
24
|
-
&& matchPath({ path: routePath, end: false }, pathname) !== null;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../shell/header/course-navigation-bar/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAE/D;;;;;;;GAOG;AACH,SAAS,2BAA2B;IAClC,OAAO,oBAAoB,CAAC,+BAA+B,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,OAAO,2BAA2B,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,OAAO,2BAA2B,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC/C,MAAM,SAAS,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,SAAS,KAAK,IAAI;eACpB,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC;eACzB,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,KAAK,IAAI,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { matchPath } from 'react-router-dom';\nimport { getActiveRoles, getProvidesAsStrings, getUrlByRouteRole } from '../../../runtime';\nimport { providesCourseNavigationRolesId } from '../constants';\n\n/*\n * Collects route role strings from all apps that opted into the course\n * navigation bar feature. Each app declares its roles as a string array:\n *\n * provides: {\n * [providesCourseNavigationRolesId]: ['org.openedx.frontend.role.learning'],\n * }\n */\nfunction getCourseNavigationBarRoles(): string[] {\n return getProvidesAsStrings(providesCourseNavigationRolesId);\n}\n\nexport function isCourseNavigationRoute(): boolean {\n const activeRoles = getActiveRoles();\n return getCourseNavigationBarRoles().some(role => activeRoles.includes(role));\n}\n\nexport function isClientRoute(pathname: string): boolean {\n return getCourseNavigationBarRoles().some(role => {\n const routePath = getUrlByRouteRole(role);\n return routePath !== null\n && routePath.startsWith('/')\n && matchPath({ path: routePath, end: false }, pathname) !== null;\n });\n}\n"]}
|
/package/dist/shell/header/{course-navigation-bar → course-bar/navigation}/CourseTabsNavigation.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|