@pie-players/pie-assessment-player 0.3.16 → 0.3.19
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 +52 -0
- package/dist/components/AssessmentPlayerDefaultElement.d.ts +14 -1
- package/dist/components/AssessmentPlayerDefaultElement.d.ts.map +1 -1
- package/dist/pie-assessment-player.js +655 -124
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -8,7 +8,59 @@ Primary entrypoint:
|
|
|
8
8
|
|
|
9
9
|
- `@pie-players/pie-assessment-player`
|
|
10
10
|
|
|
11
|
+
## Debug logging
|
|
12
|
+
|
|
13
|
+
Assessment-player now exposes a `debug` option on `pie-assessment-player-default`.
|
|
14
|
+
|
|
15
|
+
- Enable verbose debug logs: `<pie-assessment-player-default debug="true">`
|
|
16
|
+
- Disable verbose debug logs: `<pie-assessment-player-default debug="false">` (or `debug="0"`)
|
|
17
|
+
|
|
18
|
+
The setting is forwarded to the rendered section-player instance and also applies
|
|
19
|
+
the global flag (`window.PIE_DEBUG`) for shared runtime logging behavior.
|
|
20
|
+
|
|
11
21
|
Component registration entrypoints:
|
|
12
22
|
|
|
13
23
|
- `@pie-players/pie-assessment-player/components/assessment-player-default-element`
|
|
14
24
|
- `@pie-players/pie-assessment-player/components/assessment-player-shell-element`
|
|
25
|
+
|
|
26
|
+
## Instrumentation and observability
|
|
27
|
+
|
|
28
|
+
Assessment-player instrumentation is provider-agnostic and built on the shared
|
|
29
|
+
`InstrumentationProvider` contract used across players.
|
|
30
|
+
|
|
31
|
+
Canonical provider injection paths:
|
|
32
|
+
|
|
33
|
+
- `sectionPlayerRuntime.player.loaderConfig.instrumentationProvider`
|
|
34
|
+
- `sectionPlayerPlayer.loaderConfig.instrumentationProvider` (fallback)
|
|
35
|
+
|
|
36
|
+
Provider semantics:
|
|
37
|
+
|
|
38
|
+
- With `trackPageActions: true`, missing/`undefined` provider values use the default New Relic provider path.
|
|
39
|
+
- `instrumentationProvider: null` explicitly disables instrumentation.
|
|
40
|
+
- Invalid provider objects are ignored (optional debug warning), also no-op.
|
|
41
|
+
- Existing `item-player` behavior remains the compatibility anchor.
|
|
42
|
+
- To keep production telemetry while debugging, use `CompositeInstrumentationProvider`
|
|
43
|
+
with `NewRelicInstrumentationProvider` and `DebugPanelInstrumentationProvider`.
|
|
44
|
+
- Toolkit telemetry forwarding uses the same provider path, so tool/backend
|
|
45
|
+
operational events appear in production providers and debug overlays.
|
|
46
|
+
|
|
47
|
+
Assessment-player owned canonical stream:
|
|
48
|
+
|
|
49
|
+
- `pie-assessment-controller-ready`
|
|
50
|
+
- `pie-assessment-navigation-requested`
|
|
51
|
+
- `pie-assessment-route-changed`
|
|
52
|
+
- `pie-assessment-session-applied`
|
|
53
|
+
- `pie-assessment-session-changed`
|
|
54
|
+
- `pie-assessment-progress-changed`
|
|
55
|
+
- `pie-assessment-submission-state-changed`
|
|
56
|
+
- `pie-assessment-error`
|
|
57
|
+
|
|
58
|
+
Ownership boundary: assessment-player owns assessment semantics only. Section
|
|
59
|
+
and toolkit semantics remain in their own streams to avoid overlap. Bridge
|
|
60
|
+
dedupe is a safety net, not the primary correctness mechanism.
|
|
61
|
+
|
|
62
|
+
Toolkit tool/backend operational stream (when toolkit is mounted):
|
|
63
|
+
|
|
64
|
+
- `pie-tool-init-start|success|error`
|
|
65
|
+
- `pie-tool-backend-call-start|success|error`
|
|
66
|
+
- `pie-tool-library-load-start|success|error`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Env } from '@pie-players/pie-players-shared/types';
|
|
2
2
|
import { AssessmentControllerHandle } from '../controller/AssessmentController.js';
|
|
3
3
|
import { AssessmentPlayerProgressSnapshot, AssessmentPlayerRuntimeHostContract, AssessmentPlayerSnapshot } from '../contracts/runtime-host-contract.js';
|
|
4
|
-
import { AssessmentDefinition, AssessmentPlayerHooks } from '../types.js';
|
|
4
|
+
import { AssessmentDefinition, AssessmentPlayerHooks, AssessmentPlayerRuntimeConfig } from '../types.js';
|
|
5
5
|
export declare class AssessmentPlayerDefaultElement extends HTMLElement implements AssessmentPlayerRuntimeHostContract {
|
|
6
6
|
static get observedAttributes(): string[];
|
|
7
7
|
assessmentId: string;
|
|
@@ -13,24 +13,37 @@ export declare class AssessmentPlayerDefaultElement extends HTMLElement implemen
|
|
|
13
13
|
showNavigation: boolean | string | null | undefined;
|
|
14
14
|
sectionPlayerLayout: "splitpane" | "vertical";
|
|
15
15
|
playerType: "iife" | "esm" | "preloaded";
|
|
16
|
+
private _debug;
|
|
16
17
|
private controller;
|
|
17
18
|
private controllerReadyPromise;
|
|
18
19
|
private controllerReadyResolve;
|
|
19
20
|
private sectionHost;
|
|
20
21
|
private sectionControllerRef;
|
|
21
22
|
private unsubscribeController?;
|
|
23
|
+
private detachInstrumentationBridge?;
|
|
24
|
+
private _sectionPlayerRuntime;
|
|
25
|
+
private _sectionPlayerPlayer;
|
|
22
26
|
private readiness;
|
|
23
27
|
constructor();
|
|
24
28
|
attributeChangedCallback(name: string, _oldValue: string | null, value: string | null): void;
|
|
29
|
+
get debug(): boolean | string | null | undefined;
|
|
30
|
+
set debug(value: boolean | string | null | undefined);
|
|
31
|
+
get sectionPlayerRuntime(): AssessmentPlayerRuntimeConfig["sectionPlayerRuntime"];
|
|
32
|
+
set sectionPlayerRuntime(value: AssessmentPlayerRuntimeConfig["sectionPlayerRuntime"]);
|
|
33
|
+
get sectionPlayerPlayer(): AssessmentPlayerRuntimeConfig["sectionPlayerPlayer"];
|
|
34
|
+
set sectionPlayerPlayer(value: AssessmentPlayerRuntimeConfig["sectionPlayerPlayer"]);
|
|
25
35
|
connectedCallback(): void;
|
|
26
36
|
disconnectedCallback(): void;
|
|
27
37
|
private dispatch;
|
|
28
38
|
private bootstrapController;
|
|
39
|
+
private resolveInstrumentationProvider;
|
|
40
|
+
private attachInstrumentationBridge;
|
|
29
41
|
private renderEmptyState;
|
|
30
42
|
private buildSectionPlayerTag;
|
|
31
43
|
private syncCurrentSectionSessionIntoAssessment;
|
|
32
44
|
private attachSectionControllerReadyListener;
|
|
33
45
|
private render;
|
|
46
|
+
private applyDebugFlag;
|
|
34
47
|
getSnapshot(): AssessmentPlayerSnapshot;
|
|
35
48
|
selectNavigation(): import('../contracts/runtime-host-contract.js').AssessmentPlayerNavigationSnapshot;
|
|
36
49
|
selectReadiness(): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssessmentPlayerDefaultElement.d.ts","sourceRoot":"","sources":["../../src/components/AssessmentPlayerDefaultElement.ts"],"names":[],"mappings":"AAAA,OAAO,6EAA6E,CAAC;AACrF,OAAO,4EAA4E,CAAC;
|
|
1
|
+
{"version":3,"file":"AssessmentPlayerDefaultElement.d.ts","sourceRoot":"","sources":["../../src/components/AssessmentPlayerDefaultElement.ts"],"names":[],"mappings":"AAAA,OAAO,6EAA6E,CAAC;AACrF,OAAO,4EAA4E,CAAC;AAMpF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAEjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAQxF,OAAO,KAAK,EACX,gCAAgC,EAChC,mCAAmC,EACnC,wBAAwB,EACxB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EACX,oBAAoB,EACpB,qBAAqB,EACrB,6BAA6B,EAC7B,MAAM,aAAa,CAAC;AAoBrB,qBAAa,8BACZ,SAAQ,WACR,YAAW,mCAAmC;IAE9C,MAAM,KAAK,kBAAkB,aAS5B;IAED,YAAY,SAAM;IAClB,SAAS,SAAM;IACf,UAAU,EAAE,oBAAoB,GAAG,IAAI,CAAQ;IAC/C,GAAG,EAAE,GAAG,GAAG,IAAI,CAAQ;IACvB,WAAW,EAAE,OAAO,CAAQ;IAC5B,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAQ;IAC3C,cAAc,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,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C;IAe/C,OAAO,CAAC,oCAAoC;IAqB5C,OAAO,CAAC,MAAM;IA6Hd,OAAO,CAAC,cAAc;IActB,WAAW,IAAI,wBAAwB;IA6BvC,gBAAgB;IAIhB,eAAe;;;IAIf,cAAc,IAAI,gCAAgC;IAIlD,UAAU,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;IAgCvD,YAAY,IAAI,OAAO;IAqBvB,gBAAgB,IAAI,OAAO;IAqB3B,uBAAuB,IAAI,0BAA0B,GAAG,IAAI;IAItD,2BAA2B,CAAC,SAAS,SAAO;CASlD"}
|
|
@@ -1,39 +1,512 @@
|
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var z = (s, e, t) => e in s ? M(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var f = (s, e, t) => z(s, typeof e != "symbol" ? e + "" : e, t);
|
|
1
4
|
import "@pie-players/pie-section-player/components/section-player-splitpane-element";
|
|
2
5
|
import "@pie-players/pie-section-player/components/section-player-vertical-element";
|
|
3
|
-
function
|
|
6
|
+
function _(s, e) {
|
|
7
|
+
const t = `[${s}]`;
|
|
8
|
+
return {
|
|
9
|
+
// Only debug method checks debugEnabledFn - it's checked dynamically on every call
|
|
10
|
+
debug: (n, ...i) => {
|
|
11
|
+
e() && console.debug(t, n, ...i);
|
|
12
|
+
},
|
|
13
|
+
// info, warn, error always log (not gated by debug flag)
|
|
14
|
+
info: (n, ...i) => console.info(t, n, ...i),
|
|
15
|
+
warn: (n, ...i) => console.warn(t, n, ...i),
|
|
16
|
+
error: (n, ...i) => console.error(t, n, ...i)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function D() {
|
|
20
|
+
return typeof window < "u" && window.PIE_DEBUG === !0;
|
|
21
|
+
}
|
|
22
|
+
var y;
|
|
23
|
+
(function(s) {
|
|
24
|
+
s.player = "player.js", s.clientPlayer = "client-player.js", s.editor = "editor.js";
|
|
25
|
+
})(y || (y = {}));
|
|
26
|
+
var E;
|
|
27
|
+
(function(s) {
|
|
28
|
+
s.loading = "loading", s.loaded = "loaded";
|
|
29
|
+
})(E || (E = {}));
|
|
30
|
+
typeof window < "u" && !window.pieHelpers && (window.pieHelpers = {
|
|
31
|
+
loadingScripts: {},
|
|
32
|
+
loadingPromises: {}
|
|
33
|
+
});
|
|
34
|
+
const F = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, T = "https://proxy.pie-api.com", G = `${T}/bundles/`;
|
|
35
|
+
function B(s) {
|
|
36
|
+
try {
|
|
37
|
+
const e = F?.[s];
|
|
38
|
+
if (typeof e == "string" && e.length > 0)
|
|
39
|
+
return e;
|
|
40
|
+
} catch {
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
typeof window < "u" && window.PIE_BUILDER_ORIGIN_URL || B("PUBLIC_BUILDER_ORIGIN_URL");
|
|
44
|
+
typeof window < "u" && window.PIE_BUILDER_BUNDLE_URL || B("PUBLIC_BUILDER_BUNDLE_URL");
|
|
45
|
+
var w;
|
|
46
|
+
(function(s) {
|
|
47
|
+
s.SAVE = "save", s.MODEL = "model", s.SCORE = "score", s.MANUAL_SCORE = "manual-score";
|
|
48
|
+
})(w || (w = {}));
|
|
49
|
+
var P;
|
|
50
|
+
(function(s) {
|
|
51
|
+
s.AUTO = "auto", s.MANUAL = "manual";
|
|
52
|
+
})(P || (P = {}));
|
|
53
|
+
var N;
|
|
54
|
+
(function(s) {
|
|
55
|
+
s.GATHER = "gather", s.VIEW = "view", s.EVALUATE = "evaluate";
|
|
56
|
+
})(N || (N = {}));
|
|
57
|
+
var C;
|
|
58
|
+
(function(s) {
|
|
59
|
+
s.PENDING = "pending", s.IN_PROGRESS = "in_progress", s.COMPLETED = "completed", s.FAILED = "failed";
|
|
60
|
+
})(C || (C = {}));
|
|
61
|
+
var A;
|
|
62
|
+
(function(s) {
|
|
63
|
+
s[s.ROOT = 0] = "ROOT", s[s.SUBJECT = 1] = "SUBJECT", s[s.LEVEL = 2] = "LEVEL", s[s.STANDARD = 3] = "STANDARD";
|
|
64
|
+
})(A || (A = {}));
|
|
65
|
+
y.player;
|
|
66
|
+
function U(s) {
|
|
67
|
+
if (!s || typeof s != "object")
|
|
68
|
+
return !1;
|
|
69
|
+
const e = s;
|
|
70
|
+
return typeof e.providerId == "string" && typeof e.providerName == "string" && typeof e.initialize == "function" && typeof e.trackError == "function" && typeof e.trackEvent == "function" && typeof e.destroy == "function" && typeof e.isReady == "function";
|
|
71
|
+
}
|
|
72
|
+
const H = _("instrumentation-event-bridge", () => D());
|
|
73
|
+
function V(s) {
|
|
74
|
+
return s && typeof s == "object" ? s : typeof s > "u" ? {} : { value: s };
|
|
75
|
+
}
|
|
76
|
+
function j(s) {
|
|
77
|
+
H.warn(`[InstrumentationEventBridge:${s}] Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
|
|
78
|
+
}
|
|
79
|
+
function q(s) {
|
|
80
|
+
try {
|
|
81
|
+
s.provider.trackError(s.error instanceof Error ? s.error : new Error(String(s.error ?? "Unknown instrumentation bridge error")), {
|
|
82
|
+
component: s.component,
|
|
83
|
+
errorType: "InstrumentationBridgeError",
|
|
84
|
+
sourceEventName: s.sourceEventName
|
|
85
|
+
});
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function J(s) {
|
|
90
|
+
if (!s.host || !s.eventMap.length)
|
|
91
|
+
return () => {
|
|
92
|
+
};
|
|
93
|
+
if (!s.instrumentationProvider)
|
|
94
|
+
return () => {
|
|
95
|
+
};
|
|
96
|
+
if (!U(s.instrumentationProvider))
|
|
97
|
+
return s.debug && j(s.component), () => {
|
|
98
|
+
};
|
|
99
|
+
const e = s.instrumentationProvider, t = [], n = Math.max(0, s.dedupeWindowMs ?? 0), i = /* @__PURE__ */ new Map(), o = (r, c) => {
|
|
100
|
+
const d = [
|
|
101
|
+
c.assessmentId,
|
|
102
|
+
c.sectionId,
|
|
103
|
+
c.attemptId,
|
|
104
|
+
c.itemId,
|
|
105
|
+
c.canonicalItemId,
|
|
106
|
+
c.sourceRuntimeId
|
|
107
|
+
].map((a) => String(a ?? "")).join("|");
|
|
108
|
+
return `${r.instrumentationEventName}|${d}`;
|
|
109
|
+
};
|
|
110
|
+
for (const r of s.eventMap) {
|
|
111
|
+
const c = (d) => {
|
|
112
|
+
try {
|
|
113
|
+
if (!e.isReady() || s.shouldTrackEvent && !s.shouldTrackEvent(d))
|
|
114
|
+
return;
|
|
115
|
+
const u = V(d.detail), m = (/* @__PURE__ */ new Date()).toISOString(), h = {
|
|
116
|
+
...u,
|
|
117
|
+
...s.staticAttributes,
|
|
118
|
+
component: s.component,
|
|
119
|
+
sourceEventName: r.sourceEventName,
|
|
120
|
+
timestamp: m
|
|
121
|
+
};
|
|
122
|
+
if (n > 0) {
|
|
123
|
+
const S = Date.now(), I = o(r, h), b = i.get(I);
|
|
124
|
+
if (typeof b == "number" && S - b < n)
|
|
125
|
+
return;
|
|
126
|
+
i.set(I, S);
|
|
127
|
+
}
|
|
128
|
+
e.trackEvent(r.instrumentationEventName, {
|
|
129
|
+
...h
|
|
130
|
+
});
|
|
131
|
+
} catch (a) {
|
|
132
|
+
q({
|
|
133
|
+
provider: e,
|
|
134
|
+
component: s.component,
|
|
135
|
+
error: a,
|
|
136
|
+
sourceEventName: r.sourceEventName
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
s.host.addEventListener(r.sourceEventName, c), t.push(() => {
|
|
141
|
+
s.host?.removeEventListener(r.sourceEventName, c);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return () => {
|
|
145
|
+
for (const r of t)
|
|
146
|
+
r();
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
class W {
|
|
150
|
+
constructor() {
|
|
151
|
+
f(this, "initialized", !1);
|
|
152
|
+
f(this, "config");
|
|
153
|
+
}
|
|
154
|
+
// ============================================================================
|
|
155
|
+
// Public API methods (template methods)
|
|
156
|
+
// ============================================================================
|
|
157
|
+
/**
|
|
158
|
+
* Track an error with the instrumentation provider
|
|
159
|
+
*
|
|
160
|
+
* Template method that:
|
|
161
|
+
* 1. Checks if provider is ready
|
|
162
|
+
* 2. Applies error filter if configured
|
|
163
|
+
* 3. Transforms attributes if configured
|
|
164
|
+
* 4. Delegates to concrete provider implementation (doTrackError)
|
|
165
|
+
*
|
|
166
|
+
* @param error The error to track
|
|
167
|
+
* @param attributes Contextual attributes
|
|
168
|
+
*/
|
|
169
|
+
trackError(e, t) {
|
|
170
|
+
if (!this.guardedOperation("trackError", e, t) || !this.applyErrorFilter(e, t))
|
|
171
|
+
return;
|
|
172
|
+
const n = this.transformAttributes(t);
|
|
173
|
+
try {
|
|
174
|
+
this.doTrackError(e, n), this.config?.debug && console.log(`[${this.providerName}] Tracked error:`, e, n);
|
|
175
|
+
} catch (i) {
|
|
176
|
+
console.error(`[${this.providerName}] Error tracking error:`, i);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Track a custom event with the instrumentation provider
|
|
181
|
+
*
|
|
182
|
+
* Template method that:
|
|
183
|
+
* 1. Checks if provider is ready
|
|
184
|
+
* 2. Applies event filter if configured
|
|
185
|
+
* 3. Applies sampling if configured
|
|
186
|
+
* 4. Transforms attributes if configured
|
|
187
|
+
* 5. Adds timestamp if not present
|
|
188
|
+
* 6. Delegates to concrete provider implementation (doTrackEvent)
|
|
189
|
+
*
|
|
190
|
+
* @param eventName Name of the event
|
|
191
|
+
* @param attributes Event attributes
|
|
192
|
+
*/
|
|
193
|
+
trackEvent(e, t) {
|
|
194
|
+
if (!this.guardedOperation("trackEvent", e, t) || !this.applyEventFilter(e, t) || !this.applySampling(e))
|
|
195
|
+
return;
|
|
196
|
+
let n = this.transformAttributes(t);
|
|
197
|
+
n.timestamp || (n = {
|
|
198
|
+
...n,
|
|
199
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
200
|
+
});
|
|
201
|
+
try {
|
|
202
|
+
this.doTrackEvent(e, n), this.config?.debug && console.log(`[${this.providerName}] Tracked event:`, e, n);
|
|
203
|
+
} catch (i) {
|
|
204
|
+
console.error(`[${this.providerName}] Error tracking event:`, i);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Track a performance metric
|
|
209
|
+
*
|
|
210
|
+
* Default implementation tracks metrics as events with a `metric:` prefix.
|
|
211
|
+
* Concrete providers can override this method if their backend has a
|
|
212
|
+
* dedicated metric API.
|
|
213
|
+
*
|
|
214
|
+
* @param metricName Name of the metric
|
|
215
|
+
* @param value Numeric value
|
|
216
|
+
* @param attributes Optional metric attributes
|
|
217
|
+
*/
|
|
218
|
+
trackMetric(e, t, n) {
|
|
219
|
+
this.trackEvent(`metric:${e}`, {
|
|
220
|
+
...n,
|
|
221
|
+
metricValue: t,
|
|
222
|
+
metricName: e
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Set user context for session tracking
|
|
227
|
+
*
|
|
228
|
+
* Template method that checks if provider is ready then delegates
|
|
229
|
+
* to concrete provider implementation.
|
|
230
|
+
*
|
|
231
|
+
* @param userId User identifier
|
|
232
|
+
* @param attributes Optional user attributes
|
|
233
|
+
*/
|
|
234
|
+
setUserContext(e, t) {
|
|
235
|
+
if (this.guardedOperation("setUserContext", e, t))
|
|
236
|
+
try {
|
|
237
|
+
this.doSetUserContext(e, t), this.config?.debug && console.log(`[${this.providerName}] Set user context:`, e, t);
|
|
238
|
+
} catch (n) {
|
|
239
|
+
console.error(`[${this.providerName}] Error setting user context:`, n);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Set global custom attributes
|
|
244
|
+
*
|
|
245
|
+
* Template method that checks if provider is ready then delegates
|
|
246
|
+
* to concrete provider implementation.
|
|
247
|
+
*
|
|
248
|
+
* @param attributes Attributes to set globally
|
|
249
|
+
*/
|
|
250
|
+
setGlobalAttributes(e) {
|
|
251
|
+
if (this.guardedOperation("setGlobalAttributes", e))
|
|
252
|
+
try {
|
|
253
|
+
this.doSetGlobalAttributes(e), this.config?.debug && console.log(`[${this.providerName}] Set global attributes:`, e);
|
|
254
|
+
} catch (t) {
|
|
255
|
+
console.error(`[${this.providerName}] Error setting global attributes:`, t);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// ============================================================================
|
|
259
|
+
// Protected utility methods (shared logic)
|
|
260
|
+
// ============================================================================
|
|
261
|
+
/**
|
|
262
|
+
* Guard operation - check if provider is ready
|
|
263
|
+
*
|
|
264
|
+
* Returns false if provider is not ready, logging a warning in debug mode.
|
|
265
|
+
*
|
|
266
|
+
* @param operation Name of the operation for logging
|
|
267
|
+
* @param args Arguments for logging
|
|
268
|
+
* @returns true if provider is ready, false otherwise
|
|
269
|
+
*/
|
|
270
|
+
guardedOperation(e, ...t) {
|
|
271
|
+
return this.isReady() ? !0 : (this.config?.debug && console.warn(`[${this.providerName}] Attempted to ${e} but provider not ready:`, ...t), !1);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Apply error filter if configured
|
|
275
|
+
*
|
|
276
|
+
* Returns false if error should be filtered out, logging in debug mode.
|
|
277
|
+
*
|
|
278
|
+
* @param error The error
|
|
279
|
+
* @param attributes Error attributes
|
|
280
|
+
* @returns true if error should be tracked, false if filtered out
|
|
281
|
+
*/
|
|
282
|
+
applyErrorFilter(e, t) {
|
|
283
|
+
return this.config?.errorFilter && !this.config.errorFilter(e, t) ? (this.config?.debug && console.log(`[${this.providerName}] Error filtered out:`, e, t), !1) : !0;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Apply event filter if configured
|
|
287
|
+
*
|
|
288
|
+
* Returns false if event should be filtered out, logging in debug mode.
|
|
289
|
+
*
|
|
290
|
+
* @param eventName Event name
|
|
291
|
+
* @param attributes Event attributes
|
|
292
|
+
* @returns true if event should be tracked, false if filtered out
|
|
293
|
+
*/
|
|
294
|
+
applyEventFilter(e, t) {
|
|
295
|
+
return this.config?.eventFilter && !this.config.eventFilter(e, t) ? (this.config?.debug && console.log(`[${this.providerName}] Event filtered out:`, e, t), !1) : !0;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Apply sampling if configured
|
|
299
|
+
*
|
|
300
|
+
* Returns false if event should be sampled out, logging in debug mode.
|
|
301
|
+
*
|
|
302
|
+
* @param eventName Event name for logging
|
|
303
|
+
* @returns true if event should be tracked, false if sampled out
|
|
304
|
+
*/
|
|
305
|
+
applySampling(e) {
|
|
306
|
+
return this.config?.sampleRate !== void 0 && this.config.sampleRate < 1 && Math.random() > this.config.sampleRate ? (this.config?.debug && console.log(`[${this.providerName}] Event sampled out:`, e), !1) : !0;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Transform attributes if transformer is configured
|
|
310
|
+
*
|
|
311
|
+
* @param attributes Original attributes
|
|
312
|
+
* @returns Transformed attributes or original if no transformer
|
|
313
|
+
*/
|
|
314
|
+
transformAttributes(e) {
|
|
315
|
+
return this.config?.attributeTransformer ? this.config.attributeTransformer(e) : e;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
class K extends W {
|
|
319
|
+
constructor() {
|
|
320
|
+
super(...arguments);
|
|
321
|
+
f(this, "providerId", "newrelic");
|
|
322
|
+
f(this, "providerName", "New Relic");
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Initialize the New Relic provider
|
|
326
|
+
*
|
|
327
|
+
* Checks if the New Relic Browser Agent is available via `window.newrelic`.
|
|
328
|
+
* If not available, initialization succeeds but `isReady()` will return false.
|
|
329
|
+
*
|
|
330
|
+
* @param config Optional configuration
|
|
331
|
+
*/
|
|
332
|
+
async initialize(t) {
|
|
333
|
+
this.config = t, typeof window < "u" && window.newrelic ? (this.initialized = !0, this.config?.debug && console.log("[NewRelicProvider] Initialized successfully")) : (this.config?.debug && console.warn("[NewRelicProvider] New Relic not available (window.newrelic not found)"), this.initialized = !1);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Check if provider is ready
|
|
337
|
+
*
|
|
338
|
+
* @returns true if New Relic is available and initialized
|
|
339
|
+
*/
|
|
340
|
+
isReady() {
|
|
341
|
+
return this.initialized && typeof window < "u" && !!window.newrelic;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Cleanup provider resources
|
|
345
|
+
*
|
|
346
|
+
* Marks provider as uninitialized. The global `window.newrelic` object
|
|
347
|
+
* is not modified.
|
|
348
|
+
*/
|
|
349
|
+
destroy() {
|
|
350
|
+
this.initialized = !1, this.config?.debug && console.log("[NewRelicProvider] Destroyed");
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Track an error with New Relic
|
|
354
|
+
*
|
|
355
|
+
* Calls `newrelic.noticeError(error, attributes)`
|
|
356
|
+
*
|
|
357
|
+
* @param error The error to track
|
|
358
|
+
* @param attributes Transformed attributes (already filtered and transformed by base class)
|
|
359
|
+
*/
|
|
360
|
+
doTrackError(t, n) {
|
|
361
|
+
window.newrelic.noticeError(t, n);
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Track a custom event/page action with New Relic
|
|
365
|
+
*
|
|
366
|
+
* Calls `newrelic.addPageAction(eventName, attributes)`
|
|
367
|
+
*
|
|
368
|
+
* @param eventName Name of the event
|
|
369
|
+
* @param attributes Transformed attributes (already filtered and transformed by base class)
|
|
370
|
+
*/
|
|
371
|
+
doTrackEvent(t, n) {
|
|
372
|
+
window.newrelic.addPageAction(t, n);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Set user context for session tracking
|
|
376
|
+
*
|
|
377
|
+
* Calls `newrelic.setUserId()` and `newrelic.setCustomAttribute()` for user attributes.
|
|
378
|
+
*
|
|
379
|
+
* @param userId User identifier
|
|
380
|
+
* @param attributes Optional user attributes
|
|
381
|
+
*/
|
|
382
|
+
doSetUserContext(t, n) {
|
|
383
|
+
const i = window.newrelic;
|
|
384
|
+
if (i.setUserId && i.setUserId(t), n && i.setCustomAttribute)
|
|
385
|
+
for (const [o, r] of Object.entries(n))
|
|
386
|
+
i.setCustomAttribute(o, r);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Set global custom attributes
|
|
390
|
+
*
|
|
391
|
+
* Calls `newrelic.setCustomAttribute()` for each attribute.
|
|
392
|
+
*
|
|
393
|
+
* @param attributes Attributes to set globally
|
|
394
|
+
*/
|
|
395
|
+
doSetGlobalAttributes(t) {
|
|
396
|
+
const n = window.newrelic;
|
|
397
|
+
if (n.setCustomAttribute)
|
|
398
|
+
for (const [i, o] of Object.entries(t))
|
|
399
|
+
n.setCustomAttribute(i, o);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
function x(s) {
|
|
403
|
+
return s && typeof s == "object" ? s : {};
|
|
404
|
+
}
|
|
405
|
+
function R(s) {
|
|
406
|
+
const e = x(s), t = x(e.loaderConfig);
|
|
407
|
+
return Object.keys(t).length > 0 ? t : null;
|
|
408
|
+
}
|
|
409
|
+
function L(s) {
|
|
410
|
+
if (!s || !("instrumentationProvider" in s))
|
|
411
|
+
return { kind: "unset" };
|
|
412
|
+
const e = s.instrumentationProvider;
|
|
413
|
+
return e === null ? { kind: "null" } : typeof e > "u" ? { kind: "unset" } : { kind: "value", value: e };
|
|
414
|
+
}
|
|
415
|
+
function k(s) {
|
|
416
|
+
if (!s || !("trackPageActions" in s))
|
|
417
|
+
return;
|
|
418
|
+
const e = s.trackPageActions;
|
|
419
|
+
return typeof e == "boolean" ? e : void 0;
|
|
420
|
+
}
|
|
421
|
+
function Y(s, e) {
|
|
422
|
+
return s.kind === "value" || s.kind === "null" ? s : e;
|
|
423
|
+
}
|
|
424
|
+
let g;
|
|
425
|
+
const Z = _("instrumentation-provider-resolution", () => D());
|
|
426
|
+
function Q() {
|
|
427
|
+
return g || (g = new K(), g.initialize()), g;
|
|
428
|
+
}
|
|
429
|
+
function X(s) {
|
|
430
|
+
const e = R(s.runtimePlayer), t = R(s.player), n = k(e), i = k(t), o = n ?? i ?? !1, r = Y(L(e), L(t));
|
|
431
|
+
if (r.kind !== "null") {
|
|
432
|
+
if (r.kind === "unset")
|
|
433
|
+
return o ? Q() : void 0;
|
|
434
|
+
if (U(r.value))
|
|
435
|
+
return r.value;
|
|
436
|
+
if (s.debug) {
|
|
437
|
+
const c = s.component ? `[${s.component}] ` : "";
|
|
438
|
+
Z.warn(`${c}Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
const ee = [
|
|
443
|
+
{
|
|
444
|
+
sourceEventName: "assessment-controller-ready",
|
|
445
|
+
instrumentationEventName: "pie-assessment-controller-ready"
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
sourceEventName: "assessment-navigation-requested",
|
|
449
|
+
instrumentationEventName: "pie-assessment-navigation-requested"
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
sourceEventName: "assessment-route-changed",
|
|
453
|
+
instrumentationEventName: "pie-assessment-route-changed"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
sourceEventName: "assessment-session-applied",
|
|
457
|
+
instrumentationEventName: "pie-assessment-session-applied"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
sourceEventName: "assessment-session-changed",
|
|
461
|
+
instrumentationEventName: "pie-assessment-session-changed"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
sourceEventName: "assessment-progress-changed",
|
|
465
|
+
instrumentationEventName: "pie-assessment-progress-changed"
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
sourceEventName: "assessment-submission-state-changed",
|
|
469
|
+
instrumentationEventName: "pie-assessment-submission-state-changed"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
sourceEventName: "assessment-error",
|
|
473
|
+
instrumentationEventName: "pie-assessment-error"
|
|
474
|
+
}
|
|
475
|
+
];
|
|
476
|
+
function p() {
|
|
4
477
|
return Date.now();
|
|
5
478
|
}
|
|
6
|
-
function
|
|
7
|
-
return
|
|
479
|
+
function v(s) {
|
|
480
|
+
return s.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
8
481
|
}
|
|
9
|
-
function
|
|
10
|
-
if (
|
|
11
|
-
return `aas_v1_${
|
|
12
|
-
const e =
|
|
13
|
-
return `aas_v1_${
|
|
482
|
+
function te(s) {
|
|
483
|
+
if (s.attemptId)
|
|
484
|
+
return `aas_v1_${v(s.assessmentId)}_${v(s.attemptId)}`;
|
|
485
|
+
const e = $(), t = e ? se(e) : "anon";
|
|
486
|
+
return `aas_v1_${v(s.assessmentId)}_${v(t)}`;
|
|
14
487
|
}
|
|
15
|
-
function
|
|
488
|
+
function $() {
|
|
16
489
|
try {
|
|
17
490
|
return typeof window > "u" ? null : window.localStorage;
|
|
18
491
|
} catch {
|
|
19
492
|
return null;
|
|
20
493
|
}
|
|
21
494
|
}
|
|
22
|
-
function
|
|
23
|
-
const e = "pie:assessment-player:anonymous-device-id", t =
|
|
495
|
+
function se(s) {
|
|
496
|
+
const e = "pie:assessment-player:anonymous-device-id", t = s.getItem(e);
|
|
24
497
|
if (t) return t;
|
|
25
|
-
const
|
|
26
|
-
return
|
|
498
|
+
const n = `anon-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
|
|
499
|
+
return s.setItem(e, n), n;
|
|
27
500
|
}
|
|
28
|
-
function
|
|
501
|
+
function O() {
|
|
29
502
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
30
503
|
}
|
|
31
|
-
function
|
|
32
|
-
const e =
|
|
504
|
+
function ne(s) {
|
|
505
|
+
const e = O(), t = s.sectionIdentifiers[0];
|
|
33
506
|
return {
|
|
34
507
|
version: 1,
|
|
35
|
-
assessmentAttemptSessionIdentifier:
|
|
36
|
-
assessmentId:
|
|
508
|
+
assessmentAttemptSessionIdentifier: s.assessmentAttemptSessionIdentifier,
|
|
509
|
+
assessmentId: s.assessmentId,
|
|
37
510
|
startedAt: e,
|
|
38
511
|
updatedAt: e,
|
|
39
512
|
navigationState: {
|
|
@@ -42,19 +515,19 @@ function I(n) {
|
|
|
42
515
|
currentSectionIdentifier: t
|
|
43
516
|
},
|
|
44
517
|
realization: {
|
|
45
|
-
seed:
|
|
46
|
-
sectionIdentifiers:
|
|
518
|
+
seed: s.seed,
|
|
519
|
+
sectionIdentifiers: s.sectionIdentifiers
|
|
47
520
|
},
|
|
48
521
|
sectionSessions: {}
|
|
49
522
|
};
|
|
50
523
|
}
|
|
51
|
-
function
|
|
52
|
-
const t =
|
|
524
|
+
function ie(s, e) {
|
|
525
|
+
const t = O();
|
|
53
526
|
return {
|
|
54
|
-
...
|
|
527
|
+
...s,
|
|
55
528
|
updatedAt: t,
|
|
56
529
|
sectionSessions: {
|
|
57
|
-
...
|
|
530
|
+
...s.sectionSessions,
|
|
58
531
|
[e.sectionIdentifier]: {
|
|
59
532
|
sectionIdentifier: e.sectionIdentifier,
|
|
60
533
|
updatedAt: t,
|
|
@@ -63,42 +536,42 @@ function b(n, e) {
|
|
|
63
536
|
}
|
|
64
537
|
};
|
|
65
538
|
}
|
|
66
|
-
function
|
|
67
|
-
const t = new Set(
|
|
539
|
+
function re(s, e) {
|
|
540
|
+
const t = new Set(s.navigationState.visitedSectionIdentifiers || []);
|
|
68
541
|
return e.currentSectionIdentifier && t.add(e.currentSectionIdentifier), {
|
|
69
|
-
...
|
|
542
|
+
...s,
|
|
70
543
|
navigationState: {
|
|
71
|
-
...
|
|
544
|
+
...s.navigationState,
|
|
72
545
|
currentSectionIndex: e.currentSectionIndex,
|
|
73
546
|
currentSectionIdentifier: e.currentSectionIdentifier,
|
|
74
547
|
visitedSectionIdentifiers: Array.from(t)
|
|
75
548
|
}
|
|
76
549
|
};
|
|
77
550
|
}
|
|
78
|
-
function
|
|
79
|
-
if (!
|
|
80
|
-
const e = [], t =
|
|
81
|
-
return t.length > 0 ? (t.forEach((
|
|
82
|
-
(
|
|
551
|
+
function oe(s) {
|
|
552
|
+
if (!s) return [];
|
|
553
|
+
const e = [], t = s.testParts || [];
|
|
554
|
+
return t.length > 0 ? (t.forEach((n, i) => {
|
|
555
|
+
(n.sections || []).forEach((o, r) => {
|
|
83
556
|
e.push({
|
|
84
|
-
stageIdentifier:
|
|
557
|
+
stageIdentifier: n.identifier,
|
|
85
558
|
stageIndex: i,
|
|
86
559
|
sectionIndex: e.length,
|
|
87
560
|
sectionIdentifier: o.identifier || `section-${i}-${r}`,
|
|
88
561
|
section: o
|
|
89
562
|
});
|
|
90
563
|
});
|
|
91
|
-
}), e) : ((
|
|
564
|
+
}), e) : ((s.sections || []).forEach((n, i) => {
|
|
92
565
|
e.push({
|
|
93
566
|
stageIdentifier: "default",
|
|
94
567
|
stageIndex: 0,
|
|
95
568
|
sectionIndex: i,
|
|
96
|
-
sectionIdentifier:
|
|
97
|
-
section:
|
|
569
|
+
sectionIdentifier: n.identifier || `section-${i}`,
|
|
570
|
+
section: n
|
|
98
571
|
});
|
|
99
572
|
}), e);
|
|
100
573
|
}
|
|
101
|
-
class
|
|
574
|
+
class ae {
|
|
102
575
|
constructor(e) {
|
|
103
576
|
this.args = e, this.listeners = /* @__PURE__ */ new Set(), this.deliveryPlan = { sections: [] }, this.session = null, this.readiness = "bootstrapping", this.submitted = !1, this.storageContext = {
|
|
104
577
|
assessmentId: e.assessmentId,
|
|
@@ -108,19 +581,19 @@ class w {
|
|
|
108
581
|
emit(e) {
|
|
109
582
|
for (const t of this.listeners) t(e);
|
|
110
583
|
}
|
|
111
|
-
handleError(e, t,
|
|
584
|
+
handleError(e, t, n) {
|
|
112
585
|
const i = e instanceof Error ? e : new Error(String(e));
|
|
113
|
-
this.args.hooks?.onError?.(i, { phase: t, details:
|
|
586
|
+
this.args.hooks?.onError?.(i, { phase: t, details: n });
|
|
114
587
|
}
|
|
115
588
|
async getPersistenceStrategy() {
|
|
116
589
|
if (this.persistenceStrategy) return this.persistenceStrategy;
|
|
117
590
|
const e = {
|
|
118
591
|
createDefaultPersistence: () => {
|
|
119
|
-
const t =
|
|
592
|
+
const t = $(), n = `pie:assessment-controller:v1:${this.storageContext.assessmentId}:${this.storageContext.attemptId || "default"}`;
|
|
120
593
|
return {
|
|
121
594
|
async loadSession() {
|
|
122
595
|
if (!t) return null;
|
|
123
|
-
const i = t.getItem(
|
|
596
|
+
const i = t.getItem(n);
|
|
124
597
|
if (!i) return null;
|
|
125
598
|
try {
|
|
126
599
|
return JSON.parse(i);
|
|
@@ -129,10 +602,10 @@ class w {
|
|
|
129
602
|
}
|
|
130
603
|
},
|
|
131
604
|
async saveSession(i, o) {
|
|
132
|
-
t && t.setItem(
|
|
605
|
+
t && t.setItem(n, JSON.stringify(o));
|
|
133
606
|
},
|
|
134
607
|
async clearSession() {
|
|
135
|
-
t && t.removeItem(
|
|
608
|
+
t && t.removeItem(n);
|
|
136
609
|
}
|
|
137
610
|
};
|
|
138
611
|
}
|
|
@@ -145,7 +618,7 @@ class w {
|
|
|
145
618
|
async createDeliveryPlan() {
|
|
146
619
|
const e = {
|
|
147
620
|
createDefaultDeliveryPlan: () => ({
|
|
148
|
-
sections:
|
|
621
|
+
sections: oe(this.args.assessment)
|
|
149
622
|
})
|
|
150
623
|
}, t = {
|
|
151
624
|
assessmentId: this.args.assessmentId,
|
|
@@ -157,8 +630,8 @@ class w {
|
|
|
157
630
|
ensureSession() {
|
|
158
631
|
if (this.session) return this.session;
|
|
159
632
|
const e = this.deliveryPlan.sections.map((t) => t.sectionIdentifier);
|
|
160
|
-
return this.session =
|
|
161
|
-
assessmentAttemptSessionIdentifier:
|
|
633
|
+
return this.session = ne({
|
|
634
|
+
assessmentAttemptSessionIdentifier: te({
|
|
162
635
|
assessmentId: this.args.assessmentId,
|
|
163
636
|
attemptId: this.args.attemptId
|
|
164
637
|
}),
|
|
@@ -179,7 +652,7 @@ class w {
|
|
|
179
652
|
try {
|
|
180
653
|
await this.args.hooks?.onBeforeAssessmentHydrate?.(this.storageContext);
|
|
181
654
|
const t = await (await this.getPersistenceStrategy()).loadSession(this.storageContext);
|
|
182
|
-
t && (this.session = t, this.emit({ type: "assessment-session-applied", timestamp:
|
|
655
|
+
t && (this.session = t, this.emit({ type: "assessment-session-applied", timestamp: p() })), this.ensureSession(), this.readiness = "ready";
|
|
183
656
|
} catch (e) {
|
|
184
657
|
this.readiness = "error", this.handleError(e, "session-load");
|
|
185
658
|
}
|
|
@@ -218,11 +691,11 @@ class w {
|
|
|
218
691
|
e > 0 ? e - 1 : 0,
|
|
219
692
|
this.session?.navigationState.currentSectionIndex || 0
|
|
220
693
|
)
|
|
221
|
-
),
|
|
694
|
+
), n = this.deliveryPlan.sections[t];
|
|
222
695
|
return {
|
|
223
696
|
currentSectionIndex: t,
|
|
224
697
|
totalSections: e,
|
|
225
|
-
currentSectionId:
|
|
698
|
+
currentSectionId: n?.sectionIdentifier,
|
|
226
699
|
canNext: t < e - 1,
|
|
227
700
|
canPrevious: t > 0
|
|
228
701
|
};
|
|
@@ -230,24 +703,24 @@ class w {
|
|
|
230
703
|
setIndex(e) {
|
|
231
704
|
const t = this.buildNavigationSnapshot();
|
|
232
705
|
if (e < 0 || e >= t.totalSections) return !1;
|
|
233
|
-
const
|
|
234
|
-
this.session =
|
|
706
|
+
const n = t.currentSectionId, i = this.deliveryPlan.sections[e];
|
|
707
|
+
this.session = re(this.ensureSession(), {
|
|
235
708
|
currentSectionIndex: e,
|
|
236
709
|
currentSectionIdentifier: i?.sectionIdentifier
|
|
237
710
|
});
|
|
238
711
|
const o = this.buildNavigationSnapshot();
|
|
239
712
|
return this.emit({
|
|
240
713
|
type: "assessment-route-changed",
|
|
241
|
-
timestamp:
|
|
714
|
+
timestamp: p(),
|
|
242
715
|
currentSectionIndex: o.currentSectionIndex,
|
|
243
716
|
totalSections: o.totalSections,
|
|
244
717
|
currentSectionId: o.currentSectionId,
|
|
245
|
-
previousSectionId:
|
|
718
|
+
previousSectionId: n,
|
|
246
719
|
canNext: o.canNext,
|
|
247
720
|
canPrevious: o.canPrevious
|
|
248
|
-
}), this.emit({ type: "assessment-session-changed", timestamp:
|
|
721
|
+
}), this.emit({ type: "assessment-session-changed", timestamp: p() }), this.emit({
|
|
249
722
|
type: "assessment-progress-changed",
|
|
250
|
-
timestamp:
|
|
723
|
+
timestamp: p(),
|
|
251
724
|
visitedSectionCount: this.ensureSession().navigationState.visitedSectionIdentifiers.length,
|
|
252
725
|
totalSections: o.totalSections
|
|
253
726
|
}), !0;
|
|
@@ -256,7 +729,7 @@ class w {
|
|
|
256
729
|
if (typeof e == "number")
|
|
257
730
|
return this.setIndex(e);
|
|
258
731
|
const t = this.deliveryPlan.sections.findIndex(
|
|
259
|
-
(
|
|
732
|
+
(n) => n.sectionIdentifier === e
|
|
260
733
|
);
|
|
261
734
|
return t < 0 ? !1 : this.setIndex(t);
|
|
262
735
|
}
|
|
@@ -271,7 +744,7 @@ class w {
|
|
|
271
744
|
async submit() {
|
|
272
745
|
this.submitted = !0, this.emit({
|
|
273
746
|
type: "assessment-submission-state-changed",
|
|
274
|
-
timestamp:
|
|
747
|
+
timestamp: p(),
|
|
275
748
|
submitted: !0
|
|
276
749
|
}), await this.persist();
|
|
277
750
|
}
|
|
@@ -289,10 +762,10 @@ class w {
|
|
|
289
762
|
return this.ensureSession().sectionSessions[e]?.session || null;
|
|
290
763
|
}
|
|
291
764
|
updateSectionSession(e, t) {
|
|
292
|
-
this.session =
|
|
765
|
+
this.session = ie(this.ensureSession(), {
|
|
293
766
|
sectionIdentifier: e,
|
|
294
767
|
sectionSession: t
|
|
295
|
-
}), this.emit({ type: "assessment-session-changed", timestamp:
|
|
768
|
+
}), this.emit({ type: "assessment-session-changed", timestamp: p() });
|
|
296
769
|
}
|
|
297
770
|
}
|
|
298
771
|
const l = {
|
|
@@ -305,16 +778,16 @@ const l = {
|
|
|
305
778
|
progressChanged: "assessment-progress-changed",
|
|
306
779
|
submissionStateChanged: "assessment-submission-state-changed",
|
|
307
780
|
error: "assessment-error"
|
|
308
|
-
},
|
|
309
|
-
function
|
|
310
|
-
if (
|
|
311
|
-
if (typeof
|
|
312
|
-
const t =
|
|
781
|
+
}, ce = "pie-section-player-splitpane", de = "pie-section-player-vertical";
|
|
782
|
+
function le(s, e = !1) {
|
|
783
|
+
if (s == null) return e;
|
|
784
|
+
if (typeof s == "boolean") return s;
|
|
785
|
+
const t = s.trim().toLowerCase();
|
|
313
786
|
return t === "" || t === "true" || t === "1" || t === "yes";
|
|
314
787
|
}
|
|
315
|
-
class
|
|
788
|
+
class ue extends HTMLElement {
|
|
316
789
|
constructor() {
|
|
317
|
-
super(), this.assessmentId = "", this.attemptId = "", this.assessment = null, this.env = null, this.coordinator = null, this.hooks = null, this.showNavigation = !0, this.sectionPlayerLayout = "splitpane", this.playerType = "iife", this.controller = null, this.controllerReadyPromise = null, this.controllerReadyResolve = null, this.sectionHost = null, this.sectionControllerRef = null, this.readiness = {
|
|
790
|
+
super(), this.assessmentId = "", this.attemptId = "", this.assessment = null, this.env = null, this.coordinator = null, this.hooks = null, this.showNavigation = !0, this.sectionPlayerLayout = "splitpane", this.playerType = "iife", this._debug = void 0, this.controller = null, this.controllerReadyPromise = null, this.controllerReadyResolve = null, this.sectionHost = null, this.sectionControllerRef = null, this._sectionPlayerRuntime = null, this._sectionPlayerPlayer = null, this.readiness = {
|
|
318
791
|
phase: "bootstrapping"
|
|
319
792
|
}, this.controllerReadyPromise = new Promise((e) => {
|
|
320
793
|
this.controllerReadyResolve = e;
|
|
@@ -326,29 +799,48 @@ class E extends HTMLElement {
|
|
|
326
799
|
"attempt-id",
|
|
327
800
|
"show-navigation",
|
|
328
801
|
"section-player-layout",
|
|
329
|
-
"player-type"
|
|
802
|
+
"player-type",
|
|
803
|
+
"debug"
|
|
330
804
|
];
|
|
331
805
|
}
|
|
332
|
-
attributeChangedCallback(e, t,
|
|
333
|
-
e === "assessment-id" && (this.assessmentId =
|
|
806
|
+
attributeChangedCallback(e, t, n) {
|
|
807
|
+
e === "assessment-id" && (this.assessmentId = n || ""), e === "attempt-id" && (this.attemptId = n || ""), e === "show-navigation" && (this.showNavigation = n), e === "section-player-layout" && (this.sectionPlayerLayout = n === "vertical" ? "vertical" : "splitpane"), e === "player-type" && (this.playerType = n || "iife"), e === "debug" && (this.debug = n), this.isConnected && this.bootstrapController();
|
|
808
|
+
}
|
|
809
|
+
get debug() {
|
|
810
|
+
return this._debug;
|
|
811
|
+
}
|
|
812
|
+
set debug(e) {
|
|
813
|
+
this._debug = e, this.applyDebugFlag();
|
|
814
|
+
}
|
|
815
|
+
get sectionPlayerRuntime() {
|
|
816
|
+
return this._sectionPlayerRuntime;
|
|
817
|
+
}
|
|
818
|
+
set sectionPlayerRuntime(e) {
|
|
819
|
+
this._sectionPlayerRuntime = e, this.isConnected && this.attachInstrumentationBridge();
|
|
820
|
+
}
|
|
821
|
+
get sectionPlayerPlayer() {
|
|
822
|
+
return this._sectionPlayerPlayer;
|
|
823
|
+
}
|
|
824
|
+
set sectionPlayerPlayer(e) {
|
|
825
|
+
this._sectionPlayerPlayer = e, this.isConnected && this.attachInstrumentationBridge();
|
|
334
826
|
}
|
|
335
827
|
connectedCallback() {
|
|
336
828
|
this.assessmentId || (this.assessmentId = this.getAttribute("assessment-id") || ""), this.attemptId || (this.attemptId = this.getAttribute("attempt-id") || ""), this.showNavigation = this.getAttribute("show-navigation") ?? this.showNavigation;
|
|
337
829
|
const e = this.getAttribute("section-player-layout");
|
|
338
830
|
this.sectionPlayerLayout = e === "vertical" ? "vertical" : this.sectionPlayerLayout;
|
|
339
831
|
const t = this.getAttribute("player-type");
|
|
340
|
-
t && (this.playerType = t), this.bootstrapController();
|
|
832
|
+
t && (this.playerType = t), this.debug = this.getAttribute("debug") ?? this.debug, this.attachInstrumentationBridge(), this.bootstrapController();
|
|
341
833
|
}
|
|
342
834
|
disconnectedCallback() {
|
|
343
|
-
this.unsubscribeController?.(), this.hooks?.onAssessmentControllerDispose?.(this.controller || void 0);
|
|
835
|
+
this.unsubscribeController?.(), this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge = void 0, this.hooks?.onAssessmentControllerDispose?.(this.controller || void 0);
|
|
344
836
|
}
|
|
345
|
-
dispatch(e, t,
|
|
837
|
+
dispatch(e, t, n = !1) {
|
|
346
838
|
return this.dispatchEvent(
|
|
347
839
|
new CustomEvent(e, {
|
|
348
840
|
detail: t,
|
|
349
841
|
bubbles: !0,
|
|
350
842
|
composed: !0,
|
|
351
|
-
cancelable:
|
|
843
|
+
cancelable: n
|
|
352
844
|
})
|
|
353
845
|
);
|
|
354
846
|
}
|
|
@@ -358,7 +850,7 @@ class E extends HTMLElement {
|
|
|
358
850
|
return;
|
|
359
851
|
}
|
|
360
852
|
this.readiness = { phase: "bootstrapping" }, this.render();
|
|
361
|
-
const e = new
|
|
853
|
+
const e = new ae({
|
|
362
854
|
assessmentId: this.assessmentId,
|
|
363
855
|
attemptId: this.attemptId || void 0,
|
|
364
856
|
assessment: this.assessment,
|
|
@@ -375,9 +867,36 @@ class E extends HTMLElement {
|
|
|
375
867
|
l.submissionStateChanged,
|
|
376
868
|
t
|
|
377
869
|
);
|
|
378
|
-
})
|
|
379
|
-
|
|
380
|
-
|
|
870
|
+
});
|
|
871
|
+
try {
|
|
872
|
+
await e.initialize(), this.readiness = { phase: "ready" }, this.controllerReadyResolve?.(e), this.dispatch(l.controllerReady, {
|
|
873
|
+
controller: e
|
|
874
|
+
}), this.hooks?.onAssessmentControllerReady?.(e), this.render();
|
|
875
|
+
} catch (t) {
|
|
876
|
+
this.readiness = { phase: "error" }, this.dispatch(l.error, {
|
|
877
|
+
error: t
|
|
878
|
+
}), this.renderEmptyState("Failed to initialize assessment player");
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
resolveInstrumentationProvider() {
|
|
882
|
+
return X({
|
|
883
|
+
runtimePlayer: this.sectionPlayerRuntime?.player,
|
|
884
|
+
player: this.sectionPlayerPlayer,
|
|
885
|
+
component: "pie-assessment-player-default"
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
attachInstrumentationBridge() {
|
|
889
|
+
this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge = J({
|
|
890
|
+
host: this,
|
|
891
|
+
instrumentationProvider: this.resolveInstrumentationProvider(),
|
|
892
|
+
component: "pie-assessment-player-default",
|
|
893
|
+
eventMap: ee,
|
|
894
|
+
staticAttributes: {
|
|
895
|
+
instrumentationLayer: "assessment",
|
|
896
|
+
assessmentId: this.assessmentId,
|
|
897
|
+
attemptId: this.attemptId || void 0
|
|
898
|
+
}
|
|
899
|
+
});
|
|
381
900
|
}
|
|
382
901
|
renderEmptyState(e) {
|
|
383
902
|
this.innerHTML = "";
|
|
@@ -385,22 +904,22 @@ class E extends HTMLElement {
|
|
|
385
904
|
t.className = "pie-assessment-player-empty", t.textContent = e, this.appendChild(t);
|
|
386
905
|
}
|
|
387
906
|
buildSectionPlayerTag() {
|
|
388
|
-
return this.sectionPlayerLayout === "vertical" ?
|
|
907
|
+
return this.sectionPlayerLayout === "vertical" ? de : ce;
|
|
389
908
|
}
|
|
390
909
|
syncCurrentSectionSessionIntoAssessment() {
|
|
391
910
|
const e = this.controller;
|
|
392
911
|
if (!e) return;
|
|
393
912
|
const t = this.sectionControllerRef || this.sectionHost?.firstElementChild?.getSectionController?.();
|
|
394
913
|
if (!t?.getSession) return;
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
|
|
914
|
+
const n = e.getCurrentSection();
|
|
915
|
+
n && e.updateSectionSession(
|
|
916
|
+
n.sectionIdentifier,
|
|
398
917
|
t.getSession()
|
|
399
918
|
);
|
|
400
919
|
}
|
|
401
920
|
attachSectionControllerReadyListener(e, t) {
|
|
402
|
-
e.addEventListener("section-controller-ready", async (
|
|
403
|
-
const i =
|
|
921
|
+
e.addEventListener("section-controller-ready", async (n) => {
|
|
922
|
+
const i = n.detail;
|
|
404
923
|
this.sectionControllerRef = i?.controller || null;
|
|
405
924
|
const o = this.controller?.getSectionSession(t);
|
|
406
925
|
o && this.sectionControllerRef?.applySession && await this.sectionControllerRef.applySession(o, { mode: "replace" });
|
|
@@ -414,11 +933,11 @@ class E extends HTMLElement {
|
|
|
414
933
|
}
|
|
415
934
|
render() {
|
|
416
935
|
const e = this.controller;
|
|
417
|
-
this.innerHTML = "";
|
|
936
|
+
this.attachInstrumentationBridge(), this.innerHTML = "";
|
|
418
937
|
const t = document.createElement("div");
|
|
419
938
|
t.className = "pie-assessment-player-default";
|
|
420
|
-
const
|
|
421
|
-
|
|
939
|
+
const n = document.createElement("style");
|
|
940
|
+
n.textContent = `
|
|
422
941
|
:host {
|
|
423
942
|
display: block;
|
|
424
943
|
height: 100%;
|
|
@@ -465,36 +984,48 @@ class E extends HTMLElement {
|
|
|
465
984
|
height: 100%;
|
|
466
985
|
overflow: hidden;
|
|
467
986
|
}
|
|
468
|
-
`, t.appendChild(
|
|
987
|
+
`, t.appendChild(n);
|
|
469
988
|
const i = this.getSnapshot();
|
|
470
|
-
if (
|
|
471
|
-
const
|
|
472
|
-
|
|
989
|
+
if (le(this.showNavigation, !0)) {
|
|
990
|
+
const d = document.createElement("div");
|
|
991
|
+
d.className = "pie-assessment-player-navigation";
|
|
473
992
|
const a = document.createElement("div");
|
|
474
993
|
a.className = "pie-assessment-player-current-position", a.textContent = i.navigation.totalSections > 0 ? `Section ${i.navigation.currentIndex + 1} of ${i.navigation.totalSections}` : "No sections";
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
|
|
994
|
+
const u = document.createElement("div");
|
|
995
|
+
u.className = "pie-assessment-player-nav-controls";
|
|
996
|
+
const m = document.createElement("button");
|
|
997
|
+
m.className = "pie-assessment-player-nav-btn", m.textContent = "Back", m.disabled = !i.navigation.canPrevious, m.addEventListener("click", () => {
|
|
479
998
|
this.navigatePrevious();
|
|
480
999
|
});
|
|
481
|
-
const
|
|
482
|
-
|
|
1000
|
+
const h = document.createElement("button");
|
|
1001
|
+
h.className = "pie-assessment-player-nav-btn", h.textContent = "Next", h.disabled = !i.navigation.canNext, h.addEventListener("click", () => {
|
|
483
1002
|
this.navigateNext();
|
|
484
|
-
}),
|
|
1003
|
+
}), u.appendChild(m), u.appendChild(h), d.appendChild(a), d.appendChild(u), t.appendChild(d);
|
|
485
1004
|
}
|
|
486
1005
|
const r = document.createElement("div");
|
|
487
1006
|
r.className = "pie-assessment-player-section-host", this.sectionHost = r;
|
|
488
|
-
const
|
|
489
|
-
if (
|
|
490
|
-
const
|
|
491
|
-
a.setAttribute("assessment-id", this.assessmentId), a.setAttribute("section-id",
|
|
1007
|
+
const c = e?.getCurrentSection() || null;
|
|
1008
|
+
if (c) {
|
|
1009
|
+
const d = this.buildSectionPlayerTag(), a = document.createElement(d);
|
|
1010
|
+
if (a.setAttribute("assessment-id", this.assessmentId), a.setAttribute("section-id", c.sectionIdentifier), this.attemptId && a.setAttribute("attempt-id", this.attemptId), a.setAttribute("player-type", this.playerType), this.debug !== void 0 && this.debug !== null) {
|
|
1011
|
+
const u = typeof this.debug == "boolean" ? String(this.debug) : this.debug;
|
|
1012
|
+
a.setAttribute("debug", u);
|
|
1013
|
+
}
|
|
1014
|
+
a.section = c.section, this.env && (a.env = this.env), this.coordinator && (a.coordinator = this.coordinator), this.sectionPlayerRuntime && (a.runtime = this.sectionPlayerRuntime), this.sectionPlayerPlayer && (a.player = this.sectionPlayerPlayer), this.attachSectionControllerReadyListener(
|
|
492
1015
|
a,
|
|
493
|
-
|
|
1016
|
+
c.sectionIdentifier
|
|
494
1017
|
), r.appendChild(a);
|
|
495
1018
|
}
|
|
496
1019
|
t.appendChild(r), this.appendChild(t);
|
|
497
1020
|
}
|
|
1021
|
+
applyDebugFlag() {
|
|
1022
|
+
if (this.debug === void 0 || this.debug === null || typeof window > "u") return;
|
|
1023
|
+
const e = String(this.debug), t = !(e.toLowerCase() === "false" || e === "0" || e === "");
|
|
1024
|
+
try {
|
|
1025
|
+
window.PIE_DEBUG = t;
|
|
1026
|
+
} catch {
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
498
1029
|
getSnapshot() {
|
|
499
1030
|
const e = this.controller?.getRuntimeState() || {
|
|
500
1031
|
readiness: this.readiness.phase,
|
|
@@ -532,15 +1063,15 @@ class E extends HTMLElement {
|
|
|
532
1063
|
return this.getSnapshot().progress;
|
|
533
1064
|
}
|
|
534
1065
|
navigateTo(e) {
|
|
535
|
-
const t = this.selectNavigation(),
|
|
536
|
-
let o =
|
|
1066
|
+
const t = this.selectNavigation(), n = t.currentIndex, i = t.currentSectionId;
|
|
1067
|
+
let o = n, r;
|
|
537
1068
|
if (typeof e == "number")
|
|
538
1069
|
o = e, r = this.controller?.getSectionAt(o)?.sectionIdentifier;
|
|
539
1070
|
else if (r = e, this.controller?.getCurrentSection()?.sectionIdentifier === r) return !0;
|
|
540
1071
|
if (!this.dispatch(
|
|
541
1072
|
l.navigationRequested,
|
|
542
1073
|
{
|
|
543
|
-
fromIndex:
|
|
1074
|
+
fromIndex: n,
|
|
544
1075
|
toIndex: o,
|
|
545
1076
|
fromSectionId: i,
|
|
546
1077
|
toSectionId: r,
|
|
@@ -549,8 +1080,8 @@ class E extends HTMLElement {
|
|
|
549
1080
|
!0
|
|
550
1081
|
)) return !1;
|
|
551
1082
|
this.syncCurrentSectionSessionIntoAssessment();
|
|
552
|
-
const
|
|
553
|
-
return
|
|
1083
|
+
const d = this.controller?.navigateTo(e) === !0;
|
|
1084
|
+
return d && this.controller?.persist(), d;
|
|
554
1085
|
}
|
|
555
1086
|
navigateNext() {
|
|
556
1087
|
const e = this.selectNavigation(), t = this.controller?.getSectionAt(e.currentIndex + 1);
|
|
@@ -591,23 +1122,23 @@ class E extends HTMLElement {
|
|
|
591
1122
|
}
|
|
592
1123
|
async waitForAssessmentController(e = 5e3) {
|
|
593
1124
|
if (this.controller) return this.controller;
|
|
594
|
-
const t = this.controllerReadyPromise || Promise.resolve(null),
|
|
1125
|
+
const t = this.controllerReadyPromise || Promise.resolve(null), n = new Promise((i) => {
|
|
595
1126
|
setTimeout(() => i(null), e);
|
|
596
1127
|
});
|
|
597
|
-
return Promise.race([t,
|
|
1128
|
+
return Promise.race([t, n]);
|
|
598
1129
|
}
|
|
599
1130
|
}
|
|
600
1131
|
customElements.get("pie-assessment-player-default") || customElements.define(
|
|
601
1132
|
"pie-assessment-player-default",
|
|
602
|
-
|
|
1133
|
+
ue
|
|
603
1134
|
);
|
|
604
|
-
function
|
|
605
|
-
if (
|
|
606
|
-
if (typeof
|
|
607
|
-
const t =
|
|
1135
|
+
function he(s, e = !1) {
|
|
1136
|
+
if (s == null) return e;
|
|
1137
|
+
if (typeof s == "boolean") return s;
|
|
1138
|
+
const t = s.trim().toLowerCase();
|
|
608
1139
|
return t === "" || t === "true" || t === "1" || t === "yes";
|
|
609
1140
|
}
|
|
610
|
-
class
|
|
1141
|
+
class me extends HTMLElement {
|
|
611
1142
|
constructor() {
|
|
612
1143
|
super(...arguments), this.showNavigation = !0;
|
|
613
1144
|
}
|
|
@@ -617,11 +1148,11 @@ class k extends HTMLElement {
|
|
|
617
1148
|
connectedCallback() {
|
|
618
1149
|
this.showNavigation = this.getAttribute("show-navigation") ?? this.showNavigation, this.render();
|
|
619
1150
|
}
|
|
620
|
-
attributeChangedCallback(e, t,
|
|
621
|
-
e === "show-navigation" && (this.showNavigation =
|
|
1151
|
+
attributeChangedCallback(e, t, n) {
|
|
1152
|
+
e === "show-navigation" && (this.showNavigation = n), this.render();
|
|
622
1153
|
}
|
|
623
1154
|
render() {
|
|
624
|
-
const e =
|
|
1155
|
+
const e = he(this.showNavigation, !0);
|
|
625
1156
|
this.innerHTML = "";
|
|
626
1157
|
const t = document.createElement("style");
|
|
627
1158
|
t.textContent = `
|
|
@@ -642,18 +1173,18 @@ class k extends HTMLElement {
|
|
|
642
1173
|
overflow: hidden;
|
|
643
1174
|
}
|
|
644
1175
|
`;
|
|
645
|
-
const
|
|
646
|
-
if (
|
|
1176
|
+
const n = document.createElement("div");
|
|
1177
|
+
if (n.className = "pie-assessment-player-shell", e) {
|
|
647
1178
|
const r = document.createElement("slot");
|
|
648
|
-
r.name = "navigation",
|
|
1179
|
+
r.name = "navigation", n.appendChild(r);
|
|
649
1180
|
}
|
|
650
1181
|
const i = document.createElement("div");
|
|
651
1182
|
i.className = "pie-assessment-player-shell__body";
|
|
652
1183
|
const o = document.createElement("slot");
|
|
653
|
-
i.appendChild(o),
|
|
1184
|
+
i.appendChild(o), n.appendChild(i), this.appendChild(t), this.appendChild(n);
|
|
654
1185
|
}
|
|
655
1186
|
}
|
|
656
|
-
customElements.get("pie-assessment-player-shell") || customElements.define("pie-assessment-player-shell",
|
|
1187
|
+
customElements.get("pie-assessment-player-shell") || customElements.define("pie-assessment-player-shell", me);
|
|
657
1188
|
export {
|
|
658
1189
|
l as ASSESSMENT_PLAYER_PUBLIC_EVENTS
|
|
659
1190
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AssessmentSection, Env, TestPart } from '@pie-players/pie-players-shared/types';
|
|
2
|
+
import { LoaderConfig } from '@pie-players/pie-players-shared/loader-config';
|
|
2
3
|
export interface SectionSessionSnapshot {
|
|
3
4
|
currentItemIndex?: number;
|
|
4
5
|
visitedItemIdentifiers?: string[];
|
|
@@ -80,11 +81,31 @@ export interface AssessmentDefinition {
|
|
|
80
81
|
testParts?: TestPart[];
|
|
81
82
|
sections?: AssessmentSection[];
|
|
82
83
|
}
|
|
84
|
+
export interface SectionPlayerLoaderOverrides {
|
|
85
|
+
loaderConfig?: LoaderConfig;
|
|
86
|
+
loaderOptions?: Record<string, unknown>;
|
|
87
|
+
[key: string]: unknown;
|
|
88
|
+
}
|
|
89
|
+
export interface SectionPlayerRuntimeOverrides {
|
|
90
|
+
player?: SectionPlayerLoaderOverrides | null;
|
|
91
|
+
[key: string]: unknown;
|
|
92
|
+
}
|
|
83
93
|
export interface AssessmentPlayerRuntimeConfig {
|
|
84
94
|
assessmentId?: string;
|
|
85
95
|
attemptId?: string;
|
|
86
96
|
assessment?: AssessmentDefinition | null;
|
|
87
97
|
env?: Env;
|
|
98
|
+
debug?: boolean | string;
|
|
99
|
+
/**
|
|
100
|
+
* Optional section-player runtime overrides passed through by assessment-player.
|
|
101
|
+
* Useful for advanced configuration such as runtime.player.loaderConfig observability wiring.
|
|
102
|
+
*/
|
|
103
|
+
sectionPlayerRuntime?: SectionPlayerRuntimeOverrides | null;
|
|
104
|
+
/**
|
|
105
|
+
* Optional section-player player overrides passed through by assessment-player.
|
|
106
|
+
* Useful for directly supplying runtime-equivalent player settings such as loaderConfig.
|
|
107
|
+
*/
|
|
108
|
+
sectionPlayerPlayer?: SectionPlayerLoaderOverrides | null;
|
|
88
109
|
hooks?: AssessmentPlayerHooks;
|
|
89
110
|
}
|
|
90
111
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,GAAG,EACH,QAAQ,EACR,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,GAAG,EACH,QAAQ,EACR,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAElF,MAAM,WAAW,sBAAsB;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,gCAAgC;IAChD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yBAAyB,EAAE,MAAM,EAAE,CAAC;IACpC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,4BAA4B;IAC5C,IAAI,EAAE,MA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AC,EAAE,4BAA4B,GAAG,IAAI,CAAC;IAC1D,KAAK,CAAC,EAAE,qBAAqB,CAAC;CAC9B"}
|
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.19",
|
|
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.19",
|
|
53
|
+
"@pie-players/pie-players-shared": "0.3.19",
|
|
54
|
+
"@pie-players/pie-section-player": "0.3.19"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@playwright/test": "^1.58.2",
|