diff --git a/src/CONST.ts b/src/CONST.ts index a4c330b36cc6..e2613d75003f 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -4815,6 +4815,28 @@ const CONST = { }, SUBSCRIPTION_SIZE_LIMIT: 20000, + SUBSCRIPTION_POSSIBLE_COST_SAVINGS: { + COLLECT_PLAN: 10, + CONTROL_PLAN: 18, + }, + FEEDBACK_SURVEY_OPTIONS: { + TOO_LIMITED: { + ID: 'tooLimited', + TRANSLATION_KEY: 'feedbackSurvey.tooLimited', + }, + TOO_EXPENSIVE: { + ID: 'tooExpensive', + TRANSLATION_KEY: 'feedbackSurvey.tooExpensive', + }, + INADEQUATE_SUPPORT: { + ID: 'inadequateSupport', + TRANSLATION_KEY: 'feedbackSurvey.inadequateSupport', + }, + BUSINESS_CLOSING: { + ID: 'businessClosing', + TRANSLATION_KEY: 'feedbackSurvey.businessClosing', + }, + }, } as const; type Country = keyof typeof CONST.ALL_COUNTRIES; diff --git a/src/ROUTES.ts b/src/ROUTES.ts index fd03e3c19e2d..ed20d388bb87 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -104,6 +104,7 @@ const ROUTES = { SETTINGS_SUBSCRIPTION: 'settings/subscription', SETTINGS_SUBSCRIPTION_SIZE: 'settings/subscription/subscription-size', SETTINGS_SUBSCRIPTION_ADD_PAYMENT_CARD: 'settings/subscription/add-payment-card', + SETTINGS_SUBSCRIPTION_DISABLE_AUTO_RENEW_SURVEY: 'settings/subscription/disable-auto-renew-survey', SETTINGS_PRIORITY_MODE: 'settings/preferences/priority-mode', SETTINGS_LANGUAGE: 'settings/preferences/language', SETTINGS_THEME: 'settings/preferences/theme', diff --git a/src/SCREENS.ts b/src/SCREENS.ts index fd7418aee1c5..9f7277a0ad0f 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -108,6 +108,7 @@ const SCREENS = { ROOT: 'Settings_Subscription', SIZE: 'Settings_Subscription_Size', ADD_PAYMENT_CARD: 'Settings_Subscription_Add_Payment_Card', + DISABLE_AUTO_RENEW_SURVEY: 'Settings_Subscription_DisableAutoRenewSurvey', }, }, SAVE_THE_WORLD: { diff --git a/src/components/FeedbackSurvey.tsx b/src/components/FeedbackSurvey.tsx new file mode 100644 index 000000000000..3b7d6475262b --- /dev/null +++ b/src/components/FeedbackSurvey.tsx @@ -0,0 +1,90 @@ +import React, {useState} from 'react'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; +import useLocalize from '@hooks/useLocalize'; +import useTheme from '@hooks/useTheme'; +import useThemeStyles from '@hooks/useThemeStyles'; +import CONST from '@src/CONST'; +import type {TranslationPaths} from '@src/languages/types'; +import FixedFooter from './FixedFooter'; +import FormAlertWithSubmitButton from './FormAlertWithSubmitButton'; +import SingleOptionSelector from './SingleOptionSelector'; +import Text from './Text'; + +type FeedbackSurveyProps = { + /** Title of the survey */ + title: string; + + /** Description of the survey */ + description: string; + + /** Callback to be called when the survey is submitted */ + onSubmit: (reason: Option) => void; + + /** Styles for the option row element */ + optionRowStyles?: StyleProp; +}; + +type Option = { + key: string; + label: TranslationPaths; +}; + +const OPTIONS: Option[] = [ + {key: CONST.FEEDBACK_SURVEY_OPTIONS.TOO_LIMITED.ID, label: CONST.FEEDBACK_SURVEY_OPTIONS.TOO_LIMITED.TRANSLATION_KEY}, + {key: CONST.FEEDBACK_SURVEY_OPTIONS.TOO_EXPENSIVE.ID, label: CONST.FEEDBACK_SURVEY_OPTIONS.TOO_EXPENSIVE.TRANSLATION_KEY}, + {key: CONST.FEEDBACK_SURVEY_OPTIONS.INADEQUATE_SUPPORT.ID, label: CONST.FEEDBACK_SURVEY_OPTIONS.INADEQUATE_SUPPORT.TRANSLATION_KEY}, + {key: CONST.FEEDBACK_SURVEY_OPTIONS.BUSINESS_CLOSING.ID, label: CONST.FEEDBACK_SURVEY_OPTIONS.BUSINESS_CLOSING.TRANSLATION_KEY}, +]; + +function FeedbackSurvey({title, description, onSubmit, optionRowStyles}: FeedbackSurveyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const theme = useTheme(); + + const selectCircleStyles: StyleProp = {borderColor: theme.border}; + const [reason, setReason] = useState