@superbuilders/primer-tives 0.0.3 → 0.0.4

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.
Files changed (42) hide show
  1. package/README.md +40 -46
  2. package/dist/choice-state.d.ts +8 -0
  3. package/dist/choice-state.d.ts.map +1 -0
  4. package/dist/client.d.ts +2 -8
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/consumed.d.ts +6 -0
  7. package/dist/consumed.d.ts.map +1 -0
  8. package/dist/errors.d.ts +2 -1
  9. package/dist/errors.d.ts.map +1 -1
  10. package/dist/extended-text-state.d.ts +8 -0
  11. package/dist/extended-text-state.d.ts.map +1 -0
  12. package/dist/feedback-state.d.ts +7 -0
  13. package/dist/feedback-state.d.ts.map +1 -0
  14. package/dist/index.d.ts +9 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +573 -0
  17. package/dist/index.js.map +21 -0
  18. package/dist/observation-state.d.ts +6 -0
  19. package/dist/observation-state.d.ts.map +1 -0
  20. package/dist/pci-state.d.ts +6 -0
  21. package/dist/pci-state.d.ts.map +1 -0
  22. package/dist/session-context.d.ts +24 -0
  23. package/dist/session-context.d.ts.map +1 -0
  24. package/dist/session.d.ts +16 -0
  25. package/dist/session.d.ts.map +1 -0
  26. package/dist/text-entry-state.d.ts +8 -0
  27. package/dist/text-entry-state.d.ts.map +1 -0
  28. package/dist/transport.d.ts +46 -0
  29. package/dist/transport.d.ts.map +1 -0
  30. package/dist/types.d.ts +5 -2
  31. package/dist/types.d.ts.map +1 -1
  32. package/package.json +4 -20
  33. package/dist/client.js +0 -400
  34. package/dist/client.js.map +0 -11
  35. package/dist/content.js +0 -27
  36. package/dist/content.js.map +0 -10
  37. package/dist/errors.js +0 -36
  38. package/dist/errors.js.map +0 -10
  39. package/dist/pci.js +0 -2
  40. package/dist/pci.js.map +0 -9
  41. package/dist/types.js +0 -2
  42. package/dist/types.js.map +0 -9
package/README.md CHANGED
@@ -15,9 +15,8 @@ Dependency: `@superbuilders/errors` is installed automatically.
15
15
  ## Quick start
16
16
 
17
17
  ```ts
18
- import { create } from "@superbuilders/primer-tives/client"
18
+ import { create, ErrRateLimited } from "@superbuilders/primer-tives"
19
19
  import * as errors from "@superbuilders/errors"
20
- import { ErrNetwork, ErrRateLimited } from "@superbuilders/primer-tives/errors"
21
20
 
22
21
  const client = create({
23
22
  publishableKey: "pk_live_abc123",
@@ -26,7 +25,7 @@ const client = create({
26
25
 
27
26
  let state = await client.start("student-uuid")
28
27
 
29
- while (state.phase !== "completed" && state.phase !== "fatal") {
28
+ while (state.phase !== "completed" && state.phase !== "fatal" && state.phase !== "consumed") {
30
29
  switch (state.phase) {
31
30
  case "observation":
32
31
  renderStimulus(state.stimulus)
@@ -69,6 +68,8 @@ while (state.phase !== "completed" && state.phase !== "fatal") {
69
68
  }
70
69
  ```
71
70
 
71
+ Both `state.phase` and `state.kind` are discriminated unions — TypeScript narrows the type in each `case` branch automatically. The outer switch on `phase` is exhaustive over the 7 states (`observation`, `interaction`, `feedback`, `completed`, `consumed`, `errored`, `fatal`). The inner switch on `kind` is exhaustive over the 4 interaction types (`choice`, `text-entry`, `extended-text`, `portable-custom`).
72
+
72
73
  ## Wire protocol
73
74
 
74
75
  Every request is a POST to `https://${origin}/api/v0/advance`:
@@ -85,7 +86,7 @@ The server identifies the student, determines which content to serve, evaluates
85
86
 
86
87
  - `studentId` — who is being advanced
87
88
  - `supportedPcis` — which custom interaction types the renderer can handle
88
- - `intent` — `{ kind: "observation" }` or `{ kind: "interaction", submission: ... }`
89
+ - `intent` — `{ kind: "observation" }`, `{ kind: "interaction", submission: ... }`, or `{ kind: "timeout" }`
89
90
 
90
91
  ## Configuration
91
92
 
@@ -117,10 +118,15 @@ interface Config<Pcis extends PciId = PciId> {
117
118
 
118
119
  ```
119
120
  observation → interaction → feedback → observation → ... → completed
121
+ | |
120
122
  ↓ ↓
121
123
  errored errored
124
+ |
122
125
 
123
126
  (retry) → back to failed phase
127
+
128
+ Any action called twice → consumed (terminal)
129
+ Interaction timeout → same as submit (server evaluates)
124
130
  ```
125
131
 
126
132
  ### `observation`
@@ -149,7 +155,11 @@ Student must respond. Discriminate on `state.kind`:
149
155
  | `"extended-text"` (multiple) | `submitTexts(values: string[])` | `cardinality: "multiple"`, `maxStrings`, `minStrings` |
150
156
  | `"portable-custom"` | `submit(value: PciValue<K>)` | `pciId`, `properties` |
151
157
 
152
- All submit methods return `Promise<PrimerState>`.
158
+ All interaction states also have a `timeout()` method that advances the state machine as if the student ran out of time.
159
+
160
+ All submit and timeout methods return `Promise<PrimerState>`.
161
+
162
+ Every interaction state carries `interaction.prompt` (`ContentInline[]`) and `interaction.type` (the discriminant matching `state.kind`).
153
163
 
154
164
  ### `feedback`
155
165
 
@@ -193,39 +203,23 @@ For choice interactions, extract correct option identifiers from `kind: "identif
193
203
 
194
204
  Session finished. No further actions.
195
205
 
206
+ ### `consumed`
207
+
208
+ A state transition was already consumed (e.g., double-clicking `advance()`, calling `submitChoice()` twice). The SDK returns `consumed` instead of throwing. Terminal — treat like `completed` in your loop condition.
209
+
196
210
  ### `errored`
197
211
 
198
212
  Retryable error (network, timeout, rate limit, 5xx). Remembers the failed intent.
199
213
 
200
214
  ```ts
201
215
  state.error // Error sentinel (use errors.is())
202
- state.failedPhase // "observation" | "interaction"
216
+ state.failedPhase // "observation" | "interaction" | "timeout"
203
217
  state.retry() // Promise<PrimerState> — replays exact failed intent
204
218
  ```
205
219
 
206
220
  ### `fatal`
207
221
 
208
- Terminal. Unsupported PCI or unknown interaction type. Session is broken.
209
-
210
- ## Stimulus & Interaction
211
-
212
- Every state carries a `stimulus: RendererStimulus | null` directly:
213
-
214
- ```ts
215
- state.stimulus // RendererStimulus | null
216
- ```
217
-
218
- Stimulus is a discriminated union on `type`:
219
- - `BodyStimulus` — `{ type: "body", body: ContentBlock[] }` — text-only
220
- - `ImageStimulus` — `{ type: "image", description: ContentInline[], src: string }` — image-backed
221
- - `null` — no stimulus
222
-
223
- Interaction states also carry `interaction` directly:
224
-
225
- ```ts
226
- state.interaction.prompt // ContentInline[]
227
- state.interaction.type // "choice" | "text-entry" | "extended-text" | "portable-custom"
228
- ```
222
+ Terminal. Unsupported PCI that the renderer can't handle. Session is broken.
229
223
 
230
224
  ## Client-side validation
231
225
 
@@ -235,13 +229,13 @@ The SDK validates submissions before sending them to the server:
235
229
 
236
230
  **Extended text (multiple):** rejects fewer than `minStrings`, more than `maxStrings`.
237
231
 
238
- Failed validation returns an `errored` state with `ErrInvalidSubmission`.
232
+ Failed validation returns an `errored` state with `ErrInvalidSubmission`. The failed intent is preserved — calling `retry()` replays the same invalid submission, so fix the input before retrying.
239
233
 
240
234
  ## Error sentinels
241
235
 
242
236
  ```ts
243
237
  import * as errors from "@superbuilders/errors"
244
- import { ErrNetwork, ErrRateLimited } from "@superbuilders/primer-tives/errors"
238
+ import { ErrNetwork, ErrRateLimited } from "@superbuilders/primer-tives"
245
239
 
246
240
  if (errors.is(state.error, ErrNetwork)) { /* handle */ }
247
241
  ```
@@ -255,10 +249,9 @@ if (errors.is(state.error, ErrNetwork)) { /* handle */ }
255
249
  | `ErrInvalidPublishableKey` | 401 |
256
250
  | `ErrForbidden` | 403 |
257
251
  | `ErrNotFound` | 404 |
258
- | `ErrConflict` | 409 |
259
252
  | `ErrUnsupportedPci` | 422 — server sent a PCI the client can't handle |
260
253
  | `ErrRateLimited` | 429 |
261
- | `ErrServerError` | 5xx |
254
+ | `ErrServerError` | 500 or unrecognized 5xx |
262
255
  | `ErrServiceUnavailable` | 502/503/504 |
263
256
  | `ErrInvalidSubmission` | Client-side validation failed |
264
257
  | `ErrNotSerializable` | Attempted to JSON.stringify PrimerState |
@@ -266,22 +259,20 @@ if (errors.is(state.error, ErrNetwork)) { /* handle */ }
266
259
 
267
260
  **`errored`** = retryable (call `retry()`). **`fatal`** = terminal.
268
261
 
262
+ Note: HTTP 409 (conflict) is handled internally — the SDK converts it to a `consumed` state. It never surfaces as an error sentinel.
263
+
269
264
  ## Submission payloads
270
265
 
271
266
  ```ts
272
- type RendererSubmission<K extends PciId = PciId> =
267
+ type RendererSubmission =
273
268
  | { type: "choice"; selectedKeys: string[] }
274
269
  | { type: "text-entry"; value: string }
275
270
  | { type: "extended-text"; values: string[] }
276
- | { type: "portable-custom"; pciId: K; value: PciValue<K> }
271
+ | { type: "portable-custom"; pciId: PciId; value: PciValue<PciId> }
277
272
  ```
278
273
 
279
- See `/types` for the full type surface.
280
-
281
274
  ## Content format
282
275
 
283
- Minimal example of the content format:
284
-
285
276
  ```ts
286
277
  type ContentInline =
287
278
  | { type: "text"; value: string }
@@ -290,7 +281,7 @@ type ContentInline =
290
281
  type ContentBlock = { type: "paragraph"; children: ContentInline[] }
291
282
  ```
292
283
 
293
- `inlinesToPlainText(nodes)` strips inline formatting for accessibility labels. `blocksToPlainText(blocks)` flattens blocks to plain text. See `/content` for the complete type surface.
284
+ `inlinesToPlainText(nodes)` strips inline formatting for accessibility labels. `blocksToPlainText(blocks)` flattens blocks to plain text.
294
285
 
295
286
  ## PCI system
296
287
 
@@ -329,15 +320,18 @@ type PciValue<K extends PciId> // submission value
329
320
  3. Include in `supportedPcis` when calling `create()`
330
321
  4. Build renderer with `PciRenderProps<"urn:primer:pci:your-pci">`
331
322
 
332
- ## Subpath exports
323
+ ## Import
333
324
 
334
- | Path | JS | Description |
335
- |---|---|---|
336
- | `/client` | yes | `create()`, transport, state machine |
337
- | `/types` | yes | States, interactions, submissions, `PciRenderProps` |
338
- | `/content` | yes | `ContentInline`, `inlinesToPlainText()` |
339
- | `/errors` | yes | 15 sentinel error constants |
340
- | `/pci` | yes | `PciId`, `PciProps`, `PciValue`, `PciRegistry` |
325
+ Everything is exported from the package root:
326
+
327
+ ```ts
328
+ import { create, ADVANCE_PATH, DEFAULT_ORIGIN } from "@superbuilders/primer-tives"
329
+ import { ErrNetwork, ErrTimeout } from "@superbuilders/primer-tives"
330
+ import { inlinesToPlainText, blocksToPlainText } from "@superbuilders/primer-tives"
331
+ import type { PrimerState, Config, Client, PrimerLogger } from "@superbuilders/primer-tives"
332
+ import type { ContentBlock, ContentInline } from "@superbuilders/primer-tives"
333
+ import type { PciId, PciProps, PciValue, PciRenderProps } from "@superbuilders/primer-tives"
334
+ ```
341
335
 
342
336
  ## Non-serializable state
343
337
 
@@ -0,0 +1,8 @@
1
+ import type { SessionContext } from "./session-context";
2
+ import type { PciId } from "./pci";
3
+ import type { PrimerState, RendererChoice, RendererInteraction, RendererStimulus } from "./types";
4
+ declare function choiceState<Pcis extends PciId>(ctx: SessionContext<Pcis>, stimulus: RendererStimulus | null, interaction: Extract<RendererInteraction<Pcis>, {
5
+ type: "choice";
6
+ }>, options: RendererChoice[], maxChoices: number, minChoices: number): PrimerState<Pcis>;
7
+ export { choiceState };
8
+ //# sourceMappingURL=choice-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choice-state.d.ts","sourceRoot":"","sources":["../src/choice-state.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AA6C3H,iBAAS,WAAW,CAAC,IAAI,SAAS,KAAK,EACtC,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,EACzB,QAAQ,EAAE,gBAAgB,GAAG,IAAI,EACjC,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,EACnE,OAAO,EAAE,cAAc,EAAE,EACzB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GAChB,WAAW,CAAC,IAAI,CAAC,CA8CnB;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
package/dist/client.d.ts CHANGED
@@ -1,13 +1,7 @@
1
1
  import type { PciId } from "./pci";
2
+ import type { PrimerLogger } from "./session-context";
2
3
  import type { PrimerState } from "./types";
3
- interface PrimerLogger {
4
- debug(message: string, attributes?: Record<string, unknown>): void;
5
- info(message: string, attributes?: Record<string, unknown>): void;
6
- warn(message: string, attributes?: Record<string, unknown>): void;
7
- error(message: string, attributes?: Record<string, unknown>): void;
8
- }
9
4
  declare const DEFAULT_ORIGIN = "https://sb-primer.vercel.app";
10
- declare const ADVANCE_PATH = "/api/v0/advance";
11
5
  interface Config<Pcis extends PciId = PciId> {
12
6
  readonly publishableKey: string;
13
7
  readonly supportedPcis: readonly Pcis[];
@@ -20,6 +14,6 @@ interface Client<Pcis extends PciId = PciId> {
20
14
  start(studentId: string): Promise<PrimerState<Pcis>>;
21
15
  }
22
16
  declare function create<const Pcis extends PciId>(config: Config<Pcis>): Client<Pcis>;
23
- export { ADVANCE_PATH, DEFAULT_ORIGIN, create };
17
+ export { DEFAULT_ORIGIN, create };
24
18
  export type { Client, Config, PrimerLogger };
25
19
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,KAAK,EAAY,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAIX,WAAW,EAMX,MAAM,mCAAmC,CAAA;AAG1C,UAAU,YAAY;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAClE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IACjE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IACjE,KAAK,C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AAc,iCAAiC,CAAA;AAGrD,UAAU,MAAM,CAAC,IAAI,SAAS,KAAK,GAAG,KAAK;IAC1C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,aAAa,EAAE,SAAS,IAAI,EAAE,CAAA;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;IACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAA;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAA;CAC9B;AAED,UAAU,MAAM,CAAC,IAAI,SAAS,KAAK,GAAG,KAAK;IAC1C,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;CACpD;AAED,iBAAS,MAAM,CAAC,KAAK,CAAC,IAAI,SAAS,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAyC5E;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,CAAA;AACjC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { ConsumedState } from "./types";
2
+ declare function poisonToJSON(): never;
3
+ declare const CONSUMED: ConsumedState;
4
+ declare const CONSUMED_PROMISE: Promise<ConsumedState>;
5
+ export { CONSUMED, CONSUMED_PROMISE, poisonToJSON };
6
+ //# sourceMappingURL=consumed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consumed.d.ts","sourceRoot":"","sources":["../src/consumed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAEtE,iBAAS,YAAY,IAAI,KAAK,CAG7B;AAED,QAAA,MAAM,QAAQ,EAAE,aAA2D,CAAA;AAC3E,QAAA,MAAM,gBAAgB,EAAE,OAAO,CAAC,aAAa,CAA6B,CAAA;AAE1E,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,CAAA"}
package/dist/errors.d.ts CHANGED
@@ -13,5 +13,6 @@ declare const ErrServiceUnavailable: Error;
13
13
  declare const ErrNotSerializable: Error;
14
14
  declare const ErrInvalidSubmission: Error;
15
15
  declare const ErrMalformedPublishableKey: Error;
16
- export { ErrBadRequest, ErrConflict, ErrForbidden, ErrInvalidPublishableKey, ErrInvalidSubmission, ErrMalformedPublishableKey, ErrJsonParse, ErrNetwork, ErrNotFound, ErrNotSerializable, ErrRateLimited, ErrServerError, ErrServiceUnavailable, ErrTimeout, ErrUnsupportedPci };
16
+ declare const ErrStateConsumed: Error;
17
+ export { ErrBadRequest, ErrConflict, ErrForbidden, ErrInvalidPublishableKey, ErrInvalidSubmission, ErrMalformedPublishableKey, ErrJsonParse, ErrNetwork, ErrNotFound, ErrNotSerializable, ErrRateLimited, ErrServerError, ErrServiceUnavailable, ErrStateConsumed, ErrTimeout, ErrUnsupportedPci };
17
18
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,UAAU,OAAwB,CAAA;AACxC,QAAA,MAAM,YAAY,OAA2B,CAAA;AAC7C,QAAA,MAAM,iBAAiB,OAAgC,CAAA;AACvD,QAAA,MAAM,wBAAwB,OAAwC,CAAA;AACtE,QAAA,MAAM,aAAa,OAA4B,CAAA;AAC/C,QAAA,MAAM,cAAc,OAA6B,CAAA;AACjD,QAAA,MAAM,UAAU,OAAwB,CAAA;AACxC,QAAA,MAAM,YAAY,OAA0B,CAAA;AAC5C,QAAA,MAAM,WAAW,OAA0B,CAAA;AAC3C,QAAA,MAAM,WAAW,OAAyB,CAAA;AAC1C,QAAA,MAAM,cAAc,OAA6B,CAAA;AACjD,QAAA,MAAM,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B,EAChB,UAAU,EACV,iBAAiB,EACjB,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { SessionContext } from "./session-context";
2
+ import type { PciId } from "./pci";
3
+ import type { PrimerState, RendererInteraction, RendererStimulus } from "./types";
4
+ declare function extendedTextState<Pcis extends PciId>(ctx: SessionContext<Pcis>, stimulus: RendererStimulus | null, interaction: RendererInteraction<Pcis> & {
5
+ type: "extended-text";
6
+ }): PrimerState<Pcis>;
7
+ export { extendedTextState };
8
+ //# sourceMappingURL=extended-text-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extended-text-state.d.ts","sourceRoot":"","sources":["../src/extended-text-state.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAoB3G,iBAAS,iBAAiB,CAAC,IAAI,SAAS,KAAK,EAC5C,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,EACzB,QAAQ,EAAE,gBAAgB,GAAG,IAAI,EACjC,WAAW,EAAE,mBAAmB,CAAC,IAAI,CAAC,GAAG;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GAChE,WAAW,CAAC,IAAI,CAAC,CAwEnB;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { ContentInline } from "./content";
2
+ import type { SessionContext } from "./session-context";
3
+ import type { PciId } from "./pci";
4
+ import type { PrimerState, RendererCorrectAnswer, RendererInteraction, RendererStimulus, RendererSubmission } from "./types";
5
+ declare function feedbackState<Pcis extends PciId>(ctx: SessionContext<Pcis>, stimulus: RendererStimulus | null, interaction: RendererInteraction<Pcis>, submission: RendererSubmission<Pcis>, isCorrect: boolean, feedbackContent: ContentInline[], correctAnswer: RendererCorrectAnswer | null): PrimerState<Pcis>;
6
+ export { feedbackState };
7
+ //# sourceMappingURL=feedback-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback-state.d.ts","sourceRoot":"","sources":["../src/feedback-state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,KAAK,EACX,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,MAAM,mCAAmC,CAAA;AAE1C,iBAAS,aAAa,CAAC,IAAI,SAAS,KAAK,EACxC,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,EACzB,QAAQ,EAAE,gBAAgB,GAAG,IAAI,EACjC,WAAW,EAAE,mBAAmB,CAAC,IAAI,CAAC,EACtC,UAAU,EAAE,kBAAkB,CAAC,IAAI,CAAC,EACpC,SAAS,EAAE,OAAO,EAClB,eAAe,EAAE,aAAa,EAAE,EAChC,aAAa,EAAE,qBAAqB,GAAG,IAAI,GACzC,WAAW,CAAC,IAAI,CAAC,CAoBnB;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
@@ -0,0 +1,9 @@
1
+ export { create, DEFAULT_ORIGIN } from "./client";
2
+ export type { Client, Config, PrimerLogger } from "./client";
3
+ export { ADVANCE_PATH } from "./transport";
4
+ export { ErrBadRequest, ErrConflict, ErrForbidden, ErrInvalidPublishableKey, ErrInvalidSubmission, ErrJsonParse, ErrMalformedPublishableKey, ErrNetwork, ErrNotFound, ErrNotSerializable, ErrRateLimited, ErrServerError, ErrServiceUnavailable, ErrStateConsumed, ErrTimeout, ErrUnsupportedPci } from "./errors";
5
+ export type { BodyStimulus, ChoiceState, CompletedState, ConsumedState, ErroredState, ExtendedTextMultipleState, ExtendedTextSingleState, ExtendedTextState, FatalState, FeedbackState, ImageStimulus, InteractionState, NonSerializable, ObservationState, PciInteraction, PciInteractionState, PciRenderProps, PciSubmission, PrimerState, RendererChoice, RendererCorrectAnswer, RendererCorrectScalarValue, RendererInteraction, RendererStimulus, RendererSubmission, TextEntryState } from "./types";
6
+ export type { ContentBlock, ContentInline } from "./content";
7
+ export { blocksToPlainText, inlinesToPlainText } from "./content";
8
+ export type { DivisionRemainderProps, DivisionRemainderSubmission, FractionAdditionProps, FractionAdditionSubmission, PciId, PciProps, PciRegistry, PciUrn, PciValue } from "./pci";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAC3E,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AAEtF,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAEpE,OAAO,EACN,aAAa,EACb,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,oBAAoB,EACpB,YAAY,EACZ,0BAA0B,EAC1B,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,MAAM,oCAAoC,CAAA;AAE3C,YAAY,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,EACvB,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,MAAM,mCAAmC,CAAA;AAE1C,YAAY,EACX,YAAY,EACZ,aAAa,EACb,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EACN,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,qCAAqC,CAAA;AAE5C,YAAY,EACX,sBAAsB,EACtB,2BAA2B,EAC3B,qBAAqB,EACrB,0BAA0B,EAC1B,KAAK,EACL,QAAQ,EACR,WAAW,EACX,MAAM,EACN,QAAQ,EACR,MAAM,iCAAiC,CAAA"}