@brightspace-hmc/siren-sdk
Advanced tools
Comparing version 3.10.0 to 3.11.0
{ | ||
"name": "@brightspace-hmc/siren-sdk", | ||
"version": "3.10.0", | ||
"version": "3.11.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "", |
import { Actions, Classes } from '../../hypermedia-constants.js'; | ||
import { ContentEntity } from './ContentEntity.js'; | ||
import ContentHelperFunctions from './ContentHelperFunctions.js'; | ||
import { performSirenAction } from '../../es6/SirenAction.js'; | ||
@@ -25,2 +26,24 @@ | ||
/** | ||
* @returns {string|null} HTML description of the SCORM activity | ||
*/ | ||
descriptionRichText() { | ||
const descriptionSubEntity = ContentHelperFunctions.getDescriptionSubEntity(this._entity); | ||
if (!descriptionSubEntity) { | ||
return null; | ||
} | ||
return descriptionSubEntity.properties.html || ''; | ||
} | ||
/** | ||
* @returns {string|null} Plaintext description of the SCORM activity | ||
*/ | ||
descriptionText() { | ||
const descriptionSubEntity = ContentHelperFunctions.getDescriptionSubEntity(this._entity); | ||
if (!descriptionSubEntity) { | ||
return null; | ||
} | ||
return descriptionSubEntity.properties.text || ''; | ||
} | ||
/** | ||
* @returns {boolean} external resource value (i.e. open in new tab or not) | ||
@@ -72,2 +95,19 @@ */ | ||
/** | ||
* Updates the SCORM activity's description | ||
* @param {string} richText Rich text description to set on the SCORM activity | ||
*/ | ||
async setScormActivityDescription(richText) { | ||
if (!this._entity) { | ||
return; | ||
} | ||
const action = this._entity.getActionByName(Actions.content.updateDescription); | ||
if (!action) { | ||
return; | ||
} | ||
const fields = [{ name: 'description', value: richText }]; | ||
return await performSirenAction(this._token, action, fields); | ||
} | ||
/** | ||
* Updates the SCORM activity to have the given title | ||
@@ -131,2 +171,3 @@ * @param {string} title Title to set on the SCORM activity | ||
[this.title(), contentscormActivity.title], | ||
[this.descriptionRichText(), contentscormActivity.descriptionRichText], | ||
[this.isExternalResource(), contentscormActivity.isExternalResource] | ||
@@ -133,0 +174,0 @@ ]; |
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
412906
11431