@coursekit/client
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -83,5 +83,12 @@ 'use strict'; | ||
let meta; | ||
if (data.publicContent && data.publicContent.content) { | ||
html = md$1.render(data.publicContent.markdown); | ||
markdown = data.publicContent.markdown; | ||
} else { | ||
if (user) { | ||
html = md$1.render(data.privateContent.markdown); | ||
markdown = data.privateContent.markdown; | ||
} | ||
} | ||
if (user) { | ||
html = md$1.render(data.privateContent.markdown); | ||
markdown = data.privateContent.markdown; | ||
meta = { | ||
@@ -91,8 +98,8 @@ ...data.publicContent, | ||
}; | ||
delete meta.markdown; | ||
} else { | ||
meta = { | ||
...data.publicContent | ||
...data.publicContent | ||
}; | ||
} | ||
delete meta.markdown; | ||
const lessons = data.lessons.map(lesson => ({ | ||
@@ -174,16 +181,19 @@ id: lesson.id, | ||
let meta; | ||
if (data.publicContent && data.publicContent.content) { | ||
html = md.render(data.publicContent.markdown); | ||
markdown = data.publicContent.markdown; | ||
} else { | ||
if (status === 200) { | ||
html = md.render(data.privateContent.markdown); | ||
markdown = data.privateContent.markdown; | ||
} | ||
} | ||
if (status === 200) { | ||
html = md.render(data.privateContent.markdown); | ||
markdown = data.privateContent.markdown; | ||
complete = user ? isLessonComplete(courseId, data.id, user) : false; | ||
meta = { | ||
...data.publicContent, | ||
...data.privateContent, | ||
}; | ||
delete meta.markdown; | ||
} else { | ||
meta = { | ||
...data.publicContent | ||
}; | ||
} | ||
meta = { | ||
...data.publicContent, | ||
...data.privateContent, | ||
}; | ||
delete meta.markdown; | ||
return { | ||
@@ -190,0 +200,0 @@ status, |
@@ -9,5 +9,12 @@ import { getProgress, getNextLessonId, isCourseEnrolled, isLessonComplete } from './helpers' | ||
let meta | ||
if (data.publicContent && data.publicContent.content) { | ||
html = md.render(data.publicContent.markdown) | ||
markdown = data.publicContent.markdown | ||
} else { | ||
if (user) { | ||
html = md.render(data.privateContent.markdown) | ||
markdown = data.privateContent.markdown | ||
} | ||
} | ||
if (user) { | ||
html = md.render(data.privateContent.markdown) | ||
markdown = data.privateContent.markdown | ||
meta = { | ||
@@ -17,8 +24,8 @@ ...data.publicContent, | ||
} | ||
delete meta.markdown | ||
} else { | ||
meta = { | ||
...data.publicContent | ||
...data.publicContent | ||
} | ||
} | ||
delete meta.markdown | ||
const lessons = data.lessons.map(lesson => ({ | ||
@@ -25,0 +32,0 @@ id: lesson.id, |
@@ -38,16 +38,19 @@ import { isLessonComplete } from './helpers' | ||
let meta | ||
if (status === 200) { | ||
html = md.render(data.privateContent.markdown) | ||
markdown = data.privateContent.markdown | ||
complete = user ? isLessonComplete(courseId, data.id, user) : false | ||
meta = { | ||
...data.publicContent, | ||
...data.privateContent, | ||
} | ||
delete meta.markdown | ||
if (data.publicContent && data.publicContent.content) { | ||
html = md.render(data.publicContent.markdown) | ||
markdown = data.publicContent.markdown | ||
} else { | ||
meta = { | ||
...data.publicContent | ||
if (status === 200) { | ||
html = md.render(data.privateContent.markdown) | ||
markdown = data.privateContent.markdown | ||
} | ||
} | ||
if (status === 200) { | ||
complete = user ? isLessonComplete(courseId, data.id, user) : false | ||
} | ||
meta = { | ||
...data.publicContent, | ||
...data.privateContent, | ||
} | ||
delete meta.markdown | ||
return { | ||
@@ -54,0 +57,0 @@ status, |
{ | ||
"name": "@coursekit/client", | ||
"description": "CourseKit client library", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"main": "dist/library.js", | ||
@@ -6,0 +6,0 @@ "module": "dist/library.mjs", |
@@ -238,7 +238,7 @@ # CourseKit JavaScript Client | ||
Raw course content. `null` is the user is not logged in. | ||
Raw course content. `null` if the user is not logged in and meta property of course `public.content` is not `true`. | ||
#### `html: string | null` | ||
Rendered markdown. `null` is the user is not logged in. | ||
Rendered markdown. `null` if the user is not logged in and meta property of course `public.content` is not `true`. | ||
@@ -279,12 +279,4 @@ #### `nextLessonId: string | null` | ||
An object containing all meta properties of the lesson (these are set in the frontmatter of the lesson content). Will only include the *public* meta properties if the user is not logged in. | ||
An object containing any public meta properties of the lesson (these are set in the frontmatter of the lesson content). | ||
#### `markdown: string | null` | ||
Raw lesson content. `null` is the user is not logged in. | ||
#### `html: string | null` | ||
Rendered markdown. `null` is the user is not logged in. | ||
## CourseSummary object | ||
@@ -334,4 +326,12 @@ | ||
An object containing any public meta properties of the lesson (these are set in the frontmatter of the lesson content). | ||
An object containing all meta properties of the lesson (these are set in the frontmatter of the lesson content). Will only include the *public* meta properties if the user is not logged in. | ||
#### `markdown: string | null` | ||
Raw lesson content. `null` if the user is not logged in and meta property of lesson `public.content` is not `true`. | ||
#### `html: string | null` | ||
Rendered markdown. `null` if the user is not logged in and meta property of lesson `public.content` is not `true`. | ||
### Methods | ||
@@ -338,0 +338,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46869
1186