@khanacademy/math-input 6.0.1 → 6.0.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @khanacademy/math-input
2
2
 
3
+ ## 6.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 037a2db6: Update MathQuill version
8
+
9
+ ## 6.0.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 71c631ea: Add keypad opened and closed analytics events
14
+ - Updated dependencies [71c631ea]
15
+ - @khanacademy/perseus-core@0.0.2
16
+
3
17
  ## 6.0.1
4
18
 
5
19
  ### Patch Changes
package/dist/es/index.js CHANGED
@@ -4,6 +4,7 @@ import { getDecimalSeparator } from '@khanacademy/wonder-blocks-i18n';
4
4
  import { entries } from '@khanacademy/wonder-stuff-core';
5
5
  import { StyleSheet, css } from 'aphrodite';
6
6
  import * as React from 'react';
7
+ import { useEffect } from 'react';
7
8
  import ReactDOM from 'react-dom';
8
9
  import $ from 'jquery';
9
10
  import MathQuill from 'mathquill';
@@ -8597,6 +8598,7 @@ function allPages(props) {
8597
8598
  // keypad to learners for entering math expressions.
8598
8599
  function Keypad(props) {
8599
8600
  const [selectedPage, setSelectedPage] = React.useState("Numbers");
8601
+ const [isMounted, setIsMounted] = React.useState(false);
8600
8602
  const availablePages = allPages(props);
8601
8603
  const {
8602
8604
  onClickKey,
@@ -8608,8 +8610,31 @@ function Keypad(props) {
8608
8610
  logarithms,
8609
8611
  basicRelations,
8610
8612
  advancedRelations,
8611
- showDismiss
8613
+ showDismiss,
8614
+ sendEvent
8612
8615
  } = props;
8616
+ useEffect(() => {
8617
+ if (!isMounted) {
8618
+ sendEvent({
8619
+ type: "math-input:keypad-opened",
8620
+ payload: {
8621
+ virtualKeypadVersion: "MATH_INPUT_KEYPAD_V2"
8622
+ }
8623
+ });
8624
+ setIsMounted(true);
8625
+ }
8626
+ return () => {
8627
+ if (isMounted) {
8628
+ sendEvent({
8629
+ type: "math-input:keypad-closed",
8630
+ payload: {
8631
+ virtualKeypadVersion: "MATH_INPUT_KEYPAD_V2"
8632
+ }
8633
+ });
8634
+ setIsMounted(false);
8635
+ }
8636
+ };
8637
+ }, [sendEvent, isMounted]);
8613
8638
  return /*#__PURE__*/React.createElement(View$1, null, /*#__PURE__*/React.createElement(Tabbar, {
8614
8639
  items: availablePages,
8615
8640
  selectedItem: selectedPage,