@playcademy/sdk 0.16.1-beta.1 → 0.16.1-beta.10

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
@@ -139,9 +139,10 @@ const completed = await client.timeback.assessments.submit(attempt.attemptId, {
139
139
  })
140
140
  ```
141
141
 
142
- `start()` resumes an unfinished attempt or selects the next live test. Save payloads are
143
- question deltas, but each included question replaces its complete response state; use `null` to
144
- clear an answer. Keep the returned `responseVersion` and send it with the next mutation.
142
+ `start()` resumes a compatible unfinished attempt or selects content for a fixed test or standards
143
+ review. Save payloads merge at both the item and response levels; omitted values remain unchanged,
144
+ and `null` clears one response. Keep the returned `responseVersion` and send it with the next
145
+ mutation.
145
146
 
146
147
  For local development, import the current ordered catalog before starting the dev host:
147
148
 
@@ -172,6 +173,46 @@ OAuth provider connections (Discord, Google, etc.).
172
173
  await client.identity.connect({ provider: 'discord' })
173
174
  ```
174
175
 
176
+ ### `client.embed`
177
+
178
+ Launch other Playcademy games as embedded children (platform mode only). With `timeback`, the child's play time and completion are recorded on this game's Timeback course. Interrupted launches resume automatically when the child streams checkpoints; the `resume` option tunes or disables the persistence.
179
+
180
+ ```typescript
181
+ const session = client.embed.launch({
182
+ slug: 'math-cakes',
183
+ container: overlayEl,
184
+ intent: { lessonId: 'two-digit-add', eLevel: 'E2' },
185
+ timeback: { activityId: 'two-digit-add-e2', grade: 2, subject: 'Math' },
186
+ })
187
+
188
+ const activity = await session.finished
189
+
190
+ if (activity.status === 'completed') {
191
+ await activity.end({
192
+ correctQuestions: activity.correct,
193
+ totalQuestions: activity.total,
194
+ xpAwarded: 10,
195
+ })
196
+ }
197
+
198
+ await session.closed // iframe unmounted; dismiss surrounding UI
199
+ ```
200
+
201
+ ### `client.parent`
202
+
203
+ The launch context when this game was launched by a parent game (`mode: 'child'`); `null` in every other mode. In child mode, activity reporting is relayed to the parent automatically, and `xpAwarded` becomes a suggestion the parent may override. Stream `client.parent.checkpoint(state)` to make interrupted launches resumable; the state comes back as `client.parent.resume`. Narrow with `isChildLaunched()` to get the relaxed types.
204
+
205
+ ```typescript
206
+ import { isChildLaunched } from '@playcademy/sdk'
207
+
208
+ if (isChildLaunched(client)) {
209
+ const { lessonId, eLevel } = client.parent.intent
210
+ startLesson(lessonId, eLevel)
211
+ // ...later: xpAwarded may be omitted; the parent decides the award
212
+ await client.timeback.endActivity({ correctQuestions, totalQuestions })
213
+ }
214
+ ```
215
+
175
216
  ### `client.demo`
176
217
 
177
218
  Demo mode for anonymous players on the landing page.