From 95efe7fedd980efa13bad5ea99e05e936700600e Mon Sep 17 00:00:00 2001 From: Brian Smith <112954497+brian-smith-tcril@users.noreply.github.com> Date: Wed, 23 Apr 2025 15:45:16 -0400 Subject: [PATCH] feat: standardize slot ids (#589) --- package-lock.json | 8 ++--- package.json | 3 +- src/plugin-slots/CourseInfoSlot/README.md | 11 +++--- src/plugin-slots/CourseInfoSlot/index.jsx | 3 +- src/plugin-slots/DesktopHeaderSlot/README.md | 7 ++-- src/plugin-slots/DesktopHeaderSlot/index.jsx | 3 +- .../DesktopLoggedOutItemsSlot/README.md | 11 +++--- .../DesktopLoggedOutItemsSlot/index.jsx | 3 +- .../DesktopMainMenuSlot/README.md | 11 +++--- .../DesktopMainMenuSlot/index.jsx | 3 +- .../DesktopSecondaryMenuSlot/README.md | 11 +++--- .../DesktopSecondaryMenuSlot/index.jsx | 3 +- .../DesktopUserMenuSlot/README.md | 11 +++--- .../DesktopUserMenuSlot/index.jsx | 3 +- src/plugin-slots/LearningHelpSlot/README.md | 7 ++-- src/plugin-slots/LearningHelpSlot/index.jsx | 2 +- .../LearningLoggedOutItemsSlot/README.md | 11 +++--- .../LearningLoggedOutItemsSlot/index.jsx | 3 +- .../LearningUserMenuSlot/README.md | 11 +++--- .../LearningUserMenuSlot/index.jsx | 3 +- src/plugin-slots/LogoSlot/README.md | 9 +++-- src/plugin-slots/LogoSlot/index.jsx | 3 +- src/plugin-slots/MobileHeaderSlot/README.md | 7 ++-- src/plugin-slots/MobileHeaderSlot/index.jsx | 3 +- .../MobileLoggedOutItemsSlot/README.md | 12 ++++--- .../MobileLoggedOutItemsSlot/index.jsx | 3 +- src/plugin-slots/MobileMainMenuSlot/README.md | 12 ++++--- src/plugin-slots/MobileMainMenuSlot/index.jsx | 3 +- src/plugin-slots/MobileUserMenuSlot/README.md | 12 ++++--- src/plugin-slots/MobileUserMenuSlot/index.jsx | 3 +- src/plugin-slots/README.md | 34 ++++++++++++------- 31 files changed, 145 insertions(+), 84 deletions(-) diff --git a/package-lock.json b/package-lock.json index c6e3eea..2e05ac1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@fortawesome/free-regular-svg-icons": "6.6.0", "@fortawesome/free-solid-svg-icons": "6.6.0", "@fortawesome/react-fontawesome": "^0.2.0", - "@openedx/frontend-plugin-framework": "^1.6.0", + "@openedx/frontend-plugin-framework": "^1.7.0", "axios-mock-adapter": "1.22.0", "babel-polyfill": "6.26.0", "classnames": "^2.5.1", @@ -3746,9 +3746,9 @@ } }, "node_modules/@openedx/frontend-plugin-framework": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@openedx/frontend-plugin-framework/-/frontend-plugin-framework-1.6.0.tgz", - "integrity": "sha512-zgP+/hs/cvcPmFOgVm2xt/qgX1nheNsfipzCO7I3bON4hHyOhmOyzwFZJ7pz7GzCJwKlMVguh3HcJgf4p/BPKQ==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@openedx/frontend-plugin-framework/-/frontend-plugin-framework-1.7.0.tgz", + "integrity": "sha512-8tGkuHvtzhbqb9dU4sXUtR0K44+Hjh1uGR6DvhZAt9wSKQC1v4RBk34ef8DFzQhoNQa/Jtn6BJuta4Un6MmHmw==", "license": "AGPL-3.0", "dependencies": { "@edx/brand": "npm:@openedx/brand-openedx@^1.2.2", diff --git a/package.json b/package.json index 9c216f4..6b1cafc 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "build": "make build", "i18n_extract": "fedx-scripts formatjs extract", "lint": "fedx-scripts eslint --ext .js --ext .jsx .", + "lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx .", "snapshot": "fedx-scripts jest --updateSnapshot", "start": "fedx-scripts webpack-dev-server --progress", "test": "fedx-scripts jest --coverage" @@ -54,7 +55,7 @@ "@fortawesome/free-regular-svg-icons": "6.6.0", "@fortawesome/free-solid-svg-icons": "6.6.0", "@fortawesome/react-fontawesome": "^0.2.0", - "@openedx/frontend-plugin-framework": "^1.6.0", + "@openedx/frontend-plugin-framework": "^1.7.0", "axios-mock-adapter": "1.22.0", "babel-polyfill": "6.26.0", "classnames": "^2.5.1", diff --git a/src/plugin-slots/CourseInfoSlot/README.md b/src/plugin-slots/CourseInfoSlot/README.md index 574de55..1b3fd9f 100644 --- a/src/plugin-slots/CourseInfoSlot/README.md +++ b/src/plugin-slots/CourseInfoSlot/README.md @@ -1,6 +1,9 @@ # Course Info Slot -### Slot ID: `course_info_slot` +### Slot ID: `org.openedx.frontend.layout.header_learning_course_info.v1` + +### Slot ID Aliases +* `course_info_slot` ## Description @@ -24,7 +27,7 @@ const replaceCourseTitle = ( widget ) => { const config = { pluginSlots: { - course_info_slot: { + 'org.openedx.frontend.layout.header_learning_course_info.v1': { keepDefault: true, plugins: [ { @@ -51,7 +54,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - course_info_slot: { + 'org.openedx.frontend.layout.header_learning_course_info.v1': { keepDefault: false, plugins: [ { @@ -83,7 +86,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - course_info_slot: { + 'org.openedx.frontend.layout.header_learning_course_info.v1': { keepDefault: true, plugins: [ { diff --git a/src/plugin-slots/CourseInfoSlot/index.jsx b/src/plugin-slots/CourseInfoSlot/index.jsx index f66d403..3fec88c 100644 --- a/src/plugin-slots/CourseInfoSlot/index.jsx +++ b/src/plugin-slots/CourseInfoSlot/index.jsx @@ -9,7 +9,8 @@ const CourseInfoSlot = ({ ...attributes }) => ( ( { const config = { pluginSlots: { - desktop_logged_out_items_slot: { + 'org.openedx.frontend.layout.header_desktop_logged_out_items.v1': { keepDefault: true, plugins: [ { @@ -67,7 +70,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - desktop_logged_out_items_slot: { + 'org.openedx.frontend.layout.header_desktop_logged_out_items.v1': { keepDefault: false, plugins: [ { @@ -99,7 +102,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - desktop_logged_out_items_slot: { + 'org.openedx.frontend.layout.header_desktop_logged_out_items.v1': { keepDefault: true, plugins: [ { diff --git a/src/plugin-slots/DesktopLoggedOutItemsSlot/index.jsx b/src/plugin-slots/DesktopLoggedOutItemsSlot/index.jsx index b9676b2..000ae4f 100644 --- a/src/plugin-slots/DesktopLoggedOutItemsSlot/index.jsx +++ b/src/plugin-slots/DesktopLoggedOutItemsSlot/index.jsx @@ -6,7 +6,8 @@ const DesktopLoggedOutItemsSlot = ({ items, }) => ( { const config = { pluginSlots: { - desktop_main_menu_slot: { + 'org.openedx.frontend.layout.header_desktop_main_menu.v1': { keepDefault: true, plugins: [ { @@ -67,7 +70,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - desktop_main_menu_slot: { + 'org.openedx.frontend.layout.header_desktop_main_menu.v1': { keepDefault: false, plugins: [ { @@ -99,7 +102,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - desktop_main_menu_slot: { + 'org.openedx.frontend.layout.header_desktop_main_menu.v1': { keepDefault: true, plugins: [ { diff --git a/src/plugin-slots/DesktopMainMenuSlot/index.jsx b/src/plugin-slots/DesktopMainMenuSlot/index.jsx index b0026b9..4e94300 100644 --- a/src/plugin-slots/DesktopMainMenuSlot/index.jsx +++ b/src/plugin-slots/DesktopMainMenuSlot/index.jsx @@ -6,7 +6,8 @@ const DesktopMainMenuSlot = ({ menu, }) => ( { const config = { pluginSlots: { - desktop_secondary_menu_slot: { + 'org.openedx.frontend.layout.header_desktop_secondary_menu.v1': { keepDefault: true, plugins: [ { @@ -62,7 +65,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - desktop_secondary_menu_slot: { + 'org.openedx.frontend.layout.header_desktop_secondary_menu.v1': { keepDefault: false, plugins: [ { @@ -94,7 +97,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - desktop_secondary_menu_slot: { + 'org.openedx.frontend.layout.header_desktop_secondary_menu.v1': { keepDefault: true, plugins: [ { diff --git a/src/plugin-slots/DesktopSecondaryMenuSlot/index.jsx b/src/plugin-slots/DesktopSecondaryMenuSlot/index.jsx index 79c1f5f..e43e552 100644 --- a/src/plugin-slots/DesktopSecondaryMenuSlot/index.jsx +++ b/src/plugin-slots/DesktopSecondaryMenuSlot/index.jsx @@ -6,7 +6,8 @@ const DesktopSecondaryMenuSlot = ({ menu, }) => ( { const config = { pluginSlots: { - desktop_user_menu_slot: { + 'org.openedx.frontend.layout.header_desktop_user_menu.v1': { keepDefault: true, plugins: [ { @@ -75,7 +78,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - desktop_user_menu_slot: { + 'org.openedx.frontend.layout.header_desktop_user_menu.v1': { keepDefault: false, plugins: [ { @@ -107,7 +110,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - desktop_user_menu_slot: { + 'org.openedx.frontend.layout.header_desktop_user_menu.v1': { keepDefault: true, plugins: [ { diff --git a/src/plugin-slots/DesktopUserMenuSlot/index.jsx b/src/plugin-slots/DesktopUserMenuSlot/index.jsx index 1df367c..8f95fe6 100644 --- a/src/plugin-slots/DesktopUserMenuSlot/index.jsx +++ b/src/plugin-slots/DesktopUserMenuSlot/index.jsx @@ -6,7 +6,8 @@ const DesktopUserMenuSlot = ({ menu, }) => ( ( - + ); diff --git a/src/plugin-slots/LearningLoggedOutItemsSlot/README.md b/src/plugin-slots/LearningLoggedOutItemsSlot/README.md index a803d01..46aae26 100644 --- a/src/plugin-slots/LearningLoggedOutItemsSlot/README.md +++ b/src/plugin-slots/LearningLoggedOutItemsSlot/README.md @@ -1,6 +1,9 @@ # Learning Logged Out Items Slot -### Slot ID: `learning_logged_out_items_slot` +### Slot ID: `org.openedx.frontend.layout.header_learning_logged_out_items.v1` + +### Slot ID Aliases +* `learning_logged_out_items_slot` ## Description @@ -38,7 +41,7 @@ const modifyLoggedOutItems = ( widget ) => { const config = { pluginSlots: { - learning_logged_out_items_slot: { + 'org.openedx.frontend.layout.header_learning_logged_out_items.v1': { keepDefault: true, plugins: [ { @@ -65,7 +68,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - learning_logged_out_items_slot: { + 'org.openedx.frontend.layout.header_learning_logged_out_items.v1': { keepDefault: false, plugins: [ { @@ -97,7 +100,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - learning_logged_out_items_slot: { + 'org.openedx.frontend.layout.header_learning_logged_out_items.v1': { keepDefault: true, plugins: [ { diff --git a/src/plugin-slots/LearningLoggedOutItemsSlot/index.jsx b/src/plugin-slots/LearningLoggedOutItemsSlot/index.jsx index daf64a6..0fca2f2 100644 --- a/src/plugin-slots/LearningLoggedOutItemsSlot/index.jsx +++ b/src/plugin-slots/LearningLoggedOutItemsSlot/index.jsx @@ -6,7 +6,8 @@ const LearningLoggedOutItemsSlot = ({ buttonsInfo, }) => ( { const config = { pluginSlots: { - learning_user_menu_slot: { + 'org.openedx.frontend.layout.header_learning_user_menu.v1': { keepDefault: true, plugins: [ { @@ -64,7 +67,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - learning_user_menu_slot: { + 'org.openedx.frontend.layout.header_learning_user_menu.v1': { keepDefault: false, plugins: [ { @@ -96,7 +99,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - learning_user_menu_slot: { + 'org.openedx.frontend.layout.header_learning_user_menu.v1': { keepDefault: true, plugins: [ { diff --git a/src/plugin-slots/LearningUserMenuSlot/index.jsx b/src/plugin-slots/LearningUserMenuSlot/index.jsx index b78e3ae..1261573 100644 --- a/src/plugin-slots/LearningUserMenuSlot/index.jsx +++ b/src/plugin-slots/LearningUserMenuSlot/index.jsx @@ -6,7 +6,8 @@ const LearningUserMenuSlot = ({ items, }) => ( { const config = { pluginSlots: { - logo_slot: { + 'org.openedx.frontend.layout.header_logo.v1': { keepDefault: true, plugins: [ { @@ -47,7 +50,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - logo_slot: { + 'org.openedx.frontend.layout.header_logo.v1': { keepDefault: false, plugins: [ { diff --git a/src/plugin-slots/LogoSlot/index.jsx b/src/plugin-slots/LogoSlot/index.jsx index 42f9262..a4c9d13 100644 --- a/src/plugin-slots/LogoSlot/index.jsx +++ b/src/plugin-slots/LogoSlot/index.jsx @@ -6,7 +6,8 @@ const LogoSlot = ({ href, src, alt, ...attributes }) => ( ( { const config = { pluginSlots: { - mobile_logged_out_items_slot: { + 'org.openedx.frontend.layout.header_mobile_logged_out_items.v1': { keepDefault: true, plugins: [ { @@ -67,7 +70,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - mobile_logged_out_items_slot: { + 'org.openedx.frontend.layout.header_mobile_logged_out_items.v1': { keepDefault: false, plugins: [ { @@ -99,7 +102,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - mobile_logged_out_items_slot: { + 'org.openedx.frontend.layout.header_mobile_logged_out_items.v1': { keepDefault: true, plugins: [ { @@ -131,4 +134,3 @@ const config = { export default config; ``` - diff --git a/src/plugin-slots/MobileLoggedOutItemsSlot/index.jsx b/src/plugin-slots/MobileLoggedOutItemsSlot/index.jsx index 490dda0..10c15cc 100644 --- a/src/plugin-slots/MobileLoggedOutItemsSlot/index.jsx +++ b/src/plugin-slots/MobileLoggedOutItemsSlot/index.jsx @@ -6,7 +6,8 @@ const MobileLoggedOutItemsSlot = ({ items, }) => ( { const config = { pluginSlots: { - mobile_main_menu_slot: { + 'org.openedx.frontend.layout.header_mobile_main_menu.v1': { keepDefault: true, plugins: [ { @@ -67,7 +70,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - mobile_main_menu_slot: { + 'org.openedx.frontend.layout.header_mobile_main_menu.v1': { keepDefault: false, plugins: [ { @@ -99,7 +102,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - mobile_main_menu_slot: { + 'org.openedx.frontend.layout.header_mobile_main_menu.v1': { keepDefault: true, plugins: [ { @@ -131,4 +134,3 @@ const config = { export default config; ``` - diff --git a/src/plugin-slots/MobileMainMenuSlot/index.jsx b/src/plugin-slots/MobileMainMenuSlot/index.jsx index b26cfc2..ba3c811 100644 --- a/src/plugin-slots/MobileMainMenuSlot/index.jsx +++ b/src/plugin-slots/MobileMainMenuSlot/index.jsx @@ -6,7 +6,8 @@ const MobileMainMenuSlot = ({ menu, }) => ( { const config = { pluginSlots: { - mobile_user_menu_slot: { + 'org.openedx.frontend.layout.header_mobile_user_menu.v1': { keepDefault: true, plugins: [ { @@ -75,7 +78,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - mobile_user_menu_slot: { + 'org.openedx.frontend.layout.header_mobile_user_menu.v1': { keepDefault: false, plugins: [ { @@ -107,7 +110,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame const config = { pluginSlots: { - mobile_user_menu_slot: { + 'org.openedx.frontend.layout.header_mobile_user_menu.v1': { keepDefault: true, plugins: [ { @@ -139,4 +142,3 @@ const config = { export default config; ``` - diff --git a/src/plugin-slots/MobileUserMenuSlot/index.jsx b/src/plugin-slots/MobileUserMenuSlot/index.jsx index 51f48bf..2196ef4 100644 --- a/src/plugin-slots/MobileUserMenuSlot/index.jsx +++ b/src/plugin-slots/MobileUserMenuSlot/index.jsx @@ -6,7 +6,8 @@ const MobileUserMenuSlot = ({ menu, }) => (