@dev.smartpricing/message-composer-utils 4.2.14-stage-fix.2 → 4.3.0
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/schemas/ai-integration.js +34 -0
- package/dist/schemas/ai-integration.js.map +1 -0
- package/dist/schemas/brand.js +40 -0
- package/dist/schemas/brand.js.map +1 -0
- package/dist/schemas/common.js +34 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/schemas/dynamic-values.js +16 -0
- package/dist/schemas/dynamic-values.js.map +1 -0
- package/dist/schemas/index.js +15 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/language.js +13 -0
- package/dist/schemas/language.js.map +1 -0
- package/dist/schemas/media.js +33 -0
- package/dist/schemas/media.js.map +1 -0
- package/dist/schemas/message-compilation.js +31 -0
- package/dist/schemas/message-compilation.js.map +1 -0
- package/dist/schemas/message-group.js +70 -0
- package/dist/schemas/message-group.js.map +1 -0
- package/dist/schemas/message.js +33 -0
- package/dist/schemas/message.js.map +1 -0
- package/dist/schemas/meta-integration.js +42 -0
- package/dist/schemas/meta-integration.js.map +1 -0
- package/dist/schemas/onboarding.js +38 -0
- package/dist/schemas/onboarding.js.map +1 -0
- package/dist/schemas/organization.js +7 -0
- package/dist/schemas/organization.js.map +1 -0
- package/dist/schemas/property.js +8 -0
- package/dist/schemas/property.js.map +1 -0
- package/dist/schemas/tracking.js +6 -0
- package/dist/schemas/tracking.js.map +1 -0
- package/dist/types/api/apiTemplates.js +2 -0
- package/dist/types/api/apiTemplates.js.map +1 -0
- package/dist/types/template.js +2 -0
- package/dist/types/template.js.map +1 -0
- package/dist/utils/templates/email-maizzle.js +433 -0
- package/dist/utils/templates/email-maizzle.js.map +1 -0
- package/dist/utils/templates/email-mjml.js +1 -1
- package/dist/utils/templates/email.test.js.map +1 -1
- package/package.json +5 -1
- package/src/schemas/ai-integration.ts +53 -0
- package/src/schemas/brand.ts +57 -0
- package/src/schemas/common.ts +43 -0
- package/src/schemas/dynamic-values.ts +23 -0
- package/src/schemas/index.ts +14 -0
- package/src/schemas/language.ts +15 -0
- package/src/schemas/media.ts +37 -0
- package/src/schemas/message-compilation.ts +38 -0
- package/src/schemas/message-group.ts +100 -0
- package/src/schemas/message.ts +36 -0
- package/src/schemas/meta-integration.ts +47 -0
- package/src/schemas/onboarding.ts +44 -0
- package/src/schemas/organization.ts +7 -0
- package/src/schemas/property.ts +10 -0
- package/src/schemas/tracking.ts +6 -0
- package/src/types/api/aiIntegration.ts +1 -1
- package/src/types/brand.ts +1 -1
- package/src/types/dynamic-values.ts +1 -1
- package/src/types/kafka-events.ts +1 -1
- package/src/types/media.ts +4 -4
- package/src/types/message.ts +3 -3
- package/src/types/submission-job.ts +2 -2
- package/src/utils/templates/brand-cascade.ts +1 -1
- package/src/utils/templates/email-mjml.ts +1 -1
- package/src/utils/templates/email.test.ts +1 -5
- package/src/utils/templates/tiptap.ts +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DynamicValuesResponse } from "../types/index.js";
|
|
3
|
+
|
|
4
|
+
export const dynamicValuesQuerySchema = z.object({
|
|
5
|
+
product: z.string({ error: "product query parameter is required" }),
|
|
6
|
+
context: z.string().optional(),
|
|
7
|
+
language: z.string().default("en"),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const dynamicValuesResponseSchema = z.record(
|
|
11
|
+
z.string(),
|
|
12
|
+
z.object({
|
|
13
|
+
description: z.string(),
|
|
14
|
+
fields: z.array(
|
|
15
|
+
z.object({
|
|
16
|
+
value: z.string(),
|
|
17
|
+
label: z.string(),
|
|
18
|
+
description: z.string(),
|
|
19
|
+
default: z.string().optional(),
|
|
20
|
+
}),
|
|
21
|
+
),
|
|
22
|
+
}),
|
|
23
|
+
) satisfies z.ZodType<DynamicValuesResponse>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./common.js";
|
|
2
|
+
export * from "./ai-integration.js";
|
|
3
|
+
export * from "./brand.js";
|
|
4
|
+
export * from "./dynamic-values.js";
|
|
5
|
+
export * from "./language.js";
|
|
6
|
+
export * from "./media.js";
|
|
7
|
+
export * from "./organization.js";
|
|
8
|
+
export * from "./property.js";
|
|
9
|
+
export * from "./message.js";
|
|
10
|
+
export * from "./message-group.js";
|
|
11
|
+
export * from "./message-compilation.js";
|
|
12
|
+
export * from "./meta-integration.js";
|
|
13
|
+
export * from "./onboarding.js";
|
|
14
|
+
export * from "./tracking.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Language, WithDbTimestamps } from "../types/index.js";
|
|
3
|
+
import { dbTimestampSchema } from "./common.js";
|
|
4
|
+
|
|
5
|
+
/** Mirrors Language rows; id is a TEXT primary key (e.g. "en"), not a UUID. */
|
|
6
|
+
export const languageResponseSchema = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
name: z.string(),
|
|
9
|
+
flag: z.string(),
|
|
10
|
+
meta_language_code: z.string().nullable(),
|
|
11
|
+
created_at: dbTimestampSchema,
|
|
12
|
+
updated_at: dbTimestampSchema,
|
|
13
|
+
}) satisfies z.ZodType<unknown, WithDbTimestamps<Language>>;
|
|
14
|
+
|
|
15
|
+
export const languageListResponseSchema = z.array(languageResponseSchema);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { MediaFromDb } from "../types/index.js";
|
|
3
|
+
import { dbTimestampSchema } from "./common.js";
|
|
4
|
+
|
|
5
|
+
const DEFAULT_LIMIT = 50;
|
|
6
|
+
const MAX_LIMIT = 200;
|
|
7
|
+
|
|
8
|
+
export const listMediaQuerySchema = z.object({
|
|
9
|
+
userId: z.string().optional(),
|
|
10
|
+
organizationId: z.string().optional(),
|
|
11
|
+
smartnessEventId: z.uuid().optional(),
|
|
12
|
+
fileType: z.string().optional(),
|
|
13
|
+
limit: z.coerce.number().int().min(1).max(MAX_LIMIT).default(DEFAULT_LIMIT),
|
|
14
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Mirrors MediaFromDb rows as returned today. Optional columns are also
|
|
19
|
+
* nullable: the shared type says `field?: string` but SELECT * returns
|
|
20
|
+
* explicit nulls (why response schemas carry no `satisfies` pin yet).
|
|
21
|
+
*/
|
|
22
|
+
export const mediaResponseSchema = z.object({
|
|
23
|
+
id: z.uuid(),
|
|
24
|
+
remote_url: z.string(),
|
|
25
|
+
remote_name: z.string(),
|
|
26
|
+
file_name: z.string(),
|
|
27
|
+
file_type: z.string(),
|
|
28
|
+
meta_handle_id: z.string().nullable().optional(),
|
|
29
|
+
smartchat_media_id: z.string().nullable().optional(),
|
|
30
|
+
smartness_event_id: z.string().nullable().optional(),
|
|
31
|
+
organization_id: z.string().nullable().optional(),
|
|
32
|
+
user_id: z.string(),
|
|
33
|
+
created_at: dbTimestampSchema,
|
|
34
|
+
updated_at: dbTimestampSchema,
|
|
35
|
+
}) satisfies z.ZodType<unknown, MediaFromDb>;
|
|
36
|
+
|
|
37
|
+
export const mediaListResponseSchema = z.array(mediaResponseSchema);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
CompileMessageRequest,
|
|
4
|
+
CompileAndSendRequest,
|
|
5
|
+
previewMessageRequestSchema,
|
|
6
|
+
} from "../types/index.js";
|
|
7
|
+
|
|
8
|
+
export const messageLanguageQuerySchema = z.object({
|
|
9
|
+
language: z.string(),
|
|
10
|
+
fallbackLanguage: z.string().optional(),
|
|
11
|
+
strict_language: z.coerce.boolean().optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const compileMessageBodySchema = z.object({
|
|
15
|
+
language: z.string(),
|
|
16
|
+
fallbackLanguage: z.string().optional(),
|
|
17
|
+
parameters: z.record(z.string(), z.unknown()),
|
|
18
|
+
strict: z.boolean().optional(),
|
|
19
|
+
brand_id: z.string().optional(),
|
|
20
|
+
strict_language: z.boolean().optional(),
|
|
21
|
+
}) satisfies z.ZodType<CompileMessageRequest>;
|
|
22
|
+
|
|
23
|
+
export const compileAndSendBodySchema = compileMessageBodySchema.extend({
|
|
24
|
+
from: z.string().min(1, "Missing required parameters"),
|
|
25
|
+
to: z.string().min(1, "Missing required parameters"),
|
|
26
|
+
automationEngineMessageId: z.string().optional(),
|
|
27
|
+
additionalInfo: z.record(z.string(), z.unknown()).optional(),
|
|
28
|
+
provider: z.enum(["SendGrid", "AmazonSES"]).optional(),
|
|
29
|
+
kind: z.string().optional(),
|
|
30
|
+
}) satisfies z.ZodType<CompileAndSendRequest>;
|
|
31
|
+
|
|
32
|
+
export const testEmailBodySchema = z.object({
|
|
33
|
+
message: previewMessageRequestSchema.shape.message,
|
|
34
|
+
to: z.string().min(1, "Missing required parameters: message, to"),
|
|
35
|
+
brand_id: z.string().nullable().optional(),
|
|
36
|
+
sender_name: z.string().nullable().optional(),
|
|
37
|
+
from: z.string().optional(),
|
|
38
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
DuplicateMessageGroupBody,
|
|
4
|
+
MessageGroupFromDb,
|
|
5
|
+
MessageGroupWithMessageSummary,
|
|
6
|
+
MESSAGE_GROUP_CATEGORIES,
|
|
7
|
+
MESSAGE_GROUP_VISIBILITY,
|
|
8
|
+
MESSAGE_STATUS,
|
|
9
|
+
MESSAGE_RENDER_TYPES,
|
|
10
|
+
} from "../types/index.js";
|
|
11
|
+
import { dbTimestampSchema } from "./common.js";
|
|
12
|
+
import { messageResponseSchema } from "./message.js";
|
|
13
|
+
|
|
14
|
+
export const listMessageGroupsQuerySchema = z.object({
|
|
15
|
+
render_type: z.string().optional(),
|
|
16
|
+
tags: z.union([z.string(), z.array(z.string())]).optional(),
|
|
17
|
+
tags_mode: z.enum(["and", "or"]).default("and"),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const updateMessageGroupBodySchema = z.object({
|
|
21
|
+
name: z
|
|
22
|
+
.string()
|
|
23
|
+
.refine(
|
|
24
|
+
(name) => name.trim() !== "",
|
|
25
|
+
"Name is required and cannot be empty",
|
|
26
|
+
),
|
|
27
|
+
brand_id: z.string().nullable().optional(),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const createMessageGroupBodySchema = z.object({
|
|
31
|
+
name: z.string(),
|
|
32
|
+
category: z.enum(MESSAGE_GROUP_CATEGORIES),
|
|
33
|
+
visibility: z.enum(MESSAGE_GROUP_VISIBILITY).optional(),
|
|
34
|
+
brand_id: z.string().nullable().optional(),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const duplicateMessageGroupBodySchema = z
|
|
38
|
+
.object({
|
|
39
|
+
name: z.string().optional(),
|
|
40
|
+
visibility: z.enum(MESSAGE_GROUP_VISIBILITY).optional(),
|
|
41
|
+
brand_id: z.string().nullable().optional(),
|
|
42
|
+
})
|
|
43
|
+
.optional() satisfies z.ZodType<DuplicateMessageGroupBody | undefined>;
|
|
44
|
+
|
|
45
|
+
/** Mirrors MessageGroupFromDb rows as returned today. */
|
|
46
|
+
export const messageGroupResponseSchema = z.object({
|
|
47
|
+
id: z.uuid(),
|
|
48
|
+
name: z.string(),
|
|
49
|
+
category: z.enum(MESSAGE_GROUP_CATEGORIES),
|
|
50
|
+
visibility: z.enum(MESSAGE_GROUP_VISIBILITY).nullable().optional(),
|
|
51
|
+
brand_id: z.string().nullable().optional(),
|
|
52
|
+
organization_id: z.string().nullable().optional(),
|
|
53
|
+
user_id: z.string(),
|
|
54
|
+
created_at: dbTimestampSchema,
|
|
55
|
+
updated_at: dbTimestampSchema,
|
|
56
|
+
}) satisfies z.ZodType<unknown, MessageGroupFromDb>;
|
|
57
|
+
|
|
58
|
+
export const messageGroupWithMessagesResponseSchema =
|
|
59
|
+
messageGroupResponseSchema.extend({
|
|
60
|
+
messages: z.array(messageResponseSchema),
|
|
61
|
+
tags: z.array(z.string()),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const messageGroupWithTagsResponseSchema =
|
|
65
|
+
messageGroupResponseSchema.extend({
|
|
66
|
+
tags: z.array(z.string()),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
/** List item for GET /message-groups: per-message summaries, no bodies. */
|
|
70
|
+
export const messageGroupWithMessageSummaryResponseSchema =
|
|
71
|
+
messageGroupWithTagsResponseSchema.extend({
|
|
72
|
+
messages: z.array(
|
|
73
|
+
z.object({
|
|
74
|
+
id: z.uuid(),
|
|
75
|
+
language: z.string(),
|
|
76
|
+
status: z.enum(MESSAGE_STATUS),
|
|
77
|
+
preview: z.string(),
|
|
78
|
+
render_type: z.enum(MESSAGE_RENDER_TYPES),
|
|
79
|
+
}),
|
|
80
|
+
),
|
|
81
|
+
}) satisfies z.ZodType<unknown, MessageGroupWithMessageSummary>;
|
|
82
|
+
|
|
83
|
+
export const messageGroupSummaryListResponseSchema = z.array(
|
|
84
|
+
messageGroupWithMessageSummaryResponseSchema,
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
export const messageGroupValidationResponseSchema = z.object({
|
|
88
|
+
valid: z.boolean(),
|
|
89
|
+
errors: z.object({
|
|
90
|
+
status: z.array(z.string()),
|
|
91
|
+
languages: z.array(z.string()),
|
|
92
|
+
content: z.record(
|
|
93
|
+
z.string(),
|
|
94
|
+
z.object({
|
|
95
|
+
type: z.string(),
|
|
96
|
+
errors: z.array(z.string()),
|
|
97
|
+
}),
|
|
98
|
+
),
|
|
99
|
+
}),
|
|
100
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { MESSAGE_STATUS, MESSAGE_RENDER_TYPES } from "../types/index.js";
|
|
3
|
+
import { dbTimestampSchema } from "./common.js";
|
|
4
|
+
|
|
5
|
+
export const messageBodySchema = z.object({
|
|
6
|
+
message_group_id: z.uuid(),
|
|
7
|
+
language_id: z.string(),
|
|
8
|
+
status: z.enum(MESSAGE_STATUS),
|
|
9
|
+
render_type: z.enum(MESSAGE_RENDER_TYPES),
|
|
10
|
+
body: z.record(z.string(), z.unknown()),
|
|
11
|
+
metadata: z.record(z.string(), z.unknown()),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Mirrors MessageFromDb rows as returned today. body/metadata stay loose
|
|
16
|
+
* records — no full Zod schema exists for the deep block unions (ADR 0004 §5).
|
|
17
|
+
*/
|
|
18
|
+
export const messageResponseSchema = z.object({
|
|
19
|
+
id: z.uuid(),
|
|
20
|
+
message_group_id: z.uuid(),
|
|
21
|
+
language_id: z.string(),
|
|
22
|
+
status: z.enum(MESSAGE_STATUS),
|
|
23
|
+
render_type: z.enum(MESSAGE_RENDER_TYPES),
|
|
24
|
+
body: z.record(z.string(), z.unknown()),
|
|
25
|
+
metadata: z.record(z.string(), z.unknown()).nullable(),
|
|
26
|
+
organization_id: z.string().nullable().optional(),
|
|
27
|
+
user_id: z.string(),
|
|
28
|
+
created_at: dbTimestampSchema,
|
|
29
|
+
updated_at: dbTimestampSchema,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const messageListResponseSchema = z.array(messageResponseSchema);
|
|
33
|
+
|
|
34
|
+
export const messageDeletedResponseSchema = z.object({
|
|
35
|
+
message: z.string(),
|
|
36
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { SubmissionJob, SubmissionJobResponse } from "../types/index.js";
|
|
3
|
+
import { dbTimestampSchema } from "./common.js";
|
|
4
|
+
|
|
5
|
+
export const messageIdParamsSchema = z.object({
|
|
6
|
+
messageId: z.uuid(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const submitGroupBodySchema = z.object({
|
|
10
|
+
wabaId: z.string().min(1, "Meta WABA ID required in body"),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Mirrors submission_jobs rows as returned today. Note: meta_config is echoed
|
|
15
|
+
* back as stored; accessToken is optional here because the current insert
|
|
16
|
+
* never writes it (the shared SubmissionJob type still claims it required —
|
|
17
|
+
* candidate for a type fix + curation pass).
|
|
18
|
+
*/
|
|
19
|
+
export const submissionJobResponseSchema = z.object({
|
|
20
|
+
id: z.uuid(),
|
|
21
|
+
message_group_id: z.uuid(),
|
|
22
|
+
status: z.enum(["queued", "processing", "completed", "failed"]),
|
|
23
|
+
submitted_count: z.number(),
|
|
24
|
+
failed_count: z.number(),
|
|
25
|
+
errors: z
|
|
26
|
+
.array(z.object({ messageId: z.string().optional(), error: z.string() }))
|
|
27
|
+
.nullable(),
|
|
28
|
+
meta_config: z.object({
|
|
29
|
+
wabaId: z.string(),
|
|
30
|
+
accessToken: z.string().optional(),
|
|
31
|
+
apiVersion: z.string().optional(),
|
|
32
|
+
}),
|
|
33
|
+
created_at: dbTimestampSchema,
|
|
34
|
+
updated_at: dbTimestampSchema,
|
|
35
|
+
}) satisfies z.ZodType<unknown, SubmissionJob>;
|
|
36
|
+
|
|
37
|
+
/** Sync single-message submission result; templateId is finalized via webhook. */
|
|
38
|
+
export const submitMessageResponseSchema = z.object({
|
|
39
|
+
success: z.boolean(),
|
|
40
|
+
templateId: z.string(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const submitGroupAcceptedResponseSchema = z.object({
|
|
44
|
+
jobId: z.uuid(),
|
|
45
|
+
status: z.literal("queued"),
|
|
46
|
+
message: z.string(),
|
|
47
|
+
}) satisfies z.ZodType<SubmissionJobResponse>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
brandDefaultEmailSettingsSchema,
|
|
4
|
+
brandDefaultButtonSettingsSchema,
|
|
5
|
+
brandSocialsSchema,
|
|
6
|
+
} from "../types/index.js";
|
|
7
|
+
import { messageGroupWithMessagesResponseSchema } from "./message-group.js";
|
|
8
|
+
|
|
9
|
+
export const onboardingResponseSchema = z.object({
|
|
10
|
+
messageGroups: z.array(messageGroupWithMessagesResponseSchema),
|
|
11
|
+
summary: z.object({
|
|
12
|
+
totalGroups: z.number(),
|
|
13
|
+
totalMessages: z.number(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const onboardingBodySchema = z.object({
|
|
18
|
+
organizationId: z
|
|
19
|
+
.string({ error: "Both organizationId and userId are required" })
|
|
20
|
+
.min(1, "Both organizationId and userId are required"),
|
|
21
|
+
userId: z
|
|
22
|
+
.string({ error: "Both organizationId and userId are required" })
|
|
23
|
+
.min(1, "Both organizationId and userId are required"),
|
|
24
|
+
tags: z.array(z.string()).optional(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const createDefaultBrandBodySchema = z.object({
|
|
28
|
+
organizationId: z
|
|
29
|
+
.string({ error: "organizationId, userId, name, and logoUrl are required" })
|
|
30
|
+
.min(1, "organizationId, userId, name, and logoUrl are required"),
|
|
31
|
+
userId: z
|
|
32
|
+
.string({ error: "organizationId, userId, name, and logoUrl are required" })
|
|
33
|
+
.min(1, "organizationId, userId, name, and logoUrl are required"),
|
|
34
|
+
name: z
|
|
35
|
+
.string({ error: "organizationId, userId, name, and logoUrl are required" })
|
|
36
|
+
.min(1, "organizationId, userId, name, and logoUrl are required"),
|
|
37
|
+
logoUrl: z
|
|
38
|
+
.string({ error: "organizationId, userId, name, and logoUrl are required" })
|
|
39
|
+
.min(1, "organizationId, userId, name, and logoUrl are required"),
|
|
40
|
+
colors: z.array(z.string()).optional(),
|
|
41
|
+
defaultEmailSettings: brandDefaultEmailSettingsSchema.optional(),
|
|
42
|
+
defaultButtonSettings: brandDefaultButtonSettingsSchema.optional(),
|
|
43
|
+
defaultSocials: brandSocialsSchema,
|
|
44
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Property } from "../types/index.js";
|
|
3
|
+
|
|
4
|
+
export const propertyResponseSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
hasAccess: z.boolean(),
|
|
8
|
+
}) satisfies z.ZodType<Property>;
|
|
9
|
+
|
|
10
|
+
export const propertyListResponseSchema = z.array(propertyResponseSchema);
|
package/src/types/brand.ts
CHANGED
|
@@ -88,7 +88,7 @@ export interface Brand extends DbEntity {
|
|
|
88
88
|
default_email_settings: BrandDefaultEmailSettings;
|
|
89
89
|
default_button_settings: BrandDefaultButtonSettings;
|
|
90
90
|
default_socials: BrandSocials | null;
|
|
91
|
-
data: BrandData;
|
|
91
|
+
data: BrandData | null;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
export type BrandFromDb = WithDbTimestamps<Brand> & {
|
|
@@ -19,7 +19,7 @@ export interface DynamicValuesContextConfig {
|
|
|
19
19
|
/**
|
|
20
20
|
* Fields only offered when the organization has the Internal PMS capability
|
|
21
21
|
* (Core `product-access` → `smartpms.subscribed`). Merged into `fields` in
|
|
22
|
-
* the API response for entitled organizations; hidden otherwise (see ADR
|
|
22
|
+
* the API response for entitled organizations; hidden otherwise (see ADR 0009).
|
|
23
23
|
*/
|
|
24
24
|
pmsFields?: DynamicValueFieldConfig[];
|
|
25
25
|
}
|
package/src/types/media.ts
CHANGED
|
@@ -17,10 +17,10 @@ export interface Media extends DbEntity {
|
|
|
17
17
|
remote_name: string; // Sanitized filename stored in GCS (includes UUID prefix)
|
|
18
18
|
file_name: string; // Original filename from user
|
|
19
19
|
file_type: string;
|
|
20
|
-
meta_handle_id?: string;
|
|
21
|
-
smartchat_media_id?: string;
|
|
22
|
-
smartness_event_id?: string;
|
|
23
|
-
organization_id?: string;
|
|
20
|
+
meta_handle_id?: string | null;
|
|
21
|
+
smartchat_media_id?: string | null;
|
|
22
|
+
smartness_event_id?: string | null;
|
|
23
|
+
organization_id?: string | null;
|
|
24
24
|
user_id: string;
|
|
25
25
|
}
|
|
26
26
|
|
package/src/types/message.ts
CHANGED
|
@@ -31,7 +31,7 @@ interface BaseMessage extends DbEntity {
|
|
|
31
31
|
language_id: string;
|
|
32
32
|
status: MessageStatus;
|
|
33
33
|
render_type: RenderType;
|
|
34
|
-
organization_id?: string;
|
|
34
|
+
organization_id?: string | null;
|
|
35
35
|
user_id: string;
|
|
36
36
|
}
|
|
37
37
|
export interface WhatsappMessage extends BaseMessage {
|
|
@@ -83,9 +83,9 @@ export interface MessageGroup extends DbEntity {
|
|
|
83
83
|
id: string;
|
|
84
84
|
name: string;
|
|
85
85
|
category: MessageGroupCategory;
|
|
86
|
-
visibility?: MessageGroupVisibility;
|
|
86
|
+
visibility?: MessageGroupVisibility | null;
|
|
87
87
|
brand_id?: string | null;
|
|
88
|
-
organization_id?: string;
|
|
88
|
+
organization_id?: string | null;
|
|
89
89
|
user_id: string;
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -14,10 +14,10 @@ export interface SubmissionJob {
|
|
|
14
14
|
/** Absent for job-level failures (e.g. credentials resolution) */
|
|
15
15
|
messageId?: string;
|
|
16
16
|
error: string;
|
|
17
|
-
}
|
|
17
|
+
}> | null;
|
|
18
18
|
meta_config: {
|
|
19
19
|
wabaId: string;
|
|
20
|
-
accessToken
|
|
20
|
+
accessToken?: string;
|
|
21
21
|
apiVersion?: string;
|
|
22
22
|
};
|
|
23
23
|
created_at: string;
|
|
@@ -32,7 +32,7 @@ import { generateText } from "./messages.js";
|
|
|
32
32
|
/**
|
|
33
33
|
* Converts TipTap JSONContent to HTML for email rendering.
|
|
34
34
|
* `linkColor`, when given, is baked as a literal inline style onto `<a>`
|
|
35
|
-
* tags (not a CSS var) — see docs/adr/
|
|
35
|
+
* tags (not a CSS var) — see docs/adr/0008 for why this compile path can't
|
|
36
36
|
* reuse the live-editor CSS custom property approach.
|
|
37
37
|
*/
|
|
38
38
|
function generateEmailHtml(
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest";
|
|
2
2
|
import { syncLayoutFromBase } from "./email.js";
|
|
3
|
-
import type {
|
|
4
|
-
ButtonBlock,
|
|
5
|
-
GridBlock,
|
|
6
|
-
ImageBlock,
|
|
7
|
-
} from "../../types/index.js";
|
|
3
|
+
import type { ButtonBlock, GridBlock, ImageBlock } from "../../types/index.js";
|
|
8
4
|
import {
|
|
9
5
|
emptyButtonBlock,
|
|
10
6
|
emptyGridBlock,
|
|
@@ -21,7 +21,7 @@ import { generateHtml, generateText } from "./messages.js";
|
|
|
21
21
|
* instance. Used for the canvas preview and settings-panel editor.
|
|
22
22
|
* - "compile": a literal hex is baked into the inline style. Required for
|
|
23
23
|
* the final email HTML — Outlook and other strict clients don't support
|
|
24
|
-
* CSS custom properties. See docs/adr/
|
|
24
|
+
* CSS custom properties. See docs/adr/0008.
|
|
25
25
|
*/
|
|
26
26
|
export type LinkColorOption =
|
|
27
27
|
| { mode: "live" }
|