@khanacademy/perseus-core
Advanced tools
Comparing version 0.0.0-PR681-20230821194917 to 0.0.0-PR684-20230821213119
# @khanacademy/perseus-core | ||
## 0.0.0-PR681-20230821194917 | ||
## 0.0.0-PR684-20230821213119 | ||
### Major Changes | ||
### Minor Changes | ||
- 8034c522: Switch from using ProvideKeypad in ArticleRenderer to passing the keypad element down instead | ||
- dd800c22: Rename analytics prop from onEvent to onAnalyticsEvent | ||
@@ -9,0 +9,0 @@ ## 0.1.1 |
@@ -0,5 +1,6 @@ | ||
export type VirtualKeypadVersion = "PERSEUS_MATH_INPUT" | "MATH_INPUT_KEYPAD_V1" | "MATH_INPUT_KEYPAD_V2" | "REACT_NATIVE_KEYPAD"; | ||
export type PerseusAnalyticsEvent = { | ||
type: "perseus:expression-evaluated"; | ||
payload: { | ||
virtualKeypadVersion?: string; | ||
virtualKeypadVersion: VirtualKeypadVersion; | ||
result: "correct" | "incorrect" | "invalid"; | ||
@@ -10,3 +11,3 @@ }; | ||
payload: { | ||
virtualKeypadVersion: string; | ||
virtualKeypadVersion: VirtualKeypadVersion; | ||
}; | ||
@@ -16,6 +17,6 @@ } | { | ||
payload: { | ||
virtualKeypadVersion: string; | ||
virtualKeypadVersion: VirtualKeypadVersion; | ||
}; | ||
}; | ||
/** A function to send analytics events. */ | ||
export type SendEventFn = (event: PerseusAnalyticsEvent) => Promise<void>; | ||
/** A function that is called when Perseus emits an analytics event. */ | ||
export type AnalyticsEventHandlerFn = (event: PerseusAnalyticsEvent) => Promise<void>; |
@@ -1,2 +0,2 @@ | ||
export type { PerseusAnalyticsEvent, SendEventFn } from "./analytics"; | ||
export type { KEScore, KeypadContextRendererInterface } from "./types"; | ||
export type { PerseusAnalyticsEvent, AnalyticsEventHandlerFn } from "./analytics"; | ||
export type { KEScore, RendererInterface } from "./types"; |
@@ -1,3 +0,9 @@ | ||
export interface KeypadContextRendererInterface { | ||
type State = any; | ||
export interface RendererInterface { | ||
getSerializedState(): State; | ||
restoreSerializedState(state: State, callback?: () => void): void; | ||
scoreInput(): KEScore; | ||
blur(): void; | ||
focus(): boolean | null | undefined; | ||
props: any; | ||
} | ||
@@ -12,1 +18,2 @@ export type KEScore = { | ||
}; | ||
export {}; |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "0.0.0-PR681-20230821194917", | ||
"version": "0.0.0-PR684-20230821213119", | ||
"publishConfig": { | ||
@@ -9,0 +9,0 @@ "access": "public" |
@@ -0,1 +1,7 @@ | ||
export type VirtualKeypadVersion = | ||
| "PERSEUS_MATH_INPUT" | ||
| "MATH_INPUT_KEYPAD_V1" | ||
| "MATH_INPUT_KEYPAD_V2" | ||
| "REACT_NATIVE_KEYPAD"; | ||
// A type union of all the events that any package in the Perseus ecosystem can | ||
@@ -7,5 +13,3 @@ // send. | ||
payload: { | ||
// Keypad version can be supplied by Perseus sometimes, but not always. | ||
// The host application will need to fill this in if it's not present. | ||
virtualKeypadVersion?: string; | ||
virtualKeypadVersion: VirtualKeypadVersion; | ||
result: "correct" | "incorrect" | "invalid"; | ||
@@ -17,3 +21,3 @@ }; | ||
payload: { | ||
virtualKeypadVersion: string; | ||
virtualKeypadVersion: VirtualKeypadVersion; | ||
}; | ||
@@ -24,3 +28,3 @@ } | ||
payload: { | ||
virtualKeypadVersion: string; | ||
virtualKeypadVersion: VirtualKeypadVersion; | ||
}; | ||
@@ -32,3 +36,5 @@ }; | ||
/** A function to send analytics events. */ | ||
export type SendEventFn = (event: PerseusAnalyticsEvent) => Promise<void>; | ||
/** A function that is called when Perseus emits an analytics event. */ | ||
export type AnalyticsEventHandlerFn = ( | ||
event: PerseusAnalyticsEvent, | ||
) => Promise<void>; |
@@ -1,2 +0,2 @@ | ||
export type {PerseusAnalyticsEvent, SendEventFn} from "./analytics"; | ||
export type {KEScore, KeypadContextRendererInterface} from "./types"; | ||
export type {PerseusAnalyticsEvent, AnalyticsEventHandlerFn} from "./analytics"; | ||
export type {KEScore, RendererInterface} from "./types"; |
// Types that can be shared between Perseus packages | ||
// ideally without causing circular dependencies | ||
// Interface currently only implemented by | ||
// TODO: this should be typed | ||
type State = any; | ||
// Interfact currently only implemented by | ||
// ServerItemRenderer and used by KeypadContext | ||
// to pass around a renderer reference | ||
export interface KeypadContextRendererInterface { | ||
export interface RendererInterface { | ||
getSerializedState(): State; | ||
restoreSerializedState(state: State, callback?: () => void): void; | ||
scoreInput(): KEScore; | ||
blur(): void; | ||
focus(): boolean | null | undefined; | ||
props: any; | ||
} | ||
@@ -10,0 +18,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53421
20
140