feat(calendario): opciones de generación, regenerar y publish IG/FB
Cantidades posts/stories/reels, días, mix mismo día, instrucciones, regenerar marcadas, texto por slide/guión reel, stories interactivas y horarios IG/FB separados o iguales. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -130,6 +130,16 @@ function normalizePiece(
|
||||
hook: str(raw.hook, 300),
|
||||
body: cleanBody,
|
||||
});
|
||||
const slide_copy = Array.isArray(raw.slide_copy)
|
||||
? (raw.slide_copy as { n?: unknown; label?: unknown; text?: unknown }[])
|
||||
.map((s, i) => ({
|
||||
n: Number(s.n) || i + 1,
|
||||
label: s.label != null ? String(s.label).slice(0, 80) : undefined,
|
||||
text: String(s.text || '').trim().slice(0, 800),
|
||||
}))
|
||||
.filter((s) => s.text)
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
id: str(raw.id, 120) || newPieceId(date, title),
|
||||
date,
|
||||
@@ -151,6 +161,9 @@ function normalizePiece(
|
||||
: /linkedin/i.test(enriched.platform || '')
|
||||
? '#7C66B8'
|
||||
: '#2071cf',
|
||||
slide_copy: slide_copy?.length ? slide_copy : undefined,
|
||||
reel_script: str(raw.reel_script, 6000) || undefined,
|
||||
interactive_story: str(raw.interactive_story, 40) || undefined,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ export async function POST(req: NextRequest) {
|
||||
const body = (await req.json().catch(() => ({}))) as {
|
||||
month?: string;
|
||||
avoid_titles?: string[];
|
||||
gen_options?: Record<string, unknown>;
|
||||
options?: Record<string, unknown>;
|
||||
};
|
||||
const month = String(body.month || '').slice(0, 7);
|
||||
if (!/^\d{4}-\d{2}$/.test(month)) {
|
||||
@@ -55,6 +57,9 @@ export async function POST(req: NextRequest) {
|
||||
.map((t) => t.trim().slice(0, 160))
|
||||
.slice(0, 40)
|
||||
: [];
|
||||
const genOptions = (body.gen_options || body.options || null) as
|
||||
| Record<string, unknown>
|
||||
| null;
|
||||
|
||||
let slug = 'cliente';
|
||||
const t = await restGet<{ slug?: string }[]>(
|
||||
@@ -132,6 +137,7 @@ export async function POST(req: NextRequest) {
|
||||
brandbook,
|
||||
publishedPosts,
|
||||
avoidTitles,
|
||||
genOptions: genOptions || undefined,
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
|
||||
@@ -302,7 +302,7 @@ export default async function CalendarioPage({
|
||||
</Link>
|
||||
</div>
|
||||
{agency ? (
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<div className="flex flex-wrap items-center justify-end gap-3">
|
||||
<CalendarCreator
|
||||
tenantLabel={ctx.label}
|
||||
existingMonths={plans.map((p) => p.month).filter(Boolean)}
|
||||
@@ -345,14 +345,14 @@ export default async function CalendarioPage({
|
||||
return (
|
||||
<div className="space-y-5">
|
||||
{agency ? (
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<div className="flex flex-wrap items-center justify-end gap-3">
|
||||
{active.month ? (
|
||||
<DeleteCalendarMonthButton month={active.month} />
|
||||
) : null}
|
||||
<CalendarCreator
|
||||
tenantLabel={ctx.label}
|
||||
existingMonths={plans.map((p) => p.month).filter(Boolean)}
|
||||
/>
|
||||
{active.month ? (
|
||||
<DeleteCalendarMonthButton month={active.month} />
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
<RrssMonthView
|
||||
|
||||
Reference in New Issue
Block a user