Repository navigation
Feature : Added Promote referral program messaging to OptionsSelector component #30372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a0d616c
5d8e987
f7e6269
c710e20
3bcbb6e
69e34d9
6317b7b
db4946e
00740d2
60e0e49
3731ff6
a00f072
58c379f
24ff2d6
431ff43
e57cf20
c69c83c
da040d1
92829fc
c1be188
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,16 +7,23 @@ import ArrowKeyFocusManager from '@components/ArrowKeyFocusManager'; | |
| import Button from '@components/Button'; | ||
| import FixedFooter from '@components/FixedFooter'; | ||
| import FormHelpMessage from '@components/FormHelpMessage'; | ||
| import Icon from '@components/Icon'; | ||
| import {Info} from '@components/Icon/Expensicons'; | ||
| import OptionsList from '@components/OptionsList'; | ||
| import {PressableWithoutFeedback} from '@components/Pressable'; | ||
| import Text from '@components/Text'; | ||
| import TextInput from '@components/TextInput'; | ||
| import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; | ||
| import withNavigationFocus from '@components/withNavigationFocus'; | ||
| import compose from '@libs/compose'; | ||
| import getPlatform from '@libs/getPlatform'; | ||
| import KeyboardShortcut from '@libs/KeyboardShortcut'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import setSelection from '@libs/setSelection'; | ||
| import colors from '@styles/colors'; | ||
| import styles from '@styles/styles'; | ||
| import CONST from '@src/CONST'; | ||
| import ROUTES from '@src/ROUTES'; | ||
| import {defaultProps as optionsSelectorDefaultProps, propTypes as optionsSelectorPropTypes} from './optionsSelectorPropTypes'; | ||
|
|
||
| const propTypes = { | ||
|
|
@@ -35,12 +42,20 @@ const propTypes = { | |
| /** Whether navigation is focused */ | ||
| isFocused: PropTypes.bool.isRequired, | ||
|
|
||
| /** Whether referral CTA should be displayed */ | ||
| shouldShowReferralCTA: PropTypes.bool, | ||
|
|
||
| /** Referral content type */ | ||
| referralContentType: PropTypes.string, | ||
|
|
||
| ...optionsSelectorPropTypes, | ||
| ...withLocalizePropTypes, | ||
| }; | ||
|
|
||
| const defaultProps = { | ||
| shouldDelayFocus: false, | ||
| shouldShowReferralCTA: false, | ||
| referralContentType: CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND, | ||
| safeAreaPaddingBottomStyle: {}, | ||
| contentContainerStyles: [], | ||
| listContainerStyles: [styles.flex1], | ||
|
|
@@ -55,6 +70,7 @@ class BaseOptionsSelector extends Component { | |
| this.updateFocusedIndex = this.updateFocusedIndex.bind(this); | ||
| this.scrollToIndex = this.scrollToIndex.bind(this); | ||
| this.selectRow = this.selectRow.bind(this); | ||
| this.handleReferralModal = this.handleReferralModal.bind(this); | ||
| this.selectFocusedOption = this.selectFocusedOption.bind(this); | ||
| this.addToSelection = this.addToSelection.bind(this); | ||
| this.updateSearchValue = this.updateSearchValue.bind(this); | ||
|
|
@@ -67,6 +83,7 @@ class BaseOptionsSelector extends Component { | |
| allOptions, | ||
| focusedIndex, | ||
| shouldDisableRowSelection: false, | ||
| shouldShowReferralModal: false, | ||
| errorMessage: '', | ||
| }; | ||
| } | ||
|
|
@@ -180,6 +197,10 @@ class BaseOptionsSelector extends Component { | |
| this.props.onChangeText(value); | ||
| } | ||
|
|
||
| handleReferralModal() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey there! I'm refactoring this whole component and curious about its purpose. It looks like we never call it. |
||
| this.setState((prevState) => ({shouldShowReferralModal: !prevState.shouldShowReferralModal})); | ||
| } | ||
|
|
||
| subscribeToKeyboardShortcut() { | ||
| const enterConfig = CONST.KEYBOARD_SHORTCUTS.ENTER; | ||
| this.unsubscribeEnter = KeyboardShortcut.subscribe( | ||
|
|
@@ -495,6 +516,34 @@ class BaseOptionsSelector extends Component { | |
| </> | ||
| )} | ||
| </View> | ||
| {this.props.shouldShowReferralCTA && ( | ||
| <View style={[styles.ph5, styles.pb5, styles.flexShrink0]}> | ||
| <PressableWithoutFeedback | ||
| onPress={() => { | ||
| Navigation.navigate(ROUTES.REFERRAL_DETAILS_MODAL.getRoute(this.props.referralContentType)); | ||
| }} | ||
| style={[styles.p5, styles.w100, styles.br2, styles.highlightBG, styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, {gap: 10}]} | ||
| accessibilityLabel="referral" | ||
| role={CONST.ACCESSIBILITY_ROLE.BUTTON} | ||
| > | ||
| <Text> | ||
| {this.props.translate(`referralProgram.${this.props.referralContentType}.buttonText1`)} | ||
| <Text | ||
| color={colors.green400} | ||
| style={styles.textStrong} | ||
| > | ||
| {this.props.translate(`referralProgram.${this.props.referralContentType}.buttonText2`)} | ||
| </Text> | ||
| </Text> | ||
| <Icon | ||
| src={Info} | ||
| height={20} | ||
| width={20} | ||
| /> | ||
| </PressableWithoutFeedback> | ||
| </View> | ||
| )} | ||
|
|
||
| {shouldShowFooter && ( | ||
| <FixedFooter> | ||
| {shouldShowDefaultConfirmButton && ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -117,6 +117,7 @@ export default { | |||||
| twoFactorCode: 'Two-factor code', | ||||||
| workspaces: 'Workspaces', | ||||||
| profile: 'Profile', | ||||||
| referral: 'Referral', | ||||||
| payments: 'Payments', | ||||||
| wallet: 'Wallet', | ||||||
| preferences: 'Preferences', | ||||||
|
|
@@ -1908,4 +1909,31 @@ export default { | |||||
| guaranteed: 'Guaranteed eReceipt', | ||||||
| transactionDate: 'Transaction date', | ||||||
| }, | ||||||
| referralProgram: { | ||||||
| [CONST.REFERRAL_PROGRAM.CONTENT_TYPES.START_CHAT]: { | ||||||
| buttonText1: 'Start a chat, ', | ||||||
| buttonText2: `get $${CONST.REFERRAL_PROGRAM.REVENUE}.`, | ||||||
| header: `Start a chat, get $${CONST.REFERRAL_PROGRAM.REVENUE}`, | ||||||
| body: `Start a chat with a new Expensify account. Get $${CONST.REFERRAL_PROGRAM.REVENUE} once they start an annual subscription with two or more active members and make the first two payments toward their Expensify bill.`, | ||||||
| }, | ||||||
| [CONST.REFERRAL_PROGRAM.CONTENT_TYPES.MONEY_REQUEST]: { | ||||||
| buttonText1: 'Request money, ', | ||||||
| buttonText2: `get $${CONST.REFERRAL_PROGRAM.REVENUE}.`, | ||||||
| header: `Request money, get $${CONST.REFERRAL_PROGRAM.REVENUE}`, | ||||||
| body: `Request money from a new Expensify account. Get $${CONST.REFERRAL_PROGRAM.REVENUE} once they start an annual subscription with two or more active members and make the first two payments toward their Expensify bill.`, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anyone can raise quick fix for this typo? |
||||||
| }, | ||||||
| [CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SEND_MONEY]: { | ||||||
| buttonText1: 'Send money, ', | ||||||
| buttonText2: `get $${CONST.REFERRAL_PROGRAM.REVENUE}.`, | ||||||
| header: `Send money, get $${CONST.REFERRAL_PROGRAM.REVENUE}`, | ||||||
| body: `Send money to a new Expensify account. Get $${CONST.REFERRAL_PROGRAM.REVENUE} once they start an annual subscription with two or more active members and make the first two payments toward their Expensify bill.`, | ||||||
| }, | ||||||
| [CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND]: { | ||||||
| buttonText1: 'Refer a friend, ', | ||||||
| buttonText2: `get $${CONST.REFERRAL_PROGRAM.REVENUE}.`, | ||||||
| header: `Refer a friend, get $${CONST.REFERRAL_PROGRAM.REVENUE}`, | ||||||
| body: `Send your Expensify referral link to a friend or anyone else you know who spends too much time on expenses. When they start an annual subscription, you'll get $${CONST.REFERRAL_PROGRAM.REVENUE}.`, | ||||||
| }, | ||||||
| copyReferralLink: 'Copy referral link', | ||||||
| }, | ||||||
| } satisfies TranslationBase; | ||||||
Uh oh!
There was an error while loading. Please reload this page.