pxengine 0.1.135 → 0.1.136
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 +331 -253
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -1
- package/dist/index.d.ts +43 -1
- package/dist/index.mjs +169 -97
- package/dist/index.mjs.map +1 -1
- package/dist/registry.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -15787,10 +15787,11 @@ var NextStepCard = ({
|
|
|
15787
15787
|
};
|
|
15788
15788
|
|
|
15789
15789
|
// src/molecules/generic/PresentationJobCard/PresentationJobCard.tsx
|
|
15790
|
-
import { useCallback as useCallback4, useEffect as
|
|
15790
|
+
import { useCallback as useCallback4, useEffect as useEffect8, useLayoutEffect as useLayoutEffect2, useRef as useRef10, useState as useState10 } from "react";
|
|
15791
15791
|
|
|
15792
15792
|
// src/lib/shared-poll.ts
|
|
15793
15793
|
import { useEffect as useEffect6, useRef as useRef8 } from "react";
|
|
15794
|
+
var SSE_FALLBACK_POLL_MS = 2e4;
|
|
15794
15795
|
var MAX_RETAINED = 50;
|
|
15795
15796
|
var RETAIN_TTL_MS = 30 * 60 * 1e3;
|
|
15796
15797
|
var entries = /* @__PURE__ */ new Map();
|
|
@@ -15917,6 +15918,12 @@ function stopSharedPoll(key) {
|
|
|
15917
15918
|
entry.stopped = true;
|
|
15918
15919
|
clearTimer(entry);
|
|
15919
15920
|
}
|
|
15921
|
+
function refreshSharedPoll(key) {
|
|
15922
|
+
if (!key) return;
|
|
15923
|
+
const entry = entries.get(key);
|
|
15924
|
+
if (!entry || entry.stopped) return;
|
|
15925
|
+
void runPoll(key);
|
|
15926
|
+
}
|
|
15920
15927
|
function getSharedPollLastData(key) {
|
|
15921
15928
|
if (!key) return void 0;
|
|
15922
15929
|
const entry = entries.get(key);
|
|
@@ -15953,6 +15960,45 @@ function useSharedPoll(config, onData, onError) {
|
|
|
15953
15960
|
}, [key, intervalMs]);
|
|
15954
15961
|
}
|
|
15955
15962
|
|
|
15963
|
+
// src/lib/job-signal.ts
|
|
15964
|
+
import { useEffect as useEffect7, useRef as useRef9 } from "react";
|
|
15965
|
+
var JOB_SIGNAL_EVENT = "pxengine:job-signal";
|
|
15966
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
15967
|
+
var windowBridgeInstalled = false;
|
|
15968
|
+
function fanout(jobId) {
|
|
15969
|
+
if (!jobId) return;
|
|
15970
|
+
for (const listener of Array.from(listeners)) {
|
|
15971
|
+
try {
|
|
15972
|
+
listener(jobId);
|
|
15973
|
+
} catch {
|
|
15974
|
+
}
|
|
15975
|
+
}
|
|
15976
|
+
}
|
|
15977
|
+
function ensureWindowBridge() {
|
|
15978
|
+
if (windowBridgeInstalled || typeof window === "undefined") return;
|
|
15979
|
+
windowBridgeInstalled = true;
|
|
15980
|
+
window.addEventListener(JOB_SIGNAL_EVENT, (event) => {
|
|
15981
|
+
const detail = event.detail;
|
|
15982
|
+
const jobId = detail?.jobId;
|
|
15983
|
+
if (typeof jobId === "string" && jobId) fanout(jobId);
|
|
15984
|
+
});
|
|
15985
|
+
}
|
|
15986
|
+
function emitJobSignal(jobId) {
|
|
15987
|
+
fanout(jobId);
|
|
15988
|
+
}
|
|
15989
|
+
function subscribeJobSignal(listener) {
|
|
15990
|
+
ensureWindowBridge();
|
|
15991
|
+
listeners.add(listener);
|
|
15992
|
+
return () => {
|
|
15993
|
+
listeners.delete(listener);
|
|
15994
|
+
};
|
|
15995
|
+
}
|
|
15996
|
+
function useJobSignal(onSignal) {
|
|
15997
|
+
const ref = useRef9(onSignal);
|
|
15998
|
+
ref.current = onSignal;
|
|
15999
|
+
useEffect7(() => subscribeJobSignal((jobId) => ref.current(jobId)), []);
|
|
16000
|
+
}
|
|
16001
|
+
|
|
15956
16002
|
// src/molecules/generic/job-card-shared/Chip.tsx
|
|
15957
16003
|
import { jsx as jsx148 } from "react/jsx-runtime";
|
|
15958
16004
|
var Chip = ({
|
|
@@ -16046,7 +16092,7 @@ function formatTemplateLabel(templateId) {
|
|
|
16046
16092
|
}
|
|
16047
16093
|
var DECK_CANVAS = { w: 1280, h: 720 };
|
|
16048
16094
|
function useDeckFitScale(canvasW = DECK_CANVAS.w, canvasH = DECK_CANVAS.h) {
|
|
16049
|
-
const containerRef =
|
|
16095
|
+
const containerRef = useRef10(null);
|
|
16050
16096
|
const [scale, setScale] = useState10(1);
|
|
16051
16097
|
useLayoutEffect2(() => {
|
|
16052
16098
|
const el = containerRef.current;
|
|
@@ -16181,9 +16227,9 @@ var ExportModal = ({ formats, title, onClose }) => {
|
|
|
16181
16227
|
var FullscreenModal = ({ url, title, slideCount, initialSlide = 1, onClose }) => {
|
|
16182
16228
|
const [currentSlide, setCurrentSlide] = useState10(initialSlide);
|
|
16183
16229
|
const [iframeReady, setIframeReady] = useState10(false);
|
|
16184
|
-
const iframeRef =
|
|
16230
|
+
const iframeRef = useRef10(null);
|
|
16185
16231
|
const { containerRef, scale, canvasW, canvasH } = useDeckFitScale();
|
|
16186
|
-
|
|
16232
|
+
useEffect8(() => {
|
|
16187
16233
|
const onKey = (e) => {
|
|
16188
16234
|
if (e.key === "Escape") onClose();
|
|
16189
16235
|
};
|
|
@@ -16201,7 +16247,7 @@ var FullscreenModal = ({ url, title, slideCount, initialSlide = 1, onClose }) =>
|
|
|
16201
16247
|
window.removeEventListener("message", onMsg);
|
|
16202
16248
|
};
|
|
16203
16249
|
}, [onClose, iframeReady]);
|
|
16204
|
-
|
|
16250
|
+
useEffect8(() => {
|
|
16205
16251
|
document.body.style.overflow = "hidden";
|
|
16206
16252
|
return () => {
|
|
16207
16253
|
document.body.style.overflow = "";
|
|
@@ -16355,46 +16401,46 @@ var PresentationJobCard = ({
|
|
|
16355
16401
|
const [regenPollUrl, setRegenPollUrl] = useState10(null);
|
|
16356
16402
|
const [currentSlide, setCurrentSlide] = useState10(1);
|
|
16357
16403
|
const [iframeReady, setIframeReady] = useState10(false);
|
|
16358
|
-
const iframeRef =
|
|
16404
|
+
const iframeRef = useRef10(null);
|
|
16359
16405
|
const { containerRef: previewFitRef, scale: previewScale, canvasW, canvasH } = useDeckFitScale();
|
|
16360
|
-
|
|
16406
|
+
useEffect8(() => {
|
|
16361
16407
|
setStatus(initialStatus);
|
|
16362
16408
|
}, [initialStatus]);
|
|
16363
16409
|
const progressPct = initialProgress?.percentage;
|
|
16364
16410
|
const progressStep = initialProgress?.current_step;
|
|
16365
|
-
|
|
16411
|
+
useEffect8(() => {
|
|
16366
16412
|
if (initialProgress) setProgress(initialProgress);
|
|
16367
16413
|
}, [progressPct, progressStep]);
|
|
16368
|
-
|
|
16414
|
+
useEffect8(() => {
|
|
16369
16415
|
if (initialError) setError(initialError);
|
|
16370
16416
|
}, [initialError]);
|
|
16371
|
-
|
|
16417
|
+
useEffect8(() => {
|
|
16372
16418
|
if (initialSlideCount !== void 0) setSlideCount(initialSlideCount);
|
|
16373
16419
|
}, [initialSlideCount]);
|
|
16374
16420
|
const htmlUrl = initialFormats?.html_url;
|
|
16375
|
-
|
|
16421
|
+
useEffect8(() => {
|
|
16376
16422
|
if (initialFormats) setFormats(initialFormats);
|
|
16377
16423
|
}, [htmlUrl]);
|
|
16378
|
-
|
|
16424
|
+
useEffect8(() => {
|
|
16379
16425
|
if (initialTitle) setTitle(initialTitle);
|
|
16380
16426
|
}, [initialTitle]);
|
|
16381
|
-
|
|
16427
|
+
useEffect8(() => {
|
|
16382
16428
|
if (initialGenerationMode) setGenerationMode(initialGenerationMode);
|
|
16383
16429
|
}, [initialGenerationMode]);
|
|
16384
|
-
|
|
16430
|
+
useEffect8(() => {
|
|
16385
16431
|
if (initialTemplateId) setTemplateId(initialTemplateId);
|
|
16386
16432
|
}, [initialTemplateId]);
|
|
16387
|
-
|
|
16433
|
+
useEffect8(() => {
|
|
16388
16434
|
if (initialTemplateVersionId) setTemplateVersionId(initialTemplateVersionId);
|
|
16389
16435
|
}, [initialTemplateVersionId]);
|
|
16390
|
-
|
|
16436
|
+
useEffect8(() => {
|
|
16391
16437
|
if (initialReviewStatus) setReviewStatus(initialReviewStatus);
|
|
16392
16438
|
}, [initialReviewStatus]);
|
|
16393
16439
|
const initialOutlineSlideCount = initialOutline?.slides?.length;
|
|
16394
|
-
|
|
16440
|
+
useEffect8(() => {
|
|
16395
16441
|
if (initialOutline) setOutline(initialOutline);
|
|
16396
16442
|
}, [initialOutlineSlideCount]);
|
|
16397
|
-
|
|
16443
|
+
useEffect8(() => {
|
|
16398
16444
|
if (reviewStatus !== "pending_outline_approval" || slideTemplateOptions !== null) return;
|
|
16399
16445
|
let cancelled = false;
|
|
16400
16446
|
(async () => {
|
|
@@ -16421,10 +16467,10 @@ var PresentationJobCard = ({
|
|
|
16421
16467
|
cancelled = true;
|
|
16422
16468
|
};
|
|
16423
16469
|
}, [reviewStatus, slideTemplateOptions, templatesUrl, authToken]);
|
|
16424
|
-
|
|
16470
|
+
useEffect8(() => {
|
|
16425
16471
|
setIframeReady(false);
|
|
16426
16472
|
}, [formats.html_url]);
|
|
16427
|
-
|
|
16473
|
+
useEffect8(() => {
|
|
16428
16474
|
const handler = (e) => {
|
|
16429
16475
|
if (e.data?.type === "slideChanged") {
|
|
16430
16476
|
setCurrentSlide(e.data.slide);
|
|
@@ -16450,15 +16496,15 @@ var PresentationJobCard = ({
|
|
|
16450
16496
|
};
|
|
16451
16497
|
const isTerminal = status === "complete" || status === "failed";
|
|
16452
16498
|
const building = Boolean(outlineWritePollUrl) || approvingOutline;
|
|
16453
|
-
const onCompleteRef =
|
|
16454
|
-
const onFailedRef =
|
|
16455
|
-
const hasNotifiedRef =
|
|
16499
|
+
const onCompleteRef = useRef10(onComplete);
|
|
16500
|
+
const onFailedRef = useRef10(onFailed);
|
|
16501
|
+
const hasNotifiedRef = useRef10(false);
|
|
16456
16502
|
onCompleteRef.current = onComplete;
|
|
16457
16503
|
onFailedRef.current = onFailed;
|
|
16458
16504
|
useSharedPoll(
|
|
16459
16505
|
{
|
|
16460
16506
|
key: !isTerminal && pollUrl ? pollUrl : null,
|
|
16461
|
-
intervalMs:
|
|
16507
|
+
intervalMs: SSE_FALLBACK_POLL_MS,
|
|
16462
16508
|
fetcher: async () => {
|
|
16463
16509
|
const headers = {};
|
|
16464
16510
|
if (authToken) {
|
|
@@ -16518,7 +16564,7 @@ var PresentationJobCard = ({
|
|
|
16518
16564
|
useSharedPoll(
|
|
16519
16565
|
{
|
|
16520
16566
|
key: building && pollUrl ? pollUrl : null,
|
|
16521
|
-
intervalMs:
|
|
16567
|
+
intervalMs: SSE_FALLBACK_POLL_MS,
|
|
16522
16568
|
fetcher: async () => {
|
|
16523
16569
|
const headers = {};
|
|
16524
16570
|
if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
|
|
@@ -16568,7 +16614,7 @@ var PresentationJobCard = ({
|
|
|
16568
16614
|
useSharedPoll(
|
|
16569
16615
|
{
|
|
16570
16616
|
key: outlineWritePollUrl,
|
|
16571
|
-
intervalMs:
|
|
16617
|
+
intervalMs: SSE_FALLBACK_POLL_MS,
|
|
16572
16618
|
fetcher: async () => {
|
|
16573
16619
|
const headers = {};
|
|
16574
16620
|
if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
|
|
@@ -16593,7 +16639,7 @@ var PresentationJobCard = ({
|
|
|
16593
16639
|
useSharedPoll(
|
|
16594
16640
|
{
|
|
16595
16641
|
key: regenPollUrl,
|
|
16596
|
-
intervalMs:
|
|
16642
|
+
intervalMs: SSE_FALLBACK_POLL_MS,
|
|
16597
16643
|
fetcher: async () => {
|
|
16598
16644
|
const headers = {};
|
|
16599
16645
|
if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
|
|
@@ -16615,6 +16661,16 @@ var PresentationJobCard = ({
|
|
|
16615
16661
|
}
|
|
16616
16662
|
}
|
|
16617
16663
|
);
|
|
16664
|
+
useJobSignal(
|
|
16665
|
+
useCallback4(
|
|
16666
|
+
(completedJobId) => {
|
|
16667
|
+
for (const url of [pollUrl, outlineWritePollUrl, regenPollUrl]) {
|
|
16668
|
+
if (url && url.includes(completedJobId)) refreshSharedPoll(url);
|
|
16669
|
+
}
|
|
16670
|
+
},
|
|
16671
|
+
[pollUrl, outlineWritePollUrl, regenPollUrl]
|
|
16672
|
+
)
|
|
16673
|
+
);
|
|
16618
16674
|
const buildEditedOutline = () => {
|
|
16619
16675
|
if (!outline || !Array.isArray(outline.slides)) return void 0;
|
|
16620
16676
|
let changed = false;
|
|
@@ -17307,7 +17363,7 @@ var PresentationJobCard = ({
|
|
|
17307
17363
|
};
|
|
17308
17364
|
|
|
17309
17365
|
// src/molecules/generic/ResearchReportJobCard/ResearchReportJobCard.tsx
|
|
17310
|
-
import { useCallback as useCallback5, useEffect as
|
|
17366
|
+
import { useCallback as useCallback5, useEffect as useEffect9, useRef as useRef11, useState as useState11 } from "react";
|
|
17311
17367
|
import { Fragment as Fragment6, jsx as jsx152, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
17312
17368
|
var DEFAULT_THEME = {
|
|
17313
17369
|
primary: "#C0AE82",
|
|
@@ -17343,14 +17399,14 @@ function withPdfViewerParams(url) {
|
|
|
17343
17399
|
return `${url}#toolbar=0&navpanes=0&scrollbar=0`;
|
|
17344
17400
|
}
|
|
17345
17401
|
var FullscreenPreviewModal = ({ url, title, onClose, isPdf }) => {
|
|
17346
|
-
|
|
17402
|
+
useEffect9(() => {
|
|
17347
17403
|
const onKey = (e) => {
|
|
17348
17404
|
if (e.key === "Escape") onClose();
|
|
17349
17405
|
};
|
|
17350
17406
|
document.addEventListener("keydown", onKey);
|
|
17351
17407
|
return () => document.removeEventListener("keydown", onKey);
|
|
17352
17408
|
}, [onClose]);
|
|
17353
|
-
|
|
17409
|
+
useEffect9(() => {
|
|
17354
17410
|
document.body.style.overflow = "hidden";
|
|
17355
17411
|
return () => {
|
|
17356
17412
|
document.body.style.overflow = "";
|
|
@@ -17408,7 +17464,7 @@ var ReportExportModal = ({ htmlUrl, pdfUrl, title, onClose }) => {
|
|
|
17408
17464
|
const available = REPORT_FORMATS.filter((f) => urls[f.key]);
|
|
17409
17465
|
const filename = (title ?? "").replace(/[^a-z0-9]/gi, "-").toLowerCase();
|
|
17410
17466
|
const [downloadingKey, setDownloadingKey] = useState11(null);
|
|
17411
|
-
|
|
17467
|
+
useEffect9(() => {
|
|
17412
17468
|
const onKey = (e) => {
|
|
17413
17469
|
if (e.key === "Escape") onClose();
|
|
17414
17470
|
};
|
|
@@ -17554,62 +17610,62 @@ var ResearchReportJobCard = (props) => {
|
|
|
17554
17610
|
const [rowError, setRowError] = useState11(null);
|
|
17555
17611
|
const [outlineWritePollUrl, setOutlineWritePollUrl] = useState11(null);
|
|
17556
17612
|
const [regenPollUrl, setRegenPollUrl] = useState11(null);
|
|
17557
|
-
const onCompleteRef =
|
|
17558
|
-
const onFailedRef =
|
|
17559
|
-
const hasNotifiedRef =
|
|
17613
|
+
const onCompleteRef = useRef11(onComplete);
|
|
17614
|
+
const onFailedRef = useRef11(onFailed);
|
|
17615
|
+
const hasNotifiedRef = useRef11(false);
|
|
17560
17616
|
onCompleteRef.current = onComplete;
|
|
17561
17617
|
onFailedRef.current = onFailed;
|
|
17562
|
-
|
|
17618
|
+
useEffect9(() => {
|
|
17563
17619
|
const newStatus = initialStatus ?? (initialHtmlUrl ? "complete" : void 0);
|
|
17564
17620
|
setStatus(newStatus);
|
|
17565
17621
|
}, [initialStatus, initialHtmlUrl]);
|
|
17566
|
-
|
|
17622
|
+
useEffect9(() => {
|
|
17567
17623
|
if (initialTitle) setTitle(initialTitle);
|
|
17568
17624
|
}, [initialTitle]);
|
|
17569
|
-
|
|
17625
|
+
useEffect9(() => {
|
|
17570
17626
|
if (initialHtmlUrl) setHtmlUrl(initialHtmlUrl);
|
|
17571
17627
|
}, [initialHtmlUrl]);
|
|
17572
|
-
|
|
17628
|
+
useEffect9(() => {
|
|
17573
17629
|
if (initialGenerationMode) setGenerationMode(initialGenerationMode);
|
|
17574
17630
|
}, [initialGenerationMode]);
|
|
17575
|
-
|
|
17631
|
+
useEffect9(() => {
|
|
17576
17632
|
if (initialTemplateId) setTemplateId(initialTemplateId);
|
|
17577
17633
|
}, [initialTemplateId]);
|
|
17578
|
-
|
|
17634
|
+
useEffect9(() => {
|
|
17579
17635
|
if (initialTemplateVersionId) setTemplateVersionId(initialTemplateVersionId);
|
|
17580
17636
|
}, [initialTemplateVersionId]);
|
|
17581
|
-
|
|
17637
|
+
useEffect9(() => {
|
|
17582
17638
|
if (initialReviewStatus) setReviewStatus(initialReviewStatus);
|
|
17583
17639
|
}, [initialReviewStatus]);
|
|
17584
17640
|
const initialOutlineSectionCount = initialOutline?.sections?.length;
|
|
17585
|
-
|
|
17641
|
+
useEffect9(() => {
|
|
17586
17642
|
if (initialOutline) setOutline(initialOutline);
|
|
17587
17643
|
}, [initialOutlineSectionCount]);
|
|
17588
|
-
|
|
17644
|
+
useEffect9(() => {
|
|
17589
17645
|
if (initialDepth) setDepth(initialDepth);
|
|
17590
17646
|
}, [initialDepth]);
|
|
17591
|
-
|
|
17647
|
+
useEffect9(() => {
|
|
17592
17648
|
if (initialSectionCount !== void 0) setSectionCount(initialSectionCount);
|
|
17593
17649
|
}, [initialSectionCount]);
|
|
17594
|
-
|
|
17650
|
+
useEffect9(() => {
|
|
17595
17651
|
if (initialSourceCount !== void 0) setSourceCount(initialSourceCount);
|
|
17596
17652
|
}, [initialSourceCount]);
|
|
17597
|
-
|
|
17653
|
+
useEffect9(() => {
|
|
17598
17654
|
if (initialWordCount !== void 0) setWordCount(initialWordCount);
|
|
17599
17655
|
}, [initialWordCount]);
|
|
17600
|
-
|
|
17656
|
+
useEffect9(() => {
|
|
17601
17657
|
if (initialSummary) setSummary(initialSummary);
|
|
17602
17658
|
}, [initialSummary]);
|
|
17603
17659
|
const themePrimary = initialTheme?.primary;
|
|
17604
|
-
|
|
17660
|
+
useEffect9(() => {
|
|
17605
17661
|
if (initialTheme) setTheme(initialTheme);
|
|
17606
17662
|
}, [themePrimary]);
|
|
17607
|
-
|
|
17663
|
+
useEffect9(() => {
|
|
17608
17664
|
if (initialError) setError(initialError);
|
|
17609
17665
|
}, [initialError]);
|
|
17610
17666
|
const progressPct = initialProgress?.percentage;
|
|
17611
17667
|
const progressStep = initialProgress?.current_step;
|
|
17612
|
-
|
|
17668
|
+
useEffect9(() => {
|
|
17613
17669
|
if (initialProgress) setProgress(initialProgress);
|
|
17614
17670
|
}, [progressPct, progressStep]);
|
|
17615
17671
|
const isTerminal = status === "complete" || status === "failed";
|
|
@@ -17619,7 +17675,7 @@ var ResearchReportJobCard = (props) => {
|
|
|
17619
17675
|
useSharedPoll(
|
|
17620
17676
|
{
|
|
17621
17677
|
key: !isTerminal && pollUrl ? pollUrl : null,
|
|
17622
|
-
intervalMs:
|
|
17678
|
+
intervalMs: SSE_FALLBACK_POLL_MS,
|
|
17623
17679
|
fetcher: async () => {
|
|
17624
17680
|
const headers = {};
|
|
17625
17681
|
if (authToken) {
|
|
@@ -17675,7 +17731,7 @@ var ResearchReportJobCard = (props) => {
|
|
|
17675
17731
|
useSharedPoll(
|
|
17676
17732
|
{
|
|
17677
17733
|
key: building && pollUrl ? pollUrl : null,
|
|
17678
|
-
intervalMs:
|
|
17734
|
+
intervalMs: SSE_FALLBACK_POLL_MS,
|
|
17679
17735
|
fetcher: async () => {
|
|
17680
17736
|
const headers = {};
|
|
17681
17737
|
if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
|
|
@@ -17722,7 +17778,7 @@ var ResearchReportJobCard = (props) => {
|
|
|
17722
17778
|
useSharedPoll(
|
|
17723
17779
|
{
|
|
17724
17780
|
key: regenPollUrl,
|
|
17725
|
-
intervalMs:
|
|
17781
|
+
intervalMs: SSE_FALLBACK_POLL_MS,
|
|
17726
17782
|
fetcher: async () => {
|
|
17727
17783
|
const headers = {};
|
|
17728
17784
|
if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
|
|
@@ -17777,7 +17833,7 @@ var ResearchReportJobCard = (props) => {
|
|
|
17777
17833
|
useSharedPoll(
|
|
17778
17834
|
{
|
|
17779
17835
|
key: outlineWritePollUrl,
|
|
17780
|
-
intervalMs:
|
|
17836
|
+
intervalMs: SSE_FALLBACK_POLL_MS,
|
|
17781
17837
|
fetcher: async () => {
|
|
17782
17838
|
const headers = {};
|
|
17783
17839
|
if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
|
|
@@ -17799,6 +17855,16 @@ var ResearchReportJobCard = (props) => {
|
|
|
17799
17855
|
}
|
|
17800
17856
|
}
|
|
17801
17857
|
);
|
|
17858
|
+
useJobSignal(
|
|
17859
|
+
useCallback5(
|
|
17860
|
+
(completedJobId) => {
|
|
17861
|
+
for (const url of [pollUrl, outlineWritePollUrl, regenPollUrl]) {
|
|
17862
|
+
if (url && url.includes(completedJobId)) refreshSharedPoll(url);
|
|
17863
|
+
}
|
|
17864
|
+
},
|
|
17865
|
+
[pollUrl, outlineWritePollUrl, regenPollUrl]
|
|
17866
|
+
)
|
|
17867
|
+
);
|
|
17802
17868
|
const buildEditedOutline = () => {
|
|
17803
17869
|
if (!outline || !Array.isArray(outline.sections)) return void 0;
|
|
17804
17870
|
let changed = false;
|
|
@@ -18472,7 +18538,7 @@ var ResearchReportJobCard = (props) => {
|
|
|
18472
18538
|
};
|
|
18473
18539
|
|
|
18474
18540
|
// src/molecules/generic/WebSearchJobCard/WebSearchJobCard.tsx
|
|
18475
|
-
import { useEffect as
|
|
18541
|
+
import { useEffect as useEffect10, useRef as useRef12, useState as useState12 } from "react";
|
|
18476
18542
|
import { jsx as jsx153, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
18477
18543
|
var SearchIcon = () => /* @__PURE__ */ jsxs111("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
18478
18544
|
/* @__PURE__ */ jsx153("circle", { cx: "11", cy: "11", r: "8" }),
|
|
@@ -18509,38 +18575,38 @@ var WebSearchJobCard = ({
|
|
|
18509
18575
|
const [results, setResults] = useState12(initialResults || []);
|
|
18510
18576
|
const [error, setError] = useState12(initialError);
|
|
18511
18577
|
const [progress, setProgress] = useState12(initialProgress);
|
|
18512
|
-
const onCompleteRef =
|
|
18513
|
-
const onFailedRef =
|
|
18514
|
-
const hasNotifiedRef =
|
|
18578
|
+
const onCompleteRef = useRef12(onComplete);
|
|
18579
|
+
const onFailedRef = useRef12(onFailed);
|
|
18580
|
+
const hasNotifiedRef = useRef12(false);
|
|
18515
18581
|
onCompleteRef.current = onComplete;
|
|
18516
18582
|
onFailedRef.current = onFailed;
|
|
18517
|
-
|
|
18583
|
+
useEffect10(() => {
|
|
18518
18584
|
setStatus(initialStatus);
|
|
18519
18585
|
}, [initialStatus]);
|
|
18520
|
-
|
|
18586
|
+
useEffect10(() => {
|
|
18521
18587
|
if (initialQuery) setQuery(initialQuery);
|
|
18522
18588
|
}, [initialQuery]);
|
|
18523
|
-
|
|
18589
|
+
useEffect10(() => {
|
|
18524
18590
|
if (initialTitle && !initialQuery) setQuery(initialTitle);
|
|
18525
18591
|
}, [initialTitle, initialQuery]);
|
|
18526
|
-
|
|
18592
|
+
useEffect10(() => {
|
|
18527
18593
|
if (initialResultCount !== void 0) setResultCount(initialResultCount);
|
|
18528
18594
|
}, [initialResultCount]);
|
|
18529
|
-
|
|
18595
|
+
useEffect10(() => {
|
|
18530
18596
|
if (initialSearchCount !== void 0) setSearchCount(initialSearchCount);
|
|
18531
18597
|
}, [initialSearchCount]);
|
|
18532
|
-
|
|
18598
|
+
useEffect10(() => {
|
|
18533
18599
|
if (initialSummary) setSummary(initialSummary);
|
|
18534
18600
|
}, [initialSummary]);
|
|
18535
|
-
|
|
18601
|
+
useEffect10(() => {
|
|
18536
18602
|
if (initialResults) setResults(initialResults);
|
|
18537
18603
|
}, [initialResults]);
|
|
18538
|
-
|
|
18604
|
+
useEffect10(() => {
|
|
18539
18605
|
if (initialError) setError(initialError);
|
|
18540
18606
|
}, [initialError]);
|
|
18541
18607
|
const progressPct = initialProgress?.percentage;
|
|
18542
18608
|
const progressStep = initialProgress?.current_step;
|
|
18543
|
-
|
|
18609
|
+
useEffect10(() => {
|
|
18544
18610
|
if (initialProgress) setProgress(initialProgress);
|
|
18545
18611
|
}, [progressPct, progressStep]);
|
|
18546
18612
|
const isTerminal = status === "complete" || status === "failed";
|
|
@@ -18728,7 +18794,7 @@ var WebSearchJobCard = ({
|
|
|
18728
18794
|
import React112, { useMemo as useMemo6 } from "react";
|
|
18729
18795
|
|
|
18730
18796
|
// src/molecules/creator-discovery/SearchSpecCard/CustomFieldRenderers.tsx
|
|
18731
|
-
import { useState as useState13, useRef as
|
|
18797
|
+
import { useState as useState13, useRef as useRef13, useEffect as useEffect11, useMemo as useMemo5 } from "react";
|
|
18732
18798
|
|
|
18733
18799
|
// src/lib/countries.ts
|
|
18734
18800
|
var countries = [
|
|
@@ -18942,8 +19008,8 @@ var CountrySelectEdit = ({
|
|
|
18942
19008
|
}) => {
|
|
18943
19009
|
const [isDropdownOpen, setIsDropdownOpen] = useState13(false);
|
|
18944
19010
|
const [searchTerm, setSearchTerm] = useState13("");
|
|
18945
|
-
const dropdownRef =
|
|
18946
|
-
|
|
19011
|
+
const dropdownRef = useRef13(null);
|
|
19012
|
+
useEffect11(() => {
|
|
18947
19013
|
const handleClickOutside = (event) => {
|
|
18948
19014
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
18949
19015
|
setIsDropdownOpen(false);
|
|
@@ -21012,11 +21078,11 @@ CampaignConceptCard.displayName = "CampaignConceptCard";
|
|
|
21012
21078
|
import { useCallback as useCallback9, useState as useState22, memo } from "react";
|
|
21013
21079
|
|
|
21014
21080
|
// src/molecules/creator-discovery/CreatorWidget/CreatorImageList.tsx
|
|
21015
|
-
import { useEffect as
|
|
21081
|
+
import { useEffect as useEffect12, useState as useState15 } from "react";
|
|
21016
21082
|
import { Fragment as Fragment7, jsx as jsx170, jsxs as jsxs127 } from "react/jsx-runtime";
|
|
21017
21083
|
function useMediaQuery(query) {
|
|
21018
21084
|
const [matches, setMatches] = useState15(false);
|
|
21019
|
-
|
|
21085
|
+
useEffect12(() => {
|
|
21020
21086
|
const media = window.matchMedia(query);
|
|
21021
21087
|
const listener = () => setMatches(media.matches);
|
|
21022
21088
|
listener();
|
|
@@ -21099,7 +21165,7 @@ function CreatorImageList({
|
|
|
21099
21165
|
}
|
|
21100
21166
|
|
|
21101
21167
|
// src/molecules/creator-discovery/CreatorWidget/CreatorProgressBar.tsx
|
|
21102
|
-
import { useEffect as
|
|
21168
|
+
import { useEffect as useEffect13, useState as useState16 } from "react";
|
|
21103
21169
|
import { motion as motion2, AnimatePresence as AnimatePresence2 } from "framer-motion";
|
|
21104
21170
|
import { jsx as jsx171, jsxs as jsxs128 } from "react/jsx-runtime";
|
|
21105
21171
|
function truncateName(name, maxLength) {
|
|
@@ -21108,7 +21174,7 @@ function truncateName(name, maxLength) {
|
|
|
21108
21174
|
}
|
|
21109
21175
|
function ProgressBar({ overallPercentage }) {
|
|
21110
21176
|
const [showTooltip, setShowTooltip] = useState16(true);
|
|
21111
|
-
|
|
21177
|
+
useEffect13(() => {
|
|
21112
21178
|
if (overallPercentage && overallPercentage >= 100) {
|
|
21113
21179
|
setShowTooltip(false);
|
|
21114
21180
|
}
|
|
@@ -21269,7 +21335,7 @@ function CreatorCompactView({
|
|
|
21269
21335
|
}
|
|
21270
21336
|
|
|
21271
21337
|
// src/molecules/creator-discovery/CreatorWidget/CreatorExpandedPanel.tsx
|
|
21272
|
-
import { useState as useState20, useEffect as
|
|
21338
|
+
import { useState as useState20, useEffect as useEffect15, useCallback as useCallback7 } from "react";
|
|
21273
21339
|
import ReactDOM2 from "react-dom";
|
|
21274
21340
|
import { AnimatePresence as AnimatePresence4, motion as motion5 } from "framer-motion";
|
|
21275
21341
|
|
|
@@ -22230,7 +22296,7 @@ function BrandCollaborationsList({
|
|
|
22230
22296
|
}
|
|
22231
22297
|
|
|
22232
22298
|
// src/molecules/creator-discovery/CreatorWidget/CreatorGridView.tsx
|
|
22233
|
-
import { useState as useState19, useMemo as useMemo10, useRef as
|
|
22299
|
+
import { useState as useState19, useMemo as useMemo10, useRef as useRef14, useCallback as useCallback6, useEffect as useEffect14 } from "react";
|
|
22234
22300
|
import { motion as motion4 } from "framer-motion";
|
|
22235
22301
|
import { jsx as jsx179, jsxs as jsxs135 } from "react/jsx-runtime";
|
|
22236
22302
|
var formatFollowerCount3 = (count) => {
|
|
@@ -22282,17 +22348,17 @@ function CreatorGridViewCard({ creator }) {
|
|
|
22282
22348
|
const [isExpanded, setIsExpanded] = useState19(false);
|
|
22283
22349
|
const [showFullDescription, setShowFullDescription] = useState19(false);
|
|
22284
22350
|
const [isDescriptionOverflowing, setIsDescriptionOverflowing] = useState19(false);
|
|
22285
|
-
const descriptionRef =
|
|
22286
|
-
const cardRef =
|
|
22351
|
+
const descriptionRef = useRef14(null);
|
|
22352
|
+
const cardRef = useRef14(null);
|
|
22287
22353
|
const checkDescriptionOverflow = useCallback6(() => {
|
|
22288
22354
|
const el = descriptionRef.current;
|
|
22289
22355
|
if (!el) return;
|
|
22290
22356
|
setIsDescriptionOverflowing(el.scrollHeight > el.clientHeight + 1);
|
|
22291
22357
|
}, []);
|
|
22292
|
-
|
|
22358
|
+
useEffect14(() => {
|
|
22293
22359
|
checkDescriptionOverflow();
|
|
22294
22360
|
}, [checkDescriptionOverflow, isExpanded, showFullDescription]);
|
|
22295
|
-
|
|
22361
|
+
useEffect14(() => {
|
|
22296
22362
|
const onResize = () => checkDescriptionOverflow();
|
|
22297
22363
|
window.addEventListener("resize", onResize);
|
|
22298
22364
|
return () => window.removeEventListener("resize", onResize);
|
|
@@ -22984,7 +23050,7 @@ function CreatorExpandedPanel({
|
|
|
22984
23050
|
setLoading(false);
|
|
22985
23051
|
}
|
|
22986
23052
|
}, [creatorIds, sessionId, version, fetcher]);
|
|
22987
|
-
|
|
23053
|
+
useEffect15(() => {
|
|
22988
23054
|
if (isOpen && creatorIds.length > 0) {
|
|
22989
23055
|
loadCreators();
|
|
22990
23056
|
}
|
|
@@ -23038,7 +23104,7 @@ function CreatorExpandedPanel({
|
|
|
23038
23104
|
}
|
|
23039
23105
|
|
|
23040
23106
|
// src/molecules/creator-discovery/CreatorWidget/useCreatorWidgetPolling.ts
|
|
23041
|
-
import { useState as useState21, useEffect as
|
|
23107
|
+
import { useState as useState21, useEffect as useEffect16, useCallback as useCallback8, useMemo as useMemo11, useRef as useRef15 } from "react";
|
|
23042
23108
|
var DEFAULT_POLLING_CONFIG = {
|
|
23043
23109
|
pollInterval: 5e3,
|
|
23044
23110
|
maxDuration: 15 * 60 * 1e3,
|
|
@@ -23116,9 +23182,9 @@ function useCreatorWidgetPolling({
|
|
|
23116
23182
|
const [loadingStatus, setLoadingStatus] = useState21(
|
|
23117
23183
|
!(hydrated.versionData && hydratedTerminal)
|
|
23118
23184
|
);
|
|
23119
|
-
const remainingTimeRef =
|
|
23120
|
-
const countdownRef =
|
|
23121
|
-
const versionDataRef =
|
|
23185
|
+
const remainingTimeRef = useRef15(0);
|
|
23186
|
+
const countdownRef = useRef15(null);
|
|
23187
|
+
const versionDataRef = useRef15(versionData);
|
|
23122
23188
|
versionDataRef.current = versionData;
|
|
23123
23189
|
const requestedVersion = selectedVersion ?? currentVersion ?? versionData?.currentVersion;
|
|
23124
23190
|
const updateStatus = useCallback8(
|
|
@@ -23159,9 +23225,9 @@ function useCreatorWidgetPolling({
|
|
|
23159
23225
|
);
|
|
23160
23226
|
const activeVersion = selectedVersion ?? requestedVersion;
|
|
23161
23227
|
const statusKey = sessionId && activeVersion != null ? statusPollKey(sessionId, activeVersion) : null;
|
|
23162
|
-
const errorCountRef =
|
|
23163
|
-
const deadlineRef =
|
|
23164
|
-
const doneRef =
|
|
23228
|
+
const errorCountRef = useRef15(0);
|
|
23229
|
+
const deadlineRef = useRef15(0);
|
|
23230
|
+
const doneRef = useRef15(hydratedTerminal);
|
|
23165
23231
|
const stopCountdown = useCallback8(() => {
|
|
23166
23232
|
if (countdownRef.current) {
|
|
23167
23233
|
clearInterval(countdownRef.current);
|
|
@@ -23169,7 +23235,7 @@ function useCreatorWidgetPolling({
|
|
|
23169
23235
|
}
|
|
23170
23236
|
setTimeDisplay("");
|
|
23171
23237
|
}, []);
|
|
23172
|
-
|
|
23238
|
+
useEffect16(() => {
|
|
23173
23239
|
if (statusKey == null) return;
|
|
23174
23240
|
const cached = getSharedPollLastData(statusKey);
|
|
23175
23241
|
const cachedStatus = cached?.status?.status;
|
|
@@ -23359,7 +23425,7 @@ function CreatorWidgetInner({
|
|
|
23359
23425
|
var CreatorWidget = memo(CreatorWidgetInner);
|
|
23360
23426
|
|
|
23361
23427
|
// src/molecules/analytics/AnalyticsChart.tsx
|
|
23362
|
-
import { useEffect as
|
|
23428
|
+
import { useEffect as useEffect17, useMemo as useMemo12, useRef as useRef16, useState as useState23 } from "react";
|
|
23363
23429
|
|
|
23364
23430
|
// src/molecules/analytics/buildOptions.ts
|
|
23365
23431
|
function deepMerge(base, override) {
|
|
@@ -23695,8 +23761,8 @@ function AnalyticsChart({
|
|
|
23695
23761
|
const [fetchedConfig, setFetchedConfig] = useState23(null);
|
|
23696
23762
|
const [fetching, setFetching] = useState23(false);
|
|
23697
23763
|
const [fetchError, setFetchError] = useState23(null);
|
|
23698
|
-
const containerRef =
|
|
23699
|
-
const chartRef =
|
|
23764
|
+
const containerRef = useRef16(null);
|
|
23765
|
+
const chartRef = useRef16(null);
|
|
23700
23766
|
const declarative = useMemo12(
|
|
23701
23767
|
() => resolveDeclarativeConfig({
|
|
23702
23768
|
chartConfig,
|
|
@@ -23737,10 +23803,10 @@ function AnalyticsChart({
|
|
|
23737
23803
|
const options = buildChartOptions(declarative, palette);
|
|
23738
23804
|
return extraOptions ? deepMerge(options, extraOptions) : options;
|
|
23739
23805
|
}, [declarative, theme, mode, extraOptions]);
|
|
23740
|
-
|
|
23806
|
+
useEffect17(() => {
|
|
23741
23807
|
setMounted(true);
|
|
23742
23808
|
}, []);
|
|
23743
|
-
|
|
23809
|
+
useEffect17(() => {
|
|
23744
23810
|
if (!chartId || configProp || builtConfig) return;
|
|
23745
23811
|
let cancelled = false;
|
|
23746
23812
|
setFetching(true);
|
|
@@ -23762,7 +23828,7 @@ function AnalyticsChart({
|
|
|
23762
23828
|
};
|
|
23763
23829
|
}, [chartId, apiBase, authToken, configProp, builtConfig]);
|
|
23764
23830
|
const activeConfig = configProp ?? builtConfig ?? fetchedConfig;
|
|
23765
|
-
|
|
23831
|
+
useEffect17(() => {
|
|
23766
23832
|
if (!mounted || !activeConfig || !containerRef.current) return;
|
|
23767
23833
|
const container = containerRef.current;
|
|
23768
23834
|
let cancelled = false;
|
|
@@ -23782,7 +23848,7 @@ function AnalyticsChart({
|
|
|
23782
23848
|
cancelled = true;
|
|
23783
23849
|
};
|
|
23784
23850
|
}, [mounted, activeConfig]);
|
|
23785
|
-
|
|
23851
|
+
useEffect17(() => {
|
|
23786
23852
|
return () => {
|
|
23787
23853
|
if (chartRef.current) {
|
|
23788
23854
|
try {
|
|
@@ -23793,7 +23859,7 @@ function AnalyticsChart({
|
|
|
23793
23859
|
}
|
|
23794
23860
|
};
|
|
23795
23861
|
}, []);
|
|
23796
|
-
|
|
23862
|
+
useEffect17(() => {
|
|
23797
23863
|
if (!mounted || !containerRef.current) return;
|
|
23798
23864
|
const obs = new ResizeObserver(() => {
|
|
23799
23865
|
try {
|
|
@@ -26069,6 +26135,7 @@ export {
|
|
|
26069
26135
|
InputWidget,
|
|
26070
26136
|
InsightDigestCard,
|
|
26071
26137
|
InsightSummaryCard,
|
|
26138
|
+
JOB_SIGNAL_EVENT,
|
|
26072
26139
|
KPIStatsCard,
|
|
26073
26140
|
KbdAtom,
|
|
26074
26141
|
KeywordBundlesDisplay,
|
|
@@ -26129,6 +26196,7 @@ export {
|
|
|
26129
26196
|
ResizablePanel,
|
|
26130
26197
|
ResizablePanelGroup,
|
|
26131
26198
|
RiskSignalCard,
|
|
26199
|
+
SSE_FALLBACK_POLL_MS,
|
|
26132
26200
|
ScoreBreakdownCard,
|
|
26133
26201
|
ScrollArea,
|
|
26134
26202
|
ScrollAreaAtom,
|
|
@@ -26199,17 +26267,21 @@ export {
|
|
|
26199
26267
|
defaultFetchSelections,
|
|
26200
26268
|
defaultPersistSelection,
|
|
26201
26269
|
elementToQAField,
|
|
26270
|
+
emitJobSignal,
|
|
26202
26271
|
formatQAMessage,
|
|
26203
26272
|
generateFieldsFromData,
|
|
26204
26273
|
generateFieldsFromPropDefinitions,
|
|
26205
26274
|
getPxAuthToken,
|
|
26206
26275
|
isInputAtom,
|
|
26207
26276
|
notifyPxUnauthorized,
|
|
26277
|
+
refreshSharedPoll,
|
|
26208
26278
|
setPxAuthTokenProvider,
|
|
26209
26279
|
setPxUnauthorizedHandler,
|
|
26210
26280
|
submitWidgetToAgent,
|
|
26281
|
+
subscribeJobSignal,
|
|
26211
26282
|
th,
|
|
26212
26283
|
useCreatorWidgetPolling,
|
|
26284
|
+
useJobSignal,
|
|
26213
26285
|
useWidgetTheme,
|
|
26214
26286
|
withAlpha
|
|
26215
26287
|
};
|