@availity/feedback 8.0.4 → 9.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ # [9.0.0](https://github.com/Availity/availity-react/compare/@availity/feedback@8.0.4...@availity/feedback@9.0.0) (2024-07-12)
6
+
7
+
8
+ ### Features
9
+
10
+ * **feedback:** default to use avLogMessagesApiV2 to send feedback ([e06ff98](https://github.com/Availity/availity-react/commit/e06ff9806d8bd3095b0f6000947e9357f69c11c9))
11
+
12
+
13
+ ### BREAKING CHANGES
14
+
15
+ * **feedback:** this will break splunk dashboards
16
+
17
+
18
+
5
19
  ## [8.0.4](https://github.com/Availity/availity-react/compare/@availity/feedback@8.0.3...@availity/feedback@8.0.4) (2024-05-31)
6
20
 
7
21
  ### Dependency Updates
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/feedback",
3
- "version": "8.0.4",
3
+ "version": "9.0.0",
4
4
  "description": "Availity feedback with smiley faces react component.",
5
5
  "keywords": [
6
6
  "react",
package/src/Feedback.js CHANGED
@@ -1,25 +1,26 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Dropdown, DropdownToggle } from 'reactstrap';
4
- import { avLogMessagesApi } from '@availity/api-axios';
4
+ import { avLogMessagesApiV2 } from '@availity/api-axios';
5
5
  import { useToggle } from '@availity/hooks';
6
+
6
7
  import FeedbackDropdown from './FeedbackDropdown';
7
8
  import FeedbackModal from './FeedbackModal';
8
9
 
9
10
  const Feedback = ({
10
11
  appName,
11
- modal,
12
+ modal = false,
12
13
  zIndex,
13
14
  supportZIndex,
14
15
  children,
15
- analytics,
16
+ analytics = avLogMessagesApiV2,
16
17
  className,
17
18
  outline,
18
- color,
19
+ color = 'secondary',
19
20
  formProps,
20
21
  prompt,
21
22
  onFeedbackSent,
22
- showSupport,
23
+ showSupport = false,
23
24
  onModalOpenChange,
24
25
  ...props
25
26
  }) => {
@@ -27,7 +28,8 @@ const Feedback = ({
27
28
 
28
29
  const handleFeedbackToggle = () => {
29
30
  feedbackToggle();
30
- onModalOpenChange(!feedbackIsOpen);
31
+
32
+ if (onModalOpenChange) onModalOpenChange(!feedbackIsOpen);
31
33
  };
32
34
 
33
35
  return (
@@ -102,12 +104,4 @@ Feedback.propTypes = {
102
104
  showSupport: PropTypes.bool,
103
105
  };
104
106
 
105
- Feedback.defaultProps = {
106
- modal: false,
107
- color: 'secondary',
108
- analytics: avLogMessagesApi,
109
- showSupport: false,
110
- onModalOpenChange: Object,
111
- };
112
-
113
107
  export default Feedback;
@@ -6,7 +6,7 @@ import Icon from '@availity/icon';
6
6
  const btnStyles = { fontSize: '1.4em', padding: '.2em .4em' };
7
7
  const iconStyles = { margin: '0px' };
8
8
 
9
- const FeedbackButton = ({ onClick, icon, active, children, iconSize, ...rest }) => (
9
+ const FeedbackButton = ({ onClick, icon, active, children, iconSize = '', ...rest }) => (
10
10
  <Button
11
11
  style={btnStyles}
12
12
  color={active === icon ? 'primary' : 'light'}
@@ -23,15 +23,11 @@ const FeedbackButton = ({ onClick, icon, active, children, iconSize, ...rest })
23
23
  );
24
24
 
25
25
  FeedbackButton.propTypes = {
26
- onClick: PropTypes.func,
26
+ onClick: PropTypes.func.isRequired,
27
27
  icon: PropTypes.string,
28
28
  active: PropTypes.string,
29
29
  children: PropTypes.node,
30
30
  iconSize: PropTypes.string,
31
31
  };
32
32
 
33
- FeedbackButton.defaultProps = {
34
- iconSize: '',
35
- };
36
-
37
33
  export default FeedbackButton;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { DropdownMenu } from 'reactstrap';
4
+
4
5
  import FeedbackForm from './FeedbackForm';
5
6
  import SupportModal from './SupportModal';
6
7
  import SupportDropdown from './SupportDropdown';
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect, useRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Button, ModalBody, ModalHeader, ModalFooter, FormGroup } from 'reactstrap';
4
- import { avLogMessagesApi, avRegionsApi } from '@availity/api-axios';
4
+ import { avLogMessagesApiV2, avRegionsApi } from '@availity/api-axios';
5
5
  import { Form, Field } from '@availity/form';
6
6
  import { SelectField } from '@availity/select';
7
7
  import * as yup from 'yup';
@@ -29,24 +29,25 @@ const FeedbackForm = ({
29
29
  name,
30
30
  onClose,
31
31
  faceOptions,
32
- aboutOptions,
33
- aboutLabel,
32
+ aboutOptions = [],
33
+ aboutLabel = 'This is about',
34
34
  onFeedbackSent,
35
35
  prompt,
36
- additionalComments,
36
+ additionalComments = false,
37
37
  staticFields,
38
- analytics,
38
+ analytics = avLogMessagesApiV2,
39
39
  modalHeaderProps,
40
- showSupport,
40
+ showSupport = false,
41
41
  setSupportIsActive,
42
42
  autoFocusFeedbackButton,
43
- modal,
43
+ modal = true,
44
44
  ...formProps
45
45
  }) => {
46
46
  const [active, setActive] = useState(null);
47
47
  const [sent, setSent] = useState(null);
48
48
  const [loading, setLoading] = useState(null);
49
49
  const ref = useRef();
50
+
50
51
  const sendFeedback = async ({ smileField, ...values }) => {
51
52
  setLoading(true);
52
53
  const response = await avRegionsApi.getCurrentRegion();
@@ -289,7 +290,7 @@ FeedbackForm.propTypes = {
289
290
  /** Props to be spread onto the <ModalHeader /> rendered inside of the <FeedbackForm />. See ModalHeader
290
291
  *For accessibility use className instead of tag to adjust size and style of header. */
291
292
  modalHeaderProps: PropTypes.shape({ ...ModalHeader.propTypes }),
292
- /** Override the analytics instance that is passed in. Default avLogMessagesApi */
293
+ /** Override the analytics instance that is passed in. Default avLogMessagesApiV2 */
293
294
  analytics: PropTypes.shape({
294
295
  info: PropTypes.func.isRequired,
295
296
  }),
@@ -302,13 +303,4 @@ FeedbackForm.propTypes = {
302
303
  modal: PropTypes.bool,
303
304
  };
304
305
 
305
- FeedbackForm.defaultProps = {
306
- aboutOptions: [],
307
- aboutLabel: 'This is about',
308
- additionalComments: false,
309
- analytics: avLogMessagesApi,
310
- showSupport: false,
311
- modal: true,
312
- };
313
-
314
306
  export default FeedbackForm;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Modal } from 'reactstrap';
4
+
4
5
  import FeedbackForm from './FeedbackForm';
5
6
  import SupportModal from './SupportModal';
6
7
 
package/src/SmileField.js CHANGED
@@ -1,11 +1,29 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useField, useFormikContext } from 'formik';
4
+
4
5
  import FeedbackButton from './FeedbackButton';
5
6
 
6
7
  const btnStyles = { flex: 1, margin: '0 2% 0 2%' };
8
+ const defaultOptions = [
9
+ {
10
+ icon: 'smile',
11
+ description: 'Smiley face',
12
+ label: 'What do you like?',
13
+ },
14
+ {
15
+ icon: 'meh',
16
+ description: 'Meh face',
17
+ label: 'What would you improve?',
18
+ },
19
+ {
20
+ icon: 'frown',
21
+ description: 'Frowny face',
22
+ label: "What don't you like?",
23
+ },
24
+ ];
7
25
 
8
- const SmileField = ({ name, options, onChange, autoFocusFeedbackButton, onClose, modal }) => {
26
+ const SmileField = ({ name, options = defaultOptions, onChange, autoFocusFeedbackButton = true, onClose, modal }) => {
9
27
  const [{ value }] = useField(name);
10
28
  const { setFieldValue } = useFormikContext();
11
29
 
@@ -55,25 +73,4 @@ SmileField.propTypes = {
55
73
  modal: PropTypes.bool,
56
74
  };
57
75
 
58
- SmileField.defaultProps = {
59
- options: [
60
- {
61
- icon: 'smile',
62
- description: 'Smiley face',
63
- label: 'What do you like?',
64
- },
65
- {
66
- icon: 'meh',
67
- description: 'Meh face',
68
- label: 'What would you improve?',
69
- },
70
- {
71
- icon: 'frown',
72
- description: 'Frowny face',
73
- label: "What don't you like?",
74
- },
75
- ],
76
- autoFocusFeedbackButton: true,
77
- };
78
-
79
76
  export default SmileField;