@backstage-community/plugin-entity-feedback 0.7.2 → 0.9.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
@@ -1,5 +1,27 @@
1
1
  # @backstage-community/plugin-entity-feedback
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 30e9f1b: Backstage version bump to v1.41.1
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [30e9f1b]
12
+ - @backstage-community/plugin-entity-feedback-common@0.7.0
13
+
14
+ ## 0.8.0
15
+
16
+ ### Minor Changes
17
+
18
+ - 45ec160: Backstage version bump to v1.40.2
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [45ec160]
23
+ - @backstage-community/plugin-entity-feedback-common@0.6.0
24
+
3
25
  ## 0.7.2
4
26
 
5
27
  ### Patch Changes
@@ -1,8 +1,8 @@
1
+ import { jsx } from 'react/jsx-runtime';
1
2
  import { parseEntityRef } from '@backstage/catalog-model';
2
3
  import { SubvalueCell, ErrorPanel, Table } from '@backstage/core-components';
3
4
  import { useApi } from '@backstage/core-plugin-api';
4
5
  import { EntityRefLink } from '@backstage/plugin-catalog-react';
5
- import React from 'react';
6
6
  import useAsync from 'react-use/esm/useAsync';
7
7
  import '@backstage/errors';
8
8
  import { entityFeedbackApiRef } from '../../api/EntityFeedbackApi.esm.js';
@@ -41,10 +41,10 @@ const FeedbackRatingsTable = (props) => {
41
41
  },
42
42
  render: (rating) => {
43
43
  const compoundRef = parseEntityRef(rating.entityRef);
44
- return /* @__PURE__ */ React.createElement(
44
+ return /* @__PURE__ */ jsx(
45
45
  SubvalueCell,
46
46
  {
47
- value: /* @__PURE__ */ React.createElement(
47
+ value: /* @__PURE__ */ jsx(
48
48
  EntityRefLink,
49
49
  {
50
50
  entityRef: rating.entityRef,
@@ -66,7 +66,7 @@ const FeedbackRatingsTable = (props) => {
66
66
  (r) => Object.keys(r.ratings).some((v) => ratingValues.includes(v))
67
67
  );
68
68
  if (error) {
69
- return /* @__PURE__ */ React.createElement(
69
+ return /* @__PURE__ */ jsx(
70
70
  ErrorPanel,
71
71
  {
72
72
  defaultExpanded: true,
@@ -75,7 +75,7 @@ const FeedbackRatingsTable = (props) => {
75
75
  }
76
76
  );
77
77
  }
78
- return /* @__PURE__ */ React.createElement(
78
+ return /* @__PURE__ */ jsx(
79
79
  Table,
80
80
  {
81
81
  columns,
@@ -1 +1 @@
1
- {"version":3,"file":"FeedbackRatingsTable.esm.js","sources":["../../../src/components/FeedbackRatingsTable/FeedbackRatingsTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { ErrorPanel, SubvalueCell, Table } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { EntityRatingsData } from '@backstage-community/plugin-entity-feedback-common';\nimport React from 'react';\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { entityFeedbackApiRef } from '../../api';\n\ninterface FeedbackRatingsTableProps {\n allEntities?: boolean;\n ownerRef?: string;\n ratingValues: string[];\n title?: string;\n}\n\nexport const FeedbackRatingsTable = (props: FeedbackRatingsTableProps) => {\n const {\n allEntities,\n ownerRef,\n ratingValues,\n title = 'Entity Ratings',\n } = props;\n const feedbackApi = useApi(entityFeedbackApiRef);\n\n const {\n error,\n loading,\n value: ratings,\n } = useAsync(async () => {\n if (allEntities) {\n return feedbackApi.getAllRatings();\n }\n\n if (!ownerRef) {\n return [];\n }\n\n return feedbackApi.getOwnedRatings(ownerRef);\n }, [allEntities, feedbackApi, ownerRef]);\n\n const columns = [\n { title: 'Title', field: 'entityTitle', hidden: true, searchable: true },\n {\n title: 'Entity',\n field: 'entityRef',\n highlight: true,\n customSort: (a: EntityRatingsData, b: EntityRatingsData) => {\n const titleA = a.entityTitle ?? parseEntityRef(a.entityRef).name;\n const titleB = b.entityTitle ?? parseEntityRef(b.entityRef).name;\n return titleA.localeCompare(titleB);\n },\n render: (rating: EntityRatingsData) => {\n const compoundRef = parseEntityRef(rating.entityRef);\n return (\n <SubvalueCell\n value={\n <EntityRefLink\n entityRef={rating.entityRef}\n defaultKind={compoundRef.kind}\n title={rating.entityTitle}\n />\n }\n subvalue={compoundRef.kind}\n />\n );\n },\n },\n ...ratingValues.map(ratingVal => ({\n title: ratingVal,\n field: `ratings.${ratingVal}`,\n })),\n ];\n\n // Exclude entities that don't have applicable ratings\n const ratingsRows = ratings?.filter(r =>\n Object.keys(r.ratings).some(v => ratingValues.includes(v)),\n );\n\n if (error) {\n return (\n <ErrorPanel\n defaultExpanded\n title=\"Failed to load feedback ratings\"\n error={error}\n />\n );\n }\n\n return (\n <Table<EntityRatingsData>\n columns={columns}\n data={ratingsRows ?? []}\n isLoading={loading}\n options={{\n emptyRowsWhenPaging: false,\n loadingType: 'linear',\n pageSize: 20,\n pageSizeOptions: [20, 50, 100],\n paging: true,\n showEmptyDataSourceMessage: !loading,\n }}\n title={title}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAiCa,MAAA,oBAAA,GAAuB,CAAC,KAAqC,KAAA;AACxE,EAAM,MAAA;AAAA,IACJ,WAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,KAAQ,GAAA;AAAA,GACN,GAAA,KAAA;AACJ,EAAM,MAAA,WAAA,GAAc,OAAO,oBAAoB,CAAA;AAE/C,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,OAAA;AAAA,I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,CAAA;AAAA;AAAA,SACxB;AAAA;AAEJ,KACF;AAAA,IACA,GAAG,YAAa,CAAA,GAAA,CAAI,CAAc,SAAA,MAAA;AAAA,MAChC,KAAO,EAAA,SAAA;AAAA,MACP,KAAA,EAAO,WAAW,SAAS,CAAA;AAAA,KAC3B,CAAA;AAAA,GACJ;AAGA,EAAA,MAAM,cAAc,OAAS,EAAA,MAAA;AAAA,IAAO,CAAA,CAAA,KAClC,MAAO,CAAA,IAAA,CAAK,CAAE,CAAA,OAAO,CAAE,CAAA,IAAA,CAAK,CAAK,CAAA,KAAA,YAAA,CAAa,QAAS,CAAA,CAAC,CAAC;AAAA,GAC3D;AAEA,EAAA,IAAI,KAAO,EAAA;AACT,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,eAAe,EAAA,IAAA;AAAA,QACf,KAAM,EAAA,iCAAA;AAAA,QACN;AAAA;AAAA,KACF;AAAA;AAIJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAA;AAAA,MACA,IAAA,EAAM,eAAe,EAAC;AAAA,MACtB,SAAW,EAAA,OAAA;AAAA,MACX,OAAS,EAAA;AAAA,QACP,mBAAqB,EAAA,KAAA;AAAA,QACrB,WAAa,EAAA,QAAA;AAAA,QACb,QAAU,EAAA,EAAA;AAAA,QACV,eAAiB,EAAA,CAAC,EAAI,EAAA,EAAA,EAAI,GAAG,CAAA;AAAA,QAC7B,MAAQ,EAAA,IAAA;AAAA,QACR,4BAA4B,CAAC;AAAA,OAC/B;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"FeedbackRatingsTable.esm.js","sources":["../../../src/components/FeedbackRatingsTable/FeedbackRatingsTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { ErrorPanel, SubvalueCell, Table } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { EntityRatingsData } from '@backstage-community/plugin-entity-feedback-common';\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { entityFeedbackApiRef } from '../../api';\n\ninterface FeedbackRatingsTableProps {\n allEntities?: boolean;\n ownerRef?: string;\n ratingValues: string[];\n title?: string;\n}\n\nexport const FeedbackRatingsTable = (props: FeedbackRatingsTableProps) => {\n const {\n allEntities,\n ownerRef,\n ratingValues,\n title = 'Entity Ratings',\n } = props;\n const feedbackApi = useApi(entityFeedbackApiRef);\n\n const {\n error,\n loading,\n value: ratings,\n } = useAsync(async () => {\n if (allEntities) {\n return feedbackApi.getAllRatings();\n }\n\n if (!ownerRef) {\n return [];\n }\n\n return feedbackApi.getOwnedRatings(ownerRef);\n }, [allEntities, feedbackApi, ownerRef]);\n\n const columns = [\n { title: 'Title', field: 'entityTitle', hidden: true, searchable: true },\n {\n title: 'Entity',\n field: 'entityRef',\n highlight: true,\n customSort: (a: EntityRatingsData, b: EntityRatingsData) => {\n const titleA = a.entityTitle ?? parseEntityRef(a.entityRef).name;\n const titleB = b.entityTitle ?? parseEntityRef(b.entityRef).name;\n return titleA.localeCompare(titleB);\n },\n render: (rating: EntityRatingsData) => {\n const compoundRef = parseEntityRef(rating.entityRef);\n return (\n <SubvalueCell\n value={\n <EntityRefLink\n entityRef={rating.entityRef}\n defaultKind={compoundRef.kind}\n title={rating.entityTitle}\n />\n }\n subvalue={compoundRef.kind}\n />\n );\n },\n },\n ...ratingValues.map(ratingVal => ({\n title: ratingVal,\n field: `ratings.${ratingVal}`,\n })),\n ];\n\n // Exclude entities that don't have applicable ratings\n const ratingsRows = ratings?.filter(r =>\n Object.keys(r.ratings).some(v => ratingValues.includes(v)),\n );\n\n if (error) {\n return (\n <ErrorPanel\n defaultExpanded\n title=\"Failed to load feedback ratings\"\n error={error}\n />\n );\n }\n\n return (\n <Table<EntityRatingsData>\n columns={columns}\n data={ratingsRows ?? []}\n isLoading={loading}\n options={{\n emptyRowsWhenPaging: false,\n loadingType: 'linear',\n pageSize: 20,\n pageSizeOptions: [20, 50, 100],\n paging: true,\n showEmptyDataSourceMessage: !loading,\n }}\n title={title}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAgCa,MAAA,oBAAA,GAAuB,CAAC,KAAqC,KAAA;AACxE,EAAM,MAAA;AAAA,IACJ,WAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,KAAQ,GAAA;AAAA,GACN,GAAA,KAAA;AACJ,EAAM,MAAA,WAAA,GAAc,OAAO,oBAAoB,CAAA;AAE/C,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAO,EAAA;AAAA,GACT,GAAI,SAAS,YAAY;AACvB,IAAA,IAAI,WAAa,EAAA;AACf,MAAA,OAAO,YAAY,aAAc,EAAA;AAAA;AAGnC,IAAA,IAAI,CAAC,QAAU,EAAA;AACb,MAAA,OAAO,EAAC;AAAA;AAGV,IAAO,OAAA,WAAA,CAAY,gBAAgB,QAAQ,CAAA;AAAA,GAC1C,EAAA,CAAC,WAAa,EAAA,WAAA,EAAa,QAAQ,CAAC,CAAA;AAEvC,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,EAAE,OAAO,OAAS,EAAA,KAAA,EAAO,eAAe,MAAQ,EAAA,IAAA,EAAM,YAAY,IAAK,EAAA;AAAA,IACvE;AAAA,MACE,KAAO,EAAA,QAAA;AAAA,MACP,KAAO,EAAA,WAAA;AAAA,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ACf,KAAM,EAAA,iCAAA;AAAA,QACN;AAAA;AAAA,KACF;AAAA;AAIJ,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAA;AAAA,MACA,IAAA,EAAM,eAAe,EAAC;AAAA,MACtB,SAAW,EAAA,OAAA;AAAA,MACX,OAAS,EAAA;AAAA,QACP,mBAAqB,EAAA,KAAA;AAAA,QACrB,WAAa,EAAA,QAAA;AAAA,QACb,QAAU,EAAA,EAAA;AAAA,QACV,eAAiB,EAAA,CAAC,EAAI,EAAA,EAAA,EAAI,GAAG,CAAA;AAAA,QAC7B,MAAQ,EAAA,IAAA;AAAA,QACR,4BAA4B,CAAC;AAAA,OAC/B;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,3 +1,4 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
1
2
  import { stringifyEntityRef } from '@backstage/catalog-model';
2
3
  import { Progress } from '@backstage/core-components';
3
4
  import { useApi, errorApiRef } from '@backstage/core-plugin-api';
@@ -17,7 +18,7 @@ import Switch from '@material-ui/core/Switch';
17
18
  import TextField from '@material-ui/core/TextField';
18
19
  import Typography from '@material-ui/core/Typography';
19
20
  import { makeStyles } from '@material-ui/core/styles';
20
- import React, { useState } from 'react';
21
+ import { useState } from 'react';
21
22
  import useAsyncFn from 'react-use/esm/useAsyncFn';
22
23
  import '@backstage/errors';
23
24
  import { entityFeedbackApiRef } from '../../api/EntityFeedbackApi.esm.js';
@@ -93,76 +94,104 @@ const FeedbackResponseDialog = (props) => {
93
94
  errorApi.post(e);
94
95
  }
95
96
  }, [comments, consent, entity, feedbackApi, onClose, responseSelections]);
96
- return /* @__PURE__ */ React.createElement(Dialog, { open, onClose: () => !saving && onClose() }, saving && /* @__PURE__ */ React.createElement(Progress, null), /* @__PURE__ */ React.createElement(DialogTitle, null, feedbackDialogTitle), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(FormControl, { component: "fieldset", fullWidth: true }, /* @__PURE__ */ React.createElement(FormLabel, { component: "legend" }, "Select all that apply"), /* @__PURE__ */ React.createElement(FormGroup, { className: classes.boxContainer }, feedbackDialogResponses.map((response) => /* @__PURE__ */ React.createElement(Grid, { container: true, key: response.id, direction: "column", spacing: 1 }, /* @__PURE__ */ React.createElement(
97
- FormControlLabel,
98
- {
99
- control: /* @__PURE__ */ React.createElement(
100
- Checkbox,
97
+ return /* @__PURE__ */ jsxs(Dialog, { open, onClose: () => !saving && onClose(), children: [
98
+ saving && /* @__PURE__ */ jsx(Progress, {}),
99
+ /* @__PURE__ */ jsx(DialogTitle, { children: feedbackDialogTitle }),
100
+ /* @__PURE__ */ jsxs(DialogContent, { children: [
101
+ /* @__PURE__ */ jsxs(FormControl, { component: "fieldset", fullWidth: true, children: [
102
+ /* @__PURE__ */ jsx(FormLabel, { component: "legend", children: "Select all that apply" }),
103
+ /* @__PURE__ */ jsx(FormGroup, { className: classes.boxContainer, children: feedbackDialogResponses.map((response) => /* @__PURE__ */ jsxs(Grid, { container: true, direction: "column", spacing: 1, children: [
104
+ /* @__PURE__ */ jsx(
105
+ FormControlLabel,
106
+ {
107
+ control: /* @__PURE__ */ jsx(
108
+ Checkbox,
109
+ {
110
+ checked: responseSelections[response.id],
111
+ disabled: saving,
112
+ name: response.id,
113
+ onChange: (e) => setResponseSelections({
114
+ ...responseSelections,
115
+ [e.target.name]: e.target.checked
116
+ }),
117
+ color: "primary"
118
+ }
119
+ ),
120
+ label: response.label
121
+ }
122
+ ),
123
+ /* @__PURE__ */ jsx(Collapse, { in: responseSelections[response.id], children: /* @__PURE__ */ jsx(
124
+ TextField,
125
+ {
126
+ "data-testid": `feedback-response-dialog-collapse-comments-input-${responseSelections[response.id]}`,
127
+ disabled: saving,
128
+ className: classes.commentBoxes,
129
+ multiline: true,
130
+ minRows: 2,
131
+ fullWidth: true,
132
+ variant: "outlined",
133
+ value: comments.responseComments[response.id] || "",
134
+ onChange: (e) => setComments((prevComments) => ({
135
+ responseComments: {
136
+ ...prevComments.responseComments,
137
+ [response.id]: e.target.value
138
+ },
139
+ additionalComments: prevComments.additionalComments
140
+ }))
141
+ }
142
+ ) })
143
+ ] }, response.id)) })
144
+ ] }),
145
+ /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, children: [
146
+ /* @__PURE__ */ jsx(FormLabel, { component: "legend", className: classes.formLabel, children: "Additional comments" }),
147
+ /* @__PURE__ */ jsx(
148
+ TextField,
149
+ {
150
+ "data-testid": "feedback-response-dialog-comments-input",
151
+ disabled: saving,
152
+ multiline: true,
153
+ minRows: 2,
154
+ onChange: (e) => setComments((prevComments) => ({
155
+ responseComments: {
156
+ ...prevComments.responseComments
157
+ },
158
+ additionalComments: e.target.value
159
+ })),
160
+ variant: "outlined",
161
+ value: comments.additionalComments || ""
162
+ }
163
+ )
164
+ ] }),
165
+ /* @__PURE__ */ jsxs(Typography, { className: classes.contactConsent, children: [
166
+ "May we contact you about your feedback?",
167
+ /* @__PURE__ */ jsxs(Grid, { component: "label", container: true, alignItems: "center", spacing: 1, children: [
168
+ /* @__PURE__ */ jsx(Grid, { item: true, children: "No" }),
169
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
170
+ Switch,
171
+ {
172
+ checked: consent,
173
+ disabled: saving,
174
+ onChange: (e) => setConsent(e.target.checked)
175
+ }
176
+ ) }),
177
+ /* @__PURE__ */ jsx(Grid, { item: true, children: "Yes" })
178
+ ] })
179
+ ] })
180
+ ] }),
181
+ /* @__PURE__ */ jsxs(DialogActions, { className: classes.dialogActions, children: [
182
+ /* @__PURE__ */ jsx(
183
+ Button,
101
184
  {
102
- checked: responseSelections[response.id],
185
+ color: "primary",
186
+ "data-testid": "feedback-response-dialog-submit-button",
103
187
  disabled: saving,
104
- name: response.id,
105
- onChange: (e) => setResponseSelections({
106
- ...responseSelections,
107
- [e.target.name]: e.target.checked
108
- }),
109
- color: "primary"
188
+ onClick: saveResponse,
189
+ children: "Submit"
110
190
  }
111
191
  ),
112
- label: response.label
113
- }
114
- ), /* @__PURE__ */ React.createElement(Collapse, { in: responseSelections[response.id] }, /* @__PURE__ */ React.createElement(
115
- TextField,
116
- {
117
- "data-testid": `feedback-response-dialog-collapse-comments-input-${responseSelections[response.id]}`,
118
- disabled: saving,
119
- className: classes.commentBoxes,
120
- multiline: true,
121
- minRows: 2,
122
- fullWidth: true,
123
- variant: "outlined",
124
- value: comments.responseComments[response.id] || "",
125
- onChange: (e) => setComments((prevComments) => ({
126
- responseComments: {
127
- ...prevComments.responseComments,
128
- [response.id]: e.target.value
129
- },
130
- additionalComments: prevComments.additionalComments
131
- }))
132
- }
133
- )))))), /* @__PURE__ */ React.createElement(FormControl, { fullWidth: true }, /* @__PURE__ */ React.createElement(FormLabel, { component: "legend", className: classes.formLabel }, "Additional comments"), /* @__PURE__ */ React.createElement(
134
- TextField,
135
- {
136
- "data-testid": "feedback-response-dialog-comments-input",
137
- disabled: saving,
138
- multiline: true,
139
- minRows: 2,
140
- onChange: (e) => setComments((prevComments) => ({
141
- responseComments: {
142
- ...prevComments.responseComments
143
- },
144
- additionalComments: e.target.value
145
- })),
146
- variant: "outlined",
147
- value: comments.additionalComments || ""
148
- }
149
- )), /* @__PURE__ */ React.createElement(Typography, { className: classes.contactConsent }, "May we contact you about your feedback?", /* @__PURE__ */ React.createElement(Grid, { component: "label", container: true, alignItems: "center", spacing: 1 }, /* @__PURE__ */ React.createElement(Grid, { item: true }, "No"), /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
150
- Switch,
151
- {
152
- checked: consent,
153
- disabled: saving,
154
- onChange: (e) => setConsent(e.target.checked)
155
- }
156
- )), /* @__PURE__ */ React.createElement(Grid, { item: true }, "Yes")))), /* @__PURE__ */ React.createElement(DialogActions, { className: classes.dialogActions }, /* @__PURE__ */ React.createElement(
157
- Button,
158
- {
159
- color: "primary",
160
- "data-testid": "feedback-response-dialog-submit-button",
161
- disabled: saving,
162
- onClick: saveResponse
163
- },
164
- "Submit"
165
- ), /* @__PURE__ */ React.createElement(Button, { color: "primary", disabled: saving, onClick: onClose }, "Close")));
192
+ /* @__PURE__ */ jsx(Button, { color: "primary", disabled: saving, onClick: onClose, children: "Close" })
193
+ ] })
194
+ ] });
166
195
  };
167
196
 
168
197
  export { FeedbackResponseDialog };
@@ -1 +1 @@
1
- {"version":3,"file":"FeedbackResponseDialog.esm.js","sources":["../../../src/components/FeedbackResponseDialog/FeedbackResponseDialog.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { Progress } from '@backstage/core-components';\nimport { ErrorApiError, errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Collapse from '@material-ui/core/Collapse';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport FormGroup from '@material-ui/core/FormGroup';\nimport FormLabel from '@material-ui/core/FormLabel';\nimport Grid from '@material-ui/core/Grid';\nimport Switch from '@material-ui/core/Switch';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport React, { ReactNode, useState } from 'react';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\n\nimport { entityFeedbackApiRef } from '../../api';\n\n/**\n * @public\n */\nexport interface EntityFeedbackResponse {\n id: string;\n label: string;\n}\nexport interface Comments {\n responseComments: {\n [key: string]: string;\n };\n additionalComments?: string;\n}\n\nconst defaultFeedbackResponses: EntityFeedbackResponse[] = [\n { id: 'incorrect', label: 'Incorrect info' },\n { id: 'missing', label: 'Missing info' },\n { id: 'other', label: 'Other' },\n];\n\n/**\n * @public\n */\nexport interface FeedbackResponseDialogProps {\n entity: Entity;\n feedbackDialogResponses?: EntityFeedbackResponse[];\n feedbackDialogTitle?: ReactNode;\n open: boolean;\n onClose: () => void;\n}\n\nconst useStyles = makeStyles<Theme>(\n theme => ({\n contactConsent: {\n marginTop: theme.spacing(1.5),\n },\n commentBoxes: {\n marginBottom: theme.spacing(1.5),\n },\n boxContainer: {\n marginBottom: theme.spacing(1.5),\n marginTop: theme.spacing(1.5),\n marginLeft: theme.spacing(1),\n paddingRight: theme.spacing(1),\n },\n formLabel: {\n marginBottom: theme.spacing(1.5),\n },\n dialogActions: {\n justifyContent: 'flex-start',\n },\n }),\n { name: 'BackstageEntityFeedbackDialog' },\n);\n\nexport const FeedbackResponseDialog = (props: FeedbackResponseDialogProps) => {\n const {\n entity,\n feedbackDialogResponses = defaultFeedbackResponses,\n feedbackDialogTitle = 'Tell us what could be better',\n open,\n onClose,\n } = props;\n const classes = useStyles();\n const errorApi = useApi(errorApiRef);\n const feedbackApi = useApi(entityFeedbackApiRef);\n const [responseSelections, setResponseSelections] = useState(\n Object.fromEntries(feedbackDialogResponses.map(r => [r.id, false])),\n );\n const [comments, setComments] = useState<Comments>({\n responseComments: {},\n additionalComments: '',\n });\n const [consent, setConsent] = useState(true);\n\n const [{ loading: saving }, saveResponse] = useAsyncFn(async () => {\n // filter out responses that were not selected\n const filteredResponseComments = Object.entries(\n comments.responseComments,\n ).reduce((entry, [key, value]) => {\n if (responseSelections[key]) {\n entry[key] = value;\n }\n return entry;\n }, {} as { [key: string]: string });\n\n const filteredComments = {\n ...comments,\n responseComments: filteredResponseComments,\n };\n try {\n await feedbackApi.recordResponse(stringifyEntityRef(entity), {\n comments: JSON.stringify(filteredComments),\n consent,\n response: Object.keys(responseSelections)\n .filter(id => responseSelections[id])\n .join(','),\n });\n onClose();\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n }, [comments, consent, entity, feedbackApi, onClose, responseSelections]);\n\n return (\n <Dialog open={open} onClose={() => !saving && onClose()}>\n {saving && <Progress />}\n <DialogTitle>{feedbackDialogTitle}</DialogTitle>\n <DialogContent>\n <FormControl component=\"fieldset\" fullWidth>\n <FormLabel component=\"legend\">Select all that apply</FormLabel>\n <FormGroup className={classes.boxContainer}>\n {feedbackDialogResponses.map((response: EntityFeedbackResponse) => (\n <Grid container key={response.id} direction=\"column\" spacing={1}>\n <FormControlLabel\n control={\n <Checkbox\n checked={responseSelections[response.id]}\n disabled={saving}\n name={response.id}\n onChange={e =>\n setResponseSelections({\n ...responseSelections,\n [e.target.name]: e.target.checked,\n })\n }\n color=\"primary\"\n />\n }\n label={response.label}\n />\n <Collapse in={responseSelections[response.id]}>\n <TextField\n data-testid={`feedback-response-dialog-collapse-comments-input-${\n responseSelections[response.id]\n }`}\n disabled={saving}\n className={classes.commentBoxes}\n multiline\n minRows={2}\n fullWidth\n variant=\"outlined\"\n value={comments.responseComments[response.id] || ''}\n onChange={e =>\n setComments(prevComments => ({\n responseComments: {\n ...prevComments.responseComments,\n [response.id]: e.target.value,\n },\n additionalComments: prevComments.additionalComments,\n }))\n }\n />\n </Collapse>\n </Grid>\n ))}\n </FormGroup>\n </FormControl>\n <FormControl fullWidth>\n <FormLabel component=\"legend\" className={classes.formLabel}>\n Additional comments\n </FormLabel>\n <TextField\n data-testid=\"feedback-response-dialog-comments-input\"\n disabled={saving}\n multiline\n minRows={2}\n onChange={e =>\n setComments(prevComments => ({\n responseComments: {\n ...prevComments.responseComments,\n },\n additionalComments: e.target.value,\n }))\n }\n variant=\"outlined\"\n value={comments.additionalComments || ''}\n />\n </FormControl>\n <Typography className={classes.contactConsent}>\n May we contact you about your feedback?\n <Grid component=\"label\" container alignItems=\"center\" spacing={1}>\n <Grid item>No</Grid>\n <Grid item>\n <Switch\n checked={consent}\n disabled={saving}\n onChange={e => setConsent(e.target.checked)}\n />\n </Grid>\n <Grid item>Yes</Grid>\n </Grid>\n </Typography>\n </DialogContent>\n <DialogActions className={classes.dialogActions}>\n <Button\n color=\"primary\"\n data-testid=\"feedback-response-dialog-submit-button\"\n disabled={saving}\n onClick={saveResponse}\n >\n Submit\n </Button>\n <Button color=\"primary\" disabled={saving} onClick={onClose}>\n Close\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAM,wBAAqD,GAAA;AAAA,EACzD,EAAE,EAAA,EAAI,WAAa,EAAA,KAAA,EAAO,gBAAiB,EAAA;AAAA,EAC3C,EAAE,EAAA,EAAI,SAAW,EAAA,KAAA,EAAO,cAAe,EAAA;AAAA,EACvC,EAAE,EAAA,EAAI,OAAS,EAAA,KAAA,EAAO,OAAQ;AAChC,CAAA;AAaA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,cAAgB,EAAA;AAAA,MACd,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA,KAC9B;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA,KACjC;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,MAC/B,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,MAC5B,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC3B,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,KAC/B;AAAA,IACA,S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AA,EAAA,IAAE,CACb,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,OAAA;AAAA,MACT,QAAU,EAAA,MAAA;AAAA,MACV,QAAU,EAAA,CAAA,CAAA,KAAK,UAAW,CAAA,CAAA,CAAE,OAAO,OAAO;AAAA;AAAA,GAE9C,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IAAC,EAAA,EAAA,KAAG,CAChB,CACF,CACF,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,SAAA,EAAW,QAAQ,aAChC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,SAAA;AAAA,MACN,aAAY,EAAA,wCAAA;AAAA,MACZ,QAAU,EAAA,MAAA;AAAA,MACV,OAAS,EAAA;AAAA,KAAA;AAAA,IACV;AAAA,GAED,kBACC,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,KAAM,EAAA,SAAA,EAAU,QAAU,EAAA,MAAA,EAAQ,OAAS,EAAA,OAAA,EAAA,EAAS,OAE5D,CACF,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"FeedbackResponseDialog.esm.js","sources":["../../../src/components/FeedbackResponseDialog/FeedbackResponseDialog.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { Progress } from '@backstage/core-components';\nimport { ErrorApiError, errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Collapse from '@material-ui/core/Collapse';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport FormGroup from '@material-ui/core/FormGroup';\nimport FormLabel from '@material-ui/core/FormLabel';\nimport Grid from '@material-ui/core/Grid';\nimport Switch from '@material-ui/core/Switch';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport { ReactNode, useState } from 'react';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\n\nimport { entityFeedbackApiRef } from '../../api';\n\n/**\n * @public\n */\nexport interface EntityFeedbackResponse {\n id: string;\n label: string;\n}\nexport interface Comments {\n responseComments: {\n [key: string]: string;\n };\n additionalComments?: string;\n}\n\nconst defaultFeedbackResponses: EntityFeedbackResponse[] = [\n { id: 'incorrect', label: 'Incorrect info' },\n { id: 'missing', label: 'Missing info' },\n { id: 'other', label: 'Other' },\n];\n\n/**\n * @public\n */\nexport interface FeedbackResponseDialogProps {\n entity: Entity;\n feedbackDialogResponses?: EntityFeedbackResponse[];\n feedbackDialogTitle?: ReactNode;\n open: boolean;\n onClose: () => void;\n}\n\nconst useStyles = makeStyles<Theme>(\n theme => ({\n contactConsent: {\n marginTop: theme.spacing(1.5),\n },\n commentBoxes: {\n marginBottom: theme.spacing(1.5),\n },\n boxContainer: {\n marginBottom: theme.spacing(1.5),\n marginTop: theme.spacing(1.5),\n marginLeft: theme.spacing(1),\n paddingRight: theme.spacing(1),\n },\n formLabel: {\n marginBottom: theme.spacing(1.5),\n },\n dialogActions: {\n justifyContent: 'flex-start',\n },\n }),\n { name: 'BackstageEntityFeedbackDialog' },\n);\n\nexport const FeedbackResponseDialog = (props: FeedbackResponseDialogProps) => {\n const {\n entity,\n feedbackDialogResponses = defaultFeedbackResponses,\n feedbackDialogTitle = 'Tell us what could be better',\n open,\n onClose,\n } = props;\n const classes = useStyles();\n const errorApi = useApi(errorApiRef);\n const feedbackApi = useApi(entityFeedbackApiRef);\n const [responseSelections, setResponseSelections] = useState(\n Object.fromEntries(feedbackDialogResponses.map(r => [r.id, false])),\n );\n const [comments, setComments] = useState<Comments>({\n responseComments: {},\n additionalComments: '',\n });\n const [consent, setConsent] = useState(true);\n\n const [{ loading: saving }, saveResponse] = useAsyncFn(async () => {\n // filter out responses that were not selected\n const filteredResponseComments = Object.entries(\n comments.responseComments,\n ).reduce((entry, [key, value]) => {\n if (responseSelections[key]) {\n entry[key] = value;\n }\n return entry;\n }, {} as { [key: string]: string });\n\n const filteredComments = {\n ...comments,\n responseComments: filteredResponseComments,\n };\n try {\n await feedbackApi.recordResponse(stringifyEntityRef(entity), {\n comments: JSON.stringify(filteredComments),\n consent,\n response: Object.keys(responseSelections)\n .filter(id => responseSelections[id])\n .join(','),\n });\n onClose();\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n }, [comments, consent, entity, feedbackApi, onClose, responseSelections]);\n\n return (\n <Dialog open={open} onClose={() => !saving && onClose()}>\n {saving && <Progress />}\n <DialogTitle>{feedbackDialogTitle}</DialogTitle>\n <DialogContent>\n <FormControl component=\"fieldset\" fullWidth>\n <FormLabel component=\"legend\">Select all that apply</FormLabel>\n <FormGroup className={classes.boxContainer}>\n {feedbackDialogResponses.map((response: EntityFeedbackResponse) => (\n <Grid container key={response.id} direction=\"column\" spacing={1}>\n <FormControlLabel\n control={\n <Checkbox\n checked={responseSelections[response.id]}\n disabled={saving}\n name={response.id}\n onChange={e =>\n setResponseSelections({\n ...responseSelections,\n [e.target.name]: e.target.checked,\n })\n }\n color=\"primary\"\n />\n }\n label={response.label}\n />\n <Collapse in={responseSelections[response.id]}>\n <TextField\n data-testid={`feedback-response-dialog-collapse-comments-input-${\n responseSelections[response.id]\n }`}\n disabled={saving}\n className={classes.commentBoxes}\n multiline\n minRows={2}\n fullWidth\n variant=\"outlined\"\n value={comments.responseComments[response.id] || ''}\n onChange={e =>\n setComments(prevComments => ({\n responseComments: {\n ...prevComments.responseComments,\n [response.id]: e.target.value,\n },\n additionalComments: prevComments.additionalComments,\n }))\n }\n />\n </Collapse>\n </Grid>\n ))}\n </FormGroup>\n </FormControl>\n <FormControl fullWidth>\n <FormLabel component=\"legend\" className={classes.formLabel}>\n Additional comments\n </FormLabel>\n <TextField\n data-testid=\"feedback-response-dialog-comments-input\"\n disabled={saving}\n multiline\n minRows={2}\n onChange={e =>\n setComments(prevComments => ({\n responseComments: {\n ...prevComments.responseComments,\n },\n additionalComments: e.target.value,\n }))\n }\n variant=\"outlined\"\n value={comments.additionalComments || ''}\n />\n </FormControl>\n <Typography className={classes.contactConsent}>\n May we contact you about your feedback?\n <Grid component=\"label\" container alignItems=\"center\" spacing={1}>\n <Grid item>No</Grid>\n <Grid item>\n <Switch\n checked={consent}\n disabled={saving}\n onChange={e => setConsent(e.target.checked)}\n />\n </Grid>\n <Grid item>Yes</Grid>\n </Grid>\n </Typography>\n </DialogContent>\n <DialogActions className={classes.dialogActions}>\n <Button\n color=\"primary\"\n data-testid=\"feedback-response-dialog-submit-button\"\n disabled={saving}\n onClick={saveResponse}\n >\n Submit\n </Button>\n <Button color=\"primary\" disabled={saving} onClick={onClose}>\n Close\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAM,wBAAqD,GAAA;AAAA,EACzD,EAAE,EAAA,EAAI,WAAa,EAAA,KAAA,EAAO,gBAAiB,EAAA;AAAA,EAC3C,EAAE,EAAA,EAAI,SAAW,E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,CAAQ,aAChC,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,KAAM,EAAA,SAAA;AAAA,UACN,aAAY,EAAA,wCAAA;AAAA,UACZ,QAAU,EAAA,MAAA;AAAA,UACV,OAAS,EAAA,YAAA;AAAA,UACV,QAAA,EAAA;AAAA;AAAA,OAED;AAAA,sBACA,GAAA,CAAC,UAAO,KAAM,EAAA,SAAA,EAAU,UAAU,MAAQ,EAAA,OAAA,EAAS,SAAS,QAE5D,EAAA,OAAA,EAAA;AAAA,KACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,3 +1,4 @@
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
1
2
  import { ErrorPanel, Table } from '@backstage/core-components';
2
3
  import { useApi } from '@backstage/core-plugin-api';
3
4
  import { EntityRefLink } from '@backstage/plugin-catalog-react';
@@ -5,7 +6,6 @@ import Chip from '@material-ui/core/Chip';
5
6
  import { makeStyles } from '@material-ui/core/styles';
6
7
  import CheckIcon from '@material-ui/icons/Check';
7
8
  import Typography from '@material-ui/core/Typography';
8
- import React from 'react';
9
9
  import useAsync from 'react-use/esm/useAsync';
10
10
  import '@backstage/errors';
11
11
  import { entityFeedbackApiRef } from '../../api/EntityFeedbackApi.esm.js';
@@ -41,19 +41,19 @@ const FeedbackResponseTable = (props) => {
41
41
  title: "User",
42
42
  field: "userRef",
43
43
  width: "15%",
44
- render: (response) => /* @__PURE__ */ React.createElement(EntityRefLink, { entityRef: response.userRef, defaultKind: "user" })
44
+ render: (response) => /* @__PURE__ */ jsx(EntityRefLink, { entityRef: response.userRef, defaultKind: "user" })
45
45
  },
46
46
  {
47
47
  title: "OK to contact?",
48
48
  field: "consent",
49
49
  width: "10%",
50
- render: (response) => response.consent ? /* @__PURE__ */ React.createElement(CheckIcon, { className: classes.consentCheck }) : ""
50
+ render: (response) => response.consent ? /* @__PURE__ */ jsx(CheckIcon, { className: classes.consentCheck }) : ""
51
51
  },
52
52
  {
53
53
  title: "Responses",
54
54
  field: "response",
55
55
  width: "35%",
56
- render: (response) => /* @__PURE__ */ React.createElement(React.Fragment, null, (response.response || "").split(",").map((v) => v.trim()).filter(Boolean).map((res) => /* @__PURE__ */ React.createElement(Chip, { key: res, size: "small", label: res })))
56
+ render: (response) => /* @__PURE__ */ jsx(Fragment, { children: (response.response || "").split(",").map((v) => v.trim()).filter(Boolean).map((res) => /* @__PURE__ */ jsx(Chip, { size: "small", label: res }, res)) })
57
57
  },
58
58
  {
59
59
  title: "Comments",
@@ -66,14 +66,28 @@ const FeedbackResponseTable = (props) => {
66
66
  } catch (e) {
67
67
  parsedComment = response.comments;
68
68
  }
69
- return /* @__PURE__ */ React.createElement("div", null, typeof parsedComment === "object" ? /* @__PURE__ */ React.createElement("ul", { className: classes.list }, Object.entries(parsedComment.responseComments)?.map(
70
- ([key, value]) => /* @__PURE__ */ React.createElement("li", { key, className: classes.listItem }, /* @__PURE__ */ React.createElement("strong", null, key, ":"), " ", value)
71
- ), parsedComment.additionalComments && /* @__PURE__ */ React.createElement("li", { className: classes.listItem }, /* @__PURE__ */ React.createElement("strong", null, "additional:"), " ", parsedComment.additionalComments)) : /* @__PURE__ */ React.createElement(Typography, null, parsedComment));
69
+ return /* @__PURE__ */ jsx("div", { children: typeof parsedComment === "object" ? /* @__PURE__ */ jsxs("ul", { className: classes.list, children: [
70
+ Object.entries(parsedComment.responseComments)?.map(
71
+ ([key, value]) => /* @__PURE__ */ jsxs("li", { className: classes.listItem, children: [
72
+ /* @__PURE__ */ jsxs("strong", { children: [
73
+ key,
74
+ ":"
75
+ ] }),
76
+ " ",
77
+ value
78
+ ] }, key)
79
+ ),
80
+ parsedComment.additionalComments && /* @__PURE__ */ jsxs("li", { className: classes.listItem, children: [
81
+ /* @__PURE__ */ jsx("strong", { children: "additional:" }),
82
+ " ",
83
+ parsedComment.additionalComments
84
+ ] })
85
+ ] }) : /* @__PURE__ */ jsx(Typography, { children: parsedComment }) });
72
86
  }
73
87
  }
74
88
  ];
75
89
  if (error) {
76
- return /* @__PURE__ */ React.createElement(
90
+ return /* @__PURE__ */ jsx(
77
91
  ErrorPanel,
78
92
  {
79
93
  defaultExpanded: true,
@@ -82,7 +96,7 @@ const FeedbackResponseTable = (props) => {
82
96
  }
83
97
  );
84
98
  }
85
- return /* @__PURE__ */ React.createElement(
99
+ return /* @__PURE__ */ jsx(
86
100
  Table,
87
101
  {
88
102
  columns,
@@ -1 +1 @@
1
- {"version":3,"file":"FeedbackResponseTable.esm.js","sources":["../../../src/components/FeedbackResponseTable/FeedbackResponseTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErrorPanel, Table } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { FeedbackResponse } from '@backstage-community/plugin-entity-feedback-common';\nimport Chip from '@material-ui/core/Chip';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CheckIcon from '@material-ui/icons/Check';\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { entityFeedbackApiRef } from '../../api';\nimport { Comments } from '../FeedbackResponseDialog';\n\ntype ResponseRow = Omit<FeedbackResponse, 'entityRef'>;\n\nconst useStyles = makeStyles(theme => ({\n consentCheck: {\n color: theme.palette.status.ok,\n },\n listItem: {\n padding: '0',\n marginTop: theme.spacing(1),\n },\n list: {\n paddingLeft: '0',\n },\n}));\n\n/**\n * @public\n */\nexport interface FeedbackResponseTableProps {\n entityRef: string;\n title?: string;\n}\n\nexport const FeedbackResponseTable = (props: FeedbackResponseTableProps) => {\n const { entityRef, title = 'Entity Responses' } = props;\n const classes = useStyles();\n const feedbackApi = useApi(entityFeedbackApiRef);\n\n const {\n error,\n loading,\n value: responses,\n } = useAsync(async () => {\n if (!entityRef) {\n return [];\n }\n\n return feedbackApi.getResponses(entityRef);\n }, [entityRef, feedbackApi]);\n\n const columns = [\n {\n title: 'User',\n field: 'userRef',\n width: '15%',\n render: (response: ResponseRow) => (\n <EntityRefLink entityRef={response.userRef} defaultKind=\"user\" />\n ),\n },\n {\n title: 'OK to contact?',\n field: 'consent',\n width: '10%',\n render: (response: ResponseRow) =>\n response.consent ? <CheckIcon className={classes.consentCheck} /> : '',\n },\n {\n title: 'Responses',\n field: 'response',\n width: '35%',\n render: (response: ResponseRow) => (\n <>\n {(response.response || '')\n .split(',')\n .map((v: string) => v.trim()) // removes whitespace\n .filter(Boolean) // removes accidental empty entries\n .map((res: string) => (\n <Chip key={res} size=\"small\" label={res} />\n ))}\n </>\n ),\n },\n {\n title: 'Comments',\n field: 'comments',\n width: '40%',\n render: (response: ResponseRow) => {\n // Check if comment is a stringified object\n let parsedComment;\n try {\n parsedComment =\n response?.comments && (JSON.parse(response.comments) as Comments);\n } catch (e) {\n // If parsing fails, assume it's a regular string\n parsedComment = response.comments;\n }\n return (\n <div>\n {typeof parsedComment === 'object' ? (\n <ul className={classes.list}>\n {Object.entries<string>(parsedComment.responseComments)?.map(\n ([key, value]) => (\n <li key={key} className={classes.listItem}>\n <strong>{key}:</strong> {value}\n </li>\n ),\n )}\n {parsedComment.additionalComments && (\n <li className={classes.listItem}>\n <strong>additional:</strong>{' '}\n {parsedComment.additionalComments}\n </li>\n )}\n </ul>\n ) : (\n <Typography>{parsedComment}</Typography>\n )}\n </div>\n );\n },\n },\n ];\n\n if (error) {\n return (\n <ErrorPanel\n defaultExpanded\n title=\"Failed to load feedback responses\"\n error={error}\n />\n );\n }\n\n return (\n <Table<ResponseRow>\n columns={columns}\n data={(responses ?? []) as ResponseRow[]}\n isLoading={loading}\n options={{\n emptyRowsWhenPaging: false,\n loadingType: 'linear',\n pageSize: 20,\n pageSizeOptions: [20, 50, 100],\n paging: true,\n showEmptyDataSourceMessage: !loading,\n }}\n title={title}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,YAAc,EAAA;AAAA,IACZ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,GAC9B;AAAA,EACA,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,GAAA;AAAA,IACT,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GAC5B;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,WAAa,EAAA;AAAA;AAEjB,CAAE,CAAA,CAAA;AAUW,MAAA,qBAAA,GAAwB,CAAC,KAAsC,KAAA;AAC1E,EAAA,MAAM,EAAE,SAAA,EAAW,KAAQ,GAAA,kBAAA,EAAuB,GAAA,KAAA;AAClD,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,WAAA,GAAc,OAAO,oBAAoB,CAAA;AAE/C,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAO,EAAA;AAAA,GACT,GAAI,SAAS,YAAY;AACvB,IAAA,IAAI,CAAC,SAAW,EAAA;AACd,MAAA,OAAO,EAAC;AAAA;AAGV,IAAO,OAAA,WAAA,CAAY,aAAa,SAAS,CAAA;AAAA,GACxC,EAAA,CAAC,SAAW,EAAA,WAAW,CAAC,CAAA;AAE3B,EAAA,MAAM,OAAU,GAAA;AAAA,IACd;AAAA,MACE,KAAO,EAAA,MAAA;AAAA,MACP,KAAO,EAAA,SAAA;AAAA,MACP,KAAO,EAAA,KAAA;AAAA,MACP,MAAA,EAAQ,CAAC,QACP,q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EAAI,GAAG,CAAA;AAAA,QAC7B,MAAQ,EAAA,IAAA;AAAA,QACR,4BAA4B,CAAC;AAAA,OAC/B;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"FeedbackResponseTable.esm.js","sources":["../../../src/components/FeedbackResponseTable/FeedbackResponseTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErrorPanel, Table } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { FeedbackResponse } from '@backstage-community/plugin-entity-feedback-common';\nimport Chip from '@material-ui/core/Chip';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CheckIcon from '@material-ui/icons/Check';\nimport Typography from '@material-ui/core/Typography';\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { entityFeedbackApiRef } from '../../api';\nimport { Comments } from '../FeedbackResponseDialog';\n\ntype ResponseRow = Omit<FeedbackResponse, 'entityRef'>;\n\nconst useStyles = makeStyles(theme => ({\n consentCheck: {\n color: theme.palette.status.ok,\n },\n listItem: {\n padding: '0',\n marginTop: theme.spacing(1),\n },\n list: {\n paddingLeft: '0',\n },\n}));\n\n/**\n * @public\n */\nexport interface FeedbackResponseTableProps {\n entityRef: string;\n title?: string;\n}\n\nexport const FeedbackResponseTable = (props: FeedbackResponseTableProps) => {\n const { entityRef, title = 'Entity Responses' } = props;\n const classes = useStyles();\n const feedbackApi = useApi(entityFeedbackApiRef);\n\n const {\n error,\n loading,\n value: responses,\n } = useAsync(async () => {\n if (!entityRef) {\n return [];\n }\n\n return feedbackApi.getResponses(entityRef);\n }, [entityRef, feedbackApi]);\n\n const columns = [\n {\n title: 'User',\n field: 'userRef',\n width: '15%',\n render: (response: ResponseRow) => (\n <EntityRefLink entityRef={response.userRef} defaultKind=\"user\" />\n ),\n },\n {\n title: 'OK to contact?',\n field: 'consent',\n width: '10%',\n render: (response: ResponseRow) =>\n response.consent ? <CheckIcon className={classes.consentCheck} /> : '',\n },\n {\n title: 'Responses',\n field: 'response',\n width: '35%',\n render: (response: ResponseRow) => (\n <>\n {(response.response || '')\n .split(',')\n .map((v: string) => v.trim()) // removes whitespace\n .filter(Boolean) // removes accidental empty entries\n .map((res: string) => (\n <Chip key={res} size=\"small\" label={res} />\n ))}\n </>\n ),\n },\n {\n title: 'Comments',\n field: 'comments',\n width: '40%',\n render: (response: ResponseRow) => {\n // Check if comment is a stringified object\n let parsedComment;\n try {\n parsedComment =\n response?.comments && (JSON.parse(response.comments) as Comments);\n } catch (e) {\n // If parsing fails, assume it's a regular string\n parsedComment = response.comments;\n }\n return (\n <div>\n {typeof parsedComment === 'object' ? (\n <ul className={classes.list}>\n {Object.entries<string>(parsedComment.responseComments)?.map(\n ([key, value]) => (\n <li key={key} className={classes.listItem}>\n <strong>{key}:</strong> {value}\n </li>\n ),\n )}\n {parsedComment.additionalComments && (\n <li className={classes.listItem}>\n <strong>additional:</strong>{' '}\n {parsedComment.additionalComments}\n </li>\n )}\n </ul>\n ) : (\n <Typography>{parsedComment}</Typography>\n )}\n </div>\n );\n },\n },\n ];\n\n if (error) {\n return (\n <ErrorPanel\n defaultExpanded\n title=\"Failed to load feedback responses\"\n error={error}\n />\n );\n }\n\n return (\n <Table<ResponseRow>\n columns={columns}\n data={(responses ?? []) as ResponseRow[]}\n isLoading={loading}\n options={{\n emptyRowsWhenPaging: false,\n loadingType: 'linear',\n pageSize: 20,\n pageSizeOptions: [20, 50, 100],\n paging: true,\n showEmptyDataSourceMessage: !loading,\n }}\n title={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MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,3 +1,4 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
1
2
  import { stringifyEntityRef } from '@backstage/catalog-model';
2
3
  import { Progress } from '@backstage/core-components';
3
4
  import { useApi, errorApiRef, identityApiRef } from '@backstage/core-plugin-api';
@@ -8,7 +9,7 @@ import ThumbDownIcon from '@material-ui/icons/ThumbDown';
8
9
  import ThumbUpIcon from '@material-ui/icons/ThumbUp';
9
10
  import ThumbDownOutlinedIcon from '@material-ui/icons/ThumbDownOutlined';
10
11
  import ThumbUpOutlinedIcon from '@material-ui/icons/ThumbUpOutlined';
11
- import React, { useState, useCallback } from 'react';
12
+ import { useState, useCallback } from 'react';
12
13
  import useAsync from 'react-use/esm/useAsync';
13
14
  import useAsyncFn from 'react-use/esm/useAsyncFn';
14
15
  import '@backstage/errors';
@@ -76,32 +77,36 @@ const LikeDislikeButtons = (props) => {
76
77
  [rating, requestResponse, saveFeedback, setOpenFeedbackDialog]
77
78
  );
78
79
  if (loadingEntity || loadingFeedback || savingFeedback) {
79
- return /* @__PURE__ */ React.createElement(Progress, null);
80
+ return /* @__PURE__ */ jsx(Progress, {});
80
81
  }
81
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
82
- IconButton,
83
- {
84
- "data-testid": "entity-feedback-like-button",
85
- onClick: () => applyRating("LIKE" /* like */)
86
- },
87
- rating === "LIKE" /* like */ ? /* @__PURE__ */ React.createElement(Tooltip, { title: "Liked" }, /* @__PURE__ */ React.createElement(ThumbUpIcon, { fontSize: "small" })) : /* @__PURE__ */ React.createElement(Tooltip, { title: "Like" }, /* @__PURE__ */ React.createElement(ThumbUpOutlinedIcon, { fontSize: "small" }))
88
- ), /* @__PURE__ */ React.createElement(
89
- IconButton,
90
- {
91
- "data-testid": "entity-feedback-dislike-button",
92
- onClick: () => applyRating("DISLIKE" /* dislike */)
93
- },
94
- rating === "DISLIKE" /* dislike */ ? /* @__PURE__ */ React.createElement(Tooltip, { title: "Disliked" }, /* @__PURE__ */ React.createElement(ThumbDownIcon, { fontSize: "small" })) : /* @__PURE__ */ React.createElement(Tooltip, { title: "Dislike" }, /* @__PURE__ */ React.createElement(ThumbDownOutlinedIcon, { fontSize: "small" }))
95
- ), /* @__PURE__ */ React.createElement(
96
- FeedbackResponseDialog,
97
- {
98
- entity,
99
- open: openFeedbackDialog,
100
- onClose: () => setOpenFeedbackDialog(false),
101
- feedbackDialogResponses,
102
- feedbackDialogTitle
103
- }
104
- ));
82
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
83
+ /* @__PURE__ */ jsx(
84
+ IconButton,
85
+ {
86
+ "data-testid": "entity-feedback-like-button",
87
+ onClick: () => applyRating("LIKE" /* like */),
88
+ children: rating === "LIKE" /* like */ ? /* @__PURE__ */ jsx(Tooltip, { title: "Liked", children: /* @__PURE__ */ jsx(ThumbUpIcon, { fontSize: "small" }) }) : /* @__PURE__ */ jsx(Tooltip, { title: "Like", children: /* @__PURE__ */ jsx(ThumbUpOutlinedIcon, { fontSize: "small" }) })
89
+ }
90
+ ),
91
+ /* @__PURE__ */ jsx(
92
+ IconButton,
93
+ {
94
+ "data-testid": "entity-feedback-dislike-button",
95
+ onClick: () => applyRating("DISLIKE" /* dislike */),
96
+ children: rating === "DISLIKE" /* dislike */ ? /* @__PURE__ */ jsx(Tooltip, { title: "Disliked", children: /* @__PURE__ */ jsx(ThumbDownIcon, { fontSize: "small" }) }) : /* @__PURE__ */ jsx(Tooltip, { title: "Dislike", children: /* @__PURE__ */ jsx(ThumbDownOutlinedIcon, { fontSize: "small" }) })
97
+ }
98
+ ),
99
+ /* @__PURE__ */ jsx(
100
+ FeedbackResponseDialog,
101
+ {
102
+ entity,
103
+ open: openFeedbackDialog,
104
+ onClose: () => setOpenFeedbackDialog(false),
105
+ feedbackDialogResponses,
106
+ feedbackDialogTitle
107
+ }
108
+ )
109
+ ] });
105
110
  };
106
111
 
107
112
  export { FeedbackRatings, LikeDislikeButtons };
@@ -1 +1 @@
1
- {"version":3,"file":"LikeDislikeButtons.esm.js","sources":["../../../src/components/LikeDislikeButtons/LikeDislikeButtons.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { Progress } from '@backstage/core-components';\nimport {\n ErrorApiError,\n errorApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsyncEntity } from '@backstage/plugin-catalog-react';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport ThumbDownIcon from '@material-ui/icons/ThumbDown';\nimport ThumbUpIcon from '@material-ui/icons/ThumbUp';\nimport ThumbDownOutlinedIcon from '@material-ui/icons/ThumbDownOutlined';\nimport ThumbUpOutlinedIcon from '@material-ui/icons/ThumbUpOutlined';\nimport React, { ReactNode, useCallback, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\n\nimport { entityFeedbackApiRef } from '../../api';\nimport {\n EntityFeedbackResponse,\n FeedbackResponseDialog,\n} from '../FeedbackResponseDialog';\n\nexport enum FeedbackRatings {\n like = 'LIKE',\n dislike = 'DISLIKE',\n neutral = 'NEUTRAL',\n}\n\n/**\n * @public\n */\nexport interface LikeDislikeButtonsProps {\n feedbackDialogResponses?: EntityFeedbackResponse[];\n feedbackDialogTitle?: ReactNode;\n requestResponse?: boolean;\n}\n\nexport const LikeDislikeButtons = (props: LikeDislikeButtonsProps) => {\n const {\n feedbackDialogResponses,\n feedbackDialogTitle,\n requestResponse = true,\n } = props;\n const errorApi = useApi(errorApiRef);\n const feedbackApi = useApi(entityFeedbackApiRef);\n const identityApi = useApi(identityApiRef);\n const [rating, setRating] = useState<FeedbackRatings>(\n FeedbackRatings.neutral,\n );\n const [openFeedbackDialog, setOpenFeedbackDialog] = useState(false);\n const { entity, loading: loadingEntity } = useAsyncEntity();\n\n const { loading: loadingFeedback } = useAsync(async () => {\n // Wait until entity is loaded\n if (!entity) {\n return;\n }\n\n try {\n const identity = await identityApi.getBackstageIdentity();\n const prevFeedback = await feedbackApi.getRatings(\n stringifyEntityRef(entity),\n );\n setRating(\n (prevFeedback.find(r => r.userRef === identity.userEntityRef)?.rating ??\n rating) as FeedbackRatings,\n );\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n }, [entity, feedbackApi, setRating]);\n\n const [{ loading: savingFeedback }, saveFeedback] = useAsyncFn(\n async (feedback: FeedbackRatings) => {\n try {\n await feedbackApi.recordRating(stringifyEntityRef(entity!), feedback);\n setRating(feedback);\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n },\n [entity, feedbackApi, setRating],\n );\n\n const applyRating = useCallback(\n (feedback: FeedbackRatings) => {\n // Clear rating if feedback is same as current\n if (feedback === rating) {\n saveFeedback(FeedbackRatings.neutral);\n return;\n }\n\n saveFeedback(feedback);\n if (feedback === FeedbackRatings.dislike && requestResponse) {\n setOpenFeedbackDialog(true);\n }\n },\n [rating, requestResponse, saveFeedback, setOpenFeedbackDialog],\n );\n\n if (loadingEntity || loadingFeedback || savingFeedback) {\n return <Progress />;\n }\n\n return (\n <>\n <IconButton\n data-testid=\"entity-feedback-like-button\"\n onClick={() => applyRating(FeedbackRatings.like)}\n >\n {rating === FeedbackRatings.like ? (\n <Tooltip title=\"Liked\">\n <ThumbUpIcon fontSize=\"small\" />\n </Tooltip>\n ) : (\n <Tooltip title=\"Like\">\n <ThumbUpOutlinedIcon fontSize=\"small\" />\n </Tooltip>\n )}\n </IconButton>\n <IconButton\n data-testid=\"entity-feedback-dislike-button\"\n onClick={() => applyRating(FeedbackRatings.dislike)}\n >\n {rating === FeedbackRatings.dislike ? (\n <Tooltip title=\"Disliked\">\n <ThumbDownIcon fontSize=\"small\" />\n </Tooltip>\n ) : (\n <Tooltip title=\"Dislike\">\n <ThumbDownOutlinedIcon fontSize=\"small\" />\n </Tooltip>\n )}\n </IconButton>\n <FeedbackResponseDialog\n entity={entity!}\n open={openFeedbackDialog}\n onClose={() => setOpenFeedbackDialog(false)}\n feedbackDialogResponses={feedbackDialogResponses}\n feedbackDialogTitle={feedbackDialogTitle}\n />\n </>\n );\n};\n"],"names":["FeedbackRatings"],"mappings":";;;;;;;;;;;;;;;;;AAyCY,IAAA,eAAA,qBAAAA,gBAAL,KAAA;AACL,EAAAA,iBAAA,MAAO,CAAA,GAAA,MAAA;AACP,EAAAA,iBAAA,SAAU,CAAA,GAAA,SAAA;AACV,EAAAA,iBAAA,SAAU,CAAA,GAAA,SAAA;AAHA,EAAAA,OAAAA,gBAAAA;AAAA,CAAA,EAAA,eAAA,IAAA,EAAA;AAeC,MAAA,kBAAA,GAAqB,CAAC,KAAmC,KAAA;AACpE,EAAM,MAAA;AAAA,IACJ,uBAAA;AAAA,IACA,mBAAA;AAAA,IACA,eAAkB,GAAA;AAAA,GAChB,GAAA,KAAA;AACJ,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,WAAA,GAAc,OAAO,oBAAoB,CAAA;AAC/C,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAM,MAAA,CAAC,MAAQ,EAAA,SAAS,CAAI,GAAA,QAAA;AAAA,IAC1B,SAAA;AAAA,GACF;AACA,EAAA,MAAM,CAAC,kBAAA,EAAoB,qBAAqB,CAAA,GAAI,SAAS,KAAK,CAAA;AAClE,EAAA,MAAM,EAAE,MAAA,EAAQ,OAAS,EAAA,aAAA,KAAkB,cAAe,EAAA;AAE1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,MACC,MAAA;AAAA,MACA,IAAM,EAAA,kBAAA;AAAA,MACN,OAAA,EAAS,MAAM,qBAAA,CAAsB,KAAK,CAAA;AAAA,MAC1C,uBAAA;AAAA,MACA;AAAA;AAAA,GAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"LikeDislikeButtons.esm.js","sources":["../../../src/components/LikeDislikeButtons/LikeDislikeButtons.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { Progress } from '@backstage/core-components';\nimport {\n ErrorApiError,\n errorApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsyncEntity } from '@backstage/plugin-catalog-react';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport ThumbDownIcon from '@material-ui/icons/ThumbDown';\nimport ThumbUpIcon from '@material-ui/icons/ThumbUp';\nimport ThumbDownOutlinedIcon from '@material-ui/icons/ThumbDownOutlined';\nimport ThumbUpOutlinedIcon from '@material-ui/icons/ThumbUpOutlined';\nimport { ReactNode, useCallback, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\n\nimport { entityFeedbackApiRef } from '../../api';\nimport {\n EntityFeedbackResponse,\n FeedbackResponseDialog,\n} from '../FeedbackResponseDialog';\n\nexport enum FeedbackRatings {\n like = 'LIKE',\n dislike = 'DISLIKE',\n neutral = 'NEUTRAL',\n}\n\n/**\n * @public\n */\nexport interface LikeDislikeButtonsProps {\n feedbackDialogResponses?: EntityFeedbackResponse[];\n feedbackDialogTitle?: ReactNode;\n requestResponse?: boolean;\n}\n\nexport const LikeDislikeButtons = (props: LikeDislikeButtonsProps) => {\n const {\n feedbackDialogResponses,\n feedbackDialogTitle,\n requestResponse = true,\n } = props;\n const errorApi = useApi(errorApiRef);\n const feedbackApi = useApi(entityFeedbackApiRef);\n const identityApi = useApi(identityApiRef);\n const [rating, setRating] = useState<FeedbackRatings>(\n FeedbackRatings.neutral,\n );\n const [openFeedbackDialog, setOpenFeedbackDialog] = useState(false);\n const { entity, loading: loadingEntity } = useAsyncEntity();\n\n const { loading: loadingFeedback } = useAsync(async () => {\n // Wait until entity is loaded\n if (!entity) {\n return;\n }\n\n try {\n const identity = await identityApi.getBackstageIdentity();\n const prevFeedback = await feedbackApi.getRatings(\n stringifyEntityRef(entity),\n );\n setRating(\n (prevFeedback.find(r => r.userRef === identity.userEntityRef)?.rating ??\n rating) as FeedbackRatings,\n );\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n }, [entity, feedbackApi, setRating]);\n\n const [{ loading: savingFeedback }, saveFeedback] = useAsyncFn(\n async (feedback: FeedbackRatings) => {\n try {\n await feedbackApi.recordRating(stringifyEntityRef(entity!), feedback);\n setRating(feedback);\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n },\n [entity, feedbackApi, setRating],\n );\n\n const applyRating = useCallback(\n (feedback: FeedbackRatings) => {\n // Clear rating if feedback is same as current\n if (feedback === rating) {\n saveFeedback(FeedbackRatings.neutral);\n return;\n }\n\n saveFeedback(feedback);\n if (feedback === FeedbackRatings.dislike && requestResponse) {\n setOpenFeedbackDialog(true);\n }\n },\n [rating, requestResponse, saveFeedback, setOpenFeedbackDialog],\n );\n\n if (loadingEntity || loadingFeedback || savingFeedback) {\n return <Progress />;\n }\n\n return (\n <>\n <IconButton\n data-testid=\"entity-feedback-like-button\"\n onClick={() => applyRating(FeedbackRatings.like)}\n >\n {rating === FeedbackRatings.like ? (\n <Tooltip title=\"Liked\">\n <ThumbUpIcon fontSize=\"small\" />\n </Tooltip>\n ) : (\n <Tooltip title=\"Like\">\n <ThumbUpOutlinedIcon fontSize=\"small\" />\n </Tooltip>\n )}\n </IconButton>\n <IconButton\n data-testid=\"entity-feedback-dislike-button\"\n onClick={() => applyRating(FeedbackRatings.dislike)}\n >\n {rating === FeedbackRatings.dislike ? (\n <Tooltip title=\"Disliked\">\n <ThumbDownIcon fontSize=\"small\" />\n </Tooltip>\n ) : (\n <Tooltip title=\"Dislike\">\n <ThumbDownOutlinedIcon fontSize=\"small\" />\n </Tooltip>\n )}\n </IconButton>\n <FeedbackResponseDialog\n entity={entity!}\n open={openFeedbackDialog}\n onClose={() => setOpenFeedbackDialog(false)}\n feedbackDialogResponses={feedbackDialogResponses}\n feedbackDialogTitle={feedbackDialogTitle}\n />\n </>\n );\n};\n"],"names":["FeedbackRatings"],"mappings":";;;;;;;;;;;;;;;;;;AAyCY,IAAA,eAAA,qBAAAA,gBAAL,KAAA;AACL,EAAAA,iBAAA,MAAO,CAAA,GAAA,MAAA;AACP,EAAAA,iBAAA,SAAU,CAAA,GAAA,SAAA;AACV,EAAAA,iBAAA,SAAU,CAAA,GAAA,SAAA;AAHA,EAAAA,OAAAA,gBAAAA;AAAA,CAAA,EAAA,eAAA,IAAA,EAAA;AAeC,MAAA,kBAAA,GAAqB,CAAC,KAAmC,KAAA;AACpE,EAAM,MAAA;AAAA,IACJ,uBAAA;AAAA,IACA,mBAAA;AAAA,IACA,eAAkB,GAAA;AAAA,GAChB,GAAA,KAAA;AACJ,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,WAAA,GAAc,OAAO,oBAAoB,CAAA;AAC/C,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAM,MAAA,CAAC,MAAQ,EAAA,SAAS,CAAI,GAAA,QAAA;AAAA,IAC1B,SAAA;AAAA,GACF;AACA,EAAA,MAAM,CA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AA;AAAA;AAAA,KAEJ;AAAA,oBACA,GAAA;AAAA,MAAC,sBAAA;AAAA,MAAA;AAAA,QACC,MAAA;AAAA,QACA,IAAM,EAAA,kBAAA;AAAA,QACN,OAAA,EAAS,MAAM,qBAAA,CAAsB,KAAK,CAAA;AAAA,QAC1C,uBAAA;AAAA,QACA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,10 +1,10 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { FeedbackRatingsTable } from '../FeedbackRatingsTable/FeedbackRatingsTable.esm.js';
3
3
  import { FeedbackRatings } from '../LikeDislikeButtons/LikeDislikeButtons.esm.js';
4
4
 
5
5
  const LikeDislikeRatingsTable = (props) => {
6
6
  const { allEntities, ownerRef, title } = props;
7
- return /* @__PURE__ */ React.createElement(
7
+ return /* @__PURE__ */ jsx(
8
8
  FeedbackRatingsTable,
9
9
  {
10
10
  allEntities,
@@ -1 +1 @@
1
- {"version":3,"file":"LikeDislikeRatingsTable.esm.js","sources":["../../../src/components/LikeDislikeRatingsTable/LikeDislikeRatingsTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nimport { FeedbackRatingsTable } from '../FeedbackRatingsTable';\nimport { FeedbackRatings } from '../LikeDislikeButtons';\n\n/**\n * @public\n */\nexport interface LikeDislikeRatingsTableProps {\n allEntities?: boolean;\n ownerRef?: string;\n title?: string;\n}\n\nexport const LikeDislikeRatingsTable = (\n props: LikeDislikeRatingsTableProps,\n) => {\n const { allEntities, ownerRef, title } = props;\n\n return (\n <FeedbackRatingsTable\n allEntities={allEntities}\n ownerRef={ownerRef}\n ratingValues={Object.values(FeedbackRatings).filter(\n r => r !== FeedbackRatings.neutral,\n )}\n title={title}\n />\n );\n};\n"],"names":[],"mappings":";;;;AA8Ba,MAAA,uBAAA,GAA0B,CACrC,KACG,KAAA;AACH,EAAA,MAAM,EAAE,WAAA,EAAa,QAAU,EAAA,KAAA,EAAU,GAAA,KAAA;AAEzC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,WAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAc,EAAA,MAAA,CAAO,MAAO,CAAA,eAAe,CAAE,CAAA,MAAA;AAAA,QAC3C,CAAA,CAAA,KAAK,MAAM,eAAgB,CAAA;AAAA,OAC7B;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"LikeDislikeRatingsTable.esm.js","sources":["../../../src/components/LikeDislikeRatingsTable/LikeDislikeRatingsTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FeedbackRatingsTable } from '../FeedbackRatingsTable';\nimport { FeedbackRatings } from '../LikeDislikeButtons';\n\n/**\n * @public\n */\nexport interface LikeDislikeRatingsTableProps {\n allEntities?: boolean;\n ownerRef?: string;\n title?: string;\n}\n\nexport const LikeDislikeRatingsTable = (\n props: LikeDislikeRatingsTableProps,\n) => {\n const { allEntities, ownerRef, title } = props;\n\n return (\n <FeedbackRatingsTable\n allEntities={allEntities}\n ownerRef={ownerRef}\n ratingValues={Object.values(FeedbackRatings).filter(\n r => r !== FeedbackRatings.neutral,\n )}\n title={title}\n />\n );\n};\n"],"names":[],"mappings":";;;;AA4Ba,MAAA,uBAAA,GAA0B,CACrC,KACG,KAAA;AACH,EAAA,MAAM,EAAE,WAAA,EAAa,QAAU,EAAA,KAAA,EAAU,GAAA,KAAA;AAEzC,EACE,uBAAA,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,WAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAc,EAAA,MAAA,CAAO,MAAO,CAAA,eAAe,CAAE,CAAA,MAAA;AAAA,QAC3C,CAAA,CAAA,KAAK,MAAM,eAAgB,CAAA;AAAA,OAC7B;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,3 +1,4 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
1
2
  import { stringifyEntityRef } from '@backstage/catalog-model';
2
3
  import { Progress } from '@backstage/core-components';
3
4
  import { useApi, errorApiRef, identityApiRef } from '@backstage/core-plugin-api';
@@ -5,7 +6,7 @@ import { useAsyncEntity } from '@backstage/plugin-catalog-react';
5
6
  import IconButton from '@material-ui/core/IconButton';
6
7
  import StarOutlineIcon from '@material-ui/icons/StarOutline';
7
8
  import StarIcon from '@material-ui/icons/Star';
8
- import React, { useState, useCallback } from 'react';
9
+ import { useState, useCallback } from 'react';
9
10
  import useAsync from 'react-use/esm/useAsync';
10
11
  import useAsyncFn from 'react-use/esm/useAsyncFn';
11
12
  import '@backstage/errors';
@@ -85,26 +86,29 @@ const StarredRatingButtons = (props) => {
85
86
  ]
86
87
  );
87
88
  if (loadingEntity || loadingFeedback || savingFeedback) {
88
- return /* @__PURE__ */ React.createElement(Progress, null);
89
+ return /* @__PURE__ */ jsx(Progress, {});
89
90
  }
90
- return /* @__PURE__ */ React.createElement(React.Fragment, null, Object.values(FeedbackRatings).filter((o) => typeof o === "number").map((starRating) => /* @__PURE__ */ React.createElement(
91
- IconButton,
92
- {
93
- key: starRating,
94
- "data-testid": `entity-feedback-star-button-${starRating}`,
95
- onClick: () => applyRating(starRating)
96
- },
97
- rating && rating >= starRating ? /* @__PURE__ */ React.createElement(StarIcon, { fontSize: "small" }) : /* @__PURE__ */ React.createElement(StarOutlineIcon, { fontSize: "small" })
98
- )), /* @__PURE__ */ React.createElement(
99
- FeedbackResponseDialog,
100
- {
101
- entity,
102
- open: openFeedbackDialog,
103
- onClose: () => setOpenFeedbackDialog(false),
104
- feedbackDialogResponses,
105
- feedbackDialogTitle
106
- }
107
- ));
91
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
92
+ Object.values(FeedbackRatings).filter((o) => typeof o === "number").map((starRating) => /* @__PURE__ */ jsx(
93
+ IconButton,
94
+ {
95
+ "data-testid": `entity-feedback-star-button-${starRating}`,
96
+ onClick: () => applyRating(starRating),
97
+ children: rating && rating >= starRating ? /* @__PURE__ */ jsx(StarIcon, { fontSize: "small" }) : /* @__PURE__ */ jsx(StarOutlineIcon, { fontSize: "small" })
98
+ },
99
+ starRating
100
+ )),
101
+ /* @__PURE__ */ jsx(
102
+ FeedbackResponseDialog,
103
+ {
104
+ entity,
105
+ open: openFeedbackDialog,
106
+ onClose: () => setOpenFeedbackDialog(false),
107
+ feedbackDialogResponses,
108
+ feedbackDialogTitle
109
+ }
110
+ )
111
+ ] });
108
112
  };
109
113
 
110
114
  export { FeedbackRatings, StarredRatingButtons };
@@ -1 +1 @@
1
- {"version":3,"file":"StarredRatingButtons.esm.js","sources":["../../../src/components/StarredRatingButtons/StarredRatingButtons.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { Progress } from '@backstage/core-components';\nimport {\n ErrorApiError,\n errorApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsyncEntity } from '@backstage/plugin-catalog-react';\nimport IconButton from '@material-ui/core/IconButton';\nimport StarOutlineIcon from '@material-ui/icons/StarOutline';\nimport StarIcon from '@material-ui/icons/Star';\nimport React, { ReactNode, useCallback, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\n\nimport { entityFeedbackApiRef } from '../../api';\nimport {\n EntityFeedbackResponse,\n FeedbackResponseDialog,\n} from '../FeedbackResponseDialog';\n\nexport enum FeedbackRatings {\n one = 1,\n two = 2,\n three = 3,\n four = 4,\n five = 5,\n}\n\n/**\n * @public\n */\nexport interface StarredRatingButtonsProps {\n feedbackDialogResponses?: EntityFeedbackResponse[];\n feedbackDialogTitle?: ReactNode;\n requestResponse?: boolean;\n requestResponseThreshold?: number;\n}\n\nexport const StarredRatingButtons = (props: StarredRatingButtonsProps) => {\n const {\n feedbackDialogResponses,\n feedbackDialogTitle,\n requestResponse = true,\n requestResponseThreshold = FeedbackRatings.two,\n } = props;\n const errorApi = useApi(errorApiRef);\n const feedbackApi = useApi(entityFeedbackApiRef);\n const identityApi = useApi(identityApiRef);\n const [rating, setRating] = useState<FeedbackRatings>();\n const [openFeedbackDialog, setOpenFeedbackDialog] = useState(false);\n const { entity, loading: loadingEntity } = useAsyncEntity();\n\n const { loading: loadingFeedback } = useAsync(async () => {\n // Wait until entity is loaded\n if (!entity) {\n return;\n }\n\n try {\n const identity = await identityApi.getBackstageIdentity();\n const prevFeedback = await feedbackApi.getRatings(\n stringifyEntityRef(entity),\n );\n\n const prevRating = prevFeedback.find(\n r => r.userRef === identity.userEntityRef,\n )?.rating;\n if (prevRating) {\n setRating(parseInt(prevRating, 10));\n }\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n }, [entity, feedbackApi, setRating]);\n\n const [{ loading: savingFeedback }, saveFeedback] = useAsyncFn(\n async (feedback: FeedbackRatings) => {\n try {\n await feedbackApi.recordRating(\n stringifyEntityRef(entity!),\n feedback.toString(),\n );\n setRating(feedback);\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n },\n [entity, feedbackApi, setRating],\n );\n\n const applyRating = useCallback(\n (feedback: FeedbackRatings) => {\n // Ignore rating if feedback is same as current\n if (feedback === rating) {\n return;\n }\n\n saveFeedback(feedback);\n if (feedback <= requestResponseThreshold && requestResponse) {\n setOpenFeedbackDialog(true);\n }\n },\n [\n rating,\n requestResponse,\n requestResponseThreshold,\n saveFeedback,\n setOpenFeedbackDialog,\n ],\n );\n\n if (loadingEntity || loadingFeedback || savingFeedback) {\n return <Progress />;\n }\n\n return (\n <>\n {Object.values(FeedbackRatings)\n .filter((o): o is number => typeof o === 'number')\n .map(starRating => (\n <IconButton\n key={starRating}\n data-testid={`entity-feedback-star-button-${starRating}`}\n onClick={() => applyRating(starRating as FeedbackRatings)}\n >\n {rating && rating >= starRating ? (\n <StarIcon fontSize=\"small\" />\n ) : (\n <StarOutlineIcon fontSize=\"small\" />\n )}\n </IconButton>\n ))}\n <FeedbackResponseDialog\n entity={entity!}\n open={openFeedbackDialog}\n onClose={() => setOpenFeedbackDialog(false)}\n feedbackDialogResponses={feedbackDialogResponses}\n feedbackDialogTitle={feedbackDialogTitle}\n />\n </>\n );\n};\n"],"names":["FeedbackRatings"],"mappings":";;;;;;;;;;;;;;AAsCY,IAAA,eAAA,qBAAAA,gBAAL,KAAA;AACL,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,SAAM,CAAN,CAAA,GAAA,KAAA;AACA,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,SAAM,CAAN,CAAA,GAAA,KAAA;AACA,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,WAAQ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e,CAC3B,CAAA,MAAA,CAAO,CAAC,CAAA,KAAmB,OAAO,CAAA,KAAM,QAAQ,CAAA,CAChD,IAAI,CACH,UAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,GAAK,EAAA,UAAA;AAAA,MACL,aAAA,EAAa,+BAA+B,UAAU,CAAA,CAAA;AAAA,MACtD,OAAA,EAAS,MAAM,WAAA,CAAY,UAA6B;AAAA,KAAA;AAAA,IAEvD,MAAA,IAAU,MAAU,IAAA,UAAA,mBAClB,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,QAAS,EAAA,OAAA,EAAQ,CAE3B,mBAAA,KAAA,CAAA,aAAA,CAAC,eAAgB,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA;AAAA,GAGvC,CACH,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,sBAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,IAAM,EAAA,kBAAA;AAAA,MACN,OAAA,EAAS,MAAM,qBAAA,CAAsB,KAAK,CAAA;AAAA,MAC1C,uBAAA;AAAA,MACA;AAAA;AAAA,GAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"StarredRatingButtons.esm.js","sources":["../../../src/components/StarredRatingButtons/StarredRatingButtons.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { Progress } from '@backstage/core-components';\nimport {\n ErrorApiError,\n errorApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsyncEntity } from '@backstage/plugin-catalog-react';\nimport IconButton from '@material-ui/core/IconButton';\nimport StarOutlineIcon from '@material-ui/icons/StarOutline';\nimport StarIcon from '@material-ui/icons/Star';\nimport { ReactNode, useCallback, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\n\nimport { entityFeedbackApiRef } from '../../api';\nimport {\n EntityFeedbackResponse,\n FeedbackResponseDialog,\n} from '../FeedbackResponseDialog';\n\nexport enum FeedbackRatings {\n one = 1,\n two = 2,\n three = 3,\n four = 4,\n five = 5,\n}\n\n/**\n * @public\n */\nexport interface StarredRatingButtonsProps {\n feedbackDialogResponses?: EntityFeedbackResponse[];\n feedbackDialogTitle?: ReactNode;\n requestResponse?: boolean;\n requestResponseThreshold?: number;\n}\n\nexport const StarredRatingButtons = (props: StarredRatingButtonsProps) => {\n const {\n feedbackDialogResponses,\n feedbackDialogTitle,\n requestResponse = true,\n requestResponseThreshold = FeedbackRatings.two,\n } = props;\n const errorApi = useApi(errorApiRef);\n const feedbackApi = useApi(entityFeedbackApiRef);\n const identityApi = useApi(identityApiRef);\n const [rating, setRating] = useState<FeedbackRatings>();\n const [openFeedbackDialog, setOpenFeedbackDialog] = useState(false);\n const { entity, loading: loadingEntity } = useAsyncEntity();\n\n const { loading: loadingFeedback } = useAsync(async () => {\n // Wait until entity is loaded\n if (!entity) {\n return;\n }\n\n try {\n const identity = await identityApi.getBackstageIdentity();\n const prevFeedback = await feedbackApi.getRatings(\n stringifyEntityRef(entity),\n );\n\n const prevRating = prevFeedback.find(\n r => r.userRef === identity.userEntityRef,\n )?.rating;\n if (prevRating) {\n setRating(parseInt(prevRating, 10));\n }\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n }, [entity, feedbackApi, setRating]);\n\n const [{ loading: savingFeedback }, saveFeedback] = useAsyncFn(\n async (feedback: FeedbackRatings) => {\n try {\n await feedbackApi.recordRating(\n stringifyEntityRef(entity!),\n feedback.toString(),\n );\n setRating(feedback);\n } catch (e) {\n errorApi.post(e as ErrorApiError);\n }\n },\n [entity, feedbackApi, setRating],\n );\n\n const applyRating = useCallback(\n (feedback: FeedbackRatings) => {\n // Ignore rating if feedback is same as current\n if (feedback === rating) {\n return;\n }\n\n saveFeedback(feedback);\n if (feedback <= requestResponseThreshold && requestResponse) {\n setOpenFeedbackDialog(true);\n }\n },\n [\n rating,\n requestResponse,\n requestResponseThreshold,\n saveFeedback,\n setOpenFeedbackDialog,\n ],\n );\n\n if (loadingEntity || loadingFeedback || savingFeedback) {\n return <Progress />;\n }\n\n return (\n <>\n {Object.values(FeedbackRatings)\n .filter((o): o is number => typeof o === 'number')\n .map(starRating => (\n <IconButton\n key={starRating}\n data-testid={`entity-feedback-star-button-${starRating}`}\n onClick={() => applyRating(starRating as FeedbackRatings)}\n >\n {rating && rating >= starRating ? (\n <StarIcon fontSize=\"small\" />\n ) : (\n <StarOutlineIcon fontSize=\"small\" />\n )}\n </IconButton>\n ))}\n <FeedbackResponseDialog\n entity={entity!}\n open={openFeedbackDialog}\n onClose={() => setOpenFeedbackDialog(false)}\n feedbackDialogResponses={feedbackDialogResponses}\n feedbackDialogTitle={feedbackDialogTitle}\n />\n </>\n );\n};\n"],"names":["FeedbackRatings"],"mappings":";;;;;;;;;;;;;;;AAsCY,IAAA,eAAA,qBAAAA,gBAAL,KAAA;AACL,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,SAAM,CAAN,CAAA,GAAA,KAAA;AACA,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,SAAM,CAAN,CAAA,GAAA,KAAA;AACA,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,WAAQ,CAAR,CAAA,GAAA,OAAA;AACA,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,UAAO,CAAP,CAAA,GAAA,MAAA;AACA,EAAAA,gBAAAA,CAAAA,gBAAAA,CAAA,UAAO,CAAP,CAAA,GAAA,MAAA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+BAA+B,UAAU,CAAA,CAAA;AAAA,QACtD,OAAA,EAAS,MAAM,WAAA,CAAY,UAA6B,CAAA;AAAA,QAEvD,QAAA,EAAA,MAAA,IAAU,MAAU,IAAA,UAAA,mBAClB,GAAA,CAAA,QAAA,EAAA,EAAS,QAAS,EAAA,OAAA,EAAQ,CAE3B,mBAAA,GAAA,CAAC,eAAgB,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA;AAAA,OAAA;AAAA,MAP/B;AAAA,KAUR,CAAA;AAAA,oBACH,GAAA;AAAA,MAAC,sBAAA;AAAA,MAAA;AAAA,QACC,MAAA;AAAA,QACA,IAAM,EAAA,kBAAA;AAAA,QACN,OAAA,EAAS,MAAM,qBAAA,CAAsB,KAAK,CAAA;AAAA,QAC1C,uBAAA;AAAA,QACA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,10 +1,10 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { FeedbackRatingsTable } from '../FeedbackRatingsTable/FeedbackRatingsTable.esm.js';
3
3
  import { FeedbackRatings } from '../StarredRatingButtons/StarredRatingButtons.esm.js';
4
4
 
5
5
  const StarredRatingsTable = (props) => {
6
6
  const { allEntities, ownerRef, title } = props;
7
- return /* @__PURE__ */ React.createElement(
7
+ return /* @__PURE__ */ jsx(
8
8
  FeedbackRatingsTable,
9
9
  {
10
10
  allEntities,
@@ -1 +1 @@
1
- {"version":3,"file":"StarredRatingsTable.esm.js","sources":["../../../src/components/StarredRatingsTable/StarredRatingsTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nimport { FeedbackRatingsTable } from '../FeedbackRatingsTable';\nimport { FeedbackRatings } from '../StarredRatingButtons';\n\n/**\n * @public\n */\nexport interface StarredRatingsTableProps {\n allEntities?: boolean;\n ownerRef?: string;\n title?: string;\n}\n\nexport const StarredRatingsTable = (props: StarredRatingsTableProps) => {\n const { allEntities, ownerRef, title } = props;\n\n return (\n <FeedbackRatingsTable\n allEntities={allEntities}\n ownerRef={ownerRef}\n ratingValues={Object.values(FeedbackRatings)\n .filter(o => typeof o === 'number')\n .map(r => r.toString())}\n title={title}\n />\n );\n};\n"],"names":[],"mappings":";;;;AA8Ba,MAAA,mBAAA,GAAsB,CAAC,KAAoC,KAAA;AACtE,EAAA,MAAM,EAAE,WAAA,EAAa,QAAU,EAAA,KAAA,EAAU,GAAA,KAAA;AAEzC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,WAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAc,EAAA,MAAA,CAAO,MAAO,CAAA,eAAe,EACxC,MAAO,CAAA,CAAA,CAAA,KAAK,OAAO,CAAA,KAAM,QAAQ,CACjC,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA,CAAA,CAAE,UAAU,CAAA;AAAA,MACxB;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"StarredRatingsTable.esm.js","sources":["../../../src/components/StarredRatingsTable/StarredRatingsTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FeedbackRatingsTable } from '../FeedbackRatingsTable';\nimport { FeedbackRatings } from '../StarredRatingButtons';\n\n/**\n * @public\n */\nexport interface StarredRatingsTableProps {\n allEntities?: boolean;\n ownerRef?: string;\n title?: string;\n}\n\nexport const StarredRatingsTable = (props: StarredRatingsTableProps) => {\n const { allEntities, ownerRef, title } = props;\n\n return (\n <FeedbackRatingsTable\n allEntities={allEntities}\n ownerRef={ownerRef}\n ratingValues={Object.values(FeedbackRatings)\n .filter(o => typeof o === 'number')\n .map(r => r.toString())}\n title={title}\n />\n );\n};\n"],"names":[],"mappings":";;;;AA4Ba,MAAA,mBAAA,GAAsB,CAAC,KAAoC,KAAA;AACtE,EAAA,MAAM,EAAE,WAAA,EAAa,QAAU,EAAA,KAAA,EAAU,GAAA,KAAA;AAEzC,EACE,uBAAA,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,WAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAc,EAAA,MAAA,CAAO,MAAO,CAAA,eAAe,EACxC,MAAO,CAAA,CAAA,CAAA,KAAK,OAAO,CAAA,KAAM,QAAQ,CACjC,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA,CAAA,CAAE,UAAU,CAAA;AAAA,MACxB;AAAA;AAAA,GACF;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Entity } from '@backstage/catalog-model';
2
- import React, { ReactNode } from 'react';
2
+ import { ReactNode } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
4
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
4
5
  import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';
5
6
  import { EntityRatingsData, Rating, Ratings, FeedbackResponse } from '@backstage-community/plugin-entity-feedback-common';
@@ -76,39 +77,39 @@ declare const entityFeedbackPlugin: _backstage_core_plugin_api.BackstagePlugin<{
76
77
  /**
77
78
  * @public
78
79
  */
79
- declare const LikeDislikeButtons: (props: LikeDislikeButtonsProps) => React.JSX.Element;
80
+ declare const LikeDislikeButtons: (props: LikeDislikeButtonsProps) => react_jsx_runtime.JSX.Element;
80
81
  /**
81
82
  * @public
82
83
  */
83
- declare const StarredRatingButtons: (props: StarredRatingButtonsProps) => React.JSX.Element;
84
+ declare const StarredRatingButtons: (props: StarredRatingButtonsProps) => react_jsx_runtime.JSX.Element;
84
85
  /**
85
86
  * @public
86
87
  */
87
- declare const FeedbackResponseDialog: (props: FeedbackResponseDialogProps) => React.JSX.Element;
88
+ declare const FeedbackResponseDialog: (props: FeedbackResponseDialogProps) => react_jsx_runtime.JSX.Element;
88
89
  /**
89
90
  * @public
90
91
  */
91
- declare const EntityFeedbackResponseContent: () => React.JSX.Element;
92
+ declare const EntityFeedbackResponseContent: () => react_jsx_runtime.JSX.Element;
92
93
  /**
93
94
  * @public
94
95
  */
95
- declare const FeedbackResponseTable: (props: FeedbackResponseTableProps) => React.JSX.Element;
96
+ declare const FeedbackResponseTable: (props: FeedbackResponseTableProps) => react_jsx_runtime.JSX.Element;
96
97
  /**
97
98
  * @public
98
99
  */
99
- declare const EntityLikeDislikeRatingsCard: () => React.JSX.Element;
100
+ declare const EntityLikeDislikeRatingsCard: () => react_jsx_runtime.JSX.Element;
100
101
  /**
101
102
  * @public
102
103
  */
103
- declare const LikeDislikeRatingsTable: (props: LikeDislikeRatingsTableProps) => React.JSX.Element;
104
+ declare const LikeDislikeRatingsTable: (props: LikeDislikeRatingsTableProps) => react_jsx_runtime.JSX.Element;
104
105
  /**
105
106
  * @public
106
107
  */
107
- declare const EntityStarredRatingsCard: () => React.JSX.Element;
108
+ declare const EntityStarredRatingsCard: () => react_jsx_runtime.JSX.Element;
108
109
  /**
109
110
  * @public
110
111
  */
111
- declare const StarredRatingsTable: (props: StarredRatingsTableProps) => React.JSX.Element;
112
+ declare const StarredRatingsTable: (props: StarredRatingsTableProps) => react_jsx_runtime.JSX.Element;
112
113
 
113
114
  /**
114
115
  * @public
@@ -1,7 +1,7 @@
1
+ import { jsx } from 'react/jsx-runtime';
1
2
  import { stringifyEntityRef } from '@backstage/catalog-model';
2
3
  import { createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, createComponentExtension, createRoutableExtension } from '@backstage/core-plugin-api';
3
4
  import { useAsyncEntity } from '@backstage/plugin-catalog-react';
4
- import React from 'react';
5
5
  import { EntityFeedbackClient } from './api/EntityFeedbackClient.esm.js';
6
6
  import { entityFeedbackApiRef } from './api/EntityFeedbackApi.esm.js';
7
7
  import { rootRouteRef } from './routes.esm.js';
@@ -60,7 +60,7 @@ const EntityFeedbackResponseContent = entityFeedbackPlugin.provide(
60
60
  ({ FeedbackResponseTable: FeedbackResponseTable2 }) => {
61
61
  return () => {
62
62
  const { entity } = useAsyncEntity();
63
- return /* @__PURE__ */ React.createElement(
63
+ return /* @__PURE__ */ jsx(
64
64
  FeedbackResponseTable2,
65
65
  {
66
66
  entityRef: entity ? stringifyEntityRef(entity) : ""
@@ -89,7 +89,7 @@ const EntityLikeDislikeRatingsCard = entityFeedbackPlugin.provide(
89
89
  ({ LikeDislikeRatingsTable: LikeDislikeRatingsTable2 }) => {
90
90
  return () => {
91
91
  const { entity } = useAsyncEntity();
92
- return /* @__PURE__ */ React.createElement(
92
+ return /* @__PURE__ */ jsx(
93
93
  LikeDislikeRatingsTable2,
94
94
  {
95
95
  ownerRef: entity ? stringifyEntityRef(entity) : ""
@@ -119,7 +119,7 @@ const EntityStarredRatingsCard = entityFeedbackPlugin.provide(
119
119
  ({ StarredRatingsTable: StarredRatingsTable2 }) => {
120
120
  return () => {
121
121
  const { entity } = useAsyncEntity();
122
- return /* @__PURE__ */ React.createElement(
122
+ return /* @__PURE__ */ jsx(
123
123
  StarredRatingsTable2,
124
124
  {
125
125
  ownerRef: entity ? stringifyEntityRef(entity) : ""
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport {\n createApiFactory,\n createComponentExtension,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport { useAsyncEntity } from '@backstage/plugin-catalog-react';\nimport React from 'react';\n\nimport { entityFeedbackApiRef, EntityFeedbackClient } from './api';\nimport { rootRouteRef } from './routes';\n\n/**\n * @public\n */\nexport const entityFeedbackPlugin = createPlugin({\n id: 'entity-feedback',\n routes: {\n root: rootRouteRef,\n },\n apis: [\n createApiFactory({\n api: entityFeedbackApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, fetchApi }) =>\n new EntityFeedbackClient({ discoveryApi, fetchApi }),\n }),\n ],\n});\n\n/**\n * @public\n */\nexport const LikeDislikeButtons = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'LikeDislikeButtons',\n component: {\n lazy: () =>\n import('./components/LikeDislikeButtons').then(\n m => m.LikeDislikeButtons,\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const StarredRatingButtons = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'StarredRatingButtons',\n component: {\n lazy: () =>\n import('./components/StarredRatingButtons').then(\n m => m.StarredRatingButtons,\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const FeedbackResponseDialog = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'FeedbackResponseDialog',\n component: {\n lazy: () =>\n import('./components/FeedbackResponseDialog').then(\n m => m.FeedbackResponseDialog,\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const EntityFeedbackResponseContent = entityFeedbackPlugin.provide(\n createRoutableExtension({\n name: 'EntityFeedbackResponseContent',\n mountPoint: rootRouteRef,\n component: () =>\n import('./components/FeedbackResponseTable').then(\n ({ FeedbackResponseTable }) => {\n return () => {\n const { entity } = useAsyncEntity();\n return (\n <FeedbackResponseTable\n entityRef={entity ? stringifyEntityRef(entity) : ''}\n />\n );\n };\n },\n ),\n }),\n);\n\n/**\n * @public\n */\nexport const FeedbackResponseTable = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'FeedbackResponseTable',\n component: {\n lazy: () =>\n import('./components/FeedbackResponseTable').then(\n m => m.FeedbackResponseTable,\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const EntityLikeDislikeRatingsCard = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'EntityLikeDislikeRatingsCard',\n component: {\n lazy: () =>\n import('./components/LikeDislikeRatingsTable').then(\n ({ LikeDislikeRatingsTable }) => {\n return () => {\n const { entity } = useAsyncEntity();\n return (\n <LikeDislikeRatingsTable\n ownerRef={entity ? stringifyEntityRef(entity) : ''}\n />\n );\n };\n },\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const LikeDislikeRatingsTable = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'LikeDislikeRatingsTable',\n component: {\n lazy: () =>\n import('./components/LikeDislikeRatingsTable').then(\n m => m.LikeDislikeRatingsTable,\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const EntityStarredRatingsCard = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'EntityStarredRatingsCard',\n component: {\n lazy: () =>\n import('./components/StarredRatingsTable').then(\n ({ StarredRatingsTable }) => {\n return () => {\n const { entity } = useAsyncEntity();\n return (\n <StarredRatingsTable\n ownerRef={entity ? stringifyEntityRef(entity) : ''}\n />\n );\n };\n },\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const StarredRatingsTable = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'StarredRatingsTable',\n component: {\n lazy: () =>\n import('./components/StarredRatingsTable').then(\n m => m.StarredRatingsTable,\n ),\n },\n }),\n);\n"],"names":["FeedbackResponseTable","LikeDislikeRatingsTable","StarredRatingsTable"],"mappings":";;;;;;;;AAkCO,MAAM,uBAAuB,YAAa,CAAA;AAAA,EAC/C,EAAI,EAAA,iBAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA;AAAA,GACR;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,oBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,QAAU,EAAA;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,QAAA,EACxB,KAAA,IAAI,oBAAqB,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU;AAAA,KACtD;AAAA;AAEL,CAAC;AAKM,MAAM,qBAAqB,oBAAqB,CAAA,OAAA;AAAA,EACrD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,oBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,8CAAiC,CAAE,CAAA,IAAA;AAAA,QACxC,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;AAKO,MAAM,uBAAuB,oBAAqB,CAAA,OAAA;AAAA,EACvD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,sBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,gDAAmC,CAAE,CAAA,IAAA;AAAA,QAC1C,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;AAKO,MAAM,yBAAyB,oBAAqB,CAAA,OAAA;AAAA,EACzD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,wBAAA;AAAA,IACN,SAAW,EAAA;AA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sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport {\n createApiFactory,\n createComponentExtension,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\nimport { useAsyncEntity } from '@backstage/plugin-catalog-react';\n\nimport { entityFeedbackApiRef, EntityFeedbackClient } from './api';\nimport { rootRouteRef } from './routes';\n\n/**\n * @public\n */\nexport const entityFeedbackPlugin = createPlugin({\n id: 'entity-feedback',\n routes: {\n root: rootRouteRef,\n },\n apis: [\n createApiFactory({\n api: entityFeedbackApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, fetchApi }) =>\n new EntityFeedbackClient({ discoveryApi, fetchApi }),\n }),\n ],\n});\n\n/**\n * @public\n */\nexport const LikeDislikeButtons = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'LikeDislikeButtons',\n component: {\n lazy: () =>\n import('./components/LikeDislikeButtons').then(\n m => m.LikeDislikeButtons,\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const StarredRatingButtons = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'StarredRatingButtons',\n component: {\n lazy: () =>\n import('./components/StarredRatingButtons').then(\n m => m.StarredRatingButtons,\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const FeedbackResponseDialog = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'FeedbackResponseDialog',\n component: {\n lazy: () =>\n import('./components/FeedbackResponseDialog').then(\n m => m.FeedbackResponseDialog,\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const EntityFeedbackResponseContent = entityFeedbackPlugin.provide(\n createRoutableExtension({\n name: 'EntityFeedbackResponseContent',\n mountPoint: rootRouteRef,\n component: () =>\n import('./components/FeedbackResponseTable').then(\n ({ FeedbackResponseTable }) => {\n return () => {\n const { entity } = useAsyncEntity();\n return (\n <FeedbackResponseTable\n entityRef={entity ? stringifyEntityRef(entity) : ''}\n />\n );\n };\n },\n ),\n }),\n);\n\n/**\n * @public\n */\nexport const FeedbackResponseTable = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'FeedbackResponseTable',\n component: {\n lazy: () =>\n import('./components/FeedbackResponseTable').then(\n m => m.FeedbackResponseTable,\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const EntityLikeDislikeRatingsCard = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'EntityLikeDislikeRatingsCard',\n component: {\n lazy: () =>\n import('./components/LikeDislikeRatingsTable').then(\n ({ LikeDislikeRatingsTable }) => {\n return () => {\n const { entity } = useAsyncEntity();\n return (\n <LikeDislikeRatingsTable\n ownerRef={entity ? stringifyEntityRef(entity) : ''}\n />\n );\n };\n },\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const LikeDislikeRatingsTable = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'LikeDislikeRatingsTable',\n component: {\n lazy: () =>\n import('./components/LikeDislikeRatingsTable').then(\n m => m.LikeDislikeRatingsTable,\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const EntityStarredRatingsCard = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'EntityStarredRatingsCard',\n component: {\n lazy: () =>\n import('./components/StarredRatingsTable').then(\n ({ StarredRatingsTable }) => {\n return () => {\n const { entity } = useAsyncEntity();\n return (\n <StarredRatingsTable\n ownerRef={entity ? stringifyEntityRef(entity) : ''}\n />\n );\n };\n },\n ),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const StarredRatingsTable = entityFeedbackPlugin.provide(\n createComponentExtension({\n name: 'StarredRatingsTable',\n component: {\n lazy: () =>\n import('./components/StarredRatingsTable').then(\n m => m.StarredRatingsTable,\n ),\n },\n }),\n);\n"],"names":["FeedbackResponseTable","LikeDislikeRatingsTable","StarredRatingsTable"],"mappings":";;;;;;;;AAiCO,MAAM,uBAAuB,YAAa,CAAA;AAAA,EAC/C,EAAI,EAAA,iBAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA;AAAA,GACR;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,oBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,QAAU,EAAA;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,QAAA,EACxB,KAAA,IAAI,oBAAqB,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU;AAAA,KACtD;AAAA;AAEL,CAAC;AAKM,MAAM,qBAAqB,oBAAqB,CAAA,OAAA;AAAA,EACrD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,oBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,8CAAiC,CAAE,CAAA,IAAA;AAAA,QACxC,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;AAKO,MAAM,uBAAuB,oBAAqB,CAAA,OAAA;AAAA,EACvD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,sBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,gDAAmC,CAAE,CAAA,IAAA;AAAA,QAC1C,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;AAKO,MAAM,yBAAyB,oBAAqB,CAAA,OAAA;AAAA,EACzD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,wBAA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-community/plugin-entity-feedback",
3
- "version": "0.7.2",
3
+ "version": "0.9.0",
4
4
  "backstage": {
5
5
  "role": "frontend-plugin",
6
6
  "pluginId": "entity-feedback",
@@ -38,22 +38,22 @@
38
38
  "test": "backstage-cli package test"
39
39
  },
40
40
  "dependencies": {
41
- "@backstage-community/plugin-entity-feedback-common": "^0.5.0",
42
- "@backstage/catalog-model": "^1.7.3",
43
- "@backstage/core-components": "^0.17.0",
44
- "@backstage/core-plugin-api": "^1.10.5",
41
+ "@backstage-community/plugin-entity-feedback-common": "^0.7.0",
42
+ "@backstage/catalog-model": "^1.7.5",
43
+ "@backstage/core-components": "^0.17.4",
44
+ "@backstage/core-plugin-api": "^1.10.9",
45
45
  "@backstage/errors": "^1.2.7",
46
- "@backstage/plugin-catalog-react": "^1.16.0",
46
+ "@backstage/plugin-catalog-react": "^1.19.1",
47
47
  "@material-ui/core": "^4.9.13",
48
48
  "@material-ui/icons": "^4.9.1",
49
49
  "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
50
50
  "react-use": "^17.2.4"
51
51
  },
52
52
  "devDependencies": {
53
- "@backstage/cli": "^0.31.0",
54
- "@backstage/dev-utils": "^1.1.8",
55
- "@backstage/plugin-catalog": "^1.28.0",
56
- "@backstage/test-utils": "^1.7.6",
53
+ "@backstage/cli": "^0.33.1",
54
+ "@backstage/dev-utils": "^1.1.12",
55
+ "@backstage/plugin-catalog": "^1.31.1",
56
+ "@backstage/test-utils": "^1.7.10",
57
57
  "@testing-library/dom": "^10.0.0",
58
58
  "@testing-library/jest-dom": "^6.0.0",
59
59
  "@testing-library/react": "^15.0.0",
@@ -69,5 +69,12 @@
69
69
  "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
70
70
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
71
71
  },
72
+ "typesVersions": {
73
+ "*": {
74
+ "package.json": [
75
+ "package.json"
76
+ ]
77
+ }
78
+ },
72
79
  "module": "./dist/index.esm.js"
73
80
  }