@playcademy/sdk 0.24.0 → 0.24.1-beta.2
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/index.d.ts +170 -127
- package/dist/index.js +20 -3
- package/dist/internal.d.ts +2041 -1970
- package/dist/internal.js +22 -3
- package/dist/server/edge.d.ts +24 -1
- package/dist/server/edge.js +1 -1
- package/dist/server.d.ts +24 -1
- package/dist/server.js +1 -1
- package/dist/types.d.ts +458 -411
- package/package.json +1 -1
package/dist/internal.js
CHANGED
|
@@ -2289,6 +2289,23 @@ function createTimebackActivityTracker(client) {
|
|
|
2289
2289
|
};
|
|
2290
2290
|
}
|
|
2291
2291
|
|
|
2292
|
+
// src/core/timeback/course-hint.ts
|
|
2293
|
+
function withEnrollmentCourseHint(metadata, enrollments) {
|
|
2294
|
+
if (metadata.courseId !== undefined) {
|
|
2295
|
+
return metadata;
|
|
2296
|
+
}
|
|
2297
|
+
const matching = enrollments.filter((enrollment) => enrollment.grade === metadata.grade && enrollment.subject === metadata.subject);
|
|
2298
|
+
const enrollment = matching.find((candidate) => candidate.kind === "hole_filling") ?? matching[0];
|
|
2299
|
+
if (!enrollment) {
|
|
2300
|
+
return metadata;
|
|
2301
|
+
}
|
|
2302
|
+
return {
|
|
2303
|
+
...metadata,
|
|
2304
|
+
courseId: enrollment.courseId,
|
|
2305
|
+
...enrollment.id && { enrollmentId: enrollment.id }
|
|
2306
|
+
};
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2292
2309
|
// src/namespaces/game/embed.ts
|
|
2293
2310
|
function createEmbedNamespace(client) {
|
|
2294
2311
|
return {
|
|
@@ -2325,7 +2342,7 @@ function createEmbedNamespace(client) {
|
|
|
2325
2342
|
const session = new ChildSession({
|
|
2326
2343
|
slug: options.slug,
|
|
2327
2344
|
container: options.container,
|
|
2328
|
-
timeback: options.timeback,
|
|
2345
|
+
timeback: options.timeback && withEnrollmentCourseHint(options.timeback, client.timeback.user?.enrollments ?? []),
|
|
2329
2346
|
resume: resume.envelope,
|
|
2330
2347
|
resumeStore: resume.store,
|
|
2331
2348
|
reporter: {
|
|
@@ -3023,7 +3040,7 @@ function createTimebackEngine(client) {
|
|
|
3023
3040
|
activity: {
|
|
3024
3041
|
currentRunId: activityTracker.currentRunId,
|
|
3025
3042
|
isManuallyPaused: activityTracker.isActivityManuallyPaused,
|
|
3026
|
-
start: activityTracker.startActivity,
|
|
3043
|
+
start: (metadata, options) => activityTracker.startActivity(withEnrollmentCourseHint(metadata, userStore.snapshot()?.enrollments ?? []), options),
|
|
3027
3044
|
tryStartAssessment: activityTracker.tryStartAssessmentTracking,
|
|
3028
3045
|
pause: activityTracker.pauseActivity,
|
|
3029
3046
|
resume: activityTracker.resumeActivity,
|
|
@@ -4334,6 +4351,8 @@ function createTimebackNamespace2(client) {
|
|
|
4334
4351
|
get: (gameId) => client["request"](`/timeback/integrations/${gameId}`, "GET"),
|
|
4335
4352
|
getRemovedIntegrations: (gameId) => client["request"](`/timeback/integrations/${gameId}/removed`, "GET"),
|
|
4336
4353
|
createIntegration: (gameId, request) => client["request"](`/timeback/integrations/${gameId}`, "POST", { body: request }),
|
|
4354
|
+
getHoleFillingCourses: (gameId) => client["request"](`/timeback/integrations/${gameId}/hole-filling`, "GET"),
|
|
4355
|
+
createHoleFillingCourse: (gameId, request) => client["request"](`/timeback/integrations/${gameId}/hole-filling`, "POST", { body: request }),
|
|
4337
4356
|
updateIntegration: (gameId, courseId, request) => client["request"](`/timeback/integrations/${gameId}/${courseId}`, "PATCH", { body: request }),
|
|
4338
4357
|
deactivateCourse: (gameId, courseId) => client["request"](`/timeback/integrations/${gameId}/${courseId}`, "DELETE"),
|
|
4339
4358
|
reactivateCourse: (gameId, courseId) => client["request"](`/timeback/integrations/${gameId}/${courseId}/reactivate`, "POST"),
|
|
@@ -4683,7 +4702,7 @@ async function request({
|
|
|
4683
4702
|
return rawText && rawText.length > 0 ? rawText : undefined;
|
|
4684
4703
|
}
|
|
4685
4704
|
// src/version.ts
|
|
4686
|
-
var SDK_VERSION = "0.24.
|
|
4705
|
+
var SDK_VERSION = "0.24.1-beta.2";
|
|
4687
4706
|
|
|
4688
4707
|
// src/clients/base.ts
|
|
4689
4708
|
class PlaycademyBaseClient {
|
package/dist/server/edge.d.ts
CHANGED
|
@@ -319,8 +319,18 @@ interface ActivityData {
|
|
|
319
319
|
subject: CaliperSubject;
|
|
320
320
|
/** Activity display name (optional) */
|
|
321
321
|
activityName?: string;
|
|
322
|
-
/**
|
|
322
|
+
/**
|
|
323
|
+
* Optional course to report against. When omitted, the SDK fills it from
|
|
324
|
+
* the student's enrollment for this grade/subject (preferring a
|
|
325
|
+
* hole-filling course). The platform uses it if it's the base course or one
|
|
326
|
+
* of that grade/subject's hole-filling courses, otherwise the base course.
|
|
327
|
+
*/
|
|
323
328
|
courseId?: string;
|
|
329
|
+
/**
|
|
330
|
+
* The student's enrollment in `courseId`. Filled by the SDK alongside an
|
|
331
|
+
* automatic `courseId`; recorded on hole-filling Caliper events.
|
|
332
|
+
*/
|
|
333
|
+
enrollmentId?: string;
|
|
324
334
|
/** Course display name (auto-filled from config if not provided) */
|
|
325
335
|
courseName?: string;
|
|
326
336
|
/** Student email address (optional) */
|
|
@@ -382,9 +392,22 @@ interface EndActivityPayload {
|
|
|
382
392
|
* @module types/timeback/api
|
|
383
393
|
*/
|
|
384
394
|
|
|
395
|
+
/**
|
|
396
|
+
* `base` courses form a game's grade ladder (one active per grade and subject).
|
|
397
|
+
* `hole_filling` courses are remediation courses Timeback enrolls students into
|
|
398
|
+
* after a failed test; each sits beside a base course.
|
|
399
|
+
*/
|
|
400
|
+
type GameTimebackIntegrationKind = 'base' | 'hole_filling';
|
|
385
401
|
interface EndActivityResponse {
|
|
386
402
|
status: 'ok';
|
|
403
|
+
/** The course the activity was recorded against. */
|
|
387
404
|
courseId: string;
|
|
405
|
+
/**
|
|
406
|
+
* `'hole_filling'` when the activity was recorded against a hole-filling
|
|
407
|
+
* course (the student is enrolled there, or the game passed its
|
|
408
|
+
* `courseId`); `'base'` otherwise.
|
|
409
|
+
*/
|
|
410
|
+
courseKind?: GameTimebackIntegrationKind;
|
|
388
411
|
xpAwarded: number;
|
|
389
412
|
masteredUnits?: number;
|
|
390
413
|
pctCompleteApp?: number;
|
package/dist/server/edge.js
CHANGED
package/dist/server.d.ts
CHANGED
|
@@ -319,8 +319,18 @@ interface ActivityData {
|
|
|
319
319
|
subject: CaliperSubject;
|
|
320
320
|
/** Activity display name (optional) */
|
|
321
321
|
activityName?: string;
|
|
322
|
-
/**
|
|
322
|
+
/**
|
|
323
|
+
* Optional course to report against. When omitted, the SDK fills it from
|
|
324
|
+
* the student's enrollment for this grade/subject (preferring a
|
|
325
|
+
* hole-filling course). The platform uses it if it's the base course or one
|
|
326
|
+
* of that grade/subject's hole-filling courses, otherwise the base course.
|
|
327
|
+
*/
|
|
323
328
|
courseId?: string;
|
|
329
|
+
/**
|
|
330
|
+
* The student's enrollment in `courseId`. Filled by the SDK alongside an
|
|
331
|
+
* automatic `courseId`; recorded on hole-filling Caliper events.
|
|
332
|
+
*/
|
|
333
|
+
enrollmentId?: string;
|
|
324
334
|
/** Course display name (auto-filled from config if not provided) */
|
|
325
335
|
courseName?: string;
|
|
326
336
|
/** Student email address (optional) */
|
|
@@ -382,9 +392,22 @@ interface EndActivityPayload {
|
|
|
382
392
|
* @module types/timeback/api
|
|
383
393
|
*/
|
|
384
394
|
|
|
395
|
+
/**
|
|
396
|
+
* `base` courses form a game's grade ladder (one active per grade and subject).
|
|
397
|
+
* `hole_filling` courses are remediation courses Timeback enrolls students into
|
|
398
|
+
* after a failed test; each sits beside a base course.
|
|
399
|
+
*/
|
|
400
|
+
type GameTimebackIntegrationKind = 'base' | 'hole_filling';
|
|
385
401
|
interface EndActivityResponse {
|
|
386
402
|
status: 'ok';
|
|
403
|
+
/** The course the activity was recorded against. */
|
|
387
404
|
courseId: string;
|
|
405
|
+
/**
|
|
406
|
+
* `'hole_filling'` when the activity was recorded against a hole-filling
|
|
407
|
+
* course (the student is enrolled there, or the game passed its
|
|
408
|
+
* `courseId`); `'base'` otherwise.
|
|
409
|
+
*/
|
|
410
|
+
courseKind?: GameTimebackIntegrationKind;
|
|
388
411
|
xpAwarded: number;
|
|
389
412
|
masteredUnits?: number;
|
|
390
413
|
pctCompleteApp?: number;
|