feat: credit banner (#96)

This commit is contained in:
Ben Warzeski
2022-12-19 13:25:02 -05:00
committed by GitHub
parent a21698e96a
commit 166c64a391
52 changed files with 1678 additions and 141 deletions

View File

@@ -5,6 +5,7 @@ export const categories = StrictDict({
upgrade: 'upgrade',
userEngagement: 'user-engagement',
searchButton: 'search_button',
credit: 'credit',
});
export const events = StrictDict({
@@ -48,6 +49,7 @@ export const eventNames = StrictDict({
enterpriseDashboardModalCTAClicked: `${learnerPortal}.dashboard_cta.clicked`,
enterpriseDashboardModalClosed: `${learnerPortal}.closed`,
findCoursesClicked: 'edx.bi.dashboard.find_courses_button.clicked',
purchaseCredit: 'edx.bi.credit.clicked_purchase_credit',
});
export const linkNames = StrictDict({

View File

@@ -1,4 +1,5 @@
import course from './trackers/course';
import credit from './trackers/credit';
import engagement from './trackers/engagement';
import enterpriseDashboard from './trackers/enterpriseDashboard';
import entitlements from './trackers/entitlements';
@@ -7,6 +8,7 @@ import findCourses from './trackers/findCourses';
export default {
course,
credit,
engagement,
enterpriseDashboard,
entitlements,

View File

@@ -0,0 +1,19 @@
import { createEventTracker, createLinkTracker } from 'data/services/segment/utils';
import { categories, eventNames } from '../constants';
/**
* Create event tracker for purchase credit event
* @param {string} fromCourseRun - course run identifier for leaving course
* @return {callback} - callback that triggers the event tracker
*/
export const purchase = (courseKey, href) => createLinkTracker(
createEventTracker(eventNames.purchaseCredit, {
label: courseKey,
category: categories.credit,
}),
href,
);
export default {
purchase,
};