-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Free trial] Implement and show Trial Ended banner, Expensify DM GBR and custom Expensify DM chat item in the App after Free Trial ends #44483
Merged
chiragsalian
merged 20 commits into
Expensify:main
from
callstack-internal:pac-guerreiro/feature/43671-trial-ended-banner-expensify-dm-gbr-and-custom-chat-item
Jul 11, 2024
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1c35f4d
feat: add trial ended banner and update related UI
pac-guerreiro d6e2f36
refactor: remove unnecessary text wrapper
pac-guerreiro 8fc1eba
Merge branch 'pac-guerreiro/feature/43672-implement-and-show-free-tri…
pac-guerreiro ace1c18
Merge branch 'pac-guerreiro/feature/43672-implement-and-show-free-tri…
pac-guerreiro 978af7e
Merge branch 'pac-guerreiro/feature/43672-implement-and-show-free-tri…
pac-guerreiro d3dc428
Merge branch 'pac-guerreiro/feature/43672-implement-and-show-free-tri…
pac-guerreiro a2f0e84
refactor: apply suggestions
pac-guerreiro 21554b9
Merge branch 'pac-guerreiro/feature/43672-implement-and-show-free-tri…
pac-guerreiro 5e8e967
Merge branch 'main' into pac-guerreiro/feature/43671-trial-ended-bann…
pac-guerreiro 222e524
Merge branch 'main' into pac-guerreiro/feature/43671-trial-ended-bann…
pac-guerreiro a36a47c
Merge branch 'main' into pac-guerreiro/feature/43671-trial-ended-bann…
pac-guerreiro bc13f9a
fix: free trial ended not showing as report last message in LHN
pac-guerreiro 38a11b6
fix: GBR not showing in concierge chat option in LHN
pac-guerreiro 174c48b
Merge branch 'main' into pac-guerreiro/feature/43671-trial-ended-bann…
pac-guerreiro bc06a92
Merge branch 'main' into pac-guerreiro/feature/43671-trial-ended-bann…
pac-guerreiro 3e1992a
Merge branch 'main' into pac-guerreiro/feature/43671-trial-ended-bann…
pac-guerreiro 16dd7a2
Merge branch 'main' into pac-guerreiro/feature/43671-trial-ended-bann…
pac-guerreiro 79b3671
refactor: add isConciergeChat property to OptionData and check for it
pac-guerreiro cfb59ee
Merge branch 'main' into pac-guerreiro/feature/43671-trial-ended-bann…
pac-guerreiro 531e0be
chore: fix linter issue
pac-guerreiro 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
37 changes: 37 additions & 0 deletions
37
assets/images/simple-illustrations/simple-illustration__tire.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -438,6 +438,7 @@ type OptionData = { | |
shouldShowAmountInput?: boolean; | ||
amountInputProps?: MoneyRequestAmountInputProps; | ||
tabIndex?: 0 | -1; | ||
isConciergeChat?: boolean; | ||
} & Report; | ||
|
||
type OnyxDataTaskAssigneeChat = { | ||
|
@@ -7079,8 +7080,10 @@ function shouldShowMerchantColumn(transactions: Transaction[]) { | |
/** | ||
* Whether the report is a system chat or concierge chat, depending on the user's account ID (used for A/B testing purposes). | ||
*/ | ||
function isChatUsedForOnboarding(report: OnyxEntry<Report>): boolean { | ||
return AccountUtils.isAccountIDOddNumber(currentUserAccountID ?? -1) ? isSystemChat(report) : isConciergeChatReport(report); | ||
function isChatUsedForOnboarding(optionOrReport: OnyxEntry<Report> | OptionData): boolean { | ||
return AccountUtils.isAccountIDOddNumber(currentUserAccountID ?? -1) | ||
? isSystemChat(optionOrReport) | ||
: (optionOrReport as OptionData).isConciergeChat ?? isConciergeChatReport(optionOrReport); | ||
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. We should had used optional chaining here, this caused the app to crash and caused the issue #45492 |
||
} | ||
|
||
/** | ||
|
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type ShouldRenderAddPaymentCard from './types'; | ||
|
||
const shouldRenderAddPaymentCard: ShouldRenderAddPaymentCard = () => false; | ||
|
||
export default shouldRenderAddPaymentCard; |
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type ShouldRenderAddPaymentCard from './types'; | ||
|
||
const shouldRenderAddPaymentCard: ShouldRenderAddPaymentCard = () => true; | ||
|
||
export default shouldRenderAddPaymentCard; |
This file contains 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type ShouldRenderAddPaymentCard = () => boolean; | ||
|
||
export default ShouldRenderAddPaymentCard; |
This file contains 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
20 changes: 20 additions & 0 deletions
20
src/pages/settings/Subscription/CardSection/BillingBanner/TrialEndedBillingBanner.tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import * as Illustrations from '@components/Icon/Illustrations'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import BillingBanner from './BillingBanner'; | ||
|
||
function TrialEndedBillingBanner() { | ||
const {translate} = useLocalize(); | ||
|
||
return ( | ||
<BillingBanner | ||
title={translate('subscription.billingBanner.trialEnded.title')} | ||
subtitle={translate('subscription.billingBanner.trialEnded.subtitle')} | ||
icon={Illustrations.Tire} | ||
/> | ||
); | ||
} | ||
|
||
TrialEndedBillingBanner.displayName = 'TrialEndedBillingBanner'; | ||
|
||
export default TrialEndedBillingBanner; |
This file contains 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 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the return type
ReportAction
here? Shouldn't it beboolean
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rojiphil
We're applying a type predicate - https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates
Not only does this function return a boolean, it also tells the compiler that the argument we passed to it is a specific subtype of
ReportAction
, which allows us developers to easily access it's properties without the need to do manual assertions.I hope this answers your requestion 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. That's cool. Thanks.