From 5ae57d9e45c7dca9f5e6c78232895f3e1b7b29de Mon Sep 17 00:00:00 2001 From: Michal Muzyk Date: Mon, 3 Jun 2024 09:49:49 +0200 Subject: [PATCH 01/13] feat: subscription settings ui --- src/CONST.ts | 1 + src/components/FeedbackSurvey.tsx | 75 +++++++++++++++ src/languages/en.ts | 21 ++++ src/languages/es.ts | 21 ++++ .../DisableAutoRenewSurveyPage.tsx | 35 +++++++ .../Subscription/SubscriptionSettingsPage.tsx | 2 + .../SubscriptionSettingsSection.tsx | 96 +++++++++++++++++++ .../workflows/ToggleSettingsOptionRow.tsx | 15 ++- 8 files changed, 261 insertions(+), 5 deletions(-) create mode 100644 src/components/FeedbackSurvey.tsx create mode 100644 src/pages/settings/Subscription/DisableAutoRenewSurveyPage.tsx create mode 100644 src/pages/settings/Subscription/SubscriptionSettingsSection.tsx diff --git a/src/CONST.ts b/src/CONST.ts index 6517ece4276d..000ad3798d72 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -594,6 +594,7 @@ const CONST = { ONFIDO_TERMS_OF_SERVICE_URL: 'https://onfido.com/terms-of-service/', LIST_OF_RESTRICTED_BUSINESSES: 'https://community.expensify.com/discussion/6191/list-of-restricted-businesses', TRAVEL_TERMS_URL: `${USE_EXPENSIFY_URL}/travelterms`, + CORPORATE_KARMA_URL: `${USE_EXPENSIFY_URL}/corporate-karma`, // Use Environment.getEnvironmentURL to get the complete URL with port number DEV_NEW_EXPENSIFY_URL: 'https://dev.new.expensify.com:', diff --git a/src/components/FeedbackSurvey.tsx b/src/components/FeedbackSurvey.tsx new file mode 100644 index 000000000000..92743c1f3f0e --- /dev/null +++ b/src/components/FeedbackSurvey.tsx @@ -0,0 +1,75 @@ +import React, {useState} from 'react'; +import {View} from 'react-native'; +import useLocalize from '@hooks/useLocalize'; +import type {TranslationPaths} from '@src/languages/types'; +import Button from './Button'; +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: () => void; +}; + +const OPTION_KEYS = { + IMPROVEMENT: 'improvement', + EXPENSIVE: 'expensive', + SUPPORT: 'support', + CLOSING: 'closing', +}; + +type Option = { + key: string; + label: TranslationPaths; +}; + +const OPTIONS: Option[] = [ + {key: OPTION_KEYS.IMPROVEMENT, label: 'subscription.subscriptionSettings.functionalityNeeds'}, + {key: OPTION_KEYS.EXPENSIVE, label: 'subscription.subscriptionSettings.tooExpensive'}, + {key: OPTION_KEYS.SUPPORT, label: 'subscription.subscriptionSettings.inadequateCustomerSupport'}, + {key: OPTION_KEYS.CLOSING, label: 'subscription.subscriptionSettings.companyClosing'}, +]; + +function FeedbackSurvey({title, description, onSubmit}: FeedbackSurveyProps) { + const {translate} = useLocalize(); + const [reason, setReason] = useState