pxengine 0.1.123 → 0.1.125
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 +72 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +72 -16
- package/dist/index.mjs.map +1 -1
- package/dist/registry.json +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -16698,6 +16698,7 @@ var PresentationJobCard = ({
|
|
|
16698
16698
|
iframe.contentWindow.postMessage({ type: command }, "*");
|
|
16699
16699
|
};
|
|
16700
16700
|
const isTerminal = status === "complete" || status === "failed";
|
|
16701
|
+
const building = Boolean(outlineWritePollUrl) || approvingOutline;
|
|
16701
16702
|
const onCompleteRef = (0, import_react79.useRef)(onComplete);
|
|
16702
16703
|
const onFailedRef = (0, import_react79.useRef)(onFailed);
|
|
16703
16704
|
const hasNotifiedRef = (0, import_react79.useRef)(false);
|
|
@@ -16759,6 +16760,23 @@ var PresentationJobCard = ({
|
|
|
16759
16760
|
}
|
|
16760
16761
|
// Transient fetch errors are ignored — the shared loop retries next tick.
|
|
16761
16762
|
);
|
|
16763
|
+
useSharedPoll(
|
|
16764
|
+
{
|
|
16765
|
+
key: building && pollUrl ? pollUrl : null,
|
|
16766
|
+
intervalMs: 2e3,
|
|
16767
|
+
fetcher: async () => {
|
|
16768
|
+
const headers = {};
|
|
16769
|
+
if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
|
|
16770
|
+
const res = await fetch(pollUrl, { headers });
|
|
16771
|
+
if (!res.ok) throw new Error(`poll ${res.status}`);
|
|
16772
|
+
return res.json();
|
|
16773
|
+
},
|
|
16774
|
+
shouldContinue: () => true
|
|
16775
|
+
},
|
|
16776
|
+
(data) => {
|
|
16777
|
+
if (data.progress) setProgress(data.progress);
|
|
16778
|
+
}
|
|
16779
|
+
);
|
|
16762
16780
|
const applyDeckOutput = (0, import_react79.useCallback)((out, opts) => {
|
|
16763
16781
|
if (out.title) setTitle(out.title);
|
|
16764
16782
|
if (out.slide_count !== void 0) setSlideCount(out.slide_count);
|
|
@@ -17053,7 +17071,7 @@ var PresentationJobCard = ({
|
|
|
17053
17071
|
window.open(link, "_blank", "noopener,noreferrer");
|
|
17054
17072
|
}
|
|
17055
17073
|
};
|
|
17056
|
-
|
|
17074
|
+
const renderProgressCard = (headline, subline) => {
|
|
17057
17075
|
const pct = progress?.percentage ?? 0;
|
|
17058
17076
|
const step = progress?.current_step ?? "Starting...";
|
|
17059
17077
|
const details = progress?.details;
|
|
@@ -17096,11 +17114,8 @@ var PresentationJobCard = ({
|
|
|
17096
17114
|
}
|
|
17097
17115
|
),
|
|
17098
17116
|
/* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
17099
|
-
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", style: t.text, children:
|
|
17100
|
-
/* @__PURE__ */ (0, import_jsx_runtime151.
|
|
17101
|
-
slidesTotal > 0 ? `${slidesTotal} slides` : "Presentation",
|
|
17102
|
-
" \xB7 In progress"
|
|
17103
|
-
] })
|
|
17117
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", style: t.text, children: headline }),
|
|
17118
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-xs text-zinc-500 mt-0.5", children: subline })
|
|
17104
17119
|
] })
|
|
17105
17120
|
] }),
|
|
17106
17121
|
/* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "mt-4 space-y-3", children: [
|
|
@@ -17153,6 +17168,13 @@ var PresentationJobCard = ({
|
|
|
17153
17168
|
}
|
|
17154
17169
|
` })
|
|
17155
17170
|
] });
|
|
17171
|
+
};
|
|
17172
|
+
if (status === "pending" || status === "running") {
|
|
17173
|
+
const slidesTotal = progress?.details?.slides_total ?? 0;
|
|
17174
|
+
return renderProgressCard(
|
|
17175
|
+
title || "Creating Presentation",
|
|
17176
|
+
`${slidesTotal > 0 ? `${slidesTotal} slides` : "Presentation"} \xB7 In progress`
|
|
17177
|
+
);
|
|
17156
17178
|
}
|
|
17157
17179
|
if (status === "failed") {
|
|
17158
17180
|
return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "bg-red-950/20 border border-red-800/25 rounded-2xl p-5", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
@@ -17165,7 +17187,12 @@ var PresentationJobCard = ({
|
|
|
17165
17187
|
}
|
|
17166
17188
|
if (status === "complete" && reviewStatus === "pending_outline_approval") {
|
|
17167
17189
|
const slides = Array.isArray(outline?.slides) ? outline.slides : [];
|
|
17168
|
-
|
|
17190
|
+
if (building) {
|
|
17191
|
+
return renderProgressCard(
|
|
17192
|
+
title || "Building your deck",
|
|
17193
|
+
`${slides.length > 0 ? `${slides.length} slides` : "Presentation"} \xB7 Building`
|
|
17194
|
+
);
|
|
17195
|
+
}
|
|
17169
17196
|
return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", style: t.root, children: [
|
|
17170
17197
|
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
17171
17198
|
"div",
|
|
@@ -17821,6 +17848,7 @@ var ResearchReportJobCard = (props) => {
|
|
|
17821
17848
|
const isTerminal = status === "complete" || status === "failed";
|
|
17822
17849
|
const primaryColor = theme?.primary || DEFAULT_THEME.primary;
|
|
17823
17850
|
const hasHTML = Boolean(htmlUrl);
|
|
17851
|
+
const building = Boolean(outlineWritePollUrl) || approvingOutline;
|
|
17824
17852
|
const updateScale = (0, import_react80.useCallback)(() => {
|
|
17825
17853
|
if (previewRef.current) {
|
|
17826
17854
|
setPreviewScale(previewRef.current.offsetWidth / 800);
|
|
@@ -17889,6 +17917,23 @@ var ResearchReportJobCard = (props) => {
|
|
|
17889
17917
|
}
|
|
17890
17918
|
// Transient fetch errors are ignored — the shared loop retries next tick.
|
|
17891
17919
|
);
|
|
17920
|
+
useSharedPoll(
|
|
17921
|
+
{
|
|
17922
|
+
key: building && pollUrl ? pollUrl : null,
|
|
17923
|
+
intervalMs: 2e3,
|
|
17924
|
+
fetcher: async () => {
|
|
17925
|
+
const headers = {};
|
|
17926
|
+
if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
|
|
17927
|
+
const res = await fetch(pollUrl, { headers });
|
|
17928
|
+
if (!res.ok) throw new Error(`poll ${res.status}`);
|
|
17929
|
+
return res.json();
|
|
17930
|
+
},
|
|
17931
|
+
shouldContinue: () => true
|
|
17932
|
+
},
|
|
17933
|
+
(data) => {
|
|
17934
|
+
if (data.progress) setProgress(data.progress);
|
|
17935
|
+
}
|
|
17936
|
+
);
|
|
17892
17937
|
const applyRegeneratedOutput = (0, import_react80.useCallback)(
|
|
17893
17938
|
(out) => {
|
|
17894
17939
|
if (out.html_url) setHtmlUrl(out.html_url);
|
|
@@ -18116,7 +18161,7 @@ var ResearchReportJobCard = (props) => {
|
|
|
18116
18161
|
if (count >= 1e3) return `${(count / 1e3).toFixed(1)}k`;
|
|
18117
18162
|
return count.toString();
|
|
18118
18163
|
};
|
|
18119
|
-
|
|
18164
|
+
const renderProgressCard = (headline, subline) => {
|
|
18120
18165
|
const pct = progress?.percentage ?? 0;
|
|
18121
18166
|
const step = progress?.current_step ?? "Starting...";
|
|
18122
18167
|
const details = progress?.details;
|
|
@@ -18152,12 +18197,8 @@ var ResearchReportJobCard = (props) => {
|
|
|
18152
18197
|
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
18153
18198
|
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "w-10 h-10 rounded-xl bg-[#C0AE82]/10 border border-[#C0AE82]/25 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "text-lg", children: getPhaseIcon() }) }),
|
|
18154
18199
|
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
18155
|
-
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children:
|
|
18156
|
-
/* @__PURE__ */ (0, import_jsx_runtime152.
|
|
18157
|
-
depth && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "capitalize", children: depth }),
|
|
18158
|
-
depth && " \xB7 ",
|
|
18159
|
-
"In progress"
|
|
18160
|
-
] })
|
|
18200
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: headline }),
|
|
18201
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-xs text-zinc-500 mt-0.5", children: subline })
|
|
18161
18202
|
] })
|
|
18162
18203
|
] }),
|
|
18163
18204
|
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "mt-4 space-y-3", children: [
|
|
@@ -18208,6 +18249,16 @@ var ResearchReportJobCard = (props) => {
|
|
|
18208
18249
|
}
|
|
18209
18250
|
` })
|
|
18210
18251
|
] });
|
|
18252
|
+
};
|
|
18253
|
+
if (!status || status === "pending" || status === "running") {
|
|
18254
|
+
return renderProgressCard(
|
|
18255
|
+
title || "Generating Research Report",
|
|
18256
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_jsx_runtime152.Fragment, { children: [
|
|
18257
|
+
depth && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "capitalize", children: depth }),
|
|
18258
|
+
depth && " \xB7 ",
|
|
18259
|
+
"In progress"
|
|
18260
|
+
] })
|
|
18261
|
+
);
|
|
18211
18262
|
}
|
|
18212
18263
|
if (status === "failed") {
|
|
18213
18264
|
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "bg-red-950/20 border border-red-800/25 rounded-2xl p-5", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
@@ -18220,7 +18271,12 @@ var ResearchReportJobCard = (props) => {
|
|
|
18220
18271
|
}
|
|
18221
18272
|
if (status === "complete" && reviewStatus === "pending_outline_approval") {
|
|
18222
18273
|
const sections = Array.isArray(outline?.sections) ? outline.sections : [];
|
|
18223
|
-
|
|
18274
|
+
if (building) {
|
|
18275
|
+
return renderProgressCard(
|
|
18276
|
+
title || "Building your report",
|
|
18277
|
+
`${sections.length > 0 ? `${sections.length} sections` : "Report"} \xB7 Building`
|
|
18278
|
+
);
|
|
18279
|
+
}
|
|
18224
18280
|
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
|
|
18225
18281
|
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
18226
18282
|
"div",
|
|
@@ -18337,7 +18393,7 @@ var ResearchReportJobCard = (props) => {
|
|
|
18337
18393
|
] })
|
|
18338
18394
|
] }) });
|
|
18339
18395
|
}
|
|
18340
|
-
if (status === "complete" && !hasHTML) {
|
|
18396
|
+
if (status === "complete" && !hasHTML && !pdfUrl) {
|
|
18341
18397
|
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
|
|
18342
18398
|
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
18343
18399
|
"div",
|