Skip to content

Commit d00b0e1

Browse files
committed
Store submission result in form state
1 parent 4fe1a70 commit d00b0e1

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@snf/access-qa-bot",
3-
"version": "2.4.5",
3+
"version": "2.4.6",
44
"private": false,
55
"homepage": ".",
66
"description": "ACCESS Q&A Bot React Component with support ticket creation, feedback collection, and ProForma integration",

src/utils/flows/security-flow.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,14 @@ export const createSecurityFlow = ({
249249
if (result.success) {
250250
submissionResult = {
251251
success: true,
252-
ticketKey: result.data?.ticketKey,
253-
ticketUrl: result.data?.ticketUrl
252+
ticketKey: result.data?.data?.ticketKey,
253+
ticketUrl: result.data?.data?.ticketUrl
254254
};
255255
setTicketForm(prevForm => ({
256256
...prevForm,
257-
ticketKey: result.data?.ticketKey,
258-
ticketUrl: result.data?.ticketUrl
257+
ticketKey: result.data?.data?.ticketKey,
258+
ticketUrl: result.data?.data?.ticketUrl,
259+
submissionResult: submissionResult
259260
}));
260261
} else {
261262
submissionResult = {
@@ -289,7 +290,9 @@ export const createSecurityFlow = ({
289290
},
290291
security_success: {
291292
message: () => {
292-
return generateSecuritySuccessMessage(submissionResult);
293+
const currentForm = getCurrentTicketForm() || {};
294+
const result = currentForm.submissionResult || submissionResult;
295+
return generateSecuritySuccessMessage(result);
293296
},
294297
options: ["Back to Main Menu"],
295298
chatDisabled: true,

src/utils/flows/tickets/ticket-flow-utils.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,21 @@ export const createSubmissionHandler = (setTicketForm) => {
3939
if (proxyResponse.success) {
4040
submissionResult = {
4141
success: true,
42-
ticketKey: proxyResponse.data.ticketKey,
43-
ticketUrl: proxyResponse.data.ticketUrl
42+
ticketKey: proxyResponse.data.data.ticketKey,
43+
ticketUrl: proxyResponse.data.data.ticketUrl
4444
};
4545
setTicketForm(prevForm => ({
4646
...prevForm,
47-
ticketKey: proxyResponse.data.ticketKey,
48-
ticketUrl: proxyResponse.data.ticketUrl
47+
ticketKey: proxyResponse.data.data.ticketKey,
48+
ticketUrl: proxyResponse.data.data.ticketUrl
4949
}));
5050
} else {
51-
console.error(`| ❌ ${ticketType} ticket creation failed:`, proxyResponse.data?.message || proxyResponse.error);
51+
console.error(`| ❌ ${ticketType} ticket creation failed:`, proxyResponse);
5252
submissionResult = {
5353
success: false,
54-
error: proxyResponse.data?.message || proxyResponse.error
54+
error: proxyResponse.error || 'Unknown error'
5555
};
56-
setTicketForm(prevForm => ({...prevForm, submissionError: proxyResponse.data?.message || proxyResponse.error}));
56+
setTicketForm(prevForm => ({...prevForm, submissionError: proxyResponse.error || 'Unknown error'}));
5757
}
5858
} catch (error) {
5959
console.error(`| ❌ Error sending ${ticketType} data to proxy:`, error);

0 commit comments

Comments
 (0)