Skip to content

feat: Version 2 Created the plugin slot for UpgradeToCompleteAlert#47

Merged
mshet-sonata-pixel merged 1 commit into
release-teakfrom
SUBS-173-v22
Apr 1, 2026
Merged

feat: Version 2 Created the plugin slot for UpgradeToCompleteAlert#47
mshet-sonata-pixel merged 1 commit into
release-teakfrom
SUBS-173-v22

Conversation

@mshet-sonata-pixel
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings March 27, 2026 16:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new plugin slot intended to support upgrade-related messaging in the Course Home “Dates” banner area, and wires the Dates tab to render that slot.

Changes:

  • Added BannerDatesUpgradeSlot with slot ID org.openedx.frontend.learning.banner_dates_upgrade.v1 (+ alias) and documentation.
  • Updated DatesTab to render the new plugin slot in place of UpgradeToCompleteAlert.
  • Updated Dates tab tests to reflect the new default rendering behavior (and removed the prior analytics test for the old alert).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/plugin-slots/README.md Registers the new slot in the plugin slots index.
src/plugin-slots/BannerDatesUpgradeSlot/index.tsx Introduces the new PluginSlot wrapper component for the dates upgrade banner.
src/plugin-slots/BannerDatesUpgradeSlot/README.md Documents the slot’s ID, aliases, and intended usage.
src/course-home/dates-tab/DatesTab.jsx Replaces UpgradeToCompleteAlert with BannerDatesUpgradeSlot.
src/course-home/dates-tab/DatesTab.test.jsx Updates expectations to no longer render UpgradeToCompleteAlert by default and removes the related analytics click test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/course-home/dates-tab/DatesTab.jsx Outdated
Comment on lines 54 to 55
<BannerDatesUpgradeSlot courseId={courseId} />
<UpgradeToShiftDatesAlert logUpgradeLinkClick={logUpgradeLinkClick} model="dates" />
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

Swapping UpgradeToCompleteAlert for BannerDatesUpgradeSlot changes the default UX: the upgrade-to-complete banner (and its click analytics) will no longer appear unless a plugin supplies it. If the intent is only to introduce a plugin extension point, consider keeping the existing alert as the slot’s default children (or otherwise preserving the current behavior) and pass through any needed props (e.g., the existing logUpgradeLinkClick).

Suggested change
<BannerDatesUpgradeSlot courseId={courseId} />
<UpgradeToShiftDatesAlert logUpgradeLinkClick={logUpgradeLinkClick} model="dates" />
<BannerDatesUpgradeSlot courseId={courseId}>
<UpgradeToShiftDatesAlert logUpgradeLinkClick={logUpgradeLinkClick} model="dates" />
</BannerDatesUpgradeSlot>

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agree with co-pilot. Let's keep the Alert as the default content for now until we actually remove the component from frontend-app-learning. I know the ticket said to remove it but I think we should reconsider that. We can remove the default via env.config.js instead.

Comment on lines +5 to +14
export const BannerDatesUpgradeSlot = ({
courseId,
}: BannerDatesUpgradeSlotProps) => (
<PluginSlot
id="org.openedx.frontend.learning.banner_dates_upgrade.v1"
idAliases={['dates_upgrade_banner_slot']}
pluginProps={{
courseId,
}}
/>
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

This slot currently renders no default content and only passes courseId. If it is meant to be the extension point for the existing Upgrade-to-Complete banner, consider rendering the current default alert as PluginSlot children (so behavior stays the same when no plugins are installed) and include any additional pluginProps/callbacks needed to avoid duplicating logic (e.g., the upgrade click analytics handler / upgrade URL).

Copilot uses AI. Check for mistakes.
Comment on lines +174 to +187
@@ -182,8 +182,9 @@ describe('DatesTab', () => {
axiosMock.onGet(datesUrl).reply(200, datesTabData);
render(component);

await waitFor(() => expect(screen.getByText('You are auditing this course, which means that you are unable to participate in graded assignments. To complete graded assignments as part of this course, you can upgrade today.')).toBeInTheDocument());
expect(screen.getByRole('button', { name: 'Upgrade now' })).toBeInTheDocument();
await waitFor(() => expect(screen.getByText('We’ve built a suggested schedule to help you stay on track. But don’t worry—it’s flexible so you can learn at your own pace.')).toBeInTheDocument());
expect(screen.queryByText('You are auditing this course, which means that you are unable to participate in graded assignments. To complete graded assignments as part of this course, you can upgrade today.')).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: 'Upgrade now' })).not.toBeInTheDocument();
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The updated test now asserts that UpgradeToCompleteAlert does not render by default, which reflects a behavioral change (the alert previously rendered for eligible audit learners). If the PR’s scope is just “create a plugin slot”, the test should continue to expect the default alert (potentially rendered as the slot’s fallback) and keep equivalent coverage for the upgrade-button analytics event.

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +15
### Props:
* `courseId` - The course ID (string)

### Example Usage
Plugins can inject components here to show upgrade-related alerts and notifications in the dates banner section.
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

This README describes the slot as enabling upgrade notifications, but it doesn’t clarify whether anything renders by default (without plugins) or how it relates to the existing UpgradeToCompleteAlert behavior. Please document whether the slot includes a default fallback and, if not, note that plugins must provide the entire alert/analytics behavior.

Suggested change
### Props:
* `courseId` - The course ID (string)
### Example Usage
Plugins can inject components here to show upgrade-related alerts and notifications in the dates banner section.
### Default behavior
By default, this slot does not render any UI or trigger any analytics on its own; if no plugins target this slot, nothing additional will appear in the dates banner section.
This slot does not automatically reuse or wrap existing upgrade experiences such as `UpgradeToCompleteAlert`—plugins are responsible for providing the full alert component, user interactions, and any associated tracking or reporting behavior.
### Props:
* `courseId` - The course ID (string)
### Example Usage
Plugins can inject components here to show upgrade-related alerts and notifications in the dates banner section, including any desired visual treatment, call-to-action buttons, and analytics/tracking events.

Copilot uses AI. Check for mistakes.
@mshet-sonata-pixel mshet-sonata-pixel changed the title feat: Created the plugin slot for UpgradeToCompleteAlert feat: Version 2 Created the plugin slot for UpgradeToCompleteAlert Mar 27, 2026
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread src/plugin-slots/BannerDatesUpgradeSlot/README.md Outdated
Copilot AI review requested due to automatic review settings April 1, 2026 04:53
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/course-home/dates-tab/DatesTab.test.jsx:281

  • The analytics test for the upgrade button in UpgradeToCompleteAlert was removed. Since BannerDatesUpgradeSlot still renders UpgradeToCompleteAlert by default (and logUpgradeLinkClick still sends the track event), losing this assertion reduces coverage and could hide regressions in upgrade-click tracking on the Dates tab. Consider restoring a test that clicks "Upgrade now" and verifies sendTrackEvent payloads.
    it('sends analytics event onClick of upgrade button in UpgradeToShiftDatesAlert', async () => {
      sendTrackEvent.mockClear();
      datesTabData.datesBannerInfo = {
        contentTypeGatingEnabled: true,
        missedDeadlines: true,
        missedGatedContent: true,
        verifiedUpgradeLink: 'http://localhost:18130/basket/add/?sku=8CF08E5',
      };

      axiosMock.onGet(datesUrl).reply(200, datesTabData);
      render(component);

      const upgradeButton = await waitFor(() => screen.getByRole('button', { name: 'Upgrade to shift due dates' }));
      fireEvent.click(upgradeButton);

      expect(sendTrackEvent).toHaveBeenCalledTimes(1);
      expect(sendTrackEvent).toHaveBeenCalledWith('edx.bi.ecommerce.upsell_links_clicked', {
        org_key: 'edX',
        courserun_key: courseId,
        linkCategory: 'personalized_learner_schedules',
        linkName: 'dates_upgrade',
        linkType: 'button',
        pageName: 'dates_tab',
      });
    });

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +4
# Banner Dates Upgrade Slot

### Slot ID: `org.openedx.frontend.learning.banner_dates_upgrade.v1`

Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

PR title mentions "Version 2", but this slot is introduced as org.openedx.frontend.learning.banner_dates_upgrade.v1 here (and in the code). If the intent is a v2 slot, the ID/docs should be updated accordingly; otherwise consider adjusting the PR title to avoid confusion for plugin integrators.

Copilot uses AI. Check for mistakes.
@mshet-sonata-pixel mshet-sonata-pixel merged commit 283be48 into release-teak Apr 1, 2026
4 checks passed
@mshet-sonata-pixel mshet-sonata-pixel deleted the SUBS-173-v22 branch April 1, 2026 05:53
@mshet-sonata-pixel mshet-sonata-pixel restored the SUBS-173-v22 branch May 4, 2026 14:08
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.

3 participants