-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43982 from fabioh8010/feature/free-trials/pre-trial
[Free trial] Implement and show Pre-Trial banner in the App during Pre-Trial
- Loading branch information
Showing
9 changed files
with
202 additions
and
52 deletions.
There are no files selected for viewing
60 changes: 59 additions & 1 deletion
60
assets/images/simple-illustrations/simple-illustration__treasurechest.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
src/pages/settings/Subscription/CardSection/BillingBanner.tsx
This file was deleted.
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
src/pages/settings/Subscription/CardSection/BillingBanner/BillingBanner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from 'react'; | ||
import type {StyleProp, TextStyle, ViewStyle} from 'react-native'; | ||
import {View} from 'react-native'; | ||
import type {ValueOf} from 'type-fest'; | ||
import Icon from '@components/Icon'; | ||
import * as Expensicons from '@components/Icon/Expensicons'; | ||
import Text from '@components/Text'; | ||
import useTheme from '@hooks/useTheme'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import variables from '@styles/variables'; | ||
import CONST from '@src/CONST'; | ||
import type IconAsset from '@src/types/utils/IconAsset'; | ||
|
||
type BillingBannerProps = { | ||
/** The title of the banner. */ | ||
title: string | React.ReactNode; | ||
|
||
/** The subtitle of the banner. */ | ||
subtitle: string | React.ReactNode; | ||
|
||
/** The icon to display in the banner. */ | ||
icon: IconAsset; | ||
|
||
/** The type of brick road indicator to show. */ | ||
brickRoadIndicator?: ValueOf<typeof CONST.BRICK_ROAD_INDICATOR_STATUS>; | ||
|
||
/** Styles to apply to the container. */ | ||
style?: StyleProp<ViewStyle>; | ||
|
||
/** Styles to apply to the title. */ | ||
titleStyle?: StyleProp<TextStyle>; | ||
|
||
/** Styles to apply to the subtitle. */ | ||
subtitleStyle?: StyleProp<TextStyle>; | ||
}; | ||
|
||
function BillingBanner({title, subtitle, icon, brickRoadIndicator, style, titleStyle, subtitleStyle}: BillingBannerProps) { | ||
const styles = useThemeStyles(); | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<View style={[styles.pv4, styles.ph5, styles.flexRow, styles.gap3, styles.w100, styles.alignItemsCenter, styles.trialBannerBackgroundColor, style]}> | ||
<Icon | ||
src={icon} | ||
width={variables.menuIconSize} | ||
height={variables.menuIconSize} | ||
/> | ||
|
||
<View style={[styles.flex1, styles.justifyContentCenter]}> | ||
{typeof title === 'string' ? <Text style={[styles.textStrong, titleStyle]}>{title}</Text> : title} | ||
{typeof subtitle === 'string' ? <Text style={subtitleStyle}>{subtitle}</Text> : subtitle} | ||
</View> | ||
|
||
{!!brickRoadIndicator && ( | ||
<Icon | ||
src={Expensicons.DotIndicator} | ||
fill={brickRoadIndicator === CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR ? theme.danger : theme.success} | ||
/> | ||
)} | ||
</View> | ||
); | ||
} | ||
|
||
BillingBanner.displayName = 'BillingBanner'; | ||
|
||
export default BillingBanner; |
49 changes: 49 additions & 0 deletions
49
src/pages/settings/Subscription/CardSection/BillingBanner/PreTrialBillingBanner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import * as Illustrations from '@components/Icon/Illustrations'; | ||
import Text from '@components/Text'; | ||
import TextLink from '@components/TextLink'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import * as Report from '@libs/actions/Report'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import * as ReportUtils from '@libs/ReportUtils'; | ||
import ROUTES from '@src/ROUTES'; | ||
import BillingBanner from './BillingBanner'; | ||
|
||
function PreTrialBillingBanner() { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
|
||
const navigateToChat = () => { | ||
const reportUsedForOnboarding = ReportUtils.getChatUsedForOnboarding(); | ||
|
||
if (!reportUsedForOnboarding) { | ||
Report.navigateToConciergeChat(); | ||
return; | ||
} | ||
|
||
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportUsedForOnboarding.reportID)); | ||
}; | ||
|
||
return ( | ||
<BillingBanner | ||
title={translate('subscription.billingBanner.preTrial.title')} | ||
subtitle={ | ||
<Text> | ||
{translate('subscription.billingBanner.preTrial.subtitle')} | ||
<TextLink | ||
style={styles.link} | ||
onPress={navigateToChat} | ||
> | ||
{translate('subscription.billingBanner.preTrial.subtitleLink')} | ||
</TextLink> | ||
</Text> | ||
} | ||
icon={Illustrations.TreasureChest} | ||
/> | ||
); | ||
} | ||
|
||
PreTrialBillingBanner.displayName = 'PreTrialBillingBanner'; | ||
|
||
export default PreTrialBillingBanner; |
Oops, something went wrong.