@lessonkit/lxpack 1.6.0 → 1.7.1

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/README.md CHANGED
@@ -84,7 +84,7 @@ Production builds require `allowedParentOrigins` when `bridge: "auto"`.
84
84
 
85
85
  ## Docs
86
86
 
87
- [Packaging reference](https://lessonkit.readthedocs.io/en/latest/reference/packaging.html) · [LXPack bridge](https://lessonkit.readthedocs.io/en/latest/reference/lxpack-bridge.html) · [Manifest](https://lessonkit.readthedocs.io/en/latest/reference/manifest.html) · [Golden example](https://github.com/eddiethedean/lessonkit/tree/main/examples/lxpack-golden) · [TypeDoc API index](https://lessonkit.readthedocs.io/en/latest/reference/api.html)
87
+ [5-minute guide](https://lessonkit.readthedocs.io/en/latest/guides/react-developers/getting-started-in-5-minutes.html) · [LMS Go-Live](https://lessonkit.readthedocs.io/en/latest/guides/react-developers/lms-go-live.html) · [Packaging reference](https://lessonkit.readthedocs.io/en/latest/reference/packaging.html) · [TypeDoc API index](https://lessonkit.readthedocs.io/en/latest/reference/api.html)
88
88
 
89
89
  ## License
90
90
 
package/dist/bridge.cjs CHANGED
@@ -144,6 +144,7 @@ function clamp01(value) {
144
144
  function normalizeScore(raw) {
145
145
  const { score, maxScore } = raw;
146
146
  if (typeof score !== "number" || !Number.isFinite(score)) return null;
147
+ if (typeof maxScore === "number" && maxScore <= 0) return null;
147
148
  if (typeof maxScore === "number" && maxScore > 0) {
148
149
  return clamp01(score / maxScore);
149
150
  }
@@ -157,6 +158,9 @@ function normalizePassingThreshold(raw) {
157
158
  if (typeof passingScore !== "number" || !Number.isFinite(passingScore)) {
158
159
  return DEFAULT_BRIDGE_PASSING_SCORE2;
159
160
  }
161
+ if (typeof maxScore === "number" && maxScore <= 0) {
162
+ return DEFAULT_BRIDGE_PASSING_SCORE2;
163
+ }
160
164
  if (typeof maxScore === "number" && maxScore > 1) {
161
165
  return clamp01(passingScore / maxScore);
162
166
  }
package/dist/bridge.js CHANGED
@@ -28,6 +28,7 @@ function clamp01(value) {
28
28
  function normalizeScore(raw) {
29
29
  const { score, maxScore } = raw;
30
30
  if (typeof score !== "number" || !Number.isFinite(score)) return null;
31
+ if (typeof maxScore === "number" && maxScore <= 0) return null;
31
32
  if (typeof maxScore === "number" && maxScore > 0) {
32
33
  return clamp01(score / maxScore);
33
34
  }
@@ -41,6 +42,9 @@ function normalizePassingThreshold(raw) {
41
42
  if (typeof passingScore !== "number" || !Number.isFinite(passingScore)) {
42
43
  return DEFAULT_BRIDGE_PASSING_SCORE2;
43
44
  }
45
+ if (typeof maxScore === "number" && maxScore <= 0) {
46
+ return DEFAULT_BRIDGE_PASSING_SCORE2;
47
+ }
44
48
  if (typeof maxScore === "number" && maxScore > 1) {
45
49
  return clamp01(passingScore / maxScore);
46
50
  }