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

    Invites to a customer'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: []) => CustomerDashboardInviteService = ...

    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

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