Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update locations of public widget options functions: categorizer, orderer, and expression #2152

Merged
merged 6 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/sixty-experts-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": patch
"@khanacademy/perseus-core": patch
---

Move the categorizer, orderer, and expression public widget options functions from perseus package to their widget folders in perseus-core
6 changes: 3 additions & 3 deletions packages/perseus-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ export type {ExpressionDefaultWidgetOptions} from "./widgets/expression";

export type * from "./widgets/logic-export.types";

export {default as getOrdererPublicWidgetOptions} from "./utils/orderer-util";

export {default as getExpressionPublicWidgetOptions} from "./utils/expression-util";
export {default as getOrdererPublicWidgetOptions} from "./widgets/orderer/orderer-util";
export {default as getCategorizerPublicWidgetOptions} from "./widgets/categorizer/categorizer-util";
export {default as getExpressionPublicWidgetOptions} from "./widgets/expression/expression-util";
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import getCategorizerPublicWidgetOptions from "./categorizer.util";
import getCategorizerPublicWidgetOptions from "./categorizer-util";

import type {PerseusCategorizerWidgetOptions} from "@khanacademy/perseus-core";
import type {PerseusCategorizerWidgetOptions} from "../../data-schema";

describe("getCategorizerPublicWidgetOptions", () => {
it("returns an object without the answer data", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import getExpressionPublicWidgetOptions from "./expression-util";

import type {PerseusExpressionWidgetOptions} from "@khanacademy/perseus-core";
import type {PerseusExpressionWidgetOptions} from "../../data-schema";

describe("getExpressionPublicWidgetOptions", () => {
it("should return the correct public options without any answer data", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import getOrdererPublicWidgetOptions from "./orderer-util";

import type {PerseusOrdererWidgetOptions} from "@khanacademy/perseus-core";
import type {PerseusOrdererWidgetOptions} from "../../data-schema";

describe("getOrdererPublicWidgetOptions", () => {
it("should return the correct public options without any answer data", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/perseus/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type {ILogger} from "./logging/log";
import type {PerseusStrings} from "./strings";
import type {SizeClass} from "./util/sizing-utils";
import type {WidgetPromptJSON} from "./widget-ai-utils/prompt-types";
import type getCategorizerPublicWidgetOptions from "./widgets/categorizer/categorizer.util";
import type {KeypadAPI} from "@khanacademy/math-input";
import type {
Hint,
Expand All @@ -14,6 +13,7 @@ import type {
Version,
WidgetOptionsUpgradeMap,
getOrdererPublicWidgetOptions,
getCategorizerPublicWidgetOptions,
getExpressionPublicWidgetOptions,
} from "@khanacademy/perseus-core";
import type {LinterContextProps} from "@khanacademy/perseus-linter";
Expand Down
7 changes: 4 additions & 3 deletions packages/perseus/src/widgets/categorizer/categorizer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/* eslint-disable @khanacademy/ts-no-error-suppressions */
import {
type PerseusCategorizerWidgetOptions,
getCategorizerPublicWidgetOptions,
} from "@khanacademy/perseus-core";
import {linterContextDefault} from "@khanacademy/perseus-linter";
import {
scoreCategorizer,
Expand All @@ -20,11 +24,8 @@ import sharedStyles from "../../styles/shared";
import Util from "../../util";
import {getPromptJSON as _getPromptJSON} from "../../widget-ai-utils/categorizer/categorizer-ai-utils";

import getCategorizerPublicWidgetOptions from "./categorizer.util";

import type {Widget, WidgetExports, WidgetProps} from "../../types";
import type {CategorizerPromptJSON} from "../../widget-ai-utils/categorizer/categorizer-ai-utils";
import type {PerseusCategorizerWidgetOptions} from "@khanacademy/perseus-core";
import type {
PerseusCategorizerScoringData,
PerseusCategorizerUserInput,
Expand Down
Loading