tychat-contracts 1.6.31 → 1.6.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/campaigns/campaign.dto.d.ts +20 -0
- package/dist/campaigns/campaign.dto.d.ts.map +1 -1
- package/dist/configurations/app-module-policy.enums.d.ts +1 -1
- package/dist/configurations/app-module-policy.enums.d.ts.map +1 -1
- package/dist/configurations/app-module-policy.enums.js +2 -0
- package/package.json +1 -1
- package/src/campaigns/campaign-recipient.dto.ts +26 -26
- package/src/campaigns/campaign-refund.dto.ts +34 -34
- package/src/campaigns/campaign-status.dto.ts +44 -44
- package/src/campaigns/campaign-template.dto.ts +38 -38
- package/src/campaigns/campaign.dto.ts +71 -50
- package/src/campaigns/create-campaign.dto.ts +70 -70
- package/src/campaigns/index.ts +6 -6
- package/src/configurations/app-module-policy.enums.ts +2 -0
- package/src/storage/delete-object-rpc.dto.ts +28 -28
|
@@ -36,6 +36,14 @@ export interface CampaignListResponseDto {
|
|
|
36
36
|
page: number;
|
|
37
37
|
limit: number;
|
|
38
38
|
}
|
|
39
|
+
/** Métricas por URL rastreado (campanhas não oficiais com substituição de links). */
|
|
40
|
+
export interface CampaignLinkStatDto {
|
|
41
|
+
targetUrl: string;
|
|
42
|
+
/** Quantidade de destinatários (pacientes) com pelo menos um clique neste link. */
|
|
43
|
+
uniqueRecipientsClicked: number;
|
|
44
|
+
/** Total de cliques (inclui reaberturas). */
|
|
45
|
+
totalClicks: number;
|
|
46
|
+
}
|
|
39
47
|
export interface CampaignStatsDto {
|
|
40
48
|
total: number;
|
|
41
49
|
pending: number;
|
|
@@ -44,5 +52,17 @@ export interface CampaignStatsDto {
|
|
|
44
52
|
read: number;
|
|
45
53
|
failed: number;
|
|
46
54
|
replied: number;
|
|
55
|
+
/** Leituras com confirmação explícita do webhook da Meta. */
|
|
56
|
+
readFromMeta?: number;
|
|
57
|
+
/** Leituras confirmadas por webhook Evolution (quando disponível). */
|
|
58
|
+
readFromEvolution?: number;
|
|
59
|
+
/**
|
|
60
|
+
* `read_at` preenchido sem origem de canal conhecida (legado ou provedor sem indicador).
|
|
61
|
+
*/
|
|
62
|
+
readUnconfirmed?: number;
|
|
63
|
+
/** Destinatários com pelo menos um clique em link rastreado. */
|
|
64
|
+
linkClickRecipients?: number;
|
|
65
|
+
/** Por link: URL de destino e quantos pacientes clicaram. */
|
|
66
|
+
trackedLinks?: CampaignLinkStatDto[];
|
|
47
67
|
}
|
|
48
68
|
//# sourceMappingURL=campaign.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"campaign.dto.d.ts","sourceRoot":"","sources":["../../src/campaigns/campaign.dto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEpF,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC7C,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAClD,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAA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,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,6DAA6D;IAC7D,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACtC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Módulos da aplicação web do tenant (Tychat-v2), controlados por plano e override por tenant.
|
|
3
3
|
* Valores estáveis para API e persistência.
|
|
4
4
|
*/
|
|
5
|
-
export declare const TYCHAT_APP_MODULE_KEYS: readonly ["dashboard", "check_in", "check_out", "schedule", "conversations", "patients", "patients_documents", "patients_legal_terms", "clinic_legal_terms", "legal_terms_digital_signature", "patients_anamneses", "clinic_anamneses", "ai_conversation", "follow_up", "funnel", "satisfaction", "clinic", "billings", "connections", "settings", "campaigns"];
|
|
5
|
+
export declare const TYCHAT_APP_MODULE_KEYS: readonly ["dashboard", "check_in", "check_out", "doctor_platform", "schedule", "conversations", "patients", "patients_documents", "patients_legal_terms", "clinic_legal_terms", "legal_terms_digital_signature", "patients_anamneses", "clinic_anamneses", "ai_conversation", "follow_up", "funnel", "satisfaction", "clinic", "billings", "connections", "settings", "campaigns"];
|
|
6
6
|
export type TychatAppModuleKey = (typeof TYCHAT_APP_MODULE_KEYS)[number];
|
|
7
7
|
export declare const TYCHAT_APP_MODULE_POLICY_LEVELS: readonly ["default", "plan", "tenant"];
|
|
8
8
|
export type TychatAppModulePolicyLevel = (typeof TYCHAT_APP_MODULE_POLICY_LEVELS)[number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-module-policy.enums.d.ts","sourceRoot":"","sources":["../../src/configurations/app-module-policy.enums.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"app-module-policy.enums.d.ts","sourceRoot":"","sources":["../../src/configurations/app-module-policy.enums.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,sBAAsB,oXAwBzB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE,eAAO,MAAM,+BAA+B,wCAAyC,CAAC;AACtF,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import type { RecipientStatusDto } from './campaign-status.dto';
|
|
2
|
-
|
|
3
|
-
export interface CampaignRecipientDto {
|
|
4
|
-
id: string;
|
|
5
|
-
campaignId: string;
|
|
6
|
-
patientId: string;
|
|
7
|
-
phoneNumber: string;
|
|
8
|
-
patientName: string | null;
|
|
9
|
-
status: RecipientStatusDto;
|
|
10
|
-
whatsappMessageId: string | null;
|
|
11
|
-
errorMessage: string | null;
|
|
12
|
-
sentAt: string | null;
|
|
13
|
-
deliveredAt: string | null;
|
|
14
|
-
readAt: string | null;
|
|
15
|
-
repliedAt: string | null;
|
|
16
|
-
retryCount: number;
|
|
17
|
-
createdAt: string;
|
|
18
|
-
updatedAt: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface CampaignRecipientListResponseDto {
|
|
22
|
-
items: CampaignRecipientDto[];
|
|
23
|
-
total: number;
|
|
24
|
-
page: number;
|
|
25
|
-
limit: number;
|
|
26
|
-
}
|
|
1
|
+
import type { RecipientStatusDto } from './campaign-status.dto';
|
|
2
|
+
|
|
3
|
+
export interface CampaignRecipientDto {
|
|
4
|
+
id: string;
|
|
5
|
+
campaignId: string;
|
|
6
|
+
patientId: string;
|
|
7
|
+
phoneNumber: string;
|
|
8
|
+
patientName: string | null;
|
|
9
|
+
status: RecipientStatusDto;
|
|
10
|
+
whatsappMessageId: string | null;
|
|
11
|
+
errorMessage: string | null;
|
|
12
|
+
sentAt: string | null;
|
|
13
|
+
deliveredAt: string | null;
|
|
14
|
+
readAt: string | null;
|
|
15
|
+
repliedAt: string | null;
|
|
16
|
+
retryCount: number;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CampaignRecipientListResponseDto {
|
|
22
|
+
items: CampaignRecipientDto[];
|
|
23
|
+
total: number;
|
|
24
|
+
page: number;
|
|
25
|
+
limit: number;
|
|
26
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import type { RefundCaseStatusDto } from './campaign-status.dto';
|
|
2
|
-
import type { CampaignDto } from './campaign.dto';
|
|
3
|
-
|
|
4
|
-
export interface CampaignRefundCaseDto {
|
|
5
|
-
id: string;
|
|
6
|
-
tenantId: string;
|
|
7
|
-
campaignId: string;
|
|
8
|
-
campaign?: CampaignDto;
|
|
9
|
-
status: RefundCaseStatusDto;
|
|
10
|
-
totalPaidCents: number;
|
|
11
|
-
amountUsedCents: number;
|
|
12
|
-
refundAmountCents: number;
|
|
13
|
-
messagesSentBeforeCancel: number;
|
|
14
|
-
cancellationReason: string | null;
|
|
15
|
-
adminNotes: string | null;
|
|
16
|
-
processedByAdminId: string | null;
|
|
17
|
-
processedAt: string | null;
|
|
18
|
-
createdAt: string;
|
|
19
|
-
updatedAt: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface CampaignRefundCaseListResponseDto {
|
|
23
|
-
items: CampaignRefundCaseDto[];
|
|
24
|
-
total: number;
|
|
25
|
-
page: number;
|
|
26
|
-
limit: number;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface ProcessRefundRequestDto {
|
|
30
|
-
refundCaseId: string;
|
|
31
|
-
newStatus: 'analyzing' | 'approved' | 'rejected' | 'processed';
|
|
32
|
-
adminNotes?: string;
|
|
33
|
-
processedByAdminId?: string;
|
|
34
|
-
}
|
|
1
|
+
import type { RefundCaseStatusDto } from './campaign-status.dto';
|
|
2
|
+
import type { CampaignDto } from './campaign.dto';
|
|
3
|
+
|
|
4
|
+
export interface CampaignRefundCaseDto {
|
|
5
|
+
id: string;
|
|
6
|
+
tenantId: string;
|
|
7
|
+
campaignId: string;
|
|
8
|
+
campaign?: CampaignDto;
|
|
9
|
+
status: RefundCaseStatusDto;
|
|
10
|
+
totalPaidCents: number;
|
|
11
|
+
amountUsedCents: number;
|
|
12
|
+
refundAmountCents: number;
|
|
13
|
+
messagesSentBeforeCancel: number;
|
|
14
|
+
cancellationReason: string | null;
|
|
15
|
+
adminNotes: string | null;
|
|
16
|
+
processedByAdminId: string | null;
|
|
17
|
+
processedAt: string | null;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CampaignRefundCaseListResponseDto {
|
|
23
|
+
items: CampaignRefundCaseDto[];
|
|
24
|
+
total: number;
|
|
25
|
+
page: number;
|
|
26
|
+
limit: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ProcessRefundRequestDto {
|
|
30
|
+
refundCaseId: string;
|
|
31
|
+
newStatus: 'analyzing' | 'approved' | 'rejected' | 'processed';
|
|
32
|
+
adminNotes?: string;
|
|
33
|
+
processedByAdminId?: string;
|
|
34
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
export const CAMPAIGN_STATUSES = [
|
|
2
|
-
'draft',
|
|
3
|
-
'awaiting_template',
|
|
4
|
-
'awaiting_payment',
|
|
5
|
-
'ready',
|
|
6
|
-
'sending',
|
|
7
|
-
'paused',
|
|
8
|
-
'completed',
|
|
9
|
-
'cancelled',
|
|
10
|
-
'pending_refund',
|
|
11
|
-
'refund_approved',
|
|
12
|
-
] as const;
|
|
13
|
-
|
|
14
|
-
export type CampaignStatusDto = (typeof CAMPAIGN_STATUSES)[number];
|
|
15
|
-
|
|
16
|
-
export const RECIPIENT_STATUSES = [
|
|
17
|
-
'pending',
|
|
18
|
-
'queued',
|
|
19
|
-
'sent',
|
|
20
|
-
'delivered',
|
|
21
|
-
'read',
|
|
22
|
-
'failed',
|
|
23
|
-
'skipped',
|
|
24
|
-
] as const;
|
|
25
|
-
|
|
26
|
-
export type RecipientStatusDto = (typeof RECIPIENT_STATUSES)[number];
|
|
27
|
-
|
|
28
|
-
export const TEMPLATE_META_STATUSES = ['pending', 'approved', 'rejected'] as const;
|
|
29
|
-
|
|
30
|
-
export type TemplateMetaStatusDto = (typeof TEMPLATE_META_STATUSES)[number];
|
|
31
|
-
|
|
32
|
-
export const TEMPLATE_CATEGORIES = ['MARKETING', 'UTILITY'] as const;
|
|
33
|
-
|
|
34
|
-
export type TemplateCategoryDto = (typeof TEMPLATE_CATEGORIES)[number];
|
|
35
|
-
|
|
36
|
-
export const REFUND_CASE_STATUSES = [
|
|
37
|
-
'pending',
|
|
38
|
-
'analyzing',
|
|
39
|
-
'approved',
|
|
40
|
-
'rejected',
|
|
41
|
-
'processed',
|
|
42
|
-
] as const;
|
|
43
|
-
|
|
44
|
-
export type RefundCaseStatusDto = (typeof REFUND_CASE_STATUSES)[number];
|
|
1
|
+
export const CAMPAIGN_STATUSES = [
|
|
2
|
+
'draft',
|
|
3
|
+
'awaiting_template',
|
|
4
|
+
'awaiting_payment',
|
|
5
|
+
'ready',
|
|
6
|
+
'sending',
|
|
7
|
+
'paused',
|
|
8
|
+
'completed',
|
|
9
|
+
'cancelled',
|
|
10
|
+
'pending_refund',
|
|
11
|
+
'refund_approved',
|
|
12
|
+
] as const;
|
|
13
|
+
|
|
14
|
+
export type CampaignStatusDto = (typeof CAMPAIGN_STATUSES)[number];
|
|
15
|
+
|
|
16
|
+
export const RECIPIENT_STATUSES = [
|
|
17
|
+
'pending',
|
|
18
|
+
'queued',
|
|
19
|
+
'sent',
|
|
20
|
+
'delivered',
|
|
21
|
+
'read',
|
|
22
|
+
'failed',
|
|
23
|
+
'skipped',
|
|
24
|
+
] as const;
|
|
25
|
+
|
|
26
|
+
export type RecipientStatusDto = (typeof RECIPIENT_STATUSES)[number];
|
|
27
|
+
|
|
28
|
+
export const TEMPLATE_META_STATUSES = ['pending', 'approved', 'rejected'] as const;
|
|
29
|
+
|
|
30
|
+
export type TemplateMetaStatusDto = (typeof TEMPLATE_META_STATUSES)[number];
|
|
31
|
+
|
|
32
|
+
export const TEMPLATE_CATEGORIES = ['MARKETING', 'UTILITY'] as const;
|
|
33
|
+
|
|
34
|
+
export type TemplateCategoryDto = (typeof TEMPLATE_CATEGORIES)[number];
|
|
35
|
+
|
|
36
|
+
export const REFUND_CASE_STATUSES = [
|
|
37
|
+
'pending',
|
|
38
|
+
'analyzing',
|
|
39
|
+
'approved',
|
|
40
|
+
'rejected',
|
|
41
|
+
'processed',
|
|
42
|
+
] as const;
|
|
43
|
+
|
|
44
|
+
export type RefundCaseStatusDto = (typeof REFUND_CASE_STATUSES)[number];
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import type { TemplateCategoryDto, TemplateMetaStatusDto } from './campaign-status.dto';
|
|
2
|
-
|
|
3
|
-
export interface CampaignTemplateDto {
|
|
4
|
-
id: string;
|
|
5
|
-
tenantId: string;
|
|
6
|
-
name: string;
|
|
7
|
-
languageCode: string;
|
|
8
|
-
category: TemplateCategoryDto | null;
|
|
9
|
-
metaTemplateName: string | null;
|
|
10
|
-
metaTemplateId: string | null;
|
|
11
|
-
metaStatus: TemplateMetaStatusDto | null;
|
|
12
|
-
headerText: string | null;
|
|
13
|
-
bodyText: string;
|
|
14
|
-
footerText: string | null;
|
|
15
|
-
buttons: Record<string, unknown>[] | null;
|
|
16
|
-
isOfficial: boolean;
|
|
17
|
-
metaSyncedAt: string | null;
|
|
18
|
-
createdAt: string;
|
|
19
|
-
updatedAt: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface CampaignTemplateListResponseDto {
|
|
23
|
-
items: CampaignTemplateDto[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface TemplateVariablePreviewDto {
|
|
27
|
-
variableName: string;
|
|
28
|
-
sampleValue: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface TemplatePreviewRequestDto {
|
|
32
|
-
bodyText: string;
|
|
33
|
-
variables: TemplateVariablePreviewDto[];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface TemplatePreviewResponseDto {
|
|
37
|
-
previewText: string;
|
|
38
|
-
}
|
|
1
|
+
import type { TemplateCategoryDto, TemplateMetaStatusDto } from './campaign-status.dto';
|
|
2
|
+
|
|
3
|
+
export interface CampaignTemplateDto {
|
|
4
|
+
id: string;
|
|
5
|
+
tenantId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
languageCode: string;
|
|
8
|
+
category: TemplateCategoryDto | null;
|
|
9
|
+
metaTemplateName: string | null;
|
|
10
|
+
metaTemplateId: string | null;
|
|
11
|
+
metaStatus: TemplateMetaStatusDto | null;
|
|
12
|
+
headerText: string | null;
|
|
13
|
+
bodyText: string;
|
|
14
|
+
footerText: string | null;
|
|
15
|
+
buttons: Record<string, unknown>[] | null;
|
|
16
|
+
isOfficial: boolean;
|
|
17
|
+
metaSyncedAt: string | null;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CampaignTemplateListResponseDto {
|
|
23
|
+
items: CampaignTemplateDto[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface TemplateVariablePreviewDto {
|
|
27
|
+
variableName: string;
|
|
28
|
+
sampleValue: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface TemplatePreviewRequestDto {
|
|
32
|
+
bodyText: string;
|
|
33
|
+
variables: TemplateVariablePreviewDto[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface TemplatePreviewResponseDto {
|
|
37
|
+
previewText: string;
|
|
38
|
+
}
|
|
@@ -1,50 +1,71 @@
|
|
|
1
|
-
import type { CampaignTemplateDto } from './campaign-template.dto';
|
|
2
|
-
import type { CampaignStatusDto, TemplateCategoryDto } from './campaign-status.dto';
|
|
3
|
-
|
|
4
|
-
export interface CampaignDto {
|
|
5
|
-
id: string;
|
|
6
|
-
tenantId: string;
|
|
7
|
-
name: string;
|
|
8
|
-
status: CampaignStatusDto;
|
|
9
|
-
templateId: string | null;
|
|
10
|
-
isOfficial: boolean;
|
|
11
|
-
templateCategory: TemplateCategoryDto | null;
|
|
12
|
-
audienceFilters: Record<string, unknown>[] | null;
|
|
13
|
-
totalRecipients: number;
|
|
14
|
-
sentCount: number;
|
|
15
|
-
deliveredCount: number;
|
|
16
|
-
readCount: number;
|
|
17
|
-
failedCount: number;
|
|
18
|
-
repliedCount: number;
|
|
19
|
-
delayBetweenSendsMs: number;
|
|
20
|
-
estimatedCostCents: number;
|
|
21
|
-
actualCostCents: number;
|
|
22
|
-
billingId: string | null;
|
|
23
|
-
paymentConfirmed: boolean;
|
|
24
|
-
scheduledAt: string | null;
|
|
25
|
-
startedAt: string | null;
|
|
26
|
-
completedAt: string | null;
|
|
27
|
-
pausedAt: string | null;
|
|
28
|
-
createdByUserId: string | null;
|
|
29
|
-
createdAt: string;
|
|
30
|
-
updatedAt: string;
|
|
31
|
-
/** Template associado (quando foi carregado no serviço); `null` sem template. */
|
|
32
|
-
template: CampaignTemplateDto | null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface CampaignListResponseDto {
|
|
36
|
-
items: CampaignDto[];
|
|
37
|
-
total: number;
|
|
38
|
-
page: number;
|
|
39
|
-
limit: number;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
import type { CampaignTemplateDto } from './campaign-template.dto';
|
|
2
|
+
import type { CampaignStatusDto, TemplateCategoryDto } from './campaign-status.dto';
|
|
3
|
+
|
|
4
|
+
export interface CampaignDto {
|
|
5
|
+
id: string;
|
|
6
|
+
tenantId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
status: CampaignStatusDto;
|
|
9
|
+
templateId: string | null;
|
|
10
|
+
isOfficial: boolean;
|
|
11
|
+
templateCategory: TemplateCategoryDto | null;
|
|
12
|
+
audienceFilters: Record<string, unknown>[] | null;
|
|
13
|
+
totalRecipients: number;
|
|
14
|
+
sentCount: number;
|
|
15
|
+
deliveredCount: number;
|
|
16
|
+
readCount: number;
|
|
17
|
+
failedCount: number;
|
|
18
|
+
repliedCount: number;
|
|
19
|
+
delayBetweenSendsMs: number;
|
|
20
|
+
estimatedCostCents: number;
|
|
21
|
+
actualCostCents: number;
|
|
22
|
+
billingId: string | null;
|
|
23
|
+
paymentConfirmed: boolean;
|
|
24
|
+
scheduledAt: string | null;
|
|
25
|
+
startedAt: string | null;
|
|
26
|
+
completedAt: string | null;
|
|
27
|
+
pausedAt: string | null;
|
|
28
|
+
createdByUserId: string | null;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
/** Template associado (quando foi carregado no serviço); `null` sem template. */
|
|
32
|
+
template: CampaignTemplateDto | null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface CampaignListResponseDto {
|
|
36
|
+
items: CampaignDto[];
|
|
37
|
+
total: number;
|
|
38
|
+
page: number;
|
|
39
|
+
limit: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Métricas por URL rastreado (campanhas não oficiais com substituição de links). */
|
|
43
|
+
export interface CampaignLinkStatDto {
|
|
44
|
+
targetUrl: string;
|
|
45
|
+
/** Quantidade de destinatários (pacientes) com pelo menos um clique neste link. */
|
|
46
|
+
uniqueRecipientsClicked: number;
|
|
47
|
+
/** Total de cliques (inclui reaberturas). */
|
|
48
|
+
totalClicks: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface CampaignStatsDto {
|
|
52
|
+
total: number;
|
|
53
|
+
pending: number;
|
|
54
|
+
sent: number;
|
|
55
|
+
delivered: number;
|
|
56
|
+
read: number;
|
|
57
|
+
failed: number;
|
|
58
|
+
replied: number;
|
|
59
|
+
/** Leituras com confirmação explícita do webhook da Meta. */
|
|
60
|
+
readFromMeta?: number;
|
|
61
|
+
/** Leituras confirmadas por webhook Evolution (quando disponível). */
|
|
62
|
+
readFromEvolution?: number;
|
|
63
|
+
/**
|
|
64
|
+
* `read_at` preenchido sem origem de canal conhecida (legado ou provedor sem indicador).
|
|
65
|
+
*/
|
|
66
|
+
readUnconfirmed?: number;
|
|
67
|
+
/** Destinatários com pelo menos um clique em link rastreado. */
|
|
68
|
+
linkClickRecipients?: number;
|
|
69
|
+
/** Por link: URL de destino e quantos pacientes clicaram. */
|
|
70
|
+
trackedLinks?: CampaignLinkStatDto[];
|
|
71
|
+
}
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import type { TemplateCategoryDto } from './campaign-status.dto';
|
|
2
|
-
|
|
3
|
-
export interface CreateCampaignRequestDto {
|
|
4
|
-
name: string;
|
|
5
|
-
templateId?: string;
|
|
6
|
-
isOfficial?: boolean;
|
|
7
|
-
audienceFilters?: Record<string, unknown>[];
|
|
8
|
-
delayBetweenSendsMs?: number;
|
|
9
|
-
scheduledAt?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface UpdateCampaignRequestDto {
|
|
13
|
-
name?: string;
|
|
14
|
-
templateId?: string;
|
|
15
|
-
audienceFilters?: Record<string, unknown>[];
|
|
16
|
-
delayBetweenSendsMs?: number;
|
|
17
|
-
scheduledAt?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface CreateCampaignTemplateRequestDto {
|
|
21
|
-
name: string;
|
|
22
|
-
languageCode?: string;
|
|
23
|
-
category?: TemplateCategoryDto;
|
|
24
|
-
bodyText: string;
|
|
25
|
-
headerText?: string;
|
|
26
|
-
footerText?: string;
|
|
27
|
-
isOfficial?: boolean;
|
|
28
|
-
buttons?: Record<string, unknown>[];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface StartCampaignRequestDto {
|
|
32
|
-
campaignId: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface PauseCampaignRequestDto {
|
|
36
|
-
campaignId: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface ResumeCampaignRequestDto {
|
|
40
|
-
campaignId: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface CancelCampaignRequestDto {
|
|
44
|
-
campaignId: string;
|
|
45
|
-
reason?: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface ConfirmCampaignPaymentRequestDto {
|
|
49
|
-
campaignId: string;
|
|
50
|
-
billingId: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface PopulateRecipientsRequestDto {
|
|
54
|
-
campaignId: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface PopulateRecipientsResponseDto {
|
|
58
|
-
count: number;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface CampaignCostEstimateRequestDto {
|
|
62
|
-
campaignId: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface CampaignCostEstimateResponseDto {
|
|
66
|
-
totalRecipients: number;
|
|
67
|
-
costPerMessageCents: number;
|
|
68
|
-
estimatedTotalCents: number;
|
|
69
|
-
category: TemplateCategoryDto;
|
|
70
|
-
}
|
|
1
|
+
import type { TemplateCategoryDto } from './campaign-status.dto';
|
|
2
|
+
|
|
3
|
+
export interface CreateCampaignRequestDto {
|
|
4
|
+
name: string;
|
|
5
|
+
templateId?: string;
|
|
6
|
+
isOfficial?: boolean;
|
|
7
|
+
audienceFilters?: Record<string, unknown>[];
|
|
8
|
+
delayBetweenSendsMs?: number;
|
|
9
|
+
scheduledAt?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface UpdateCampaignRequestDto {
|
|
13
|
+
name?: string;
|
|
14
|
+
templateId?: string;
|
|
15
|
+
audienceFilters?: Record<string, unknown>[];
|
|
16
|
+
delayBetweenSendsMs?: number;
|
|
17
|
+
scheduledAt?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface CreateCampaignTemplateRequestDto {
|
|
21
|
+
name: string;
|
|
22
|
+
languageCode?: string;
|
|
23
|
+
category?: TemplateCategoryDto;
|
|
24
|
+
bodyText: string;
|
|
25
|
+
headerText?: string;
|
|
26
|
+
footerText?: string;
|
|
27
|
+
isOfficial?: boolean;
|
|
28
|
+
buttons?: Record<string, unknown>[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface StartCampaignRequestDto {
|
|
32
|
+
campaignId: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface PauseCampaignRequestDto {
|
|
36
|
+
campaignId: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ResumeCampaignRequestDto {
|
|
40
|
+
campaignId: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface CancelCampaignRequestDto {
|
|
44
|
+
campaignId: string;
|
|
45
|
+
reason?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ConfirmCampaignPaymentRequestDto {
|
|
49
|
+
campaignId: string;
|
|
50
|
+
billingId: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface PopulateRecipientsRequestDto {
|
|
54
|
+
campaignId: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface PopulateRecipientsResponseDto {
|
|
58
|
+
count: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface CampaignCostEstimateRequestDto {
|
|
62
|
+
campaignId: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface CampaignCostEstimateResponseDto {
|
|
66
|
+
totalRecipients: number;
|
|
67
|
+
costPerMessageCents: number;
|
|
68
|
+
estimatedTotalCents: number;
|
|
69
|
+
category: TemplateCategoryDto;
|
|
70
|
+
}
|
package/src/campaigns/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './campaign-status.dto';
|
|
2
|
-
export * from './campaign.dto';
|
|
3
|
-
export * from './campaign-template.dto';
|
|
4
|
-
export * from './campaign-recipient.dto';
|
|
5
|
-
export * from './campaign-refund.dto';
|
|
6
|
-
export * from './create-campaign.dto';
|
|
1
|
+
export * from './campaign-status.dto';
|
|
2
|
+
export * from './campaign.dto';
|
|
3
|
+
export * from './campaign-template.dto';
|
|
4
|
+
export * from './campaign-recipient.dto';
|
|
5
|
+
export * from './campaign-refund.dto';
|
|
6
|
+
export * from './create-campaign.dto';
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
-
import { IsString, MaxLength, MinLength } from 'class-validator';
|
|
3
|
-
|
|
4
|
-
/** RMQ: serviço interno pede remoção de objeto validando escopo por tenant. */
|
|
5
|
-
export class DeleteObjectRpcDto {
|
|
6
|
-
@ApiProperty({
|
|
7
|
-
description: 'Tenant slug (deve corresponder ao prefixo do objectKey)',
|
|
8
|
-
example: 'clinica_sampaio',
|
|
9
|
-
})
|
|
10
|
-
@IsString()
|
|
11
|
-
@MinLength(1)
|
|
12
|
-
@MaxLength(255)
|
|
13
|
-
tenantSlug: string;
|
|
14
|
-
|
|
15
|
-
@ApiProperty({
|
|
16
|
-
description: 'Chave S3 do objeto',
|
|
17
|
-
example: 'tenants/clinica_sampaio/patients/.../doc.pdf',
|
|
18
|
-
})
|
|
19
|
-
@IsString()
|
|
20
|
-
@MinLength(1)
|
|
21
|
-
@MaxLength(2048)
|
|
22
|
-
objectKey: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class DeleteObjectRpcResultDto {
|
|
26
|
-
@ApiProperty({ description: 'Confirmação da remoção' })
|
|
27
|
-
ok: true;
|
|
28
|
-
}
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsString, MaxLength, MinLength } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
/** RMQ: serviço interno pede remoção de objeto validando escopo por tenant. */
|
|
5
|
+
export class DeleteObjectRpcDto {
|
|
6
|
+
@ApiProperty({
|
|
7
|
+
description: 'Tenant slug (deve corresponder ao prefixo do objectKey)',
|
|
8
|
+
example: 'clinica_sampaio',
|
|
9
|
+
})
|
|
10
|
+
@IsString()
|
|
11
|
+
@MinLength(1)
|
|
12
|
+
@MaxLength(255)
|
|
13
|
+
tenantSlug: string;
|
|
14
|
+
|
|
15
|
+
@ApiProperty({
|
|
16
|
+
description: 'Chave S3 do objeto',
|
|
17
|
+
example: 'tenants/clinica_sampaio/patients/.../doc.pdf',
|
|
18
|
+
})
|
|
19
|
+
@IsString()
|
|
20
|
+
@MinLength(1)
|
|
21
|
+
@MaxLength(2048)
|
|
22
|
+
objectKey: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class DeleteObjectRpcResultDto {
|
|
26
|
+
@ApiProperty({ description: 'Confirmação da remoção' })
|
|
27
|
+
ok: true;
|
|
28
|
+
}
|