@patch-adams/core 1.5.6 → 1.5.8
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.
- package/dist/cli.cjs +48 -11
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +48 -11
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +48 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +48 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -958,6 +958,14 @@ function generateLrsBridgeCode(options) {
|
|
|
958
958
|
});
|
|
959
959
|
}
|
|
960
960
|
|
|
961
|
+
// Decode HTML entities (e.g., " " & ') to clean text
|
|
962
|
+
function decodeEntities(str) {
|
|
963
|
+
if (!str || typeof str !== 'string') return str;
|
|
964
|
+
var txt = document.createElement('textarea');
|
|
965
|
+
txt.innerHTML = str;
|
|
966
|
+
return txt.value;
|
|
967
|
+
}
|
|
968
|
+
|
|
961
969
|
LRS.sessionId = generateUUID();
|
|
962
970
|
LRS.courseAttemptId = generateUUID(); // Unique per session for Xyleme correlation
|
|
963
971
|
LRS.launchTime = new Date().toISOString();
|
|
@@ -2549,6 +2557,10 @@ function generateLrsBridgeCode(options) {
|
|
|
2549
2557
|
info.id = window.location.href.split('#')[0].split('?')[0];
|
|
2550
2558
|
}
|
|
2551
2559
|
|
|
2560
|
+
// Decode any HTML entities in title/description
|
|
2561
|
+
if (info.title) info.title = decodeEntities(info.title);
|
|
2562
|
+
if (info.description) info.description = decodeEntities(info.description);
|
|
2563
|
+
|
|
2552
2564
|
// Build shared link name if not provided
|
|
2553
2565
|
if (!info.sharedLinkName && info.title && info.sharedLinkToken) {
|
|
2554
2566
|
info.sharedLinkName = info.title + ' - LMS Thin Pack';
|
|
@@ -2728,7 +2740,7 @@ function generateLrsBridgeCode(options) {
|
|
|
2728
2740
|
id: window.location.href.split('#')[0].split('?')[0],
|
|
2729
2741
|
definition: {
|
|
2730
2742
|
type: 'http://xyleme.com/bravais/activities/document',
|
|
2731
|
-
name: { 'en-US': document.title || 'Rise Course' }
|
|
2743
|
+
name: { 'en-US': decodeEntities(document.title) || 'Rise Course' }
|
|
2732
2744
|
}
|
|
2733
2745
|
};
|
|
2734
2746
|
}
|
|
@@ -2759,10 +2771,11 @@ function generateLrsBridgeCode(options) {
|
|
|
2759
2771
|
courseObj.definition.extensions = courseObj.definition.extensions || {};
|
|
2760
2772
|
|
|
2761
2773
|
if (activityDetails) {
|
|
2762
|
-
// Merge activity details into extensions
|
|
2774
|
+
// Merge activity details into extensions, decoding any HTML entities in string values
|
|
2763
2775
|
for (var key in activityDetails) {
|
|
2764
2776
|
if (activityDetails.hasOwnProperty(key)) {
|
|
2765
|
-
|
|
2777
|
+
var val = activityDetails[key];
|
|
2778
|
+
courseObj.definition.extensions[key] = typeof val === 'string' ? decodeEntities(val) : val;
|
|
2766
2779
|
}
|
|
2767
2780
|
}
|
|
2768
2781
|
}
|
|
@@ -2841,7 +2854,7 @@ function generateLrsBridgeCode(options) {
|
|
|
2841
2854
|
id: LRS.courseInfo.id,
|
|
2842
2855
|
definition: {
|
|
2843
2856
|
type: 'http://xyleme.com/bravais/activities/document',
|
|
2844
|
-
name: { 'en-US': LRS.courseInfo.title }
|
|
2857
|
+
name: { 'en-US': decodeEntities(LRS.courseInfo.title) }
|
|
2845
2858
|
}
|
|
2846
2859
|
};
|
|
2847
2860
|
|
|
@@ -2891,7 +2904,7 @@ function generateLrsBridgeCode(options) {
|
|
|
2891
2904
|
objectType: 'Activity',
|
|
2892
2905
|
definition: {
|
|
2893
2906
|
type: 'http://xyleme.com/bravais/activities/document',
|
|
2894
|
-
name: { 'en-US': LRS.courseInfo.title || 'Rise Course' }
|
|
2907
|
+
name: { 'en-US': decodeEntities(LRS.courseInfo.title) || 'Rise Course' }
|
|
2895
2908
|
}
|
|
2896
2909
|
};
|
|
2897
2910
|
|
|
@@ -3013,15 +3026,37 @@ function generateLrsBridgeCode(options) {
|
|
|
3013
3026
|
* Build activity object for questions in Xyleme format
|
|
3014
3027
|
* Name format: "Assessment Name - Q#: Question text..."
|
|
3015
3028
|
*/
|
|
3029
|
+
/**
|
|
3030
|
+
* Simple string hash for generating short, stable IDs from long strings.
|
|
3031
|
+
* Returns a hex string (8 chars). Not cryptographic \u2014 just for uniqueness.
|
|
3032
|
+
*/
|
|
3033
|
+
function hashString(str) {
|
|
3034
|
+
var hash = 0;
|
|
3035
|
+
for (var i = 0; i < str.length; i++) {
|
|
3036
|
+
var ch = str.charCodeAt(i);
|
|
3037
|
+
hash = ((hash << 5) - hash) + ch;
|
|
3038
|
+
hash = hash & hash; // Convert to 32-bit integer
|
|
3039
|
+
}
|
|
3040
|
+
return Math.abs(hash).toString(16).padStart(8, '0');
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3016
3043
|
function buildQuestionActivityObject(questionInfo) {
|
|
3017
|
-
var
|
|
3044
|
+
var rawGuid = questionInfo.questionGuid || questionInfo.id || generateUUID();
|
|
3045
|
+
|
|
3046
|
+
// Ensure the object ID stays under 255 chars total to avoid Bravais aggregation failures.
|
|
3047
|
+
// Rise SCORM interaction IDs can be very long (full slugified question text).
|
|
3048
|
+
// Use a truncated prefix + hash to keep it short but unique and stable.
|
|
3049
|
+
var questionGuid = rawGuid;
|
|
3050
|
+
if (rawGuid.length > 80) {
|
|
3051
|
+
questionGuid = rawGuid.substring(0, 60) + '_' + hashString(rawGuid);
|
|
3052
|
+
}
|
|
3018
3053
|
|
|
3019
3054
|
// Build human-readable display name
|
|
3020
3055
|
var displayName = (questionInfo.assessmentName || 'Knowledge Check');
|
|
3021
3056
|
if (questionInfo.questionNumber) {
|
|
3022
3057
|
displayName += ' - Q' + questionInfo.questionNumber;
|
|
3023
3058
|
}
|
|
3024
|
-
var questionText = questionInfo.text || questionInfo.questionText || '';
|
|
3059
|
+
var questionText = decodeEntities(questionInfo.text || questionInfo.questionText || '');
|
|
3025
3060
|
if (questionText.length > 50) {
|
|
3026
3061
|
displayName += ': ' + questionText.substring(0, 47) + '...';
|
|
3027
3062
|
} else if (questionText.length > 0) {
|
|
@@ -4398,10 +4433,12 @@ function generateLrsBridgeCode(options) {
|
|
|
4398
4433
|
var interactionId = interaction.id || ('interaction-' + idx);
|
|
4399
4434
|
|
|
4400
4435
|
// Try to make a readable question text from the interaction ID
|
|
4401
|
-
var questionText =
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4436
|
+
var questionText = decodeEntities(
|
|
4437
|
+
interactionId
|
|
4438
|
+
.replace(/_\\d+$/, '') // remove trailing _0
|
|
4439
|
+
.replace(/_/g, ' ') // underscores to spaces
|
|
4440
|
+
.substring(0, 200)
|
|
4441
|
+
);
|
|
4405
4442
|
|
|
4406
4443
|
// Get lesson context
|
|
4407
4444
|
var lessonInfo = getCachedLessonInfo();
|