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.mjs CHANGED
@@ -16366,6 +16366,7 @@ var PresentationJobCard = ({
16366
16366
  iframe.contentWindow.postMessage({ type: command }, "*");
16367
16367
  };
16368
16368
  const isTerminal = status === "complete" || status === "failed";
16369
+ const building = Boolean(outlineWritePollUrl) || approvingOutline;
16369
16370
  const onCompleteRef = useRef8(onComplete);
16370
16371
  const onFailedRef = useRef8(onFailed);
16371
16372
  const hasNotifiedRef = useRef8(false);
@@ -16427,6 +16428,23 @@ var PresentationJobCard = ({
16427
16428
  }
16428
16429
  // Transient fetch errors are ignored — the shared loop retries next tick.
16429
16430
  );
16431
+ useSharedPoll(
16432
+ {
16433
+ key: building && pollUrl ? pollUrl : null,
16434
+ intervalMs: 2e3,
16435
+ fetcher: async () => {
16436
+ const headers = {};
16437
+ if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
16438
+ const res = await fetch(pollUrl, { headers });
16439
+ if (!res.ok) throw new Error(`poll ${res.status}`);
16440
+ return res.json();
16441
+ },
16442
+ shouldContinue: () => true
16443
+ },
16444
+ (data) => {
16445
+ if (data.progress) setProgress(data.progress);
16446
+ }
16447
+ );
16430
16448
  const applyDeckOutput = useCallback4((out, opts) => {
16431
16449
  if (out.title) setTitle(out.title);
16432
16450
  if (out.slide_count !== void 0) setSlideCount(out.slide_count);
@@ -16721,7 +16739,7 @@ var PresentationJobCard = ({
16721
16739
  window.open(link, "_blank", "noopener,noreferrer");
16722
16740
  }
16723
16741
  };
16724
- if (status === "pending" || status === "running") {
16742
+ const renderProgressCard = (headline, subline) => {
16725
16743
  const pct = progress?.percentage ?? 0;
16726
16744
  const step = progress?.current_step ?? "Starting...";
16727
16745
  const details = progress?.details;
@@ -16764,11 +16782,8 @@ var PresentationJobCard = ({
16764
16782
  }
16765
16783
  ),
16766
16784
  /* @__PURE__ */ jsxs109("div", { className: "flex-1 min-w-0", children: [
16767
- /* @__PURE__ */ jsx151("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", style: t.text, children: title || "Creating Presentation" }),
16768
- /* @__PURE__ */ jsxs109("p", { className: "text-xs text-zinc-500 mt-0.5", children: [
16769
- slidesTotal > 0 ? `${slidesTotal} slides` : "Presentation",
16770
- " \xB7 In progress"
16771
- ] })
16785
+ /* @__PURE__ */ jsx151("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", style: t.text, children: headline }),
16786
+ /* @__PURE__ */ jsx151("p", { className: "text-xs text-zinc-500 mt-0.5", children: subline })
16772
16787
  ] })
16773
16788
  ] }),
16774
16789
  /* @__PURE__ */ jsxs109("div", { className: "mt-4 space-y-3", children: [
@@ -16821,6 +16836,13 @@ var PresentationJobCard = ({
16821
16836
  }
16822
16837
  ` })
16823
16838
  ] });
16839
+ };
16840
+ if (status === "pending" || status === "running") {
16841
+ const slidesTotal = progress?.details?.slides_total ?? 0;
16842
+ return renderProgressCard(
16843
+ title || "Creating Presentation",
16844
+ `${slidesTotal > 0 ? `${slidesTotal} slides` : "Presentation"} \xB7 In progress`
16845
+ );
16824
16846
  }
16825
16847
  if (status === "failed") {
16826
16848
  return /* @__PURE__ */ jsx151("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsx151("div", { className: "bg-red-950/20 border border-red-800/25 rounded-2xl p-5", children: /* @__PURE__ */ jsxs109("div", { className: "flex items-start gap-3", children: [
@@ -16833,7 +16855,12 @@ var PresentationJobCard = ({
16833
16855
  }
16834
16856
  if (status === "complete" && reviewStatus === "pending_outline_approval") {
16835
16857
  const slides = Array.isArray(outline?.slides) ? outline.slides : [];
16836
- const building = Boolean(outlineWritePollUrl) || approvingOutline;
16858
+ if (building) {
16859
+ return renderProgressCard(
16860
+ title || "Building your deck",
16861
+ `${slides.length > 0 ? `${slides.length} slides` : "Presentation"} \xB7 Building`
16862
+ );
16863
+ }
16837
16864
  return /* @__PURE__ */ jsx151("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsxs109("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", style: t.root, children: [
16838
16865
  /* @__PURE__ */ jsx151(
16839
16866
  "div",
@@ -17489,6 +17516,7 @@ var ResearchReportJobCard = (props) => {
17489
17516
  const isTerminal = status === "complete" || status === "failed";
17490
17517
  const primaryColor = theme?.primary || DEFAULT_THEME.primary;
17491
17518
  const hasHTML = Boolean(htmlUrl);
17519
+ const building = Boolean(outlineWritePollUrl) || approvingOutline;
17492
17520
  const updateScale = useCallback5(() => {
17493
17521
  if (previewRef.current) {
17494
17522
  setPreviewScale(previewRef.current.offsetWidth / 800);
@@ -17557,6 +17585,23 @@ var ResearchReportJobCard = (props) => {
17557
17585
  }
17558
17586
  // Transient fetch errors are ignored — the shared loop retries next tick.
17559
17587
  );
17588
+ useSharedPoll(
17589
+ {
17590
+ key: building && pollUrl ? pollUrl : null,
17591
+ intervalMs: 2e3,
17592
+ fetcher: async () => {
17593
+ const headers = {};
17594
+ if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
17595
+ const res = await fetch(pollUrl, { headers });
17596
+ if (!res.ok) throw new Error(`poll ${res.status}`);
17597
+ return res.json();
17598
+ },
17599
+ shouldContinue: () => true
17600
+ },
17601
+ (data) => {
17602
+ if (data.progress) setProgress(data.progress);
17603
+ }
17604
+ );
17560
17605
  const applyRegeneratedOutput = useCallback5(
17561
17606
  (out) => {
17562
17607
  if (out.html_url) setHtmlUrl(out.html_url);
@@ -17784,7 +17829,7 @@ var ResearchReportJobCard = (props) => {
17784
17829
  if (count >= 1e3) return `${(count / 1e3).toFixed(1)}k`;
17785
17830
  return count.toString();
17786
17831
  };
17787
- if (!status || status === "pending" || status === "running") {
17832
+ const renderProgressCard = (headline, subline) => {
17788
17833
  const pct = progress?.percentage ?? 0;
17789
17834
  const step = progress?.current_step ?? "Starting...";
17790
17835
  const details = progress?.details;
@@ -17820,12 +17865,8 @@ var ResearchReportJobCard = (props) => {
17820
17865
  /* @__PURE__ */ jsxs110("div", { className: "flex items-start gap-3", children: [
17821
17866
  /* @__PURE__ */ jsx152("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__ */ jsx152("span", { className: "text-lg", children: getPhaseIcon() }) }),
17822
17867
  /* @__PURE__ */ jsxs110("div", { className: "flex-1 min-w-0", children: [
17823
- /* @__PURE__ */ jsx152("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: title || "Generating Research Report" }),
17824
- /* @__PURE__ */ jsxs110("p", { className: "text-xs text-zinc-500 mt-0.5", children: [
17825
- depth && /* @__PURE__ */ jsx152("span", { className: "capitalize", children: depth }),
17826
- depth && " \xB7 ",
17827
- "In progress"
17828
- ] })
17868
+ /* @__PURE__ */ jsx152("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: headline }),
17869
+ /* @__PURE__ */ jsx152("p", { className: "text-xs text-zinc-500 mt-0.5", children: subline })
17829
17870
  ] })
17830
17871
  ] }),
17831
17872
  /* @__PURE__ */ jsxs110("div", { className: "mt-4 space-y-3", children: [
@@ -17876,6 +17917,16 @@ var ResearchReportJobCard = (props) => {
17876
17917
  }
17877
17918
  ` })
17878
17919
  ] });
17920
+ };
17921
+ if (!status || status === "pending" || status === "running") {
17922
+ return renderProgressCard(
17923
+ title || "Generating Research Report",
17924
+ /* @__PURE__ */ jsxs110(Fragment6, { children: [
17925
+ depth && /* @__PURE__ */ jsx152("span", { className: "capitalize", children: depth }),
17926
+ depth && " \xB7 ",
17927
+ "In progress"
17928
+ ] })
17929
+ );
17879
17930
  }
17880
17931
  if (status === "failed") {
17881
17932
  return /* @__PURE__ */ jsx152("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsx152("div", { className: "bg-red-950/20 border border-red-800/25 rounded-2xl p-5", children: /* @__PURE__ */ jsxs110("div", { className: "flex items-start gap-3", children: [
@@ -17888,7 +17939,12 @@ var ResearchReportJobCard = (props) => {
17888
17939
  }
17889
17940
  if (status === "complete" && reviewStatus === "pending_outline_approval") {
17890
17941
  const sections = Array.isArray(outline?.sections) ? outline.sections : [];
17891
- const building = Boolean(outlineWritePollUrl) || approvingOutline;
17942
+ if (building) {
17943
+ return renderProgressCard(
17944
+ title || "Building your report",
17945
+ `${sections.length > 0 ? `${sections.length} sections` : "Report"} \xB7 Building`
17946
+ );
17947
+ }
17892
17948
  return /* @__PURE__ */ jsx152("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsxs110("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
17893
17949
  /* @__PURE__ */ jsx152(
17894
17950
  "div",
@@ -18005,7 +18061,7 @@ var ResearchReportJobCard = (props) => {
18005
18061
  ] })
18006
18062
  ] }) });
18007
18063
  }
18008
- if (status === "complete" && !hasHTML) {
18064
+ if (status === "complete" && !hasHTML && !pdfUrl) {
18009
18065
  return /* @__PURE__ */ jsx152("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsxs110("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
18010
18066
  /* @__PURE__ */ jsx152(
18011
18067
  "div",