[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] |
| } | ||
|
|
||
| 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.
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.
Adjusted the logic to calculate with second precision cc @chiragsalian
|
|
||
| // 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.
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.
Makes sense, I've adjusted but could you confirm @chiragsalian ?
There was a problem hiding this comment.
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.
| if (!firstDayFreeTrial || !lastDayFreeTrial) { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
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.
You are right, adjusted! cc @chiragsalian
rojiphil
left a comment
There was a problem hiding this comment.
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.
| 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.
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.
@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.
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 |
rojiphil
left a comment
There was a problem hiding this comment.
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 |
|
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? |
chiragsalian
left a comment
There was a problem hiding this comment.
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.
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,
OnyxUpdatetypings 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 Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop