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

    Invites to every customer's dashboard, for callers with no dashboard user: CFX operators and onboarding's owner invite.

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

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

    • Invites an address to roleId, else to the role set's highest-rank non-internal role, and emails it; a member is left alone. id is the address's live PENDING invite: this one, or one already open to the same role and still acceptable, emailed again. An expired one is replaced by a fresh row; one to another role is WORKSPACE_INVITE_PENDING.

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

      Parameters

      • __namedParameters: {
            customerId: string;
            dashboardOrigin: string;
            email: string;
            roleId?: string;
            silent?: true;
            tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>;
        }
        • customerId: string
        • dashboardOrigin: string

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

        • email: string
        • OptionalroleId?: string
        • Optionalsilent?: true

          Writes the invite and sends no email; sign-in accepts it as usual.

        • Optionaltx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>

      Returns Promise<
          | {
              ok: true;
              value: | { outcome: "ALREADY_MEMBER" }
              | { outcome: "INVITED" } & InvitedTo
              | { outcome: "ADDED"; userId: string } & Omit<InvitedTo, "id">;
          }
          | { error: ServiceError; ok: false },
      >

    • Revokes a live PENDING invite: the row is soft-deleted, as a member's revoke does, so its link stops working. One already revoked writes nothing and publishes again: a retry finds it there. With a caller's tx nothing is published: the caller publishes after its commit.

      Parameters

      • __namedParameters: { id: string; tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations> }

      Returns Promise<{ ok: true; value: T } | { error: RevokeError; ok: false }>

    • Invites across every customer, oldest first; deleted ones only with includeDeleted.

      Parameters

      • __namedParameters: {
            createdAt?: DbTimestampCriteria;
            customerIds?: string[];
            emails?: string[];
            ids?: string[];
            includeDeleted?: boolean;
            page?: number;
            pageSize?: number;
            statuses?: ("PENDING" | "DELETED" | "ACCEPTED" | "REVOKED" | "EXPIRED")[];
            updatedAt?: DbTimestampCriteria;
        } = {}
        • OptionalcreatedAt?: DbTimestampCriteria
        • OptionalcustomerIds?: string[]
        • Optionalemails?: string[]

          Matched case-insensitively.

        • Optionalids?: string[]
        • OptionalincludeDeleted?: boolean
        • Optionalpage?: number

          Defaults to 1

        • OptionalpageSize?: number

          Defaults to 100

        • Optionalstatuses?: ("PENDING" | "DELETED" | "ACCEPTED" | "REVOKED" | "EXPIRED")[]
        • OptionalupdatedAt?: DbTimestampCriteria

      Returns Promise<
          {
              ok: true;
              value: {
                  hasNext: boolean;
                  items: CustomerDashboardWorkspaceInvite[];
                  total: number;
              };
          },
      >