diff --git a/src/reducers/application.tsx b/src/reducers/application.tsx index 3d49d0bfa..ffc80edac 100644 --- a/src/reducers/application.tsx +++ b/src/reducers/application.tsx @@ -66,6 +66,10 @@ export type ShareType = { closeOnFinish: boolean; } & SubShareType; +export type NTUsersFormData = { + flipper_trace: string | null; +}; + export type State = { leftSidebarVisible: boolean; rightSidebarVisible: boolean; @@ -80,6 +84,7 @@ export type State = { flipperRating: number | null; statusMessages: Array; xcodeCommandLineToolsDetected: boolean; + supportForm: {webState: NTUsersFormData} | null; }; type BooleanActionType = @@ -150,6 +155,12 @@ export type Action = payload: { isDetected: boolean; }; + } + | { + type: 'SET_SUPPORT_FORM_STATE'; + payload: { + webState: NTUsersFormData; + } | null; }; export const initialState: () => State = () => ({ @@ -172,6 +183,7 @@ export const initialState: () => State = () => ({ flipperRating: null, statusMessages: [], xcodeCommandLineToolsDetected: false, + supportForm: null, }); function statusMessage(sender: string, msg: string): string { @@ -285,6 +297,8 @@ export default function reducer( return state; } else if (action.type === 'SET_XCODE_DETECTED') { return {...state, xcodeCommandLineToolsDetected: action.payload.isDetected}; + } else if (action.type === 'SET_SUPPORT_FORM_STATE') { + return {...state, supportForm: action.payload}; } else { return state; } @@ -370,3 +384,10 @@ export const setXcodeDetected = (isDetected: boolean): Action => ({ type: 'SET_XCODE_DETECTED', payload: {isDetected}, }); + +export const setSupportFormState = ( + payload: {webState: NTUsersFormData} | null, +): Action => ({ + type: 'SET_SUPPORT_FORM_STATE', + payload, +}); diff --git a/src/utils/supportRequestsFormUtils.tsx b/src/utils/supportRequestsFormUtils.tsx index e1a69bc34..c0e31a390 100644 --- a/src/utils/supportRequestsFormUtils.tsx +++ b/src/utils/supportRequestsFormUtils.tsx @@ -21,19 +21,6 @@ export function sendDidMountMessage(webview: WebviewTag) { payload: null, }); } -/** - * - * @param webview - * @param text - * This helper function is for appending a text in the questions input text field. - * One should use it only for the pages backed by NTUsersFormContainer.react.js - */ -export function appendTextInQuestionsField(webview: WebviewTag, text: string) { - webview.send('hostMessage', { - type: 'appendQuestionString', - payload: text, - }); -} /** *