Skip to content

Commit

Permalink
feat: require passing user to learnerPortalLinks (#9)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: getLearnerPortalLinks now requires a user to be passed
in. This is done to remove the dependency on frontend-auth so it can be
used in both edx-platform and other MFEs.

ENT-2648
  • Loading branch information
bbaker6225 committed Mar 11, 2020
1 parent cc768ff commit 08351db
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@edx/frontend-enterprise",
"version": "1.0.0-semantically-released",
"version": "2.0.0-semantically-released",
"description": "Frontend utilities for supporting enterprise features.",
"main": "dist/main.js",
"publishConfig": {
Expand Down Expand Up @@ -57,9 +57,6 @@
"webpack": "^4.16.2",
"webpack-cli": "^3.1.0"
},
"peerDependencies": {
"@edx/frontend-auth": "^9.0.0"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}",
Expand Down
4 changes: 1 addition & 3 deletions src/learnerPortalLinks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getAuthenticatedUser } from '@edx/frontend-auth'; // eslint-disable-line
import { fetchEnterpriseCustomers } from './service';
import { isEnterpriseLearner } from './utils';

Expand Down Expand Up @@ -63,9 +62,8 @@ function getCachedLearnerPortalLinks(userId) {
return null;
}

export default async function getLearnerPortalLinks(apiClient) {
export default async function getLearnerPortalLinks(apiClient, authenticatedUser) {
let learnerPortalLinks = [];
const authenticatedUser = await getAuthenticatedUser();

if (authenticatedUser !== null && isEnterpriseLearner(authenticatedUser)) {
const { userId } = authenticatedUser;
Expand Down
7 changes: 0 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,12 @@ module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
library: 'frontend-auth',
libraryTarget: 'umd',
globalObject: 'typeof self !== \'undefined\' ? self : this',
},
resolve: {
extensions: ['.js', '.jsx'],
},
externals: {
'@edx/frontend-auth': {
commonjs: '@edx/frontend-auth',
commonjs2: '@edx/frontend-auth',
},
},
plugins: [
new UglifyJsPlugin({
sourceMap: true,
Expand Down

0 comments on commit 08351db

Please sign in to comment.