qti3-item-player-vue3 0.2.18 → 0.2.20
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/assets/pci/pci.html +37 -19
- package/dist/qti3-item-player-vue3.js +6201 -5487
- package/dist/qti3-item-player-vue3.umd.cjs +56 -56
- package/dist/qti3Player.css +1 -1
- package/package.json +1 -1
package/dist/assets/pci/pci.html
CHANGED
@@ -127,25 +127,39 @@ let qtiCustomInteractionContext = {
|
|
127
127
|
* }
|
128
128
|
*/
|
129
129
|
setRenderingProperties (instance, properties) {
|
130
|
-
if ((typeof instance.setRenderingProperties !== 'undefined') && typeof instance.setRenderingProperties == 'function') {
|
130
|
+
if ((typeof instance.setRenderingProperties !== 'undefined') && (typeof instance.setRenderingProperties == 'function')) {
|
131
131
|
console.log('[PCI Context] Interaction SetRenderingProperties:', properties)
|
132
132
|
instance.setRenderingProperties(properties)
|
133
133
|
}
|
134
134
|
},
|
135
135
|
|
136
136
|
/**
|
137
|
-
* Allow the delivery engine to check the validity of PCI instance.
|
137
|
+
* Allow the delivery engine to check the validity of the PCI instance.
|
138
138
|
* If the PCI provides a checkValidity function then use that function.
|
139
139
|
* Otherwise, return boolean true (is valid).
|
140
140
|
* @param {Object} instance The Custom Interaction Instance.
|
141
141
|
*/
|
142
|
-
|
142
|
+
checkValidity (instance) {
|
143
143
|
// default to true
|
144
144
|
let isValid = true
|
145
|
-
if ((typeof instance.checkValidity !== 'undefined') && typeof instance.checkValidity == 'function') {
|
145
|
+
if ((typeof instance.checkValidity !== 'undefined') && (typeof instance.checkValidity == 'function')) {
|
146
146
|
isValid = instance.checkValidity()
|
147
147
|
}
|
148
148
|
return isValid
|
149
|
+
},
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Allow the delivery engine to get the custom validity message of the PCI instance.
|
153
|
+
* If the PCI provides a getCustomValidity function then use that function.
|
154
|
+
* Otherwise, return the empty string.
|
155
|
+
* @param {Object} instance The Custom Interaction Instance.
|
156
|
+
*/
|
157
|
+
getCustomValidityMessage (instance) {
|
158
|
+
let message = ''
|
159
|
+
if ((typeof instance.getCustomValidity !== 'undefined') && (typeof instance.getCustomValidity == 'function')) {
|
160
|
+
message = instance.getCustomValidity()
|
161
|
+
}
|
162
|
+
return message
|
149
163
|
}
|
150
164
|
|
151
165
|
}
|
@@ -494,6 +508,10 @@ const QTI_PCI_API = {
|
|
494
508
|
return qtiCustomInteractionContext.checkValidity(this.getInstance())
|
495
509
|
},
|
496
510
|
|
511
|
+
getCustomValidityMessage () {
|
512
|
+
return qtiCustomInteractionContext.getCustomValidityMessage(this.getInstance())
|
513
|
+
},
|
514
|
+
|
497
515
|
NotifyPciChildLoaded () {
|
498
516
|
if (self == top) return
|
499
517
|
|
@@ -510,12 +528,21 @@ const QTI_PCI_API = {
|
|
510
528
|
if (self == top) return
|
511
529
|
|
512
530
|
const isValid = this.checkValidity()
|
531
|
+
const invalidResponseMessage = this.getCustomValidityMessage()
|
513
532
|
const height = this.getDom().clientHeight
|
514
533
|
const computedHeight = (height) ? height : 0
|
515
534
|
const width = this.getDom().clientWidth
|
516
535
|
const computedWidth = (width) ? width : 0
|
517
536
|
|
518
|
-
window.parent.postMessage({
|
537
|
+
window.parent.postMessage({
|
538
|
+
message: 'PciReady',
|
539
|
+
identifier: this.getResponseIdentifier(),
|
540
|
+
valid: isValid,
|
541
|
+
invalidResponseMessage: invalidResponseMessage,
|
542
|
+
width: computedWidth,
|
543
|
+
height: computedHeight,
|
544
|
+
success: true
|
545
|
+
},'*')
|
519
546
|
},
|
520
547
|
|
521
548
|
NotifyPciDone (instance, response, state, status) {
|
@@ -610,12 +637,12 @@ const QTI_PCI_API = {
|
|
610
637
|
return
|
611
638
|
}
|
612
639
|
|
613
|
-
// event.detail has
|
640
|
+
// event.detail has two required properties and two optional properties
|
614
641
|
// {
|
615
|
-
// interaction: <instance>,
|
616
|
-
// responseIdentifier: <interaction response identifer>,
|
617
|
-
// valid: <validity boolean>,
|
618
|
-
// value: <response value>
|
642
|
+
// interaction: <instance>, (req)
|
643
|
+
// responseIdentifier: <interaction response identifer>, (req)
|
644
|
+
// valid: <validity boolean>, (opt)
|
645
|
+
// value: <response value> (opt)
|
619
646
|
// }
|
620
647
|
if (typeof event.detail.interaction === 'undefined') {
|
621
648
|
console.log('[QtiInteractionChanged][Engine][Module Error]: event detail is missing required "interaction" property', event.detail)
|
@@ -625,15 +652,6 @@ const QTI_PCI_API = {
|
|
625
652
|
console.log('[QtiInteractionChanged][Engine][Module Error]: event detail is missing required "responseIdentifier" property', event.detail)
|
626
653
|
return
|
627
654
|
}
|
628
|
-
if (typeof event.detail.valid === 'undefined') {
|
629
|
-
console.log('[QtiInteractionChanged][Engine][Module Error]: event detail is missing required "valid" property', event.detail)
|
630
|
-
return
|
631
|
-
}
|
632
|
-
if (typeof event.detail.value === 'undefined') {
|
633
|
-
console.log('[QtiInteractionChanged][Engine][Module Error]: event detail is missing required "value" property', event.detail)
|
634
|
-
return
|
635
|
-
}
|
636
|
-
|
637
655
|
console.log('[QtiInteractionChanged][Engine]', event.detail)
|
638
656
|
this.NotifyPciInteractionChanged(event.detail.valid, event.detail.value)
|
639
657
|
}
|