Skip to content

Commit

Permalink
Merge pull request #12 from software-mansion-labs/travel/terms-and-co…
Browse files Browse the repository at this point in the history
…nditions

Travel/terms and conditions
  • Loading branch information
rushatgabhane authored May 2, 2024
2 parents f851f57 + 76cc3e3 commit bb8ad52
Show file tree
Hide file tree
Showing 30 changed files with 415 additions and 4 deletions.
Binary file added assets/animations/Plane.lottie
Binary file not shown.
15 changes: 15 additions & 0 deletions assets/images/simple-illustrations/simple-illustration__alert.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/images/suitcase.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,10 @@ const ROUTES = {
route: 'referral/:contentType',
getRoute: (contentType: string, backTo?: string) => getUrlWithBackToParam(`referral/${contentType}`, backTo),
},
TRACK_TRAINING_MODAL: 'track-training',
PROCESS_MONEY_REQUEST_HOLD: 'hold-expense-educational',
TRAVEL_MY_TRIPS: 'travel',
TRAVEL_TCS: 'travel/terms',
TRACK_TRAINING_MODAL: 'track-training',
ONBOARDING_ROOT: 'onboarding',
ONBOARDING_PERSONAL_DETAILS: 'onboarding/personal-details',
ONBOARDING_WORK: 'onboarding/work',
Expand Down
5 changes: 5 additions & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const SCREENS = {
CONNECTION_COMPLETE: 'ConnectionComplete',
UNLINK_LOGIN: 'UnlinkLogin',
SETTINGS_CENTRAL_PANE: 'SettingsCentralPane',
TRAVEL: {
MY_TRIPS: 'Travel_MyTrips',
TCS: 'Travel_TCS',
},
WORKSPACES_CENTRAL_PANE: 'WorkspacesCentralPane',
SEARCH: {
CENTRAL_PANE: 'Search_Central_Pane',
Expand Down Expand Up @@ -133,6 +137,7 @@ const SCREENS = {
ROOM_INVITE: 'RoomInvite',
REFERRAL: 'Referral',
PROCESS_MONEY_REQUEST_HOLD: 'ProcessMoneyRequestHold',
TRAVEL: 'Travel',
SEARCH_REPORT: 'SearchReport',
},
ONBOARDING_MODAL: {
Expand Down
12 changes: 11 additions & 1 deletion src/components/FeatureList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import {View} from 'react-native';
import type {StyleProp, ViewStyle} from 'react-native';
import type {StyleProp, TextStyle, ViewStyle} from 'react-native';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import variables from '@styles/variables';
Expand Down Expand Up @@ -43,6 +43,12 @@ type FeatureListProps = {

/** The background color to apply in the upper half of the screen. */
illustrationBackgroundColor?: string;

/** The style used for the title */
titleStyles?: StyleProp<TextStyle>;

/** Padding for content on large screens */
contentPaddingOnLargeScreens?: {padding: number};
};

function FeatureList({
Expand All @@ -55,6 +61,8 @@ function FeatureList({
illustration,
illustrationStyle,
illustrationBackgroundColor,
titleStyles,
contentPaddingOnLargeScreens,
}: FeatureListProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand All @@ -68,6 +76,8 @@ function FeatureList({
illustration={illustration}
illustrationBackgroundColor={illustrationBackgroundColor}
illustrationStyle={illustrationStyle}
titleStyles={titleStyles}
contentPaddingOnLargeScreens={contentPaddingOnLargeScreens}
>
<View style={styles.flex1}>
<View style={[styles.flex1, styles.flexRow, styles.flexWrap, styles.rowGap4, styles.pv4, styles.pl1]}>
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ import Podcast from '@assets/images/social-podcast.svg';
import Twitter from '@assets/images/social-twitter.svg';
import Youtube from '@assets/images/social-youtube.svg';
import Stopwatch from '@assets/images/stopwatch.svg';
import Suitcase from '@assets/images/suitcase.svg';
import Sync from '@assets/images/sync.svg';
import Tag from '@assets/images/tag.svg';
import Task from '@assets/images/task.svg';
Expand Down Expand Up @@ -302,6 +303,7 @@ export {
Send,
Shield,
Stopwatch,
Suitcase,
Sync,
Task,
ThumbsUp,
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Illustrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import ThreeLeggedLaptopWoman from '@assets/images/product-illustrations/three_l
import ToddBehindCloud from '@assets/images/product-illustrations/todd-behind-cloud.svg';
import Abacus from '@assets/images/simple-illustrations/simple-illustration__abacus.svg';
import Accounting from '@assets/images/simple-illustrations/simple-illustration__accounting.svg';
import Alert from '@assets/images/simple-illustrations/simple-illustration__alert.svg';
import Approval from '@assets/images/simple-illustrations/simple-illustration__approval.svg';
import BankArrow from '@assets/images/simple-illustrations/simple-illustration__bank-arrow.svg';
import BigRocket from '@assets/images/simple-illustrations/simple-illustration__bigrocket.svg';
Expand Down Expand Up @@ -160,6 +161,7 @@ export {
Workflows,
ThreeLeggedLaptopWoman,
House,
Alert,
TeachersUnite,
Abacus,
Binoculars,
Expand Down
5 changes: 5 additions & 0 deletions src/components/LottieAnimations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ const DotLottieAnimations = {
w: 200,
h: 120,
},
Plane: {
file: require('@assets/animations/Plane.lottie'),
w: 180,
h: 200,
},
} satisfies Record<string, DotLottieAnimation>;

export default DotLottieAnimations;
6 changes: 5 additions & 1 deletion src/components/Section/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ type SectionProps = ChildrenProps & {
/** Styles to apply to illustration component */
illustrationStyle?: StyleProp<ViewStyle>;

/** Padding for content on large screens */
contentPaddingOnLargeScreens?: {padding: number};

/** Overlay content to display on top of animation */
overlayContent?: () => ReactNode;

Expand All @@ -92,6 +95,7 @@ function Section({
illustration,
illustrationBackgroundColor,
illustrationStyle,
contentPaddingOnLargeScreens,
overlayContent,
renderSubtitle,
}: SectionProps) {
Expand Down Expand Up @@ -124,7 +128,7 @@ function Section({
{overlayContent?.()}
</View>
)}
<View style={[styles.w100, isCentralPane && (isSmallScreenWidth ? styles.p5 : styles.p8)]}>
<View style={[styles.w100, isCentralPane && (isSmallScreenWidth ? styles.p5 : contentPaddingOnLargeScreens ?? styles.p8)]}>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.w100, cardLayout === CARD_LAYOUT.ICON_ON_TOP && styles.mh1]}>
{cardLayout === CARD_LAYOUT.ICON_ON_LEFT && (
<IconSection
Expand Down
22 changes: 22 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1837,6 +1837,28 @@ export default {
session: {
offlineMessageRetry: "Looks like you're offline. Please check your connection and try again.",
},
travel: {
header: 'Book travel',
title: 'Travel smart',
subtitle: 'Use Expensify Travel to get the best travel offers and manage all your business expenses in one place.',
features: {
saveMoney: 'Save money on your bookings',
alerts: 'Get real time updates and alerts',
},
bookTravel: 'Book travel',
termsAndConditions: {
header: 'Before we continue...',
title: 'Please read the Terms & Conditions for travel',
subtitle: 'To enable travel on your workspace you must agree to our ',
termsconditions: 'terms & conditions',
travelTermsAndConditions: 'terms & conditions',
helpDocIntro: 'Check out this ',
helpDocOutro: 'for more information or reach out to Concierge or your Account Manager.',
helpDoc: 'Help Doc',
agree: 'I agree to the travel ',
error: 'You must accept the Terms & Conditions for travel to continue',
},
},
workspace: {
common: {
card: 'Cards',
Expand Down
22 changes: 22 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,28 @@ export default {
session: {
offlineMessageRetry: 'Parece que estás desconectado. Por favor, comprueba tu conexión e inténtalo de nuevo.',
},
travel: {
header: 'Reservar viajes',
title: 'Viaja de forma inteligente',
subtitle: 'Utiliza Expensify Travel para obtener las mejores ofertas de viaje y gestionar todos los gastos de tu negocio en un solo lugar.',
features: {
saveMoney: 'Ahorra dinero en tus reservas',
alerts: 'Obtén actualizaciones y alertas en tiempo real',
},
bookTravel: 'Reservar viajes',
termsAndConditions: {
header: 'Antes de continuar...',
title: 'Por favor, lee los Términos y condiciones para reservar viajes',
subtitle: 'Para permitir la opción de reservar viajes en su espacio de trabajo debe aceptar nuestros ',
termsconditions: 'términos y condiciones',
travelTermsAndConditions: 'términos y condiciones de viaje',
helpDocIntro: 'Consulta este ',
helpDocOutro: 'para obtener más información o comunícate con Concierge o tu gestor de cuentas.',
helpDoc: 'documento de ayuda',
agree: 'Acepto los ',
error: 'Debes aceptar los Términos y condiciones para que el viaje continúe',
},
},
workspace: {
common: {
card: 'Tarjetas',
Expand Down
2 changes: 2 additions & 0 deletions src/libs/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ const WRITE_COMMANDS = {
CATEGORIZE_TRACKED_EXPENSE: 'CategorizeTrackedExpense',
SHARE_TRACKED_EXPENSE: 'ShareTrackedExpense',
LEAVE_POLICY: 'LeavePolicy',
ACCEPT_SPOTNANA_TERMS: 'AcceptSpotnanaTerms',
SEND_INVOICE: 'SendInvoice',
} as const;

Expand Down Expand Up @@ -427,6 +428,7 @@ type WriteCommandParameters = {
[WRITE_COMMANDS.CATEGORIZE_TRACKED_EXPENSE]: Parameters.CategorizeTrackedExpenseParams;
[WRITE_COMMANDS.SHARE_TRACKED_EXPENSE]: Parameters.ShareTrackedExpenseParams;
[WRITE_COMMANDS.LEAVE_POLICY]: Parameters.LeavePolicyParams;
[WRITE_COMMANDS.ACCEPT_SPOTNANA_TERMS]: EmptyObject;
[WRITE_COMMANDS.SEND_INVOICE]: Parameters.SendInvoiceParams;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import type {
SplitDetailsNavigatorParamList,
TaskDetailsNavigatorParamList,
TeachersUniteNavigatorParamList,
TravelNavigatorParamList,
WalletStatementNavigatorParamList,
WorkspaceSwitcherNavigatorParamList,
} from '@navigation/types';
Expand Down Expand Up @@ -96,6 +97,11 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator<MoneyRequestNa
[SCREENS.MONEY_REQUEST.STATE_SELECTOR]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default as React.ComponentType,
});

const TravelModalStackNavigator = createModalStackNavigator<TravelNavigatorParamList>({
[SCREENS.TRAVEL.MY_TRIPS]: () => require('../../../../pages/Travel/MyTripsPage').default as React.ComponentType,
[SCREENS.TRAVEL.TCS]: () => require('../../../../pages/Travel/TravelTerms').default as React.ComponentType,
});

const SplitDetailsModalStackNavigator = createModalStackNavigator<SplitDetailsNavigatorParamList>({
[SCREENS.SPLIT_DETAILS.ROOT]: () => require('../../../../pages/iou/SplitBillDetailsPage').default as React.ComponentType,
});
Expand Down Expand Up @@ -364,6 +370,7 @@ export {
PrivateNotesModalStackNavigator,
ProfileModalStackNavigator,
ReferralModalStackNavigator,
TravelModalStackNavigator,
WorkspaceSwitcherModalStackNavigator,
ReimbursementAccountModalStackNavigator,
ReportDetailsModalStackNavigator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ function RightModalNavigator({navigation}: RightModalNavigatorProps) {
name="ProcessMoneyRequestHold"
component={ModalStackNavigators.ProcessMoneyRequestHoldStackNavigator}
/>
<Stack.Screen
name={SCREENS.RIGHT_MODAL.TRAVEL}
component={ModalStackNavigators.TravelModalStackNavigator}
/>
<Stack.Screen
name={SCREENS.RIGHT_MODAL.SEARCH_REPORT}
component={ModalStackNavigators.SearchReportModalStackNavigator}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ function BottomTabBar({isLoadingApp = false}: PurposeForUsingExpensifyModalProps
const navigationState = navigation.getState() as State<RootStackParamList> | undefined;
const routes = navigationState?.routes;
const currentRoute = routes?.[navigationState?.index ?? 0];

// When we are redirected to the Settings tab from the OldDot, we don't want to call the Welcome.show() method.
// To prevent this, the value of the bottomTabRoute?.name is checked here
if (Boolean(currentRoute && currentRoute.name !== NAVIGATORS.BOTTOM_TAB_NAVIGATOR && currentRoute.name !== NAVIGATORS.CENTRAL_PANE_NAVIGATOR) || Session.isAnonymousUser()) {
return;
}
Expand Down
6 changes: 6 additions & 0 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,12 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
[SCREENS.PROCESS_MONEY_REQUEST_HOLD_ROOT]: ROUTES.PROCESS_MONEY_REQUEST_HOLD,
},
},
[SCREENS.RIGHT_MODAL.TRAVEL]: {
screens: {
[SCREENS.TRAVEL.MY_TRIPS]: ROUTES.TRAVEL_MY_TRIPS,
[SCREENS.TRAVEL.TCS]: ROUTES.TRAVEL_TCS,
},
},
[SCREENS.RIGHT_MODAL.SEARCH_REPORT]: {
screens: {
[SCREENS.SEARCH.REPORT_RHP]: ROUTES.SEARCH_REPORT.route,
Expand Down
7 changes: 7 additions & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,12 @@ type RightModalNavigatorParamList = {
[SCREENS.RIGHT_MODAL.PROCESS_MONEY_REQUEST_HOLD]: NavigatorScreenParams<ProcessMoneyRequestHoldNavigatorParamList>;
[SCREENS.RIGHT_MODAL.REFERRAL]: NavigatorScreenParams<ReferralDetailsNavigatorParamList>;
[SCREENS.RIGHT_MODAL.PRIVATE_NOTES]: NavigatorScreenParams<PrivateNotesNavigatorParamList>;
[SCREENS.RIGHT_MODAL.TRAVEL]: NavigatorScreenParams<TravelNavigatorParamList>;
[SCREENS.RIGHT_MODAL.SEARCH_REPORT]: NavigatorScreenParams<SearchReportParamList>;
};

type TravelNavigatorParamList = {
[SCREENS.TRAVEL.MY_TRIPS]: undefined;
[SCREENS.RIGHT_MODAL.SEARCH_REPORT]: NavigatorScreenParams<SearchReportParamList>;
};

Expand Down Expand Up @@ -931,6 +937,7 @@ export type {
State,
StateOrRoute,
SwitchPolicyIDParams,
TravelNavigatorParamList,
TaskDetailsNavigatorParamList,
TeachersUniteNavigatorParamList,
WalletStatementNavigatorParamList,
Expand Down
26 changes: 26 additions & 0 deletions src/libs/actions/Travel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type {OnyxUpdate} from 'react-native-onyx';
import * as API from '@libs/API';
import {WRITE_COMMANDS} from '@libs/API/types';
import ONYXKEYS from '@src/ONYXKEYS';

/**
* Accept Spotnana terms and conditions to receive a proper token used for authenticating further actions
*/
function acceptSpotnanaTerms() {
const successData: OnyxUpdate[] = [
{
onyxMethod: 'merge',
key: ONYXKEYS.ACCOUNT,
value: {
travelSettings: {
hasAcceptedTerms: true,
},
},
},
];

API.write(WRITE_COMMANDS.ACCEPT_SPOTNANA_TERMS, {}, {successData});
}

// eslint-disable-next-line import/prefer-default-export
export {acceptSpotnanaTerms};
Loading

0 comments on commit bb8ad52

Please sign in to comment.