import { AutoEncoder } from '@simonbackx/simple-encoding'; import { SimpleErrors } from '@simonbackx/simple-errors'; import { EmailAttachment, Recipient, Replacement } from '../endpoints/EmailRequest.js'; import { StamhoofdFilter } from '../filters/StamhoofdFilter.js'; import { TinyMember } from '../members/Member.js'; import { BaseOrganization } from '../Organization.js'; import { OrganizationMetaData } from '../OrganizationMetaData.js'; import { OrganizationPrivateMetaData } from '../OrganizationPrivateMetaData.js'; import { Platform } from '../Platform.js'; import { User } from '../User.js'; export declare enum EmailRecipientFilterType { RegistrationMembers = "RegistrationMembers", RegistrationParents = "RegistrationParents", RegistrationUnverified = "RegistrationUnverified", Payment = "Payment", PaymentOrganization = "PaymentOrganization", Members = "Members", MemberParents = "MemberParents", MemberUnverified = "MemberUnverified", Orders = "Orders", ReceivableBalances = "ReceivableBalances", Documents = "Documents" } export declare function getExampleRecipient(type?: EmailRecipientFilterType | null): EmailRecipient; export declare enum EmailStatus { Draft = "Draft", /** * Queued to be sent any moment now */ Queued = "Queued", Sending = "Sending", Sent = "Sent", Deleted = "Deleted", Failed = "Failed" } export declare enum EmailRecipientsStatus { NotCreated = "NotCreated", Creating = "Creating", Created = "Created" } export declare class EmailRecipientSubfilter extends AutoEncoder { type: EmailRecipientFilterType; filter: StamhoofdFilter | null; search: string | null; /** * In case the email is sent to a specific type of relation, we can filter that relation here. * E.g. sending an email to organziations -> filter on who to email to for a specific organization (e.g. members with specific role) */ subfilter: StamhoofdFilter | null; } export declare class EmailRecipientFilter extends AutoEncoder { filters: EmailRecipientSubfilter[]; /** * @deprecated. * This doesn't do anything and is replaced by automatic email grouping. */ groupByEmail: boolean; get canShowInMemberPortal(): boolean; } export declare class Email extends AutoEncoder { id: string; senderId: string | null; organizationId: string | null; recipientFilter: EmailRecipientFilter; subject: string | null; status: EmailStatus; emailErrors: SimpleErrors | null; recipientsStatus: EmailRecipientsStatus; recipientsErrors: SimpleErrors | null; json: {}; text: string | null; html: string | null; fromAddress: string | null; fromName: string | null; emailRecipientsCount: number | null; otherRecipientsCount: number | null; succeededCount: number; softFailedCount: number; failedCount: number; membersCount: number; hardBouncesCount: number; softBouncesCount: number; spamComplaintsCount: number; attachments: EmailAttachment[]; sentAt: Date | null; createdAt: Date; updatedAt: Date; deletedAt: Date | null; sendAsEmail: boolean; showInMemberPortal: boolean; getTemplateType(): import("./EmailTemplate.js").EmailTemplateType | null; getSubjectFor(recipient: EmailRecipient | null): string; getSnippetFor(recipient: EmailRecipient | null): string; } export declare class EmailRecipient extends AutoEncoder { id: string; emailId: string; objectId: string | null; emailType: string | null; firstName: string | null; lastName: string | null; email: string | null; memberId: string | null; member: TinyMember | null; userId: string | null; replacements: Replacement[]; failErrorMessage: string | null; failCount: number; failError: SimpleErrors | null; previousFailError: SimpleErrors | null; hardBounceError: string | null; softBounceError: string | null; spamComplaintError: string | null; firstFailedAt: Date | null; lastFailedAt: Date | null; sentAt: Date | null; createdAt: Date; updatedAt: Date; get name(): string | null; getDefaultReplacements(): Replacement[]; getReplacements(organization: { meta: OrganizationMetaData; privateMeta: OrganizationPrivateMetaData | null; name: string; registerUrl: string; } | null, platform: Platform): Replacement[]; getRecipient(): Recipient; } export declare function isSoftEmailRecipientError(error: SimpleErrors): boolean; export declare function bounceErrorToHuman(message: string): string | undefined; export declare class EmailPreview extends Email { exampleRecipient: EmailRecipient | null; user: User | null; organization: BaseOrganization | null; get replacedSubject(): string; get snippet(): string; } export declare class EmailWithRecipients extends Email { recipients: EmailRecipient[]; organization: BaseOrganization | null; get exampleRecipient(): EmailRecipient; get replacedSubject(): string; get snippet(): string; } //# sourceMappingURL=Email.d.ts.map