-
Notifications
You must be signed in to change notification settings - Fork 4k
Set workspace address when attempting to Book Travel #46333
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
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
87c12ef
rm padding for nested lists
rushatgabhane 4edafe6
Merge branch 'main' of github.com:rushatgabhane/exfy into margin
rushatgabhane 306d765
use h3 heading
rushatgabhane d11b1e9
navigate to company address if not present
rushatgabhane 6581442
Revert "use h3 heading"
rushatgabhane e4ffa8a
Revert "rm padding for nested lists"
rushatgabhane 548c4fa
undo unrelated commits
rushatgabhane 0e6502a
undo unrelated commits
rushatgabhane d3e3498
get policy from onyx and show loading indicator
rushatgabhane 186354a
show error message for cta
rushatgabhane 1c0c1ef
add generic error for travel
rushatgabhane 19b0e29
handle error in open travel dot
rushatgabhane cf750a6
null checks for promise response
rushatgabhane a773eb6
null checks for promise response
rushatgabhane cd7e464
set error message if failed to open travel dot
rushatgabhane 3167b61
reject if unable to generate spotnana token
rushatgabhane e94ef7c
show error message if error in spotnana token while accepting terms
rushatgabhane 458ecb7
Merge branch 'Expensify:main' into travel-address
rushatgabhane 643a76e
fix type
rushatgabhane 8e1ef1c
Merge branch 'main' into travel-address
rushatgabhane 4bd56f7
Merge branch 'main' of github.com:rushatgabhane/exfy into travel-address
rushatgabhane ba72d49
add test account key
rushatgabhane a80e443
connect to test account key and use it for building travel dot url
rushatgabhane 4c663df
rm unused code
rushatgabhane 9d395c6
cleanup
rushatgabhane ddd0558
undo async url changes
rushatgabhane e8e5868
throw err for async to be caught
rushatgabhane aa023c2
throw err for async to be caught
rushatgabhane 76b5379
catch err
rushatgabhane 152b577
catch err
rushatgabhane 4d6011f
Merge branch 'main' into travel-address
rushatgabhane 90ba0ff
log warning
rushatgabhane f54c790
log warning
rushatgabhane 6b8cfa5
change warn msg
rushatgabhane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,14 +1,19 @@ | ||
| import {Linking} from 'react-native'; | ||
| import Log from '@libs/Log'; | ||
| import type AsyncOpenURL from './types'; | ||
|
|
||
| const asyncOpenURL: AsyncOpenURL = (promise, url) => { | ||
| if (!url) { | ||
| return; | ||
| } | ||
|
|
||
| promise.then((params) => { | ||
| Linking.openURL(typeof url === 'string' ? url : url(params)); | ||
| }); | ||
| promise | ||
| .then((params) => { | ||
| Linking.openURL(typeof url === 'string' ? url : url(params)); | ||
| }) | ||
| .catch(() => { | ||
| Log.warn('[asyncOpenURL] error occured while opening URL', {url}); | ||
| }); | ||
| }; | ||
|
|
||
| export default asyncOpenURL; |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| import React from 'react'; | ||
| import React, {useState} from 'react'; | ||
| import {Linking, View} from 'react-native'; | ||
| import {useOnyx} from 'react-native-onyx'; | ||
| import type {FeatureListItem} from '@components/FeatureList'; | ||
| import FeatureList from '@components/FeatureList'; | ||
| import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; | ||
| import * as Illustrations from '@components/Icon/Illustrations'; | ||
| import ScrollView from '@components/ScrollView'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
|
|
@@ -14,6 +15,7 @@ import * as Link from '@userActions/Link'; | |
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import ROUTES from '@src/ROUTES'; | ||
| import {isEmptyObject} from '@src/types/utils/EmptyObject'; | ||
|
|
||
| const tripsFeatures: FeatureListItem[] = [ | ||
| { | ||
|
|
@@ -32,8 +34,16 @@ function ManageTrips() { | |
| const {translate} = useLocalize(); | ||
| const [travelSettings] = useOnyx(ONYXKEYS.NVP_TRAVEL_SETTINGS); | ||
| const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); | ||
| const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`); | ||
|
|
||
| const [ctaErrorMessage, setCtaErrorMessage] = useState(''); | ||
|
|
||
| if (isEmptyObject(policy)) { | ||
| return <FullScreenLoadingIndicator />; | ||
| } | ||
|
|
||
| const hasAcceptedTravelTerms = travelSettings?.hasAcceptedTerms; | ||
| const hasPolicyAddress = !isEmptyObject(policy?.address); | ||
|
|
||
| const navigateToBookTravelDemo = () => { | ||
| Linking.openURL(CONST.BOOK_TRAVEL_DEMO_URL); | ||
|
|
@@ -49,12 +59,22 @@ function ManageTrips() { | |
| ctaText={translate('travel.bookTravel')} | ||
| ctaAccessibilityLabel={translate('travel.bookTravel')} | ||
| onCtaPress={() => { | ||
| if (!hasPolicyAddress) { | ||
| Navigation.navigate(ROUTES.WORKSPACE_PROFILE_ADDRESS.getRoute(activePolicyID ?? '-1')); | ||
|
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. Not using |
||
| return; | ||
| } | ||
| if (!hasAcceptedTravelTerms) { | ||
| Navigation.navigate(ROUTES.TRAVEL_TCS); | ||
| return; | ||
| } | ||
| Link.openTravelDotLink(activePolicyID); | ||
| if (ctaErrorMessage) { | ||
| setCtaErrorMessage(''); | ||
| } | ||
| Link.openTravelDotLink(activePolicyID)?.catch(() => { | ||
| setCtaErrorMessage(translate('travel.errorMessage')); | ||
| }); | ||
| }} | ||
| ctaErrorMessage={ctaErrorMessage} | ||
| illustration={Illustrations.EmptyStateTravel} | ||
| illustrationStyle={[styles.mv4, styles.tripIllustrationSize]} | ||
| secondaryButtonText={translate('travel.bookDemo')} | ||
|
|
||
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.