@pie-players/pie-assessment-player 0.3.44 → 0.3.46
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/pie-assessment-player.js +40 -35
- package/package.json +4 -4
|
@@ -193,49 +193,49 @@ function oe(e) {
|
|
|
193
193
|
if (!j(e.instrumentationProvider))
|
|
194
194
|
return e.debug && ie(e.component), () => {
|
|
195
195
|
};
|
|
196
|
-
const t = e.instrumentationProvider, s = [], n = Math.max(0, e.dedupeWindowMs ?? 0), i = /* @__PURE__ */ new Map(), c = (
|
|
196
|
+
const t = e.instrumentationProvider, s = [], n = Math.max(0, e.dedupeWindowMs ?? 0), i = /* @__PURE__ */ new Map(), c = (r, o) => {
|
|
197
197
|
const d = [
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
198
|
+
o.assessmentId,
|
|
199
|
+
o.sectionId,
|
|
200
|
+
o.attemptId,
|
|
201
|
+
o.itemId,
|
|
202
|
+
o.canonicalItemId,
|
|
203
|
+
o.sourceRuntimeId
|
|
204
204
|
].map((l) => String(l ?? "")).join("|");
|
|
205
|
-
return `${
|
|
205
|
+
return `${r.instrumentationEventName}|${d}`;
|
|
206
206
|
};
|
|
207
|
-
for (const
|
|
208
|
-
const
|
|
207
|
+
for (const r of e.eventMap) {
|
|
208
|
+
const o = (d) => {
|
|
209
209
|
try {
|
|
210
210
|
if (!t.isReady() || e.shouldTrackEvent && !e.shouldTrackEvent(d)) return;
|
|
211
211
|
const l = ne(d.detail), p = (/* @__PURE__ */ new Date()).toISOString(), I = {
|
|
212
212
|
...l,
|
|
213
213
|
...e.staticAttributes,
|
|
214
214
|
component: e.component,
|
|
215
|
-
sourceEventName:
|
|
215
|
+
sourceEventName: r.sourceEventName,
|
|
216
216
|
timestamp: p
|
|
217
217
|
};
|
|
218
218
|
if (n > 0) {
|
|
219
|
-
const b = Date.now(), E = c(
|
|
219
|
+
const b = Date.now(), E = c(r, I), w = i.get(E);
|
|
220
220
|
if (typeof w == "number" && b - w < n) return;
|
|
221
221
|
i.set(E, b);
|
|
222
222
|
}
|
|
223
|
-
t.trackEvent(
|
|
223
|
+
t.trackEvent(r.instrumentationEventName, { ...I });
|
|
224
224
|
} catch (l) {
|
|
225
225
|
re({
|
|
226
226
|
provider: t,
|
|
227
227
|
component: e.component,
|
|
228
228
|
error: l,
|
|
229
|
-
sourceEventName:
|
|
229
|
+
sourceEventName: r.sourceEventName
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
|
-
e.host.addEventListener(
|
|
234
|
-
e.host?.removeEventListener(
|
|
233
|
+
e.host.addEventListener(r.sourceEventName, o), s.push(() => {
|
|
234
|
+
e.host?.removeEventListener(r.sourceEventName, o);
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
return () => {
|
|
238
|
-
for (const
|
|
238
|
+
for (const r of s) r();
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
241
|
var ae = class {
|
|
@@ -358,13 +358,13 @@ function ue() {
|
|
|
358
358
|
return v || (v = new ce(), v.initialize()), v;
|
|
359
359
|
}
|
|
360
360
|
function he(e) {
|
|
361
|
-
const t = k(e.runtimePlayer), s = k(e.player), n = D(t), i = D(s), c = n ?? i ?? !1,
|
|
362
|
-
if (
|
|
363
|
-
if (
|
|
364
|
-
if (j(
|
|
361
|
+
const t = k(e.runtimePlayer), s = k(e.player), n = D(t), i = D(s), c = n ?? i ?? !1, r = de(T(t), T(s));
|
|
362
|
+
if (r.kind !== "null") {
|
|
363
|
+
if (r.kind === "unset") return c ? ue() : void 0;
|
|
364
|
+
if (j(r.value)) return r.value;
|
|
365
365
|
if (e.debug) {
|
|
366
|
-
const
|
|
367
|
-
le.warn(`${
|
|
366
|
+
const o = e.component ? `[${e.component}] ` : "";
|
|
367
|
+
le.warn(`${o}Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
}
|
|
@@ -485,12 +485,12 @@ function Se(e) {
|
|
|
485
485
|
if (!e) return [];
|
|
486
486
|
const t = [], s = e.testParts || [];
|
|
487
487
|
return s.length > 0 ? (s.forEach((n, i) => {
|
|
488
|
-
(n.sections || []).forEach((c,
|
|
488
|
+
(n.sections || []).forEach((c, r) => {
|
|
489
489
|
t.push({
|
|
490
490
|
stageIdentifier: n.identifier,
|
|
491
491
|
stageIndex: i,
|
|
492
492
|
sectionIndex: t.length,
|
|
493
|
-
sectionIdentifier: c.identifier || `section-${i}-${
|
|
493
|
+
sectionIdentifier: c.identifier || `section-${i}-${r}`,
|
|
494
494
|
section: c
|
|
495
495
|
});
|
|
496
496
|
});
|
|
@@ -894,10 +894,10 @@ var Pe = class extends HTMLElement {
|
|
|
894
894
|
`, t.appendChild(s);
|
|
895
895
|
const n = this.getSnapshot();
|
|
896
896
|
if (we(this.showNavigation, !0)) {
|
|
897
|
-
const o = document.createElement("div");
|
|
898
|
-
o.className = "pie-assessment-player-navigation";
|
|
899
897
|
const r = document.createElement("div");
|
|
900
|
-
r.className = "pie-assessment-player-
|
|
898
|
+
r.className = "pie-assessment-player-navigation";
|
|
899
|
+
const o = document.createElement("div");
|
|
900
|
+
o.className = "pie-assessment-player-current-position", o.textContent = n.navigation.totalSections > 0 ? `Section ${n.navigation.currentIndex + 1} of ${n.navigation.totalSections}` : "No sections";
|
|
901
901
|
const d = document.createElement("div");
|
|
902
902
|
d.className = "pie-assessment-player-nav-controls";
|
|
903
903
|
const l = document.createElement("button");
|
|
@@ -907,18 +907,23 @@ var Pe = class extends HTMLElement {
|
|
|
907
907
|
const p = document.createElement("button");
|
|
908
908
|
p.className = "pie-assessment-player-nav-btn", p.textContent = "Next", p.disabled = !n.navigation.canNext, p.addEventListener("click", () => {
|
|
909
909
|
this.navigateNext();
|
|
910
|
-
}), d.appendChild(l), d.appendChild(p),
|
|
910
|
+
}), d.appendChild(l), d.appendChild(p), r.appendChild(o), r.appendChild(d), t.appendChild(r);
|
|
911
911
|
}
|
|
912
912
|
const i = document.createElement("div");
|
|
913
913
|
i.className = "pie-assessment-player-section-host", this.sectionHost = i;
|
|
914
914
|
const c = e?.getCurrentSection() || null;
|
|
915
915
|
if (c) {
|
|
916
|
-
const
|
|
917
|
-
if (
|
|
916
|
+
const r = this.buildSectionPlayerTag(), o = document.createElement(r);
|
|
917
|
+
if (o.setAttribute("assessment-id", this.assessmentId), o.setAttribute("section-id", c.sectionIdentifier), this.attemptId && o.setAttribute("attempt-id", this.attemptId), this.debug !== void 0 && this.debug !== null) {
|
|
918
918
|
const d = typeof this.debug == "boolean" ? String(this.debug) : this.debug;
|
|
919
|
-
|
|
919
|
+
o.setAttribute("debug", d);
|
|
920
920
|
}
|
|
921
|
-
|
|
921
|
+
o.section = c.section, o.runtime = {
|
|
922
|
+
playerType: this.playerType,
|
|
923
|
+
...this.env ? { env: this.env } : {},
|
|
924
|
+
...this.coordinator ? { coordinator: this.coordinator } : {},
|
|
925
|
+
...this.sectionPlayerRuntime || {}
|
|
926
|
+
}, o.hooks = { cardTitleFormatter: this.hooks?.cardTitleFormatter }, i.appendChild(o), this.attachSectionControllerReadyListener(o, c.sectionIdentifier);
|
|
922
927
|
}
|
|
923
928
|
t.appendChild(i), this.appendChild(t);
|
|
924
929
|
}
|
|
@@ -979,8 +984,8 @@ var Pe = class extends HTMLElement {
|
|
|
979
984
|
reason: "navigate-to"
|
|
980
985
|
}, !0)) return !1;
|
|
981
986
|
this.syncCurrentSectionSessionIntoAssessment();
|
|
982
|
-
const
|
|
983
|
-
return
|
|
987
|
+
const r = this.controller?.navigateTo(e) === !0;
|
|
988
|
+
return r && this.controller?.persist(), r;
|
|
984
989
|
}
|
|
985
990
|
navigateNext() {
|
|
986
991
|
const e = this.selectNavigation(), t = this.controller?.getSectionAt(e.currentIndex + 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/pie-assessment-player",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Assessment-level coordinator custom elements for orchestrating section-player instances",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"lint": "biome check ."
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@pie-players/pie-assessment-toolkit": "0.3.
|
|
53
|
-
"@pie-players/pie-players-shared": "0.3.
|
|
54
|
-
"@pie-players/pie-section-player": "0.3.
|
|
52
|
+
"@pie-players/pie-assessment-toolkit": "0.3.46",
|
|
53
|
+
"@pie-players/pie-players-shared": "0.3.46",
|
|
54
|
+
"@pie-players/pie-section-player": "0.3.46"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@axe-core/playwright": "^4.11.1",
|