Adding SMS automation

This commit is contained in:
2026-09-13 19:11:47 +03:30
parent bd63d2ab76
commit 45b0d46cfe
26 changed files with 1724 additions and 31 deletions
+116
View File
@@ -2245,6 +2245,122 @@ export interface PersonAssetsDto {
fetchedAt: string;
}
// —— پیام خودکار (جدا از اتوماسیون گردش کار) ——
export type MessageAutomationTrigger =
| "person_created"
| "lead_submitted"
| "deal_created"
| "deal_stage_changed"
| "deal_won"
| "deal_lost"
| "ticket_created"
| "ticket_resolved"
| "invoice_issued"
| "invoice_paid"
| "activity_created"
| "activity_done";
export type MessageAutomationDelayUnit = "minutes" | "hours" | "days";
export type MessageAutomationChannel = "app" | "sms" | "both";
export type MessageAutomationTarget = "staff" | "person" | "both";
export const MESSAGE_AUTOMATION_TRIGGERS = [
"person_created",
"lead_submitted",
"deal_created",
"deal_stage_changed",
"deal_won",
"deal_lost",
"ticket_created",
"ticket_resolved",
"invoice_issued",
"invoice_paid",
"activity_created",
"activity_done",
] as const satisfies readonly MessageAutomationTrigger[];
export const MESSAGE_AUTOMATION_TRIGGER_LABELS: Record<
MessageAutomationTrigger,
string
> = {
person_created: "مخاطب جدید ساخته شد",
lead_submitted: "فرم سرنخ ارسال شد",
deal_created: "معامله جدید ساخته شد",
deal_stage_changed: "مرحله معامله عوض شد",
deal_won: "معامله برنده شد",
deal_lost: "معامله باخت",
ticket_created: "تیکت جدید ساخته شد",
ticket_resolved: "تیکت حل شد",
invoice_issued: "فاکتور صادر شد",
invoice_paid: "پرداخت روی فاکتور ثبت شد",
activity_created: "فعالیت ثبت شد",
activity_done: "فعالیت تمام شد",
};
export const MESSAGE_AUTOMATION_UNIT_LABELS: Record<
MessageAutomationDelayUnit,
string
> = {
minutes: "دقیقه",
hours: "ساعت",
days: "روز",
};
export const MESSAGE_AUTOMATION_CHANNEL_LABELS: Record<
MessageAutomationChannel,
string
> = {
app: "ناتیف داخل برنامه",
sms: "پیامک",
both: "پیامک و ناتیف",
};
export const MESSAGE_AUTOMATION_TARGET_LABELS: Record<
MessageAutomationTarget,
string
> = {
staff: "مسئول پرونده",
person: "مشتری",
both: "مشتری و مسئول",
};
export interface MessageAutomationRuleDto {
id: string;
name: string;
isActive: boolean;
trigger: MessageAutomationTrigger;
startDelayValue: number;
startDelayUnit: MessageAutomationDelayUnit;
repeatCount: number;
intervalValue: number;
intervalUnit: MessageAutomationDelayUnit;
notifyTarget: MessageAutomationTarget;
channel: MessageAutomationChannel;
title: string;
body: string;
createdAt: string;
updatedAt: string;
}
export interface CreateMessageAutomationRuleRequest {
name: string;
isActive?: boolean;
trigger: MessageAutomationTrigger;
startDelayValue?: number;
startDelayUnit?: MessageAutomationDelayUnit;
repeatCount?: number;
intervalValue?: number;
intervalUnit?: MessageAutomationDelayUnit;
notifyTarget?: MessageAutomationTarget;
channel?: MessageAutomationChannel;
title: string;
body: string;
}
export type UpdateMessageAutomationRuleRequest =
Partial<CreateMessageAutomationRuleRequest>;
export { brand, APP_NAME, APP_NAME_FA, brandSuggestionFa } from "./brand";
export type { Brand } from "./brand";
export const API_PREFIX = "api";