@patch-adams/core 1.5.1 → 1.5.3
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 +27 -13
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +27 -13
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +27 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3810,8 +3810,9 @@ function generateLrsBridgeCode(options) {
|
|
|
3810
3810
|
});
|
|
3811
3811
|
}
|
|
3812
3812
|
|
|
3813
|
-
// Track submitted Knowledge Check
|
|
3813
|
+
// Track submitted Knowledge Check questions to avoid duplicates
|
|
3814
3814
|
var submittedKnowledgeChecks = {};
|
|
3815
|
+
var kcQuestionCounter = 0;
|
|
3815
3816
|
|
|
3816
3817
|
/**
|
|
3817
3818
|
* Set up interceptors specifically for Rise Knowledge Check blocks
|
|
@@ -3843,16 +3844,26 @@ function generateLrsBridgeCode(options) {
|
|
|
3843
3844
|
* Extract and send xAPI statement for a Knowledge Check submission
|
|
3844
3845
|
*/
|
|
3845
3846
|
function extractKnowledgeCheckResult(kcBlock) {
|
|
3846
|
-
// Get block ID for
|
|
3847
|
+
// Get block ID for context
|
|
3847
3848
|
var blockContainer = kcBlock.closest('[data-block-id]');
|
|
3848
3849
|
var blockId = blockContainer ? blockContainer.getAttribute('data-block-id') : null;
|
|
3849
3850
|
|
|
3851
|
+
// Get question text first \u2014 needed for per-question dedup key
|
|
3852
|
+
var questionText = '';
|
|
3853
|
+
var questionTextEl = kcBlock.querySelector('.quiz-card__title .fr-view, .quiz-card__title');
|
|
3854
|
+
if (questionTextEl) {
|
|
3855
|
+
questionText = questionTextEl.textContent.trim();
|
|
3856
|
+
}
|
|
3857
|
+
|
|
3850
3858
|
// Get question ID from the title element
|
|
3851
3859
|
var questionTitleEl = kcBlock.querySelector('.quiz-card__title');
|
|
3852
|
-
var questionId = questionTitleEl ? questionTitleEl.id :
|
|
3860
|
+
var questionId = questionTitleEl ? questionTitleEl.id : null;
|
|
3861
|
+
|
|
3862
|
+
// Build a question-specific dedup key using question text hash
|
|
3863
|
+
// This ensures each question in a multi-question quiz block gets its own key
|
|
3864
|
+
var questionHash = questionText ? questionText.substring(0, 100) : (questionId || blockId || generateUUID());
|
|
3865
|
+
var submissionKey = 'kc-' + questionHash;
|
|
3853
3866
|
|
|
3854
|
-
// Check if we already processed this submission (avoid duplicates)
|
|
3855
|
-
var submissionKey = blockId || questionId;
|
|
3856
3867
|
var feedbackLabel = kcBlock.querySelector('.quiz-card__feedback-label');
|
|
3857
3868
|
if (!feedbackLabel) {
|
|
3858
3869
|
log('Knowledge Check: No feedback visible yet');
|
|
@@ -3868,11 +3879,9 @@ function generateLrsBridgeCode(options) {
|
|
|
3868
3879
|
}
|
|
3869
3880
|
submittedKnowledgeChecks[submissionId] = true;
|
|
3870
3881
|
|
|
3871
|
-
//
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
if (questionTextEl) {
|
|
3875
|
-
questionText = questionTextEl.textContent.trim();
|
|
3882
|
+
// Use question-specific ID for the statement (not the shared block ID)
|
|
3883
|
+
if (!questionId) {
|
|
3884
|
+
questionId = blockId ? 'q-' + blockId + '-' + questionHash.substring(0, 20) : 'q-' + generateUUID();
|
|
3876
3885
|
}
|
|
3877
3886
|
|
|
3878
3887
|
// Determine question type from aria-label
|
|
@@ -3901,11 +3910,14 @@ function generateLrsBridgeCode(options) {
|
|
|
3901
3910
|
correct: isCorrect
|
|
3902
3911
|
});
|
|
3903
3912
|
|
|
3913
|
+
// Increment question counter for this session
|
|
3914
|
+
kcQuestionCounter++;
|
|
3915
|
+
|
|
3904
3916
|
// Send question answered statement using existing LRS method
|
|
3905
3917
|
LRS.questionAnswered({
|
|
3906
3918
|
questionId: questionId,
|
|
3907
3919
|
questionGuid: blockId || generateUUID(),
|
|
3908
|
-
questionNumber:
|
|
3920
|
+
questionNumber: kcQuestionCounter,
|
|
3909
3921
|
questionText: questionText.substring(0, 500),
|
|
3910
3922
|
questionType: questionType,
|
|
3911
3923
|
answer: answerText.substring(0, 500),
|
|
@@ -4754,8 +4766,9 @@ function generateSkinCssLoader(options) {
|
|
|
4754
4766
|
}
|
|
4755
4767
|
function buildSkinCssOptions(config) {
|
|
4756
4768
|
if (!config.skin) return null;
|
|
4769
|
+
const cacheBuster = Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
|
|
4757
4770
|
return {
|
|
4758
|
-
remoteUrl: `${config.remoteDomain}/skin/${config.skin}/style.css`,
|
|
4771
|
+
remoteUrl: `${config.remoteDomain}/skin/${config.skin}/style.css?v=${cacheBuster}`,
|
|
4759
4772
|
localPath: `skin/${config.skin}/style.css`,
|
|
4760
4773
|
timeout: config.cssAfter.timeout
|
|
4761
4774
|
// reuse cssAfter timeout
|
|
@@ -4855,8 +4868,9 @@ function generateSkinJsLoader(options) {
|
|
|
4855
4868
|
}
|
|
4856
4869
|
function buildSkinJsOptions(config) {
|
|
4857
4870
|
if (!config.skin) return null;
|
|
4871
|
+
const cacheBuster = Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
|
|
4858
4872
|
return {
|
|
4859
|
-
remoteUrl: `${config.remoteDomain}/skin/${config.skin}/script.js`,
|
|
4873
|
+
remoteUrl: `${config.remoteDomain}/skin/${config.skin}/script.js?v=${cacheBuster}`,
|
|
4860
4874
|
localPath: `skin/${config.skin}/script.js`,
|
|
4861
4875
|
timeout: config.jsAfter.timeout
|
|
4862
4876
|
// reuse jsAfter timeout
|