Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5001,11 +5001,9 @@ const CONST = {
CONTENT_TYPES: {
SUBMIT_EXPENSE: 'submitExpense',
START_CHAT: 'startChat',
PAY_SOMEONE: 'paySomeone',
REFER_FRIEND: 'referralFriend',
SHARE_CODE: 'shareCode',
},
REVENUE: 250,
LEARN_MORE_LINK: 'https://help.expensify.com/articles/new-expensify/expenses/Referral-Program',
LINK: 'https://join.my.expensify.com',
},
Expand Down
19 changes: 2 additions & 17 deletions src/components/EmptySelectionListContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@ import {View} from 'react-native';
import type {TupleToUnion} from 'type-fest';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import BlockingView from './BlockingViews/BlockingView';
import * as Illustrations from './Icon/Illustrations';
import ScrollView from './ScrollView';
import Text from './Text';
import TextLink from './TextLink';

type EmptySelectionListContentProps = {
/** Type of selection list */
contentType: string;
};

const CONTENT_TYPES = [CONST.IOU.TYPE.SUBMIT, CONST.IOU.TYPE.SPLIT, CONST.IOU.TYPE.PAY];
const CONTENT_TYPES = [CONST.IOU.TYPE.CREATE];
type ContentType = TupleToUnion<typeof CONTENT_TYPES>;

function isContentType(contentType: unknown): contentType is ContentType {
Expand All @@ -33,19 +30,7 @@ function EmptySelectionListContent({contentType}: EmptySelectionListContentProps
return null;
}

const EmptySubtitle = (
<Text style={[styles.textAlignCenter]}>
{translate(`emptyList.${contentType}.subtitleText1`)}
<TextLink
onPress={() => {
Navigation.navigate(ROUTES.REFERRAL_DETAILS_MODAL.getRoute(CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SUBMIT_EXPENSE, Navigation.getActiveRouteWithoutParams()));
}}
>
{translate(`emptyList.${contentType}.subtitleText2`)}
</TextLink>
{translate(`emptyList.${contentType}.subtitleText3`)}
</Text>
);
const EmptySubtitle = <Text style={[styles.textAlignCenter]}>{translate(`emptyList.${contentType}.subtitleText`)}</Text>;

return (
<ScrollView contentContainerStyle={[styles.flexGrow1]}>
Expand Down
6 changes: 1 addition & 5 deletions src/components/ReferralProgramCTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ import Text from './Text';
import Tooltip from './Tooltip';

type ReferralProgramCTAProps = {
referralContentType:
| typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SUBMIT_EXPENSE
| typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.START_CHAT
| typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.PAY_SOMEONE
| typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND;
referralContentType: typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SUBMIT_EXPENSE | typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.START_CHAT;
style?: StyleProp<ViewStyle>;
onDismiss?: () => void;
};
Expand Down
5 changes: 2 additions & 3 deletions src/hooks/useDismissedReferralBanners.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {useOnyx} from 'react-native-onyx';
import * as User from '@userActions/User';
import {dismissReferralBanner} from '@libs/actions/User';
import type CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';

type UseDismissedReferralBannersProps = {
referralContentType:
| typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SUBMIT_EXPENSE
| typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.START_CHAT
| typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.PAY_SOMEONE
| typeof CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND;
};

Expand All @@ -20,7 +19,7 @@ function useDismissedReferralBanners({referralContentType}: UseDismissedReferral
return;
}
// Set the banner as dismissed
User.dismissReferralBanner(referralContentType);
dismissReferralBanner(referralContentType);
};

return {isDismissed, setAsDismissed};
Expand Down
50 changes: 14 additions & 36 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,23 +626,9 @@ const translations = {
findMember: 'Find a member',
},
emptyList: {
[CONST.IOU.TYPE.SUBMIT]: {
title: 'Submit an expense',
subtitleText1: 'Submit to someone and ',
subtitleText2: `get $${CONST.REFERRAL_PROGRAM.REVENUE}`,
subtitleText3: ' when they become a customer.',
},
[CONST.IOU.TYPE.SPLIT]: {
title: 'Split an expense',
subtitleText1: 'Split with a friend and ',
subtitleText2: `get $${CONST.REFERRAL_PROGRAM.REVENUE}`,
subtitleText3: ' when they become a customer.',
},
[CONST.IOU.TYPE.PAY]: {
title: 'Pay someone',
subtitleText1: 'Pay anyone and ',
subtitleText2: `get $${CONST.REFERRAL_PROGRAM.REVENUE}`,
subtitleText3: ' when they become a customer.',
[CONST.IOU.TYPE.CREATE]: {
title: 'Submit an expense, refer your boss',
subtitleText: "Want your boss to use Expensify, too? Just submit an expense to them and we'll take care of the rest.",
},
},
videoChatButtonAndMenu: {
Expand Down Expand Up @@ -5367,32 +5353,24 @@ const translations = {
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: `Get paid to talk to your friends! Start a chat with a new Expensify account and get $${CONST.REFERRAL_PROGRAM.REVENUE} when they become a customer.`,
buttonText2: 'refer a friend.',
header: 'Start a chat, refer a friend',
body: "Want your friends to use Expensify, too? Just start a chat with them and we'll take care of the rest.",
},
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SUBMIT_EXPENSE]: {
buttonText1: 'Submit an expense, ',
buttonText2: `get $${CONST.REFERRAL_PROGRAM.REVENUE}.`,
header: `Submit an expense, get $${CONST.REFERRAL_PROGRAM.REVENUE}`,
body: `It pays to get paid! Submit an expense to a new Expensify account and get $${CONST.REFERRAL_PROGRAM.REVENUE} when they become a customer.`,
},
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.PAY_SOMEONE]: {
buttonText1: 'Pay someone, ',
buttonText2: `get $${CONST.REFERRAL_PROGRAM.REVENUE}.`,
header: `Pay someone, get $${CONST.REFERRAL_PROGRAM.REVENUE}`,
body: `You gotta spend money to make money! Pay someone with Expensify and get $${CONST.REFERRAL_PROGRAM.REVENUE} when they become a customer.`,
buttonText2: 'refer your boss.',
header: 'Submit an expense, refer your boss',
body: "Want your boss to use Expensify, too? Just submit an expense to them and we'll take care of the rest.",
},
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND]: {
buttonText1: 'Invite a friend, ',
buttonText2: `get $${CONST.REFERRAL_PROGRAM.REVENUE}.`,
header: `Get $${CONST.REFERRAL_PROGRAM.REVENUE}`,
body: `Chat, pay, submit, or split an expense with a friend and get $${CONST.REFERRAL_PROGRAM.REVENUE} when they become a customer. Otherwise, just share your invite link!`,
header: 'Refer a friend',
body: "Want your friends to use Expensify, too? Just chat, pay, or split an expense with them and we'll take care of the rest. Or just share your invite link!",
},
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SHARE_CODE]: {
buttonText1: `Get $${CONST.REFERRAL_PROGRAM.REVENUE}`,
header: `Get $${CONST.REFERRAL_PROGRAM.REVENUE}`,
body: `Chat, pay, submit, or split an expense with a friend and get $${CONST.REFERRAL_PROGRAM.REVENUE} when they become a customer. Otherwise, just share your invite link!`,
buttonText: 'Refer a friend',
header: 'Refer a friend',
body: "Want your friends to use Expensify, too? Just chat, pay, or split an expense with them and we'll take care of the rest. Or just share your invite link!",
},
copyReferralLink: 'Copy invite link',
},
Expand Down
50 changes: 14 additions & 36 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,23 +618,9 @@ const translations = {
findMember: 'Encuentra un miembro',
},
emptyList: {
[CONST.IOU.TYPE.SUBMIT]: {
title: 'Presentar un gasto',
subtitleText1: 'Presente un gasto a alguien y ',
subtitleText2: `recibe ${CONST.REFERRAL_PROGRAM.REVENUE} dólares`,
subtitleText3: ' cuando se convierta en client.',
},
[CONST.IOU.TYPE.SPLIT]: {
title: 'Dividir un gasto',
subtitleText1: 'Divide con un amigo y ',
subtitleText2: `recibe ${CONST.REFERRAL_PROGRAM.REVENUE} dólares`,
subtitleText3: ' cuando se convierta en client.',
},
[CONST.IOU.TYPE.PAY]: {
title: 'Pagar a alguien',
subtitleText1: 'Paga a quien quieras y ',
subtitleText2: `recibe ${CONST.REFERRAL_PROGRAM.REVENUE} dólares`,
subtitleText3: ' cuando se convierta en client.',
[CONST.IOU.TYPE.CREATE]: {
title: 'Presenta un gasto, recomienda a tu jefe',
subtitleText: '¿Quieres que tu jefe también use Expensify? Simplemente envíale un gasto y nosotros nos encargaremos del resto.',
},
},
videoChatButtonAndMenu: {
Expand Down Expand Up @@ -5882,32 +5868,24 @@ const translations = {
referralProgram: {
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.START_CHAT]: {
buttonText1: 'Inicia un chat y ',
buttonText2: `recibe $${CONST.REFERRAL_PROGRAM.REVENUE}`,
header: `Inicia un chat y recibe $${CONST.REFERRAL_PROGRAM.REVENUE}`,
body: `¡Gana dinero por hablar con tus amigos! Inicia un chat con una cuenta nueva de Expensify y recibe $${CONST.REFERRAL_PROGRAM.REVENUE} cuando se conviertan en clientes.`,
buttonText2: 'recomienda a un amigo',
header: 'Inicia un chat, recomienda a un amigo',
body: '¿Quieres que tus amigos también usen Expensify? Simplemente inicia un chat con ellos y nosotros nos encargaremos del resto.',
},
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SUBMIT_EXPENSE]: {
buttonText1: 'Presenta un gasto, ',
buttonText2: `recibe $${CONST.REFERRAL_PROGRAM.REVENUE}`,
header: `Presenta un gasto y consigue $${CONST.REFERRAL_PROGRAM.REVENUE}`,
body: `¡Vale la pena cobrar! Envia un gasto a una cuenta nueva de Expensify y recibe $${CONST.REFERRAL_PROGRAM.REVENUE} cuando se conviertan en clientes.`,
},
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.PAY_SOMEONE]: {
buttonText1: 'Pagar a alguien, ',
buttonText2: `recibe $${CONST.REFERRAL_PROGRAM.REVENUE}`,
header: `Paga a alguien y recibe $${CONST.REFERRAL_PROGRAM.REVENUE}`,
body: `¡Hay que gastar dinero para ganar dinero! Paga a alguien con Expensify y recibe $${CONST.REFERRAL_PROGRAM.REVENUE} cuando se conviertan en clientes.`,
buttonText2: 'recomienda a tu jefe',
header: 'Envía un gasto, recomienda a tu jefe',
body: '¿Quieres que tu jefe también use Expensify? Simplemente envíale un gasto y nosotros nos encargaremos del resto.',
},
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND]: {
buttonText1: 'Invita a un amigo y ',
buttonText2: `recibe $${CONST.REFERRAL_PROGRAM.REVENUE}`,
header: `Recibe $${CONST.REFERRAL_PROGRAM.REVENUE}`,
body: `Chatea, paga, presenta y divide gastos con un amigo y recibirás $${CONST.REFERRAL_PROGRAM.REVENUE} cuando se convierta en cliente. También puedes publicar tu enlace de invitación en las redes sociales.`,
header: 'Recomienda a un amigo',
body: '¿Quieres que tus amigos también usen Expensify? Simplemente chatea, paga o divide un gasto con ellos y nosotros nos encargaremos del resto. ¡O simplemente comparte tu enlace de invitación!',
},
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SHARE_CODE]: {
buttonText1: `Recibe $${CONST.REFERRAL_PROGRAM.REVENUE}`,
header: `Recibe $${CONST.REFERRAL_PROGRAM.REVENUE}`,
body: `Chatea, paga, presenta y divide gastos con un amigo y recibirás $${CONST.REFERRAL_PROGRAM.REVENUE} cuando se convierta en cliente. También puedes publicar tu enlace de invitación en las redes sociales.`,
buttonText: 'Recomienda a un amigo',
header: 'Recomienda a un amigo',
body: '¿Quieres que tus amigos también usen Expensify? Simplemente chatea, paga o divide un gasto con ellos y nosotros nos encargaremos del resto. ¡O simplemente comparte tu enlace de invitación!',
},
copyReferralLink: 'Copiar enlace de invitación',
},
Expand Down
42 changes: 26 additions & 16 deletions src/pages/ShareCodePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,20 @@ import useThemeStyles from '@hooks/useThemeStyles';
import Clipboard from '@libs/Clipboard';
import Navigation from '@libs/Navigation/Navigation';
import type {BackToParams} from '@libs/Navigation/types';
import * as ReportUtils from '@libs/ReportUtils';
import {
getChatRoomSubtitle,
getDefaultWorkspaceAvatar,
getDisplayNameForParticipant,
getParentNavigationSubtitle,
getParticipantsAccountIDsForDisplay,
getPolicyName,
getReportName,
isExpenseReport,
isMoneyRequestReport,
} from '@libs/ReportUtils';
import shouldAllowDownloadQRCode from '@libs/shouldAllowDownloadQRCode';
import * as Url from '@libs/Url';
import * as UserUtils from '@libs/UserUtils';
import {addTrailingForwardSlash} from '@libs/Url';
import {getAvatarUrl} from '@libs/UserUtils';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import type {Policy, Report} from '@src/types/onyx';
Expand Down Expand Up @@ -68,37 +78,37 @@ function ShareCodePage({report, policy, backTo}: ShareCodePageProps) {

const subtitle = useMemo(() => {
if (isReport) {
if (ReportUtils.isExpenseReport(report)) {
return ReportUtils.getPolicyName({report});
if (isExpenseReport(report)) {
return getPolicyName({report});
}
if (ReportUtils.isMoneyRequestReport(report)) {
if (isMoneyRequestReport(report)) {
// generate subtitle from participants
return ReportUtils.getParticipantsAccountIDsForDisplay(report, true)
.map((accountID) => ReportUtils.getDisplayNameForParticipant({accountID}))
return getParticipantsAccountIDsForDisplay(report, true)
.map((accountID) => getDisplayNameForParticipant({accountID}))
.join(' & ');
}

return ReportUtils.getParentNavigationSubtitle(report).workspaceName ?? ReportUtils.getChatRoomSubtitle(report);
return getParentNavigationSubtitle(report).workspaceName ?? getChatRoomSubtitle(report);
}

return currentUserPersonalDetails.login;
}, [report, currentUserPersonalDetails, isReport]);

const title = isReport ? ReportUtils.getReportName(report) : currentUserPersonalDetails.displayName ?? '';
const urlWithTrailingSlash = Url.addTrailingForwardSlash(environmentURL);
const title = isReport ? getReportName(report) : currentUserPersonalDetails.displayName ?? '';
const urlWithTrailingSlash = addTrailingForwardSlash(environmentURL);
const url = isReport
? `${urlWithTrailingSlash}${ROUTES.REPORT_WITH_ID.getRoute(report.reportID)}`
: `${urlWithTrailingSlash}${ROUTES.PROFILE.getRoute(currentUserPersonalDetails.accountID ?? -1)}`;
: `${urlWithTrailingSlash}${ROUTES.PROFILE.getRoute(currentUserPersonalDetails.accountID ?? CONST.DEFAULT_NUMBER_ID)}`;

const logo = isReport ? getLogoForWorkspace(report, policy) : (UserUtils.getAvatarUrl(currentUserPersonalDetails?.avatar, currentUserPersonalDetails?.accountID) as ImageSourcePropType);
const logo = isReport ? getLogoForWorkspace(report, policy) : (getAvatarUrl(currentUserPersonalDetails?.avatar, currentUserPersonalDetails?.accountID) as ImageSourcePropType);

// Default logos (avatars) are SVG and they require some special logic to display correctly
let svgLogo: React.FC<SvgProps> | undefined;
let logoBackgroundColor: string | undefined;
let svgLogoFillColor: string | undefined;

if (!logo && policy && !policy.avatarURL) {
svgLogo = ReportUtils.getDefaultWorkspaceAvatar(policy.name) || Expensicons.FallbackAvatar;
svgLogo = getDefaultWorkspaceAvatar(policy.name) || Expensicons.FallbackAvatar;

const defaultWorkspaceAvatarColors = StyleUtils.getDefaultWorkspaceAvatarColor(policy.id);
logoBackgroundColor = defaultWorkspaceAvatarColors.backgroundColor?.toString();
Expand All @@ -119,7 +129,7 @@ function ShareCodePage({report, policy, backTo}: ShareCodePageProps) {
url={url}
title={title}
subtitle={subtitle}
logo={isReport ? expensifyLogo : (UserUtils.getAvatarUrl(currentUserPersonalDetails?.avatar, currentUserPersonalDetails?.accountID) as ImageSourcePropType)}
logo={isReport ? expensifyLogo : (getAvatarUrl(currentUserPersonalDetails?.avatar, currentUserPersonalDetails?.accountID) as ImageSourcePropType)}
logoRatio={isReport ? CONST.QR.EXPENSIFY_LOGO_SIZE_RATIO : CONST.QR.DEFAULT_LOGO_SIZE_RATIO}
logoMarginRatio={isReport ? CONST.QR.EXPENSIFY_LOGO_MARGIN_RATIO : CONST.QR.DEFAULT_LOGO_MARGIN_RATIO}
svgLogo={svgLogo}
Expand Down Expand Up @@ -152,7 +162,7 @@ function ShareCodePage({report, policy, backTo}: ShareCodePageProps) {
)}

<MenuItem
title={translate(`referralProgram.${CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SHARE_CODE}.buttonText1`)}
title={translate(`referralProgram.${CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SHARE_CODE}.buttonText`)}
icon={Expensicons.Cash}
onPress={() => Navigation.navigate(ROUTES.REFERRAL_DETAILS_MODAL.getRoute(CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SHARE_CODE, Navigation.getActiveRoute()))}
shouldShowRightIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function MoneyRequestParticipantsSelector({participants = CONST.EMPTY_ARRAY, onF
const {translate} = useLocalize();
const styles = useThemeStyles();
const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState('');
const referralContentType = iouType === CONST.IOU.TYPE.PAY ? CONST.REFERRAL_PROGRAM.CONTENT_TYPES.PAY_SOMEONE : CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SUBMIT_EXPENSE;
const referralContentType = CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SUBMIT_EXPENSE;
const {isOffline} = useNetwork();
const personalDetails = usePersonalDetails();
const {isDismissed} = useDismissedReferralBanners({referralContentType});
Expand Down
3 changes: 0 additions & 3 deletions src/types/onyx/DismissedReferralBanners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ type DismissedReferralBanners = {
/** Is 'Start chat' referral dismissed */
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.START_CHAT]?: boolean;

/** Is 'Pay someone' referral dismissed */
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.PAY_SOMEONE]?: boolean;

/** Is 'Refer friend' referral dismissed */
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND]?: boolean;

Expand Down