evo360-types 1.3.273 → 1.3.277
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-notifications/zod-schemas.d.ts +174 -1
- package/dist/apps/evo-notifications/zod-schemas.js +24 -1
- package/dist/apps/evo-notifications/zod-schemas.ts +25 -1
- package/dist/types/evo-notifications/index.d.ts +28 -0
- package/dist/types/evo-notifications/index.ts +36 -0
- package/package.json +1 -1
|
@@ -118,6 +118,7 @@ export declare const zNotificationMessageSchema: z.ZodObject<{
|
|
|
118
118
|
locale: z.ZodOptional<z.ZodString>;
|
|
119
119
|
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
120
120
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
121
|
+
body_text: z.ZodOptional<z.ZodString>;
|
|
121
122
|
recipient: z.ZodObject<{
|
|
122
123
|
kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
|
|
123
124
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -233,6 +234,7 @@ export declare const zNotificationMessageSchema: z.ZodObject<{
|
|
|
233
234
|
locale: z.ZodOptional<z.ZodString>;
|
|
234
235
|
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
235
236
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
237
|
+
body_text: z.ZodOptional<z.ZodString>;
|
|
236
238
|
recipient: z.ZodObject<{
|
|
237
239
|
kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
|
|
238
240
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -348,6 +350,7 @@ export declare const zNotificationMessageSchema: z.ZodObject<{
|
|
|
348
350
|
locale: z.ZodOptional<z.ZodString>;
|
|
349
351
|
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
350
352
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
353
|
+
body_text: z.ZodOptional<z.ZodString>;
|
|
351
354
|
recipient: z.ZodObject<{
|
|
352
355
|
kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
|
|
353
356
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -609,7 +612,7 @@ export declare const zNotificationLogSchema: z.ZodObject<{
|
|
|
609
612
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
610
613
|
at: z.ZodDate;
|
|
611
614
|
}, z.ZodTypeAny, "passthrough">>;
|
|
612
|
-
export declare const zDirectSendPayloadSchema: z.ZodObject<{
|
|
615
|
+
export declare const zDirectSendPayloadSchema: z.ZodEffects<z.ZodObject<{
|
|
613
616
|
tenant: z.ZodString;
|
|
614
617
|
kind: z.ZodLiteral<"notification.send">;
|
|
615
618
|
classification: z.ZodOptional<z.ZodString>;
|
|
@@ -659,6 +662,8 @@ export declare const zDirectSendPayloadSchema: z.ZodObject<{
|
|
|
659
662
|
locale: z.ZodOptional<z.ZodString>;
|
|
660
663
|
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
661
664
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
665
|
+
/** WhatsApp session text (no HSM). Max length per Meta. */
|
|
666
|
+
body_text: z.ZodOptional<z.ZodString>;
|
|
662
667
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
663
668
|
routine: z.ZodOptional<z.ZodObject<{
|
|
664
669
|
id: z.ZodString;
|
|
@@ -739,6 +744,8 @@ export declare const zDirectSendPayloadSchema: z.ZodObject<{
|
|
|
739
744
|
locale: z.ZodOptional<z.ZodString>;
|
|
740
745
|
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
741
746
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
747
|
+
/** WhatsApp session text (no HSM). Max length per Meta. */
|
|
748
|
+
body_text: z.ZodOptional<z.ZodString>;
|
|
742
749
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
743
750
|
routine: z.ZodOptional<z.ZodObject<{
|
|
744
751
|
id: z.ZodString;
|
|
@@ -819,6 +826,172 @@ export declare const zDirectSendPayloadSchema: z.ZodObject<{
|
|
|
819
826
|
locale: z.ZodOptional<z.ZodString>;
|
|
820
827
|
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
821
828
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
829
|
+
/** WhatsApp session text (no HSM). Max length per Meta. */
|
|
830
|
+
body_text: z.ZodOptional<z.ZodString>;
|
|
831
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
832
|
+
routine: z.ZodOptional<z.ZodObject<{
|
|
833
|
+
id: z.ZodString;
|
|
834
|
+
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
835
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
836
|
+
id: z.ZodString;
|
|
837
|
+
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
838
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
839
|
+
id: z.ZodString;
|
|
840
|
+
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
841
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
842
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
843
|
+
dedup_key: z.ZodOptional<z.ZodString>;
|
|
844
|
+
dedup_group_key: z.ZodOptional<z.ZodString>;
|
|
845
|
+
externalLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
846
|
+
type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
|
|
847
|
+
id: z.ZodString;
|
|
848
|
+
label: z.ZodOptional<z.ZodString>;
|
|
849
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
850
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
851
|
+
type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
|
|
852
|
+
id: z.ZodString;
|
|
853
|
+
label: z.ZodOptional<z.ZodString>;
|
|
854
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
855
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
856
|
+
type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
|
|
857
|
+
id: z.ZodString;
|
|
858
|
+
label: z.ZodOptional<z.ZodString>;
|
|
859
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
860
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
861
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
862
|
+
tenant: z.ZodString;
|
|
863
|
+
kind: z.ZodLiteral<"notification.send">;
|
|
864
|
+
classification: z.ZodOptional<z.ZodString>;
|
|
865
|
+
importance: z.ZodOptional<z.ZodNumber>;
|
|
866
|
+
recipient: z.ZodObject<{
|
|
867
|
+
kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
|
|
868
|
+
id: z.ZodOptional<z.ZodString>;
|
|
869
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
870
|
+
address: z.ZodOptional<z.ZodString>;
|
|
871
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
872
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
873
|
+
kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
|
|
874
|
+
id: z.ZodOptional<z.ZodString>;
|
|
875
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
876
|
+
address: z.ZodOptional<z.ZodString>;
|
|
877
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
878
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
879
|
+
kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
|
|
880
|
+
id: z.ZodOptional<z.ZodString>;
|
|
881
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
882
|
+
address: z.ZodOptional<z.ZodString>;
|
|
883
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
884
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
885
|
+
channel: z.ZodObject<{
|
|
886
|
+
type: z.ZodEnum<["whatsapp", "email", "sms", "push"]>;
|
|
887
|
+
channel_id: z.ZodString;
|
|
888
|
+
sender_id: z.ZodOptional<z.ZodString>;
|
|
889
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
890
|
+
type: z.ZodEnum<["whatsapp", "email", "sms", "push"]>;
|
|
891
|
+
channel_id: z.ZodString;
|
|
892
|
+
sender_id: z.ZodOptional<z.ZodString>;
|
|
893
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
894
|
+
type: z.ZodEnum<["whatsapp", "email", "sms", "push"]>;
|
|
895
|
+
channel_id: z.ZodString;
|
|
896
|
+
sender_id: z.ZodOptional<z.ZodString>;
|
|
897
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
898
|
+
template: z.ZodOptional<z.ZodObject<{
|
|
899
|
+
template_id: z.ZodString;
|
|
900
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
901
|
+
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
902
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
903
|
+
template_id: z.ZodString;
|
|
904
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
905
|
+
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
906
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
907
|
+
template_id: z.ZodString;
|
|
908
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
909
|
+
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
910
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
911
|
+
/** WhatsApp session text (no HSM). Max length per Meta. */
|
|
912
|
+
body_text: z.ZodOptional<z.ZodString>;
|
|
913
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
914
|
+
routine: z.ZodOptional<z.ZodObject<{
|
|
915
|
+
id: z.ZodString;
|
|
916
|
+
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
917
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
918
|
+
id: z.ZodString;
|
|
919
|
+
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
920
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
921
|
+
id: z.ZodString;
|
|
922
|
+
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
923
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
924
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
925
|
+
dedup_key: z.ZodOptional<z.ZodString>;
|
|
926
|
+
dedup_group_key: z.ZodOptional<z.ZodString>;
|
|
927
|
+
externalLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
928
|
+
type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
|
|
929
|
+
id: z.ZodString;
|
|
930
|
+
label: z.ZodOptional<z.ZodString>;
|
|
931
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
932
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
933
|
+
type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
|
|
934
|
+
id: z.ZodString;
|
|
935
|
+
label: z.ZodOptional<z.ZodString>;
|
|
936
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
937
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
938
|
+
type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
|
|
939
|
+
id: z.ZodString;
|
|
940
|
+
label: z.ZodOptional<z.ZodString>;
|
|
941
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
942
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
943
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
944
|
+
tenant: z.ZodString;
|
|
945
|
+
kind: z.ZodLiteral<"notification.send">;
|
|
946
|
+
classification: z.ZodOptional<z.ZodString>;
|
|
947
|
+
importance: z.ZodOptional<z.ZodNumber>;
|
|
948
|
+
recipient: z.ZodObject<{
|
|
949
|
+
kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
|
|
950
|
+
id: z.ZodOptional<z.ZodString>;
|
|
951
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
952
|
+
address: z.ZodOptional<z.ZodString>;
|
|
953
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
954
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
955
|
+
kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
|
|
956
|
+
id: z.ZodOptional<z.ZodString>;
|
|
957
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
958
|
+
address: z.ZodOptional<z.ZodString>;
|
|
959
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
960
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
961
|
+
kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
|
|
962
|
+
id: z.ZodOptional<z.ZodString>;
|
|
963
|
+
ref: z.ZodOptional<z.ZodAny>;
|
|
964
|
+
address: z.ZodOptional<z.ZodString>;
|
|
965
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
966
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
967
|
+
channel: z.ZodObject<{
|
|
968
|
+
type: z.ZodEnum<["whatsapp", "email", "sms", "push"]>;
|
|
969
|
+
channel_id: z.ZodString;
|
|
970
|
+
sender_id: z.ZodOptional<z.ZodString>;
|
|
971
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
972
|
+
type: z.ZodEnum<["whatsapp", "email", "sms", "push"]>;
|
|
973
|
+
channel_id: z.ZodString;
|
|
974
|
+
sender_id: z.ZodOptional<z.ZodString>;
|
|
975
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
976
|
+
type: z.ZodEnum<["whatsapp", "email", "sms", "push"]>;
|
|
977
|
+
channel_id: z.ZodString;
|
|
978
|
+
sender_id: z.ZodOptional<z.ZodString>;
|
|
979
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
980
|
+
template: z.ZodOptional<z.ZodObject<{
|
|
981
|
+
template_id: z.ZodString;
|
|
982
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
983
|
+
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
984
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
985
|
+
template_id: z.ZodString;
|
|
986
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
987
|
+
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
988
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
989
|
+
template_id: z.ZodString;
|
|
990
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
991
|
+
version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
992
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
993
|
+
/** WhatsApp session text (no HSM). Max length per Meta. */
|
|
994
|
+
body_text: z.ZodOptional<z.ZodString>;
|
|
822
995
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
823
996
|
routine: z.ZodOptional<z.ZodObject<{
|
|
824
997
|
id: z.ZodString;
|
|
@@ -87,6 +87,7 @@ exports.zNotificationMessageSchema = zod_schemas_1.zFireDocSchema
|
|
|
87
87
|
importance: zod_1.z.number().min(0).max(100).optional(),
|
|
88
88
|
channel: exports.zNotificationChannelRefSchema,
|
|
89
89
|
template: exports.zNotificationTemplateRefSchema.optional(),
|
|
90
|
+
body_text: zod_1.z.string().max(4096).optional(),
|
|
90
91
|
recipient: exports.zNotificationRecipientSchema,
|
|
91
92
|
variables: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
92
93
|
status: exports.zNotificationMessageStatusSchema,
|
|
@@ -138,6 +139,8 @@ exports.zDirectSendPayloadSchema = zod_1.z
|
|
|
138
139
|
recipient: exports.zNotificationRecipientSchema,
|
|
139
140
|
channel: exports.zNotificationChannelRefSchema,
|
|
140
141
|
template: exports.zNotificationTemplateRefSchema.optional(),
|
|
142
|
+
/** WhatsApp session text (no HSM). Max length per Meta. */
|
|
143
|
+
body_text: zod_1.z.string().max(4096).optional(),
|
|
141
144
|
variables: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
142
145
|
routine: zod_1.z
|
|
143
146
|
.object({
|
|
@@ -151,4 +154,24 @@ exports.zDirectSendPayloadSchema = zod_1.z
|
|
|
151
154
|
dedup_group_key: zod_1.z.string().optional(),
|
|
152
155
|
externalLinks: zod_1.z.array(zod_schemas_2.zExternalLinkSchema).optional(),
|
|
153
156
|
})
|
|
154
|
-
.passthrough()
|
|
157
|
+
.passthrough()
|
|
158
|
+
.superRefine((data, ctx) => {
|
|
159
|
+
if (data.channel.type !== "whatsapp")
|
|
160
|
+
return;
|
|
161
|
+
const hasTemplate = Boolean(data.template?.template_id?.trim());
|
|
162
|
+
const hasBody = Boolean(data.body_text?.trim());
|
|
163
|
+
if (!hasTemplate && !hasBody) {
|
|
164
|
+
ctx.addIssue({
|
|
165
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
166
|
+
message: "WhatsApp: informe template.template_id (HSM) ou body_text (texto de sessão).",
|
|
167
|
+
path: ["template"],
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
if (hasTemplate && hasBody) {
|
|
171
|
+
ctx.addIssue({
|
|
172
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
173
|
+
message: "WhatsApp: use apenas template.template_id ou body_text, não ambos.",
|
|
174
|
+
path: ["body_text"],
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
});
|
|
@@ -98,6 +98,7 @@ export const zNotificationMessageSchema = zFireDocSchema
|
|
|
98
98
|
importance: z.number().min(0).max(100).optional(),
|
|
99
99
|
channel: zNotificationChannelRefSchema,
|
|
100
100
|
template: zNotificationTemplateRefSchema.optional(),
|
|
101
|
+
body_text: z.string().max(4096).optional(),
|
|
101
102
|
recipient: zNotificationRecipientSchema,
|
|
102
103
|
variables: z.record(z.unknown()).optional(),
|
|
103
104
|
status: zNotificationMessageStatusSchema,
|
|
@@ -153,6 +154,8 @@ export const zDirectSendPayloadSchema = z
|
|
|
153
154
|
recipient: zNotificationRecipientSchema,
|
|
154
155
|
channel: zNotificationChannelRefSchema,
|
|
155
156
|
template: zNotificationTemplateRefSchema.optional(),
|
|
157
|
+
/** WhatsApp session text (no HSM). Max length per Meta. */
|
|
158
|
+
body_text: z.string().max(4096).optional(),
|
|
156
159
|
variables: z.record(z.unknown()).optional(),
|
|
157
160
|
routine: z
|
|
158
161
|
.object({
|
|
@@ -166,4 +169,25 @@ export const zDirectSendPayloadSchema = z
|
|
|
166
169
|
dedup_group_key: z.string().optional(),
|
|
167
170
|
externalLinks: z.array(zExternalLinkSchema).optional(),
|
|
168
171
|
})
|
|
169
|
-
.passthrough()
|
|
172
|
+
.passthrough()
|
|
173
|
+
.superRefine((data, ctx) => {
|
|
174
|
+
if (data.channel.type !== "whatsapp") return;
|
|
175
|
+
const hasTemplate = Boolean(data.template?.template_id?.trim());
|
|
176
|
+
const hasBody = Boolean(data.body_text?.trim());
|
|
177
|
+
if (!hasTemplate && !hasBody) {
|
|
178
|
+
ctx.addIssue({
|
|
179
|
+
code: z.ZodIssueCode.custom,
|
|
180
|
+
message:
|
|
181
|
+
"WhatsApp: informe template.template_id (HSM) ou body_text (texto de sessão).",
|
|
182
|
+
path: ["template"],
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
if (hasTemplate && hasBody) {
|
|
186
|
+
ctx.addIssue({
|
|
187
|
+
code: z.ZodIssueCode.custom,
|
|
188
|
+
message:
|
|
189
|
+
"WhatsApp: use apenas template.template_id ou body_text, não ambos.",
|
|
190
|
+
path: ["body_text"],
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
});
|
|
@@ -95,6 +95,11 @@ export interface INotificationSendPayload {
|
|
|
95
95
|
channel: INotificationChannelRef;
|
|
96
96
|
template?: INotificationTemplateRef;
|
|
97
97
|
variables?: Record<string, unknown>;
|
|
98
|
+
/**
|
|
99
|
+
* WhatsApp (sessão): texto livre enviado via Hermes `type: text` (sem HSM).
|
|
100
|
+
* Mutuamente exclusivo com `template.template_id` para `channel.type === 'whatsapp'`.
|
|
101
|
+
*/
|
|
102
|
+
body_text?: string;
|
|
98
103
|
routine?: {
|
|
99
104
|
id: string;
|
|
100
105
|
version?: number | string;
|
|
@@ -114,6 +119,8 @@ export interface INotificationMessage extends IFireDoc {
|
|
|
114
119
|
importance?: number;
|
|
115
120
|
channel: INotificationChannelRef;
|
|
116
121
|
template?: INotificationTemplateRef;
|
|
122
|
+
/** Snapshot quando o envio foi texto de sessão WhatsApp (sem template). */
|
|
123
|
+
body_text?: string;
|
|
117
124
|
recipient: INotificationRecipient;
|
|
118
125
|
variables?: Record<string, unknown>;
|
|
119
126
|
status: NotificationMessageStatus;
|
|
@@ -190,3 +197,24 @@ export interface IEmailTemplate extends IFireDoc {
|
|
|
190
197
|
variables: string[];
|
|
191
198
|
enabled: boolean;
|
|
192
199
|
}
|
|
200
|
+
export interface INotificationProviderConfig {
|
|
201
|
+
id: string;
|
|
202
|
+
provider_name: string;
|
|
203
|
+
channel_type: NotificationChannelType;
|
|
204
|
+
display_name: string;
|
|
205
|
+
description?: string;
|
|
206
|
+
enabled: boolean;
|
|
207
|
+
is_default: boolean;
|
|
208
|
+
is_stub: boolean;
|
|
209
|
+
settings?: Record<string, unknown>;
|
|
210
|
+
stats_last_reset_at?: Date;
|
|
211
|
+
created_at: Date;
|
|
212
|
+
updated_at: Date;
|
|
213
|
+
}
|
|
214
|
+
/** Campos permitidos no patch de update (Nexus / functions-notifications). */
|
|
215
|
+
export type NotificationProviderUpdatePatch = Partial<{
|
|
216
|
+
enabled: boolean;
|
|
217
|
+
is_default: boolean;
|
|
218
|
+
display_name: string;
|
|
219
|
+
description: string;
|
|
220
|
+
}>;
|
|
@@ -179,6 +179,12 @@ export interface INotificationSendPayload {
|
|
|
179
179
|
template?: INotificationTemplateRef;
|
|
180
180
|
variables?: Record<string, unknown>; // resolved upstream (Automation Hub / Task Runner)
|
|
181
181
|
|
|
182
|
+
/**
|
|
183
|
+
* WhatsApp (sessão): texto livre enviado via Hermes `type: text` (sem HSM).
|
|
184
|
+
* Mutuamente exclusivo com `template.template_id` para `channel.type === 'whatsapp'`.
|
|
185
|
+
*/
|
|
186
|
+
body_text?: string;
|
|
187
|
+
|
|
182
188
|
// Optional business context
|
|
183
189
|
routine?: {
|
|
184
190
|
id: string;
|
|
@@ -219,6 +225,8 @@ export interface INotificationMessage extends IFireDoc {
|
|
|
219
225
|
// Channel/template snapshot
|
|
220
226
|
channel: INotificationChannelRef;
|
|
221
227
|
template?: INotificationTemplateRef;
|
|
228
|
+
/** Snapshot quando o envio foi texto de sessão WhatsApp (sem template). */
|
|
229
|
+
body_text?: string;
|
|
222
230
|
|
|
223
231
|
// Recipient snapshot
|
|
224
232
|
recipient: INotificationRecipient;
|
|
@@ -332,3 +340,31 @@ export interface IEmailTemplate extends IFireDoc {
|
|
|
332
340
|
variables: string[];
|
|
333
341
|
enabled: boolean;
|
|
334
342
|
}
|
|
343
|
+
|
|
344
|
+
// ======================================================
|
|
345
|
+
// Nexus / platform: configuração global de providers de envio
|
|
346
|
+
// Path Firestore: platform/evo-notifications/providers/{providerId}
|
|
347
|
+
// ======================================================
|
|
348
|
+
|
|
349
|
+
export interface INotificationProviderConfig {
|
|
350
|
+
id: string;
|
|
351
|
+
provider_name: string;
|
|
352
|
+
channel_type: NotificationChannelType;
|
|
353
|
+
display_name: string;
|
|
354
|
+
description?: string;
|
|
355
|
+
enabled: boolean;
|
|
356
|
+
is_default: boolean;
|
|
357
|
+
is_stub: boolean;
|
|
358
|
+
settings?: Record<string, unknown>;
|
|
359
|
+
stats_last_reset_at?: Date;
|
|
360
|
+
created_at: Date;
|
|
361
|
+
updated_at: Date;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/** Campos permitidos no patch de update (Nexus / functions-notifications). */
|
|
365
|
+
export type NotificationProviderUpdatePatch = Partial<{
|
|
366
|
+
enabled: boolean;
|
|
367
|
+
is_default: boolean;
|
|
368
|
+
display_name: string;
|
|
369
|
+
description: string;
|
|
370
|
+
}>;
|