Add public API keys, outbound webhooks, and bulk SMS campaigns with settings UI and org modules.
This commit is contained in:
@@ -118,7 +118,9 @@ export type OrgModuleKey =
|
||||
| "team_settings"
|
||||
| "faq"
|
||||
| "audit_logs"
|
||||
| "saved_views";
|
||||
| "saved_views"
|
||||
| "public_api"
|
||||
| "sms_campaigns";
|
||||
|
||||
export const ORG_MODULE_KEYS: OrgModuleKey[] = [
|
||||
"customers",
|
||||
@@ -147,6 +149,8 @@ export const ORG_MODULE_KEYS: OrgModuleKey[] = [
|
||||
"faq",
|
||||
"audit_logs",
|
||||
"saved_views",
|
||||
"public_api",
|
||||
"sms_campaigns",
|
||||
];
|
||||
|
||||
export const ORG_MODULE_LABELS: Record<OrgModuleKey, string> = {
|
||||
@@ -176,6 +180,8 @@ export const ORG_MODULE_LABELS: Record<OrgModuleKey, string> = {
|
||||
faq: "FAQ",
|
||||
audit_logs: "لاگ فعالیت کاربران",
|
||||
saved_views: "فیلترهای ذخیرهشده",
|
||||
public_api: "API و وبهوک",
|
||||
sms_campaigns: "پیامک گروهی",
|
||||
};
|
||||
|
||||
export const ORG_MODULE_GROUPS: Array<{
|
||||
@@ -198,7 +204,11 @@ export const ORG_MODULE_GROUPS: Array<{
|
||||
{ title: "پشتیبانی", keys: ["tickets", "faq"] },
|
||||
{
|
||||
title: "اتوماسیون",
|
||||
keys: ["workflow_automations", "message_automations"],
|
||||
keys: [
|
||||
"workflow_automations",
|
||||
"message_automations",
|
||||
"sms_campaigns",
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "ابزارها",
|
||||
@@ -221,6 +231,7 @@ export const ORG_MODULE_GROUPS: Array<{
|
||||
"currencies",
|
||||
"tahesab",
|
||||
"audit_logs",
|
||||
"public_api",
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -2969,3 +2980,109 @@ export interface CreateSavedViewRequest {
|
||||
}
|
||||
|
||||
export type UpdateSavedViewRequest = Partial<CreateSavedViewRequest>;
|
||||
|
||||
/* ——— API عمومی و وبهوک ——— */
|
||||
|
||||
export const WEBHOOK_EVENTS = [
|
||||
"person.created",
|
||||
"person.updated",
|
||||
"deal.created",
|
||||
"deal.updated",
|
||||
"deal.won",
|
||||
"deal.lost",
|
||||
"invoice.paid",
|
||||
"activity.created",
|
||||
] as const;
|
||||
|
||||
export type WebhookEvent = (typeof WEBHOOK_EVENTS)[number];
|
||||
|
||||
export interface OrganizationApiKeyDto {
|
||||
id: string;
|
||||
name: string;
|
||||
prefix: string;
|
||||
lastUsedAt: string | null;
|
||||
revokedAt: string | null;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface CreateOrganizationApiKeyRequest {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface CreateOrganizationApiKeyResponse extends OrganizationApiKeyDto {
|
||||
/** فقط یکبار هنگام ساخت برگردانده میشود */
|
||||
rawKey: string;
|
||||
}
|
||||
|
||||
export interface WebhookEndpointDto {
|
||||
id: string;
|
||||
name: string;
|
||||
url: string;
|
||||
events: string[];
|
||||
isActive: boolean;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface CreateWebhookEndpointRequest {
|
||||
name: string;
|
||||
url: string;
|
||||
events: string[];
|
||||
secret?: string;
|
||||
isActive?: boolean;
|
||||
}
|
||||
|
||||
/** فقط هنگام ساخت؛ secret دوباره برنمیگردد */
|
||||
export interface CreateWebhookEndpointResponse extends WebhookEndpointDto {
|
||||
secret: string;
|
||||
}
|
||||
|
||||
export type UpdateWebhookEndpointRequest = Partial<CreateWebhookEndpointRequest>;
|
||||
|
||||
export interface WebhookDeliveryDto {
|
||||
id: string;
|
||||
event: string;
|
||||
status: string;
|
||||
statusCode: number | null;
|
||||
attempts: number;
|
||||
lastError: string | null;
|
||||
createdAt: string;
|
||||
deliveredAt: string | null;
|
||||
}
|
||||
|
||||
/* ——— پیامک گروهی ——— */
|
||||
|
||||
export type SmsCampaignStatus =
|
||||
| "draft"
|
||||
| "queued"
|
||||
| "sending"
|
||||
| "done"
|
||||
| "cancelled";
|
||||
|
||||
export interface SmsCampaignDto {
|
||||
id: string;
|
||||
name: string;
|
||||
body: string;
|
||||
status: SmsCampaignStatus;
|
||||
scheduledAt: string | null;
|
||||
totalCount: number;
|
||||
sentCount: number;
|
||||
failedCount: number;
|
||||
skippedCount: number;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface CreateSmsCampaignRequest {
|
||||
name: string;
|
||||
body: string;
|
||||
personIds: string[];
|
||||
scheduledAt?: string | null;
|
||||
/** اگر true باشد بلافاصله صف میشود */
|
||||
queueNow?: boolean;
|
||||
}
|
||||
|
||||
export interface SmsCampaignListResponse {
|
||||
items: SmsCampaignDto[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user