@khanacademy/perseus-core 0.0.0-PR3097-20251208173650 → 0.0.0-PR3098-20251208175503

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.
@@ -0,0 +1,39 @@
1
+ import type { PerseusItem, PerseusWidgetsMap, PerseusRenderer } from "../data-schema";
2
+ /**
3
+ * This function extracts the answers from the widgets.
4
+ *
5
+ * For each widget type, we first check to make sure the path to the answer exists,
6
+ * then we extract the answer and add it to the list of answers.
7
+ *
8
+ * A list is returned because some widgets, like multi-select radio widgets and groups
9
+ * can have multiple answers.
10
+ *
11
+ * @param {PerseusRenderer["widgets"]} widgets
12
+ * @returns a list of strings that are the answers to the widgets
13
+ */
14
+ export declare function getAnswersFromWidgets(widgets: PerseusRenderer["widgets"]): ReadonlyArray<string>;
15
+ /**
16
+ * Inject a string equivalent of the widgets into the content.
17
+ *
18
+ * Content may contain Perseus widgets, that looks like this: '[[☃ Radio 1]]'.
19
+ * This function replaces those widgets with its equivalent string.
20
+ *
21
+ * @param {string} content
22
+ * @param {PerseusRenderer["widgets"]} widgets
23
+ * @returns
24
+ */
25
+ export declare function injectWidgets(content: string, widgets: PerseusRenderer["widgets"], widgetProps?: PerseusWidgetsMap): string;
26
+ /**
27
+ * Get AI-ready data from a Perseus item for Khanmigo.
28
+ *
29
+ * This function extracts the correct answers from widgets and injects
30
+ * widget content into hints to provide Khanmigo with the context it needs
31
+ * to help students without requiring React rendering.
32
+ *
33
+ * @param {PerseusItem} perseusItem - The Perseus item containing question and hints
34
+ * @returns Object containing answers and processed hints
35
+ */
36
+ export declare function getPerseusAIData(perseusItem: PerseusItem): {
37
+ answers: ReadonlyArray<string>;
38
+ hints: ReadonlyArray<string>;
39
+ };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Shared Perseus infrastructure",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "0.0.0-PR3097-20251208173650",
6
+ "version": "0.0.0-PR3098-20251208175503",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },