-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat: Add register for webinar button #61267
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
b37654c
fb70e75
fa18b66
37e6cd3
5709292
2239f49
cfaa354
e16156c
60f06d5
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 |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import React from 'react'; | ||
| import {useOnyx} from 'react-native-onyx'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import {openExternalLink} from '@libs/actions/Link'; | ||
| import {initializeOpenAIRealtime, stopConnection} from '@libs/actions/OpenAI'; | ||
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import ButtonWithDropdownMenu from './ButtonWithDropdownMenu'; | ||
| import type {DropdownOption, OnboardingHelpType} from './ButtonWithDropdownMenu/types'; | ||
| import {Close, Monitor, Phone} from './Icon/Expensicons'; | ||
|
|
||
| type TalkToSalesButtonProps = { | ||
| reportID: string | undefined; | ||
| shouldUseNarrowLayout: boolean; | ||
| shouldShowTalkToSales: boolean; | ||
| shouldShowRegisterForWebinar: boolean; | ||
| }; | ||
|
|
||
| function OnboardingHelpDropdownButton({reportID, shouldUseNarrowLayout, shouldShowTalkToSales, shouldShowRegisterForWebinar}: TalkToSalesButtonProps) { | ||
| const {translate} = useLocalize(); | ||
| const [talkToAISales] = useOnyx(ONYXKEYS.TALK_TO_AI_SALES, {canBeMissing: false}); | ||
| const [accountID] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.accountID, canBeMissing: false}); | ||
| const styles = useThemeStyles(); | ||
|
|
||
| if (!reportID || !accountID) { | ||
| return null; | ||
| } | ||
|
|
||
| const abTestCtaText = (): string => { | ||
| const availableCTAs = [translate('aiSales.getHelp'), translate('aiSales.talkToSales'), translate('aiSales.talkToConcierge')]; | ||
| return availableCTAs.at(accountID % availableCTAs.length) ?? translate('aiSales.talkToSales'); | ||
| }; | ||
|
|
||
| const talkToSalesOption = { | ||
| talkToSaleText: talkToAISales?.isTalkingToAISales ? translate('aiSales.hangUp') : abTestCtaText(), | ||
| talkToSalesIcon: talkToAISales?.isTalkingToAISales ? Close : Phone, | ||
| abTestCtaText: abTestCtaText(), | ||
| }; | ||
|
|
||
| const options: Array<DropdownOption<OnboardingHelpType>> = []; | ||
|
|
||
| if (shouldShowTalkToSales) { | ||
| options.push({ | ||
| text: talkToSalesOption.talkToSaleText, | ||
| icon: talkToSalesOption.talkToSalesIcon, | ||
| value: CONST.ONBOARDING_HELP.TALK_TO_SALES, | ||
| onSelected: () => { | ||
| if (talkToAISales?.isTalkingToAISales) { | ||
| stopConnection(); | ||
| } else { | ||
| initializeOpenAIRealtime(Number(reportID), talkToSalesOption.abTestCtaText); | ||
| } | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| if (shouldShowRegisterForWebinar) { | ||
| options.push({ | ||
| text: translate('getAssistancePage.registerForWebinar'), | ||
| icon: Monitor, | ||
| value: CONST.ONBOARDING_HELP.REGISTER_FOR_WEBINAR, | ||
| onSelected: () => { | ||
| openExternalLink(CONST.REGISTER_FOR_WEBINAR_URL); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| if (options.length === 0) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <ButtonWithDropdownMenu | ||
| onPress={() => null} | ||
| shouldAlwaysShowDropdownMenu | ||
| success={false} | ||
| buttonSize={CONST.DROPDOWN_BUTTON_SIZE.MEDIUM} | ||
| options={options} | ||
| isSplitButton={false} | ||
| customText={translate('getAssistancePage.onboardingHelp')} | ||
| isLoading={talkToAISales?.isLoading} | ||
| style={shouldUseNarrowLayout && styles.earlyDiscountButton} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| export default OnboardingHelpDropdownButton; |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,10 +22,10 @@ type FreeTrialProps = { | |
|
|
||
| function FreeTrial({badgeStyles, pressable = false, addSpacing = false, success = true, inARow = false}: FreeTrialProps) { | ||
| const styles = useThemeStyles(); | ||
| const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); | ||
| const [firstDayFreeTrial] = useOnyx(ONYXKEYS.NVP_FIRST_DAY_FREE_TRIAL); | ||
| const [lastDayFreeTrial] = useOnyx(ONYXKEYS.NVP_LAST_DAY_FREE_TRIAL); | ||
| const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION); | ||
| const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); | ||
| const [firstDayFreeTrial] = useOnyx(ONYXKEYS.NVP_FIRST_DAY_FREE_TRIAL, {canBeMissing: true}); | ||
| const [lastDayFreeTrial] = useOnyx(ONYXKEYS.NVP_LAST_DAY_FREE_TRIAL, {canBeMissing: true}); | ||
| const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION, {canBeMissing: true}); | ||
|
|
||
| const [freeTrialText, setFreeTrialText] = useState<string | undefined>(undefined); | ||
| const {isOffline} = useNetwork(); | ||
|
|
@@ -46,6 +46,7 @@ function FreeTrial({badgeStyles, pressable = false, addSpacing = false, success | |
| icon={Star} | ||
| success={success} | ||
| text={freeTrialText} | ||
| iconWrapperStyles={[styles.mw100]} | ||
|
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. What's the purpose of this line 🤔 ?
Contributor
Author
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. Previously freeTrial button was taking all width on smallScreen that was enough to display all the text when we change the language to spanish, but now since the button is in row and when we switch the language to spanish, text overflows, to get the ellipsis i added mw100 here |
||
| onPress={() => Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION.getRoute(Navigation.getActiveRoute()))} | ||
| /> | ||
| ) : ( | ||
|
|
@@ -56,7 +57,7 @@ function FreeTrial({badgeStyles, pressable = false, addSpacing = false, success | |
| /> | ||
| ); | ||
|
|
||
| return addSpacing ? <View style={inARow ? [styles.pb3, styles.pr5, styles.w50, styles.pl1] : [styles.pb3, styles.ph5]}>{freeTrial}</View> : freeTrial; | ||
| return addSpacing ? <View style={inARow ? [styles.pb3, styles.w50, styles.pl1] : [styles.pb3, styles.ph5]}>{freeTrial}</View> : freeTrial; | ||
| } | ||
|
|
||
| FreeTrial.displayName = 'FreeTrial'; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.