Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added PluginSlot to wrap IDVerificationPage component #1097

Merged
merged 2 commits into from
Aug 16, 2024

Conversation

rijuma
Copy link
Member

@rijuma rijuma commented Aug 9, 2024

Description

This wraps the IDVerificationPage with a PluginSlot component to allow experiment with a new IDV flow.
Similar implementations can be seen in frontend-app-learner-dashboard for example.

Added a lint:fix script as well for practical reasons.

How Has This Been Tested?

Tested on local environment and the default behavior is shown as expected.

Merge Checklist

  • Is there adequate test coverage for your changes?

Post-merge Checklist

  • Deploy the changes to prod after verifying on stage or ask @openedx/edx-infinity to do it.
  • 🎉 🙌 Celebrate! Thanks for your contribution.

@rijuma rijuma force-pushed the rijuma/idv-experiment-slot branch from 9cd0b2e to d7a5b22 Compare August 9, 2024 15:45
Copy link

codecov bot commented Aug 9, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 58.61%. Comparing base (17ce32b) to head (dcdd024).
Report is 9 commits behind head on master.

Files Patch % Lines
src/plugin-slots/IdVerificationPageSlot/index.jsx 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1097      +/-   ##
==========================================
+ Coverage   58.55%   58.61%   +0.05%     
==========================================
  Files         115      117       +2     
  Lines        2309     2317       +8     
  Branches      638      641       +3     
==========================================
+ Hits         1352     1358       +6     
- Misses        896      898       +2     
  Partials       61       61              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rijuma rijuma marked this pull request as ready for review August 9, 2024 18:04
Copy link
Contributor

@schenedx schenedx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my inline comment.

@@ -40,7 +41,14 @@ subscribe(APP_READY, () => {
>
<Route path="/notifications/:courseId" element={<NotificationPreferences />} />
<Route path="/notifications" element={<NotificationCourses />} />
<Route path="/id-verification/*" element={<IdVerificationPage />} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a change like this, if we deploy this to production, the existing IDV flow will be gone.
I think we need a period of this code where the plugin slot and the existing IDV flow co-exist for a while. This way, while we build out the plugin slot, the existing IDV flow still serves our learners.
Then we need a waffle flag to do the switch from the entry link, which is probably 3 different places.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever component is wrapped by the PluginSlot (i.e. IdVerificationPage) is the "default component" and will be rendered by default if there is no plugin configuration specified (e.g. in an env.config.[js|jsx] file in edx-internal) or no overriding plugin in the said plugin configuration, so this deployment strategy isn't necessary. If we merge this as-is, there will be no changes to the IDV page in the learning MFE for 2U or any other deployments. There are more details the frontend-plugin-framework docs. Does that assuage your concerns?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. I tested it locally but with no configuration and the <IdVerificationPage> is rendered by default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. I didn't know plugin slot handles this the way it should be. Thank you for pointing it out.

Copy link
Contributor

@MichaelRoytman MichaelRoytman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I know you wanted to discuss more today, so I've held off on approving for now.

Also, should/can we test the use of the PluginSlot on the page?

@@ -40,7 +41,14 @@ subscribe(APP_READY, () => {
>
<Route path="/notifications/:courseId" element={<NotificationPreferences />} />
<Route path="/notifications" element={<NotificationCourses />} />
<Route path="/id-verification/*" element={<IdVerificationPage />} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever component is wrapped by the PluginSlot (i.e. IdVerificationPage) is the "default component" and will be rendered by default if there is no plugin configuration specified (e.g. in an env.config.[js|jsx] file in edx-internal) or no overriding plugin in the said plugin configuration, so this deployment strategy isn't necessary. If we merge this as-is, there will be no changes to the IDV page in the learning MFE for 2U or any other deployments. There are more details the frontend-plugin-framework docs. Does that assuage your concerns?

@MichaelRoytman
Copy link
Contributor

Is it necessary to write a test for the application to ensure that the PluginSlot is rendered (e.g something like this)?

Copy link
Contributor

@schenedx schenedx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@rijuma rijuma marked this pull request as draft August 12, 2024 14:39
@rijuma
Copy link
Member Author

rijuma commented Aug 13, 2024

Is it necessary to write a test for the application to ensure that the PluginSlot is rendered (e.g something like this)?

We discussed this offline and we came to the conclusion that adding a test for the index file would be complicated enough to consider it out of scope for this small update.

@rijuma rijuma marked this pull request as ready for review August 13, 2024 13:19
@MaxFrank13
Copy link
Member

MaxFrank13 commented Aug 14, 2024

Hello 👋 I just have one recommendation/request to document the plugin slot using this format in the MFE. You can use frontend-app-learning for reference as well — PluginSlots documentation & PluginSlot being implemented.

This may require you to modify your implementation a bit but it is the way that the open source community has decided PluginSlots should be accounted for. We are still catching up on this with some other PluginSlot implementations in the org (ie. Learner Dashboard), but for new ones, it'd be nice to document them from the start.

@jsnwesson
Copy link

Hey all! Agreeing with Max that it would be nice to have a place where all PluginSlots live. You can reference the Learning MFE to see how they organize three PluginSlots. This will also make testing a PluginSlot much easier, I think.

@rijuma rijuma force-pushed the rijuma/idv-experiment-slot branch 6 times, most recently from 845a98f to 4dfca51 Compare August 16, 2024 13:06
@rijuma rijuma merged commit 27c666c into master Aug 16, 2024
9 checks passed
@rijuma rijuma deleted the rijuma/idv-experiment-slot branch August 16, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants