@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,65 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const createPortfolioSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
clientId: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type CreatePortfolioInput = z.infer<typeof createPortfolioSchema>;
|
|
7
|
+
export declare const updatePortfolioSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
name: z.ZodOptional<z.ZodString>;
|
|
10
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export type UpdatePortfolioInput = z.infer<typeof updatePortfolioSchema>;
|
|
13
|
+
export declare const deletePortfolioSchema: z.ZodObject<{
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type DeletePortfolioInput = z.infer<typeof deletePortfolioSchema>;
|
|
17
|
+
export declare const accountRowSchema: z.ZodObject<{
|
|
18
|
+
externalId: z.ZodString;
|
|
19
|
+
fullName: z.ZodString;
|
|
20
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
21
|
+
email: z.ZodOptional<z.ZodString>;
|
|
22
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
23
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
24
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
25
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
28
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
29
|
+
outstandingBalance: z.ZodNumber;
|
|
30
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
31
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
32
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
33
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
negotiationOptions: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type AccountRowInput = z.infer<typeof accountRowSchema>;
|
|
37
|
+
export declare const syncAccountsInputSchema: z.ZodObject<{
|
|
38
|
+
portfolioId: z.ZodString;
|
|
39
|
+
mode: z.ZodEnum<{
|
|
40
|
+
APPEND_ONLY: "APPEND_ONLY";
|
|
41
|
+
UPDATE_EXISTING: "UPDATE_EXISTING";
|
|
42
|
+
REPLACE: "REPLACE";
|
|
43
|
+
}>;
|
|
44
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
45
|
+
externalId: z.ZodString;
|
|
46
|
+
fullName: z.ZodString;
|
|
47
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
48
|
+
email: z.ZodOptional<z.ZodString>;
|
|
49
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
50
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
51
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
52
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
53
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
54
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
55
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
56
|
+
outstandingBalance: z.ZodNumber;
|
|
57
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
58
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
59
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
60
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
negotiationOptions: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export type SyncAccountsInput = z.infer<typeof syncAccountsInputSchema>;
|
|
65
|
+
//# sourceMappingURL=portfolios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolios.d.ts","sourceRoot":"","sources":["../../src/schemas/portfolios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEzE,eAAO,MAAM,qBAAqB;;;;iBAMhC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEzE,eAAO,MAAM,qBAAqB;;iBAEhC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEzE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;iBAkB3B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE/D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const createPortfolioSchema = z.object({
|
|
3
|
+
name: z.string().min(1).max(120),
|
|
4
|
+
clientId: z.string().min(1).max(120)
|
|
5
|
+
});
|
|
6
|
+
export const updatePortfolioSchema = z.object({
|
|
7
|
+
id: z.string().min(1),
|
|
8
|
+
name: z.string().min(1).max(120).optional(),
|
|
9
|
+
// `archived` toggles the portfolio's archived state: true sets `archivedAt` to
|
|
10
|
+
// now, false clears it (restore). There is no separate status concept.
|
|
11
|
+
archived: z.boolean().optional()
|
|
12
|
+
});
|
|
13
|
+
export const deletePortfolioSchema = z.object({
|
|
14
|
+
id: z.string().min(1)
|
|
15
|
+
});
|
|
16
|
+
export const accountRowSchema = z.object({
|
|
17
|
+
externalId: z.string().min(1),
|
|
18
|
+
fullName: z.string().min(1),
|
|
19
|
+
phone: z.string().optional(),
|
|
20
|
+
email: z.string().email().optional(),
|
|
21
|
+
preferredLanguage: z.string().optional(),
|
|
22
|
+
bestTimeToCall: z.string().optional(),
|
|
23
|
+
customerSegment: z.string().optional(),
|
|
24
|
+
principalAmount: z.number().nonnegative().default(0),
|
|
25
|
+
termsAmount: z.number().nonnegative().default(0),
|
|
26
|
+
termsFrequency: z.string().optional(),
|
|
27
|
+
termsLength: z.number().int().nonnegative().default(0),
|
|
28
|
+
outstandingBalance: z.number().nonnegative(),
|
|
29
|
+
daysPastDue: z.number().int().nonnegative().default(0),
|
|
30
|
+
missedInstallments: z.number().int().nonnegative().default(0),
|
|
31
|
+
lastPaymentDate: z.string().optional(),
|
|
32
|
+
lastPaymentAmount: z.number().nonnegative().optional(),
|
|
33
|
+
negotiationOptions: z.string().optional()
|
|
34
|
+
});
|
|
35
|
+
export const syncAccountsInputSchema = z.object({
|
|
36
|
+
portfolioId: z.string().min(1),
|
|
37
|
+
mode: z.enum(["APPEND_ONLY", "UPDATE_EXISTING", "REPLACE"]),
|
|
38
|
+
rows: z.array(accountRowSchema).min(1)
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=portfolios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolios.js","sourceRoot":"","sources":["../../src/schemas/portfolios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;A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CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CACvC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Supported console languages. Keep in sync with the webapp message catalogs. */
|
|
3
|
+
export declare const languageSchema: z.ZodEnum<{
|
|
4
|
+
en: "en";
|
|
5
|
+
es: "es";
|
|
6
|
+
}>;
|
|
7
|
+
export type Language = z.infer<typeof languageSchema>;
|
|
8
|
+
/** The per-user settings record (stored in the app DB, keyed by the Identity userRef). */
|
|
9
|
+
export declare const userSettingsSchema: z.ZodObject<{
|
|
10
|
+
userRef: z.ZodString;
|
|
11
|
+
language: z.ZodEnum<{
|
|
12
|
+
en: "en";
|
|
13
|
+
es: "es";
|
|
14
|
+
}>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type UserSettings = z.infer<typeof userSettingsSchema>;
|
|
17
|
+
/** Operator-editable user settings. */
|
|
18
|
+
export declare const updateUserLanguageSchema: z.ZodObject<{
|
|
19
|
+
language: z.ZodEnum<{
|
|
20
|
+
en: "en";
|
|
21
|
+
es: "es";
|
|
22
|
+
}>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type UpdateUserLanguageInput = z.infer<typeof updateUserLanguageSchema>;
|
|
25
|
+
//# sourceMappingURL=userSettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userSettings.d.ts","sourceRoot":"","sources":["../../src/schemas/userSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,kFAAkF;AAClF,eAAO,MAAM,cAAc;;;EAAuB,CAAC;AACnD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB;;;;;;iBAG7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,uCAAuC;AACvC,eAAO,MAAM,wBAAwB;;;;;iBAEnC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
2
|
/** Supported console languages. Keep in sync with the webapp message catalogs. */
|
|
4
3
|
export const languageSchema = z.enum(["en", "es"]);
|
|
5
|
-
export type Language = z.infer<typeof languageSchema>;
|
|
6
|
-
|
|
7
4
|
/** The per-user settings record (stored in the app DB, keyed by the Identity userRef). */
|
|
8
5
|
export const userSettingsSchema = z.object({
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
userRef: z.string().min(1),
|
|
7
|
+
language: languageSchema
|
|
11
8
|
});
|
|
12
|
-
export type UserSettings = z.infer<typeof userSettingsSchema>;
|
|
13
|
-
|
|
14
9
|
/** Operator-editable user settings. */
|
|
15
10
|
export const updateUserLanguageSchema = z.object({
|
|
16
|
-
|
|
11
|
+
language: languageSchema
|
|
17
12
|
});
|
|
18
|
-
|
|
13
|
+
//# sourceMappingURL=userSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userSettings.js","sourceRoot":"","sources":["../../src/schemas/userSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,kFAAkF;AAClF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAGnD,0FAA0F;AAC1F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,QAAQ,EAAE,cAAc;CACzB,CAAC,CAAC;AAGH,uCAAuC;AACvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,QAAQ,EAAE,cAAc;CACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const updateProfileSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodOptional<z.ZodString>;
|
|
4
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type UpdateProfileInput = z.infer<typeof updateProfileSchema>;
|
|
7
|
+
//# sourceMappingURL=users.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/schemas/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/schemas/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Events emitted by the Fonoster autopilot events-hook for a Voz IA call.
|
|
4
|
+
* `conversation.started` lets us capture partial data even if the call never ends
|
|
5
|
+
* cleanly; `conversation.ended` carries the transcript and recording.
|
|
6
|
+
*/
|
|
7
|
+
export declare const voiceEventTypeSchema: z.ZodEnum<{
|
|
8
|
+
"conversation.started": "conversation.started";
|
|
9
|
+
"conversation.ended": "conversation.ended";
|
|
10
|
+
}>;
|
|
11
|
+
export type VoiceEventType = z.infer<typeof voiceEventTypeSchema>;
|
|
12
|
+
/**
|
|
13
|
+
* A raw chat-history entry from the autopilot: `{ ai: text }` (our agent) or
|
|
14
|
+
* `{ human: text }` (the customer). Kept permissive — only the ai/human keys are read.
|
|
15
|
+
*/
|
|
16
|
+
export declare const voiceChatMessageSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
17
|
+
export declare const voiceConversationEventSchema: z.ZodObject<{
|
|
18
|
+
eventType: z.ZodEnum<{
|
|
19
|
+
"conversation.started": "conversation.started";
|
|
20
|
+
"conversation.ended": "conversation.ended";
|
|
21
|
+
}>;
|
|
22
|
+
appRef: z.ZodString;
|
|
23
|
+
callRef: z.ZodString;
|
|
24
|
+
phone: z.ZodString;
|
|
25
|
+
chatHistory: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
26
|
+
recordingUrl: z.ZodOptional<z.ZodString>;
|
|
27
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export type VoiceConversationEvent = z.infer<typeof voiceConversationEventSchema>;
|
|
30
|
+
/** A normalized transcript line stored in `channelData.transcript` for the console. */
|
|
31
|
+
export interface TranscriptLine {
|
|
32
|
+
role: "agent" | "customer";
|
|
33
|
+
text: string;
|
|
34
|
+
}
|
|
35
|
+
/** Normalize autopilot chatHistory into ordered console transcript lines. */
|
|
36
|
+
export declare function normalizeChatHistory(chatHistory: ReadonlyArray<Record<string, unknown>> | undefined): TranscriptLine[];
|
|
37
|
+
//# sourceMappingURL=voiceEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voiceEvent.d.ts","sourceRoot":"","sources":["../../src/schemas/voiceEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;EAAyD,CAAC;AAC3F,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,sBAAsB,wCAAoC,CAAC;AAExE,eAAO,MAAM,4BAA4B;;;;;;;;;;;iBAQvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,uFAAuF;AACvF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,GAC9D,cAAc,EAAE,CAQlB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Events emitted by the Fonoster autopilot events-hook for a Voz IA call.
|
|
4
|
+
* `conversation.started` lets us capture partial data even if the call never ends
|
|
5
|
+
* cleanly; `conversation.ended` carries the transcript and recording.
|
|
6
|
+
*/
|
|
7
|
+
export const voiceEventTypeSchema = z.enum(["conversation.started", "conversation.ended"]);
|
|
8
|
+
/**
|
|
9
|
+
* A raw chat-history entry from the autopilot: `{ ai: text }` (our agent) or
|
|
10
|
+
* `{ human: text }` (the customer). Kept permissive — only the ai/human keys are read.
|
|
11
|
+
*/
|
|
12
|
+
export const voiceChatMessageSchema = z.record(z.string(), z.unknown());
|
|
13
|
+
export const voiceConversationEventSchema = z.object({
|
|
14
|
+
eventType: voiceEventTypeSchema,
|
|
15
|
+
appRef: z.string().min(1),
|
|
16
|
+
callRef: z.string().min(1),
|
|
17
|
+
phone: z.string().min(1),
|
|
18
|
+
chatHistory: z.array(voiceChatMessageSchema).optional(),
|
|
19
|
+
recordingUrl: z.string().optional(),
|
|
20
|
+
durationSeconds: z.number().int().nonnegative().optional()
|
|
21
|
+
});
|
|
22
|
+
/** Normalize autopilot chatHistory into ordered console transcript lines. */
|
|
23
|
+
export function normalizeChatHistory(chatHistory) {
|
|
24
|
+
if (!chatHistory)
|
|
25
|
+
return [];
|
|
26
|
+
const lines = [];
|
|
27
|
+
for (const entry of chatHistory) {
|
|
28
|
+
if (typeof entry.ai === "string")
|
|
29
|
+
lines.push({ role: "agent", text: entry.ai });
|
|
30
|
+
else if (typeof entry.human === "string")
|
|
31
|
+
lines.push({ role: "customer", text: entry.human });
|
|
32
|
+
}
|
|
33
|
+
return lines;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=voiceEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voiceEvent.js","sourceRoot":"","sources":["../../src/schemas/voiceEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,sBAAsB,EAAE,oBAAoB,CAAC,CAAC,CAAC;AAG3F;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,SAAS,EAAE,oBAAoB;IAC/B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,QAAQ,EAAE;IACvD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;CAC3D,CAAC,CAAC;AASH,6EAA6E;AAC7E,MAAM,UAAU,oBAAoB,CAClC,WAA+D;IAE/D,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,CAAC;IAC5B,MAAM,KAAK,GAAqB,EAAE,CAAC;IACnC,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;aAC3E,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAChG,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* WhatsApp integration contracts: the per-workspace WABA credentials and its sender
|
|
4
|
+
* numbers, plus the inbound Meta webhook body. This is QCobro's first tenant-provided
|
|
5
|
+
* secret — the `accessToken` is encrypted at rest (cloak) and never returned to clients.
|
|
6
|
+
*
|
|
7
|
+
* The webhook schema is a focused port of `../mikro/mods/common/src/schemas/whatsapp.ts`,
|
|
8
|
+
* trimmed to what QCobro ingests (customer messages, delivery/opt-out statuses) and
|
|
9
|
+
* extended with `metadata.phone_number_id` so events resolve to a workspace/sender.
|
|
10
|
+
*/
|
|
11
|
+
/** What a sender number can do. `messaging` now; `calling` reserved for WhatsApp Voice (future). */
|
|
12
|
+
export declare const whatsAppCapabilitiesSchema: z.ZodObject<{
|
|
13
|
+
messaging: z.ZodBoolean;
|
|
14
|
+
calling: z.ZodBoolean;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type WhatsAppCapabilities = z.infer<typeof whatsAppCapabilitiesSchema>;
|
|
17
|
+
/** Connect (or update) the workspace's WABA. The token is the tenant secret. */
|
|
18
|
+
export declare const upsertWhatsAppIntegrationSchema: z.ZodObject<{
|
|
19
|
+
wabaId: z.ZodString;
|
|
20
|
+
accessToken: z.ZodString;
|
|
21
|
+
verifyToken: z.ZodString;
|
|
22
|
+
defaultLanguage: z.ZodString;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type UpsertWhatsAppIntegrationInput = z.infer<typeof upsertWhatsAppIntegrationSchema>;
|
|
25
|
+
/** Add a sender number to the workspace's integration. */
|
|
26
|
+
export declare const addWhatsAppSenderNumberSchema: z.ZodObject<{
|
|
27
|
+
phoneNumberId: z.ZodString;
|
|
28
|
+
displayNumber: z.ZodString;
|
|
29
|
+
label: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export type AddWhatsAppSenderNumberInput = z.infer<typeof addWhatsAppSenderNumberSchema>;
|
|
32
|
+
export declare const removeWhatsAppSenderNumberSchema: z.ZodObject<{
|
|
33
|
+
phoneNumberId: z.ZodString;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type RemoveWhatsAppSenderNumberInput = z.infer<typeof removeWhatsAppSenderNumberSchema>;
|
|
36
|
+
/** The full inbound webhook body. Lenient on unknown fields Meta may add. */
|
|
37
|
+
export declare const whatsAppWebhookSchema: z.ZodObject<{
|
|
38
|
+
object: z.ZodOptional<z.ZodString>;
|
|
39
|
+
entry: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
40
|
+
id: z.ZodOptional<z.ZodString>;
|
|
41
|
+
changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
42
|
+
field: z.ZodOptional<z.ZodString>;
|
|
43
|
+
value: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
messaging_product: z.ZodOptional<z.ZodString>;
|
|
45
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
display_phone_number: z.ZodOptional<z.ZodString>;
|
|
47
|
+
phone_number_id: z.ZodString;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
messages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
50
|
+
from: z.ZodString;
|
|
51
|
+
id: z.ZodString;
|
|
52
|
+
timestamp: z.ZodString;
|
|
53
|
+
type: z.ZodString;
|
|
54
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
55
|
+
body: z.ZodString;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
}, z.core.$strip>>>;
|
|
58
|
+
statuses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
status: z.ZodString;
|
|
61
|
+
recipient_id: z.ZodOptional<z.ZodString>;
|
|
62
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
63
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
64
|
+
code: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
title: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strip>>>;
|
|
67
|
+
}, z.core.$strip>>>;
|
|
68
|
+
phone_number_id: z.ZodOptional<z.ZodString>;
|
|
69
|
+
event: z.ZodOptional<z.ZodString>;
|
|
70
|
+
new_quality_rating: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strip>>;
|
|
72
|
+
}, z.core.$strip>>>;
|
|
73
|
+
}, z.core.$strip>>>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
export type WhatsAppWebhookBody = z.infer<typeof whatsAppWebhookSchema>;
|
|
76
|
+
//# sourceMappingURL=whatsApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsApp.d.ts","sourceRoot":"","sources":["../../src/schemas/whatsApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AAEH,oGAAoG;AACpG,eAAO,MAAM,0BAA0B;;;iBAGrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,gFAAgF;AAChF,eAAO,MAAM,+BAA+B;;;;;iBAQ1C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAE7F,0DAA0D;AAC1D,eAAO,MAAM,6BAA6B;;;;iBAOxC,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEzF,eAAO,MAAM,gCAAgC;;iBAE3C,CAAC;AACH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAkD/F,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGhC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* WhatsApp integration contracts: the per-workspace WABA credentials and its sender
|
|
4
|
+
* numbers, plus the inbound Meta webhook body. This is QCobro's first tenant-provided
|
|
5
|
+
* secret — the `accessToken` is encrypted at rest (cloak) and never returned to clients.
|
|
6
|
+
*
|
|
7
|
+
* The webhook schema is a focused port of `../mikro/mods/common/src/schemas/whatsapp.ts`,
|
|
8
|
+
* trimmed to what QCobro ingests (customer messages, delivery/opt-out statuses) and
|
|
9
|
+
* extended with `metadata.phone_number_id` so events resolve to a workspace/sender.
|
|
10
|
+
*/
|
|
11
|
+
/** What a sender number can do. `messaging` now; `calling` reserved for WhatsApp Voice (future). */
|
|
12
|
+
export const whatsAppCapabilitiesSchema = z.object({
|
|
13
|
+
messaging: z.boolean(),
|
|
14
|
+
calling: z.boolean()
|
|
15
|
+
});
|
|
16
|
+
/** Connect (or update) the workspace's WABA. The token is the tenant secret. */
|
|
17
|
+
export const upsertWhatsAppIntegrationSchema = z.object({
|
|
18
|
+
wabaId: z.string().min(1),
|
|
19
|
+
accessToken: z.string().min(1),
|
|
20
|
+
/** Token echoed back during Meta's webhook verify-token handshake. */
|
|
21
|
+
verifyToken: z.string().min(1),
|
|
22
|
+
/** Meta template-send language for this workspace (e.g. `es_DO`); the single source for
|
|
23
|
+
* the WhatsApp send language. Kept with the WhatsApp config rather than in WorkspaceSettings. */
|
|
24
|
+
defaultLanguage: z.string().min(1)
|
|
25
|
+
});
|
|
26
|
+
/** Add a sender number to the workspace's integration. */
|
|
27
|
+
export const addWhatsAppSenderNumberSchema = z.object({
|
|
28
|
+
/** Meta per-number messaging endpoint id. Globally unique across the deployment. */
|
|
29
|
+
phoneNumberId: z.string().min(1),
|
|
30
|
+
/** E.164 display number for the UI. */
|
|
31
|
+
displayNumber: z.string().min(1),
|
|
32
|
+
/** Operator label, e.g. "Cobranza Suave". */
|
|
33
|
+
label: z.string().min(1)
|
|
34
|
+
});
|
|
35
|
+
export const removeWhatsAppSenderNumberSchema = z.object({
|
|
36
|
+
phoneNumberId: z.string().min(1)
|
|
37
|
+
});
|
|
38
|
+
// ── Inbound webhook body (Meta Cloud API) ─────────────────────────────────────
|
|
39
|
+
const whatsAppInboundMessageSchema = z.object({
|
|
40
|
+
from: z.string(),
|
|
41
|
+
id: z.string(),
|
|
42
|
+
timestamp: z.string(),
|
|
43
|
+
type: z.string(),
|
|
44
|
+
text: z.object({ body: z.string() }).optional()
|
|
45
|
+
});
|
|
46
|
+
/** Delivery/read/opt-out status callbacks. `errors` carries opt-out/block signals (code 131050 etc.). */
|
|
47
|
+
const whatsAppStatusSchema = z.object({
|
|
48
|
+
id: z.string(),
|
|
49
|
+
status: z.string(),
|
|
50
|
+
recipient_id: z.string().optional(),
|
|
51
|
+
timestamp: z.string().optional(),
|
|
52
|
+
errors: z
|
|
53
|
+
.array(z.object({ code: z.number().optional(), title: z.string().optional() }))
|
|
54
|
+
.optional()
|
|
55
|
+
});
|
|
56
|
+
const whatsAppChangeValueSchema = z.object({
|
|
57
|
+
messaging_product: z.string().optional(),
|
|
58
|
+
metadata: z
|
|
59
|
+
.object({
|
|
60
|
+
display_phone_number: z.string().optional(),
|
|
61
|
+
/** Resolves the event to a `WhatsAppSenderNumber` (and thus a workspace). */
|
|
62
|
+
phone_number_id: z.string()
|
|
63
|
+
})
|
|
64
|
+
.optional(),
|
|
65
|
+
messages: z.array(whatsAppInboundMessageSchema).optional(),
|
|
66
|
+
statuses: z.array(whatsAppStatusSchema).optional(),
|
|
67
|
+
// Quality-rating callbacks: phone_number_id is at the value root, not under metadata.
|
|
68
|
+
phone_number_id: z.string().optional(),
|
|
69
|
+
event: z.string().optional(),
|
|
70
|
+
new_quality_rating: z.string().optional()
|
|
71
|
+
});
|
|
72
|
+
const whatsAppChangeSchema = z.object({
|
|
73
|
+
field: z.string().optional(),
|
|
74
|
+
value: whatsAppChangeValueSchema.optional()
|
|
75
|
+
});
|
|
76
|
+
const whatsAppEntrySchema = z.object({
|
|
77
|
+
id: z.string().optional(),
|
|
78
|
+
changes: z.array(whatsAppChangeSchema).optional()
|
|
79
|
+
});
|
|
80
|
+
/** The full inbound webhook body. Lenient on unknown fields Meta may add. */
|
|
81
|
+
export const whatsAppWebhookSchema = z.object({
|
|
82
|
+
object: z.string().optional(),
|
|
83
|
+
entry: z.array(whatsAppEntrySchema).optional()
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=whatsApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsApp.js","sourceRoot":"","sources":["../../src/schemas/whatsApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AAEH,oGAAoG;AACpG,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC;AAGH,gFAAgF;AAChF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,sEAAsE;IACtE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B;qGACiG;IACjG,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACnC,CAAC,CAAC;AAGH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,oFAAoF;IACpF,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,uCAAuC;IACvC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,6CAA6C;IAC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|
+
import { z } from "zod";
|
|
2
|
+
/** Supported display/billing currencies. A workspace has exactly one. */
|
|
3
|
+
export declare const currencySchema: z.ZodEnum<{
|
|
4
|
+
USD: "USD";
|
|
5
|
+
DOP: "DOP";
|
|
6
|
+
}>;
|
|
7
|
+
export type Currency = z.infer<typeof currencySchema>;
|
|
8
|
+
/** The per-workspace settings record (stored in the app DB, keyed by workspaceRef). */
|
|
9
|
+
export declare const workspaceSettingsSchema: z.ZodObject<{
|
|
10
|
+
workspaceRef: z.ZodString;
|
|
11
|
+
currency: z.ZodEnum<{
|
|
12
|
+
USD: "USD";
|
|
13
|
+
DOP: "DOP";
|
|
14
|
+
}>;
|
|
15
|
+
timezone: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type WorkspaceSettings = z.infer<typeof workspaceSettingsSchema>;
|
|
18
|
+
/** Operator-editable settings for the active workspace. */
|
|
19
|
+
export declare const updateWorkspaceSettingsSchema: z.ZodObject<{
|
|
20
|
+
currency: z.ZodEnum<{
|
|
21
|
+
USD: "USD";
|
|
22
|
+
DOP: "DOP";
|
|
23
|
+
}>;
|
|
24
|
+
timezone: z.ZodString;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type UpdateWorkspaceSettingsInput = z.infer<typeof updateWorkspaceSettingsSchema>;
|
|
27
|
+
//# sourceMappingURL=workspaceSettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaceSettings.d.ts","sourceRoot":"","sources":["../../src/schemas/workspaceSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yEAAyE;AACzE,eAAO,MAAM,cAAc;;;EAAyB,CAAC;AACrD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,uFAAuF;AACvF,eAAO,MAAM,uBAAuB;;;;;;;iBAIlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,2DAA2D;AAC3D,eAAO,MAAM,6BAA6B;;;;;;iBAGxC,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
2
|
/** Supported display/billing currencies. A workspace has exactly one. */
|
|
4
3
|
export const currencySchema = z.enum(["USD", "DOP"]);
|
|
5
|
-
export type Currency = z.infer<typeof currencySchema>;
|
|
6
|
-
|
|
7
4
|
/** The per-workspace settings record (stored in the app DB, keyed by workspaceRef). */
|
|
8
5
|
export const workspaceSettingsSchema = z.object({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
workspaceRef: z.string().min(1),
|
|
7
|
+
currency: currencySchema,
|
|
8
|
+
timezone: z.string().min(1)
|
|
12
9
|
});
|
|
13
|
-
export type WorkspaceSettings = z.infer<typeof workspaceSettingsSchema>;
|
|
14
|
-
|
|
15
10
|
/** Operator-editable settings for the active workspace. */
|
|
16
11
|
export const updateWorkspaceSettingsSchema = z.object({
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
currency: currencySchema,
|
|
13
|
+
timezone: z.string().min(1)
|
|
19
14
|
});
|
|
20
|
-
|
|
15
|
+
//# sourceMappingURL=workspaceSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaceSettings.js","sourceRoot":"","sources":["../../src/schemas/workspaceSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yEAAyE;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAGrD,uFAAuF;AACvF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAC;AAGH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const createWorkspaceSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
currency: z.ZodEnum<{
|
|
5
|
+
USD: "USD";
|
|
6
|
+
DOP: "DOP";
|
|
7
|
+
}>;
|
|
8
|
+
timezone: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type CreateWorkspaceInput = z.infer<typeof createWorkspaceSchema>;
|
|
11
|
+
export declare const getWorkspaceSchema: z.ZodObject<{
|
|
12
|
+
ref: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export type GetWorkspaceInput = z.infer<typeof getWorkspaceSchema>;
|
|
15
|
+
export declare const updateWorkspaceSchema: z.ZodObject<{
|
|
16
|
+
ref: z.ZodString;
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type UpdateWorkspaceInput = z.infer<typeof updateWorkspaceSchema>;
|
|
20
|
+
export declare const deleteWorkspaceSchema: z.ZodObject<{
|
|
21
|
+
ref: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type DeleteWorkspaceInput = z.infer<typeof deleteWorkspaceSchema>;
|
|
24
|
+
export declare const workspaceRoleEnum: z.ZodEnum<{
|
|
25
|
+
WORKSPACE_ADMIN: "WORKSPACE_ADMIN";
|
|
26
|
+
WORKSPACE_MEMBER: "WORKSPACE_MEMBER";
|
|
27
|
+
}>;
|
|
28
|
+
export type WorkspaceRole = z.infer<typeof workspaceRoleEnum>;
|
|
29
|
+
export declare const inviteMemberSchema: z.ZodObject<{
|
|
30
|
+
email: z.ZodEmail;
|
|
31
|
+
role: z.ZodDefault<z.ZodEnum<{
|
|
32
|
+
WORKSPACE_ADMIN: "WORKSPACE_ADMIN";
|
|
33
|
+
WORKSPACE_MEMBER: "WORKSPACE_MEMBER";
|
|
34
|
+
}>>;
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type InviteMemberInput = z.infer<typeof inviteMemberSchema>;
|
|
38
|
+
export declare const removeMemberSchema: z.ZodObject<{
|
|
39
|
+
userRef: z.ZodString;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type RemoveMemberInput = z.infer<typeof removeMemberSchema>;
|
|
42
|
+
export declare const resendInvitationSchema: z.ZodObject<{
|
|
43
|
+
userRef: z.ZodString;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export type ResendInvitationInput = z.infer<typeof resendInvitationSchema>;
|
|
46
|
+
export declare const acceptInvitationSchema: z.ZodObject<{
|
|
47
|
+
token: z.ZodString;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export type AcceptInvitationInput = z.infer<typeof acceptInvitationSchema>;
|
|
50
|
+
//# sourceMappingURL=workspaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../src/schemas/workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB;;;;;;;iBAIhC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEzE,eAAO,MAAM,kBAAkB;;iBAE7B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEnE,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEzE,eAAO,MAAM,qBAAqB;;iBAEhC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEzE,eAAO,MAAM,iBAAiB;;;EAAkD,CAAC;AACjF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE9D,eAAO,MAAM,kBAAkB;;;;;;;iBAO7B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEnE,eAAO,MAAM,kBAAkB;;iBAE7B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEnE,eAAO,MAAM,sBAAsB;;iBAEjC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE3E,eAAO,MAAM,sBAAsB;;iBAEjC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { currencySchema } from "./workspaceSettings.js";
|
|
3
|
+
export const createWorkspaceSchema = z.object({
|
|
4
|
+
name: z.string().min(1).max(60),
|
|
5
|
+
currency: currencySchema,
|
|
6
|
+
timezone: z.string().min(1)
|
|
7
|
+
});
|
|
8
|
+
export const getWorkspaceSchema = z.object({
|
|
9
|
+
ref: z.string().min(1)
|
|
10
|
+
});
|
|
11
|
+
export const updateWorkspaceSchema = z.object({
|
|
12
|
+
ref: z.string().min(1),
|
|
13
|
+
name: z.string().min(1).max(60)
|
|
14
|
+
});
|
|
15
|
+
export const deleteWorkspaceSchema = z.object({
|
|
16
|
+
ref: z.string().min(1)
|
|
17
|
+
});
|
|
18
|
+
export const workspaceRoleEnum = z.enum(["WORKSPACE_ADMIN", "WORKSPACE_MEMBER"]);
|
|
19
|
+
export const inviteMemberSchema = z.object({
|
|
20
|
+
email: z.email(),
|
|
21
|
+
role: workspaceRoleEnum.default("WORKSPACE_MEMBER"),
|
|
22
|
+
// Identity's inviteUserToWorkspace requires a name; keep the apiserver
|
|
23
|
+
// contract in sync so a missing name fails validation with a clear message
|
|
24
|
+
// instead of an opaque gRPC error.
|
|
25
|
+
name: z.string().min(1).max(60)
|
|
26
|
+
});
|
|
27
|
+
export const removeMemberSchema = z.object({
|
|
28
|
+
userRef: z.string().min(1)
|
|
29
|
+
});
|
|
30
|
+
export const resendInvitationSchema = z.object({
|
|
31
|
+
userRef: z.string().min(1)
|
|
32
|
+
});
|
|
33
|
+
export const acceptInvitationSchema = z.object({
|
|
34
|
+
token: z.string().min(1)
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=workspaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../src/schemas/workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,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