pxengine 0.1.116 → 0.1.117
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/index.cjs +79 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.mjs +79 -0
- package/dist/index.mjs.map +1 -1
- package/dist/registry.json +11 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -16362,6 +16362,8 @@ var PresentationJobCard = ({
|
|
|
16362
16362
|
approveOutlineUrl,
|
|
16363
16363
|
reorderSlidesUrl,
|
|
16364
16364
|
approveSlideUrl,
|
|
16365
|
+
setSlideTemplateUrl,
|
|
16366
|
+
templatesUrl,
|
|
16365
16367
|
regenerateUrl,
|
|
16366
16368
|
hideApproval = false,
|
|
16367
16369
|
className,
|
|
@@ -16384,6 +16386,7 @@ var PresentationJobCard = ({
|
|
|
16384
16386
|
const [, setTemplateVersionId] = (0, import_react78.useState)(initialTemplateVersionId || "");
|
|
16385
16387
|
const [reviewStatus, setReviewStatus] = (0, import_react78.useState)(initialReviewStatus || "");
|
|
16386
16388
|
const [outline, setOutline] = (0, import_react78.useState)(initialOutline);
|
|
16389
|
+
const [slideTemplateOptions, setSlideTemplateOptions] = (0, import_react78.useState)(null);
|
|
16387
16390
|
const [showExport, setShowExport] = (0, import_react78.useState)(false);
|
|
16388
16391
|
const [showFullscreen, setShowFullscreen] = (0, import_react78.useState)(false);
|
|
16389
16392
|
const [copied, setCopied] = (0, import_react78.useState)(false);
|
|
@@ -16438,6 +16441,33 @@ var PresentationJobCard = ({
|
|
|
16438
16441
|
(0, import_react78.useEffect)(() => {
|
|
16439
16442
|
if (initialOutline) setOutline(initialOutline);
|
|
16440
16443
|
}, [initialOutlineSlideCount]);
|
|
16444
|
+
(0, import_react78.useEffect)(() => {
|
|
16445
|
+
if (reviewStatus !== "pending_outline_approval" || slideTemplateOptions !== null) return;
|
|
16446
|
+
let cancelled = false;
|
|
16447
|
+
(async () => {
|
|
16448
|
+
try {
|
|
16449
|
+
const endpoint = templatesUrl || "/api/presentations/templates";
|
|
16450
|
+
const headers = {};
|
|
16451
|
+
if (authToken) headers.Authorization = `Bearer ${authToken}`;
|
|
16452
|
+
const res = await fetch(endpoint, { headers });
|
|
16453
|
+
if (!res.ok) throw new Error(`Templates fetch failed (${res.status})`);
|
|
16454
|
+
const list = await res.json();
|
|
16455
|
+
if (!cancelled && Array.isArray(list)) {
|
|
16456
|
+
setSlideTemplateOptions(
|
|
16457
|
+
list.map((t2) => ({
|
|
16458
|
+
id: t2.template_id || t2.id || "",
|
|
16459
|
+
name: t2.name || t2.template_id || t2.id || ""
|
|
16460
|
+
}))
|
|
16461
|
+
);
|
|
16462
|
+
}
|
|
16463
|
+
} catch {
|
|
16464
|
+
if (!cancelled) setSlideTemplateOptions([]);
|
|
16465
|
+
}
|
|
16466
|
+
})();
|
|
16467
|
+
return () => {
|
|
16468
|
+
cancelled = true;
|
|
16469
|
+
};
|
|
16470
|
+
}, [reviewStatus, slideTemplateOptions, templatesUrl, authToken]);
|
|
16441
16471
|
const updateScale = (0, import_react78.useCallback)(() => {
|
|
16442
16472
|
if (previewRef.current) setPreviewScale(previewRef.current.offsetWidth / 1280);
|
|
16443
16473
|
}, []);
|
|
@@ -16697,6 +16727,41 @@ var PresentationJobCard = ({
|
|
|
16697
16727
|
setRowBusyIndex(null);
|
|
16698
16728
|
}
|
|
16699
16729
|
};
|
|
16730
|
+
const setSlideTemplate = async (index, templateId2) => {
|
|
16731
|
+
if (!outline || !Array.isArray(outline.slides) || rowBusyIndex !== null) return;
|
|
16732
|
+
const slides = outline.slides;
|
|
16733
|
+
const previousOutline = outline;
|
|
16734
|
+
const updated = slides.map((s, i) => {
|
|
16735
|
+
if (i !== index) return s;
|
|
16736
|
+
if (!templateId2) {
|
|
16737
|
+
const { template_id: _drop, ...rest } = s;
|
|
16738
|
+
return rest;
|
|
16739
|
+
}
|
|
16740
|
+
return { ...s, template_id: templateId2 };
|
|
16741
|
+
});
|
|
16742
|
+
setOutline({ ...outline, slides: updated });
|
|
16743
|
+
setRowBusyIndex(index);
|
|
16744
|
+
setRowError(null);
|
|
16745
|
+
try {
|
|
16746
|
+
const endpoint = setSlideTemplateUrl || `/api/presentations/${_job_id}/outline/set-slide-template`;
|
|
16747
|
+
const headers = { "Content-Type": "application/json" };
|
|
16748
|
+
if (authToken) headers.Authorization = `Bearer ${authToken}`;
|
|
16749
|
+
const res = await fetch(endpoint, {
|
|
16750
|
+
method: "POST",
|
|
16751
|
+
headers,
|
|
16752
|
+
body: JSON.stringify({ slide_index: index, template_id: templateId2 || null })
|
|
16753
|
+
});
|
|
16754
|
+
if (!res.ok) {
|
|
16755
|
+
const err = await res.json().catch(() => ({}));
|
|
16756
|
+
throw new Error(err.detail || err.error || `Template update failed (${res.status})`);
|
|
16757
|
+
}
|
|
16758
|
+
} catch (e) {
|
|
16759
|
+
setOutline(previousOutline);
|
|
16760
|
+
setRowError(e instanceof Error ? e.message : "Could not update slide's template");
|
|
16761
|
+
} finally {
|
|
16762
|
+
setRowBusyIndex(null);
|
|
16763
|
+
}
|
|
16764
|
+
};
|
|
16700
16765
|
const handleApproveOutline = async () => {
|
|
16701
16766
|
if (!_job_id || approvingOutline) return;
|
|
16702
16767
|
const endpoint = approveOutlineUrl || `/api/presentations/${_job_id}/approve-outline`;
|
|
@@ -16949,6 +17014,20 @@ var PresentationJobCard = ({
|
|
|
16949
17014
|
]
|
|
16950
17015
|
}
|
|
16951
17016
|
),
|
|
17017
|
+
slideTemplateOptions && slideTemplateOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(
|
|
17018
|
+
"select",
|
|
17019
|
+
{
|
|
17020
|
+
value: s.template_id || "",
|
|
17021
|
+
onChange: (e) => setSlideTemplate(i, e.target.value),
|
|
17022
|
+
disabled: rowBusy,
|
|
17023
|
+
title: "Design template for this slide only (default: deck's template)",
|
|
17024
|
+
className: "w-24 flex-shrink-0 bg-zinc-800/60 border border-zinc-700 rounded-lg px-1.5 h-8 text-[10px] text-zinc-300 focus:border-indigo-500 outline-none disabled:opacity-60",
|
|
17025
|
+
children: [
|
|
17026
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("option", { value: "", children: "Deck default" }),
|
|
17027
|
+
slideTemplateOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("option", { value: opt.id, children: opt.name }, opt.id))
|
|
17028
|
+
]
|
|
17029
|
+
}
|
|
17030
|
+
),
|
|
16952
17031
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
16953
17032
|
"input",
|
|
16954
17033
|
{
|