@superbuilders/primer-tives 0.0.3 → 0.0.5
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 +68 -55
- package/dist/choice-state.d.ts +8 -0
- package/dist/choice-state.d.ts.map +1 -0
- package/dist/client.d.ts +2 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/consumed.d.ts +3 -0
- package/dist/consumed.d.ts.map +1 -0
- package/dist/extended-text-state.d.ts +8 -0
- package/dist/extended-text-state.d.ts.map +1 -0
- package/dist/feedback-state.d.ts +7 -0
- package/dist/feedback-state.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +571 -0
- package/dist/index.js.map +21 -0
- package/dist/observation-state.d.ts +6 -0
- package/dist/observation-state.d.ts.map +1 -0
- package/dist/pci-state.d.ts +6 -0
- package/dist/pci-state.d.ts.map +1 -0
- package/dist/session-context.d.ts +24 -0
- package/dist/session-context.d.ts.map +1 -0
- package/dist/session.d.ts +16 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/text-entry-state.d.ts +8 -0
- package/dist/text-entry-state.d.ts.map +1 -0
- package/dist/transport.d.ts +46 -0
- package/dist/transport.d.ts.map +1 -0
- package/package.json +4 -20
- package/dist/client.js +0 -400
- package/dist/client.js.map +0 -11
- package/dist/content.js +0 -27
- package/dist/content.js.map +0 -10
- package/dist/errors.js +0 -36
- package/dist/errors.js.map +0 -10
- package/dist/pci.js +0 -2
- package/dist/pci.js.map +0 -9
- package/dist/types.js +0 -2
- 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
|
|
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",
|
|
@@ -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 6 states (`observation`, `interaction`, `feedback`, `completed`, `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" }
|
|
89
|
+
- `intent` — `{ kind: "observation" }`, `{ kind: "interaction", submission: ... }`, or `{ kind: "timeout" }`
|
|
89
90
|
|
|
90
91
|
## Configuration
|
|
91
92
|
|
|
@@ -117,12 +118,18 @@ interface Config<Pcis extends PciId = PciId> {
|
|
|
117
118
|
|
|
118
119
|
```
|
|
119
120
|
observation → interaction → feedback → observation → ... → completed
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
| \ | \ | \
|
|
122
|
+
↓ ↘ ↓ ↘ ↓ ↘
|
|
123
|
+
errored fatal errored fatal errored fatal
|
|
124
|
+
|
|
125
|
+
errored → (retry) → replays failed action
|
|
126
|
+
interaction timeout → same as submit (server evaluates)
|
|
124
127
|
```
|
|
125
128
|
|
|
129
|
+
Any action (`advance()`, `submitChoice()`, `timeout()`, etc.) can fail. Transient failures (network, timeout, 5xx) become `errored` with `retry()`. Permanent failures (401, 403, 404) become `fatal` — session is dead, no recovery.
|
|
130
|
+
|
|
131
|
+
Calling an action twice (e.g., double-clicking `advance()`) returns the same promise — the SDK memoizes in-flight requests internally. No special handling needed.
|
|
132
|
+
|
|
126
133
|
### `observation`
|
|
127
134
|
|
|
128
135
|
Display-only frame. Show the stimulus, call `advance()`.
|
|
@@ -149,7 +156,11 @@ Student must respond. Discriminate on `state.kind`:
|
|
|
149
156
|
| `"extended-text"` (multiple) | `submitTexts(values: string[])` | `cardinality: "multiple"`, `maxStrings`, `minStrings` |
|
|
150
157
|
| `"portable-custom"` | `submit(value: PciValue<K>)` | `pciId`, `properties` |
|
|
151
158
|
|
|
152
|
-
All
|
|
159
|
+
All interaction states also have a `timeout()` method that advances the state machine as if the student ran out of time.
|
|
160
|
+
|
|
161
|
+
All submit and timeout methods return `Promise<PrimerState>`.
|
|
162
|
+
|
|
163
|
+
Every interaction state carries `interaction.prompt` (`ContentInline[]`) and `interaction.type` (the discriminant matching `state.kind`).
|
|
153
164
|
|
|
154
165
|
### `feedback`
|
|
155
166
|
|
|
@@ -195,37 +206,30 @@ Session finished. No further actions.
|
|
|
195
206
|
|
|
196
207
|
### `errored`
|
|
197
208
|
|
|
198
|
-
|
|
209
|
+
Transient failure. The request might succeed on retry.
|
|
199
210
|
|
|
200
211
|
```ts
|
|
201
212
|
state.error // Error sentinel (use errors.is())
|
|
202
|
-
state.failedPhase // "observation" | "interaction"
|
|
213
|
+
state.failedPhase // "observation" | "interaction" | "timeout"
|
|
203
214
|
state.retry() // Promise<PrimerState> — replays exact failed intent
|
|
204
215
|
```
|
|
205
216
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
Terminal. Unsupported PCI or unknown interaction type. Session is broken.
|
|
217
|
+
Retryable sentinels: `ErrNetwork`, `ErrTimeout`, `ErrRateLimited`, `ErrServerError`, `ErrServiceUnavailable`, `ErrJsonParse`, `ErrConflict`.
|
|
209
218
|
|
|
210
|
-
|
|
219
|
+
### `fatal`
|
|
211
220
|
|
|
212
|
-
|
|
221
|
+
Permanent failure. Session cannot recover. No `retry()`.
|
|
213
222
|
|
|
214
223
|
```ts
|
|
215
|
-
state.
|
|
224
|
+
state.error // Error sentinel (use errors.is())
|
|
216
225
|
```
|
|
217
226
|
|
|
218
|
-
|
|
219
|
-
-
|
|
220
|
-
-
|
|
221
|
-
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
```ts
|
|
226
|
-
state.interaction.prompt // ContentInline[]
|
|
227
|
-
state.interaction.type // "choice" | "text-entry" | "extended-text" | "portable-custom"
|
|
228
|
-
```
|
|
227
|
+
Causes:
|
|
228
|
+
- Invalid publishable key (401 — `ErrInvalidPublishableKey`)
|
|
229
|
+
- Origin not allowed (403 — `ErrForbidden`)
|
|
230
|
+
- Resource not found (404 — `ErrNotFound`)
|
|
231
|
+
- Malformed request (400 — `ErrBadRequest`)
|
|
232
|
+
- Unsupported PCI (422 or client-side detection — `ErrUnsupportedPci`)
|
|
229
233
|
|
|
230
234
|
## Client-side validation
|
|
231
235
|
|
|
@@ -235,53 +239,59 @@ The SDK validates submissions before sending them to the server:
|
|
|
235
239
|
|
|
236
240
|
**Extended text (multiple):** rejects fewer than `minStrings`, more than `maxStrings`.
|
|
237
241
|
|
|
238
|
-
Failed validation returns
|
|
242
|
+
Failed validation returns `errored` (not `fatal`) with `ErrInvalidSubmission`. The original interaction state is still usable — call the submit method again with corrected input. The `retry()` on the errored state replays the same invalid submission and is not useful for validation errors.
|
|
239
243
|
|
|
240
244
|
## Error sentinels
|
|
241
245
|
|
|
242
246
|
```ts
|
|
243
247
|
import * as errors from "@superbuilders/errors"
|
|
244
|
-
import { ErrNetwork, ErrRateLimited } from "@superbuilders/primer-tives
|
|
248
|
+
import { ErrNetwork, ErrRateLimited } from "@superbuilders/primer-tives"
|
|
245
249
|
|
|
246
250
|
if (errors.is(state.error, ErrNetwork)) { /* handle */ }
|
|
247
251
|
```
|
|
248
252
|
|
|
253
|
+
**Retryable** — surface as `errored`, consumer can call `retry()`:
|
|
254
|
+
|
|
249
255
|
| Sentinel | Cause |
|
|
250
256
|
|---|---|
|
|
251
257
|
| `ErrNetwork` | Fetch failed (offline, DNS, CORS) |
|
|
252
258
|
| `ErrTimeout` | Request aborted or timed out |
|
|
253
|
-
| `ErrJsonParse` | Response not valid JSON |
|
|
254
|
-
| `ErrBadRequest` | 400 |
|
|
255
|
-
| `ErrInvalidPublishableKey` | 401 |
|
|
256
|
-
| `ErrForbidden` | 403 |
|
|
257
|
-
| `ErrNotFound` | 404 |
|
|
258
|
-
| `ErrConflict` | 409 |
|
|
259
|
-
| `ErrUnsupportedPci` | 422 — server sent a PCI the client can't handle |
|
|
260
259
|
| `ErrRateLimited` | 429 |
|
|
261
|
-
| `ErrServerError` | 5xx |
|
|
260
|
+
| `ErrServerError` | 500 or unrecognized 5xx |
|
|
262
261
|
| `ErrServiceUnavailable` | 502/503/504 |
|
|
262
|
+
| `ErrJsonParse` | Response not valid JSON |
|
|
263
|
+
| `ErrConflict` | 409 — server already processed this advance |
|
|
263
264
|
| `ErrInvalidSubmission` | Client-side validation failed |
|
|
264
|
-
| `ErrNotSerializable` | Attempted to JSON.stringify PrimerState |
|
|
265
|
-
| `ErrMalformedPublishableKey` | Key doesn't start with `pk_` |
|
|
266
265
|
|
|
267
|
-
|
|
266
|
+
**Permanent** — surface as `fatal`, session is dead:
|
|
267
|
+
|
|
268
|
+
| Sentinel | Cause |
|
|
269
|
+
|---|---|
|
|
270
|
+
| `ErrBadRequest` | 400 — malformed request |
|
|
271
|
+
| `ErrInvalidPublishableKey` | 401 — wrong publishable key |
|
|
272
|
+
| `ErrForbidden` | 403 — origin not allowed |
|
|
273
|
+
| `ErrNotFound` | 404 — resource not found |
|
|
274
|
+
| `ErrUnsupportedPci` | 422 — server sent a PCI the client can't handle |
|
|
275
|
+
|
|
276
|
+
**Thrown directly** (not wrapped in errored/fatal):
|
|
277
|
+
|
|
278
|
+
| Sentinel | Cause |
|
|
279
|
+
|---|---|
|
|
280
|
+
| `ErrMalformedPublishableKey` | Key doesn't start with `pk_` — thrown by `create()` |
|
|
281
|
+
| `ErrNotSerializable` | Attempted to JSON.stringify PrimerState — thrown by `toJSON()` |
|
|
268
282
|
|
|
269
283
|
## Submission payloads
|
|
270
284
|
|
|
271
285
|
```ts
|
|
272
|
-
type RendererSubmission
|
|
286
|
+
type RendererSubmission =
|
|
273
287
|
| { type: "choice"; selectedKeys: string[] }
|
|
274
288
|
| { type: "text-entry"; value: string }
|
|
275
289
|
| { type: "extended-text"; values: string[] }
|
|
276
|
-
| { type: "portable-custom"; pciId:
|
|
290
|
+
| { type: "portable-custom"; pciId: PciId; value: PciValue<PciId> }
|
|
277
291
|
```
|
|
278
292
|
|
|
279
|
-
See `/types` for the full type surface.
|
|
280
|
-
|
|
281
293
|
## Content format
|
|
282
294
|
|
|
283
|
-
Minimal example of the content format:
|
|
284
|
-
|
|
285
295
|
```ts
|
|
286
296
|
type ContentInline =
|
|
287
297
|
| { type: "text"; value: string }
|
|
@@ -290,7 +300,7 @@ type ContentInline =
|
|
|
290
300
|
type ContentBlock = { type: "paragraph"; children: ContentInline[] }
|
|
291
301
|
```
|
|
292
302
|
|
|
293
|
-
`inlinesToPlainText(nodes)` strips inline formatting for accessibility labels. `blocksToPlainText(blocks)` flattens blocks to plain text.
|
|
303
|
+
`inlinesToPlainText(nodes)` strips inline formatting for accessibility labels. `blocksToPlainText(blocks)` flattens blocks to plain text.
|
|
294
304
|
|
|
295
305
|
## PCI system
|
|
296
306
|
|
|
@@ -329,15 +339,18 @@ type PciValue<K extends PciId> // submission value
|
|
|
329
339
|
3. Include in `supportedPcis` when calling `create()`
|
|
330
340
|
4. Build renderer with `PciRenderProps<"urn:primer:pci:your-pci">`
|
|
331
341
|
|
|
332
|
-
##
|
|
342
|
+
## Import
|
|
333
343
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
344
|
+
Everything is exported from the package root:
|
|
345
|
+
|
|
346
|
+
```ts
|
|
347
|
+
import { create, ADVANCE_PATH, DEFAULT_ORIGIN } from "@superbuilders/primer-tives"
|
|
348
|
+
import { ErrNetwork, ErrTimeout } from "@superbuilders/primer-tives"
|
|
349
|
+
import { inlinesToPlainText, blocksToPlainText } from "@superbuilders/primer-tives"
|
|
350
|
+
import type { PrimerState, Config, Client, PrimerLogger } from "@superbuilders/primer-tives"
|
|
351
|
+
import type { ContentBlock, ContentInline } from "@superbuilders/primer-tives"
|
|
352
|
+
import type { PciId, PciProps, PciValue, PciRenderProps } from "@superbuilders/primer-tives"
|
|
353
|
+
```
|
|
341
354
|
|
|
342
355
|
## Non-serializable state
|
|
343
356
|
|
|
@@ -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,EACX,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,MAAM,mCAAmC,CAAA;AA6C1C,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,CA4CnB;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 {
|
|
17
|
+
export { DEFAULT_ORIGIN, create };
|
|
24
18
|
export type { Client, Config, PrimerLogger };
|
|
25
19
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAA;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAIpE,QAAA,MAAM,cAAc,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 @@
|
|
|
1
|
+
{"version":3,"file":"consumed.d.ts","sourceRoot":"","sources":["../src/consumed.ts"],"names":[],"mappings":"AAEA,iBAAS,YAAY,IAAI,KAAK,CAG7B;AAED,OAAO,EAAE,YAAY,EAAE,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,EACX,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,MAAM,mCAAmC,CAAA;AAoB1C,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,CAyEnB;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,CAmBnB;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -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, ErrTimeout, ErrUnsupportedPci } from "./errors";
|
|
5
|
+
export type { BodyStimulus, ChoiceState, CompletedState, 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,UAAU,EACV,iBAAiB,EACjB,MAAM,oCAAoC,CAAA;AAE3C,YAAY,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EACd,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"}
|