@cfxlabsinc/b2b-services
    Preparing search index...

    Invites to a bank's dashboard. The row is what authorizes: it is written, then emailed, and a sign-in that proves the address accepts it.

    Index
    instance: (...args: []) => BankDashboardInviteService = ...

    The process service: the shared database, the SES invite mailer and the internal event bus.

    • Invites an address to a role within the caller's reach and emails it. An address with a pending invite is settled first: one to the same role is emailed again, and one to another role is refused, as it would re-role it.

      An address a registered login holds (linked to Cognito, confirmed) is ADDED instead: the invite, new or the one already open, is accepted for them at once, as their sign-in would, and nothing is emailed. When that acceptance would not give them this role, it stays PENDING and is emailed. With a caller's tx nothing is published: the caller publishes after its commit.

      Parameters

      • args: (BankDashboardCaller | BankDashboardStaffCaller) & {
            dashboardOrigin: string;
            email: string;
            roleId: string;
            tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>;
        }
        • dashboardOrigin: string

          The origin the invitee signs up at: the email's link points there.

        • email: string
        • roleId: string
        • Optionaltx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>

      Returns Promise<
          | { error: ServiceError; ok: false }
          | {
              ok: true;
              value: Pick<BankDashboardInvite, "email" | "roleId" | "roleName"> & {
                  outcome: "INVITED" | "ADDED";
              };
          },
      >