evo360-types 1.3.442 → 1.3.444
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/apps/evo-med/calendar/zod-schemas.d.ts +1260 -1260
- package/dist/apps/evo-med/calendar/zod-schemas.js +38 -20
- package/dist/apps/evo-med/calendar/zod-schemas.ts +38 -20
- package/dist/types/evo-med/calendar/index.d.ts +20 -20
- package/dist/types/evo-med/calendar/index.ts +27 -20
- package/package.json +1 -1
|
@@ -7,23 +7,35 @@ const zod_schemas_2 = require("../people/zod-schemas");
|
|
|
7
7
|
const zod_schemas_3 = require("../../evo-integrations/zod-schemas");
|
|
8
8
|
// ----- Notification config (feat-048) — molde do `sync_config`: estruturado +
|
|
9
9
|
// `.passthrough()` p/ tolerar campos futuros sem republish.
|
|
10
|
+
//
|
|
11
|
+
// Todo campo opcional aqui é `.nullable()`: o editor do FE materializa "não
|
|
12
|
+
// escolhido" como `null` explícito (`department_id: wa.department_id ?? null` em
|
|
13
|
+
// `utils/calendarNotificationConfig.ts`), e `.passthrough()` NÃO cobre isso —
|
|
14
|
+
// ele só tolera chaves não declaradas, não valor null em chave declarada. Sem
|
|
15
|
+
// `.nullable()` o doc inteiro do calendário reprova, e quem usa `parseDoc`
|
|
16
|
+
// estrito (ex.: AppointmentRouterDialog) fica sem calendário e não renderiza.
|
|
10
17
|
const zNotificationWhatsappConfigSchema = zod_1.z
|
|
11
18
|
.object({
|
|
12
19
|
enabled: zod_1.z.boolean(),
|
|
13
|
-
channel_id: zod_1.z.string().min(1).max(60).optional(),
|
|
14
|
-
department_id: zod_1.z.string().min(1).max(60).optional(),
|
|
15
|
-
reminder_template_id: zod_1.z.string().min(1).max(120).optional(),
|
|
16
|
-
on_confirm_quick_reply_id: zod_1.z.string().min(1).max(120).optional(),
|
|
17
|
-
on_reschedule_quick_reply_id: zod_1.z
|
|
20
|
+
channel_id: zod_1.z.string().min(1).max(60).nullable().optional(),
|
|
21
|
+
department_id: zod_1.z.string().min(1).max(60).nullable().optional(),
|
|
22
|
+
reminder_template_id: zod_1.z.string().min(1).max(120).nullable().optional(),
|
|
23
|
+
on_confirm_quick_reply_id: zod_1.z.string().min(1).max(120).nullable().optional(),
|
|
24
|
+
on_reschedule_quick_reply_id: zod_1.z
|
|
25
|
+
.string()
|
|
26
|
+
.min(1)
|
|
27
|
+
.max(120)
|
|
28
|
+
.nullable()
|
|
29
|
+
.optional(),
|
|
18
30
|
})
|
|
19
31
|
.passthrough();
|
|
20
32
|
const zNotificationEmailConfigSchema = zod_1.z
|
|
21
33
|
.object({
|
|
22
34
|
enabled: zod_1.z.boolean(),
|
|
23
|
-
channel_id: zod_1.z.string().min(1).max(60).optional(),
|
|
24
|
-
reminder_template_id: zod_1.z.string().min(1).max(120).optional(),
|
|
25
|
-
on_confirm_template_id: zod_1.z.string().min(1).max(120).optional(),
|
|
26
|
-
on_reschedule_template_id: zod_1.z.string().min(1).max(120).optional(),
|
|
35
|
+
channel_id: zod_1.z.string().min(1).max(60).nullable().optional(),
|
|
36
|
+
reminder_template_id: zod_1.z.string().min(1).max(120).nullable().optional(),
|
|
37
|
+
on_confirm_template_id: zod_1.z.string().min(1).max(120).nullable().optional(),
|
|
38
|
+
on_reschedule_template_id: zod_1.z.string().min(1).max(120).nullable().optional(),
|
|
27
39
|
})
|
|
28
40
|
.passthrough();
|
|
29
41
|
// feat-092: mapa GENÉRICO de configs de notificação (config × canal × template).
|
|
@@ -39,25 +51,31 @@ const zNotificationCtaSchema = zod_1.z
|
|
|
39
51
|
.passthrough();
|
|
40
52
|
const zNotificationChannelEntrySchema = zod_1.z
|
|
41
53
|
.object({
|
|
42
|
-
enabled: zod_1.z.boolean().optional(),
|
|
43
|
-
channel_id: zod_1.z.string().min(1).max(60).optional(),
|
|
44
|
-
department_id: zod_1.z.string().min(1).max(60).optional(),
|
|
45
|
-
template_id: zod_1.z.string().min(1).max(120).optional(),
|
|
46
|
-
template_type: zod_1.z.string().min(1).max(40).optional(),
|
|
47
|
-
ctas: zod_1.z.array(zNotificationCtaSchema).optional(),
|
|
54
|
+
enabled: zod_1.z.boolean().nullable().optional(),
|
|
55
|
+
channel_id: zod_1.z.string().min(1).max(60).nullable().optional(),
|
|
56
|
+
department_id: zod_1.z.string().min(1).max(60).nullable().optional(),
|
|
57
|
+
template_id: zod_1.z.string().min(1).max(120).nullable().optional(),
|
|
58
|
+
template_type: zod_1.z.string().min(1).max(40).nullable().optional(),
|
|
59
|
+
ctas: zod_1.z.array(zNotificationCtaSchema).nullable().optional(),
|
|
48
60
|
})
|
|
49
61
|
.passthrough();
|
|
50
62
|
const zNotificationEntrySchema = zod_1.z
|
|
51
63
|
.object({
|
|
52
|
-
enabled: zod_1.z.boolean().optional(),
|
|
53
|
-
channels: zod_1.z
|
|
64
|
+
enabled: zod_1.z.boolean().nullable().optional(),
|
|
65
|
+
channels: zod_1.z
|
|
66
|
+
.record(zod_1.z.string(), zNotificationChannelEntrySchema)
|
|
67
|
+
.nullable()
|
|
68
|
+
.optional(),
|
|
54
69
|
})
|
|
55
70
|
.passthrough();
|
|
56
71
|
exports.zMedCalendarNotificationConfigSchema = zod_1.z
|
|
57
72
|
.object({
|
|
58
|
-
whatsapp: zNotificationWhatsappConfigSchema.optional(),
|
|
59
|
-
email: zNotificationEmailConfigSchema.optional(),
|
|
60
|
-
configs: zod_1.z
|
|
73
|
+
whatsapp: zNotificationWhatsappConfigSchema.nullable().optional(),
|
|
74
|
+
email: zNotificationEmailConfigSchema.nullable().optional(),
|
|
75
|
+
configs: zod_1.z
|
|
76
|
+
.record(zod_1.z.string(), zNotificationEntrySchema)
|
|
77
|
+
.nullable()
|
|
78
|
+
.optional(),
|
|
61
79
|
})
|
|
62
80
|
.passthrough();
|
|
63
81
|
exports.zMedCalendarSchema = zod_schemas_1.zFireDocSchema
|
|
@@ -5,24 +5,36 @@ import { zMedCalendarIntegrationSchema } from "../../evo-integrations/zod-schema
|
|
|
5
5
|
|
|
6
6
|
// ----- Notification config (feat-048) — molde do `sync_config`: estruturado +
|
|
7
7
|
// `.passthrough()` p/ tolerar campos futuros sem republish.
|
|
8
|
+
//
|
|
9
|
+
// Todo campo opcional aqui é `.nullable()`: o editor do FE materializa "não
|
|
10
|
+
// escolhido" como `null` explícito (`department_id: wa.department_id ?? null` em
|
|
11
|
+
// `utils/calendarNotificationConfig.ts`), e `.passthrough()` NÃO cobre isso —
|
|
12
|
+
// ele só tolera chaves não declaradas, não valor null em chave declarada. Sem
|
|
13
|
+
// `.nullable()` o doc inteiro do calendário reprova, e quem usa `parseDoc`
|
|
14
|
+
// estrito (ex.: AppointmentRouterDialog) fica sem calendário e não renderiza.
|
|
8
15
|
const zNotificationWhatsappConfigSchema = z
|
|
9
16
|
.object({
|
|
10
17
|
enabled: z.boolean(),
|
|
11
|
-
channel_id: z.string().min(1).max(60).optional(),
|
|
12
|
-
department_id: z.string().min(1).max(60).optional(),
|
|
13
|
-
reminder_template_id: z.string().min(1).max(120).optional(),
|
|
14
|
-
on_confirm_quick_reply_id: z.string().min(1).max(120).optional(),
|
|
15
|
-
on_reschedule_quick_reply_id: z
|
|
18
|
+
channel_id: z.string().min(1).max(60).nullable().optional(),
|
|
19
|
+
department_id: z.string().min(1).max(60).nullable().optional(),
|
|
20
|
+
reminder_template_id: z.string().min(1).max(120).nullable().optional(),
|
|
21
|
+
on_confirm_quick_reply_id: z.string().min(1).max(120).nullable().optional(),
|
|
22
|
+
on_reschedule_quick_reply_id: z
|
|
23
|
+
.string()
|
|
24
|
+
.min(1)
|
|
25
|
+
.max(120)
|
|
26
|
+
.nullable()
|
|
27
|
+
.optional(),
|
|
16
28
|
})
|
|
17
29
|
.passthrough();
|
|
18
30
|
|
|
19
31
|
const zNotificationEmailConfigSchema = z
|
|
20
32
|
.object({
|
|
21
33
|
enabled: z.boolean(),
|
|
22
|
-
channel_id: z.string().min(1).max(60).optional(),
|
|
23
|
-
reminder_template_id: z.string().min(1).max(120).optional(),
|
|
24
|
-
on_confirm_template_id: z.string().min(1).max(120).optional(),
|
|
25
|
-
on_reschedule_template_id: z.string().min(1).max(120).optional(),
|
|
34
|
+
channel_id: z.string().min(1).max(60).nullable().optional(),
|
|
35
|
+
reminder_template_id: z.string().min(1).max(120).nullable().optional(),
|
|
36
|
+
on_confirm_template_id: z.string().min(1).max(120).nullable().optional(),
|
|
37
|
+
on_reschedule_template_id: z.string().min(1).max(120).nullable().optional(),
|
|
26
38
|
})
|
|
27
39
|
.passthrough();
|
|
28
40
|
|
|
@@ -40,27 +52,33 @@ const zNotificationCtaSchema = z
|
|
|
40
52
|
|
|
41
53
|
const zNotificationChannelEntrySchema = z
|
|
42
54
|
.object({
|
|
43
|
-
enabled: z.boolean().optional(),
|
|
44
|
-
channel_id: z.string().min(1).max(60).optional(),
|
|
45
|
-
department_id: z.string().min(1).max(60).optional(),
|
|
46
|
-
template_id: z.string().min(1).max(120).optional(),
|
|
47
|
-
template_type: z.string().min(1).max(40).optional(),
|
|
48
|
-
ctas: z.array(zNotificationCtaSchema).optional(),
|
|
55
|
+
enabled: z.boolean().nullable().optional(),
|
|
56
|
+
channel_id: z.string().min(1).max(60).nullable().optional(),
|
|
57
|
+
department_id: z.string().min(1).max(60).nullable().optional(),
|
|
58
|
+
template_id: z.string().min(1).max(120).nullable().optional(),
|
|
59
|
+
template_type: z.string().min(1).max(40).nullable().optional(),
|
|
60
|
+
ctas: z.array(zNotificationCtaSchema).nullable().optional(),
|
|
49
61
|
})
|
|
50
62
|
.passthrough();
|
|
51
63
|
|
|
52
64
|
const zNotificationEntrySchema = z
|
|
53
65
|
.object({
|
|
54
|
-
enabled: z.boolean().optional(),
|
|
55
|
-
channels: z
|
|
66
|
+
enabled: z.boolean().nullable().optional(),
|
|
67
|
+
channels: z
|
|
68
|
+
.record(z.string(), zNotificationChannelEntrySchema)
|
|
69
|
+
.nullable()
|
|
70
|
+
.optional(),
|
|
56
71
|
})
|
|
57
72
|
.passthrough();
|
|
58
73
|
|
|
59
74
|
export const zMedCalendarNotificationConfigSchema = z
|
|
60
75
|
.object({
|
|
61
|
-
whatsapp: zNotificationWhatsappConfigSchema.optional(),
|
|
62
|
-
email: zNotificationEmailConfigSchema.optional(),
|
|
63
|
-
configs: z
|
|
76
|
+
whatsapp: zNotificationWhatsappConfigSchema.nullable().optional(),
|
|
77
|
+
email: zNotificationEmailConfigSchema.nullable().optional(),
|
|
78
|
+
configs: z
|
|
79
|
+
.record(z.string(), zNotificationEntrySchema)
|
|
80
|
+
.nullable()
|
|
81
|
+
.optional(),
|
|
64
82
|
})
|
|
65
83
|
.passthrough();
|
|
66
84
|
|
|
@@ -15,27 +15,27 @@ export interface IMedCalendarNotificationConfig {
|
|
|
15
15
|
whatsapp?: {
|
|
16
16
|
enabled: boolean;
|
|
17
17
|
/** Doc id do canal evo-chat/whatsapp por onde o lembrete sai. */
|
|
18
|
-
channel_id?: string;
|
|
19
|
-
department_id?: string;
|
|
18
|
+
channel_id?: string | null;
|
|
19
|
+
department_id?: string | null;
|
|
20
20
|
/** HSM que carrega o texto do lembrete (a Meta guarda o corpo; nós só passamos as variáveis). */
|
|
21
|
-
reminder_template_id?: string;
|
|
21
|
+
reminder_template_id?: string | null;
|
|
22
22
|
/** Quick-reply a responder quando o paciente confirmar (consumido pela feat-056). */
|
|
23
|
-
on_confirm_quick_reply_id?: string;
|
|
23
|
+
on_confirm_quick_reply_id?: string | null;
|
|
24
24
|
/** Quick-reply a responder quando o paciente pedir remarcação (feat-056). */
|
|
25
|
-
on_reschedule_quick_reply_id?: string;
|
|
26
|
-
};
|
|
25
|
+
on_reschedule_quick_reply_id?: string | null;
|
|
26
|
+
} | null;
|
|
27
27
|
/** E-mail: envia o lembrete via template de e-mail (corpo renderizado pelo engine). */
|
|
28
28
|
email?: {
|
|
29
29
|
enabled: boolean;
|
|
30
30
|
/** Doc id do canal de e-mail. */
|
|
31
|
-
channel_id?: string;
|
|
31
|
+
channel_id?: string | null;
|
|
32
32
|
/** Template do e-mail de lembrete. */
|
|
33
|
-
reminder_template_id?: string;
|
|
33
|
+
reminder_template_id?: string | null;
|
|
34
34
|
/** Template do e-mail enviado após confirmação (feat-056). */
|
|
35
|
-
on_confirm_template_id?: string;
|
|
35
|
+
on_confirm_template_id?: string | null;
|
|
36
36
|
/** Template do e-mail enviado após pedido de remarcação (feat-056). */
|
|
37
|
-
on_reschedule_template_id?: string;
|
|
38
|
-
};
|
|
37
|
+
on_reschedule_template_id?: string | null;
|
|
38
|
+
} | null;
|
|
39
39
|
/**
|
|
40
40
|
* Mapa GENÉRICO de configs de notificação (feat-092). A chave (`configKey`) é
|
|
41
41
|
* livre; o SIGNIFICADO (`appointment_reminder` | `appointment_created` | …) mora
|
|
@@ -46,31 +46,31 @@ export interface IMedCalendarNotificationConfig {
|
|
|
46
46
|
*/
|
|
47
47
|
configs?: {
|
|
48
48
|
[configKey: string]: IMedCalendarNotificationEntry;
|
|
49
|
-
};
|
|
49
|
+
} | null;
|
|
50
50
|
}
|
|
51
51
|
/** Uma config de notificação (feat-092): um evento/momento × seus canais. */
|
|
52
52
|
export interface IMedCalendarNotificationEntry {
|
|
53
53
|
/** Opt-in do config inteiro. Ausente/false ⇒ leitor ignora. */
|
|
54
|
-
enabled?: boolean;
|
|
54
|
+
enabled?: boolean | null;
|
|
55
55
|
/** Canais habilitados, keyed por tipo ('whatsapp' | 'email' | futuro). */
|
|
56
56
|
channels?: {
|
|
57
57
|
[channelKind: string]: IMedCalendarNotificationChannelEntry;
|
|
58
|
-
};
|
|
58
|
+
} | null;
|
|
59
59
|
}
|
|
60
60
|
/** Config de um canal dentro de um config de notificação (feat-092). */
|
|
61
61
|
export interface IMedCalendarNotificationChannelEntry {
|
|
62
62
|
/** Opt-in do canal. Ausente/false ⇒ leitor ignora este canal. */
|
|
63
|
-
enabled?: boolean;
|
|
63
|
+
enabled?: boolean | null;
|
|
64
64
|
/** Doc id do canal por onde a mensagem sai. Sem herança — usa o que estiver aqui. */
|
|
65
|
-
channel_id?: string;
|
|
65
|
+
channel_id?: string | null;
|
|
66
66
|
/** Departamento que recebe/roteia (opcional). */
|
|
67
|
-
department_id?: string;
|
|
67
|
+
department_id?: string | null;
|
|
68
68
|
/** Template principal da mensagem (HSM name no WA / template_id lógico no email). */
|
|
69
|
-
template_id?: string;
|
|
69
|
+
template_id?: string | null;
|
|
70
70
|
/** Tipo do template principal: 'hsm' | 'email' | … O leitor pode inferir pelo canal. */
|
|
71
|
-
template_type?: string;
|
|
71
|
+
template_type?: string | null;
|
|
72
72
|
/** Botões/ações da mensagem → artefato de resposta de cada um. */
|
|
73
|
-
ctas?: IMedCalendarNotificationCta[];
|
|
73
|
+
ctas?: IMedCalendarNotificationCta[] | null;
|
|
74
74
|
}
|
|
75
75
|
/** Um CTA (botão/ação) e o artefato enviado quando o paciente o aciona (feat-092). */
|
|
76
76
|
export interface IMedCalendarNotificationCta {
|
|
@@ -20,32 +20,37 @@ export type EvoMedCalendarPermissions =
|
|
|
20
20
|
// e, futuramente, pela feat-056 (resposta ao confirmar/remarcar). Molde do bloco
|
|
21
21
|
// `integration.sync_config`: estruturado, validado por zod, com `.passthrough()`
|
|
22
22
|
// para tolerar campos futuros sem republish.
|
|
23
|
+
//
|
|
24
|
+
// `| null` em todo campo opcional NÃO é decorativo: o editor do FE grava "não
|
|
25
|
+
// escolhido" como `null` explícito (ver `utils/calendarNotificationConfig.ts`),
|
|
26
|
+
// e `.passthrough()` não cobre valor null em chave declarada — só chave
|
|
27
|
+
// desconhecida. Sem isso o doc do calendário inteiro reprova no zod.
|
|
23
28
|
export interface IMedCalendarNotificationConfig {
|
|
24
29
|
/** WhatsApp: envia o lembrete via HSM + botões de confirmar/remarcar. */
|
|
25
30
|
whatsapp?: {
|
|
26
31
|
enabled: boolean;
|
|
27
32
|
/** Doc id do canal evo-chat/whatsapp por onde o lembrete sai. */
|
|
28
|
-
channel_id?: string;
|
|
29
|
-
department_id?: string;
|
|
33
|
+
channel_id?: string | null;
|
|
34
|
+
department_id?: string | null;
|
|
30
35
|
/** HSM que carrega o texto do lembrete (a Meta guarda o corpo; nós só passamos as variáveis). */
|
|
31
|
-
reminder_template_id?: string;
|
|
36
|
+
reminder_template_id?: string | null;
|
|
32
37
|
/** Quick-reply a responder quando o paciente confirmar (consumido pela feat-056). */
|
|
33
|
-
on_confirm_quick_reply_id?: string;
|
|
38
|
+
on_confirm_quick_reply_id?: string | null;
|
|
34
39
|
/** Quick-reply a responder quando o paciente pedir remarcação (feat-056). */
|
|
35
|
-
on_reschedule_quick_reply_id?: string;
|
|
36
|
-
};
|
|
40
|
+
on_reschedule_quick_reply_id?: string | null;
|
|
41
|
+
} | null;
|
|
37
42
|
/** E-mail: envia o lembrete via template de e-mail (corpo renderizado pelo engine). */
|
|
38
43
|
email?: {
|
|
39
44
|
enabled: boolean;
|
|
40
45
|
/** Doc id do canal de e-mail. */
|
|
41
|
-
channel_id?: string;
|
|
46
|
+
channel_id?: string | null;
|
|
42
47
|
/** Template do e-mail de lembrete. */
|
|
43
|
-
reminder_template_id?: string;
|
|
48
|
+
reminder_template_id?: string | null;
|
|
44
49
|
/** Template do e-mail enviado após confirmação (feat-056). */
|
|
45
|
-
on_confirm_template_id?: string;
|
|
50
|
+
on_confirm_template_id?: string | null;
|
|
46
51
|
/** Template do e-mail enviado após pedido de remarcação (feat-056). */
|
|
47
|
-
on_reschedule_template_id?: string;
|
|
48
|
-
};
|
|
52
|
+
on_reschedule_template_id?: string | null;
|
|
53
|
+
} | null;
|
|
49
54
|
|
|
50
55
|
/**
|
|
51
56
|
* Mapa GENÉRICO de configs de notificação (feat-092). A chave (`configKey`) é
|
|
@@ -55,31 +60,33 @@ export interface IMedCalendarNotificationConfig {
|
|
|
55
60
|
* config incompleta ⇒ o leitor não faz nada. Coexiste com os blocos `whatsapp`/
|
|
56
61
|
* `email` legados (que os consumidores atuais ainda leem).
|
|
57
62
|
*/
|
|
58
|
-
configs?: { [configKey: string]: IMedCalendarNotificationEntry };
|
|
63
|
+
configs?: { [configKey: string]: IMedCalendarNotificationEntry } | null;
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
/** Uma config de notificação (feat-092): um evento/momento × seus canais. */
|
|
62
67
|
export interface IMedCalendarNotificationEntry {
|
|
63
68
|
/** Opt-in do config inteiro. Ausente/false ⇒ leitor ignora. */
|
|
64
|
-
enabled?: boolean;
|
|
69
|
+
enabled?: boolean | null;
|
|
65
70
|
/** Canais habilitados, keyed por tipo ('whatsapp' | 'email' | futuro). */
|
|
66
|
-
channels?: {
|
|
71
|
+
channels?: {
|
|
72
|
+
[channelKind: string]: IMedCalendarNotificationChannelEntry;
|
|
73
|
+
} | null;
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
/** Config de um canal dentro de um config de notificação (feat-092). */
|
|
70
77
|
export interface IMedCalendarNotificationChannelEntry {
|
|
71
78
|
/** Opt-in do canal. Ausente/false ⇒ leitor ignora este canal. */
|
|
72
|
-
enabled?: boolean;
|
|
79
|
+
enabled?: boolean | null;
|
|
73
80
|
/** Doc id do canal por onde a mensagem sai. Sem herança — usa o que estiver aqui. */
|
|
74
|
-
channel_id?: string;
|
|
81
|
+
channel_id?: string | null;
|
|
75
82
|
/** Departamento que recebe/roteia (opcional). */
|
|
76
|
-
department_id?: string;
|
|
83
|
+
department_id?: string | null;
|
|
77
84
|
/** Template principal da mensagem (HSM name no WA / template_id lógico no email). */
|
|
78
|
-
template_id?: string;
|
|
85
|
+
template_id?: string | null;
|
|
79
86
|
/** Tipo do template principal: 'hsm' | 'email' | … O leitor pode inferir pelo canal. */
|
|
80
|
-
template_type?: string;
|
|
87
|
+
template_type?: string | null;
|
|
81
88
|
/** Botões/ações da mensagem → artefato de resposta de cada um. */
|
|
82
|
-
ctas?: IMedCalendarNotificationCta[];
|
|
89
|
+
ctas?: IMedCalendarNotificationCta[] | null;
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
/** Um CTA (botão/ação) e o artefato enviado quando o paciente o aciona (feat-092). */
|