@rh-support/components 2.5.230 → 2.5.232

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.
Files changed (71) hide show
  1. package/lib/esm/ConfirmationModal/ConfirmationDialog.js +1 -1
  2. package/lib/esm/Functional/CaseContactsSelectorExternal.d.ts +0 -2
  3. package/lib/esm/Functional/CaseContactsSelectorExternal.d.ts.map +1 -1
  4. package/lib/esm/Functional/CaseContactsSelectorExternal.js +82 -176
  5. package/lib/esm/InlineEdit/NewInlineEdit.d.ts +0 -2
  6. package/lib/esm/InlineEdit/NewInlineEdit.d.ts.map +1 -1
  7. package/lib/esm/InlineEdit/NewInlineEdit.js +2 -7
  8. package/lib/esm/MarkdownEditor/MarkdownEditor.d.ts +49 -0
  9. package/lib/esm/MarkdownEditor/MarkdownEditor.d.ts.map +1 -0
  10. package/lib/esm/MarkdownEditor/MarkdownEditor.js +601 -0
  11. package/lib/esm/MarkdownEditor/index.d.ts +2 -0
  12. package/lib/esm/MarkdownEditor/index.d.ts.map +1 -0
  13. package/lib/esm/MarkdownEditor/index.js +1 -0
  14. package/lib/esm/MarkdownEditor/markdownEditor.css +223 -0
  15. package/lib/esm/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.d.ts +0 -2
  16. package/lib/esm/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.d.ts.map +1 -1
  17. package/lib/esm/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.js +3 -8
  18. package/lib/esm/PhoneInput/PhoneInput.d.ts.map +1 -1
  19. package/lib/esm/PhoneInput/PhoneInput.js +1 -38
  20. package/lib/esm/SingleSelectDropdown/SingleSelectDropdown.d.ts +0 -2
  21. package/lib/esm/SingleSelectDropdown/SingleSelectDropdown.d.ts.map +1 -1
  22. package/lib/esm/SingleSelectDropdown/SingleSelectDropdown.js +6 -7
  23. package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.d.ts.map +1 -1
  24. package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.js +80 -62
  25. package/lib/esm/Table/TablePagination.d.ts +0 -1
  26. package/lib/esm/Table/TablePagination.d.ts.map +1 -1
  27. package/lib/esm/Table/TablePagination.js +1 -1
  28. package/lib/esm/ToastNotification/ToastNotification.d.ts +1 -5
  29. package/lib/esm/ToastNotification/ToastNotification.d.ts.map +1 -1
  30. package/lib/esm/ToastNotification/ToastNotification.js +3 -16
  31. package/lib/esm/ToastNotification/toastNotification.css +0 -7
  32. package/lib/esm/helperFunctions/errorMessage.d.ts +1 -2
  33. package/lib/esm/helperFunctions/errorMessage.d.ts.map +1 -1
  34. package/lib/esm/helperFunctions/errorMessage.js +5 -19
  35. package/lib/esm/hooks/useCopyToClipboard.d.ts +1 -1
  36. package/lib/esm/hooks/useCopyToClipboard.d.ts.map +1 -1
  37. package/lib/esm/hooks/useCopyToClipboard.js +1 -3
  38. package/lib/esm/index.d.ts +1 -3
  39. package/lib/esm/index.d.ts.map +1 -1
  40. package/lib/esm/index.js +1 -4
  41. package/package.json +6 -9
  42. package/lib/esm/CaseLabelLoadErrorModal/CaseLabelLoadErrorModal.d.ts +0 -10
  43. package/lib/esm/CaseLabelLoadErrorModal/CaseLabelLoadErrorModal.d.ts.map +0 -1
  44. package/lib/esm/CaseLabelLoadErrorModal/CaseLabelLoadErrorModal.js +0 -17
  45. package/lib/esm/CaseLabelLoadErrorModal/CaseLabelLoadErrorModal.scss +0 -13
  46. package/lib/esm/CaseLabelLoadErrorModal/index.d.ts +0 -2
  47. package/lib/esm/CaseLabelLoadErrorModal/index.d.ts.map +0 -1
  48. package/lib/esm/CaseLabelLoadErrorModal/index.js +0 -1
  49. package/lib/esm/CustomDatePicker/CustomDatePicker.d.ts +0 -18
  50. package/lib/esm/CustomDatePicker/CustomDatePicker.d.ts.map +0 -1
  51. package/lib/esm/CustomDatePicker/CustomDatePicker.js +0 -27
  52. package/lib/esm/CustomDatePicker/customDatePicker.css +0 -52
  53. package/lib/esm/CustomDatePicker/index.d.ts +0 -2
  54. package/lib/esm/CustomDatePicker/index.d.ts.map +0 -1
  55. package/lib/esm/CustomDatePicker/index.js +0 -1
  56. package/lib/esm/RichTextEditor/RichTextEditor.d.ts +0 -45
  57. package/lib/esm/RichTextEditor/RichTextEditor.d.ts.map +0 -1
  58. package/lib/esm/RichTextEditor/RichTextEditor.js +0 -464
  59. package/lib/esm/RichTextEditor/autoLinkModule.d.ts +0 -18
  60. package/lib/esm/RichTextEditor/autoLinkModule.d.ts.map +0 -1
  61. package/lib/esm/RichTextEditor/autoLinkModule.js +0 -156
  62. package/lib/esm/RichTextEditor/index.d.ts +0 -4
  63. package/lib/esm/RichTextEditor/index.d.ts.map +0 -1
  64. package/lib/esm/RichTextEditor/index.js +0 -2
  65. package/lib/esm/RichTextEditor/linkUrl.d.ts +0 -7
  66. package/lib/esm/RichTextEditor/linkUrl.d.ts.map +0 -1
  67. package/lib/esm/RichTextEditor/linkUrl.js +0 -26
  68. package/lib/esm/RichTextEditor/richTextEditor.css +0 -182
  69. package/lib/esm/RichTextEditor/useQuillEditor.d.ts +0 -20
  70. package/lib/esm/RichTextEditor/useQuillEditor.d.ts.map +0 -1
  71. package/lib/esm/RichTextEditor/useQuillEditor.js +0 -180
@@ -0,0 +1,223 @@
1
+ .markdown-content .markdown-preview {
2
+ min-height: 100px;
3
+ overflow: auto;
4
+ font-size: 15px;
5
+ padding: 0.8rem;
6
+ border: 1px solid #e3e3e3;
7
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
8
+ border-radius: 1px;
9
+ }
10
+
11
+ .markdown-content .markdown-preview ul,
12
+ .markdown-content .markdown-preview ol {
13
+ padding-left: 24px;
14
+ }
15
+
16
+ .markdown-content .markdown-preview blockquote {
17
+ border-left: 5px solid #c0c0c0 !important;
18
+ }
19
+
20
+ .markdown-editor-container {
21
+ background: #fff;
22
+ border: 1px solid #d2d2d2;
23
+ display: block;
24
+ min-height: 100px;
25
+ }
26
+
27
+ .markdown-editor-container .pf-v6-c-toolbar {
28
+ padding: 0.5rem;
29
+ }
30
+
31
+ .btn-group-separator {
32
+ background: rgba(40, 45, 51, 0.3);
33
+ height: 16px;
34
+ margin-left: 10px;
35
+ margin-right: 5px;
36
+ width: 1px;
37
+ margin-top: 10px;
38
+ }
39
+
40
+ .markdown-content .markdown-text-area {
41
+ resize: vertical;
42
+ border-radius: 0;
43
+ box-shadow: none !important;
44
+ outline: none;
45
+ border: none;
46
+ font-size: 15px;
47
+ padding: 0.8rem;
48
+ min-width: 100%;
49
+ }
50
+
51
+ .markdown-editor-container .markdown-toggle-toolbar {
52
+ border-top: 1px solid #d2d2d2;
53
+ }
54
+
55
+ .markdown-editor-container .markdown-toggle-toolbar button {
56
+ font-size: 14px;
57
+ padding: 10px 1rem;
58
+ }
59
+
60
+ .markdown-editor-container .markdown-toggle-toolbar .markdown-active-mode {
61
+ border-top: 2px solid #06c;
62
+ border-radius: 0px;
63
+ color: #6a6e73;
64
+ font-weight: 500;
65
+ color: #06c;
66
+ }
67
+
68
+ .markdown-editor-container .pf-v6-c-button.pf-m-link.pf-m-inline.markdown-guidance {
69
+ padding-block-start: 0.375rem;
70
+ padding-block-end: 0.375rem;
71
+ padding-inline-start: 0.375rem;
72
+ padding-inline-end: 0.375rem;
73
+ box-sizing: border-box;
74
+ }
75
+
76
+ .markdown-editor-container .character-count-wrapper {
77
+ white-space: nowrap;
78
+ padding: 0 16px;
79
+ font-size: 14px;
80
+ }
81
+
82
+ .markdown-editor-container .character-count-wrapper.red {
83
+ color: #e00;
84
+ }
85
+
86
+ .markdown-editor-container .markdown-toolbar-left-section {
87
+ flex: 1;
88
+ }
89
+
90
+ .markdown-editor-container.is-private .markdown-content .markdown-text-area {
91
+ background-color: #f5eeee;
92
+ }
93
+
94
+ a[href*='/attachments/']::before,
95
+ button[data-link*='/attachments/']::before {
96
+ margin-right: 4px;
97
+ font-style: normal;
98
+ text-rendering: auto;
99
+ -webkit-font-smoothing: antialiased;
100
+ content: '📎';
101
+ }
102
+
103
+ .toolbar-container {
104
+ height: 50px;
105
+ }
106
+ .markdown-text-area {
107
+ width: 100%;
108
+ height: 313px;
109
+ border: none;
110
+ }
111
+
112
+ .markdown-preview {
113
+ border-bottom: none !important;
114
+ }
115
+
116
+ .markdown-preview ul {
117
+ list-style: '-';
118
+ }
119
+
120
+ .desktop-markdown-toolbar {
121
+ display: flex;
122
+ }
123
+
124
+ .markdown-toolbar-left-section {
125
+ display: flex;
126
+ align-items: center;
127
+ }
128
+
129
+ .btn-group-separator {
130
+ display: inline-block;
131
+ width: 1px;
132
+ height: 24px;
133
+ margin: 0 8px;
134
+ background-color: #ccc;
135
+ }
136
+
137
+ .markdown-guidance-container {
138
+ display: none;
139
+ }
140
+
141
+ .mobile-markdown-toolbar {
142
+ display: none;
143
+ }
144
+
145
+ #toolsKebabMenu {
146
+ overflow: hidden;
147
+ inset: 0px auto auto -12rem !important;
148
+
149
+ .pf-v6-c-menu__list {
150
+ padding-left: 0px !important;
151
+ padding-right: 0px !important;
152
+ }
153
+
154
+ .attachments-items li {
155
+ padding: 0px 10px !important;
156
+
157
+ .pf-v6-c-divider {
158
+ width: 15rem;
159
+ margin-left: -1rem;
160
+ }
161
+ }
162
+ }
163
+
164
+ /* Mobile toolbar styles */
165
+ @media (max-width: 880px) {
166
+ .desktop-markdown-toolbar {
167
+ display: none;
168
+ }
169
+
170
+ .markdown-guidance-container {
171
+ display: flex;
172
+ justify-content: flex-end;
173
+ padding: 9px;
174
+ }
175
+
176
+ .mobile-markdown-toolbar {
177
+ display: flex;
178
+ flex-direction: row;
179
+ justify-content: space-between;
180
+ align-items: center;
181
+
182
+ .mobile-markdown-tool-item {
183
+ width: 2.5rem !important;
184
+ }
185
+ }
186
+
187
+ .markdown-toolbar-left-section {
188
+ margin-inline-end: 0px !important;
189
+ }
190
+
191
+ .markdown-preview-btn,
192
+ .plain-mode-btn,
193
+ .markdown-mode-btn {
194
+ padding-left: 4px;
195
+ padding-right: 4px;
196
+ }
197
+
198
+ .markdown-editor-container .markdown-toggle-toolbar button {
199
+ font-size: 14px;
200
+ padding: 10px 0.25rem;
201
+ }
202
+ }
203
+
204
+ @media (max-width: 475px) {
205
+ .markdown-editor-container .pf-v6-c-toolbar {
206
+ padding: 0.5rem 0rem;
207
+ }
208
+
209
+ .mobile-markdown-toolbar {
210
+ .mobile-markdown-tool-item {
211
+ width: 0.1rem !important;
212
+ }
213
+
214
+ #tools-kebab-menu-container {
215
+ position: relative;
216
+ right: 2rem;
217
+ }
218
+ }
219
+
220
+ .uploading-spinner-text {
221
+ display: none;
222
+ }
223
+ }
@@ -10,8 +10,6 @@ export interface IOwnerSelectorProps extends IOwnerSelectorExtends {
10
10
  onSelect: (contacts: IContact[]) => void;
11
11
  onChipRemoved?: (contact: IContact) => void;
12
12
  isLoading?: boolean;
13
- onHandleLoadMore?: (event: any) => void;
14
- isShowMoreOptionVisible?: boolean;
15
13
  }
16
14
  export interface IOwnerOption {
17
15
  contact: IContact;
@@ -1 +1 @@
1
- {"version":3,"file":"OwnerTypeaheadDropdown.d.ts","sourceRoot":"","sources":["../../../src/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAKlE,OAAO,KAAkB,MAAM,OAAO,CAAC;AAKvC,OAAO,EAGH,uBAAuB,EAE1B,MAAM,wCAAwC,CAAC;AAGhD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACpC,uBAAuB,EACvB,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,kBAAkB,GAAG,yBAAyB,GAAG,eAAe,GAAG,OAAO,CACnH,CAAC;AAEF,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB;IAC9D,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;IACzC,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACxC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,QAAQ,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAcD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,mBAAmB,qBAkIhE"}
1
+ {"version":3,"file":"OwnerTypeaheadDropdown.d.ts","sourceRoot":"","sources":["../../../src/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAKlE,OAAO,KAAkB,MAAM,OAAO,CAAC;AAKvC,OAAO,EAGH,uBAAuB,EAE1B,MAAM,wCAAwC,CAAC;AAGhD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACpC,uBAAuB,EACvB,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,kBAAkB,GAAG,yBAAyB,GAAG,eAAe,GAAG,OAAO,CACnH,CAAC;AAEF,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB;IAC9D,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;IACzC,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,QAAQ,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAcD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,mBAAmB,qBA2HhE"}
@@ -27,19 +27,14 @@ function getTypeaheadOptionsFromContacts(contacts, caseContactSsoUsername) {
27
27
  }));
28
28
  }
29
29
  export function OwnerTypeaheadDropdown(props) {
30
- var _a;
31
30
  const { contactSsoUsername, groupContactsAndEmails, options, selected, onSelect, onToggleClosed, onChipRemoved } = props, restProps = __rest(props, ["contactSsoUsername", "groupContactsAndEmails", "options", "selected", "onSelect", "onToggleClosed", "onChipRemoved"]);
32
31
  const selectedTypeaheadOptions = useMemo(() => getTypeaheadOptionsFromContacts(selected, contactSsoUsername), [selected, contactSsoUsername]);
33
32
  const { t } = useTranslation();
34
- const { visibleItems, hasMoreItems: hasMoreItemsLocal, onHandleLoadMore: onHandleLoadMoreLocal, resetVisibleItems, } = useProgressiveLoading(options, PAGE_SIZE);
35
- const useServerPagination = !!props.onHandleLoadMore;
36
- const displayItems = useServerPagination ? options : visibleItems;
37
- const showMore = useServerPagination ? (_a = props.isShowMoreOptionVisible) !== null && _a !== void 0 ? _a : false : hasMoreItemsLocal();
38
- const handleLoadMore = useServerPagination ? props.onHandleLoadMore : onHandleLoadMoreLocal;
33
+ const { visibleItems, hasMoreItems, onHandleLoadMore, resetVisibleItems } = useProgressiveLoading(options, PAGE_SIZE);
39
34
  const typeaheadOptions = useMemo(() => {
40
35
  const contacts = [];
41
36
  const customEmails = [];
42
- for (const option of displayItems) {
37
+ for (const option of visibleItems) {
43
38
  const typeaheadOption = {
44
39
  label: getHydraContactLabel(option.contact),
45
40
  value: option.contact.ssoUsername,
@@ -102,5 +97,5 @@ export function OwnerTypeaheadDropdown(props) {
102
97
  };
103
98
  onSelect([newCustomOption]);
104
99
  };
105
- return (React.createElement(TypeaheadDropdown, Object.assign({ "data-tracking-id": "external-case-contact-selector", selected: selectedTypeaheadOptions, options: typeaheadOptions, onSelect: onSelectContact, onHandleLoadMore: handleLoadMore, isShowMoreOptionVisible: showMore, onToggleClosed: onLocalToggleClosed, onChipRemoved: onLocalChipRemoved, onNew: onLocalNew }, restProps)));
100
+ return (React.createElement(TypeaheadDropdown, Object.assign({ "data-tracking-id": "external-case-contact-selector", selected: selectedTypeaheadOptions, options: typeaheadOptions, onSelect: onSelectContact, onHandleLoadMore: onHandleLoadMore, isShowMoreOptionVisible: hasMoreItems(), onToggleClosed: onLocalToggleClosed, onChipRemoved: onLocalChipRemoved, onNew: onLocalNew }, restProps)));
106
101
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../src/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAoB3B,OAAO,KAAsC,MAAM,OAAO,CAAC;AAM3D,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACtE,mBAAmB,CAAC,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,OAAO,KAAA,KAAK,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACrC;AAoDD,eAAO,MAAM,eAAe,GAAI,aAAa,MAAM;;;;;;;;;;CAmClD,CAAC;AAyCF,eAAO,MAAM,WAAW,GAAI,aAAa,MAAM;;;CAgB9C,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,qBA8RvC"}
1
+ {"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../src/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAoB3B,OAAO,KAAsC,MAAM,OAAO,CAAC;AAM3D,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACtE,mBAAmB,CAAC,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,OAAO,KAAA,KAAK,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACrC;AAoDD,eAAO,MAAM,eAAe,GAAI,aAAa,MAAM;;;;;;;;;;CAmClD,CAAC;AAqCF,eAAO,MAAM,WAAW,GAAI,aAAa,MAAM;;;CAgB9C,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,qBA2PvC"}
@@ -107,11 +107,7 @@ const formatNumber = (fullPhoneNumber, localFormat) => {
107
107
  }
108
108
  }
109
109
  const isPatternWithPrefix = (_a = pattern === null || pattern === void 0 ? void 0 : pattern.replace(/\s+/g, '')) === null || _a === void 0 ? void 0 : _a.startsWith(PREFIX);
110
- // TODO: Temporary — return pattern without forcing + prefix for portal phone without country code.
111
- pattern = isPatternWithPrefix ? pattern : pattern;
112
- /* TODO: Revert to previous logic after phone format handling is finalized.
113
110
  pattern = isPatternWithPrefix ? pattern : !isEmpty(isPatternWithPrefix) ? PREFIX + pattern : '';
114
- */
115
111
  return pattern;
116
112
  };
117
113
  // return phoneline and countrycode for any given phone
@@ -144,11 +140,7 @@ export function PhoneInput(props) {
144
140
  const setLocalFormat = (phoneNumber) => {
145
141
  const localPhone = removeAllChars(phoneNumber);
146
142
  if (shouldNotSetCountryCode) {
147
- // TODO: Temporary — portal phone without country code; use mask without + prefix.
148
- return DEFAULT_MASK;
149
- /* TODO: Revert to previous logic after phone format handling is finalized.
150
143
  return DEFAULT_FORMAT; // default format for portal phone without country code
151
- */
152
144
  }
153
145
  let localFormat;
154
146
  const exactCountry = getExactCountry(localPhone);
@@ -177,23 +169,12 @@ export function PhoneInput(props) {
177
169
  const localFormat = setLocalFormat(phone);
178
170
  const _formattedNumber = formatNumber(phone, localFormat);
179
171
  setFormattedNumber(_formattedNumber);
180
- // TODO: Temporary — do not prepend + when shouldNotSetCountryCode is true.
181
- if (!shouldNotSetCountryCode &&
182
- !(phone === null || phone === void 0 ? void 0 : phone.trim().startsWith(PREFIX)) &&
183
- regex.test(phone) &&
184
- !isEqual(phone, '-')) {
172
+ if (!(phone === null || phone === void 0 ? void 0 : phone.trim().startsWith(PREFIX)) && regex.test(phone) && !isEqual(phone, '-')) {
185
173
  onPhoneValueChange(PREFIX + (phone === null || phone === void 0 ? void 0 : phone.trim()));
186
174
  }
187
175
  else {
188
176
  onPhoneValueChange(phone === null || phone === void 0 ? void 0 : phone.slice(0, localFormat === null || localFormat === void 0 ? void 0 : localFormat.length));
189
177
  }
190
- /* TODO: Revert to previous logic after phone format handling is finalized.
191
- if (!phone?.trim().startsWith(PREFIX) && regex.test(phone) && !isEqual(phone, '-')) {
192
- onPhoneValueChange(PREFIX + phone?.trim());
193
- } else {
194
- onPhoneValueChange(phone?.slice(0, localFormat?.length));
195
- }
196
- */
197
178
  };
198
179
  const onCountrySelect = (_event, itemId) => {
199
180
  var _a, _b;
@@ -252,18 +233,10 @@ export function PhoneInput(props) {
252
233
  onPhoneValueChange('');
253
234
  }
254
235
  else {
255
- // TODO: Temporary — strip leading + when shouldNotSetCountryCode is true.
256
- const normalizedPhone = shouldNotSetCountryCode ? (phoneValue === null || phoneValue === void 0 ? void 0 : phoneValue.replace(/^\++/, '')) || '' : phoneValue;
257
- onPhoneValueChange(normalizedPhone);
258
- const localFormat = setLocalFormat(normalizedPhone);
259
- const _formattedNumber = formatNumber(normalizedPhone, localFormat);
260
- setFormattedNumber(_formattedNumber);
261
- /* TODO: Revert to previous logic after phone format handling is finalized.
262
236
  onPhoneValueChange(phoneValue);
263
237
  const localFormat = setLocalFormat(phoneValue);
264
238
  const _formattedNumber = formatNumber(phoneValue, localFormat);
265
239
  setFormattedNumber(_formattedNumber);
266
- */
267
240
  }
268
241
  // eslint-disable-next-line react-hooks/exhaustive-deps
269
242
  }, [phoneValue]);
@@ -278,20 +251,10 @@ export function PhoneInput(props) {
278
251
  else {
279
252
  onCountryCodeChange && onCountryCodeChange(PREFIX + countryCode);
280
253
  }
281
- // TODO: Temporary — strip leading + when shouldNotSetCountryCode is true.
282
- const normalizedPhone = shouldNotSetCountryCode
283
- ? removeAllSpaces((phoneValue === null || phoneValue === void 0 ? void 0 : phoneValue.replace(/^\++/, '')) || '')
284
- : removeAllSpaces(phoneValue);
285
- onPhoneValueChange && onPhoneValueChange(normalizedPhone);
286
- const localFormat = setLocalFormat(normalizedPhone);
287
- const _formattedNumber = formatNumber(normalizedPhone, localFormat);
288
- setFormattedNumber(_formattedNumber);
289
- /* TODO: Revert to previous logic after phone format handling is finalized.
290
254
  onPhoneValueChange && onPhoneValueChange(removeAllSpaces(phoneValue)); // removing trailing and in between spaces
291
255
  const localFormat = setLocalFormat(phoneValue);
292
256
  const _formattedNumber = formatNumber(phoneValue, localFormat);
293
257
  setFormattedNumber(_formattedNumber);
294
- */
295
258
  // eslint-disable-next-line react-hooks/exhaustive-deps
296
259
  }, [shouldNotSetCountryCode]);
297
260
  const toggle = (React.createElement(MenuToggle, { ref: toggleRef, onClick: () => setIsOpen(!isOpen), isExpanded: isOpen, className: "phone-number-select", "data-tracking-id": "case-phone-number-country-code", isDisabled: props.isDisabled, "aria-label": "Country Code" }, iso2 && phoneValue !== '' ? placeholder : t('Country Code')));
@@ -27,8 +27,6 @@ export interface SingleSelectDropdownProps extends Omit<SelectProps, 'toggle'> {
27
27
  isScrollable?: boolean;
28
28
  zIndex?: number;
29
29
  isModalOpen?: boolean;
30
- /** When set, toggle opens this handler instead of the select menu (e.g. case-details severity modal). */
31
- onMenuToggle?: () => void;
32
30
  hideToggleIcons?: boolean;
33
31
  onClear?: () => void;
34
32
  onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"SingleSelectDropdown.d.ts","sourceRoot":"","sources":["../../../src/SingleSelectDropdown/SingleSelectDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQH,WAAW,EAEd,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,EAAE,SAAS,EAA4B,MAAM,OAAO,CAAC;AAInE,MAAM,WAAW,2BAA2B;IACxC,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;IAC1E,QAAQ,EAAE,2BAA2B,CAAC;IACtC,OAAO,EAAE,2BAA2B,EAAE,CAAC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IACnC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,mBAAmB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IACxC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yGAAyG;IACzG,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,EAAE,CAAC,OAAO,KAAA,KAAK,IAAI,CAAC;CAChC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,qBA0IpE"}
1
+ {"version":3,"file":"SingleSelectDropdown.d.ts","sourceRoot":"","sources":["../../../src/SingleSelectDropdown/SingleSelectDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQH,WAAW,EAEd,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,EAAE,SAAS,EAA4B,MAAM,OAAO,CAAC;AAInE,MAAM,WAAW,2BAA2B;IACxC,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;IAC1E,QAAQ,EAAE,2BAA2B,CAAC;IACtC,OAAO,EAAE,2BAA2B,EAAE,CAAC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IACnC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,mBAAmB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IACxC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,EAAE,CAAC,OAAO,KAAA,KAAK,IAAI,CAAC;CAChC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,qBAsIpE"}
@@ -15,13 +15,9 @@ import isEqual from 'lodash/isEqual';
15
15
  import React, { useEffect, useState } from 'react';
16
16
  import { useSelectKeyboardNavigator } from '../hooks/useSelectKeyboardNavigator';
17
17
  export function SingleSelectDropdown(props) {
18
- const { badge, selected, options, isDisabled, isLoading, id, placeholder, isInvalid, className, toggleClassName, dataTrackingId, toggleDataTrackingId, isScrollable, ariaLabel, zIndex, ariaLabelledBy, isModalOpen, onMenuToggle, hideToggleIcons, onClear, onBlur, onSelect } = props, restProps = __rest(props, ["badge", "selected", "options", "isDisabled", "isLoading", "id", "placeholder", "isInvalid", "className", "toggleClassName", "dataTrackingId", "toggleDataTrackingId", "isScrollable", "ariaLabel", "zIndex", "ariaLabelledBy", "isModalOpen", "onMenuToggle", "hideToggleIcons", "onClear", "onBlur", "onSelect"]);
18
+ const { badge, selected, options, isDisabled, isLoading, id, placeholder, isInvalid, className, toggleClassName, dataTrackingId, toggleDataTrackingId, isScrollable, ariaLabel, zIndex, ariaLabelledBy, isModalOpen, hideToggleIcons, onClear, onBlur, onSelect } = props, restProps = __rest(props, ["badge", "selected", "options", "isDisabled", "isLoading", "id", "placeholder", "isInvalid", "className", "toggleClassName", "dataTrackingId", "toggleDataTrackingId", "isScrollable", "ariaLabel", "zIndex", "ariaLabelledBy", "isModalOpen", "hideToggleIcons", "onClear", "onBlur", "onSelect"]);
19
19
  const [isOpen, setIsOpen] = useState(false);
20
20
  const onToggleClick = () => {
21
- if (onMenuToggle) {
22
- onMenuToggle();
23
- return;
24
- }
25
21
  setIsOpen(!isOpen);
26
22
  };
27
23
  const handleSelect = (selectedOption) => {
@@ -40,7 +36,8 @@ export function SingleSelectDropdown(props) {
40
36
  if (isModalOpen) {
41
37
  setIsOpen(false);
42
38
  }
43
- }, [isModalOpen]);
39
+ // eslint-disable-next-line react-hooks/exhaustive-deps
40
+ }, [isOpen]);
44
41
  const toggle = (toggleRef) => (React.createElement(MenuToggle, { className: toggleClassName || 'single-select-toggle-text', ref: toggleRef, onClick: onToggleClick, onKeyDown: onInputKeyDown, isExpanded: isOpen, isDisabled: isDisabled, isFullWidth: true, status: isInvalid ? 'danger' : undefined, "data-tracking-id": toggleDataTrackingId || '', badge: badge },
45
42
  hideToggleIcons && ((selected === null || selected === void 0 ? void 0 : selected.label) || placeholder),
46
43
  !hideToggleIcons && (React.createElement(Flex, { justifyContent: { default: 'justifyContentSpaceBetween' } },
@@ -61,6 +58,8 @@ export function SingleSelectDropdown(props) {
61
58
  return (React.createElement(Select, Object.assign({ shouldFocusToggleOnSelect: true, shouldPreventScrollOnItemFocus: true, id: id || '', className: className || '', "data-tracking-id": dataTrackingId, isOpen: isOpen, selected: selected, onSelect: onLocalSelect, onOpenChange: (isOpen) => setIsOpen(isOpen), toggle: toggle, popperProps: { direction: 'down', enableFlip: false }, isScrollable: isScrollable, onBlur: onLocalBlur, "aria-label": ariaLabel, zIndex: zIndex, "aria-labelledby": ariaLabelledBy, maxMenuHeight: "20rem" }, restProps),
62
59
  React.createElement(SelectList, null, options.map((option, index) => {
63
60
  var _a;
64
- return (React.createElement(SelectOption, { key: option.value, value: option, description: option.description || '', isSelected: isEqual(selected === null || selected === void 0 ? void 0 : selected.value, option.value), isDisabled: option.disabled, isFocused: focusedItemIndex === index, title: (option === null || option === void 0 ? void 0 : option.title) || option.label, "aria-label": option.label }, (_a = option === null || option === void 0 ? void 0 : option.element) !== null && _a !== void 0 ? _a : option.label));
61
+ return (React.createElement(SelectOption, { key: option.value, value: option, description: option.description || '',
62
+ // Fix the comparison to compare the entire objects or at least their values
63
+ isSelected: isEqual(selected === null || selected === void 0 ? void 0 : selected.value, option.value), isDisabled: option.disabled, isFocused: focusedItemIndex === index, title: (option === null || option === void 0 ? void 0 : option.title) || option.label }, (_a = option === null || option === void 0 ? void 0 : option.element) !== null && _a !== void 0 ? _a : option.label));
65
64
  }))));
66
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SupportFeedbackModal.d.ts","sourceRoot":"","sources":["../../../src/SupportFeedbackForm/SupportFeedbackModal.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAanD,UAAU,MAAM;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAMD,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,qBA0R1C;kBA1RQ,oBAAoB;;;AA6R7B,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"SupportFeedbackModal.d.ts","sourceRoot":"","sources":["../../../src/SupportFeedbackForm/SupportFeedbackModal.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAcnD,UAAU,MAAM;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAWD,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,qBA+S1C;kBA/SQ,oBAAoB;;;AAkT7B,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { pcm } from '@cee-eng/hydrajs';
11
- import { Button, Icon, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant } from '@patternfly/react-core';
11
+ import { Button, FormGroup, FormHelperText, HelperText, HelperTextItem, Icon, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, TextArea, ValidatedOptions, } from '@patternfly/react-core';
12
12
  import OutlinedFrownIcon from '@patternfly/react-icons/dist/js/icons/outlined-frown-icon';
13
13
  import OutlinedFrownOpenIcon from '@patternfly/react-icons/dist/js/icons/outlined-frown-open-icon';
14
14
  import OutlinedGrinIcon from '@patternfly/react-icons/dist/js/icons/outlined-grin-icon';
@@ -20,11 +20,16 @@ import React, { useEffect, useState } from 'react';
20
20
  import { Trans, useTranslation } from 'react-i18next';
21
21
  import { useLocation, useParams } from 'react-router-dom';
22
22
  import { useFetch } from '../hooks/useFetch';
23
- import { TextAreaAutosize } from '../TextAreaAutosize';
24
23
  import { ToastNotification } from '../ToastNotification';
25
- const required = {
26
- levelOfSatisfied: true,
27
- moreInfo: false,
24
+ function isRequiredFieldValid(key, value) {
25
+ if (key === 'moreInfo') {
26
+ return (value !== null && value !== void 0 ? value : '').trim().length > 0;
27
+ }
28
+ return !isEmpty(value);
29
+ }
30
+ const formInitState = {
31
+ levelOfSatisfied: null,
32
+ moreInfo: '',
28
33
  };
29
34
  const defaultProps = {
30
35
  isModalOpen: false,
@@ -34,29 +39,25 @@ function SupportFeedbackModal(props) {
34
39
  const { t } = useTranslation();
35
40
  const seSessionId = (_b = (_a = getUrlParsedParams(useLocation().search)) === null || _a === void 0 ? void 0 : _a.seSessionId) !== null && _b !== void 0 ? _b : '';
36
41
  const { caseNumber } = useParams();
37
- const formInitState = {
38
- levelOfSatisfied: null,
39
- moreInfo: '',
40
- };
41
42
  const [values, setValues] = useState(formInitState);
42
43
  const { request: requestAISummary, isFetching: isFetchingAISummary } = useFetch(pcm.AISummaryFeedback, {
43
44
  propgateErrors: true,
44
45
  });
45
- const { request: requestFeedbackForm, isFetching: isFetchingFeedback } = useFetch(pcm.sendFeedbackForm, {
46
+ const { request: requestPcmFeedback, isFetching: isFetchingFeedback } = useFetch(pcm.submitPcmFeedback, {
46
47
  propgateErrors: true,
47
48
  });
48
49
  const isFetching = isFetchingAISummary || isFetchingFeedback;
49
- const [isSubmitDisabled, setIsSubmitDisabled] = useState(false);
50
- const [isSubmitButtonValid, setSubmitButtonValid] = useState(true);
50
+ const [showRatingError, setShowRatingError] = useState(false);
51
+ const [showFeedbackTextError, setShowFeedbackTextError] = useState(false);
52
+ const trimmedMoreInfo = values.moreInfo.trim();
53
+ const hasValidationError = showRatingError || showFeedbackTextError;
51
54
  useEffect(() => {
52
- let valid = true;
53
- Object.keys(values).forEach((key) => {
54
- if (required[key]) {
55
- valid = valid && !isEmpty(values[key]);
56
- }
57
- });
58
- setSubmitButtonValid(!valid);
59
- }, [values]);
55
+ setShowRatingError(false);
56
+ setShowFeedbackTextError(false);
57
+ if (!props.isModalOpen) {
58
+ setValues(formInitState);
59
+ }
60
+ }, [props.isModalOpen]);
60
61
  useEffect(() => {
61
62
  if (props.caseSummaryId) {
62
63
  setValues((prev) => (Object.assign(Object.assign({}, prev), { caseSummaryId: props.caseSummaryId })));
@@ -67,59 +68,75 @@ function SupportFeedbackModal(props) {
67
68
  }, [props.caseSummaryId, props.errorMessage]);
68
69
  // To Handle the Feedback Satisfaction values
69
70
  const handleSentimentChange = (event) => {
70
- setIsSubmitDisabled(false);
71
+ setShowRatingError(false);
71
72
  setValues(Object.assign(Object.assign({}, values), { [event.target.name]: event.target.value }));
72
73
  };
73
74
  // To Handle the Text Area Input (Feedback Description)
74
- const handleFeedbackTextChange = (event) => {
75
- setValues(Object.assign(Object.assign({}, values), { [event.target.name]: event.target.value }));
75
+ const handleFeedbackTextChange = (_event, value) => {
76
+ setShowFeedbackTextError(false);
77
+ setValues(Object.assign(Object.assign({}, values), { moreInfo: value }));
76
78
  };
77
79
  // To handle submit
78
80
  const handleSubmit = (event) => __awaiter(this, void 0, void 0, function* () {
79
81
  var _a;
80
82
  event.preventDefault();
81
- if (!isSubmitButtonValid) {
82
- let updatedValues = Object.assign({}, values);
83
- try {
84
- if (props.isCaseSummary) {
85
- const aiPayload = {
86
- caseNumber: caseNumber || '',
87
- feedback: values.levelOfSatisfied || '',
88
- description: values.moreInfo || '',
89
- };
90
- yield requestAISummary(aiPayload, window.sessionjs);
91
- }
92
- else {
93
- const extraInfo = [
94
- props.errorMessage && `caseSummaryErrorMessage:'${props.errorMessage}'\n`,
95
- props.caseSummaryId && `caseSummaryId:'${props.caseSummaryId}'\n`,
96
- ];
97
- updatedValues = Object.assign(Object.assign({}, updatedValues), { moreInfo: `${extraInfo.filter(Boolean).join('')}${updatedValues.moreInfo || ''}`.trim() });
98
- delete updatedValues.caseSummaryErrorMessage;
99
- delete updatedValues.caseSummaryId;
100
- const emojiRegex = /(\p{Emoji_Presentation}|\p{Emoji}\uFE0F|\p{Extended_Pictographic})+/gu;
101
- updatedValues.moreInfo = (_a = updatedValues.moreInfo) === null || _a === void 0 ? void 0 : _a.replace(emojiRegex, (match) => encodeURIComponent(match));
102
- // Call the request with the updated values
103
- yield requestFeedbackForm(updatedValues, window.sessionjs, window.location.href, seSessionId);
104
- }
105
- setValues(formInitState); // Reset form state after successful submission
106
- ToastNotification.addSuccessMessage(t(`Thank you. We've received your feedback.`), t('Have a great day!'));
107
- handleModalToggle();
83
+ const hasRating = isRequiredFieldValid('levelOfSatisfied', values.levelOfSatisfied);
84
+ const hasFeedbackText = trimmedMoreInfo.length > 0;
85
+ setShowRatingError(!hasRating);
86
+ setShowFeedbackTextError(!hasFeedbackText);
87
+ if (!hasRating || !hasFeedbackText) {
88
+ return;
89
+ }
90
+ let updatedValues = Object.assign(Object.assign({}, values), { moreInfo: trimmedMoreInfo });
91
+ try {
92
+ if (props.isCaseSummary) {
93
+ const aiPayload = {
94
+ caseNumber: caseNumber || '',
95
+ feedback: values.levelOfSatisfied || '',
96
+ description: trimmedMoreInfo,
97
+ };
98
+ yield requestAISummary(aiPayload, window.sessionjs);
108
99
  }
109
- catch (error) {
110
- ToastNotification.addDangerMessage(t('Failed to submit feedback.'));
100
+ else {
101
+ const extraInfo = [
102
+ props.errorMessage && `caseSummaryErrorMessage:'${props.errorMessage}'\n`,
103
+ props.caseSummaryId && `caseSummaryId:'${props.caseSummaryId}'\n`,
104
+ ];
105
+ updatedValues = Object.assign(Object.assign({}, updatedValues), { moreInfo: `${extraInfo.filter(Boolean).join('')}${updatedValues.moreInfo || ''}`.trim() });
106
+ delete updatedValues.caseSummaryErrorMessage;
107
+ delete updatedValues.caseSummaryId;
108
+ const emojiRegex = /(\p{Emoji_Presentation}|\p{Emoji}\uFE0F|\p{Extended_Pictographic})+/gu;
109
+ updatedValues.moreInfo = (_a = updatedValues.moreInfo) === null || _a === void 0 ? void 0 : _a.replace(emojiRegex, (match) => encodeURIComponent(match));
110
+ const session = globalThis.sessionjs;
111
+ const userInfo = session.getUserInfo();
112
+ const payload = {
113
+ userName: `${userInfo.firstName} ${userInfo.lastName}`,
114
+ ssoUserName: userInfo.username,
115
+ accountNumber: userInfo.account_number || '',
116
+ userType: session.isInternal() ? 'internal' : 'external',
117
+ foundSolution: '',
118
+ satisfactionLevel: updatedValues.levelOfSatisfied || '',
119
+ savedTime: '',
120
+ feedback: updatedValues.moreInfo || '',
121
+ currentUrl: globalThis.location.href,
122
+ email: userInfo.email || '',
123
+ sessionId: seSessionId || '',
124
+ };
125
+ yield requestPcmFeedback(payload);
111
126
  }
127
+ setValues(formInitState); // Reset form state after successful submission
128
+ ToastNotification.addSuccessMessage(t(`Thank you. We've received your feedback.`), t('Have a great day!'));
129
+ handleModalToggle();
130
+ }
131
+ catch (error) {
132
+ ToastNotification.addDangerMessage(t('Failed to submit feedback.'));
112
133
  }
113
- else
114
- setIsSubmitDisabled(true);
115
134
  });
116
135
  // Function for Toggling the Modal when Provide feedback button is clicked
117
136
  const handleModalToggle = () => {
118
137
  if (isFetching)
119
138
  return;
120
139
  props.onClose();
121
- setIsSubmitDisabled(false);
122
- setValues({ levelOfSatisfied: null, moreInfo: '' });
123
140
  };
124
141
  // Feedback Satisfaction Values
125
142
  const sentiments = [
@@ -165,13 +182,14 @@ function SupportFeedbackModal(props) {
165
182
  React.createElement(Icon, { size: "lg" }, sentiment.icon),
166
183
  React.createElement(Trans, null, sentiment.label)));
167
184
  })),
168
- isSubmitDisabled && (React.createElement("div", null,
185
+ showRatingError && (React.createElement("div", null,
169
186
  React.createElement("p", { className: "form-instructions form-invalid" },
170
187
  React.createElement(Trans, null, "Please select a value"))))),
171
- React.createElement("div", { className: "form-group pf-v6-u-mb-md" },
172
- React.createElement("label", { htmlFor: "moreFeedback" },
173
- React.createElement(Trans, null, "How can we improve?")),
174
- React.createElement(TextAreaAutosize, { name: "moreInfo", id: "moreFeedback", placeholder: t('i18nDescribeSuggestionDetail', 'Describe your suggestion in detail'), disabled: isFetching, value: values.moreInfo, className: "form-control", onChange: handleFeedbackTextChange, rowsMin: 3 })),
188
+ React.createElement(FormGroup, { label: t('How can we improve?'), isRequired: true, fieldId: "moreFeedback" },
189
+ showFeedbackTextError && (React.createElement(FormHelperText, null,
190
+ React.createElement(HelperText, null,
191
+ React.createElement(HelperTextItem, { variant: ValidatedOptions.error }, t('Please enter your feedback'))))),
192
+ React.createElement(TextArea, { name: "moreInfo", id: "moreFeedback", placeholder: t('i18nDescribeSuggestionDetail', 'Describe your suggestion in detail'), isDisabled: isFetching, value: values.moreInfo, onChange: handleFeedbackTextChange, validated: showFeedbackTextError ? ValidatedOptions.error : ValidatedOptions.default, "aria-label": t('How can we improve?'), resizeOrientation: "vertical", rows: 3 })),
175
193
  React.createElement("p", null, props.isCaseSummary ? (React.createElement(Trans, { i18nKey: "Do not share any personal or other sensitive information in your feedback. Feedback may\n be used to improve Red Hat's products or services. For more information about Red Hat\u2019s\n privacy practices, please refer to the <a><u>Red Hat Privacy Statement.</u></a>", components: {
176
194
  a: (
177
195
  // eslint-disable-next-line jsx-a11y/anchor-has-content
@@ -187,7 +205,7 @@ function SupportFeedbackModal(props) {
187
205
  React.createElement("p", { className: "pf-v6-u-mb-sm" }, t('i18nFeedbackFormFoundBug', 'Let us know if you found a bug or if you have a suggestion to improve the web experience.')),
188
206
  renderModalBody()),
189
207
  React.createElement(ModalFooter, null,
190
- React.createElement(Button, { key: "confirm", onClick: handleSubmit, variant: "primary", isDisabled: isSubmitDisabled || isFetching, className: "pf-v6-u-ml-xs", spinnerAriaValueText: isFetching ? 'Loading' : undefined, isLoading: isFetching, "data-tracking-id": "app-feedback-submit", "aria-label": t('Send feedback') },
208
+ React.createElement(Button, { key: "confirm", onClick: handleSubmit, variant: "primary", isDisabled: hasValidationError || isFetching, className: "pf-v6-u-ml-xs", spinnerAriaValueText: isFetching ? 'Loading' : undefined, isLoading: isFetching, "data-tracking-id": "app-feedback-submit", "aria-label": t('Send feedback') },
191
209
  React.createElement(Trans, null, isFetching ? 'Sending feedback' : 'Send feedback')),
192
210
  React.createElement("button", { key: "cancel", onClick: handleModalToggle, className: "btn btn-app btn-link", "data-tracking-id": "app-feedback-cancel", "aria-label": "Cancel" }, "Cancel")))));
193
211
  }
@@ -13,7 +13,6 @@ interface IProps {
13
13
  perPage?: number;
14
14
  currentPage?: number;
15
15
  variant: PaginationVariant;
16
- isCompact?: boolean;
17
16
  }
18
17
  export declare function TablePagination(props: IProps): React.JSX.Element;
19
18
  export {};