pxengine 0.1.114 → 0.1.115

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.d.cts CHANGED
@@ -3725,6 +3725,8 @@ interface ResearchReportJobCardProps {
3725
3725
  key_findings?: string[];
3726
3726
  /** HTML report URL */
3727
3727
  html_url?: string;
3728
+ /** PDF export URL (paginated print export; may be absent if PDF rendering failed) */
3729
+ pdf_url?: string;
3728
3730
  /** How the report was generated: template (default) or legacy */
3729
3731
  generation_mode?: "template" | "legacy" | string;
3730
3732
  /** Built-in template id used to render the report */
@@ -3795,6 +3797,7 @@ interface ResearchReportJobOutput {
3795
3797
  key_findings?: string[];
3796
3798
  theme?: ReportTheme;
3797
3799
  html_url?: string;
3800
+ pdf_url?: string;
3798
3801
  generation_mode?: string;
3799
3802
  template_id?: string;
3800
3803
  template_version_id?: string;
package/dist/index.d.ts CHANGED
@@ -3725,6 +3725,8 @@ interface ResearchReportJobCardProps {
3725
3725
  key_findings?: string[];
3726
3726
  /** HTML report URL */
3727
3727
  html_url?: string;
3728
+ /** PDF export URL (paginated print export; may be absent if PDF rendering failed) */
3729
+ pdf_url?: string;
3728
3730
  /** How the report was generated: template (default) or legacy */
3729
3731
  generation_mode?: "template" | "legacy" | string;
3730
3732
  /** Built-in template id used to render the report */
@@ -3795,6 +3797,7 @@ interface ResearchReportJobOutput {
3795
3797
  key_findings?: string[];
3796
3798
  theme?: ReportTheme;
3797
3799
  html_url?: string;
3800
+ pdf_url?: string;
3798
3801
  generation_mode?: string;
3799
3802
  template_id?: string;
3800
3803
  template_version_id?: string;
package/dist/index.mjs CHANGED
@@ -16868,6 +16868,7 @@ var ResearchReportJobCard = (props) => {
16868
16868
  executive_summary: initialSummary,
16869
16869
  key_findings: _initialFindings,
16870
16870
  html_url: initialHtmlUrl,
16871
+ pdf_url: initialPdfUrl,
16871
16872
  generation_mode: initialGenerationMode,
16872
16873
  template_id: initialTemplateId,
16873
16874
  template_version_id: initialTemplateVersionId,
@@ -16897,6 +16898,7 @@ var ResearchReportJobCard = (props) => {
16897
16898
  const [wordCount, setWordCount] = useState11(initialWordCount ?? 0);
16898
16899
  const [summary, setSummary] = useState11(initialSummary || "");
16899
16900
  const [htmlUrl, setHtmlUrl] = useState11(initialHtmlUrl || "");
16901
+ const [pdfUrl, setPdfUrl] = useState11(initialPdfUrl || "");
16900
16902
  const [generationMode, setGenerationMode] = useState11(
16901
16903
  initialGenerationMode || (initialHtmlUrl ? "template" : "")
16902
16904
  );
@@ -17024,6 +17026,7 @@ var ResearchReportJobCard = (props) => {
17024
17026
  setWordCount(output.word_count || 0);
17025
17027
  setSummary(output.executive_summary || "");
17026
17028
  setHtmlUrl(output.html_url || "");
17029
+ setPdfUrl(output.pdf_url || "");
17027
17030
  if (output.generation_mode) setGenerationMode(output.generation_mode);
17028
17031
  if (output.template_id) setTemplateId(output.template_id);
17029
17032
  if (output.template_version_id) setTemplateVersionId(output.template_version_id);
@@ -17051,6 +17054,7 @@ var ResearchReportJobCard = (props) => {
17051
17054
  const applyRegeneratedOutput = useCallback5(
17052
17055
  (out) => {
17053
17056
  if (out.html_url) setHtmlUrl(out.html_url);
17057
+ setPdfUrl(out.pdf_url || "");
17054
17058
  if (out.template_id) setTemplateId(out.template_id);
17055
17059
  setReviewStatus("pending_review");
17056
17060
  setTemplateVersionId("");
@@ -17067,6 +17071,7 @@ var ResearchReportJobCard = (props) => {
17067
17071
  word_count: out.word_count ?? wordCount,
17068
17072
  executive_summary: out.executive_summary ?? summary,
17069
17073
  html_url: out.html_url ?? htmlUrl,
17074
+ pdf_url: out.pdf_url ?? pdfUrl,
17070
17075
  generation_mode: "template",
17071
17076
  template_id: out.template_id ?? templateId,
17072
17077
  template_version_id: void 0,
@@ -17074,7 +17079,7 @@ var ResearchReportJobCard = (props) => {
17074
17079
  theme: out.theme ?? theme
17075
17080
  });
17076
17081
  },
17077
- [title, depth, sectionCount, sourceCount, wordCount, summary, htmlUrl, templateId, theme]
17082
+ [title, depth, sectionCount, sourceCount, wordCount, summary, htmlUrl, pdfUrl, templateId, theme]
17078
17083
  );
17079
17084
  useSharedPoll(
17080
17085
  {
@@ -17118,6 +17123,7 @@ var ResearchReportJobCard = (props) => {
17118
17123
  if (out.word_count !== void 0) setWordCount(out.word_count);
17119
17124
  if (out.executive_summary) setSummary(out.executive_summary);
17120
17125
  if (out.html_url) setHtmlUrl(out.html_url);
17126
+ setPdfUrl(out.pdf_url || "");
17121
17127
  if (out.generation_mode) setGenerationMode(out.generation_mode);
17122
17128
  if (out.template_id) setTemplateId(out.template_id);
17123
17129
  setTemplateVersionId(out.template_version_id || "");
@@ -17403,6 +17409,26 @@ var ResearchReportJobCard = (props) => {
17403
17409
  window.open(htmlUrl, "_blank", "noopener,noreferrer");
17404
17410
  }
17405
17411
  };
17412
+ const handleDownloadPdf = async () => {
17413
+ if (!pdfUrl) return;
17414
+ const filename = `${(title ?? "").replace(/[^a-z0-9]/gi, "-").toLowerCase()}.pdf`;
17415
+ const href = `/api/download?url=${encodeURIComponent(pdfUrl)}&filename=${encodeURIComponent(filename)}`;
17416
+ try {
17417
+ const response = await fetch(href);
17418
+ if (!response.ok) throw new Error(`status ${response.status}`);
17419
+ const blob = await response.blob();
17420
+ const objectUrl = window.URL.createObjectURL(blob);
17421
+ const anchor = document.createElement("a");
17422
+ anchor.href = objectUrl;
17423
+ anchor.download = filename;
17424
+ document.body.appendChild(anchor);
17425
+ anchor.click();
17426
+ anchor.remove();
17427
+ window.URL.revokeObjectURL(objectUrl);
17428
+ } catch {
17429
+ window.open(pdfUrl, "_blank", "noopener,noreferrer");
17430
+ }
17431
+ };
17406
17432
  const resolveShareLink = () => {
17407
17433
  if (shareUrl) return shareUrl;
17408
17434
  if (typeof window !== "undefined" && job_id) {
@@ -17455,6 +17481,7 @@ var ResearchReportJobCard = (props) => {
17455
17481
  word_count: wordCount,
17456
17482
  executive_summary: summary,
17457
17483
  html_url: htmlUrl,
17484
+ pdf_url: pdfUrl,
17458
17485
  generation_mode: generationMode,
17459
17486
  template_id: data.template_id || templateId,
17460
17487
  template_version_id: data.template_version_id || templateVersionId,
@@ -17592,6 +17619,18 @@ var ResearchReportJobCard = (props) => {
17592
17619
  ]
17593
17620
  }
17594
17621
  ),
17622
+ pdfUrl && /* @__PURE__ */ jsxs109(
17623
+ "button",
17624
+ {
17625
+ onClick: handleDownloadPdf,
17626
+ title: "Download PDF",
17627
+ className: "flex items-center gap-1.5 px-2.5 h-7 rounded-lg border border-zinc-700 bg-zinc-800 hover:border-zinc-500 text-zinc-400 hover:text-zinc-200 text-xs font-medium transition-colors",
17628
+ children: [
17629
+ /* @__PURE__ */ jsx148(DownloadIcon2, {}),
17630
+ /* @__PURE__ */ jsx148("span", { children: "PDF" })
17631
+ ]
17632
+ }
17633
+ ),
17595
17634
  /* @__PURE__ */ jsxs109(
17596
17635
  "button",
17597
17636
  {