@brightspace-hmc/siren-sdk
Advanced tools
Comparing version 2.126.0 to 2.127.0
{ | ||
"name": "@brightspace-hmc/siren-sdk", | ||
"version": "2.126.0", | ||
"version": "2.127.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "", |
@@ -5,2 +5,4 @@ import { Actions, Classes, Rels } from '../../hypermedia-constants.js'; | ||
const NONE_RATING_TYPE = 'None'; | ||
const HUMAN_GENERATED = 0; | ||
const AI_INSPIRED = 3; | ||
@@ -45,2 +47,6 @@ /** | ||
isAiInspired() { | ||
return this._entity && this._entity.hasClass(Classes.discussions.aiInspired); | ||
} | ||
/** | ||
@@ -165,2 +171,21 @@ * @returns {bool} Whether or not the discussion topic entity has posts. | ||
/** | ||
* @summary Formats action and fields if topic has been ai inspired | ||
* @param {object} topic the topic that's being modified | ||
* @returns {object} the appropriate action/fields to update | ||
*/ | ||
_formatUpdateAiInspiredAction(topic) { | ||
const { isAiInspired } = topic || {}; | ||
if (typeof isAiInspired === 'undefined') return; | ||
if (!this._hasFieldValueChanged(isAiInspired, this.isAiInspired())) return; | ||
const action = this._entity.getActionByName(Actions.discussions.topic.updateName); | ||
const fields = [ | ||
{ name: 'aiHumanOrigin', value: isAiInspired ? AI_INSPIRED : HUMAN_GENERATED }, | ||
]; | ||
return { action, fields }; | ||
} | ||
/** | ||
* @summary Formats action and fields if topic 'requires approval' status has changed and user has edit permission | ||
@@ -423,2 +448,3 @@ * @param {object} topic the topic that's being modified | ||
const updateRequiresApproval = this._formatUpdateRequiresApproval(topic); | ||
const updateIsAiInspired = this._formatUpdateAiInspiredAction(topic); | ||
@@ -431,3 +457,4 @@ const sirenActions = [ | ||
updateParticipationOption, | ||
updateRequiresApproval | ||
updateRequiresApproval, | ||
updateIsAiInspired | ||
]; | ||
@@ -434,0 +461,0 @@ |
@@ -438,3 +438,4 @@ export const Rels = { | ||
restrictedTopicDefault: 'restricted-topic-default', | ||
restrictedThreadsDefault: 'restricted-threads-default' | ||
restrictedThreadsDefault: 'restricted-threads-default', | ||
aiInspired: 'ai-inspired' | ||
}, | ||
@@ -441,0 +442,0 @@ enrollments: { |
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
405963
11242