pxengine 0.1.77 → 0.1.79

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
@@ -3114,6 +3114,11 @@ interface PresentationFormats {
3114
3114
  pptx_url?: string;
3115
3115
  pdf_url?: string;
3116
3116
  }
3117
+ interface PresentationJobOutput {
3118
+ title: string;
3119
+ slide_count: number;
3120
+ formats: PresentationFormats;
3121
+ }
3117
3122
  interface PresentationJobCardProps {
3118
3123
  job_id: string;
3119
3124
  title: string;
@@ -3128,6 +3133,11 @@ interface PresentationJobCardProps {
3128
3133
  * e.g. /api/agents-proxy/jobs/{job_id}/status
3129
3134
  */
3130
3135
  pollUrl?: string;
3136
+ /**
3137
+ * Bearer token for authenticated polling requests.
3138
+ * If provided, will be sent as Authorization header.
3139
+ */
3140
+ authToken?: string;
3131
3141
  /**
3132
3142
  * Shareable link copied when the user clicks Share.
3133
3143
  * Falls back to formats.html_url if not provided.
@@ -3137,6 +3147,15 @@ interface PresentationJobCardProps {
3137
3147
  className?: string;
3138
3148
  onAction?: (action: string, payload?: any) => void;
3139
3149
  sendMessage?: (message: string) => void;
3150
+ /**
3151
+ * Called when the job completes successfully via polling.
3152
+ * Use this to persist the job result to session state.
3153
+ */
3154
+ onComplete?: (output: PresentationJobOutput) => void;
3155
+ /**
3156
+ * Called when the job fails via polling.
3157
+ */
3158
+ onFailed?: (error: string) => void;
3140
3159
  }
3141
3160
 
3142
3161
  declare const PresentationJobCard: React__default.FC<PresentationJobCardProps>;
package/dist/index.d.ts CHANGED
@@ -3114,6 +3114,11 @@ interface PresentationFormats {
3114
3114
  pptx_url?: string;
3115
3115
  pdf_url?: string;
3116
3116
  }
3117
+ interface PresentationJobOutput {
3118
+ title: string;
3119
+ slide_count: number;
3120
+ formats: PresentationFormats;
3121
+ }
3117
3122
  interface PresentationJobCardProps {
3118
3123
  job_id: string;
3119
3124
  title: string;
@@ -3128,6 +3133,11 @@ interface PresentationJobCardProps {
3128
3133
  * e.g. /api/agents-proxy/jobs/{job_id}/status
3129
3134
  */
3130
3135
  pollUrl?: string;
3136
+ /**
3137
+ * Bearer token for authenticated polling requests.
3138
+ * If provided, will be sent as Authorization header.
3139
+ */
3140
+ authToken?: string;
3131
3141
  /**
3132
3142
  * Shareable link copied when the user clicks Share.
3133
3143
  * Falls back to formats.html_url if not provided.
@@ -3137,6 +3147,15 @@ interface PresentationJobCardProps {
3137
3147
  className?: string;
3138
3148
  onAction?: (action: string, payload?: any) => void;
3139
3149
  sendMessage?: (message: string) => void;
3150
+ /**
3151
+ * Called when the job completes successfully via polling.
3152
+ * Use this to persist the job result to session state.
3153
+ */
3154
+ onComplete?: (output: PresentationJobOutput) => void;
3155
+ /**
3156
+ * Called when the job fails via polling.
3157
+ */
3158
+ onFailed?: (error: string) => void;
3140
3159
  }
3141
3160
 
3142
3161
  declare const PresentationJobCard: React__default.FC<PresentationJobCardProps>;
package/dist/index.mjs CHANGED
@@ -38675,7 +38675,6 @@ var ShareIcon = () => /* @__PURE__ */ jsxs108("svg", { width: "14", height: "14"
38675
38675
  /* @__PURE__ */ jsx147("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
38676
38676
  ] });
38677
38677
  var CheckIcon = () => /* @__PURE__ */ jsx147("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx147("polyline", { points: "20 6 9 17 4 12" }) });
38678
- var Skel = ({ className, style }) => /* @__PURE__ */ jsx147("div", { className: cn("animate-pulse rounded-md bg-zinc-800/60", className), style });
38679
38678
  var FORMATS = [
38680
38679
  {
38681
38680
  key: "pdf_url",
@@ -38845,6 +38844,23 @@ var FullscreenModal = ({ url, title, slideCount, onClose }) => {
38845
38844
  ) })
38846
38845
  ] });
38847
38846
  };
38847
+ var PROCESSING_STAGES = [
38848
+ { minProgress: 0, message: "Initializing..." },
38849
+ { minProgress: 12, message: "Analyzing request..." },
38850
+ { minProgress: 25, message: "Generating content..." },
38851
+ { minProgress: 45, message: "Building slides..." },
38852
+ { minProgress: 65, message: "Applying design..." },
38853
+ { minProgress: 80, message: "Rendering outputs..." },
38854
+ { minProgress: 92, message: "Finalizing..." }
38855
+ ];
38856
+ function getStageMessage(progress) {
38857
+ for (let i = PROCESSING_STAGES.length - 1; i >= 0; i--) {
38858
+ if (progress >= PROCESSING_STAGES[i].minProgress) {
38859
+ return PROCESSING_STAGES[i].message;
38860
+ }
38861
+ }
38862
+ return PROCESSING_STAGES[0].message;
38863
+ }
38848
38864
  var PresentationJobCard = ({
38849
38865
  job_id: _job_id,
38850
38866
  title: initialTitle,
@@ -38853,8 +38869,11 @@ var PresentationJobCard = ({
38853
38869
  formats: initialFormats = {},
38854
38870
  error: initialError,
38855
38871
  pollUrl,
38872
+ authToken,
38856
38873
  shareUrl,
38857
- className
38874
+ className,
38875
+ onComplete,
38876
+ onFailed
38858
38877
  }) => {
38859
38878
  const [status, setStatus] = useState10(initialStatus);
38860
38879
  const [title, setTitle] = useState10(initialTitle);
@@ -38868,9 +38887,40 @@ var PresentationJobCard = ({
38868
38887
  const [previewScale, setPreviewScale] = useState10(1);
38869
38888
  const [iframeReady, setIframeReady] = useState10(false);
38870
38889
  const [pendingSlide, setPendingSlide] = useState10(null);
38890
+ const [progress, setProgress] = useState10(0);
38891
+ const startTimeRef = useRef5(Date.now());
38871
38892
  const intervalRef = useRef5(null);
38893
+ const progressIntervalRef = useRef5(null);
38872
38894
  const previewRef = useRef5(null);
38873
38895
  const iframeRef = useRef5(null);
38896
+ useEffect6(() => {
38897
+ const isLoading = status === "pending" || status === "running";
38898
+ if (!isLoading) {
38899
+ if (progressIntervalRef.current) {
38900
+ clearInterval(progressIntervalRef.current);
38901
+ progressIntervalRef.current = null;
38902
+ }
38903
+ if (status === "complete") setProgress(100);
38904
+ return;
38905
+ }
38906
+ startTimeRef.current = Date.now();
38907
+ progressIntervalRef.current = setInterval(() => {
38908
+ const elapsed = (Date.now() - startTimeRef.current) / 1e3;
38909
+ const estimated = Math.min(90, 90 * (1 - Math.exp(-elapsed / 60)));
38910
+ setProgress((prev) => Math.max(prev, Math.round(estimated)));
38911
+ }, 500);
38912
+ return () => {
38913
+ if (progressIntervalRef.current) {
38914
+ clearInterval(progressIntervalRef.current);
38915
+ progressIntervalRef.current = null;
38916
+ }
38917
+ };
38918
+ }, [status]);
38919
+ useEffect6(() => {
38920
+ if (status === "running") {
38921
+ setProgress((prev) => Math.max(prev, 15));
38922
+ }
38923
+ }, [status]);
38874
38924
  const updateScale = useCallback4(() => {
38875
38925
  if (previewRef.current) setPreviewScale(previewRef.current.offsetWidth / 1280);
38876
38926
  }, []);
@@ -38915,21 +38965,48 @@ var PresentationJobCard = ({
38915
38965
  setPendingSlide(target);
38916
38966
  };
38917
38967
  const isTerminal = status === "complete" || status === "failed";
38968
+ const onCompleteRef = useRef5(onComplete);
38969
+ const onFailedRef = useRef5(onFailed);
38970
+ const hasNotifiedRef = useRef5(false);
38971
+ onCompleteRef.current = onComplete;
38972
+ onFailedRef.current = onFailed;
38918
38973
  useEffect6(() => {
38919
38974
  if (isTerminal || !pollUrl) return;
38920
38975
  const poll = async () => {
38921
38976
  try {
38922
- const res = await fetch(pollUrl);
38977
+ const headers = {};
38978
+ if (authToken) {
38979
+ headers["Authorization"] = `Bearer ${authToken}`;
38980
+ }
38981
+ const res = await fetch(pollUrl, { headers });
38923
38982
  if (!res.ok) return;
38924
38983
  const data = await res.json();
38925
38984
  const newStatus = data.status;
38926
38985
  setStatus(newStatus);
38927
38986
  if (newStatus === "complete" && data.output) {
38928
- if (data.output.title) setTitle(data.output.title);
38929
- if (data.output.slide_count) setSlideCount(data.output.slide_count);
38930
- if (data.output.formats) setFormats(data.output.formats);
38987
+ const newTitle = data.output.title || initialTitle;
38988
+ const newSlideCount = data.output.slide_count || 0;
38989
+ const newFormats = data.output.formats || {};
38990
+ setTitle(newTitle);
38991
+ setSlideCount(newSlideCount);
38992
+ setFormats(newFormats);
38993
+ if (!hasNotifiedRef.current && onCompleteRef.current) {
38994
+ hasNotifiedRef.current = true;
38995
+ onCompleteRef.current({
38996
+ title: newTitle,
38997
+ slide_count: newSlideCount,
38998
+ formats: newFormats
38999
+ });
39000
+ }
39001
+ }
39002
+ if (newStatus === "failed") {
39003
+ const errorMsg = data.error || "Job failed";
39004
+ setError(errorMsg);
39005
+ if (!hasNotifiedRef.current && onFailedRef.current) {
39006
+ hasNotifiedRef.current = true;
39007
+ onFailedRef.current(errorMsg);
39008
+ }
38931
39009
  }
38932
- if (newStatus === "failed" && data.error) setError(data.error);
38933
39010
  } catch {
38934
39011
  }
38935
39012
  };
@@ -38938,7 +39015,7 @@ var PresentationJobCard = ({
38938
39015
  return () => {
38939
39016
  if (intervalRef.current) clearInterval(intervalRef.current);
38940
39017
  };
38941
- }, [isTerminal, pollUrl]);
39018
+ }, [isTerminal, pollUrl, authToken, initialTitle]);
38942
39019
  useEffect6(() => {
38943
39020
  if (isTerminal && intervalRef.current) {
38944
39021
  clearInterval(intervalRef.current);
@@ -38957,18 +39034,45 @@ var PresentationJobCard = ({
38957
39034
  }
38958
39035
  };
38959
39036
  if (status === "pending" || status === "running") {
38960
- return /* @__PURE__ */ jsx147("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsxs108("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl p-5", children: [
38961
- /* @__PURE__ */ jsxs108("div", { className: "flex items-center gap-3 mb-5", children: [
38962
- /* @__PURE__ */ jsx147(Skel, { className: "w-10 h-10 rounded-xl flex-shrink-0" }),
38963
- /* @__PURE__ */ jsxs108("div", { className: "flex-1 space-y-2", children: [
38964
- /* @__PURE__ */ jsx147(Skel, { className: "h-3.5 w-44" }),
38965
- /* @__PURE__ */ jsx147(Skel, { className: "h-3 w-28" })
39037
+ const stageMessage = getStageMessage(progress);
39038
+ return /* @__PURE__ */ jsx147("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsxs108("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
39039
+ /* @__PURE__ */ jsx147("div", { className: "h-1 bg-zinc-800", children: /* @__PURE__ */ jsx147(
39040
+ "div",
39041
+ {
39042
+ className: "h-full bg-gradient-to-r from-indigo-500 via-violet-500 to-purple-500 transition-all duration-500 ease-out",
39043
+ style: { width: `${progress}%` }
39044
+ }
39045
+ ) }),
39046
+ /* @__PURE__ */ jsxs108("div", { className: "p-5", children: [
39047
+ /* @__PURE__ */ jsxs108("div", { className: "flex items-center gap-3 mb-5", children: [
39048
+ /* @__PURE__ */ jsx147("div", { className: "w-10 h-10 rounded-xl bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx147(SlidesIcon, {}) }),
39049
+ /* @__PURE__ */ jsxs108("div", { className: "flex-1 min-w-0", children: [
39050
+ /* @__PURE__ */ jsx147("p", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: title || "Generating presentation..." }),
39051
+ /* @__PURE__ */ jsx147("p", { className: "text-xs text-zinc-500 mt-0.5", children: "Creating slides..." })
39052
+ ] })
39053
+ ] }),
39054
+ /* @__PURE__ */ jsxs108("div", { className: "relative overflow-hidden rounded-xl bg-zinc-900 border border-zinc-800/70 aspect-[16/9]", children: [
39055
+ /* @__PURE__ */ jsx147("div", { className: "absolute inset-0 bg-[radial-gradient(circle_at_14%_16%,rgba(99,102,241,0.12),transparent_30%),radial-gradient(circle_at_86%_84%,rgba(168,85,247,0.10),transparent_28%),linear-gradient(135deg,rgba(30,32,48,0.98),rgba(18,18,24,0.99))]" }),
39056
+ /* @__PURE__ */ jsxs108("div", { className: "absolute inset-0 p-6 flex flex-col justify-center", children: [
39057
+ /* @__PURE__ */ jsx147("div", { className: "h-4 w-48 rounded-full bg-white/10 animate-pulse mb-4" }),
39058
+ /* @__PURE__ */ jsx147("div", { className: "h-3 w-72 rounded-full bg-white/8 animate-pulse mb-3", style: { animationDelay: "100ms" } }),
39059
+ /* @__PURE__ */ jsx147("div", { className: "h-3 w-56 rounded-full bg-white/8 animate-pulse", style: { animationDelay: "200ms" } })
39060
+ ] }),
39061
+ /* @__PURE__ */ jsx147("div", { className: "absolute inset-0 -translate-x-full animate-[shimmer_2s_infinite] bg-gradient-to-r from-transparent via-white/6 to-transparent" })
39062
+ ] }),
39063
+ /* @__PURE__ */ jsxs108("div", { className: "flex items-center justify-between pt-4 border-t border-zinc-800/60", children: [
39064
+ /* @__PURE__ */ jsxs108("div", { className: "flex items-center gap-2.5", children: [
39065
+ /* @__PURE__ */ jsxs108("span", { className: "relative flex h-2 w-2", children: [
39066
+ /* @__PURE__ */ jsx147("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-500 opacity-75" }),
39067
+ /* @__PURE__ */ jsx147("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-indigo-500" })
39068
+ ] }),
39069
+ /* @__PURE__ */ jsx147("span", { className: "text-xs text-indigo-400/80 font-medium", children: stageMessage })
39070
+ ] }),
39071
+ /* @__PURE__ */ jsxs108("span", { className: "text-xs text-zinc-500 tabular-nums font-medium", children: [
39072
+ progress,
39073
+ "%"
39074
+ ] })
38966
39075
  ] })
38967
- ] }),
38968
- /* @__PURE__ */ jsx147("div", { className: "grid grid-cols-3 gap-3", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx147(Skel, { className: "aspect-video rounded-lg", style: { animationDelay: `${i * 150}ms` } }, i)) }),
38969
- /* @__PURE__ */ jsxs108("div", { className: "flex items-center gap-2.5 mt-4 pt-4 border-t border-zinc-800/60", children: [
38970
- /* @__PURE__ */ jsx147("span", { className: "w-2 h-2 rounded-full bg-indigo-500 animate-pulse flex-shrink-0" }),
38971
- /* @__PURE__ */ jsx147(Skel, { className: "h-3 w-36" })
38972
39076
  ] })
38973
39077
  ] }) });
38974
39078
  }
@@ -45371,11 +45475,14 @@ var PXEngineRenderer = ({
45371
45475
  props = {},
45372
45476
  children = [],
45373
45477
  id,
45478
+ key: _extractedKey,
45479
+ // Extract key to prevent React warning about spreading key prop
45374
45480
  ...remainingProps
45375
45481
  } = component;
45376
45482
  const componentName = name || type || componentType;
45377
45483
  if (!componentName || typeof componentName !== "string") return null;
45378
45484
  const rawProps = { ...remainingProps, ...props };
45485
+ delete rawProps.key;
45379
45486
  if (disabled !== void 0 && rawProps.disabled === void 0) {
45380
45487
  rawProps.disabled = disabled;
45381
45488
  }