@patch-adams/core 1.5.8 → 1.5.10
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 +38 -4
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +38 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +38 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -948,12 +948,30 @@ function generateLrsBridgeCode(options) {
|
|
|
948
948
|
});
|
|
949
949
|
}
|
|
950
950
|
|
|
951
|
-
//
|
|
951
|
+
// Clean HTML entities from text \u2014 handles both proper (") and broken (quot;) forms
|
|
952
|
+
// Rise strips the & from entities in SCORM interaction IDs, so we need both
|
|
952
953
|
function decodeEntities(str) {
|
|
953
954
|
if (!str || typeof str !== 'string') return str;
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
955
|
+
// 1. Replace known broken entities (without &) that Rise leaves behind
|
|
956
|
+
str = str
|
|
957
|
+
.replace(/quot;/g, '"')
|
|
958
|
+
.replace(/apos;/g, "'")
|
|
959
|
+
.replace(/amp;/g, '&')
|
|
960
|
+
.replace(/lt;/g, '<')
|
|
961
|
+
.replace(/gt;/g, '>')
|
|
962
|
+
.replace(/nbsp;/g, ' ');
|
|
963
|
+
// 2. Replace numeric entities like " ' " etc.
|
|
964
|
+
str = str.replace(/&#(x?[0-9a-fA-F]+);/g, function(match, code) {
|
|
965
|
+
var num = code.charAt(0) === 'x' ? parseInt(code.substring(1), 16) : parseInt(code, 10);
|
|
966
|
+
return isNaN(num) ? match : String.fromCharCode(num);
|
|
967
|
+
});
|
|
968
|
+
// 3. Catch any remaining standard &entities; via textarea decode
|
|
969
|
+
try {
|
|
970
|
+
var txt = document.createElement('textarea');
|
|
971
|
+
txt.innerHTML = str;
|
|
972
|
+
str = txt.value;
|
|
973
|
+
} catch (e) {}
|
|
974
|
+
return str;
|
|
957
975
|
}
|
|
958
976
|
|
|
959
977
|
LRS.sessionId = generateUUID();
|
|
@@ -3692,6 +3710,22 @@ function generateLrsBridgeCode(options) {
|
|
|
3692
3710
|
sendStatement(statement);
|
|
3693
3711
|
};
|
|
3694
3712
|
|
|
3713
|
+
// Send a "launched" statement \u2014 called by skin after email gate / actor setup
|
|
3714
|
+
LRS.sendLaunchStatement = function(data) {
|
|
3715
|
+
data = data || {};
|
|
3716
|
+
var activityDetails = {
|
|
3717
|
+
launchSource: data.source || 'email-gate',
|
|
3718
|
+
employeeEmail: data.email || (LRS.actor && LRS.actor.mbox ? LRS.actor.mbox.replace('mailto:', '') : undefined),
|
|
3719
|
+
employeeId: data.employeeId || LRS.employeeId || undefined
|
|
3720
|
+
};
|
|
3721
|
+
|
|
3722
|
+
if (data.employeeName) activityDetails.employeeName = data.employeeName;
|
|
3723
|
+
|
|
3724
|
+
var statement = buildStatement('launched', ACTIVITY_TYPES.course, activityDetails, null, null);
|
|
3725
|
+
log('Sending launch statement for:', activityDetails.employeeEmail || '(unknown)');
|
|
3726
|
+
sendStatement(statement);
|
|
3727
|
+
};
|
|
3728
|
+
|
|
3695
3729
|
/**
|
|
3696
3730
|
* Re-extract actor from SCORM after LMSInitialize has been called.
|
|
3697
3731
|
* Call this from the SCORM wrapper after scormInit() succeeds,
|