@availity/feedback 7.1.2 → 7.1.4

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,19 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [7.1.4](https://github.com/Availity/availity-react/compare/@availity/feedback@7.1.3...@availity/feedback@7.1.4) (2023-04-18)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **feedback:** disable button on submit to avoid log spam ([#1269](https://github.com/Availity/availity-react/issues/1269)) ([5cfc7b5](https://github.com/Availity/availity-react/commit/5cfc7b5be9de5d8e3705adef1374a1858c30a7cd))
11
+
12
+
13
+
14
+ ## [7.1.3](https://github.com/Availity/availity-react/compare/@availity/feedback@7.1.2...@availity/feedback@7.1.3) (2022-12-01)
15
+
16
+
17
+
5
18
  ## [7.1.2](https://github.com/Availity/availity-react/compare/@availity/feedback@7.1.1...@availity/feedback@7.1.2) (2022-08-08)
6
19
 
7
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/feedback",
3
- "version": "7.1.2",
3
+ "version": "7.1.4",
4
4
  "description": "Availity feedback with smiley faces react component.",
5
5
  "keywords": [
6
6
  "react",
@@ -25,11 +25,11 @@
25
25
  "publish:canary": "yarn npm publish --access public --tag canary"
26
26
  },
27
27
  "dependencies": {
28
- "@availity/form": "1.5.1",
29
- "@availity/hooks": "3.3.1",
30
- "@availity/icon": "0.11.1",
28
+ "@availity/form": "1.7.2",
29
+ "@availity/hooks": "3.3.3",
30
+ "@availity/icon": "0.11.3",
31
31
  "@availity/native-form": "^5.0.1",
32
- "@availity/select": "3.3.2",
32
+ "@availity/select": "3.5.0",
33
33
  "prop-types": "^15.8.1"
34
34
  },
35
35
  "devDependencies": {
package/src/Feedback.js CHANGED
@@ -73,21 +73,32 @@ const Feedback = ({
73
73
  };
74
74
 
75
75
  Feedback.propTypes = {
76
+ analytics: PropTypes.shape({
77
+ info: PropTypes.func.isRequired,
78
+ }),
79
+ /** The name of the application this feedback is for. It is used in the API request to indicate where the feedback came from. */
76
80
  appName: PropTypes.string,
81
+ /** Whether to open the FeedbackForm in a modal */
77
82
  modal: PropTypes.bool,
83
+ /** Allows for overriding the z-indexvalue from react-strap Modalcomponent. */
78
84
  zIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
85
+ /** Allows for overriding the z-index value from reactstrap Support Modal component. */
79
86
  supportZIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
87
+ /** The text to display on the submit button. */
80
88
  children: PropTypes.node,
81
89
  className: PropTypes.string,
90
+ /** Indicates if the button should use the "outline" styles or not. */
82
91
  outline: PropTypes.bool,
92
+ /** The color of the button. Default: "light". */
83
93
  color: PropTypes.string,
94
+ /** Props to be spread to the underlying FeedbackForm. See the FeedbackForm Props. */
84
95
  formProps: PropTypes.object,
96
+ /** Text that prompts the user to provider feedback. Default: "Tell us what you think about ${appName}.". */
85
97
  prompt: PropTypes.string,
98
+ /** Callback for when the feedback is submitted. It is called with the feedback object. */
86
99
  onFeedbackSent: PropTypes.func,
87
100
  onModalOpenChange: PropTypes.func,
88
- analytics: PropTypes.shape({
89
- info: PropTypes.func.isRequired,
90
- }),
101
+ /** Toggle whether or not to show the "Open a Support ticket" link in the FeedbackForm */
91
102
  showSupport: PropTypes.bool,
92
103
  };
93
104
 
@@ -45,8 +45,10 @@ const FeedbackForm = ({
45
45
  }) => {
46
46
  const [active, setActive] = useState(null);
47
47
  const [sent, setSent] = useState(null);
48
+ const [loading, setLoading] = useState(null);
48
49
  const ref = useRef();
49
50
  const sendFeedback = async ({ smileField, ...values }) => {
51
+ setLoading(true);
50
52
  const response = await avRegionsApi.getCurrentRegion();
51
53
 
52
54
  await analytics.info({
@@ -62,6 +64,7 @@ const FeedbackForm = ({
62
64
  });
63
65
 
64
66
  setSent(values);
67
+ setLoading(false);
65
68
  };
66
69
 
67
70
  // Close the Modal once sent after 2 seconds
@@ -238,7 +241,7 @@ const FeedbackForm = ({
238
241
  }}
239
242
  type="submit"
240
243
  color="primary"
241
- disabled={!active}
244
+ disabled={Boolean(!active || loading)}
242
245
  >
243
246
  Send Feedback
244
247
  </Button>
@@ -249,8 +252,14 @@ const FeedbackForm = ({
249
252
  };
250
253
 
251
254
  FeedbackForm.propTypes = {
255
+ /** The name of the application this feedback is for. It is used in the API request to indicate where the feedback came from. */
252
256
  name: PropTypes.string.isRequired,
257
+ /** Callback for when the feedback is submitted. It is called with the feedback object. */
253
258
  onFeedbackSent: PropTypes.func,
259
+ /** Array of Objects containing icon (String), description (String), and label (String) properties.
260
+ * Allows you to override the smiley face options which appear.
261
+ * Default: Smiley Face, Meh Face, and Frowny Face.
262
+ * Previous placeholder property removed as of v6.0.0. Use label instead. */
254
263
  faceOptions: PropTypes.arrayOf(
255
264
  PropTypes.shape({
256
265
  icon: PropTypes.string,
@@ -258,23 +267,37 @@ FeedbackForm.propTypes = {
258
267
  label: PropTypes.string,
259
268
  })
260
269
  ),
270
+ /** Array of Objects containing value (String,Number) and label (String) properties.
271
+ * Allows a dropdown displaying the options provided to let the user indicate what the feedback is about. */
261
272
  aboutOptions: PropTypes.arrayOf(
262
273
  PropTypes.shape({
263
274
  name: PropTypes.string,
264
275
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
265
276
  })
266
277
  ),
278
+ /** Label text for the dropdown created via the aboutOptions prop. Default: "This is about".
279
+ *Previously aboutPlaceholder. All placeholders replaced with labels starting v6.0.0. */
267
280
  aboutLabel: PropTypes.node,
281
+ /** When provided, a "Close" button is rendered and onClose is excuted when it's clicked. */
268
282
  onClose: PropTypes.func,
283
+ /** Text that prompts the user to provider feedback. Default: "Tell us what you think about ${appName}.". */
269
284
  prompt: PropTypes.string,
285
+ /** If true, shows an optional comments field below. */
270
286
  additionalComments: PropTypes.bool,
287
+ /** Static (non-user-entered) key/value pairs to be sent in feedback submission. */
271
288
  staticFields: PropTypes.object,
289
+ /** Props to be spread onto the <ModalHeader /> rendered inside of the <FeedbackForm />. See ModalHeader
290
+ *For accessibility use className instead of tag to adjust size and style of header. */
272
291
  modalHeaderProps: PropTypes.shape({ ...ModalHeader.propTypes }),
292
+ /** Override the analytics instance that is passed in. Default avLogMessagesApi */
273
293
  analytics: PropTypes.shape({
274
294
  info: PropTypes.func.isRequired,
275
295
  }),
296
+ /** Toggle whether or not to show the "Open a Support ticket" link in the FeedbackForm */
276
297
  showSupport: PropTypes.bool,
277
298
  setSupportIsActive: PropTypes.func,
299
+ /** Default: true. When set to false, the first feedback button is not focused.
300
+ * This is to avoid issues with focus causing other elements to close (e.g. dropdowns) */
278
301
  autoFocusFeedbackButton: PropTypes.bool,
279
302
  modal: PropTypes.bool,
280
303
  };