@qcobro/common 1.11.3 → 1.11.4
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/config.d.ts +307 -0
- package/dist/config.d.ts.map +1 -0
- package/{src/config.ts → dist/config.js} +123 -154
- package/dist/config.js.map +1 -0
- package/dist/errors/ValidationError.d.ts +27 -0
- package/dist/errors/ValidationError.d.ts.map +1 -0
- package/dist/errors/ValidationError.js +52 -0
- package/dist/errors/ValidationError.js.map +1 -0
- package/{src/errors/index.ts → dist/errors/index.d.ts} +1 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +2 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/{src/index.ts → dist/index.js} +2 -5
- package/dist/index.js.map +1 -0
- package/dist/schemas/agentTemplates.d.ts +73 -0
- package/dist/schemas/agentTemplates.d.ts.map +1 -0
- package/dist/schemas/agentTemplates.js +90 -0
- package/dist/schemas/agentTemplates.js.map +1 -0
- package/dist/schemas/apiKeys.d.ts +17 -0
- package/dist/schemas/apiKeys.d.ts.map +1 -0
- package/{src/schemas/apiKeys.ts → dist/schemas/apiKeys.js} +11 -16
- package/dist/schemas/apiKeys.js.map +1 -0
- package/dist/schemas/auth.d.ts +74 -0
- package/dist/schemas/auth.d.ts.map +1 -0
- package/dist/schemas/auth.js +53 -0
- package/dist/schemas/auth.js.map +1 -0
- package/dist/schemas/campaigns.d.ts +61 -0
- package/dist/schemas/campaigns.d.ts.map +1 -0
- package/{src/schemas/campaigns.ts → dist/schemas/campaigns.js} +20 -32
- package/dist/schemas/campaigns.js.map +1 -0
- package/dist/schemas/contactLog.d.ts +121 -0
- package/dist/schemas/contactLog.d.ts.map +1 -0
- package/dist/schemas/contactLog.js +83 -0
- package/dist/schemas/contactLog.js.map +1 -0
- package/dist/schemas/dispatch.d.ts +51 -0
- package/dist/schemas/dispatch.d.ts.map +1 -0
- package/{src/schemas/dispatch.ts → dist/schemas/dispatch.js} +55 -61
- package/dist/schemas/dispatch.js.map +1 -0
- package/dist/schemas/email.d.ts +38 -0
- package/dist/schemas/email.d.ts.map +1 -0
- package/dist/schemas/email.js +34 -0
- package/dist/schemas/email.js.map +1 -0
- package/dist/schemas/index.d.ts +16 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/{src/schemas/index.ts → dist/schemas/index.js} +1 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/insight.d.ts +25 -0
- package/dist/schemas/insight.d.ts.map +1 -0
- package/{src/schemas/insight.ts → dist/schemas/insight.js} +6 -9
- package/dist/schemas/insight.js.map +1 -0
- package/dist/schemas/portfolios.d.ts +65 -0
- package/dist/schemas/portfolios.d.ts.map +1 -0
- package/dist/schemas/portfolios.js +40 -0
- package/dist/schemas/portfolios.js.map +1 -0
- package/dist/schemas/userSettings.d.ts +25 -0
- package/dist/schemas/userSettings.d.ts.map +1 -0
- package/{src/schemas/userSettings.ts → dist/schemas/userSettings.js} +4 -9
- package/dist/schemas/userSettings.js.map +1 -0
- package/dist/schemas/users.d.ts +7 -0
- package/dist/schemas/users.d.ts.map +1 -0
- package/dist/schemas/users.js +6 -0
- package/dist/schemas/users.js.map +1 -0
- package/dist/schemas/voiceEvent.d.ts +37 -0
- package/dist/schemas/voiceEvent.d.ts.map +1 -0
- package/dist/schemas/voiceEvent.js +35 -0
- package/dist/schemas/voiceEvent.js.map +1 -0
- package/dist/schemas/whatsApp.d.ts +76 -0
- package/dist/schemas/whatsApp.d.ts.map +1 -0
- package/dist/schemas/whatsApp.js +85 -0
- package/dist/schemas/whatsApp.js.map +1 -0
- package/dist/schemas/workspaceSettings.d.ts +27 -0
- package/dist/schemas/workspaceSettings.d.ts.map +1 -0
- package/{src/schemas/workspaceSettings.ts → dist/schemas/workspaceSettings.js} +6 -11
- package/dist/schemas/workspaceSettings.js.map +1 -0
- package/dist/schemas/workspaces.d.ts +50 -0
- package/dist/schemas/workspaces.d.ts.map +1 -0
- package/dist/schemas/workspaces.js +36 -0
- package/dist/schemas/workspaces.js.map +1 -0
- package/dist/types/agentTemplates.d.ts +119 -0
- package/dist/types/agentTemplates.d.ts.map +1 -0
- package/dist/types/agentTemplates.js +2 -0
- package/dist/types/agentTemplates.js.map +1 -0
- package/dist/types/campaigns.d.ts +257 -0
- package/dist/types/campaigns.d.ts.map +1 -0
- package/dist/types/campaigns.js +2 -0
- package/dist/types/campaigns.js.map +1 -0
- package/dist/types/dispatch.d.ts +168 -0
- package/dist/types/dispatch.d.ts.map +1 -0
- package/dist/types/dispatch.js +8 -0
- package/dist/types/dispatch.js.map +1 -0
- package/dist/types/email.d.ts +65 -0
- package/dist/types/email.d.ts.map +1 -0
- package/dist/types/email.js +7 -0
- package/dist/types/email.js.map +1 -0
- package/{src/types/engine.ts → dist/types/engine.d.ts} +23 -46
- package/dist/types/engine.d.ts.map +1 -0
- package/dist/types/engine.js +10 -0
- package/dist/types/engine.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/{src/types/index.ts → dist/types/index.js} +1 -0
- package/dist/types/index.js.map +1 -0
- package/{src/types/insight.ts → dist/types/insight.d.ts} +10 -8
- package/dist/types/insight.d.ts.map +1 -0
- package/dist/types/insight.js +2 -0
- package/dist/types/insight.js.map +1 -0
- package/dist/types/portfolios.d.ts +153 -0
- package/dist/types/portfolios.d.ts.map +1 -0
- package/dist/types/portfolios.js +2 -0
- package/dist/types/portfolios.js.map +1 -0
- package/dist/types/userSettings.d.ts +25 -0
- package/dist/types/userSettings.d.ts.map +1 -0
- package/dist/types/userSettings.js +2 -0
- package/dist/types/userSettings.js.map +1 -0
- package/dist/types/voiceApplication.d.ts +32 -0
- package/dist/types/voiceApplication.d.ts.map +1 -0
- package/dist/types/voiceApplication.js +7 -0
- package/dist/types/voiceApplication.js.map +1 -0
- package/dist/types/whatsApp.d.ts +97 -0
- package/dist/types/whatsApp.d.ts.map +1 -0
- package/dist/types/whatsApp.js +2 -0
- package/dist/types/whatsApp.js.map +1 -0
- package/dist/types/workspaceSettings.d.ts +26 -0
- package/dist/types/workspaceSettings.d.ts.map +1 -0
- package/dist/types/workspaceSettings.js +2 -0
- package/dist/types/workspaceSettings.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/{src/utils/outreach.ts → dist/utils/outreach.d.ts} +7 -32
- package/dist/utils/outreach.d.ts.map +1 -0
- package/dist/utils/outreach.js +49 -0
- package/dist/utils/outreach.js.map +1 -0
- package/dist/utils/time.d.ts +25 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +52 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/utils/withErrorHandlingAndValidation.d.ts +18 -0
- package/dist/utils/withErrorHandlingAndValidation.d.ts.map +1 -0
- package/{src/utils/withErrorHandlingAndValidation.ts → dist/utils/withErrorHandlingAndValidation.js} +9 -15
- package/dist/utils/withErrorHandlingAndValidation.js.map +1 -0
- package/package.json +4 -1
- package/CHANGELOG.md +0 -115
- package/src/config.test.ts +0 -19
- package/src/errors/ValidationError.test.ts +0 -38
- package/src/errors/ValidationError.ts +0 -68
- package/src/schemas/agentTemplates.ts +0 -100
- package/src/schemas/apiKeys.test.ts +0 -38
- package/src/schemas/auth.ts +0 -76
- package/src/schemas/contactLog.ts +0 -96
- package/src/schemas/email.ts +0 -37
- package/src/schemas/portfolios.ts +0 -49
- package/src/schemas/users.ts +0 -7
- package/src/schemas/voiceEvent.ts +0 -45
- package/src/schemas/whatsApp.ts +0 -101
- package/src/schemas/workspaces.ts +0 -53
- package/src/types/agentTemplates.ts +0 -104
- package/src/types/campaigns.ts +0 -210
- package/src/types/dispatch.ts +0 -160
- package/src/types/email.ts +0 -66
- package/src/types/portfolios.ts +0 -128
- package/src/types/userSettings.ts +0 -21
- package/src/types/voiceApplication.ts +0 -29
- package/src/types/whatsApp.ts +0 -82
- package/src/types/workspaceSettings.ts +0 -22
- package/src/utils/index.ts +0 -14
- package/src/utils/outreach.test.ts +0 -83
- package/src/utils/time.ts +0 -66
- package/src/utils/withErrorHandlingAndValidation.test.ts +0 -33
- package/tsconfig.json +0 -9
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const contactOutcomeSchema: z.ZodEnum<{
|
|
3
|
+
DELIVERED: "DELIVERED";
|
|
4
|
+
NOT_DELIVERED: "NOT_DELIVERED";
|
|
5
|
+
NO_ANSWER: "NO_ANSWER";
|
|
6
|
+
PAYMENT_PROMISE: "PAYMENT_PROMISE";
|
|
7
|
+
PARTIAL_PAYMENT_AGREED: "PARTIAL_PAYMENT_AGREED";
|
|
8
|
+
NEW_TERMS: "NEW_TERMS";
|
|
9
|
+
CALLBACK_REQUESTED: "CALLBACK_REQUESTED";
|
|
10
|
+
DISPUTE_RAISED: "DISPUTE_RAISED";
|
|
11
|
+
INFORMATION_REQUEST: "INFORMATION_REQUEST";
|
|
12
|
+
RESOLVED: "RESOLVED";
|
|
13
|
+
PAID: "PAID";
|
|
14
|
+
WRONG_NUMBER: "WRONG_NUMBER";
|
|
15
|
+
OPT_OUT: "OPT_OUT";
|
|
16
|
+
REFUSED: "REFUSED";
|
|
17
|
+
OTHER: "OTHER";
|
|
18
|
+
}>;
|
|
19
|
+
export type ContactOutcome = z.infer<typeof contactOutcomeSchema>;
|
|
20
|
+
export declare const aiSentimentSchema: z.ZodEnum<{
|
|
21
|
+
POSITIVE: "POSITIVE";
|
|
22
|
+
NEUTRAL: "NEUTRAL";
|
|
23
|
+
NEGATIVE: "NEGATIVE";
|
|
24
|
+
HOSTILE: "HOSTILE";
|
|
25
|
+
}>;
|
|
26
|
+
export type AiSentiment = z.infer<typeof aiSentimentSchema>;
|
|
27
|
+
/**
|
|
28
|
+
* PaymentPromise is the only outcome QCobro tracks with a lifecycle, because a payment
|
|
29
|
+
* is the only commitment it can verify. DUE is derived (PENDING past its dueDate), not a
|
|
30
|
+
* stored status. There is intentionally no "broken" status — an unpaid promise stays on
|
|
31
|
+
* the worklist until an operator resolves it. EXPIRED is set when the account leaves its
|
|
32
|
+
* portfolio.
|
|
33
|
+
*/
|
|
34
|
+
export declare const paymentPromiseStatusSchema: z.ZodEnum<{
|
|
35
|
+
EXPIRED: "EXPIRED";
|
|
36
|
+
PENDING: "PENDING";
|
|
37
|
+
MET: "MET";
|
|
38
|
+
CANCELLED: "CANCELLED";
|
|
39
|
+
}>;
|
|
40
|
+
export type PaymentPromiseStatus = z.infer<typeof paymentPromiseStatusSchema>;
|
|
41
|
+
export declare const createContactLogSchema: z.ZodObject<{
|
|
42
|
+
portfolioAccountId: z.ZodString;
|
|
43
|
+
campaignId: z.ZodOptional<z.ZodString>;
|
|
44
|
+
agentTemplateId: z.ZodOptional<z.ZodString>;
|
|
45
|
+
paymentPromiseId: z.ZodOptional<z.ZodString>;
|
|
46
|
+
agentType: z.ZodEnum<{
|
|
47
|
+
VOICE_AI: "VOICE_AI";
|
|
48
|
+
VOICE_PRERECORDED: "VOICE_PRERECORDED";
|
|
49
|
+
SMS: "SMS";
|
|
50
|
+
EMAIL: "EMAIL";
|
|
51
|
+
WHATSAPP: "WHATSAPP";
|
|
52
|
+
}>;
|
|
53
|
+
contactedAt: z.ZodString;
|
|
54
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
outcome: z.ZodEnum<{
|
|
56
|
+
DELIVERED: "DELIVERED";
|
|
57
|
+
NOT_DELIVERED: "NOT_DELIVERED";
|
|
58
|
+
NO_ANSWER: "NO_ANSWER";
|
|
59
|
+
PAYMENT_PROMISE: "PAYMENT_PROMISE";
|
|
60
|
+
PARTIAL_PAYMENT_AGREED: "PARTIAL_PAYMENT_AGREED";
|
|
61
|
+
NEW_TERMS: "NEW_TERMS";
|
|
62
|
+
CALLBACK_REQUESTED: "CALLBACK_REQUESTED";
|
|
63
|
+
DISPUTE_RAISED: "DISPUTE_RAISED";
|
|
64
|
+
INFORMATION_REQUEST: "INFORMATION_REQUEST";
|
|
65
|
+
RESOLVED: "RESOLVED";
|
|
66
|
+
PAID: "PAID";
|
|
67
|
+
WRONG_NUMBER: "WRONG_NUMBER";
|
|
68
|
+
OPT_OUT: "OPT_OUT";
|
|
69
|
+
REFUSED: "REFUSED";
|
|
70
|
+
OTHER: "OTHER";
|
|
71
|
+
}>;
|
|
72
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
73
|
+
debtAmountSnapshot: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
aiSummary: z.ZodOptional<z.ZodString>;
|
|
75
|
+
aiSentiment: z.ZodOptional<z.ZodEnum<{
|
|
76
|
+
POSITIVE: "POSITIVE";
|
|
77
|
+
NEUTRAL: "NEUTRAL";
|
|
78
|
+
NEGATIVE: "NEGATIVE";
|
|
79
|
+
HOSTILE: "HOSTILE";
|
|
80
|
+
}>>;
|
|
81
|
+
aiDebtReason: z.ZodOptional<z.ZodString>;
|
|
82
|
+
aiResult: z.ZodOptional<z.ZodString>;
|
|
83
|
+
aiNextStep: z.ZodOptional<z.ZodString>;
|
|
84
|
+
intentMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
85
|
+
channelData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
86
|
+
providerRef: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
export type CreateContactLogInput = z.infer<typeof createContactLogSchema>;
|
|
89
|
+
/**
|
|
90
|
+
* Input to reserve a campaign attempt before the provider call (the engine's
|
|
91
|
+
* at-most-once step). Increments the attempt counters; writes no gestión.
|
|
92
|
+
*/
|
|
93
|
+
export declare const reserveAttemptSchema: z.ZodObject<{
|
|
94
|
+
campaignId: z.ZodOptional<z.ZodString>;
|
|
95
|
+
portfolioAccountId: z.ZodString;
|
|
96
|
+
at: z.ZodString;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
export type ReserveAttemptInput = z.infer<typeof reserveAttemptSchema>;
|
|
99
|
+
/**
|
|
100
|
+
* Operator resolution of a payment promise. A promise leaves PENDING only by explicit
|
|
101
|
+
* action: `MET` (paid — v1 is manual-only, no trusted payment signal) or `CANCELLED`.
|
|
102
|
+
* `EXPIRED` is set by the system when the account leaves its portfolio, not here.
|
|
103
|
+
*/
|
|
104
|
+
export declare const updatePaymentPromiseSchema: z.ZodObject<{
|
|
105
|
+
id: z.ZodString;
|
|
106
|
+
status: z.ZodEnum<{
|
|
107
|
+
MET: "MET";
|
|
108
|
+
CANCELLED: "CANCELLED";
|
|
109
|
+
}>;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
export type UpdatePaymentPromiseInput = z.infer<typeof updatePaymentPromiseSchema>;
|
|
112
|
+
/**
|
|
113
|
+
* Follow up on a payment promise with an ad-hoc agent dispatch (no campaign). Writes a
|
|
114
|
+
* gestión with `campaignId` null, the chosen `agentTemplateId`, and a link to the promise.
|
|
115
|
+
*/
|
|
116
|
+
export declare const followUpPaymentPromiseSchema: z.ZodObject<{
|
|
117
|
+
paymentPromiseId: z.ZodString;
|
|
118
|
+
agentTemplateId: z.ZodString;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
export type FollowUpPaymentPromiseInput = z.infer<typeof followUpPaymentPromiseSchema>;
|
|
121
|
+
//# sourceMappingURL=contactLog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contactLog.d.ts","sourceRoot":"","sources":["../../src/schemas/contactLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;EAgB/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,iBAAiB;;;;;EAAyD,CAAC;AACxF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B;;;;;EAAqD,CAAC;AAC7F,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BjC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;iBAK/B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;;;iBAGrC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEnF;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;iBAGvC,CAAC;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { agentTypeSchema } from "./agentTemplates.js";
|
|
3
|
+
export const contactOutcomeSchema = z.enum([
|
|
4
|
+
"DELIVERED",
|
|
5
|
+
"NOT_DELIVERED",
|
|
6
|
+
"NO_ANSWER",
|
|
7
|
+
"PAYMENT_PROMISE",
|
|
8
|
+
"PARTIAL_PAYMENT_AGREED",
|
|
9
|
+
"NEW_TERMS",
|
|
10
|
+
"CALLBACK_REQUESTED",
|
|
11
|
+
"DISPUTE_RAISED",
|
|
12
|
+
"INFORMATION_REQUEST",
|
|
13
|
+
"RESOLVED",
|
|
14
|
+
"PAID",
|
|
15
|
+
"WRONG_NUMBER",
|
|
16
|
+
"OPT_OUT",
|
|
17
|
+
"REFUSED",
|
|
18
|
+
"OTHER"
|
|
19
|
+
]);
|
|
20
|
+
export const aiSentimentSchema = z.enum(["POSITIVE", "NEUTRAL", "NEGATIVE", "HOSTILE"]);
|
|
21
|
+
/**
|
|
22
|
+
* PaymentPromise is the only outcome QCobro tracks with a lifecycle, because a payment
|
|
23
|
+
* is the only commitment it can verify. DUE is derived (PENDING past its dueDate), not a
|
|
24
|
+
* stored status. There is intentionally no "broken" status — an unpaid promise stays on
|
|
25
|
+
* the worklist until an operator resolves it. EXPIRED is set when the account leaves its
|
|
26
|
+
* portfolio.
|
|
27
|
+
*/
|
|
28
|
+
export const paymentPromiseStatusSchema = z.enum(["PENDING", "MET", "EXPIRED", "CANCELLED"]);
|
|
29
|
+
export const createContactLogSchema = z.object({
|
|
30
|
+
portfolioAccountId: z.string().min(1),
|
|
31
|
+
campaignId: z.string().min(1).optional(),
|
|
32
|
+
/** Agent template used (campaign dispatch or ad-hoc follow-up). */
|
|
33
|
+
agentTemplateId: z.string().min(1).optional(),
|
|
34
|
+
/** Set when this gestión is an ad-hoc follow-up on a specific PaymentPromise. */
|
|
35
|
+
paymentPromiseId: z.string().min(1).optional(),
|
|
36
|
+
agentType: agentTypeSchema,
|
|
37
|
+
contactedAt: z.string().min(1),
|
|
38
|
+
durationSeconds: z.number().int().nonnegative().optional(),
|
|
39
|
+
outcome: contactOutcomeSchema,
|
|
40
|
+
notes: z.string().optional(),
|
|
41
|
+
debtAmountSnapshot: z.number().nonnegative().optional(),
|
|
42
|
+
aiSummary: z.string().optional(),
|
|
43
|
+
aiSentiment: aiSentimentSchema.optional(),
|
|
44
|
+
aiDebtReason: z.string().optional(),
|
|
45
|
+
aiResult: z.string().optional(),
|
|
46
|
+
aiNextStep: z.string().optional(),
|
|
47
|
+
intentMetadata: z.record(z.string(), z.unknown()).optional(),
|
|
48
|
+
channelData: z.record(z.string(), z.unknown()).optional(),
|
|
49
|
+
/**
|
|
50
|
+
* Provider call ref (voice) / message sid (sms) for the dispatch-time attempt.
|
|
51
|
+
* When present, `recordOutcome` upserts the gestión keyed by it (one row per
|
|
52
|
+
* attempt, enriched by the async callback) instead of inserting a duplicate.
|
|
53
|
+
*/
|
|
54
|
+
providerRef: z.string().min(1).optional()
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Input to reserve a campaign attempt before the provider call (the engine's
|
|
58
|
+
* at-most-once step). Increments the attempt counters; writes no gestión.
|
|
59
|
+
*/
|
|
60
|
+
export const reserveAttemptSchema = z.object({
|
|
61
|
+
campaignId: z.string().min(1).optional(),
|
|
62
|
+
portfolioAccountId: z.string().min(1),
|
|
63
|
+
/** When the attempt is being made (ISO). */
|
|
64
|
+
at: z.string().min(1)
|
|
65
|
+
});
|
|
66
|
+
/**
|
|
67
|
+
* Operator resolution of a payment promise. A promise leaves PENDING only by explicit
|
|
68
|
+
* action: `MET` (paid — v1 is manual-only, no trusted payment signal) or `CANCELLED`.
|
|
69
|
+
* `EXPIRED` is set by the system when the account leaves its portfolio, not here.
|
|
70
|
+
*/
|
|
71
|
+
export const updatePaymentPromiseSchema = z.object({
|
|
72
|
+
id: z.string().min(1),
|
|
73
|
+
status: z.enum(["MET", "CANCELLED"])
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Follow up on a payment promise with an ad-hoc agent dispatch (no campaign). Writes a
|
|
77
|
+
* gestión with `campaignId` null, the chosen `agentTemplateId`, and a link to the promise.
|
|
78
|
+
*/
|
|
79
|
+
export const followUpPaymentPromiseSchema = z.object({
|
|
80
|
+
paymentPromiseId: z.string().min(1),
|
|
81
|
+
agentTemplateId: z.string().min(1)
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=contactLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contactLog.js","sourceRoot":"","sources":["../../src/schemas/contactLog.ts"],"names":[],"mapp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AAC;AAGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;CACrC,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACnC,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** The channels the dispatch layer triggers (subset of AgentType). */
|
|
3
|
+
export declare const dispatchChannelSchema: z.ZodEnum<{
|
|
4
|
+
VOICE_AI: "VOICE_AI";
|
|
5
|
+
VOICE_PRERECORDED: "VOICE_PRERECORDED";
|
|
6
|
+
SMS: "SMS";
|
|
7
|
+
EMAIL: "EMAIL";
|
|
8
|
+
WHATSAPP: "WHATSAPP";
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* A normalized dispatch request: a channel, a destination, the render context
|
|
12
|
+
* (the customer's account fields), and the raw template body fields for that
|
|
13
|
+
* channel. The dispatch function renders the bodies against `context` before
|
|
14
|
+
* sending, so callers pass raw templates — not pre-rendered strings.
|
|
15
|
+
*/
|
|
16
|
+
export declare const dispatchOutreachSchema: z.ZodObject<{
|
|
17
|
+
channel: z.ZodEnum<{
|
|
18
|
+
VOICE_AI: "VOICE_AI";
|
|
19
|
+
VOICE_PRERECORDED: "VOICE_PRERECORDED";
|
|
20
|
+
SMS: "SMS";
|
|
21
|
+
EMAIL: "EMAIL";
|
|
22
|
+
WHATSAPP: "WHATSAPP";
|
|
23
|
+
}>;
|
|
24
|
+
to: z.ZodString;
|
|
25
|
+
context: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
26
|
+
from: z.ZodOptional<z.ZodString>;
|
|
27
|
+
appRef: z.ZodOptional<z.ZodString>;
|
|
28
|
+
firstMessage: z.ZodOptional<z.ZodString>;
|
|
29
|
+
script: z.ZodOptional<z.ZodString>;
|
|
30
|
+
body: z.ZodOptional<z.ZodString>;
|
|
31
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
32
|
+
templateName: z.ZodOptional<z.ZodString>;
|
|
33
|
+
languageCode: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type DispatchOutreachInput = z.infer<typeof dispatchOutreachSchema>;
|
|
36
|
+
/**
|
|
37
|
+
* Input for the manual "Contactar manualmente" procedure: which customer and which
|
|
38
|
+
* campaign. A manual contact runs the campaign's agent against this one customer, so
|
|
39
|
+
* the campaign (required) determines the agent/channel; the server resolves these to
|
|
40
|
+
* a {@link dispatchOutreachSchema} request.
|
|
41
|
+
*/
|
|
42
|
+
export declare const manualOutreachSchema: z.ZodObject<{
|
|
43
|
+
portfolioAccountId: z.ZodString;
|
|
44
|
+
agentTemplateId: z.ZodString;
|
|
45
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
46
|
+
body: z.ZodOptional<z.ZodString>;
|
|
47
|
+
firstMessage: z.ZodOptional<z.ZodString>;
|
|
48
|
+
script: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type ManualOutreachInput = z.infer<typeof manualOutreachSchema>;
|
|
51
|
+
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/schemas/dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,sEAAsE;AACtE,eAAO,MAAM,qBAAqB;;;;;;EAMhC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;iBAwE/B,CAAC;AAEL,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE3E;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;iBAa/B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
2
|
/** The channels the dispatch layer triggers (subset of AgentType). */
|
|
4
3
|
export const dispatchChannelSchema = z.enum([
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
"VOICE_AI",
|
|
5
|
+
"VOICE_PRERECORDED",
|
|
6
|
+
"SMS",
|
|
7
|
+
"EMAIL",
|
|
8
|
+
"WHATSAPP"
|
|
10
9
|
]);
|
|
11
|
-
|
|
12
10
|
/**
|
|
13
11
|
* A normalized dispatch request: a channel, a destination, the render context
|
|
14
12
|
* (the customer's account fields), and the raw template body fields for that
|
|
@@ -16,7 +14,7 @@ export const dispatchChannelSchema = z.enum([
|
|
|
16
14
|
* sending, so callers pass raw templates — not pre-rendered strings.
|
|
17
15
|
*/
|
|
18
16
|
export const dispatchOutreachSchema = z
|
|
19
|
-
|
|
17
|
+
.object({
|
|
20
18
|
channel: dispatchChannelSchema,
|
|
21
19
|
/** Destination number (E.164). */
|
|
22
20
|
to: z.string().min(1),
|
|
@@ -39,41 +37,41 @@ export const dispatchOutreachSchema = z
|
|
|
39
37
|
templateName: z.string().optional(),
|
|
40
38
|
/** WHATSAPP: Meta template-send language code (sourced from the workspace, e.g. `es_DO`). */
|
|
41
39
|
languageCode: z.string().optional()
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
})
|
|
41
|
+
.superRefine((value, ctx) => {
|
|
44
42
|
if (value.channel === "SMS" && (value.body ?? "").length === 0) {
|
|
45
|
-
|
|
43
|
+
ctx.addIssue({ code: "custom", path: ["body"], message: "SMS requires a message body" });
|
|
46
44
|
}
|
|
47
45
|
if (value.channel === "EMAIL") {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
if ((value.subject ?? "").length === 0) {
|
|
47
|
+
ctx.addIssue({ code: "custom", path: ["subject"], message: "Email requires a subject" });
|
|
48
|
+
}
|
|
49
|
+
if ((value.body ?? "").length === 0) {
|
|
50
|
+
ctx.addIssue({ code: "custom", path: ["body"], message: "Email requires a body" });
|
|
51
|
+
}
|
|
54
52
|
}
|
|
55
53
|
if (value.channel === "WHATSAPP") {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
if ((value.templateName ?? "").length === 0) {
|
|
55
|
+
ctx.addIssue({
|
|
56
|
+
code: "custom",
|
|
57
|
+
path: ["templateName"],
|
|
58
|
+
message: "WhatsApp requires a templateName"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if ((value.languageCode ?? "").length === 0) {
|
|
62
|
+
ctx.addIssue({
|
|
63
|
+
code: "custom",
|
|
64
|
+
path: ["languageCode"],
|
|
65
|
+
message: "WhatsApp requires a languageCode"
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if ((value.body ?? "").length === 0) {
|
|
69
|
+
ctx.addIssue({
|
|
70
|
+
code: "custom",
|
|
71
|
+
path: ["body"],
|
|
72
|
+
message: "WhatsApp requires a template body for parameter extraction"
|
|
73
|
+
});
|
|
74
|
+
}
|
|
77
75
|
}
|
|
78
76
|
// Voice dispatch needs the synced application ref. Neither voice channel requires a
|
|
79
77
|
// `firstMessage`: VOICE_AI may open silently (the autopilot places the call and waits
|
|
@@ -81,16 +79,13 @@ export const dispatchOutreachSchema = z
|
|
|
81
79
|
// EMAIL and SMS are not voice and need no appRef.
|
|
82
80
|
const isVoice = value.channel === "VOICE_AI" || value.channel === "VOICE_PRERECORDED";
|
|
83
81
|
if (isVoice && !value.appRef) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
ctx.addIssue({
|
|
83
|
+
code: "custom",
|
|
84
|
+
path: ["appRef"],
|
|
85
|
+
message: "Voice dispatch requires appRef"
|
|
86
|
+
});
|
|
89
87
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
export type DispatchOutreachInput = z.infer<typeof dispatchOutreachSchema>;
|
|
93
|
-
|
|
88
|
+
});
|
|
94
89
|
/**
|
|
95
90
|
* Input for the manual "Contactar manualmente" procedure: which customer and which
|
|
96
91
|
* campaign. A manual contact runs the campaign's agent against this one customer, so
|
|
@@ -98,18 +93,17 @@ export type DispatchOutreachInput = z.infer<typeof dispatchOutreachSchema>;
|
|
|
98
93
|
* a {@link dispatchOutreachSchema} request.
|
|
99
94
|
*/
|
|
100
95
|
export const manualOutreachSchema = z.object({
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
96
|
+
portfolioAccountId: z.string().min(1),
|
|
97
|
+
// Manual outreach is agent-based, not campaign-based: it dispatches the chosen agent
|
|
98
|
+
// template ad-hoc and records a campaign-less gestión (no CampaignAccountState).
|
|
99
|
+
agentTemplateId: z.string().min(1),
|
|
100
|
+
/** Operator override for the email subject (rendered, replaces template value). */
|
|
101
|
+
subject: z.string().optional(),
|
|
102
|
+
/** Operator override for the message body — SMS or EMAIL (rendered). */
|
|
103
|
+
body: z.string().optional(),
|
|
104
|
+
/** Operator override for the Voz IA opening line (rendered). */
|
|
105
|
+
firstMessage: z.string().optional(),
|
|
106
|
+
/** Operator override for the Voz pregrabada spoken script (rendered). */
|
|
107
|
+
script: z.string().optional()
|
|
113
108
|
});
|
|
114
|
-
|
|
115
|
-
export type ManualOutreachInput = z.infer<typeof manualOutreachSchema>;
|
|
109
|
+
//# sourceMappingURL=dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../src/schemas/dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,sEAAsE;AACtE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC1C,UAAU;IACV,mBAAmB;IACnB,KAAK;IACL,OAAO;IACP,UAAU;CACX,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,OAAO,EAAE,qBAAqB;IAC9B,kCAAkC;IAClC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,0EAA0E;IAC1E,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACtD,0EAA0E;IAC1E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClC,6DAA6D;IAC7D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAA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AgC;SAC1C,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC;AAIL;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,qFAAqF;IACrF,iFAAiF;IACjF,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAClC,mFAAmF;IACnF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,wEAAwE;IACxE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,gEAAgE;IAChE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,yEAAyE;IACzE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* The structured decision the EMAIL autopilot returns for an inbound reply. Validated so a
|
|
4
|
+
* model can't drive the loop with malformed output. `outcome` mirrors the contact-log
|
|
5
|
+
* outcomes; `objective` carries promise details when the reply implies one.
|
|
6
|
+
*/
|
|
7
|
+
export declare const emailAutopilotDecisionSchema: z.ZodObject<{
|
|
8
|
+
action: z.ZodEnum<{
|
|
9
|
+
reply: "reply";
|
|
10
|
+
ignore: "ignore";
|
|
11
|
+
resolve: "resolve";
|
|
12
|
+
escalate: "escalate";
|
|
13
|
+
}>;
|
|
14
|
+
replyBody: z.ZodOptional<z.ZodString>;
|
|
15
|
+
outcome: z.ZodOptional<z.ZodString>;
|
|
16
|
+
objective: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
17
|
+
type: z.ZodString;
|
|
18
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
dueDate: z.ZodOptional<z.ZodString>;
|
|
20
|
+
note: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
/**
|
|
24
|
+
* Normalized inbound email from the provider webhook. The provider payload is mapped to
|
|
25
|
+
* this before ingestion so the function stays provider-agnostic.
|
|
26
|
+
*/
|
|
27
|
+
export declare const inboundEmailSchema: z.ZodObject<{
|
|
28
|
+
from: z.ZodString;
|
|
29
|
+
to: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
30
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
31
|
+
text: z.ZodDefault<z.ZodString>;
|
|
32
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
33
|
+
inReplyTo: z.ZodOptional<z.ZodString>;
|
|
34
|
+
references: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type InboundEmailInput = z.infer<typeof inboundEmailSchema>;
|
|
38
|
+
//# sourceMappingURL=email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/schemas/email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;iBAYvC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;iBAS7B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* The structured decision the EMAIL autopilot returns for an inbound reply. Validated so a
|
|
4
|
+
* model can't drive the loop with malformed output. `outcome` mirrors the contact-log
|
|
5
|
+
* outcomes; `objective` carries promise details when the reply implies one.
|
|
6
|
+
*/
|
|
7
|
+
export const emailAutopilotDecisionSchema = z.object({
|
|
8
|
+
action: z.enum(["reply", "ignore", "resolve", "escalate"]),
|
|
9
|
+
replyBody: z.string().optional(),
|
|
10
|
+
outcome: z.string().optional(),
|
|
11
|
+
objective: z
|
|
12
|
+
.object({
|
|
13
|
+
type: z.string(),
|
|
14
|
+
amount: z.number().optional(),
|
|
15
|
+
dueDate: z.string().optional(),
|
|
16
|
+
note: z.string().optional()
|
|
17
|
+
})
|
|
18
|
+
.nullish()
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Normalized inbound email from the provider webhook. The provider payload is mapped to
|
|
22
|
+
* this before ingestion so the function stays provider-agnostic.
|
|
23
|
+
*/
|
|
24
|
+
export const inboundEmailSchema = z.object({
|
|
25
|
+
from: z.string().min(1),
|
|
26
|
+
to: z.array(z.string()).default([]),
|
|
27
|
+
subject: z.string().optional(),
|
|
28
|
+
text: z.string().default(""),
|
|
29
|
+
messageId: z.string().optional(),
|
|
30
|
+
inReplyTo: z.string().optional(),
|
|
31
|
+
references: z.array(z.string()).optional(),
|
|
32
|
+
headers: z.record(z.string(), z.string()).optional()
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=email.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.js","sourceRoot":"","sources":["../../src/schemas/email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAC1D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ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ys.js";
|
|
4
|
+
export * from "./users.js";
|
|
5
|
+
export * from "./portfolios.js";
|
|
6
|
+
export * from "./workspaceSettings.js";
|
|
7
|
+
export * from "./userSettings.js";
|
|
8
|
+
export * from "./agentTemplates.js";
|
|
9
|
+
export * from "./campaigns.js";
|
|
10
|
+
export * from "./contactLog.js";
|
|
11
|
+
export * from "./dispatch.js";
|
|
12
|
+
export * from "./email.js";
|
|
13
|
+
export * from "./whatsApp.js";
|
|
14
|
+
export * from "./voiceEvent.js";
|
|
15
|
+
export * from "./insight.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* The structured analysis an LLM must return for a gestión transcript. Mirrors the
|
|
4
|
+
* `ai*` fields on `AccountContactLog`; text fields are written in the call's language,
|
|
5
|
+
* `aiSentiment` is always one of the fixed enum values.
|
|
6
|
+
*/
|
|
7
|
+
export declare const gestionInsightSchema: z.ZodObject<{
|
|
8
|
+
aiSummary: z.ZodString;
|
|
9
|
+
aiSentiment: z.ZodEnum<{
|
|
10
|
+
POSITIVE: "POSITIVE";
|
|
11
|
+
NEUTRAL: "NEUTRAL";
|
|
12
|
+
NEGATIVE: "NEGATIVE";
|
|
13
|
+
HOSTILE: "HOSTILE";
|
|
14
|
+
}>;
|
|
15
|
+
aiDebtReason: z.ZodString;
|
|
16
|
+
aiResult: z.ZodString;
|
|
17
|
+
aiNextStep: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type GestionInsight = z.infer<typeof gestionInsightSchema>;
|
|
20
|
+
/** Input to the generate-insight operation — the gestión (contact-log) id. */
|
|
21
|
+
export declare const generateInsightInputSchema: z.ZodObject<{
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type GenerateInsightInput = z.infer<typeof generateInsightInputSchema>;
|
|
25
|
+
//# sourceMappingURL=insight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insight.d.ts","sourceRoot":"","sources":["../../src/schemas/insight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;iBAM/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,8EAA8E;AAC9E,eAAO,MAAM,0BAA0B;;iBAAsC,CAAC;AAC9E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { aiSentimentSchema } from "./contactLog.js";
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* The structured analysis an LLM must return for a gestión transcript. Mirrors the
|
|
6
5
|
* `ai*` fields on `AccountContactLog`; text fields are written in the call's language,
|
|
7
6
|
* `aiSentiment` is always one of the fixed enum values.
|
|
8
7
|
*/
|
|
9
8
|
export const gestionInsightSchema = z.object({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
aiSummary: z.string().min(1),
|
|
10
|
+
aiSentiment: aiSentimentSchema,
|
|
11
|
+
aiDebtReason: z.string().min(1),
|
|
12
|
+
aiResult: z.string().min(1),
|
|
13
|
+
aiNextStep: z.string().min(1)
|
|
15
14
|
});
|
|
16
|
-
export type GestionInsight = z.infer<typeof gestionInsightSchema>;
|
|
17
|
-
|
|
18
15
|
/** Input to the generate-insight operation — the gestión (contact-log) id. */
|
|
19
16
|
export const generateInsightInputSchema = z.object({ id: z.string().min(1) });
|
|
20
|
-
|
|
17
|
+
//# sourceMappingURL=insight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insight.js","sourceRoot":"","sources":["../../src/schemas/insight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,WAAW,EAAE,iBAAiB;IAC9B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC9B,CAAC,CAAC;AAGH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC"}
|