@superbuilders/primer-tives 5.0.4 → 6.0.0

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 (46) hide show
  1. package/README.md +39 -27
  2. package/dist/client/auth-state.d.ts +4 -2
  3. package/dist/client/auth-state.d.ts.map +1 -1
  4. package/dist/client/choice-state.d.ts +2 -2
  5. package/dist/client/choice-state.d.ts.map +1 -1
  6. package/dist/client/extended-text-state.d.ts +8 -3
  7. package/dist/client/extended-text-state.d.ts.map +1 -1
  8. package/dist/client/feedback-state.d.ts +3 -3
  9. package/dist/client/feedback-state.d.ts.map +1 -1
  10. package/dist/client/index.d.ts +2 -2
  11. package/dist/client/index.d.ts.map +1 -1
  12. package/dist/client/index.js +376 -106
  13. package/dist/client/index.js.map +19 -17
  14. package/dist/client/journey.d.ts +13 -0
  15. package/dist/client/journey.d.ts.map +1 -0
  16. package/dist/client/match-state.d.ts +2 -2
  17. package/dist/client/match-state.d.ts.map +1 -1
  18. package/dist/client/mode.d.ts +5 -0
  19. package/dist/client/mode.d.ts.map +1 -0
  20. package/dist/client/observation-state.d.ts +2 -2
  21. package/dist/client/observation-state.d.ts.map +1 -1
  22. package/dist/client/order-state.d.ts +2 -2
  23. package/dist/client/order-state.d.ts.map +1 -1
  24. package/dist/client/pci-state.d.ts +2 -2
  25. package/dist/client/pci-state.d.ts.map +1 -1
  26. package/dist/client/session-context.d.ts +1 -0
  27. package/dist/client/session-context.d.ts.map +1 -1
  28. package/dist/client/session.d.ts +4 -2
  29. package/dist/client/session.d.ts.map +1 -1
  30. package/dist/client/start.d.ts +3 -0
  31. package/dist/client/start.d.ts.map +1 -1
  32. package/dist/client/text-entry-state.d.ts +7 -3
  33. package/dist/client/text-entry-state.d.ts.map +1 -1
  34. package/dist/client/transport.d.ts +9 -2
  35. package/dist/client/transport.d.ts.map +1 -1
  36. package/dist/client/types.d.ts +59 -12
  37. package/dist/client/types.d.ts.map +1 -1
  38. package/dist/contracts/index.d.ts +1 -1
  39. package/dist/contracts/index.d.ts.map +1 -1
  40. package/dist/contracts/index.js +13 -32
  41. package/dist/contracts/index.js.map +3 -3
  42. package/dist/contracts/types.d.ts +3 -20
  43. package/dist/contracts/types.d.ts.map +1 -1
  44. package/dist/contracts/validation.d.ts.map +1 -1
  45. package/dist/version.d.ts +1 -1
  46. package/package.json +1 -1
package/README.md CHANGED
@@ -19,7 +19,7 @@ bun add @superbuilders/primer-tives
19
19
 
20
20
  ## Version
21
21
 
22
- The current SDK version is `5.0.4`.
22
+ The current SDK version is `6.0.0`.
23
23
 
24
24
  ## Entrypoints
25
25
 
@@ -50,6 +50,7 @@ import {
50
50
  const options = {
51
51
  publishableKey: "pk_...",
52
52
  subject: "math",
53
+ mode: "drill",
53
54
  supportedPcis: ["urn:primer:pci:fraction-input"],
54
55
  logger
55
56
  } satisfies PrimerOptionsWithManagedAuth<"math", readonly ["urn:primer:pci:fraction-input"]>
@@ -57,6 +58,19 @@ const options = {
57
58
  let state = await start(options)
58
59
  ```
59
60
 
61
+ Primer exposes drill and curriculum as separate product surfaces behind the same SDK state machine. Version 6 callers must pass `mode: "drill"` for practice drill progression or `mode: "curriculum"` for curriculum DAG progression. Older clients that omit mode continue to enter drill behavior on the server.
62
+
63
+ ```ts
64
+ const options = {
65
+ publishableKey: "pk_...",
66
+ subject: "science",
67
+ mode: "curriculum",
68
+ logger
69
+ } satisfies PrimerOptionsWithManagedAuth<"science">
70
+
71
+ let state = await start(options)
72
+ ```
73
+
60
74
  If your application already has a learner access token, pass it directly. `start` uses that token for the learning runtime.
61
75
 
62
76
  ```ts
@@ -64,6 +78,7 @@ const options = {
64
78
  publishableKey: "pk_...",
65
79
  accessToken,
66
80
  subject: "math",
81
+ mode: "drill",
67
82
  supportedPcis: ["urn:primer:pci:fraction-input"],
68
83
  logger
69
84
  } satisfies PrimerOptionsWithAccessToken<"math", readonly ["urn:primer:pci:fraction-input"]>
@@ -98,6 +113,7 @@ Vocabulary and science currently have no required PCI capabilities, so `supporte
98
113
  const options = {
99
114
  publishableKey: "pk_...",
100
115
  subject: "vocabulary",
116
+ mode: "drill",
101
117
  logger
102
118
  } satisfies PrimerOptionsWithManagedAuth<"vocabulary">
103
119
 
@@ -109,6 +125,7 @@ Omitting `subject` means the SDK asks Primer for the all-subject runtime scope.
109
125
  ```ts
110
126
  const options = {
111
127
  publishableKey: "pk_...",
128
+ mode: "drill",
112
129
  supportedPcis: ["urn:primer:pci:fraction-input"],
113
130
  logger
114
131
  } satisfies PrimerOptionsWithManagedAuth<undefined, readonly ["urn:primer:pci:fraction-input"]>
@@ -145,6 +162,10 @@ function start<
145
162
 
146
163
  Always switch on `state.phase`. Do not assume the first state is renderable learning content.
147
164
 
165
+ Every state also exposes `state.journey`, a read-only learner progress object. It reports Primer's current journey mode plus grade, course, and lesson progress when those concepts exist for the current state.
166
+
167
+ `state.journey` cannot be used to select content or change Primer routing. It is display data only.
168
+
148
169
  ```ts
149
170
  import * as errors from "@superbuilders/errors"
150
171
  import { logger } from "@/logger"
@@ -155,6 +176,7 @@ const options = {
155
176
  publishableKey,
156
177
  accessToken,
157
178
  subject: "math",
179
+ mode: "drill",
158
180
  supportedPcis: ["urn:primer:pci:fraction-input"],
159
181
  logger
160
182
  } satisfies PrimerOptionsWithAccessToken<"math", readonly ["urn:primer:pci:fraction-input"]>
@@ -176,6 +198,7 @@ if (state.phase === "fatal") {
176
198
  type PrimerOptions<S extends Subject | undefined = undefined, Supported extends readonly PciId[] = []> = {
177
199
  readonly publishableKey: string
178
200
  readonly origin?: string
201
+ readonly mode: "drill" | "curriculum"
179
202
  readonly subject?: S
180
203
  readonly supportedPcis: subject-dependent
181
204
  readonly fetch?: typeof globalThis.fetch
@@ -196,6 +219,7 @@ type PrimerOptionsWithManagedAuth<S, Supported> = PrimerOptions<S, Supported> &
196
219
  | --- | --- | --- |
197
220
  | `publishableKey` | Yes | Public key identifying the Primer frontend your runtime belongs to. |
198
221
  | `origin` | No | Primer origin. Defaults to `https://primerlearn.dev`. |
222
+ | `mode` | Yes | Product surface. Use `"drill"` for practice drill progression or `"curriculum"` for curriculum DAG progression and generated support behavior. |
199
223
  | `accessToken` | Mode-dependent | Learner access token. When present, `start` uses access-token mode. When absent, `start` uses managed hosted-auth mode. |
200
224
  | `subject` | No | Public content scope: `"math"`, `"vocabulary"`, or `"science"`. Omitted means all-subject scope. |
201
225
  | `supportedPcis` | Subject-dependent | Renderer capabilities for Portable Custom Interactions. Required when the chosen scope can emit required PCIs. |
@@ -226,7 +250,7 @@ sessionStorage["primer:access-token:<publishableKey>"]
226
250
 
227
251
  This is intentionally zero config. There is no storage selector and no persistence flag. Managed-auth mode always uses `globalThis.sessionStorage`; if `sessionStorage` is unavailable, `start` returns `AuthUnavailableState`.
228
252
 
229
- The cache stores only the final Primer access token returned by hosted Timeback sign-in. OAuth transaction state, nonce, verifier, and callback validation state are not stored in browser storage; those remain server-managed by Primer.
253
+ The cache stores only the final Primer access token returned by hosted sign-in. OAuth transaction state, nonce, verifier, and callback validation state are not stored in browser storage; those remain server-managed by Primer.
230
254
 
231
255
  Managed-auth startup behavior is:
232
256
 
@@ -242,8 +266,6 @@ Access-token mode bypasses this cache entirely. If `accessToken` is present in `
242
266
 
243
267
  The cached value is a bearer credential. Browser-only consumers get reload convenience from this default, but any script that can read the page can read the token. Host applications must maintain normal XSS protections and should use access-token mode if they need to own token storage themselves.
244
268
 
245
- The canonical managed sign-in endpoint is `/api/auth/timeback/start`. Legacy `/auth/timeback` URLs are not part of the PrimerTives 4.0.5 contract.
246
-
247
269
  ## Auth Semantics
248
270
 
249
271
  An access token is expected to be JWS-shaped: it starts with `eyJ` and contains exactly two dots. If a provided token does not match that shape, `start` returns `FatalState` with `ErrMalformedAccessToken`.
@@ -337,6 +359,7 @@ This fails at compile time because math can emit a required PCI:
337
359
  await start({
338
360
  publishableKey,
339
361
  subject: "math",
362
+ mode: "drill",
340
363
  logger
341
364
  })
342
365
  ```
@@ -347,6 +370,7 @@ This passes:
347
370
  const options = {
348
371
  publishableKey,
349
372
  subject: "math",
373
+ mode: "drill",
350
374
  supportedPcis: ["urn:primer:pci:fraction-input"],
351
375
  logger
352
376
  } satisfies PrimerOptionsWithManagedAuth<"math", readonly ["urn:primer:pci:fraction-input"]>
@@ -741,8 +765,8 @@ interface MatchState<Pcis extends PciId = PciId> {
741
765
  readonly body: ContentBlock[]
742
766
  readonly stimulus: RendererStimulus | null
743
767
  readonly interaction: Extract<StandardRendererInteraction, { type: "match" }>
744
- readonly sourceChoices: RendererMatchChoice[]
745
- readonly targetChoices: RendererMatchChoice[]
768
+ readonly sourceChoices: RendererChoice[]
769
+ readonly targetChoices: RendererChoice[]
746
770
  readonly minAssociations: number
747
771
  readonly maxAssociations: number
748
772
  submitMatch(pairs: MatchPair[]): Promise<PrimerState<Pcis>>
@@ -761,10 +785,8 @@ Valid `submitMatch` payloads:
761
785
  | Every source identifier exists in `sourceChoices` | `ErrInvalidSubmission` |
762
786
  | Every target identifier exists in `targetChoices` | `ErrInvalidSubmission` |
763
787
  | No duplicate source-target pairs | `ErrInvalidSubmission` |
764
- | Every choice respects its `matchMin` | `ErrInvalidSubmission` |
765
- | Every choice respects its `matchMax` when `matchMax` is nonzero | `ErrInvalidSubmission` |
766
-
767
- `matchMax: 0` means unbounded.
788
+ | No duplicate source identifiers | `ErrInvalidSubmission` |
789
+ | No duplicate target identifiers | `ErrInvalidSubmission` |
768
790
 
769
791
  ## `PciInteractionState`
770
792
 
@@ -804,7 +826,7 @@ if (state.phase === "interaction" && state.kind === "portable-custom") {
804
826
  ## `FeedbackState`
805
827
 
806
828
  ```ts
807
- type AssessmentOutcomeValue = "correct" | "incorrect" | "revisionRequested"
829
+ type AssessmentOutcomeValue = "correct" | "incorrect"
808
830
 
809
831
  type AssessmentOutcome = {
810
832
  cardinality: "single"
@@ -951,7 +973,6 @@ import type {
951
973
  PciValue,
952
974
  RendererChoice,
953
975
  RendererInteraction,
954
- RendererMatchChoice,
955
976
  RendererStimulus,
956
977
  RendererSubmission,
957
978
  StandardRendererInteraction
@@ -1001,12 +1022,12 @@ Standard interactions:
1001
1022
 
1002
1023
  | Type | Key fields |
1003
1024
  | --- | --- |
1004
- | `choice` | `prompt`, `options`, `shuffle`, `minChoices`, `maxChoices` |
1025
+ | `choice` | `prompt`, `options`, `minChoices`, `maxChoices` |
1005
1026
  | `text-entry` | `prompt`, `base`, `expectedLength`, `patternMask`, `placeholderText` |
1006
1027
  | `extended-text` single | `prompt`, `format`, `expectedLines`, `expectedLength`, `patternMask`, `placeholderText` |
1007
1028
  | `extended-text` multiple | single fields plus `minStrings`, `maxStrings` |
1008
- | `order` | `prompt`, `choices`, `shuffle`, `minChoices`, `maxChoices` |
1009
- | `match` | `prompt`, `sourceChoices`, `targetChoices`, `shuffle`, `minAssociations`, `maxAssociations` |
1029
+ | `order` | `prompt`, `choices`, `minChoices`, `maxChoices` |
1030
+ | `match` | `prompt`, `sourceChoices`, `targetChoices`, `minAssociations`, `maxAssociations` |
1010
1031
  | `portable-custom` | `prompt`, `pciId`, `properties` |
1011
1032
 
1012
1033
  Choice objects:
@@ -1018,17 +1039,6 @@ interface RendererChoice {
1018
1039
  }
1019
1040
  ```
1020
1041
 
1021
- Match choice objects:
1022
-
1023
- ```ts
1024
- interface RendererMatchChoice {
1025
- identifier: string
1026
- content: ContentInline[]
1027
- matchMax: number
1028
- matchMin: number
1029
- }
1030
- ```
1031
-
1032
1042
  ## Submissions
1033
1043
 
1034
1044
  ```ts
@@ -1101,7 +1111,7 @@ Validation checks:
1101
1111
  | `extended-text` single | type match, exactly one value |
1102
1112
  | `extended-text` multiple | type match, min/max value count, duplicate values |
1103
1113
  | `order` | type match, min/max selection count, duplicate identifiers, unknown identifiers |
1104
- | `match` | type match, min/max association count, duplicate pairs, unknown sources, unknown targets, `matchMin`, `matchMax` |
1114
+ | `match` | type match, min/max association count, duplicate pairs, duplicate sources, duplicate targets, unknown sources, unknown targets |
1105
1115
  | `portable-custom` | type match, PCI id match, PCI value schema |
1106
1116
 
1107
1117
  The built-in standard interaction state methods call this before submitting. Custom renderer utilities that build `RendererSubmission` values directly should call it too.
@@ -1443,6 +1453,7 @@ import { start, type PrimerOptionsWithManagedAuth } from "@superbuilders/primer-
1443
1453
  const options = {
1444
1454
  publishableKey,
1445
1455
  subject: "vocabulary",
1456
+ mode: "drill",
1446
1457
  logger
1447
1458
  } satisfies PrimerOptionsWithManagedAuth<"vocabulary">
1448
1459
 
@@ -1499,6 +1510,7 @@ const options = {
1499
1510
  publishableKey: "pk_test",
1500
1511
  accessToken: "eyJ.test.token",
1501
1512
  subject: "vocabulary",
1513
+ mode: "drill",
1502
1514
  fetch: fetchMock,
1503
1515
  logger
1504
1516
  } satisfies PrimerOptionsWithAccessToken<"vocabulary">
@@ -1,14 +1,16 @@
1
1
  import type { AuthConfigInvalidState, AuthUnavailableState, ManagedStartState, SignInFailedState, SignInRequiredState } from "./types";
2
+ import type { Journey } from "./types";
2
3
  import type { PciId } from "../contracts/pci";
3
4
  type SignInStateConfig<Pcis extends PciId = PciId> = {
5
+ readonly journey: Journey;
4
6
  login(): Promise<ManagedStartState<Pcis>>;
5
7
  };
6
8
  declare function signInRequiredState<Pcis extends PciId>(config: SignInStateConfig<Pcis>): SignInRequiredState<Pcis>;
7
9
  declare function signInFailedState<Pcis extends PciId>(config: SignInStateConfig<Pcis> & {
8
10
  readonly error: Error;
9
11
  }): SignInFailedState<Pcis>;
10
- declare function authUnavailableState(error: Error): AuthUnavailableState;
11
- declare function authConfigInvalidState(error: Error): AuthConfigInvalidState;
12
+ declare function authUnavailableState(error: Error, journey: Journey): AuthUnavailableState;
13
+ declare function authConfigInvalidState(error: Error, journey: Journey): AuthConfigInvalidState;
12
14
  export type { SignInStateConfig };
13
15
  export { authConfigInvalidState, authUnavailableState, signInFailedState, signInRequiredState };
14
16
  //# sourceMappingURL=auth-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-state.d.ts","sourceRoot":"","sources":["../../src/client/auth-state.ts"],"names":[],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SAAS,KAAK,GAAG,KAAK,IAAI;IACpD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,KAAK,IAAI,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAA;CACzC,CAAA;AAkBD,iBAAS,mBAAmB,CAAC,IAAI,SAAS,KAAK,EAC9C,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC,GAC7B,mBAAmB,CAAC,IAAI,CAAC,CAO3B;AAED,iBAAS,iBAAiB,CAAC,IAAI,SAAS,KAAK,EAC5C,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GACzD,iBAAiB,CAAC,IAAI,CAAC,CAQzB;AAED,iBAAS,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,oBAAoB,CAOlF;AAED,iBAAS,sBAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,sBAAsB,CAOtF;AAED,YAAY,EAAE,iBAAiB,EAAE,CAAA;AACjC,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import type { SessionContext } from "./session-context";
2
- import type { InteractionFeedback, PrimerState } from "./types";
2
+ import type { InteractionFeedback, Journey, PrimerState } from "./types";
3
3
  import type { ContentBlock } from "../contracts/content";
4
4
  import type { PciId } from "../contracts/pci";
5
5
  import type { RendererChoice, RendererInteraction, RendererStimulus } from "../contracts/types";
6
- declare function choiceState<Pcis extends PciId>(ctx: SessionContext<Pcis>, body: ContentBlock[], stimulus: RendererStimulus | null, interaction: Extract<RendererInteraction<Pcis>, {
6
+ declare function choiceState<Pcis extends PciId>(ctx: SessionContext<Pcis>, journey: Journey, body: ContentBlock[], stimulus: RendererStimulus | null, interaction: Extract<RendererInteraction<Pcis>, {
7
7
  type: "choice";
8
8
  }>, options: RendererChoice[], maxChoices: number, minChoices: number, feedback: InteractionFeedback | null): PrimerState<Pcis>;
9
9
  export { choiceState };
@@ -1 +1 @@
1
- {"version":3,"file":"choice-state.d.ts","sourceRoot":"","sources":["../../src/client/choice-state.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AACxF,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAA;AAKhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAA;AACtE,OAAO,KAAK,EACX,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,MAAM,6CAA6C,CAAA;AAGpD,iBAAS,WAAW,CAAC,IAAI,SAAS,KAAK,EACtC,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,EACzB,IAAI,EAAE,YAAY,EAAE,EACpB,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,EAClB,QAAQ,EAAE,mBAAmB,GAAG,IAAI,GAClC,WAAW,CAAC,IAAI,CAAC,CAuFnB;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"choice-state.d.ts","sourceRoot":"","sources":["../../src/client/choice-state.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AACxF,OAAO,KAAK,EACX,mBAAmB,EACnB,OAAO,EACP,WAAW,EACX,MAAM,0CAA0C,CAAA;AAKjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAA;AACtE,OAAO,KAAK,EACX,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,MAAM,6CAA6C,CAAA;AAGpD,iBAAS,WAAW,CAAC,IAAI,SAAS,KAAK,EACtC,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,EACzB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,YAAY,EAAE,EACpB,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,EAClB,QAAQ,EAAE,mBAAmB,GAAG,IAAI,GAClC,WAAW,CAAC,IAAI,CAAC,CAwFnB;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -1,10 +1,15 @@
1
1
  import type { SessionContext } from "./session-context";
2
- import type { InteractionFeedback, PrimerState } from "./types";
2
+ import type { InteractionFeedback, Journey, PrimerState } from "./types";
3
3
  import type { ContentBlock } from "../contracts/content";
4
4
  import type { PciId } from "../contracts/pci";
5
5
  import type { RendererStimulus, StandardRendererInteraction } from "../contracts/types";
6
- declare function extendedTextState<Pcis extends PciId>(ctx: SessionContext<Pcis>, body: ContentBlock[], stimulus: RendererStimulus | null, interaction: Extract<StandardRendererInteraction, {
6
+ interface ExtendedTextStateOptions {
7
+ readonly initialValue?: string;
8
+ readonly initialValues?: string[];
9
+ readonly nextSubmissionRole?: "revision";
10
+ }
11
+ declare function extendedTextState<Pcis extends PciId>(ctx: SessionContext<Pcis>, journey: Journey, body: ContentBlock[], stimulus: RendererStimulus | null, interaction: Extract<StandardRendererInteraction, {
7
12
  type: "extended-text";
8
- }>, feedback: InteractionFeedback | null): PrimerState<Pcis>;
13
+ }>, feedback: InteractionFeedback | null, options?: ExtendedTextStateOptions): PrimerState<Pcis>;
9
14
  export { extendedTextState };
10
15
  //# sourceMappingURL=extended-text-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extended-text-state.d.ts","sourceRoot":"","sources":["../../src/client/extended-text-state.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AACxF,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAA;AAKhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAA;AACtE,OAAO,KAAK,EACX,gBAAgB,EAChB,2BAA2B,EAC3B,MAAM,6CAA6C,CAAA;AAGpD,iBAAS,iBAAiB,CAAC,IAAI,SAAS,KAAK,EAC5C,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,EACzB,IAAI,EAAE,YAAY,EAAE,EACpB,QAAQ,EAAE,gBAAgB,GAAG,IAAI,EACjC,WAAW,EAAE,OAAO,CAAC,2BAA2B,EAAE;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC,EAC5E,QAAQ,EAAE,mBAAmB,GAAG,IAAI,GAClC,WAAW,CAAC,IAAI,CAAC,CAyKnB;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
1
+ {"version":3,"file":"extended-text-state.d.ts","sourceRoot":"","sources":["../../src/client/extended-text-state.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,oDAAoD,CAAA;AACpG,OAAO,KAAK,EACX,mBAAmB,EACnB,OAAO,EACP,WAAW,EACX,MAAM,0CAA0C,CAAA;AAKjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAA;AACtE,OAAO,KAAK,EAEX,gBAAgB,EAChB,2BAA2B,EAC3B,MAAM,6CAA6C,CAAA;AAGpD,UAAU,wBAAwB;IACjC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACjC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,UAAU,CAAA;CACxC;AAYD,iBAAS,iBAAiB,CAAC,IAAI,SAAS,KAAK,EAC5C,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,EACzB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,YAAY,EAAE,EACpB,QAAQ,EAAE,gBAAgB,GAAG,IAAI,EACjC,WAAW,EAAE,OAAO,CAAC,2BAA2B,EAAE;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC,EAC5E,QAAQ,EAAE,mBAAmB,GAAG,IAAI,EACpC,OAAO,GAAE,wBAA6B,GACpC,WAAW,CAAC,IAAI,CAAC,CAiLnB;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,10 +1,10 @@
1
1
  import type { SessionContext } from "./session-context";
2
- import type { AssessmentOutcome, PrimerState } from "./types";
2
+ import type { Journey, PrimerState } from "./types";
3
3
  import type { ContentBlock, ContentInline } from "../contracts/content";
4
4
  import type { PciId } from "../contracts/pci";
5
5
  import type { InteractionReview } from "../contracts/review";
6
6
  import type { RendererInteraction, RendererStimulus, RendererSubmission } from "../contracts/types";
7
- declare function submittedFeedbackState<Pcis extends PciId>(ctx: SessionContext<Pcis>, body: ContentBlock[], stimulus: RendererStimulus | null, interaction: RendererInteraction<Pcis>, submission: RendererSubmission<Pcis>, assessmentOutcome: AssessmentOutcome, feedbackContent: ContentInline[], review: InteractionReview<Pcis> | null): PrimerState<Pcis>;
8
- declare function timedOutFeedbackState<Pcis extends PciId>(ctx: SessionContext<Pcis>, body: ContentBlock[], stimulus: RendererStimulus | null, interaction: RendererInteraction<Pcis>, feedbackContent: ContentInline[]): PrimerState<Pcis>;
7
+ declare function submittedFeedbackState<Pcis extends PciId>(ctx: SessionContext<Pcis>, journey: Journey, body: ContentBlock[], stimulus: RendererStimulus | null, interaction: RendererInteraction<Pcis>, submission: RendererSubmission<Pcis>, isCorrect: boolean, feedbackContent: ContentInline[], review: InteractionReview<Pcis> | null): PrimerState<Pcis>;
8
+ declare function timedOutFeedbackState<Pcis extends PciId>(ctx: SessionContext<Pcis>, journey: Journey, body: ContentBlock[], stimulus: RendererStimulus | null, interaction: RendererInteraction<Pcis>, feedbackContent: ContentInline[]): PrimerState<Pcis>;
9
9
  export { submittedFeedbackState, timedOutFeedbackState };
10
10
  //# sourceMappingURL=feedback-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feedback-state.d.ts","sourceRoot":"","sources":["../../src/client/feedback-state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AACxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAA;AAC9F,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAA;AAChG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAA;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AACrF,OAAO,KAAK,EACX,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,MAAM,6CAA6C,CAAA;AAapD,iBAAS,sBAAsB,CAAC,IAAI,SAAS,KAAK,EACjD,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,EACzB,IAAI,EAAE,YAAY,EAAE,EACpB,QAAQ,EAAE,gBAAgB,GAAG,IAAI,EACjC,WAAW,EAAE,mBAAmB,CAAC,IAAI,CAAC,EACtC,UAAU,EAAE,kBAAkB,CAAC,IAAI,CAAC,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,eAAe,EAAE,aAAa,EAAE,EAChC,MAAM,EAAE,iBA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CAAC,GAAG,IAAI,GACpC,WAAW,CAAC,IAAI,CAAC,CAenB;AAED,iBAAS,qBAAqB,CAAC,IAAI,SAAS,KAAK,EAChD,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,EACzB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,YAAY,EAAE,EACpB,QAAQ,EAAE,gBAAgB,GAAG,IAAI,EACjC,WAAW,EAAE,mBAAmB,CAAC,IAAI,CAAC,EACtC,eAAe,EAAE,aAAa,EAAE,GAC9B,WAAW,CAAC,IAAI,CAAC,CAYnB;AAED,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,CAAA"}
@@ -1,4 +1,4 @@
1
- export type { PrimerOptions, PrimerOptionsWithAccessToken, PrimerOptionsWithManagedAuth } from "./start";
1
+ export type { AdvanceMode, PrimerOptions, PrimerOptionsWithAccessToken, PrimerOptionsWithManagedAuth } from "./start";
2
2
  export { start } from "./start";
3
- export type { AccessTokenStartState, AssessmentOutcome, AssessmentOutcomeValue, AuthConfigInvalidState, AuthUnavailableState, ChoiceState, CompletedState, ErroredState, ExtendedTextMultipleState, ExtendedTextSingleState, ExtendedTextState, FatalState, FeedbackKind, FeedbackState, InteractionFeedback, InteractionState, ManagedStartState, MatchState, NonRetriableErroredState, NonSerializable, ObservationState, OrderState, PciInteractionState, PciPendingRenderProps, PciRenderProps, PciSubmittedRenderProps, PrimerState, RetriableErroredState, RuntimeState, SignInFailedState, SignInRequiredState, SubmittedFeedbackState, TextEntryState, TimedOutFeedbackState } from "./types";
3
+ export type { AccessTokenStartState, AuthConfigInvalidState, AuthUnavailableState, ChoiceState, CompletedState, ErroredState, ExtendedTextMultipleState, ExtendedTextSingleState, ExtendedTextState, FatalState, FeedbackKind, FeedbackState, InteractionFeedback, InteractionState, ManagedStartState, MatchState, NonRetriableErroredState, NonSerializable, ObservationState, OrderState, PciInteractionState, PciPendingRenderProps, PciRenderProps, PciSubmittedRenderProps, Journey, JourneyProgress, PrimerState, RetriableErroredState, RuntimeState, SignInFailedState, SignInRequiredState, SubmittedFeedbackState, TextEntryState, TimedOutFeedbackState } from "./types";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,aAAa,EACb,4BAA4B,EAC5B,4BAA4B,EAC5B,MAAM,0CAA0C,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAA;AAEhE,YAAY,EACX,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,EACvB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,MAAM,0CAA0C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,WAAW,EACX,aAAa,EACb,4BAA4B,EAC5B,4BAA4B,EAC5B,MAAM,0CAA0C,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAA;AAEhE,YAAY,EACX,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,EACvB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,OAAO,EACP,eAAe,EACf,WAAW,EACX,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,MAAM,0CAA0C,CAAA"}