@availity/mui-feedback 2.0.6 → 3.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 +34 -0
- package/dist/index.js +119 -212
- package/package.json +23 -24
- package/project.json +5 -6
- package/src/lib/Feedback.tsx +1 -1
- package/src/lib/FeedbackForm.test.tsx +4 -4
- package/src/lib/FeedbackForm.tsx +6 -8
- package/src/lib/FeedbackHeader.test.tsx +3 -3
- package/src/lib/FeedbackHeader.tsx +1 -3
- package/dist/index.d.mts +0 -10
- package/dist/index.mjs +0 -308
- package/jest.config.js +0 -17
- package/tsconfig.spec.json +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [3.0.0](https://github.com/Availity/element/compare/@availity/mui-feedback@2.0.6...@availity/mui-feedback@3.0.0) (2026-06-16)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `mui-button` updated to version `2.0.6`
|
|
10
|
+
* `mui-form-utils` updated to version `2.0.6`
|
|
11
|
+
* `mui-icon` updated to version `2.0.6`
|
|
12
|
+
* `mui-layout` updated to version `2.0.6`
|
|
13
|
+
* `mui-popover` updated to version `2.0.6`
|
|
14
|
+
* `mui-textfield` updated to version `2.0.6`
|
|
15
|
+
* `mui-toggle-button` updated to version `2.0.6`
|
|
16
|
+
* `mui-typography` updated to version `2.0.6`
|
|
17
|
+
|
|
18
|
+
### ⚠ BREAKING CHANGES
|
|
19
|
+
|
|
20
|
+
* CJS builds removed, packages are ESM-only.
|
|
21
|
+
|
|
22
|
+
- Convert all packages to ESM (type: module)
|
|
23
|
+
- Replace Jest with Vitest for all test targets
|
|
24
|
+
- Migrate ESLint to v9 flat config (eslint.config.js)
|
|
25
|
+
- Build output ESM-only (removed CJS dist/index.js require path)
|
|
26
|
+
- Upgrade @tanstack/react-query from v4 to v5
|
|
27
|
+
- Upgrade @availity/api-axios to v13
|
|
28
|
+
- Drop Node 20 support (engines: ^22.0.0 || ^24.0.0)
|
|
29
|
+
- Bump React to 19.2.7, MUI to 7.3.11, TypeScript to 5.9.3
|
|
30
|
+
- Simplify CI caching with built-in yarn cache action + Nx cache
|
|
31
|
+
- Modernize nx.json configuration
|
|
32
|
+
- Update husky hooks to use yarn directly
|
|
33
|
+
- Replace lint-staged nx affected with direct eslint
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* migrate to ESM, Vitest, and ESLint 9 flat config ([cc22bb4](https://github.com/Availity/element/commit/cc22bb4a230bc1f3b190f187c4e61249d015b25b))
|
|
38
|
+
|
|
5
39
|
## [2.0.6](https://github.com/Availity/element/compare/@availity/mui-feedback@2.0.5...@availity/mui-feedback@2.0.6) (2026-05-27)
|
|
6
40
|
|
|
7
41
|
### Dependency Updates
|
package/dist/index.js
CHANGED
|
@@ -1,127 +1,40 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
|
-
var __export = (target, all) => {
|
|
38
|
-
for (var name in all)
|
|
39
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
-
};
|
|
41
|
-
var __copyProps = (to, from, except, desc) => {
|
|
42
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
-
for (let key of __getOwnPropNames(from))
|
|
44
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
-
}
|
|
47
|
-
return to;
|
|
48
|
-
};
|
|
49
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
-
mod
|
|
56
|
-
));
|
|
57
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
-
var __async = (__this, __arguments, generator) => {
|
|
59
|
-
return new Promise((resolve, reject) => {
|
|
60
|
-
var fulfilled = (value) => {
|
|
61
|
-
try {
|
|
62
|
-
step(generator.next(value));
|
|
63
|
-
} catch (e) {
|
|
64
|
-
reject(e);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var rejected = (value) => {
|
|
68
|
-
try {
|
|
69
|
-
step(generator.throw(value));
|
|
70
|
-
} catch (e) {
|
|
71
|
-
reject(e);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
75
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
// src/index.ts
|
|
80
|
-
var index_exports = {};
|
|
81
|
-
__export(index_exports, {
|
|
82
|
-
Feedback: () => Feedback
|
|
83
|
-
});
|
|
84
|
-
module.exports = __toCommonJS(index_exports);
|
|
85
|
-
|
|
86
1
|
// src/lib/Feedback.tsx
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Popover } from "@availity/mui-popover";
|
|
4
|
+
import { Button as Button2 } from "@availity/mui-button";
|
|
5
|
+
import Container from "@mui/material/Container";
|
|
6
|
+
import { styled as styled3 } from "@mui/material/styles";
|
|
7
|
+
import { avLogMessagesApiV2 } from "@availity/api-axios";
|
|
8
|
+
import { CommentsIcon } from "@availity/mui-icon";
|
|
93
9
|
|
|
94
10
|
// src/lib/FeedbackForm.tsx
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var SmileButtons =
|
|
107
|
-
var FormActions =
|
|
108
|
-
var SmileButton = (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
})
|
|
123
|
-
) });
|
|
124
|
-
};
|
|
11
|
+
import { useEffect } from "react";
|
|
12
|
+
import { TextField } from "@availity/mui-textfield";
|
|
13
|
+
import { LoadingButton, Button, IconButton } from "@availity/mui-button";
|
|
14
|
+
import { ToggleButtonGroup, ToggleButton } from "@availity/mui-toggle-button";
|
|
15
|
+
import { Grid } from "@availity/mui-layout";
|
|
16
|
+
import { styled } from "@mui/material/styles";
|
|
17
|
+
import { FaceFrownIcon, FaceNeutralIcon, FaceSmileIcon } from "@availity/mui-icon";
|
|
18
|
+
import { FormLabel } from "@availity/mui-form-utils";
|
|
19
|
+
import { avRegionsApi } from "@availity/api-axios";
|
|
20
|
+
import { useForm, Controller } from "react-hook-form";
|
|
21
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
var SmileButtons = styled(ToggleButtonGroup, { name: "AvFeedbackContainer", slot: "SmileButtons" })({});
|
|
23
|
+
var FormActions = styled(Grid, { name: "AvFeedbackContainer", slot: "FormActions" })({});
|
|
24
|
+
var SmileButton = ({ disabled, Icon, label, value, ...props }) => /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
25
|
+
ToggleButton,
|
|
26
|
+
{
|
|
27
|
+
component: IconButton,
|
|
28
|
+
disableRipple: true,
|
|
29
|
+
title: label,
|
|
30
|
+
"aria-label": value,
|
|
31
|
+
value,
|
|
32
|
+
...props,
|
|
33
|
+
disabled,
|
|
34
|
+
size: "large",
|
|
35
|
+
children: /* @__PURE__ */ jsx(Icon, {})
|
|
36
|
+
}
|
|
37
|
+
) });
|
|
125
38
|
var FeedbackForm = ({
|
|
126
39
|
analytics,
|
|
127
40
|
appName,
|
|
@@ -131,7 +44,6 @@ var FeedbackForm = ({
|
|
|
131
44
|
setLoading,
|
|
132
45
|
setSent
|
|
133
46
|
}) => {
|
|
134
|
-
var _c;
|
|
135
47
|
const {
|
|
136
48
|
control,
|
|
137
49
|
formState: { errors },
|
|
@@ -139,29 +51,30 @@ var FeedbackForm = ({
|
|
|
139
51
|
register,
|
|
140
52
|
setValue,
|
|
141
53
|
watch
|
|
142
|
-
} =
|
|
143
|
-
const onSubmit =
|
|
144
|
-
var _b = _a, { smileField } = _b, values = __objRest(_b, ["smileField"]);
|
|
54
|
+
} = useForm();
|
|
55
|
+
const onSubmit = async ({ smileField, ...values }) => {
|
|
145
56
|
setLoading(true);
|
|
146
57
|
try {
|
|
147
|
-
const response =
|
|
148
|
-
|
|
149
|
-
surveyId: `${appName.
|
|
58
|
+
const response = await avRegionsApi.getCurrentRegion();
|
|
59
|
+
await analytics.info({
|
|
60
|
+
surveyId: `${appName.replaceAll(/\s/g, "_")}_Smile_Survey`,
|
|
150
61
|
smileLocation: `${appName}`,
|
|
151
62
|
smile: `icon-${smileField}`,
|
|
152
63
|
url: window.location.href,
|
|
153
64
|
region: response.data.regions[0] && response.data.regions[0].id,
|
|
154
65
|
userAgent: window.navigator.userAgent,
|
|
155
|
-
submitTime: /* @__PURE__ */ new Date()
|
|
156
|
-
|
|
66
|
+
submitTime: /* @__PURE__ */ new Date(),
|
|
67
|
+
...values
|
|
68
|
+
// Spread the form values onto the logger
|
|
69
|
+
});
|
|
157
70
|
setSent(true);
|
|
158
71
|
setLoading(false);
|
|
159
|
-
} catch
|
|
72
|
+
} catch {
|
|
160
73
|
setSent(false);
|
|
161
74
|
setLoading(false);
|
|
162
75
|
}
|
|
163
|
-
}
|
|
164
|
-
|
|
76
|
+
};
|
|
77
|
+
useEffect(() => {
|
|
165
78
|
if (sent) {
|
|
166
79
|
setTimeout(() => {
|
|
167
80
|
handleClose();
|
|
@@ -170,25 +83,25 @@ var FeedbackForm = ({
|
|
|
170
83
|
}, [sent]);
|
|
171
84
|
const options = [
|
|
172
85
|
{
|
|
173
|
-
Icon:
|
|
86
|
+
Icon: FaceSmileIcon,
|
|
174
87
|
label: "What do you like?",
|
|
175
88
|
value: "smile"
|
|
176
89
|
},
|
|
177
90
|
{
|
|
178
|
-
Icon:
|
|
91
|
+
Icon: FaceNeutralIcon,
|
|
179
92
|
label: "What would you improve?",
|
|
180
93
|
value: "meh"
|
|
181
94
|
},
|
|
182
|
-
{ Icon:
|
|
95
|
+
{ Icon: FaceFrownIcon, label: "What don't you like?", value: "frown" }
|
|
183
96
|
];
|
|
184
97
|
const smileFieldValue = watch("smileField");
|
|
185
98
|
const getFeedbackLabel = () => {
|
|
186
99
|
const option = options.find((option2) => option2.value === smileFieldValue);
|
|
187
|
-
return
|
|
100
|
+
return option?.label || "What would you improve?";
|
|
188
101
|
};
|
|
189
102
|
if (!sent) {
|
|
190
|
-
return /* @__PURE__ */
|
|
191
|
-
|
|
103
|
+
return /* @__PURE__ */ jsxs(
|
|
104
|
+
Grid,
|
|
192
105
|
{
|
|
193
106
|
component: "form",
|
|
194
107
|
container: true,
|
|
@@ -197,100 +110,95 @@ var FeedbackForm = ({
|
|
|
197
110
|
"aria-label": "Feedback Form",
|
|
198
111
|
"aria-describedby": "feedback-form-header",
|
|
199
112
|
children: [
|
|
200
|
-
/* @__PURE__ */
|
|
201
|
-
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
Controller,
|
|
202
115
|
{
|
|
203
116
|
control,
|
|
204
117
|
name: "smileField",
|
|
205
|
-
render: ({ field }) =>
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
);
|
|
219
|
-
}
|
|
118
|
+
render: ({ field }) => /* @__PURE__ */ jsx(
|
|
119
|
+
SmileButtons,
|
|
120
|
+
{
|
|
121
|
+
children: options.map((props, index) => /* @__PURE__ */ jsx(SmileButton, { autoFocus: index === 0, disabled: loading, ...props }, props.value)),
|
|
122
|
+
...field,
|
|
123
|
+
"aria-labelledby": "feedback-form-header",
|
|
124
|
+
onChange: (event, value) => {
|
|
125
|
+
setValue(field.name, value);
|
|
126
|
+
},
|
|
127
|
+
size: "medium",
|
|
128
|
+
exclusive: true
|
|
129
|
+
}
|
|
130
|
+
)
|
|
220
131
|
}
|
|
221
132
|
),
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
133
|
+
/* @__PURE__ */ jsx(
|
|
134
|
+
TextField,
|
|
135
|
+
{
|
|
136
|
+
...register("feedback", {
|
|
137
|
+
required: "This field is required",
|
|
138
|
+
maxLength: { value: 200, message: "This field must not exceed 200 characters" }
|
|
139
|
+
}),
|
|
228
140
|
fullWidth: true,
|
|
229
141
|
multiline: true,
|
|
230
142
|
minRows: 3,
|
|
231
143
|
maxRows: 3,
|
|
232
144
|
label: getFeedbackLabel(),
|
|
233
145
|
InputLabelProps: {
|
|
234
|
-
component:
|
|
146
|
+
component: FormLabel,
|
|
235
147
|
required: true
|
|
236
148
|
},
|
|
237
149
|
inputProps: { "aria-required": "true" },
|
|
238
|
-
helperText:
|
|
150
|
+
helperText: errors.feedback?.message || "Max 200 characters",
|
|
239
151
|
error: !!errors.feedback,
|
|
240
152
|
disabled: loading || !smileFieldValue
|
|
241
|
-
}
|
|
153
|
+
}
|
|
242
154
|
),
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ jsxs(FormActions, { container: true, direction: "row", width: "100%", spacing: 1, wrap: "wrap", children: [
|
|
156
|
+
/* @__PURE__ */ jsx(Grid, { sx: { flex: 1, minWidth: "147px" }, children: /* @__PURE__ */ jsx(Button, { color: "secondary", disabled: loading, onClick: handleClose, children: "Close" }) }),
|
|
157
|
+
/* @__PURE__ */ jsx(Grid, { sx: { flex: 1, minWidth: "147px" }, children: /* @__PURE__ */ jsx(LoadingButton, { disabled: !smileFieldValue, loading, type: "submit", children: "Send Feedback" }) })
|
|
246
158
|
] })
|
|
247
159
|
]
|
|
248
160
|
}
|
|
249
161
|
);
|
|
250
|
-
} else {
|
|
251
|
-
return null;
|
|
252
162
|
}
|
|
163
|
+
return null;
|
|
253
164
|
};
|
|
254
165
|
|
|
255
166
|
// src/lib/FeedbackHeader.tsx
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
var FeedbackHeaderContainer = (
|
|
263
|
-
var FeedbackHeader = ({ appName, handleClose, loading, sent }) =>
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
children:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
);
|
|
279
|
-
};
|
|
167
|
+
import { IconButton as IconButton2 } from "@availity/mui-button";
|
|
168
|
+
import { CloseIcon } from "@availity/mui-icon";
|
|
169
|
+
import { Typography } from "@availity/mui-typography";
|
|
170
|
+
import { Grid as Grid2 } from "@availity/mui-layout";
|
|
171
|
+
import { styled as styled2 } from "@mui/material/styles";
|
|
172
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
173
|
+
var FeedbackHeaderContainer = styled2(Grid2, { name: "AvFeedbackContainer", slot: "FeedbackHeaderContainer" })({});
|
|
174
|
+
var FeedbackHeader = ({ appName, handleClose, loading, sent }) => /* @__PURE__ */ jsxs2(
|
|
175
|
+
FeedbackHeaderContainer,
|
|
176
|
+
{
|
|
177
|
+
alignItems: "flex-start",
|
|
178
|
+
container: true,
|
|
179
|
+
direction: "row",
|
|
180
|
+
justifyContent: "space-between",
|
|
181
|
+
flexWrap: "nowrap",
|
|
182
|
+
id: "feedback-form-header",
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ jsx2(Grid2, { sx: { whiteSpace: "normal" }, children: /* @__PURE__ */ jsx2(Typography, { component: "h2", variant: "h5", children: sent ? "Thank you for your feedback." : `Tell us what you think about ${appName}` }) }),
|
|
185
|
+
/* @__PURE__ */ jsx2(Grid2, { children: /* @__PURE__ */ jsx2(IconButton2, { disabled: loading, title: "Close", onClick: handleClose, size: "medium", children: /* @__PURE__ */ jsx2(CloseIcon, { fontSize: "xsmall" }) }) })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
);
|
|
280
189
|
|
|
281
190
|
// src/lib/Feedback.tsx
|
|
282
|
-
|
|
283
|
-
var
|
|
284
|
-
var
|
|
285
|
-
var FeedbackButton = (0, import_styles3.styled)(import_mui_button3.Button, { name: "AvFeedbackButton", slot: "root" })({});
|
|
191
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
192
|
+
var FeedbackContainer = styled3(Container, { name: "AvFeedbackContainer", slot: "root" })({});
|
|
193
|
+
var FeedbackButton = styled3(Button2, { name: "AvFeedbackButton", slot: "root" })({});
|
|
286
194
|
var Feedback = ({
|
|
287
|
-
analytics =
|
|
195
|
+
analytics = avLogMessagesApiV2,
|
|
288
196
|
appName,
|
|
289
197
|
buttonVariant = "secondary"
|
|
290
198
|
}) => {
|
|
291
|
-
const [anchorEl, setAnchorEl] =
|
|
292
|
-
const [sent, setSent] =
|
|
293
|
-
const [loading, setLoading] =
|
|
199
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
200
|
+
const [sent, setSent] = useState(false);
|
|
201
|
+
const [loading, setLoading] = useState(false);
|
|
294
202
|
const handlePopoverOpen = (event) => {
|
|
295
203
|
setAnchorEl(event.currentTarget);
|
|
296
204
|
setSent(false);
|
|
@@ -299,10 +207,10 @@ var Feedback = ({
|
|
|
299
207
|
setAnchorEl(null);
|
|
300
208
|
};
|
|
301
209
|
const open = Boolean(anchorEl);
|
|
302
|
-
return /* @__PURE__ */ (
|
|
303
|
-
/* @__PURE__ */ (
|
|
304
|
-
/* @__PURE__ */ (
|
|
305
|
-
|
|
210
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
211
|
+
/* @__PURE__ */ jsx3(FeedbackButton, { onClick: handlePopoverOpen, color: buttonVariant, startIcon: /* @__PURE__ */ jsx3(CommentsIcon, {}), children: "Feedback" }),
|
|
212
|
+
/* @__PURE__ */ jsx3(
|
|
213
|
+
Popover,
|
|
306
214
|
{
|
|
307
215
|
anchorEl,
|
|
308
216
|
anchorOrigin: {
|
|
@@ -317,9 +225,9 @@ var Feedback = ({
|
|
|
317
225
|
vertical: "top",
|
|
318
226
|
horizontal: "right"
|
|
319
227
|
},
|
|
320
|
-
children: /* @__PURE__ */ (
|
|
321
|
-
/* @__PURE__ */ (
|
|
322
|
-
/* @__PURE__ */ (
|
|
228
|
+
children: /* @__PURE__ */ jsxs3(FeedbackContainer, { children: [
|
|
229
|
+
/* @__PURE__ */ jsx3(FeedbackHeader, { appName, handleClose: handlePopoverClose, loading, sent }),
|
|
230
|
+
/* @__PURE__ */ jsx3(
|
|
323
231
|
FeedbackForm,
|
|
324
232
|
{
|
|
325
233
|
analytics,
|
|
@@ -336,7 +244,6 @@ var Feedback = ({
|
|
|
336
244
|
)
|
|
337
245
|
] });
|
|
338
246
|
};
|
|
339
|
-
|
|
340
|
-
0 && (module.exports = {
|
|
247
|
+
export {
|
|
341
248
|
Feedback
|
|
342
|
-
}
|
|
249
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/mui-feedback",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Availity MUI Feedback Component - part of the @availity/element design system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -21,30 +21,28 @@
|
|
|
21
21
|
"author": "Availity Developers <AVOSS@availity.com>",
|
|
22
22
|
"browser": "./dist/index.js",
|
|
23
23
|
"main": "./dist/index.js",
|
|
24
|
-
"module": "./dist/index.mjs",
|
|
25
24
|
"types": "./dist/index.d.ts",
|
|
26
25
|
"exports": {
|
|
27
|
-
"./package.json": "./package.json",
|
|
28
26
|
".": {
|
|
29
27
|
"types": "./dist/index.d.ts",
|
|
30
|
-
"import": "./dist/index.
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
"import": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./package.json": "./package.json"
|
|
33
31
|
},
|
|
34
32
|
"scripts": {
|
|
35
|
-
"build": "tsup src/index.ts --format esm
|
|
36
|
-
"dev": "tsup src/index.ts --format esm
|
|
33
|
+
"build": "tsup src/index.ts --format esm --dts",
|
|
34
|
+
"dev": "tsup src/index.ts --format esm --watch --dts",
|
|
37
35
|
"clean": "rm -rf dist",
|
|
38
36
|
"clean:nm": "rm -rf node_modules",
|
|
39
37
|
"publish": "yarn npm publish --tolerate-republish --access public",
|
|
40
38
|
"publish:canary": "yarn npm publish --access public --tag canary"
|
|
41
39
|
},
|
|
42
40
|
"devDependencies": {
|
|
43
|
-
"@mui/material": "^7.3.
|
|
44
|
-
"react": "19.2.
|
|
45
|
-
"react-dom": "19.2.
|
|
46
|
-
"tsup": "^8.
|
|
47
|
-
"typescript": "^5.
|
|
41
|
+
"@mui/material": "^7.3.11",
|
|
42
|
+
"react": "19.2.7",
|
|
43
|
+
"react-dom": "19.2.7",
|
|
44
|
+
"tsup": "^8.5.1",
|
|
45
|
+
"typescript": "^5.9.3"
|
|
48
46
|
},
|
|
49
47
|
"peerDependencies": {
|
|
50
48
|
"@mui/material": "^7.0.0",
|
|
@@ -54,16 +52,17 @@
|
|
|
54
52
|
"access": "public"
|
|
55
53
|
},
|
|
56
54
|
"dependencies": {
|
|
57
|
-
"@availity/api-axios": "^
|
|
58
|
-
"@availity/mui-button": "^
|
|
59
|
-
"@availity/mui-form-utils": "^
|
|
60
|
-
"@availity/mui-icon": "^
|
|
61
|
-
"@availity/mui-layout": "^
|
|
62
|
-
"@availity/mui-popover": "^
|
|
63
|
-
"@availity/mui-textfield": "^
|
|
64
|
-
"@availity/mui-toggle-button": "^
|
|
65
|
-
"@availity/mui-typography": "^
|
|
66
|
-
"react-hook-form": "^7.
|
|
55
|
+
"@availity/api-axios": "^13.2.0",
|
|
56
|
+
"@availity/mui-button": "^3.0.0",
|
|
57
|
+
"@availity/mui-form-utils": "^3.0.0",
|
|
58
|
+
"@availity/mui-icon": "^3.0.0",
|
|
59
|
+
"@availity/mui-layout": "^3.0.0",
|
|
60
|
+
"@availity/mui-popover": "^3.0.0",
|
|
61
|
+
"@availity/mui-textfield": "^3.0.0",
|
|
62
|
+
"@availity/mui-toggle-button": "^3.0.0",
|
|
63
|
+
"@availity/mui-typography": "^3.0.0",
|
|
64
|
+
"react-hook-form": "^7.79.0"
|
|
67
65
|
},
|
|
68
|
-
"sideEffects": false
|
|
66
|
+
"sideEffects": false,
|
|
67
|
+
"type": "module"
|
|
69
68
|
}
|
package/project.json
CHANGED
|
@@ -8,23 +8,20 @@
|
|
|
8
8
|
"lint": {
|
|
9
9
|
"executor": "@nx/eslint:lint",
|
|
10
10
|
"options": {
|
|
11
|
-
"eslintConfig": ".eslintrc.json",
|
|
12
11
|
"silent": false,
|
|
13
12
|
"fix": false,
|
|
14
13
|
"cache": true,
|
|
15
14
|
"cacheLocation": "./node_modules/.cache/feedback/.eslintcache",
|
|
16
15
|
"maxWarnings": -1,
|
|
17
16
|
"quiet": false,
|
|
18
|
-
"noEslintrc": false,
|
|
19
17
|
"hasTypeAwareRules": true,
|
|
20
18
|
"cacheStrategy": "metadata"
|
|
21
19
|
}
|
|
22
20
|
},
|
|
23
21
|
"test": {
|
|
24
|
-
"executor": "
|
|
25
|
-
"outputs": ["{workspaceRoot}/coverage/feedback"],
|
|
22
|
+
"executor": "nx:run-commands",
|
|
26
23
|
"options": {
|
|
27
|
-
"
|
|
24
|
+
"command": "vitest run packages/feedback"
|
|
28
25
|
}
|
|
29
26
|
},
|
|
30
27
|
"version": {
|
|
@@ -34,7 +31,9 @@
|
|
|
34
31
|
"commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]",
|
|
35
32
|
"tagPrefix": "@availity/{projectName}@",
|
|
36
33
|
"trackDeps": true,
|
|
37
|
-
"skipCommitTypes": [
|
|
34
|
+
"skipCommitTypes": [
|
|
35
|
+
"docs"
|
|
36
|
+
]
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
}
|
package/src/lib/Feedback.tsx
CHANGED
|
@@ -4,9 +4,9 @@ import { Button } from '@availity/mui-button';
|
|
|
4
4
|
import Container from '@mui/material/Container';
|
|
5
5
|
import { styled } from '@mui/material/styles';
|
|
6
6
|
import { avLogMessagesApiV2 } from '@availity/api-axios';
|
|
7
|
+
import { CommentsIcon } from '@availity/mui-icon';
|
|
7
8
|
import { FeedbackForm } from './FeedbackForm';
|
|
8
9
|
import { FeedbackHeader } from './FeedbackHeader';
|
|
9
|
-
import { CommentsIcon } from '@availity/mui-icon';
|
|
10
10
|
|
|
11
11
|
export interface FeedbackProps {
|
|
12
12
|
analytics?: { info: (entries: Record<string, unknown>) => void };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { render, fireEvent } from '@testing-library/react';
|
|
2
2
|
import { FeedbackForm } from './FeedbackForm';
|
|
3
3
|
|
|
4
|
-
const analytics = { info:
|
|
5
|
-
const handleClose =
|
|
6
|
-
const setLoading =
|
|
7
|
-
const setSent =
|
|
4
|
+
const analytics = { info: vi.fn() };
|
|
5
|
+
const handleClose = vi.fn();
|
|
6
|
+
const setLoading = vi.fn();
|
|
7
|
+
const setSent = vi.fn();
|
|
8
8
|
|
|
9
9
|
describe('Feedback', () => {
|
|
10
10
|
test('should render Send Feedback button disabled', () => {
|
package/src/lib/FeedbackForm.tsx
CHANGED
|
@@ -38,7 +38,7 @@ const SmileButtons = styled(ToggleButtonGroup, { name: 'AvFeedbackContainer', sl
|
|
|
38
38
|
|
|
39
39
|
const FormActions = styled(Grid, { name: 'AvFeedbackContainer', slot: 'FormActions' })({});
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
const SmileButton = ({ disabled, Icon, label, value, ...props }: SmileButtonProps) => (
|
|
43
43
|
<div>
|
|
44
44
|
<ToggleButton
|
|
@@ -80,7 +80,7 @@ export const FeedbackForm = ({
|
|
|
80
80
|
const response = await avRegionsApi.getCurrentRegion();
|
|
81
81
|
|
|
82
82
|
await analytics.info({
|
|
83
|
-
surveyId: `${appName.
|
|
83
|
+
surveyId: `${appName.replaceAll(/\s/g, '_')}_Smile_Survey`,
|
|
84
84
|
smileLocation: `${appName}`,
|
|
85
85
|
smile: `icon-${smileField}`,
|
|
86
86
|
url: window.location.href,
|
|
@@ -140,8 +140,7 @@ export const FeedbackForm = ({
|
|
|
140
140
|
<Controller
|
|
141
141
|
control={control}
|
|
142
142
|
name="smileField"
|
|
143
|
-
render={({ field }) =>
|
|
144
|
-
return (
|
|
143
|
+
render={({ field }) => (
|
|
145
144
|
<SmileButtons
|
|
146
145
|
children={options.map((props, index) => (
|
|
147
146
|
<SmileButton autoFocus={index === 0} disabled={loading} key={props.value} {...props} />
|
|
@@ -154,8 +153,7 @@ export const FeedbackForm = ({
|
|
|
154
153
|
size="medium"
|
|
155
154
|
exclusive
|
|
156
155
|
/>
|
|
157
|
-
)
|
|
158
|
-
}}
|
|
156
|
+
)}
|
|
159
157
|
/>
|
|
160
158
|
<TextField
|
|
161
159
|
{...register('feedback', {
|
|
@@ -190,7 +188,7 @@ export const FeedbackForm = ({
|
|
|
190
188
|
</FormActions>
|
|
191
189
|
</Grid>
|
|
192
190
|
);
|
|
193
|
-
}
|
|
191
|
+
}
|
|
194
192
|
return null;
|
|
195
|
-
|
|
193
|
+
|
|
196
194
|
};
|
|
@@ -3,7 +3,7 @@ import { FeedbackHeader } from './FeedbackHeader';
|
|
|
3
3
|
|
|
4
4
|
describe('FeedbackHeader', () => {
|
|
5
5
|
test('should render successfully', () => {
|
|
6
|
-
const handleClose =
|
|
6
|
+
const handleClose = vi.fn();
|
|
7
7
|
const { getByText, getByLabelText } = render(
|
|
8
8
|
<FeedbackHeader appName="This App" handleClose={handleClose} loading={false} sent={false} />
|
|
9
9
|
);
|
|
@@ -18,9 +18,9 @@ describe('FeedbackHeader', () => {
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
test('should render sent text successfully', () => {
|
|
21
|
-
const handleClose =
|
|
21
|
+
const handleClose = vi.fn();
|
|
22
22
|
const { getByText } = render(
|
|
23
|
-
<FeedbackHeader appName="This App" handleClose={handleClose} loading={false} sent
|
|
23
|
+
<FeedbackHeader appName="This App" handleClose={handleClose} loading={false} sent />
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
expect(getByText('Thank you for your feedback.')).toBeTruthy();
|
|
@@ -13,8 +13,7 @@ interface FeedbackHeaderProps {
|
|
|
13
13
|
|
|
14
14
|
const FeedbackHeaderContainer = styled(Grid, { name: 'AvFeedbackContainer', slot: 'FeedbackHeaderContainer' })({});
|
|
15
15
|
|
|
16
|
-
export const FeedbackHeader = ({ appName, handleClose, loading, sent }: FeedbackHeaderProps): React.JSX.Element =>
|
|
17
|
-
return (
|
|
16
|
+
export const FeedbackHeader = ({ appName, handleClose, loading, sent }: FeedbackHeaderProps): React.JSX.Element => (
|
|
18
17
|
<FeedbackHeaderContainer
|
|
19
18
|
alignItems="flex-start"
|
|
20
19
|
container
|
|
@@ -35,4 +34,3 @@ export const FeedbackHeader = ({ appName, handleClose, loading, sent }: Feedback
|
|
|
35
34
|
</Grid>
|
|
36
35
|
</FeedbackHeaderContainer>
|
|
37
36
|
);
|
|
38
|
-
};
|
package/dist/index.d.mts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
interface FeedbackProps {
|
|
2
|
-
analytics?: {
|
|
3
|
-
info: (entries: Record<string, unknown>) => void;
|
|
4
|
-
};
|
|
5
|
-
appName: string;
|
|
6
|
-
buttonVariant?: 'secondary' | 'tertiary';
|
|
7
|
-
}
|
|
8
|
-
declare const Feedback: ({ analytics, appName, buttonVariant, }: FeedbackProps) => React.JSX.Element;
|
|
9
|
-
|
|
10
|
-
export { Feedback, type FeedbackProps };
|
package/dist/index.mjs
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
var __async = (__this, __arguments, generator) => {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
var fulfilled = (value) => {
|
|
35
|
-
try {
|
|
36
|
-
step(generator.next(value));
|
|
37
|
-
} catch (e) {
|
|
38
|
-
reject(e);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var rejected = (value) => {
|
|
42
|
-
try {
|
|
43
|
-
step(generator.throw(value));
|
|
44
|
-
} catch (e) {
|
|
45
|
-
reject(e);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// src/lib/Feedback.tsx
|
|
54
|
-
import { useState } from "react";
|
|
55
|
-
import { Popover } from "@availity/mui-popover";
|
|
56
|
-
import { Button as Button2 } from "@availity/mui-button";
|
|
57
|
-
import Container from "@mui/material/Container";
|
|
58
|
-
import { styled as styled3 } from "@mui/material/styles";
|
|
59
|
-
import { avLogMessagesApiV2 } from "@availity/api-axios";
|
|
60
|
-
|
|
61
|
-
// src/lib/FeedbackForm.tsx
|
|
62
|
-
import { useEffect } from "react";
|
|
63
|
-
import { TextField } from "@availity/mui-textfield";
|
|
64
|
-
import { LoadingButton, Button, IconButton } from "@availity/mui-button";
|
|
65
|
-
import { ToggleButtonGroup, ToggleButton } from "@availity/mui-toggle-button";
|
|
66
|
-
import { Grid } from "@availity/mui-layout";
|
|
67
|
-
import { styled } from "@mui/material/styles";
|
|
68
|
-
import { FaceFrownIcon, FaceNeutralIcon, FaceSmileIcon } from "@availity/mui-icon";
|
|
69
|
-
import { FormLabel } from "@availity/mui-form-utils";
|
|
70
|
-
import { avRegionsApi } from "@availity/api-axios";
|
|
71
|
-
import { useForm, Controller } from "react-hook-form";
|
|
72
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
73
|
-
var SmileButtons = styled(ToggleButtonGroup, { name: "AvFeedbackContainer", slot: "SmileButtons" })({});
|
|
74
|
-
var FormActions = styled(Grid, { name: "AvFeedbackContainer", slot: "FormActions" })({});
|
|
75
|
-
var SmileButton = (_a) => {
|
|
76
|
-
var _b = _a, { disabled, Icon, label, value } = _b, props = __objRest(_b, ["disabled", "Icon", "label", "value"]);
|
|
77
|
-
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
78
|
-
ToggleButton,
|
|
79
|
-
__spreadProps(__spreadValues({
|
|
80
|
-
component: IconButton,
|
|
81
|
-
disableRipple: true,
|
|
82
|
-
title: label,
|
|
83
|
-
"aria-label": value,
|
|
84
|
-
value
|
|
85
|
-
}, props), {
|
|
86
|
-
disabled,
|
|
87
|
-
size: "large",
|
|
88
|
-
children: /* @__PURE__ */ jsx(Icon, {})
|
|
89
|
-
})
|
|
90
|
-
) });
|
|
91
|
-
};
|
|
92
|
-
var FeedbackForm = ({
|
|
93
|
-
analytics,
|
|
94
|
-
appName,
|
|
95
|
-
handleClose,
|
|
96
|
-
loading,
|
|
97
|
-
sent,
|
|
98
|
-
setLoading,
|
|
99
|
-
setSent
|
|
100
|
-
}) => {
|
|
101
|
-
var _c;
|
|
102
|
-
const {
|
|
103
|
-
control,
|
|
104
|
-
formState: { errors },
|
|
105
|
-
handleSubmit,
|
|
106
|
-
register,
|
|
107
|
-
setValue,
|
|
108
|
-
watch
|
|
109
|
-
} = useForm();
|
|
110
|
-
const onSubmit = (_a) => __async(null, null, function* () {
|
|
111
|
-
var _b = _a, { smileField } = _b, values = __objRest(_b, ["smileField"]);
|
|
112
|
-
setLoading(true);
|
|
113
|
-
try {
|
|
114
|
-
const response = yield avRegionsApi.getCurrentRegion();
|
|
115
|
-
yield analytics.info(__spreadValues({
|
|
116
|
-
surveyId: `${appName.replace(/\s/g, "_")}_Smile_Survey`,
|
|
117
|
-
smileLocation: `${appName}`,
|
|
118
|
-
smile: `icon-${smileField}`,
|
|
119
|
-
url: window.location.href,
|
|
120
|
-
region: response.data.regions[0] && response.data.regions[0].id,
|
|
121
|
-
userAgent: window.navigator.userAgent,
|
|
122
|
-
submitTime: /* @__PURE__ */ new Date()
|
|
123
|
-
}, values));
|
|
124
|
-
setSent(true);
|
|
125
|
-
setLoading(false);
|
|
126
|
-
} catch (e) {
|
|
127
|
-
setSent(false);
|
|
128
|
-
setLoading(false);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
useEffect(() => {
|
|
132
|
-
if (sent) {
|
|
133
|
-
setTimeout(() => {
|
|
134
|
-
handleClose();
|
|
135
|
-
}, 2e3);
|
|
136
|
-
}
|
|
137
|
-
}, [sent]);
|
|
138
|
-
const options = [
|
|
139
|
-
{
|
|
140
|
-
Icon: FaceSmileIcon,
|
|
141
|
-
label: "What do you like?",
|
|
142
|
-
value: "smile"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
Icon: FaceNeutralIcon,
|
|
146
|
-
label: "What would you improve?",
|
|
147
|
-
value: "meh"
|
|
148
|
-
},
|
|
149
|
-
{ Icon: FaceFrownIcon, label: "What don't you like?", value: "frown" }
|
|
150
|
-
];
|
|
151
|
-
const smileFieldValue = watch("smileField");
|
|
152
|
-
const getFeedbackLabel = () => {
|
|
153
|
-
const option = options.find((option2) => option2.value === smileFieldValue);
|
|
154
|
-
return (option == null ? void 0 : option.label) || "What would you improve?";
|
|
155
|
-
};
|
|
156
|
-
if (!sent) {
|
|
157
|
-
return /* @__PURE__ */ jsxs(
|
|
158
|
-
Grid,
|
|
159
|
-
{
|
|
160
|
-
component: "form",
|
|
161
|
-
container: true,
|
|
162
|
-
sx: { justifyContent: "center" },
|
|
163
|
-
onSubmit: handleSubmit(onSubmit),
|
|
164
|
-
"aria-label": "Feedback Form",
|
|
165
|
-
"aria-describedby": "feedback-form-header",
|
|
166
|
-
children: [
|
|
167
|
-
/* @__PURE__ */ jsx(
|
|
168
|
-
Controller,
|
|
169
|
-
{
|
|
170
|
-
control,
|
|
171
|
-
name: "smileField",
|
|
172
|
-
render: ({ field }) => {
|
|
173
|
-
return /* @__PURE__ */ jsx(
|
|
174
|
-
SmileButtons,
|
|
175
|
-
__spreadProps(__spreadValues({
|
|
176
|
-
children: options.map((props, index) => /* @__PURE__ */ jsx(SmileButton, __spreadValues({ autoFocus: index === 0, disabled: loading }, props), props.value))
|
|
177
|
-
}, field), {
|
|
178
|
-
"aria-labelledby": "feedback-form-header",
|
|
179
|
-
onChange: (event, value) => {
|
|
180
|
-
setValue(field.name, value);
|
|
181
|
-
},
|
|
182
|
-
size: "medium",
|
|
183
|
-
exclusive: true
|
|
184
|
-
})
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
),
|
|
189
|
-
/* @__PURE__ */ jsx(
|
|
190
|
-
TextField,
|
|
191
|
-
__spreadProps(__spreadValues({}, register("feedback", {
|
|
192
|
-
required: "This field is required",
|
|
193
|
-
maxLength: { value: 200, message: "This field must not exceed 200 characters" }
|
|
194
|
-
})), {
|
|
195
|
-
fullWidth: true,
|
|
196
|
-
multiline: true,
|
|
197
|
-
minRows: 3,
|
|
198
|
-
maxRows: 3,
|
|
199
|
-
label: getFeedbackLabel(),
|
|
200
|
-
InputLabelProps: {
|
|
201
|
-
component: FormLabel,
|
|
202
|
-
required: true
|
|
203
|
-
},
|
|
204
|
-
inputProps: { "aria-required": "true" },
|
|
205
|
-
helperText: ((_c = errors.feedback) == null ? void 0 : _c.message) || "Max 200 characters",
|
|
206
|
-
error: !!errors.feedback,
|
|
207
|
-
disabled: loading || !smileFieldValue
|
|
208
|
-
})
|
|
209
|
-
),
|
|
210
|
-
/* @__PURE__ */ jsxs(FormActions, { container: true, direction: "row", width: "100%", spacing: 1, wrap: "wrap", children: [
|
|
211
|
-
/* @__PURE__ */ jsx(Grid, { sx: { flex: 1, minWidth: "147px" }, children: /* @__PURE__ */ jsx(Button, { color: "secondary", disabled: loading, onClick: handleClose, children: "Close" }) }),
|
|
212
|
-
/* @__PURE__ */ jsx(Grid, { sx: { flex: 1, minWidth: "147px" }, children: /* @__PURE__ */ jsx(LoadingButton, { disabled: !smileFieldValue, loading, type: "submit", children: "Send Feedback" }) })
|
|
213
|
-
] })
|
|
214
|
-
]
|
|
215
|
-
}
|
|
216
|
-
);
|
|
217
|
-
} else {
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
// src/lib/FeedbackHeader.tsx
|
|
223
|
-
import { IconButton as IconButton2 } from "@availity/mui-button";
|
|
224
|
-
import { CloseIcon } from "@availity/mui-icon";
|
|
225
|
-
import { Typography } from "@availity/mui-typography";
|
|
226
|
-
import { Grid as Grid2 } from "@availity/mui-layout";
|
|
227
|
-
import { styled as styled2 } from "@mui/material/styles";
|
|
228
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
229
|
-
var FeedbackHeaderContainer = styled2(Grid2, { name: "AvFeedbackContainer", slot: "FeedbackHeaderContainer" })({});
|
|
230
|
-
var FeedbackHeader = ({ appName, handleClose, loading, sent }) => {
|
|
231
|
-
return /* @__PURE__ */ jsxs2(
|
|
232
|
-
FeedbackHeaderContainer,
|
|
233
|
-
{
|
|
234
|
-
alignItems: "flex-start",
|
|
235
|
-
container: true,
|
|
236
|
-
direction: "row",
|
|
237
|
-
justifyContent: "space-between",
|
|
238
|
-
flexWrap: "nowrap",
|
|
239
|
-
id: "feedback-form-header",
|
|
240
|
-
children: [
|
|
241
|
-
/* @__PURE__ */ jsx2(Grid2, { sx: { whiteSpace: "normal" }, children: /* @__PURE__ */ jsx2(Typography, { component: "h2", variant: "h5", children: sent ? "Thank you for your feedback." : `Tell us what you think about ${appName}` }) }),
|
|
242
|
-
/* @__PURE__ */ jsx2(Grid2, { children: /* @__PURE__ */ jsx2(IconButton2, { disabled: loading, title: "Close", onClick: handleClose, size: "medium", children: /* @__PURE__ */ jsx2(CloseIcon, { fontSize: "xsmall" }) }) })
|
|
243
|
-
]
|
|
244
|
-
}
|
|
245
|
-
);
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
// src/lib/Feedback.tsx
|
|
249
|
-
import { CommentsIcon } from "@availity/mui-icon";
|
|
250
|
-
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
251
|
-
var FeedbackContainer = styled3(Container, { name: "AvFeedbackContainer", slot: "root" })({});
|
|
252
|
-
var FeedbackButton = styled3(Button2, { name: "AvFeedbackButton", slot: "root" })({});
|
|
253
|
-
var Feedback = ({
|
|
254
|
-
analytics = avLogMessagesApiV2,
|
|
255
|
-
appName,
|
|
256
|
-
buttonVariant = "secondary"
|
|
257
|
-
}) => {
|
|
258
|
-
const [anchorEl, setAnchorEl] = useState(null);
|
|
259
|
-
const [sent, setSent] = useState(false);
|
|
260
|
-
const [loading, setLoading] = useState(false);
|
|
261
|
-
const handlePopoverOpen = (event) => {
|
|
262
|
-
setAnchorEl(event.currentTarget);
|
|
263
|
-
setSent(false);
|
|
264
|
-
};
|
|
265
|
-
const handlePopoverClose = () => {
|
|
266
|
-
setAnchorEl(null);
|
|
267
|
-
};
|
|
268
|
-
const open = Boolean(anchorEl);
|
|
269
|
-
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
270
|
-
/* @__PURE__ */ jsx3(FeedbackButton, { onClick: handlePopoverOpen, color: buttonVariant, startIcon: /* @__PURE__ */ jsx3(CommentsIcon, {}), children: "Feedback" }),
|
|
271
|
-
/* @__PURE__ */ jsx3(
|
|
272
|
-
Popover,
|
|
273
|
-
{
|
|
274
|
-
anchorEl,
|
|
275
|
-
anchorOrigin: {
|
|
276
|
-
vertical: "bottom",
|
|
277
|
-
horizontal: "right"
|
|
278
|
-
},
|
|
279
|
-
sx: { marginTop: "4px" },
|
|
280
|
-
disableRestoreFocus: true,
|
|
281
|
-
onClose: handlePopoverClose,
|
|
282
|
-
open,
|
|
283
|
-
transformOrigin: {
|
|
284
|
-
vertical: "top",
|
|
285
|
-
horizontal: "right"
|
|
286
|
-
},
|
|
287
|
-
children: /* @__PURE__ */ jsxs3(FeedbackContainer, { children: [
|
|
288
|
-
/* @__PURE__ */ jsx3(FeedbackHeader, { appName, handleClose: handlePopoverClose, loading, sent }),
|
|
289
|
-
/* @__PURE__ */ jsx3(
|
|
290
|
-
FeedbackForm,
|
|
291
|
-
{
|
|
292
|
-
analytics,
|
|
293
|
-
appName,
|
|
294
|
-
handleClose: handlePopoverClose,
|
|
295
|
-
loading,
|
|
296
|
-
sent,
|
|
297
|
-
setLoading,
|
|
298
|
-
setSent
|
|
299
|
-
}
|
|
300
|
-
)
|
|
301
|
-
] })
|
|
302
|
-
}
|
|
303
|
-
)
|
|
304
|
-
] });
|
|
305
|
-
};
|
|
306
|
-
export {
|
|
307
|
-
Feedback
|
|
308
|
-
};
|
package/jest.config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const global = require('../../jest.config.global');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
...global,
|
|
5
|
-
displayName: 'feedback',
|
|
6
|
-
coverageDirectory: '../../coverage/feedback',
|
|
7
|
-
/* TODO: Update to latest Jest snapshotFormat
|
|
8
|
-
* By default Nx has kept the older style of Jest Snapshot formats
|
|
9
|
-
* to prevent breaking of any existing tests with snapshots.
|
|
10
|
-
* It's recommend you update to the latest format.
|
|
11
|
-
* You can do this by removing snapshotFormat property
|
|
12
|
-
* and running tests with --update-snapshot flag.
|
|
13
|
-
* Example: From within the project directory, run "nx test --update-snapshot"
|
|
14
|
-
* More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format
|
|
15
|
-
*/
|
|
16
|
-
snapshotFormat: { escapeString: true, printBasicPrototype: true },
|
|
17
|
-
};
|
package/tsconfig.spec.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"types": ["jest", "node", "@testing-library/jest-dom"],
|
|
7
|
-
"allowJs": true
|
|
8
|
-
},
|
|
9
|
-
"include": ["jest.config.ts", "**/*.test.js", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"]
|
|
10
|
-
}
|