@edx/track-selection-plugin 1.0.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.
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _i18n = require("@edx/frontend-platform/i18n");
8
+ var messages = (0, _i18n.defineMessages)({
9
+ pageTitle: {
10
+ id: 'trackSelection.pageTitle',
11
+ defaultMessage: 'Choose a path for your course in {courseName}',
12
+ description: 'Track selection page heading'
13
+ },
14
+ earnCertificate: {
15
+ id: 'trackSelection.earn-certificate',
16
+ defaultMessage: 'Earn a certificate',
17
+ description: 'Verified track card title on track selection'
18
+ },
19
+ accessCourse: {
20
+ id: 'trackSelection.access-course',
21
+ defaultMessage: 'Access this course',
22
+ description: 'Audit track card title on track selection'
23
+ },
24
+ free: {
25
+ id: 'trackSelection.free',
26
+ defaultMessage: 'FREE',
27
+ description: 'Audit track price label'
28
+ },
29
+ upgradeNow: {
30
+ id: 'trackSelection.upgrade-now',
31
+ defaultMessage: 'Upgrade Now',
32
+ description: 'Verified track CTA on track selection'
33
+ },
34
+ "continue": {
35
+ id: 'trackSelection.continue',
36
+ defaultMessage: 'Continue',
37
+ description: 'Audit track CTA on track selection'
38
+ },
39
+ verifiedCertificateLinkLabel: {
40
+ id: 'trackSelection.verified-certificate-link-label',
41
+ defaultMessage: 'verified certificate',
42
+ description: 'Linked phrase in verified track bullet'
43
+ },
44
+ verifiedBulletCertificateLead: {
45
+ id: 'trackSelection.verified-bullet-certificate-lead',
46
+ defaultMessage: 'Showcase a',
47
+ description: 'Start of verified track certificate bullet'
48
+ },
49
+ verifiedBulletCertificateTrail: {
50
+ id: 'trackSelection.verified-bullet-certificate-trail',
51
+ defaultMessage: 'of completion on your resumé to advance your career',
52
+ description: 'End of verified track certificate bullet'
53
+ },
54
+ verifiedBulletMissionLead: {
55
+ id: 'trackSelection.verified-bullet-mission-lead',
56
+ defaultMessage: 'Support our',
57
+ description: 'Start of verified track mission bullet'
58
+ },
59
+ mission: {
60
+ id: 'trackSelection.mission',
61
+ defaultMessage: 'mission',
62
+ description: 'Bold mission word in verified track bullet'
63
+ },
64
+ verifiedBulletMissionTrail: {
65
+ id: 'trackSelection.verified-bullet-mission-trail',
66
+ defaultMessage: 'to increase access to high-quality education for everyone, everywhere',
67
+ description: 'End of verified track mission bullet'
68
+ },
69
+ auditBulletMaterials: {
70
+ id: 'trackSelection.audit-bullet-materials',
71
+ defaultMessage: 'Get access to the course material, including videos and readings',
72
+ description: 'Audit track bullet on track selection'
73
+ },
74
+ engagementNoteLead: {
75
+ id: 'trackSelection.engagement-note-lead',
76
+ defaultMessage: 'Studies show that those who choose this option are',
77
+ description: 'Start of engagement note under verified card'
78
+ },
79
+ engagementNoteEmphasis: {
80
+ id: 'trackSelection.engagement-note-emphasis',
81
+ defaultMessage: 'more engaged and motivated',
82
+ description: 'Bold phrase in engagement note'
83
+ },
84
+ engagementNoteTrail: {
85
+ id: 'trackSelection.engagement-note-trail',
86
+ defaultMessage: 'to complete their courses',
87
+ description: 'End of engagement note under verified card'
88
+ },
89
+ auditAccessExpires: {
90
+ id: 'trackSelection.audit-access-expires',
91
+ defaultMessage: 'Access expires and all progress will be lost on {date}',
92
+ description: 'FBE audit access expiration message on track selection'
93
+ },
94
+ loading: {
95
+ id: 'trackSelection.loading',
96
+ defaultMessage: 'Loading course enrollment options',
97
+ description: 'Screen reader text while track selection data is loading'
98
+ },
99
+ loadError: {
100
+ id: 'trackSelection.load-error',
101
+ defaultMessage: 'We could not load your course enrollment options. Please try again.',
102
+ description: 'Error shown when track selection data cannot be loaded'
103
+ },
104
+ submitError: {
105
+ id: 'trackSelection.submit-error',
106
+ defaultMessage: 'We could not complete your enrollment selection. Please try again.',
107
+ description: 'Error shown when track selection submission fails'
108
+ }
109
+ });
110
+ var _default = exports["default"] = messages;
111
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","names":["_i18n","require","messages","defineMessages","pageTitle","id","defaultMessage","description","earnCertificate","accessCourse","free","upgradeNow","verifiedCertificateLinkLabel","verifiedBulletCertificateLead","verifiedBulletCertificateTrail","verifiedBulletMissionLead","mission","verifiedBulletMissionTrail","auditBulletMaterials","engagementNoteLead","engagementNoteEmphasis","engagementNoteTrail","auditAccessExpires","loading","loadError","submitError","_default","exports"],"sources":["../src/messages.js"],"sourcesContent":["import { defineMessages } from '@edx/frontend-platform/i18n';\n\nconst messages = defineMessages({\n pageTitle: {\n id: 'trackSelection.pageTitle',\n defaultMessage: 'Choose a path for your course in {courseName}',\n description: 'Track selection page heading',\n },\n earnCertificate: {\n id: 'trackSelection.earn-certificate',\n defaultMessage: 'Earn a certificate',\n description: 'Verified track card title on track selection',\n },\n accessCourse: {\n id: 'trackSelection.access-course',\n defaultMessage: 'Access this course',\n description: 'Audit track card title on track selection',\n },\n free: {\n id: 'trackSelection.free',\n defaultMessage: 'FREE',\n description: 'Audit track price label',\n },\n upgradeNow: {\n id: 'trackSelection.upgrade-now',\n defaultMessage: 'Upgrade Now',\n description: 'Verified track CTA on track selection',\n },\n continue: {\n id: 'trackSelection.continue',\n defaultMessage: 'Continue',\n description: 'Audit track CTA on track selection',\n },\n verifiedCertificateLinkLabel: {\n id: 'trackSelection.verified-certificate-link-label',\n defaultMessage: 'verified certificate',\n description: 'Linked phrase in verified track bullet',\n },\n verifiedBulletCertificateLead: {\n id: 'trackSelection.verified-bullet-certificate-lead',\n defaultMessage: 'Showcase a',\n description: 'Start of verified track certificate bullet',\n },\n verifiedBulletCertificateTrail: {\n id: 'trackSelection.verified-bullet-certificate-trail',\n defaultMessage: 'of completion on your resumé to advance your career',\n description: 'End of verified track certificate bullet',\n },\n verifiedBulletMissionLead: {\n id: 'trackSelection.verified-bullet-mission-lead',\n defaultMessage: 'Support our',\n description: 'Start of verified track mission bullet',\n },\n mission: {\n id: 'trackSelection.mission',\n defaultMessage: 'mission',\n description: 'Bold mission word in verified track bullet',\n },\n verifiedBulletMissionTrail: {\n id: 'trackSelection.verified-bullet-mission-trail',\n defaultMessage: 'to increase access to high-quality education for everyone, everywhere',\n description: 'End of verified track mission bullet',\n },\n auditBulletMaterials: {\n id: 'trackSelection.audit-bullet-materials',\n defaultMessage: 'Get access to the course material, including videos and readings',\n description: 'Audit track bullet on track selection',\n },\n engagementNoteLead: {\n id: 'trackSelection.engagement-note-lead',\n defaultMessage: 'Studies show that those who choose this option are',\n description: 'Start of engagement note under verified card',\n },\n engagementNoteEmphasis: {\n id: 'trackSelection.engagement-note-emphasis',\n defaultMessage: 'more engaged and motivated',\n description: 'Bold phrase in engagement note',\n },\n engagementNoteTrail: {\n id: 'trackSelection.engagement-note-trail',\n defaultMessage: 'to complete their courses',\n description: 'End of engagement note under verified card',\n },\n auditAccessExpires: {\n id: 'trackSelection.audit-access-expires',\n defaultMessage: 'Access expires and all progress will be lost on {date}',\n description: 'FBE audit access expiration message on track selection',\n },\n loading: {\n id: 'trackSelection.loading',\n defaultMessage: 'Loading course enrollment options',\n description: 'Screen reader text while track selection data is loading',\n },\n loadError: {\n id: 'trackSelection.load-error',\n defaultMessage: 'We could not load your course enrollment options. Please try again.',\n description: 'Error shown when track selection data cannot be loaded',\n },\n submitError: {\n id: 'trackSelection.submit-error',\n defaultMessage: 'We could not complete your enrollment selection. Please try again.',\n description: 'Error shown when track selection submission fails',\n },\n});\n\nexport default messages;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAMC,QAAQ,GAAG,IAAAC,oBAAc,EAAC;EAC9BC,SAAS,EAAE;IACTC,EAAE,EAAE,0BAA0B;IAC9BC,cAAc,EAAE,+CAA+C;IAC/DC,WAAW,EAAE;EACf,CAAC;EACDC,eAAe,EAAE;IACfH,EAAE,EAAE,iCAAiC;IACrCC,cAAc,EAAE,oBAAoB;IACpCC,WAAW,EAAE;EACf,CAAC;EACDE,YAAY,EAAE;IACZ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sBAAsB,EAAE;IACtBf,EAAE,EAAE,yCAAyC;IAC7CC,cAAc,EAAE,4BAA4B;IAC5CC,WAAW,EAAE;EACf,CAAC;EACDc,mBAAmB,EAAE;IACnBhB,EAAE,EAAE,sCAAsC;IAC1CC,cAAc,EAAE,2BAA2B;IAC3CC,WAAW,EAAE;EACf,CAAC;EACDe,kBAAkB,EAAE;IAClBjB,EAAE,EAAE,qCAAqC;IACzCC,cAAc,EAAE,wDAAwD;IACxEC,WAAW,EAAE;EACf,CAAC;EACDgB,OAAO,EAAE;IACPlB,EAAE,EAAE,wBAAwB;IAC5BC,cAAc,EAAE,mCAAmC;IACnDC,WAAW,EAAE;EACf,CAAC;EACDiB,SAAS,EAAE;IACTnB,EAAE,EAAE,2BAA2B;IAC/BC,cAAc,EAAE,qEAAqE;IACrFC,WAAW,EAAE;EACf,CAAC;EACDkB,WAAW,EAAE;IACXpB,EAAE,EAAE,6BAA6B;IACjCC,cAAc,EAAE,oEAAoE;IACpFC,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAAC,IAAAmB,QAAA,GAAAC,OAAA,cAEYzB,QAAQ","ignoreList":[]}
package/dist/utils.js ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatVerifiedPriceDisplay = formatVerifiedPriceDisplay;
7
+ exports.getVerifiedCertificateUrl = getVerifiedCertificateUrl;
8
+ var _frontendPlatform = require("@edx/frontend-platform");
9
+ var VERIFIED_CERTIFICATE_PATH = '/verified-certificate';
10
+ function buildUrlFromBase(baseUrl, path) {
11
+ if (!baseUrl) {
12
+ return path;
13
+ }
14
+ var normalizedBase = baseUrl.replace(/\/$/, '');
15
+ return "".concat(normalizedBase).concat(path.startsWith('/') ? path : "/".concat(path));
16
+ }
17
+
18
+ /** Uses track selection API fields on verifiedMode (currencySymbol, minPrice, currency). */
19
+ function formatVerifiedPriceDisplay(verifiedMode) {
20
+ if (!verifiedMode) {
21
+ return '';
22
+ }
23
+ var _verifiedMode$currenc = verifiedMode.currencySymbol,
24
+ currencySymbol = _verifiedMode$currenc === void 0 ? '' : _verifiedMode$currenc,
25
+ minPrice = verifiedMode.minPrice,
26
+ currency = verifiedMode.currency;
27
+ var currencyLabel = (currency || '').toUpperCase();
28
+ return "".concat(currencySymbol).concat(minPrice, " ").concat(currencyLabel).trim();
29
+ }
30
+
31
+ /**
32
+ * Verified certificate URL: track selection API trackLinks first, then MFE marketing base URL.
33
+ */
34
+ function getVerifiedCertificateUrl(trackLinks) {
35
+ var fromApi = (trackLinks === null || trackLinks === void 0 ? void 0 : trackLinks.verifiedCertificate) || (trackLinks === null || trackLinks === void 0 ? void 0 : trackLinks.verified_certificate);
36
+ if (fromApi) {
37
+ return fromApi;
38
+ }
39
+ var marketingRoot = (0, _frontendPlatform.getConfig)().MARKETING_SITE_BASE_URL;
40
+ if (marketingRoot) {
41
+ return "".concat(marketingRoot.replace(/\/$/, '')).concat(VERIFIED_CERTIFICATE_PATH);
42
+ }
43
+ return buildUrlFromBase((0, _frontendPlatform.getConfig)().MARKETING_SITE_BASE_URL, VERIFIED_CERTIFICATE_PATH);
44
+ }
45
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":["_frontendPlatform","require","VERIFIED_CERTIFICATE_PATH","buildUrlFromBase","baseUrl","path","normalizedBase","replace","concat","startsWith","formatVerifiedPriceDisplay","verifiedMode","_verifiedMode$currenc","currencySymbol","minPrice","currency","currencyLabel","toUpperCase","trim","getVerifiedCertificateUrl","trackLinks","fromApi","verifiedCertificate","verified_certificate","marketingRoot","getConfig","MARKETING_SITE_BASE_URL"],"sources":["../src/utils.js"],"sourcesContent":["import { getConfig } from '@edx/frontend-platform';\n\nconst VERIFIED_CERTIFICATE_PATH = '/verified-certificate';\n\nfunction buildUrlFromBase(baseUrl, path) {\n if (!baseUrl) {\n return path;\n }\n\n const normalizedBase = baseUrl.replace(/\\/$/, '');\n return `${normalizedBase}${path.startsWith('/') ? path : `/${path}`}`;\n}\n\n/** Uses track selection API fields on verifiedMode (currencySymbol, minPrice, currency). */\nexport function formatVerifiedPriceDisplay(verifiedMode) {\n if (!verifiedMode) {\n return '';\n }\n const { currencySymbol = '', minPrice, currency } = verifiedMode;\n const currencyLabel = (currency || '').toUpperCase();\n return `${currencySymbol}${minPrice} ${currencyLabel}`.trim();\n}\n\n/**\n * Verified certificate URL: track selection API trackLinks first, then MFE marketing base URL.\n */\nexport function getVerifiedCertificateUrl(trackLinks) {\n const fromApi = trackLinks?.verifiedCertificate || trackLinks?.verified_certificate;\n if (fromApi) {\n return fromApi;\n }\n const marketingRoot = getConfig().MARKETING_SITE_BASE_URL;\n if (marketingRoot) {\n return `${marketingRoot.replace(/\\/$/, '')}${VERIFIED_CERTIFICATE_PATH}`;\n }\n\n return buildUrlFromBase(getConfig().MARKETING_SITE_BASE_URL, VERIFIED_CERTIFICATE_PATH);\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAMC,yBAAyB,GAAG,uBAAuB;AAEzD,SAASC,gBAAgBA,CAACC,OAAO,EAAEC,IAAI,EAAE;EACvC,IAAI,CAACD,OAAO,EAAE;IACZ,OAAOC,IAAI;EACb;EAEA,IAAMC,cAAc,GAAGF,OAAO,CAACG,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EACjD,UAAAC,MAAA,CAAUF,cAAc,EAAAE,MAAA,CAAGH,IAAI,CAACI,UAAU,CAAC,GAAG,CAAC,GAAGJ,IAAI,OAAAG,MAAA,CAAOH,IAAI,CAAE;AACrE;;AAEA;AACO,SAASK,0BAA0BA,CAACC,YAAY,EAAE;EACvD,IAAI,CAACA,YAAY,EAAE;IACjB,OAAO,EAAE;EACX;EACA,IAAAC,qBAAA,GAAoDD,YAAY,CAAxDE,cAAc;IAAdA,cAAc,GAAAD,qBAAA,cAAG,EAAE,GAAAA,qBAAA;IAAEE,QAAQ,GAAeH,YAAY,CAAnCG,QAAQ;IAAEC,QAAQ,GAAKJ,YAAY,CAAzBI,QAAQ;EAC/C,IAAMC,aAAa,GAAG,CAACD,QAAQ,IAAI,EAAE,EAAEE,WAAW,CAAC,CAAC;EACpD,OAAO,GAAAT,MAAA,CAAGK,cAAc,EAAAL,MAAA,CAAGM,QAAQ,OAAAN,MAAA,CAAIQ,aAAa,EAAGE,IAAI,CAAC,CAAC;AAC/D;;AAEA;AACA;AACA;AACO,SAASC,yBAAyBA,CAACC,UAAU,EAAE;EACpD,IAAMC,OAAO,GAAG,CAAAD,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEE,mBAAmB,MAAIF,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEG,oBAAoB;EACnF,IAAIF,OAAO,EAAE;IACX,OAAOA,OAAO;EAChB;EACA,IAAMG,aAAa,GAAG,IAAAC,2BAAS,EAAC,CAAC,CAACC,uBAAuB;EACzD,IAAIF,aAAa,EAAE;IACjB,UAAAhB,MAAA,CAAUgB,aAAa,CAACjB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAAC,MAAA,CAAGN,yBAAyB;EACxE;EAEA,OAAOC,gBAAgB,CAAC,IAAAsB,2BAAS,EAAC,CAAC,CAACC,uBAAuB,EAAExB,yBAAyB,CAAC;AACzF","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@edx/track-selection-plugin",
3
+ "version": "1.0.0",
4
+ "description": "FBE track selection UI for frontend-app-learning",
5
+ "main": "dist",
6
+ "author": "edX",
7
+ "license": "AGPL-3.0",
8
+ "homepage": "https://github.com/edx/frontend-plugins#readme",
9
+ "bugs": {
10
+ "url": "https://github.com/edx/frontend-plugins/issues"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/edx/frontend-plugins.git"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "scripts": {
23
+ "dev": "make dev",
24
+ "clean": "make clean",
25
+ "build": "make build",
26
+ "i18n_compile": "formatjs compile-folder --format transifex ./src/i18n/messages ./src/i18n/messages",
27
+ "i18n_extract": "formatjs extract 'src/**/*.{jsx,js,tsx,ts}' --out-file ./src/i18n/transifex_input.json --ignore='**/*.d.ts' --format transifex",
28
+ "pull_translations": "make pull_translations",
29
+ "lint": "fedx-scripts eslint --ext .js --ext .jsx .",
30
+ "lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx .",
31
+ "snapshot": "fedx-scripts jest --updateSnapshot",
32
+ "test": "fedx-scripts jest --coverage --passWithNoTests",
33
+ "test:watch": "npm run test -- --watch",
34
+ "prepublish": "npm run build"
35
+ },
36
+ "sideEffects": [
37
+ "*.scss"
38
+ ],
39
+ "devDependencies": {
40
+ "jest-transform-stub": "^2.0.0"
41
+ },
42
+ "peerDependencies": {
43
+ "@edx/frontend-component-footer": "*",
44
+ "@edx/frontend-component-header": "*",
45
+ "@edx/frontend-platform": "*",
46
+ "@openedx/paragon": "23.x",
47
+ "classnames": "*",
48
+ "prop-types": "*",
49
+ "react": "*",
50
+ "react-helmet": "*"
51
+ },
52
+ "gitHead": "9253390cf2b8770982e7a09b6e1de057e6637e30"
53
+ }