@playcademy/sdk 0.9.0 → 0.9.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/README.md +5 -2
- package/dist/index.d.ts +408 -367
- package/dist/index.js +53 -3
- package/dist/internal.d.ts +5567 -5328
- package/dist/internal.js +89 -18
- package/dist/server/edge.d.ts +8 -0
- package/dist/server.d.ts +8 -0
- package/dist/types.d.ts +1228 -1186
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -235,11 +235,12 @@ if (grade3Enrollment) {
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
// Start tracking an activity (only activityId required!)
|
|
238
|
-
client.timeback.startActivity({
|
|
238
|
+
const { runId } = client.timeback.startActivity({
|
|
239
239
|
activityId: 'math-quiz-level-1',
|
|
240
240
|
})
|
|
241
241
|
// Auto-derived: activityName "Math Quiz Level 1"
|
|
242
242
|
// Auto-filled by backend: appName, subject, sensorUrl
|
|
243
|
+
// Returns the runId used by heartbeat and endActivity events
|
|
243
244
|
// Automatically pauses active time when the tab is hidden, the shell pauses,
|
|
244
245
|
// or the player has no visible keyboard/mouse activity for 10 minutes
|
|
245
246
|
|
|
@@ -340,7 +341,8 @@ const { token } = await client.realtime.token.get()
|
|
|
340
341
|
|
|
341
342
|
- `role`: The user's TimeBack role (`'student'`, `'parent'`, `'teacher'`, or `'administrator'`)
|
|
342
343
|
- `enrollments`: Array of course enrollments with `subject`, `grade`, and `courseId`
|
|
343
|
-
- `
|
|
344
|
+
- `currentRunId`: Active activity run ID, or `undefined` when no activity is active
|
|
345
|
+
- `startActivity(metadata, options?)`: Start tracking an activity and return `{ runId }`
|
|
344
346
|
- `metadata.activityId`: Unique activity identifier (required)
|
|
345
347
|
- `metadata.activityName`: Human-readable activity name
|
|
346
348
|
- `metadata.subject`: Subject area (Math, Reading, Science, etc.)
|
|
@@ -350,6 +352,7 @@ const { token } = await client.realtime.token.get()
|
|
|
350
352
|
- `options.pausedHeartbeatTimeoutMs`: Stop periodic heartbeats after a long automatic pause (`hidden` or `inactivity`); `Infinity` keeps them running
|
|
351
353
|
- `options.heartbeatIntervalMs`: Flush incremental heartbeats (`Infinity` disables periodic heartbeats)
|
|
352
354
|
- `options.inactivityTimeoutMs`: Keyboard/mouse idle timeout while visible (defaults to 10 minutes; `Infinity` disables)
|
|
355
|
+
- `options.runId`: Stable UUID to reuse for resumable activities
|
|
353
356
|
- `endActivity(scoreData)`: End activity and submit results
|
|
354
357
|
- `scoreData.correctQuestions`: Number of correct answers
|
|
355
358
|
- `scoreData.totalQuestions`: Total number of questions
|