@edx/frontend-app-subscription-learner-dashboard 1.70.0 → 1.70.1
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/constants.d.ts
CHANGED
|
@@ -15,3 +15,4 @@ export declare const subscriptionProgramProgressRole = "org.edx.frontend.subs.ro
|
|
|
15
15
|
export declare const subscriptionDashboardUrlPath = "/subscription-learner-dashboard";
|
|
16
16
|
export declare const SUBSCRIPTION_ROUTE_PREFIXES: string[];
|
|
17
17
|
export declare const NON_SUBSCRIPTION_ROUTE_PREFIXES: string[];
|
|
18
|
+
export declare const learnerDashboardUrlPath = "/learner-dashboard";
|
package/dist/constants.js
CHANGED
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,KAAK,GAAG,2CAA2C,CAAC;AAEjE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC,yFAAyF;AACzF,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAC5C,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,oBAAoB,GAAgB,SAAS,CAAC;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAgB,QAAQ,CAAC;AAEzD,MAAM,CAAC,MAAM,yBAAyB,GAAG,sCAAsC,CAAC;AAEhF,MAAM,CAAC,MAAM,uBAAuB,GAAG,mCAAmC,CAAC;AAE3E,MAAM,CAAC,MAAM,uBAAuB,GAAG,mCAAmC,CAAC;AAE3E,MAAM,CAAC,MAAM,uBAAuB,GAAG,mCAAmC,CAAC;AAE3E,MAAM,CAAC,MAAM,+BAA+B,GAAG,4CAA4C,CAAC;AAE5F,MAAM,CAAC,MAAM,4BAA4B,GAAG,iCAAiC,CAAC;AAE9E,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,gBAAgB;IAChB,WAAW;IACX,sBAAsB;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,WAAW;IACX,OAAO;CACR,CAAC","sourcesContent":["import { ProductType } from './types/types';\n\nexport const appId = 'org.openedx.frontend.app.learnerDashboard';\n\nexport const HITS_PER_PAGE_PROGRAMS = 4;\nexport const HITS_PER_PAGE_COURSES = 4;\n\n/** Facet attribute names in ALGOLIA_PRODUCT_INDEX_NAME — update if your index differs */\nexport const FACET_PRODUCT_TYPE = 'product';\nexport const FACET_SUBJECTS = 'subjects';\n\nexport const PRODUCT_TYPE_PROGRAM: ProductType = 'program';\nexport const PRODUCT_TYPE_COURSE: ProductType = 'course';\n\nexport const subscriptionDashboardRole = 'org.edx.frontend.subs.role.dashboard';\n\nexport const subscriptionSignoutRole = 'org.openedx.frontend.role.signOut';\n\nexport const subscriptionAccountRole = 'org.openedx.frontend.role.account';\n\nexport const subscriptionProfileRole = 'org.openedx.frontend.role.profile';\n\nexport const subscriptionProgramProgressRole = 'org.edx.frontend.subs.role.programProgress';\n\nexport const subscriptionDashboardUrlPath = '/subscription-learner-dashboard';\n\nexport const SUBSCRIPTION_ROUTE_PREFIXES = [\n '/subscription-',\n '/checkout',\n '/manage-subscription',\n];\n\nexport const NON_SUBSCRIPTION_ROUTE_PREFIXES = [\n '/learner-',\n '/aca-',\n];\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,KAAK,GAAG,2CAA2C,CAAC;AAEjE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC,yFAAyF;AACzF,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAC5C,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,oBAAoB,GAAgB,SAAS,CAAC;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAgB,QAAQ,CAAC;AAEzD,MAAM,CAAC,MAAM,yBAAyB,GAAG,sCAAsC,CAAC;AAEhF,MAAM,CAAC,MAAM,uBAAuB,GAAG,mCAAmC,CAAC;AAE3E,MAAM,CAAC,MAAM,uBAAuB,GAAG,mCAAmC,CAAC;AAE3E,MAAM,CAAC,MAAM,uBAAuB,GAAG,mCAAmC,CAAC;AAE3E,MAAM,CAAC,MAAM,+BAA+B,GAAG,4CAA4C,CAAC;AAE5F,MAAM,CAAC,MAAM,4BAA4B,GAAG,iCAAiC,CAAC;AAE9E,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,gBAAgB;IAChB,WAAW;IACX,sBAAsB;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,WAAW;IACX,OAAO;CACR,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,oBAAoB,CAAC","sourcesContent":["import { ProductType } from './types/types';\n\nexport const appId = 'org.openedx.frontend.app.learnerDashboard';\n\nexport const HITS_PER_PAGE_PROGRAMS = 4;\nexport const HITS_PER_PAGE_COURSES = 4;\n\n/** Facet attribute names in ALGOLIA_PRODUCT_INDEX_NAME — update if your index differs */\nexport const FACET_PRODUCT_TYPE = 'product';\nexport const FACET_SUBJECTS = 'subjects';\n\nexport const PRODUCT_TYPE_PROGRAM: ProductType = 'program';\nexport const PRODUCT_TYPE_COURSE: ProductType = 'course';\n\nexport const subscriptionDashboardRole = 'org.edx.frontend.subs.role.dashboard';\n\nexport const subscriptionSignoutRole = 'org.openedx.frontend.role.signOut';\n\nexport const subscriptionAccountRole = 'org.openedx.frontend.role.account';\n\nexport const subscriptionProfileRole = 'org.openedx.frontend.role.profile';\n\nexport const subscriptionProgramProgressRole = 'org.edx.frontend.subs.role.programProgress';\n\nexport const subscriptionDashboardUrlPath = '/subscription-learner-dashboard';\n\nexport const SUBSCRIPTION_ROUTE_PREFIXES = [\n '/subscription-',\n '/checkout',\n '/manage-subscription',\n];\n\nexport const NON_SUBSCRIPTION_ROUTE_PREFIXES = [\n '/learner-',\n '/aca-',\n];\n\nexport const learnerDashboardUrlPath = '/learner-dashboard';\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from 'react';
|
|
3
3
|
import { LinkMenuItem, WidgetOperationTypes, getAppConfig, useSiteEvent, } from '@openedx/frontend-base';
|
|
4
|
-
import { appId, subscriptionDashboardUrlPath, subscriptionSignoutRole, SUBSCRIPTION_ROUTE_PREFIXES, } from '../../constants';
|
|
4
|
+
import { appId, subscriptionDashboardUrlPath, subscriptionSignoutRole, SUBSCRIPTION_ROUTE_PREFIXES, learnerDashboardUrlPath, } from '../../constants';
|
|
5
5
|
import { createEventTracker } from '../../data/services/segment/utils';
|
|
6
6
|
import { categories, eventNames } from '../../tracking/constants';
|
|
7
7
|
import { getCommonTrackingProps } from '../../tracking';
|
|
@@ -38,6 +38,7 @@ const SubscribeLink = () => {
|
|
|
38
38
|
}
|
|
39
39
|
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" }) }));
|
|
40
40
|
};
|
|
41
|
+
const dashboardURL = getCommonTrackingProps().isSubscriber === true ? subscriptionDashboardUrlPath : learnerDashboardUrlPath;
|
|
41
42
|
const app = {
|
|
42
43
|
appId: 'org.openedx.frontend.app.learnerDashboard.header',
|
|
43
44
|
slots: [
|
|
@@ -96,7 +97,7 @@ const app = {
|
|
|
96
97
|
slotId: 'org.openedx.frontend.slot.header.desktopRight.v1',
|
|
97
98
|
id: 'org.edx.frontend.widget.learnerHome.headerLinkDashboard.v1',
|
|
98
99
|
op: WidgetOperationTypes.PREPEND,
|
|
99
|
-
element: (_jsx("div", { className: "px-3 dashboard-header-navlink", onClick: () => trackHeaderLinkClick(
|
|
100
|
+
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" }) })),
|
|
100
101
|
condition: {
|
|
101
102
|
callback: () => isSubscriptionContext() || (typeof window !== 'undefined' && window.location.pathname.startsWith('/aca-')),
|
|
102
103
|
},
|
|
@@ -120,7 +121,7 @@ const app = {
|
|
|
120
121
|
slotId: 'org.openedx.frontend.slot.header.authenticatedMenu.v1',
|
|
121
122
|
id: 'org.edx.frontend.widget.learnerDashboard.dashboard.v1',
|
|
122
123
|
op: WidgetOperationTypes.PREPEND,
|
|
123
|
-
element: (_jsx("div", { onClick: () => trackHeaderLinkClick(
|
|
124
|
+
element: (_jsx("div", { onClick: () => trackHeaderLinkClick(dashboardURL, eventNames.headerDashboardLinkClicked), children: _jsx(LinkMenuItem, { label: messages['header.user.menu.dashboard'].defaultMessage, url: dashboardURL, variant: "dropdownItem" }) })),
|
|
124
125
|
condition: {
|
|
125
126
|
callback: () => isSubscriptionContext(),
|
|
126
127
|
},
|
|
@@ -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,GAC5B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,kBAAkB,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D,EAAE,EAAE,oBAAoB,CAAC,MAAM;YAC/B,OAAO,EAAE,KAAC,QAAQ,KAAG;SACtB;QACD;YACE,MAAM,EAAE,kDAAkD;YAC1D,EAAE,EAAE,2DAA2D;YAC/D,EAAE,EAAE,oBAAoB,CAAC,OAAO;YAChC,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} 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 // Add/remove prefixes based on your actual subscription routes\n return SUBSCRIPTION_ROUTE_PREFIXES.some((prefix) =>\n pathname.startsWith(prefix),\n );\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 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(subscriptionDashboardUrlPath, eventNames.headerDashboardLinkClicked)}\n >\n <LinkMenuItem\n label={messages['header.user.menu.dashboard'].defaultMessage}\n url={subscriptionDashboardUrlPath}\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('/manage-subscription', eventNames.headerManageSubscriptionClicked)}>\n <LinkMenuItem\n label={messages['header.user.menu.manageSubscription'].defaultMessage}\n url=\"/manage-subscription\"\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(subscriptionDashboardUrlPath, eventNames.headerDashboardLinkClicked)}>\n <LinkMenuItem\n label={messages['header.user.menu.dashboard'].defaultMessage}\n url={subscriptionDashboardUrlPath}\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,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EAAE,gDAAgD;YACxD,EAAE,EAAE,kDAAkD;YACtD,EAAE,EAAE,oBAAoB,CAAC,MAAM;YAC/B,OAAO,EAAE,KAAC,QAAQ,KAAG;SACtB;QACD;YACE,MAAM,EAAE,kDAAkD;YAC1D,EAAE,EAAE,2DAA2D;YAC/D,EAAE,EAAE,oBAAoB,CAAC,OAAO;YAChC,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 // Add/remove prefixes based on your actual subscription routes\n return SUBSCRIPTION_ROUTE_PREFIXES.some((prefix) =>\n pathname.startsWith(prefix),\n );\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('/manage-subscription', eventNames.headerManageSubscriptionClicked)}>\n <LinkMenuItem\n label={messages['header.user.menu.manageSubscription'].defaultMessage}\n url=\"/manage-subscription\"\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"]}
|