-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[No QA][Free trial] Implement all Free Trials utility functions #43844
[No QA][Free trial] Implement all Free Trials utility functions #43844
Conversation
…nyx-keys-and-utility-functions
…nyx-keys-and-utility-functions
…nyx-keys-and-utility-functions
@hoangzinh Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
src/libs/SubscriptionUtils.ts
Outdated
} | ||
|
||
const currentDate = new Date(); | ||
const difference = differenceInCalendarDays(parseDate(lastDayFreeTrial, CONST.DATE.FNS_DATE_TIME_FORMAT_STRING, currentDate), currentDate); |
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.
Would not difference
become 0
when the currentDate
is lastDayFreeTrial
and be considered as trial ended even when it has not really ended?
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.
Adjusted the logic to calculate with second precision cc @chiragsalian
src/libs/SubscriptionUtils.ts
Outdated
|
||
// If it reached here it means that the user is actually the workspace's owner. | ||
// We should restrict the workspace's owner actions if it's past its grace period end date and it's owing some amount. | ||
if (ownerBillingGraceEndPeriod && amountOwed !== undefined && isAfter(currentDate, fromUnixTime(ownerBillingGraceEndPeriod))) { |
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.
Can amountOwed
have a value of 0
? In that case, it will be considered that the workspace owner owes some amount (as we only have undefined
check) thereby restricting user billable actions. This does not seem correct.
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.
Makes sense, I've adjusted but could you confirm @chiragsalian ?
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.
its cool that you accounted for this but no amountOwed cannot be a value of 0. We just delete this entry from the database if its value is 0.
src/libs/SubscriptionUtils.ts
Outdated
if (!firstDayFreeTrial || !lastDayFreeTrial) { | ||
return true; | ||
} |
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.
I think it's an incorrect value when either of those values hasn't been set/loaded yet or user hasn't started the free trial yet.
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.
You are right, adjusted! cc @chiragsalian
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.
NAB but just found one more minor issue related to description. I have added a suggestion for the same. Please have a look.
Otherwise, I think the code looks super good once we address the above. Thanks.
src/ONYXKEYS.ts
Outdated
@@ -376,6 +391,10 @@ const ONYXKEYS = { | |||
|
|||
// Search Page related | |||
SNAPSHOT: 'snapshot_', | |||
|
|||
// Shared NVPs | |||
/** Collection of objects where each objects represents a workspace’s owner which is past due billing AND the user is a member of. */ |
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.
Would this sound better?
/** Collection of objects where each objects represents a workspace’s owner which is past due billing AND the user is a member of. */ | |
/** Collection of objects where each object represents a workspace’s non-owner(normal users and admins) who is member of a workspace where the owner is past due billing. */ |
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 That is not true, each object represents the workspace owner where the user is member of. I've changed to Collection of objects where each object represents the owner of the workspace that is past due billing AND the user is a member of.
Wdyt?
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.
Ah! You are right. It makes sense too.
…nyx-keys-and-utility-functions
Reviewer Checklist
Screenshots/VideosRun Test20240618_233413.mp4MacOS: Chrome / SafariNA MacOS: DesktopNA Android: NativeNA Android: mWeb ChromeNA iOS: NativeNA iOS: mWeb SafariNA |
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.
Changes LGTM. Also unit tests run well. Thanks @fabioh8010
We did not find an internal engineer to review this PR, trying to assign a random engineer to #43673 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
@aldo-expensify Are you the internal engineer here? The comment here seems to suggest so. |
I believe so, unless this is supposed to be handled by someone more familiar with the project |
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.
LGTM
We did not find an internal engineer to review this PR, trying to assign a random engineer to #43673 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
@chiragsalian can you review this? |
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.
Nice, the code LGTM
/** | ||
* Whether the report is a system chat or concierge chat, depending on the user's account ID. | ||
*/ | ||
function isChatUsedForOnboarding(report: OnyxEntry<Report>): boolean { |
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.
NAB: we should add some context that these are used for A/B testing because it could be rather confusing for anyone reading this that we're doing different logic depending on whether accountID is odd or even.
Cool looks like all the comments are handled. My NAB can be addressed in a follow-up, merging. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/chiragsalian in version: 1.4.86-0 🚀
|
1 similar comment
🚀 Deployed to staging by https://github.com/chiragsalian in version: 1.4.86-0 🚀
|
🚀 Deployed to staging by https://github.com/chiragsalian in version: 1.4.86-0 🚀
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.0.0-9 🚀
|
Details
NOTE 1: ReportUtils.findPolicyExpenseChatByPolicyID() won't be implemented in this PR/issue. It makes more sense to be implemented on #43673
NOTE 2: I had to make some TS fixes (commit) because as we are adding new Onyx keys,
OnyxUpdate
typings is starting to show problems in some situations, more details here.Fixed Issues
$ #43668
PROPOSAL:
Tests
npm test
, all tests should pass.Offline tests
N/A
QA Steps
N/A
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop