@edx/frontend-app-subscription-manage 1.24.1 → 1.25.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/constants.d.ts
CHANGED
|
@@ -5,10 +5,6 @@ export declare const subscriptionCheckoutRole = "org.openedx.frontend.role.subsc
|
|
|
5
5
|
/** Sibling search MFE route role (externalRoutes). */
|
|
6
6
|
export declare const subscriptionSearchRole = "org.openedx.frontend.role.subscription.search";
|
|
7
7
|
export declare const ORDER_HISTORY_PAGE_PATH = "order-history";
|
|
8
|
-
/** Default help center URL when not overridden in app config. */
|
|
9
|
-
export declare const DEFAULT_LEARNER_HELP_CENTER_URL = "https://support.edx.org/hc/en-us";
|
|
10
|
-
/** Default marketing page for "Learn about edX Subscription". */
|
|
11
|
-
export declare const DEFAULT_SUBSCRIPTION_LEARN_MORE_URL = "https://www.edx.org/edx-subscription";
|
|
12
8
|
/** Countries that require the extra renew consent checkbox (ISO alpha-2). */
|
|
13
9
|
export declare const COUNTRIES_REQUIRING_EXTRA_CONFIRM: readonly string[];
|
|
14
10
|
/** Active / trial statuses that map to the manage (active) view. */
|
package/dist/constants.js
CHANGED
|
@@ -5,10 +5,6 @@ export const subscriptionCheckoutRole = 'org.openedx.frontend.role.subscription.
|
|
|
5
5
|
/** Sibling search MFE route role (externalRoutes). */
|
|
6
6
|
export const subscriptionSearchRole = 'org.openedx.frontend.role.subscription.search';
|
|
7
7
|
export const ORDER_HISTORY_PAGE_PATH = 'order-history';
|
|
8
|
-
/** Default help center URL when not overridden in app config. */
|
|
9
|
-
export const DEFAULT_LEARNER_HELP_CENTER_URL = 'https://support.edx.org/hc/en-us';
|
|
10
|
-
/** Default marketing page for "Learn about edX Subscription". */
|
|
11
|
-
export const DEFAULT_SUBSCRIPTION_LEARN_MORE_URL = 'https://www.edx.org/edx-subscription';
|
|
12
8
|
/** Countries that require the extra renew consent checkbox (ISO alpha-2). */
|
|
13
9
|
export const COUNTRIES_REQUIRING_EXTRA_CONFIRM = ['GB', 'CA'];
|
|
14
10
|
/** Active / trial statuses that map to the manage (active) view. */
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,8CAA8C,CAAC;AACpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,+CAA+C,CAAC;AAEtF,wDAAwD;AACxD,MAAM,CAAC,MAAM,wBAAwB,GAAG,iDAAiD,CAAC;AAE1F,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,+CAA+C,CAAC;AAEtF,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEvD,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,8CAA8C,CAAC;AACpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,+CAA+C,CAAC;AAEtF,wDAAwD;AACxD,MAAM,CAAC,MAAM,wBAAwB,GAAG,iDAAiD,CAAC;AAE1F,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,+CAA+C,CAAC;AAEtF,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEvD,6EAA6E;AAC7E,MAAM,CAAC,MAAM,iCAAiC,GAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAEjF,oEAAoE;AACpE,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAC;IAClD,QAAQ;IACR,cAAc;IACd,UAAU;CACX,CAAC,CAAC;AAEH,qEAAqE;AACrE,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAC;IACpD,UAAU;IACV,WAAW;IACX,sBAAsB;IACtB,gBAAgB;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAE/C,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAE/C,8DAA8D;AAC9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAEnD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAEnD,kDAAkD;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC","sourcesContent":["export const appId = 'org.openedx.frontend.app.subscription.manage';\nexport const subscriptionManageRole = 'org.openedx.frontend.role.subscription.manage';\n\n/** Sibling checkout MFE route role (externalRoutes). */\nexport const subscriptionCheckoutRole = 'org.openedx.frontend.role.subscription.checkout';\n\n/** Sibling search MFE route role (externalRoutes). */\nexport const subscriptionSearchRole = 'org.openedx.frontend.role.subscription.search';\n\nexport const ORDER_HISTORY_PAGE_PATH = 'order-history';\n\n/** Countries that require the extra renew consent checkbox (ISO alpha-2). */\nexport const COUNTRIES_REQUIRING_EXTRA_CONFIRM: readonly string[] = ['GB', 'CA'];\n\n/** Active / trial statuses that map to the manage (active) view. */\nexport const ACTIVE_SUBSCRIPTION_STATUSES = new Set([\n 'ACTIVE',\n 'TRIAL_ACTIVE',\n 'TRIALING',\n]);\n\n/** Canceled statuses that may still have access until period end. */\nexport const CANCELED_SUBSCRIPTION_STATUSES = new Set([\n 'CANCELED',\n 'CANCELLED',\n 'CANCEL_AT_PERIOD_END',\n 'PENDING_CANCEL',\n]);\n\nexport const appName = 'learner-home';\n\nexport const STRIPE_PAYMENT_GATEWAY = 'stripe';\n\nexport const PAYPAL_PAYMENT_GATEWAY = 'paypal';\n\n/** Path of the order history page (route `order-history`). */\nexport const ORDER_HISTORY_PATH = '/order-history';\n\n/** Path of the order details page (route `order-details/:orderNumber`). */\nexport const ORDER_DETAILS_PATH = '/order-details';\n\n/** Billing contact shown in the refund notice. */\nexport const BILLING_SUPPORT_EMAIL = 'billing@edx.org';\n"]}
|
package/dist/utils/edxSession.js
CHANGED
|
@@ -44,8 +44,8 @@ function isDevelopment() {
|
|
|
44
44
|
/** LMS edx-session endpoint for the current site. */
|
|
45
45
|
export function getEdxSessionUrl() {
|
|
46
46
|
return isDevelopment()
|
|
47
|
-
?
|
|
48
|
-
:
|
|
47
|
+
? `${getSiteConfig().lmsBaseUrl}/api/edx-session`
|
|
48
|
+
: ''; // same url but static was used before.
|
|
49
49
|
}
|
|
50
50
|
/** Exchange the learner's edX session for a Viax token. */
|
|
51
51
|
export function fetchEdxSession(sessionUrl) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edxSession.js","sourceRoot":"","sources":["../../src/utils/edxSession.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;AAEH,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAWzE,qGAAqG;AACrG,MAAM,gBAAgB,GAAG;IACvB,OAAO,EAAE,kuBAAkuB;IAC3uB,SAAS,EAAE,wVAAwV;CACpW,CAAC;AAEF,SAAS,oBAAoB,CAAC,IAA6B;;IACzD,MAAM,SAAS,GAAG,CAChB,MAAA,MAAA,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAI,CAAC,KAAK,mCAAI,IAAI,CAAC,YAAY,mCAAI,IAAI,CAAC,WAAW,CAChD,CAAC;IACxB,MAAM,WAAW,GAAG,CAAC,MAAA,IAAI,CAAC,WAAW,mCAAI,IAAI,CAAC,YAAY,CAAuB,CAAC;IAElF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IACD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO;QACL,SAAS;QACT,WAAW;QACX,QAAQ,EAAE,IAAI,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,CAAC,QAA8B;QAC7C,KAAK,EAAE,IAAI,CAAC,KAA2B;KACxC,CAAC;AACJ,CAAC;AAED,SAAS,aAAa;IACpB,OAAO,aAAa,EAAE,CAAC,WAAW,KAAK,gBAAgB,CAAC,WAAW,CAAC;AACtE,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,gBAAgB;IAC9B,OAAO,aAAa,EAAE;QACpB,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC,UAAU,kBAAkB;QACjD,CAAC,CAAC,EAAE,CAAC,CAAC,uCAAuC;AACjD,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAgB,eAAe,CAAC,UAAkB;;QACtD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE;YAClC,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,SAAS;YACtB,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;SACrE,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,gCAAgC,GAAG,CAAC,MAAM,uCAAuC,CAClF,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAkD,CAAC;QAC9E,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CAAA","sourcesContent":["/**\n * Exchange the learner's edX session for a Viax JWT.\n *\n * Dev uses POST with a hardcoded JWT payload (local LMS cookie exchange is\n * unavailable). Stage/prod use POST with browser session cookies.\n */\n\nimport { EnvironmentTypes, getSiteConfig } from '@openedx/frontend-base';\n\nexport interface EdxSessionResult {\n viaxToken: string,\n customerUid: string,\n partyUid?: string,\n edxUserId?: string,\n username?: string,\n email?: string,\n}\n\n/** Hardcoded edX JWT used only for local/dev against Viax (same pattern as enroll/checkout MFEs). */\nconst DEV_SESSION_BODY = {\n payload: 'eyJhbGciOiJSUzUxMiIsImtpZCI6Imxtc3N0YWdlMDAyIiwidHlwIjoiSldUIn0.eyJhdWQiOiJJbmtvY3VqTGlreXVjc0Vkd2lXYXRkZWJyRWFja21ldkxha0R1aWZLb29zaGtha1dvdyIsImV4cCI6MTc5MTUyODA4OSwiZ3JhbnRfdHlwZSI6InBhc3N3b3JkIiwiaWF0IjoxNzkxNTI0NDg5LCJpc3MiOiJodHRwczovL2NvdXJzZXMuc3RhZ2UuZWR4Lm9yZy9vYXV0aDIiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJUVV8yNjA4X0pFRzMiLCJzY29wZXMiOlsidXNlcl9pZCIsImVtYWlsIiwicHJvZmlsZSJdLCJ2ZXJzaW9uIjoiMS4yLjAiLCJzdWIiOiJiMTM0NGUxYWFjNGI5MWExZDBiZGU0NzFkMjdlMTkwNCIsImZpbHRlcnMiOlsidXNlcjptZSJdLCJpc19yZXN0cmljdGVkIjpmYWxzZSwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJ1c2VyX2lkIjo1Mjg0NzAwLCJlbWFpbCI6InRlc3QtdXNlckBnbWFpbC5jb20iLCJuYW1lIjoiVGVzdCBVc2VyIiwiZmFtaWx5X25hbWUiOiIiLCJnaXZlbl9uYW1lIjoiIiwiYWRtaW5pc3RyYXRvciI6ZmFsc2UsInN1cGVydXNlciI6ZmFsc2V9',\n signature: 'Ho60pm9qWXSiU9yWPJ6srgKxlDtAgiBH3kMbzCFOBZq7qm8Qi_z-iNMqxVl5dozvQNtJAuS5A--lvzkIk9fEb2u0tS_L_QKBdrEg28yvPcjwlgOsGGZ5wUOu5Vi2NN9cbNH-TiPA0zLIMVifvh8NhuWTzk6Q4yIAqU28H1Xz6Mwiz0ftHcARvdIYA-IGaWJt0YEVOw_nDLWui7V4AXSeAV50rHAlqsHzAfUnmpBxW2KAve-ZWMxmDCiF3xEaiwKtQXBsUCJ1xjGxub4dzZjry4ELRQf6EpW2l6sL5vGjD2FrlSMyt08D7lUCMBAbzpr8-ycuTRicMpnS2l64VMOp1g'\n};\n\nfunction parseSessionResponse(data: Record<string, unknown>): EdxSessionResult {\n const viaxToken = (\n data.viaxToken ?? data.token ?? data.access_token ?? data.accessToken\n ) as string | undefined;\n const customerUid = (data.customerUid ?? data.customer_uid) as string | undefined;\n\n if (!viaxToken) {\n throw new Error('Session response missing viax token.');\n }\n if (!customerUid) {\n throw new Error('Session response missing customerUid.');\n }\n\n return {\n viaxToken,\n customerUid,\n partyUid: data.partyUid as string | undefined,\n edxUserId: data.edxUserId as string | undefined,\n username: data.username as string | undefined,\n email: data.email as string | undefined,\n };\n}\n\nfunction isDevelopment(): boolean {\n return getSiteConfig().environment === EnvironmentTypes.DEVELOPMENT;\n}\n\n/** LMS edx-session endpoint for the current site. */\nexport function getEdxSessionUrl(): string {\n return isDevelopment()\n ? `${getSiteConfig().lmsBaseUrl}/api/edx-session`\n : ''; // same url but static was used before.\n}\n\n/** Exchange the learner's edX session for a Viax token. */\nexport async function fetchEdxSession(sessionUrl: string): Promise<EdxSessionResult> {\n const res = await fetch(sessionUrl, {\n method: 'POST',\n credentials: 'include',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: isDevelopment() ? JSON.stringify(DEV_SESSION_BODY) : undefined,\n });\n\n if (!res.ok) {\n throw new Error(\n `Failed to establish session (${res.status}). Please log into edX and try again.`,\n );\n }\n\n const data = await res.json() as Record<string, unknown> & { error?: string };\n if (data.error) {\n throw new Error(String(data.error));\n }\n\n return parseSessionResponse(data);\n}\n"]}
|
package/dist/utils/urls.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External / sibling-app URLs for manage-subscription CTAs.
|
|
3
3
|
*/
|
|
4
4
|
import { getAppConfig, getSiteConfig, getUrlByRouteRole } from '@openedx/frontend-base';
|
|
5
|
-
import {
|
|
5
|
+
import { appId, subscriptionCheckoutRole, } from '../constants';
|
|
6
6
|
/** Checkout / subscribe flow URL (renew + new subscribe). */
|
|
7
7
|
export function getCheckoutUrl() {
|
|
8
8
|
var _a;
|
|
@@ -21,13 +21,13 @@ export function getCheckoutUrl() {
|
|
|
21
21
|
export function getLearnMoreUrl() {
|
|
22
22
|
var _a;
|
|
23
23
|
const config = getAppConfig(appId);
|
|
24
|
-
return (_a = config.SUBSCRIPTION_LEARN_MORE_URL) !== null && _a !== void 0 ? _a :
|
|
24
|
+
return (_a = config.SUBSCRIPTION_LEARN_MORE_URL) !== null && _a !== void 0 ? _a : config.EDX_SUBSCRIPTION_URL;
|
|
25
25
|
}
|
|
26
26
|
/** Learner Help Center (footer link). */
|
|
27
27
|
export function getLearnerHelpCenterUrl() {
|
|
28
28
|
var _a;
|
|
29
29
|
const config = getAppConfig(appId);
|
|
30
|
-
return (_a = config.LEARNER_HELP_CENTER_URL) !== null && _a !== void 0 ? _a :
|
|
30
|
+
return (_a = config.LEARNER_HELP_CENTER_URL) !== null && _a !== void 0 ? _a : config.SUPPORT_URL;
|
|
31
31
|
}
|
|
32
32
|
/** Learner dashboard URL for post-cancel return. */
|
|
33
33
|
export function getLearnerDashboardUrl() {
|
package/dist/utils/urls.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urls.js","sourceRoot":"","sources":["../../src/utils/urls.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAExF,OAAO,EACL
|
|
1
|
+
{"version":3,"file":"urls.js","sourceRoot":"","sources":["../../src/utils/urls.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,Y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C","sourcesContent":["/**\n * External / sibling-app URLs for manage-subscription CTAs.\n */\n\nimport { getAppConfig, getSiteConfig, getUrlByRouteRole } from '@openedx/frontend-base';\n\nimport {\n appId,\n subscriptionCheckoutRole,\n} from '../constants';\n\n/** Checkout / subscribe flow URL (renew + new subscribe). */\nexport function getCheckoutUrl(): string {\n const config = getAppConfig(appId);\n const fromConfig = config.CHECKOUT_URL as string | undefined;\n if (fromConfig) {\n return fromConfig;\n }\n\n const fromRole = getUrlByRouteRole(subscriptionCheckoutRole)?.replace(/\\/+$/, '');\n if (fromRole) {\n return fromRole;\n }\n\n return '/checkout';\n}\n\n/** Marketing page for \"Learn about edX Subscription\". */\nexport function getLearnMoreUrl(): string {\n const config = getAppConfig(appId);\n return (config.SUBSCRIPTION_LEARN_MORE_URL as string | undefined)\n ?? config.EDX_SUBSCRIPTION_URL as string;\n}\n\n/** Learner Help Center (footer link). */\nexport function getLearnerHelpCenterUrl(): string {\n const config = getAppConfig(appId);\n return (config.LEARNER_HELP_CENTER_URL as string | undefined)\n ?? config.SUPPORT_URL as string;\n}\n\n/** Learner dashboard URL for post-cancel return. */\nexport function getLearnerDashboardUrl(): string {\n const config = getAppConfig(appId);\n const fromConfig = config.LEARNER_DASHBOARD_URL as string | undefined;\n if (fromConfig) {\n return fromConfig;\n }\n const lms = getSiteConfig().baseUrl?.replace(/\\/+$/, '') ?? '';\n return lms ? `${lms}/subscription-learner-dashboard` : '/subscription-learner-dashboard';\n}\n\n/** Optional change-to-annual checkout deep link. */\nexport function getChangeToAnnualUrl(): string {\n const config = getAppConfig(appId);\n const fromConfig = config.CHANGE_TO_ANNUAL_URL as string | undefined;\n if (fromConfig) {\n return fromConfig;\n }\n return `${getCheckoutUrl()}?plan=annual`;\n}\n\n/** Courses / LMS host used for certificate and course deep links. */\nexport function getCoursesBaseUrl(): string {\n const config = getAppConfig(appId);\n return (config.COURSES_BASE_URL as string | undefined)?.replace(/\\/+$/, '') ?? '';\n}\n\n/**\n * Resolve a certificate path (`tCertificateUrl`) against COURSES_BASE_URL.\n * Returns null when the path is empty.\n */\nexport function getCertificateUrl(certificatePath: string | null | undefined): string | null {\n const path = certificatePath?.trim();\n if (!path) {\n return null;\n }\n if (/^https?:\\/\\//i.test(path)) {\n return path;\n }\n const base = getCoursesBaseUrl();\n if (!base) {\n return path.startsWith('/') ? path : `/${path}`;\n }\n return `${base}${path.startsWith('/') ? path : `/${path}`}`;\n}\n"]}
|