involveMINT / iMPublic

Public involveMINT repo
https://app.involvemint.io
7 stars 20 forks source link

Sign Up Redirects not working #281

Open involve-MINT opened 1 month ago

involve-MINT commented 1 month ago

Marketplace redirects automatically to the sign-up page which shouldn’t happen.If you navigate to app.involvemint.io/market it should take you to market

When signing up as a business using the forwarding link: https://app.involvemint.io/signUp?register=ep, the forwarding link only works if you have NOT created an account OR you have cleared your cookies. It’s unclear, if after the initial account creation page, if the forwarding link for businesses takes businesses to the business sign up page.

This ticket related to: https://github.com/involveMINT/iMPublic/issues/148

In particular making sure the sign ups redirects work for following scenarios (note none of these scenarios involve clearing cookies or cache at any point bc this is not a common practice the average person does not do):

  1. User who HAS NOT previously visited the webapp AND uses the redirect link to sign up on web app as a biz.
  2. User who HAS previously visited the webapp AND uses the redirect link to sign up on the web app as a biz.
  3. User who HAS created a changemaker account AND is logged in and then uses redirect link to sign up as a biz
  4. User who HAS created a changemaker account AND is NOT logged in and then uses redirect link to sign up as a biz

The issue comes in, I believe, for when the web app is determining if a user is signing up at large or signing up as a ChangeMaker who wants to link a biz to their user account. When a user who is a CM signs wants to add a biz account for themselves, they can navigate to hamburger menu-> "Add a New Account" -> "Apply for yourself" tab. Vs. default "apply for business" which means to invite another biz.

I recognize that these titles (heuristics) of these features definitely need to be improved too.

involve-MINT commented 3 weeks ago

Hey @b3nkang any updates to this ticket? @QuinnNTonic Looking to onboard vendors soon

b3nkang commented 3 weeks ago

Hey @b3nkang any updates to this ticket? @QuinnNTonic Looking to onboard vendors soon

Haven't had a chance to look at it yet, but I will give it a stab later tonight if that's helpful

involve-MINT commented 3 weeks ago

@b3nkang updated ticket. Highest priotiy currently

b3nkang commented 3 weeks ago

Okay will do my best, will shoot to get it resolved EOD today PT

b3nkang commented 3 weeks ago

So I was able to diagnose a few issues specifically on my local instance but not too sure where to proceed or how to resolve. I don't think I can move on this much more as I've stared at this too long without being able to sort it out so I'll describe my progress below in as much detail as possible; if @QuinnNTonic or @fogunsan y'all are able to help pick it up from here that'd be great, as I'm sort of at the limit of my understanding and time.

Issue 1:

After navigating to the ep application, after filling it out, the ExchangePartner Application Successful modal doesn't pop up and the page immediately reloads and the Choose a Project modal pops up, even through the code in user-session.effects.ts specifically with the readonly submitEpApplication$ = createEffect(() => console logs properly.

The issue is with the line:

map((epApp) => {
              if (!ImConfig.requireApplicationApproval) {
                window.location.reload();
              }

due to the !ImConfig.requireApplicationApproval triggering a reload. I've just commented it out but this requires more inspection. Here's a vid below showing the issue:

https://github.com/involveMINT/iMPublic/assets/134336066/4889a6c8-0afb-4123-b89d-4c1e6ec2094f

Issue 2:

Once the reloading issue is resolved, the next is that the ExchangePartner Application Successful modal doesn't redirect anywhere - the thing modal just closes and the shows the cleaned form, although the ep form is unable to be submitted again without reload. See vid below:

https://github.com/involveMINT/iMPublic/assets/134336066/f6ebf90d-a763-457e-afdf-920d672843c1

I think this is because, if you drill down into the infoModal -> infoModalService -> InfoModalComponent -> info-modal.component.html there's a dismiss(true) function whose dismissal event needs to be handled. I read briefly this can be done with an onDidDismiss method but implementation wise not too sure.

I tried something naive with the following below but isn't working great:

  readonly submitEpApplication$ = createEffect(() =>
    this.actions$.pipe(
      ofType(UserSessionActions.submitEpApplication),
      delayWhen(() => from(this.status.showLoader('Submitting ExchangePartner Application...'))),
      pessimisticUpdate({
        run: ({ dto }) =>
          this.epApp.submit(UserQuery.epApplications, dto).pipe(
            switchMap((epApp) => {
              this.status.dismissLoader();
              return from(
                this.infoModal.open({
                  title: 'ExchangePartner Application Successful',
                  description: `Our administrators are reviewing your request and is pending approval or denial.`,
                  icon: { name: 'checkmark', source: 'ionicon' },
                  useBackground: true,
                })
              ).pipe(
                switchMap(modal => modal.onDidDismiss()),
                map(result => {
                  if (result.data) {
                    this.route.to.SomePageToGoTo.ROOT();
                  }
                  return UserSessionActions.submitEpApplicationSuccess({ epApp });
                })
              );
            })
          ),
        onError: (action, { error }) => {
          this.status.dismissLoader();
          this.status.presentNgRxActionAlert(action, error);
          return UserSessionActions.submitEpApplicationError({ error });
        },
      })
    )
  );
involve-MINT commented 3 weeks ago

@b3nkang I've updated the description of this ticket to make it more thorough. Hopefully that helps. Let me know if anything is unclear.