@edx/frontend-app-subscription-learner-dashboard 1.76.0 → 1.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/containers/ProgramDashboard/ProgramProgress/CompletedTabData/CompletedRecordBanner/index.js +3 -3
- package/dist/containers/ProgramDashboard/ProgramProgress/CompletedTabData/CompletedRecordBanner/index.js.map +1 -1
- package/dist/widgets/LearnerDashboardHeader/app.js +7 -20
- package/dist/widgets/LearnerDashboardHeader/app.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,10 +7,10 @@ import messages from '../../messages';
|
|
|
7
7
|
import './index.scss';
|
|
8
8
|
import { trackProgramProgressHelpCenterButtonClicked, trackProgramProgressMyProgramRecordsButtonClicked } from '../../../../../tracking/trackers/programProgress';
|
|
9
9
|
export const CompletedRecordBanner = () => {
|
|
10
|
-
var _a;
|
|
10
|
+
var _a, _b;
|
|
11
11
|
const { formatMessage } = useIntl();
|
|
12
|
-
const programRecordsUrl = (_a = getAppConfig(appId).PROGRAM_RECORDS_URL) !== null && _a !== void 0 ? _a : '
|
|
13
|
-
const helpCenterUrl =
|
|
12
|
+
const programRecordsUrl = (_a = getAppConfig(appId).PROGRAM_RECORDS_URL) !== null && _a !== void 0 ? _a : ''; // static fallback url is not required as it already exists in app config and edx-internal.
|
|
13
|
+
const helpCenterUrl = (_b = getAppConfig(appId).HELP_CENTER_URL) !== null && _b !== void 0 ? _b : '';
|
|
14
14
|
return (_jsx(Card, { className: "mb-3 mt-4 completed-banner-card", "data-testid": "completed-banner-card", children: _jsxs(Card.Section, { className: "pt-3 pb-3 px-4 border-top", children: [_jsx(Row, { children: _jsxs(Col, { xs: 12, children: [_jsx("h5", { className: "mb-1 font-weight-bold", children: formatMessage(messages.programProgressCompletedBannerTitle) }), _jsx("div", { className: "text-muted", children: formatMessage(messages.programProgressCompletedBannerDescription) })] }) }), _jsx(Row, { className: "mt-3", children: _jsxs(Col, { xs: 12, className: "d-flex justify-content-end", children: [_jsxs(Button, { variant: "outline-primary", className: "mr-2 d-flex align-items-center", as: "a", target: "_blank", rel: "noopener noreferrer", href: helpCenterUrl, onClick: () => trackProgramProgressHelpCenterButtonClicked({ tabSource: formatMessage(messages.programProgressCompletedTab).toLowerCase(), redirection_url: helpCenterUrl, buttonText: formatMessage(messages.programProgressCompletedBannerHelpCenterButton) }), children: [formatMessage(messages.programProgressCompletedBannerHelpCenterButton), _jsx(Icon, { src: OpenInNew, className: "ml-1" })] }), _jsx(Button, { variant: "primary", className: "d-flex align-items-center", as: "a", target: "_blank", rel: "noopener noreferrer", href: `${programRecordsUrl}`, onClick: () => trackProgramProgressMyProgramRecordsButtonClicked({ tabSource: formatMessage(messages.programProgressCompletedTab).toLowerCase(), redirection_url: programRecordsUrl, buttonText: formatMessage(messages.programProgressCompletedBannerMyProgramRecordsButton) }), children: formatMessage(messages.programProgressCompletedBannerMyProgramRecordsButton) })] }) })] }) }));
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/containers/ProgramDashboard/ProgramProgress/CompletedTabData/CompletedRecordBanner/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,2CAA2C,EAAE,iDAAiD,EAAE,MAAM,wCAAwC,CAAC;AAExJ,MAAM,CAAC,MAAM,qBAAqB,GAAO,GAAG,EAAE;;IAC5C,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,iBAAiB,GAAG,MAAA,YAAY,CAAC,KAAK,CAAC,CAAC,mBAAmB,mCAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/containers/ProgramDashboard/ProgramProgress/CompletedTabData/CompletedRecordBanner/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,2CAA2C,EAAE,iDAAiD,EAAE,MAAM,wCAAwC,CAAC;AAExJ,MAAM,CAAC,MAAM,qBAAqB,GAAO,GAAG,EAAE;;IAC5C,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,iBAAiB,GAAG,MAAA,YAAY,CAAC,KAAK,CAAC,CAAC,mBAAmB,mCAAI,EAAE,CAAC,CAAC,2FAA2F;IACpK,MAAM,aAAa,GAAG,MAAA,YAAY,CAAC,KAAK,CAAC,CAAC,eAAe,mCAAI,EAAE,CAAC;IAEhE,OAAO,CACL,KAAC,IAAI,IAAC,SAAS,EAAC,iCAAiC,iBAAa,uBAAuB,YACnF,MAAC,IAAI,CAAC,OAAO,IAAC,SAAS,EAAC,2BAA2B,aACjD,KAAC,GAAG,cACF,MAAC,GAAG,IAAC,EAAE,EAAE,EAAE,aACT,aAAI,SAAS,EAAC,uBAAuB,YAAE,aAAa,CAAC,QAAQ,CAAC,mCAAmC,CAAC,GAAM,EACxG,cAAK,SA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nimport { useIntl, getAppConfig } from '@openedx/frontend-base';\nimport { Card, Button, Row, Col, Icon } from '@openedx/paragon';\nimport { OpenInNew } from '@openedx/paragon/icons';\n\nimport { appId } from '@src/constants';\nimport messages from '../../messages';\nimport './index.scss';\nimport { trackProgramProgressHelpCenterButtonClicked, trackProgramProgressMyProgramRecordsButtonClicked } from '@src/tracking/trackers/programProgress';\n\nexport const CompletedRecordBanner: FC = () => {\n const { formatMessage } = useIntl();\n const programRecordsUrl = getAppConfig(appId).PROGRAM_RECORDS_URL ?? ''; // static fallback url is not required as it already exists in app config and edx-internal.\n const helpCenterUrl = getAppConfig(appId).HELP_CENTER_URL ?? '';\n\n return (\n <Card className=\"mb-3 mt-4 completed-banner-card\" data-testid=\"completed-banner-card\">\n <Card.Section className=\"pt-3 pb-3 px-4 border-top\">\n <Row>\n <Col xs={12}>\n <h5 className=\"mb-1 font-weight-bold\">{formatMessage(messages.programProgressCompletedBannerTitle)}</h5>\n <div className=\"text-muted\">\n {formatMessage(messages.programProgressCompletedBannerDescription)}\n </div>\n </Col>\n </Row>\n\n <Row className=\"mt-3\">\n <Col xs={12} className=\"d-flex justify-content-end\">\n <Button\n variant=\"outline-primary\"\n className=\"mr-2 d-flex align-items-center\"\n as=\"a\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={helpCenterUrl as string}\n onClick={() => trackProgramProgressHelpCenterButtonClicked({ tabSource: formatMessage(messages.programProgressCompletedTab).toLowerCase(), redirection_url: helpCenterUrl, buttonText: formatMessage(messages.programProgressCompletedBannerHelpCenterButton) })}\n >\n {formatMessage(messages.programProgressCompletedBannerHelpCenterButton)}\n <Icon src={OpenInNew} className=\"ml-1\" />\n </Button>\n <Button\n variant=\"primary\"\n className=\"d-flex align-items-center\"\n as=\"a\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={`${programRecordsUrl}`}\n onClick={() => trackProgramProgressMyProgramRecordsButtonClicked({ tabSource: formatMessage(messages.programProgressCompletedTab).toLowerCase(), redirection_url: programRecordsUrl, buttonText: formatMessage(messages.programProgressCompletedBannerMyProgramRecordsButton) })}\n >\n {formatMessage(messages.programProgressCompletedBannerMyProgramRecordsButton)}\n </Button>\n </Col>\n </Row>\n </Card.Section>\n </Card>\n );\n};\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
3
|
import { useCallback, useState } from 'react';
|
|
3
4
|
import { LinkMenuItem, WidgetOperationTypes, getAppConfig, useSiteEvent, } from '@openedx/frontend-base';
|
|
@@ -15,15 +16,13 @@ import SiteLogo from './SiteLogo';
|
|
|
15
16
|
const trackHeaderLinkClick = (url, eventName) => {
|
|
16
17
|
createEventTracker(eventName, { category: categories.header, label: url })();
|
|
17
18
|
};
|
|
19
|
+
const isSubscriber = (_a = window.__EDX_IS_SUBSCRIBER__) !== null && _a !== void 0 ? _a : getCommonTrackingProps().isSubscriber;
|
|
18
20
|
const isSubscriptionContext = () => {
|
|
19
|
-
var _a
|
|
21
|
+
var _a;
|
|
20
22
|
if (typeof window === 'undefined') {
|
|
21
23
|
return false;
|
|
22
24
|
}
|
|
23
25
|
const pathname = ((_a = window.location) === null || _a === void 0 ? void 0 : _a.pathname) || '';
|
|
24
|
-
// Determine if the user is a subscriber based on the window variable or tracking props
|
|
25
|
-
// to determine the subscription context.
|
|
26
|
-
const isSubscriber = (_b = window.__EDX_IS_SUBSCRIBER__) !== null && _b !== void 0 ? _b : getCommonTrackingProps().isSubscriber;
|
|
27
26
|
return isSubscriber === true
|
|
28
27
|
&& SUBSCRIPTION_ROUTE_PREFIXES.some(prefix => pathname.startsWith(prefix));
|
|
29
28
|
};
|
|
@@ -36,12 +35,12 @@ const SubscribeLink = () => {
|
|
|
36
35
|
}
|
|
37
36
|
}, []);
|
|
38
37
|
useSiteEvent('org.openedx.frontend.event.subscriptionCheckout.paymentStateChanged.v1', handlePaymentStateChanged);
|
|
39
|
-
if (isPaid ||
|
|
38
|
+
if (isPaid || isSubscriber === true) {
|
|
40
39
|
return null;
|
|
41
40
|
}
|
|
42
41
|
return (_jsx("div", { className: "d-inline-flex align-items-center text-warning text-decoration-none subscribe-header-navlink px-3", children: _jsx(LinkMenuItem, { label: messages['header.user.menu.subscribe'].defaultMessage, url: "/checkout", variant: "hyperlink" }) }));
|
|
43
42
|
};
|
|
44
|
-
const dashboardURL =
|
|
43
|
+
const dashboardURL = isSubscriber === true ? subscriptionDashboardUrlPath : learnerDashboardUrlPath;
|
|
45
44
|
const app = {
|
|
46
45
|
appId: 'org.openedx.frontend.app.learnerDashboard.header',
|
|
47
46
|
slots: [
|
|
@@ -92,8 +91,8 @@ const app = {
|
|
|
92
91
|
element: _jsx(SubscribeLink, {}),
|
|
93
92
|
condition: {
|
|
94
93
|
callback: () => typeof window !== 'undefined'
|
|
95
|
-
&& (window.location.pathname.startsWith('/checkout') || window.location.pathname.startsWith('/aca-'))
|
|
96
|
-
&&
|
|
94
|
+
&& (window.location.pathname.startsWith('/checkout') || window.location.pathname.startsWith('/aca-') || window.location.pathname.startsWith('/order-'))
|
|
95
|
+
&& isSubscriber !== true,
|
|
97
96
|
},
|
|
98
97
|
},
|
|
99
98
|
{
|
|
@@ -101,18 +100,6 @@ const app = {
|
|
|
101
100
|
id: 'org.edx.frontend.widget.learnerHome.headerLinkDashboard.v1',
|
|
102
101
|
op: WidgetOperationTypes.PREPEND,
|
|
103
102
|
element: (_jsx("div", { className: "px-3 dashboard-header-navlink", onClick: () => trackHeaderLinkClick(dashboardURL, eventNames.headerDashboardLinkClicked), children: _jsx(LinkMenuItem, { label: messages['header.user.menu.dashboard'].defaultMessage, url: dashboardURL, variant: "hyperlink" }) })),
|
|
104
|
-
condition: {
|
|
105
|
-
callback: () => isSubscriptionContext() || (typeof window !== 'undefined' && window.location.pathname.startsWith('/aca-')),
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',
|
|
110
|
-
id: 'org.edx.frontend.widget.header.user.menu.manageSubscription.v1',
|
|
111
|
-
op: WidgetOperationTypes.APPEND,
|
|
112
|
-
element: (_jsx("div", { onClick: () => trackHeaderLinkClick('/order-history', eventNames.headerOrderHistoryClicked), children: _jsx(LinkMenuItem, { label: messages['header.user.menu.manageSubscription'].defaultMessage, url: "/order-history", variant: "dropdownItem" }) })),
|
|
113
|
-
condition: {
|
|
114
|
-
callback: () => isSubscriptionContext(),
|
|
115
|
-
},
|
|
116
103
|
},
|
|
117
104
|
{
|
|
118
105
|
slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/widgets/LearnerDashboardHeader/app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAEL,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,YAAY,GACb,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,KAAK,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,QAAQ,MAAM,YAAY,CAAC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SAAS,EAAE,kDAAkD;YAC7D,OAAO,EAAE,mBAAK;SACf;QACD,IAAI;QACJ,8GAA8G;QAC9G,yDAAyD;QACzD,qEAAqE;QACrE,6FAA6F;QAC7F,sCAAsC;QACtC,eAAe;QACf,oBAAoB;QACpB,uEAAuE;QACvE,2BAA2B;QAC3B,+BAA+B;QAC/B,SAAS;QACT,MAAM;QACN,KAAK;KACN;CACF,CAAC;AAEF,eAAe,GAAG,CAAC","sourcesContent":["import { useCallback, useState } from 'react';\nimport {\n App,\n LinkMenuItem,\n WidgetOperationTypes,\n getAppConfig,\n useSiteEvent,\n} from '@openedx/frontend-base';\n\nimport {\n appId,\n subscriptionDashboardUrlPath,\n subscriptionSignoutRole,\n SUBSCRIPTION_ROUTE_PREFIXES,\n learnerDashboardUrlPath,\n} from '../../constants';\n\nimport { createEventTracker } from '../../data/services/segment/utils';\nimport { categories, eventNames } from '../../tracking/constants';\nimport { getCommonTrackingProps } from '@src/tracking';\n\nimport ConfirmEmailBanner from './ConfirmEmailBanner';\nimport ProgramsLinkMenuItem from './ProgramsLinkMenuItem';\nimport SupportLinkMenuItem from './SupportLinkMenuItem';\nimport OrderHistoryLinkMenuItem from './OrderHistoryLinkMenuItem';\nimport messages from '@src/messages';\nimport CustomAvatarMenu from './CustomAvatarMenu';\nimport SiteLogo from './SiteLogo';\n\nconst trackHeaderLinkClick = (url: string, eventName: string) => {\n createEventTracker(\n eventName,\n { category: categories.header, label: url }\n )();\n};\n\nconst isSubscriptionContext = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n const pathname = window.location?.pathname || '';\n\n // Determine if the user is a subscriber based on the window variable or tracking props\n // to determine the subscription context.\n const isSubscriber = (window as Window & { __EDX_IS_SUBSCRIBER__?: boolean }).__EDX_IS_SUBSCRIBER__\n ?? getCommonTrackingProps().isSubscriber;\n\n return isSubscriber === true\n && SUBSCRIPTION_ROUTE_PREFIXES.some(prefix => pathname.startsWith(prefix));\n};\n\nconst SubscribeLink = () => {\n const [isPaid, setIsPaid] = useState(false);\n const handlePaymentStateChanged = useCallback(\n (_topic: string, data?: { isPaid: boolean }) => {\n // Checkout cleanup must not undo a successful payment.\n if (data?.isPaid === true) {\n setIsPaid(true);\n }\n }, []);\n\n useSiteEvent(\n 'org.openedx.frontend.event.subscriptionCheckout.paymentStateChanged.v1',\n handlePaymentStateChanged,\n );\n\n if (isPaid || getCommonTrackingProps().isSubscriber === true) {\n return null;\n }\n\n return (\n <div className=\"d-inline-flex align-items-center text-warning text-decoration-none subscribe-header-navlink px-3\">\n <LinkMenuItem\n label={messages['header.user.menu.subscribe'].defaultMessage}\n url=\"/checkout\"\n variant=\"hyperlink\"\n />\n </div>\n );\n};\n\nconst dashboardURL = getCommonTrackingProps().isSubscriber === true ? subscriptionDashboardUrlPath : learnerDashboardUrlPath;\n\nconst app: App = {\n appId: 'org.openedx.frontend.app.learnerDashboard.header',\n slots: [\n {\n slotId: 'org.openedx.frontend.slot.header.main.v1',\n id: 'org.openedx.frontend.widget.learnerDashboard.headerConfirmEmail.v1',\n op: WidgetOperationTypes.PREPEND,\n component: ConfirmEmailBanner,\n condition: {\n callback: () => isSubscriptionContext(),\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.primaryLinks.v1',\n id: 'org.openedx.frontend.widget.learnerDashboard.headerLinkPrograms.v1',\n op: WidgetOperationTypes.APPEND,\n element: (\n <div onClick={() => trackHeaderLinkClick('programs', eventNames.headerProgramsLinkClicked)}>\n <ProgramsLinkMenuItem variant=\"navLink\" />\n </div>\n ),\n condition: {\n callback: () =>\n getAppConfig(appId).ENABLE_PROGRAMS === true\n && isSubscriptionContext(),\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',\n id: 'org.openedx.frontend.widget.learnerDashboard.headerLinkSupport.v1',\n op: WidgetOperationTypes.APPEND,\n element: (\n <div onClick={() => trackHeaderLinkClick('support', eventNames.headerSupportLinkClicked)}>\n <SupportLinkMenuItem variant=\"dropdownItem\" />\n </div>\n ),\n condition: {\n callback: () =>\n Boolean(getAppConfig(appId).SUPPORT_URL) && isSubscriptionContext(),\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',\n id: 'org.openedx.frontend.widget.learnerDashboard.headerLinkOrderHistory.v1',\n op: WidgetOperationTypes.INSERT_BEFORE,\n relatedId:\n 'org.openedx.frontend.widget.header.desktopAuthenticatedMenuLogout.v1',\n element: (\n <div onClick={() => trackHeaderLinkClick('order-history', eventNames.headerOrderHistoryLinkClicked)}>\n <OrderHistoryLinkMenuItem variant=\"navLink\" />\n </div>\n ),\n condition: {\n callback: () =>\n Boolean(getAppConfig(appId).ORDER_HISTORY_URL)\n && isSubscriptionContext(),\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.desktopRight.v1',\n id: 'org.edx.frontend.widget.learnerHome.headerLinkSubscribe.v1',\n op: WidgetOperationTypes.INSERT_BEFORE,\n relatedId: 'org.edx.frontend.widget.learnerHome.headerLinkDashboard.v1',\n element: <SubscribeLink />,\n condition: {\n callback: () =>\n typeof window !== 'undefined'\n && (window.location.pathname.startsWith('/checkout') || window.location.pathname.startsWith('/aca-'))\n && getCommonTrackingProps().isSubscriber !== true,\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.desktopRight.v1',\n id: 'org.edx.frontend.widget.learnerHome.headerLinkDashboard.v1',\n op: WidgetOperationTypes.PREPEND,\n element: (\n <div\n className=\"px-3 dashboard-header-navlink\"\n onClick={() => trackHeaderLinkClick(dashboardURL, eventNames.headerDashboardLinkClicked)}\n >\n <LinkMenuItem\n label={messages['header.user.menu.dashboard'].defaultMessage}\n url={dashboardURL}\n variant=\"hyperlink\"\n />\n </div>\n ),\n condition: {\n callback: () => isSubscriptionContext() || (typeof window !== 'undefined' && window.location.pathname.startsWith('/aca-')),\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',\n id: 'org.edx.frontend.widget.header.user.menu.manageSubscription.v1',\n op: WidgetOperationTypes.APPEND,\n element: (\n <div onClick={() => trackHeaderLinkClick('/order-history', eventNames.headerOrderHistoryClicked)}>\n <LinkMenuItem\n label={messages['header.user.menu.manageSubscription'].defaultMessage}\n url=\"/order-history\"\n variant=\"dropdownItem\"\n />\n </div>\n ),\n condition: {\n callback: () => isSubscriptionContext(),\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',\n id: 'org.edx.frontend.widget.learnerDashboard.headerAuthenticatedMenuSignOut.v1',\n op: WidgetOperationTypes.APPEND,\n element: (\n <div onClick={() => trackHeaderLinkClick('', eventNames.headerUserSignOut)}>\n <LinkMenuItem\n label={messages['header.user.menu.signOut'].defaultMessage}\n role={subscriptionSignoutRole}\n variant=\"dropdownItem\"\n />\n </div>\n ),\n },\n {\n slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',\n id: 'org.edx.frontend.widget.learnerDashboard.dashboard.v1',\n op: WidgetOperationTypes.PREPEND,\n element: (\n <div onClick={() => trackHeaderLinkClick(dashboardURL, eventNames.headerDashboardLinkClicked)}>\n <LinkMenuItem\n label={messages['header.user.menu.dashboard'].defaultMessage}\n url={dashboardURL}\n variant=\"dropdownItem\"\n />\n </div>\n ),\n condition: {\n callback: () => isSubscriptionContext(),\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.desktopRight.v1',\n id: 'org.openedx.frontend.widget.header.desktopAuthenticatedMenu.v1',\n op: WidgetOperationTypes.REPLACE,\n relatedId:\n 'org.openedx.frontend.widget.header.desktopAuthenticatedMenu.v1',\n element: <CustomAvatarMenu />,\n condition: {\n authenticated: true,\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.mobileRight.v1',\n id: 'org.example.site.widget.header.mobileAuthenticatedMenu.v1',\n op: WidgetOperationTypes.REPLACE,\n relatedId:\n 'org.openedx.frontend.widget.header.mobileAuthenticatedMenu.v1',\n element: <CustomAvatarMenu />,\n condition: {\n authenticated: true,\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.desktopLeft.v1',\n id: 'org.openedx.frontend.widget.learnerDashboard.header.desktopLogo.v1',\n op: WidgetOperationTypes.REPLACE,\n relatedId: 'org.openedx.frontend.widget.header.desktopLogo.v1',\n element: <SiteLogo />,\n },\n {\n slotId: 'org.openedx.frontend.slot.header.mobileLeft.v1',\n id: 'org.example.site.widget.header.mobileLogoLeft.v1',\n op: WidgetOperationTypes.APPEND,\n element: <SiteLogo />,\n },\n {\n slotId: 'org.openedx.frontend.slot.header.mobileCenter.v1',\n id: 'org.example.site.widget.header.mobileLogoCenterReplace.v1',\n op: WidgetOperationTypes.REPLACE,\n relatedId: 'org.openedx.frontend.widget.header.mobileLogo.v1',\n element: <></>,\n },\n // {\n // // TO-DO : Resume your last course will be implemented seprately in a different ticket.(Ticket: SUBS-818)\n // // https://2u-internal.atlassian.net/browse/SUBS-818\n // slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',\n // id: 'org.openedx.frontend.widget.learnerDashboard.headerAuthenticatedMenuLastCourse.v1',\n // op: WidgetOperationTypes.PREPEND,\n // element: (\n // <LinkMenuItem\n // label={messages['header.user.menu.lastCourse'].defaultMessage}\n // url=\"/last-course\"\n // variant=\"dropdownItem\"\n // />\n // )\n // },\n ],\n};\n\nexport default app;\n"]}
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/widgets/LearnerDashboardHeader/app.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAEL,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,YAAY,GACb,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,KAAK,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,0BA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useState } from 'react';\nimport {\n App,\n LinkMenuItem,\n WidgetOperationTypes,\n getAppConfig,\n useSiteEvent,\n} from '@openedx/frontend-base';\n\nimport {\n appId,\n subscriptionDashboardUrlPath,\n subscriptionSignoutRole,\n SUBSCRIPTION_ROUTE_PREFIXES,\n learnerDashboardUrlPath,\n} from '../../constants';\n\nimport { createEventTracker } from '../../data/services/segment/utils';\nimport { categories, eventNames } from '../../tracking/constants';\nimport { getCommonTrackingProps } from '@src/tracking';\n\nimport ConfirmEmailBanner from './ConfirmEmailBanner';\nimport ProgramsLinkMenuItem from './ProgramsLinkMenuItem';\nimport SupportLinkMenuItem from './SupportLinkMenuItem';\nimport OrderHistoryLinkMenuItem from './OrderHistoryLinkMenuItem';\nimport messages from '@src/messages';\nimport CustomAvatarMenu from './CustomAvatarMenu';\nimport SiteLogo from './SiteLogo';\n\nconst trackHeaderLinkClick = (url: string, eventName: string) => {\n createEventTracker(\n eventName,\n { category: categories.header, label: url }\n )();\n};\n\nconst isSubscriber\n = (window as Window & { __EDX_IS_SUBSCRIBER__?: boolean }).__EDX_IS_SUBSCRIBER__\n ?? getCommonTrackingProps().isSubscriber;\n\nconst isSubscriptionContext = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n const pathname = window.location?.pathname || '';\n\n return isSubscriber === true\n && SUBSCRIPTION_ROUTE_PREFIXES.some(prefix => pathname.startsWith(prefix));\n};\n\nconst SubscribeLink = () => {\n const [isPaid, setIsPaid] = useState(false);\n const handlePaymentStateChanged = useCallback(\n (_topic: string, data?: { isPaid: boolean }) => {\n // Checkout cleanup must not undo a successful payment.\n if (data?.isPaid === true) {\n setIsPaid(true);\n }\n }, []);\n\n useSiteEvent(\n 'org.openedx.frontend.event.subscriptionCheckout.paymentStateChanged.v1',\n handlePaymentStateChanged,\n );\n\n if (isPaid || isSubscriber === true) {\n return null;\n }\n\n return (\n <div className=\"d-inline-flex align-items-center text-warning text-decoration-none subscribe-header-navlink px-3\">\n <LinkMenuItem\n label={messages['header.user.menu.subscribe'].defaultMessage}\n url=\"/checkout\"\n variant=\"hyperlink\"\n />\n </div>\n );\n};\n\nconst dashboardURL = isSubscriber === true ? subscriptionDashboardUrlPath : learnerDashboardUrlPath;\n\nconst app: App = {\n appId: 'org.openedx.frontend.app.learnerDashboard.header',\n slots: [\n {\n slotId: 'org.openedx.frontend.slot.header.main.v1',\n id: 'org.openedx.frontend.widget.learnerDashboard.headerConfirmEmail.v1',\n op: WidgetOperationTypes.PREPEND,\n component: ConfirmEmailBanner,\n condition: {\n callback: () => isSubscriptionContext(),\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.primaryLinks.v1',\n id: 'org.openedx.frontend.widget.learnerDashboard.headerLinkPrograms.v1',\n op: WidgetOperationTypes.APPEND,\n element: (\n <div onClick={() => trackHeaderLinkClick('programs', eventNames.headerProgramsLinkClicked)}>\n <ProgramsLinkMenuItem variant=\"navLink\" />\n </div>\n ),\n condition: {\n callback: () =>\n getAppConfig(appId).ENABLE_PROGRAMS === true\n && isSubscriptionContext(),\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',\n id: 'org.openedx.frontend.widget.learnerDashboard.headerLinkSupport.v1',\n op: WidgetOperationTypes.APPEND,\n element: (\n <div onClick={() => trackHeaderLinkClick('support', eventNames.headerSupportLinkClicked)}>\n <SupportLinkMenuItem variant=\"dropdownItem\" />\n </div>\n ),\n condition: {\n callback: () =>\n Boolean(getAppConfig(appId).SUPPORT_URL) && isSubscriptionContext(),\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',\n id: 'org.openedx.frontend.widget.learnerDashboard.headerLinkOrderHistory.v1',\n op: WidgetOperationTypes.INSERT_BEFORE,\n relatedId:\n 'org.openedx.frontend.widget.header.desktopAuthenticatedMenuLogout.v1',\n element: (\n <div onClick={() => trackHeaderLinkClick('order-history', eventNames.headerOrderHistoryLinkClicked)}>\n <OrderHistoryLinkMenuItem variant=\"navLink\" />\n </div>\n ),\n condition: {\n callback: () =>\n Boolean(getAppConfig(appId).ORDER_HISTORY_URL)\n && isSubscriptionContext(),\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.desktopRight.v1',\n id: 'org.edx.frontend.widget.learnerHome.headerLinkSubscribe.v1',\n op: WidgetOperationTypes.INSERT_BEFORE,\n relatedId: 'org.edx.frontend.widget.learnerHome.headerLinkDashboard.v1',\n element: <SubscribeLink />,\n condition: {\n callback: () =>\n typeof window !== 'undefined'\n && (window.location.pathname.startsWith('/checkout') || window.location.pathname.startsWith('/aca-') || window.location.pathname.startsWith('/order-'))\n && isSubscriber !== true,\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.desktopRight.v1',\n id: 'org.edx.frontend.widget.learnerHome.headerLinkDashboard.v1',\n op: WidgetOperationTypes.PREPEND,\n element: (\n <div\n className=\"px-3 dashboard-header-navlink\"\n onClick={() => trackHeaderLinkClick(dashboardURL, eventNames.headerDashboardLinkClicked)}\n >\n <LinkMenuItem\n label={messages['header.user.menu.dashboard'].defaultMessage}\n url={dashboardURL}\n variant=\"hyperlink\"\n />\n </div>\n ),\n },\n {\n slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',\n id: 'org.edx.frontend.widget.learnerDashboard.headerAuthenticatedMenuSignOut.v1',\n op: WidgetOperationTypes.APPEND,\n element: (\n <div onClick={() => trackHeaderLinkClick('', eventNames.headerUserSignOut)}>\n <LinkMenuItem\n label={messages['header.user.menu.signOut'].defaultMessage}\n role={subscriptionSignoutRole}\n variant=\"dropdownItem\"\n />\n </div>\n ),\n },\n {\n slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',\n id: 'org.edx.frontend.widget.learnerDashboard.dashboard.v1',\n op: WidgetOperationTypes.PREPEND,\n element: (\n <div onClick={() => trackHeaderLinkClick(dashboardURL, eventNames.headerDashboardLinkClicked)}>\n <LinkMenuItem\n label={messages['header.user.menu.dashboard'].defaultMessage}\n url={dashboardURL}\n variant=\"dropdownItem\"\n />\n </div>\n ),\n condition: {\n callback: () => isSubscriptionContext(),\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.desktopRight.v1',\n id: 'org.openedx.frontend.widget.header.desktopAuthenticatedMenu.v1',\n op: WidgetOperationTypes.REPLACE,\n relatedId:\n 'org.openedx.frontend.widget.header.desktopAuthenticatedMenu.v1',\n element: <CustomAvatarMenu />,\n condition: {\n authenticated: true,\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.mobileRight.v1',\n id: 'org.example.site.widget.header.mobileAuthenticatedMenu.v1',\n op: WidgetOperationTypes.REPLACE,\n relatedId:\n 'org.openedx.frontend.widget.header.mobileAuthenticatedMenu.v1',\n element: <CustomAvatarMenu />,\n condition: {\n authenticated: true,\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.desktopLeft.v1',\n id: 'org.openedx.frontend.widget.learnerDashboard.header.desktopLogo.v1',\n op: WidgetOperationTypes.REPLACE,\n relatedId: 'org.openedx.frontend.widget.header.desktopLogo.v1',\n element: <SiteLogo />,\n },\n {\n slotId: 'org.openedx.frontend.slot.header.mobileLeft.v1',\n id: 'org.example.site.widget.header.mobileLogoLeft.v1',\n op: WidgetOperationTypes.APPEND,\n element: <SiteLogo />,\n },\n {\n slotId: 'org.openedx.frontend.slot.header.mobileCenter.v1',\n id: 'org.example.site.widget.header.mobileLogoCenterReplace.v1',\n op: WidgetOperationTypes.REPLACE,\n relatedId: 'org.openedx.frontend.widget.header.mobileLogo.v1',\n element: <></>,\n },\n // {\n // // TO-DO : Resume your last course will be implemented seprately in a different ticket.(Ticket: SUBS-818)\n // // https://2u-internal.atlassian.net/browse/SUBS-818\n // slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',\n // id: 'org.openedx.frontend.widget.learnerDashboard.headerAuthenticatedMenuLastCourse.v1',\n // op: WidgetOperationTypes.PREPEND,\n // element: (\n // <LinkMenuItem\n // label={messages['header.user.menu.lastCourse'].defaultMessage}\n // url=\"/last-course\"\n // variant=\"dropdownItem\"\n // />\n // )\n // },\n ],\n};\n\nexport default app;\n"]}
|