Open carlosmiceli opened 3 days ago
Job added to Upwork: https://www.upwork.com/jobs/~021862573059516200142
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (External
)
Improve/fix logic for creating a workspace during onboarding flow
This is an improvement
Instead of creating the policy in the employee step or auto-create a new workspace for vsb
onboarding, we can only create the new workspace when the user completes the final step.
We can remove the create a new workspace logic here and here
In here, if the onboardingPurposeSelected is newDotManageTeam
, create a new workspace via createWorkspace
and then get adminsChatReportID
, policyID
and pass it to completeOnboarding
function
let onboardingAdminsChatReportID; let onboardingPolicyID;
if (onboardingPurposeSelected === CONST.ONBOARDING_CHOICES.MANAGE_TEAM) {
const {adminsChatReportID, policyID} = Policy.createWorkspace(undefined, true, '', Policy.generatePolicyID(), CONST.ONBOARDING_CHOICES.MANAGE_TEAM);
onboardingAdminsChatReportID = adminsChatReportID;
onboardingPolicyID = policyID;
};
Report.completeOnboarding(
onboardingPurposeSelected,
CONST.ONBOARDING_MESSAGES[onboardingPurposeSelected],
undefined,
undefined,
onboardingAdminsChatReportID ?? undefined,
onboardingPolicyID,
undefined,
onboardingCompanySize,
userReportedIntegration,
);
That can make sure the workspace is only created when we complete the onboarding flow with onboardingPurposeSelected
as newDotManageTeam
In completeOnboarding
function, we can build the optimistic data for new workspace via buildPolicyData
function and then add these onyx data in completeOnboarding
and from the backend, we will use the onboardingPolicyID
to create a new workspace.
If user completed the onboarding flow using OD, two workspaces are created.
if signupQualifier is VSB, we are not showing How many employees do you have? or OnboardingEmployees page, hence this useEffect is added to automatically create a workspace for it. https://github.com/Expensify/App/blob/f12b73c3aff5fea8cb8d41f111d52d5bfd187eb1/src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx#L61-L73
if signupQualifier is SMB, it is not considered anywhere in code to skip the workspace creation, workspace is created in any case here. https://github.com/Expensify/App/blob/f12b73c3aff5fea8cb8d41f111d52d5bfd187eb1/src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx#L66-L70
remove this useEffect, because it is used to create a workspace if signupQualifier is VSB https://github.com/Expensify/App/blob/f12b73c3aff5fea8cb8d41f111d52d5bfd187eb1/src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx#L61-L73
add one more condition here in BaseOnboardingEmployees, if the signupQualifier is SMB, then don't create the workspace.
const isSmb = onboardingValues && 'signupQualifier' in onboardingValues && onboardingValues.signupQualifier === CONST.ONBOARDING_SIGNUP_QUALIFIERS.SMB;
https://github.com/Expensify/App/blob/f12b73c3aff5fea8cb8d41f111d52d5bfd187eb1/src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx#L66-L70
as :
if (!onboardingPolicyID && !isSmb) {
const filteredPolicies = Object.values(allPolicies ?? {}).filter(PolicyUtils.isPaidGroupPolicy);
as:
if (!onboardingPolicyID && !isSmb && filteredPolicies.length <=0 ) {
@thesahindia any thoughts on which proposal to go with?
We want new users that are taken to the Employee Count screen to have a workspace created automatically (this is currently in place):
However, for signups that join via expensify.com and select either
vsb
orsmb
as signup qualifier, we want to skip actually creating a workspace at this step because that's going to be created automatically via the API during the account creation. Otherwise we'll be creating one twice. These are the correspondingvsb
andsmb
signup options on expensify.com:To clarify, the current onboarding flow logic for creating a workspace should still occur for any new user that's taken to the onboarding modal and does NOT have either
vsb
orsmb
as asignupQualifier
. Those would be:Please include videos of all the possible signup cases and confirming that only one workspace is created for each. Also confirm that this bug where we created duplicate workspaces doesn't reoccur (if it's still happening). Finally, we think there may be an extreme edge case where:
Please include in your proposal a way to prevent this if it could occur.
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @thesahindia