* feat: subscription changes on program dashboard and details (#31909) - add a h2 programs heading on program dashboard - subscription ui changes on program dashboard - subscription alerts on both pages * feat: add subscription upsell, fix responsive layout of program dashboard (#31943) * test: update tests for subscription changes on program dashboard (#32021) * feat: subscription api changes on program dashboard (#32085) * feat: add subscription segment events to program details and dashboard (#32164) * feat: subscription changes on program dashboard and details pages (#32205)
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
import Backbone from 'backbone';
|
|
|
|
import HtmlUtils from 'edx-ui-toolkit/js/utils/html-utils';
|
|
|
|
import NewProgramsView from './explore_new_programs_view';
|
|
import SubscriptionUpsellView from './subscription_upsell_view';
|
|
|
|
import sidebarTpl from '../../../templates/learner_dashboard/sidebar.underscore';
|
|
|
|
class SidebarView extends Backbone.View {
|
|
constructor(options) {
|
|
const defaults = {
|
|
el: '.sidebar',
|
|
events: {
|
|
'click .js-subscription-upsell-cta ': 'trackSubscriptionUpsellCTA',
|
|
},
|
|
};
|
|
super(Object.assign({}, defaults, options));
|
|
}
|
|
|
|
initialize(data) {
|
|
this.tpl = HtmlUtils.template(sidebarTpl);
|
|
this.context = data.context;
|
|
}
|
|
|
|
render() {
|
|
HtmlUtils.setHtml(this.$el, this.tpl(this.context));
|
|
this.postRender();
|
|
}
|
|
|
|
postRender() {
|
|
if (this.context.isUserB2CSubscriptionsEnabled) {
|
|
this.subscriptionUpsellView = new SubscriptionUpsellView({
|
|
context: this.context,
|
|
});
|
|
}
|
|
|
|
this.newProgramsView = new NewProgramsView({
|
|
context: this.context,
|
|
});
|
|
}
|
|
|
|
trackSubscriptionUpsellCTA() {
|
|
window.analytics.track(
|
|
'edx.bi.user.subscription.program-dashboard.upsell.clicked'
|
|
);
|
|
}
|
|
}
|
|
|
|
export default SidebarView;
|