-
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
[Awaiting Payment 26th Sept] [CRITICAL] Update the free trial badge to display Start a free trial badge when we create a workspace for a user #48217
Comments
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Update the free trial badge to display Start a free trial badge when we create a workspace for a use What is the root cause of that problem?Feature Request What changes do you think we should make in order to solve the problem?We will update the code here, here, and here to use a util function to get the correct string according to trial status (as we do here) function getFreeTrialBadgeText() {
if (CardSectionUtils.shouldShowPreTrialBillingBanner()) {
return translate('subscription.billingBanner.preTrial.title');
}
if (SubscriptionUtils.isUserOnFreeTrial()) {
return translate('subscription.billingBanner.trialStarted.title', {numOfDays: SubscriptionUtils.calculateRemainingFreeTrialDays()});
}
if (SubscriptionUtils.hasUserFreeTrialEnded()) {
return translate('subscription.billingBanner.trialEnded.title');
}
}
|
Edited by proposal-police: This proposal was edited at 2024-08-28 21:19:42 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Update the free trial badge to display What is the root cause of that problem?Users lack urgency in configuring and using their workspace after creation. They are unaware that their workspace is a paid feature until either (1) they create an expense, which triggers the 7-day free trial (displayed as a badge in Concierge and Settings - Subscription), or (2) they manually navigate to Settings - Subscription to learn about paid plans. What changes do you think we should make in order to solve the problem?
function hasPaidPolicy(policies: OnyxCollection<Policy> | null, currentUserAccountID: number): boolean {
return Object.values(policies ?? {}).some(
(policy) => isPolicyOwner(policy, currentUserAccountID ?? -1) && isPaidGroupPolicy(policy)
);
} This checks if the user owns a paid policy, which is the same approach used in useSubscriptionPlan , which is used in the subscription tab inside
function getFreeTrialText(policies: OnyxCollection<Policy> | null): string | undefined {
if (!PolicyUtils.hasPaidPolicy(policies, currentUserAccountID)) {
return undefined;
}
if (CardSectionUtils.shouldShowPreTrialBillingBanner()) {
return translateLocal('subscription.billingBanner.preTrial.title');
}
if (isUserOnFreeTrial()) {
return translateLocal('subscription.billingBanner.trialStarted.title', {numOfDays: calculateRemainingFreeTrialDays()});
}
if (hasUserFreeTrialEnded()) {
return translateLocal('subscription.billingBanner.trialEnded.title');
}
return undefined;
} This function will return the correct trial status text based on the user’s subscription status.
Alternatively
|
I think @neonbhai is on the right track. I updated the mockups for clarity in the issue description. @rojiphil @chiragsalian - can you both take a quick review? |
Yeah. It makes sense to display pre trial status in LHN and header of the chat used for onboarding. |
Correct yeah BE is not needed for this the FE has all the information and i imagine its the same condition as when we determine to show subscription tab and then showing start a free trial banner in subscription page. Reviewing @abzokhattab proposal,
I don't follow this. Currently and after the changes to solve this issue free trial will not start when a workspace is created.
This doesn't feel right or rather precise to me. Yeah like rojiphil mentioned we need to check paid policies. So a helper function like Infact i would suggest using whatever logic the subscription tab uses to show itself so that our logic stays consistent with it. And looking at that code its here which looks at if NVP_PRIVATE_SUBSCRIPTION exists. So yeah using that looks even simpler because that NVP is set only when a workspace is created. Also @danielrvidal / @anmurali, about this part,
I think that's incorrect and the "Start a free trial badge" should be on whichever chat the user was onboarded with. Since that will contain the onboarding message. So it makes sense to keep having the badge in the same location as the onboarding chat otherwise it would jump around which is ugly. |
@chiragsalian - we're removing the Expensify DM and streamlining onboarding tasks always to Concierge, hence that description |
Ah okay then perfect 👍 lets use Concierge and not worry about onboarding chat reportID |
Good clarification though! |
Thanks all for the feedback ... I have updated the proposal and added a test branch here is the result: Screen.Recording.2024-09-01.at.5.36.34.AM.mov |
Yeah. While using |
we can also change the new |
I agree
I don't follow this comment. useSubscriptionPlan already checks for paid policies that are owned by the user. If i have misunderstood you can you explain this with a snippet. |
I mean the following changes:
function getOwnedPaidPolicies(policies: OnyxCollection<Policy> | null, currentUserAccountID: number): Policy[] {
return Object.values(policies ?? {}).filter((policy): policy is Policy => isPolicyOwner(policy, currentUserAccountID) && isPaidGroupPolicy(policy));
}
const ownerPolicies = useMemo(() => PolicyUtils.getOwnedPaidPolicies(policies, session?.accountID ?? -1), [policies, session?.accountID]);
const ownedPaidPolicies = PolicyUtils.getOwnedPaidPolicies(policies, currentUserAccountID);
if (isEmptyObject(ownedPaidPolicies)) { This approach ensures that the logic for checking whether the user has a paid policy is consistent across both |
Your suggestion works. But i guess my original question (and even roji's) is why bother with a new hasPaidPolicy/getOwnedPaidPolicies when we could only just reuse useSubscriptionPlan. But as i think about this more i prefer your getOwnedPaidPolicies instead of useSubscriptionPlan since it eliminates the extra overhead to iterate and check for any control policies. So yeah i like getOwnedPaidPolicies. Let's go with that. The rest of your proposal LGTM as well. Feel free to create the PR @abzokhattab. |
agree ... also i chose this approach because we cannot import a hook inside the util files .. so in this case we cannot import the |
Triggered auto assignment to @trjExpensify ( |
Still working through the PR listed above. Constant progress is being made. |
@danielrvidal @anmurali While the OP of this issue has not explicitly stated to display 48217-trialended-confirm.mp4 |
I don't mind that, but it wasn't in the scope of the original design nor solves our problem stated in the OP really, so I'm hesitant to add it willy nilly. CC: @dannymcclain |
I feel the same. Would love to get @dubielzyk-expensify's thoughts about it! |
Agree with Tom and Danny here |
Kewwwl, let's leave that off then @rojiphil. |
Yeah. It's better to leave it as that's the consensus. @abzokhattab Since the implementation mentioned here is not required, let us remove this from the PR. Thanks. |
Nicee! Updated the title to reflect the payment hold. |
Payment will be due tomorrow. |
Can we get a regression test for this please, @rojiphil? |
@trjExpensify Sure, the regression test is as follows:.
|
Current assignee @trjExpensify is eligible for the Bug assigner, not assigning anyone new. |
Excellent, issue created! Payments as follows:
Offers sent! |
Thanks a-lot, Tom for moving this forward As this is a critical issue and has required some time and effort exploring different approaches, would it be possible to increase the bounty to 500 like those critical issues(#40152 (comment) - #40209 (comment) and others) ? Your consideration is greatly appreciated. |
Payment increase to 500 sounds fair to me. I let tom make the final decision and handle the payment. |
Amended, paid @abzokhattab. |
@trjExpensify Accepted offer. Thanks. |
Paid, closing! |
Proposal: Update the free trial badge to display
Start a free trial
badge when we create a workspace for a userProblem: Users don't really have a sense of urgency when it comes to configuring and using their workspace on creating it. Users also do not know right now that their workspace is a paid feature unless (1) a free trial starts, which does not happen till a user creates an expense on the workspace, which triggers the 7-day free trial to start that includes a badge on Concierge and in the Settings - Subscription tab says
Free Trial: 7 days left
or 2) they navigate to Settings -Subscription and learn about paid plans.Solution: Show a
Start a free trial
badge on Concierge DM and in Settings - Subscriptions tab (LHN) when the workspace is first created.Free trial: X days left
in both the Concierge DM and Settings - Subscription tab (LHN). Keep this also as is. I.e. update theStart a free trial
toFree trial: X days left
when billable action is taken, which officially starts the free trial clock.When a workspace is created, and there is no billable activity yet
Send a notification but lag this notification by a full minute so it isn't sent between the onboarding tasks itself
Issue Owner
Current Issue Owner: @trjExpensifyThe text was updated successfully, but these errors were encountered: