• Creates a journey client for AM authentication tree/journey interactions.

    Supports two configuration modes:

    1. Standard configuration - Provide serverConfig.baseUrl directly:

      const client = await journey({
      config: {
      serverConfig: { baseUrl: 'https://am.example.com/am/' },
      realmPath: 'alpha',
      },
      });
    2. Well-known discovery - Provide serverConfig.wellknown for OIDC endpoint discovery:

      const client = await journey({
      config: {
      serverConfig: {
      baseUrl: 'https://am.example.com/am/',
      wellknown: 'https://am.example.com/am/oauth2/realms/root/realms/alpha/.well-known/openid-configuration',
      },
      // realmPath is optional - can be inferred from the well-known issuer
      },
      });

    Parameters

    Returns Promise<
        {
            next: (
                step: JourneyStep,
                options?: NextOptions,
            ) => Promise<
                undefined
                | JourneyStep
                | JourneyLoginSuccess
                | JourneyLoginFailure,
            >;
            redirect: (step: JourneyStep) => Promise<void>;
            resume: (
                url: string,
                options?: ResumeOptions,
            ) => Promise<
                undefined
                | JourneyStep
                | JourneyLoginSuccess
                | JourneyLoginFailure,
            >;
            start: (
                options?: StartParam,
            ) => Promise<
                undefined
                | JourneyStep
                | JourneyLoginSuccess
                | JourneyLoginFailure,
            >;
            terminate: (
                options?: { query?: Record<string, string> },
            ) => Promise<undefined | void>;
        },
    >

    A journey client instance with start, next, redirect, resume, and terminate methods