@primestyleai/tryon 5.10.141 → 5.10.143

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.
@@ -19263,20 +19263,13 @@ function MobileScanningView({
19263
19263
  const img = e.currentTarget;
19264
19264
  setDims({ w: img.naturalWidth || img.offsetWidth, h: img.naturalHeight || img.offsetHeight });
19265
19265
  };
19266
- const TOTAL_MS = 6e3;
19267
- const LAST_HOLD_MS = 1e3;
19268
- const startRef = reactExports.useRef(Date.now());
19266
+ const STAGE_DWELL_MS = 1800;
19269
19267
  const [stageIdx, setStageIdx] = reactExports.useState(0);
19270
19268
  reactExports.useEffect(() => {
19271
- const stepMs = (TOTAL_MS - LAST_HOLD_MS) / Math.max(1, stages.length - 1);
19272
- const id2 = setInterval(() => {
19273
- const elapsed = Date.now() - startRef.current;
19274
- const idx = Math.min(stages.length - 1, Math.floor(elapsed / stepMs));
19275
- setStageIdx((prev) => prev === idx ? prev : idx);
19276
- if (idx >= stages.length - 1) clearInterval(id2);
19277
- }, 100);
19278
- return () => clearInterval(id2);
19279
- }, [stages.length]);
19269
+ if (stageIdx >= stages.length - 1) return;
19270
+ const id2 = setTimeout(() => setStageIdx((i) => Math.min(stages.length - 1, i + 1)), STAGE_DWELL_MS);
19271
+ return () => clearTimeout(id2);
19272
+ }, [stageIdx, stages.length]);
19280
19273
  reactExports.useEffect(() => {
19281
19274
  if (isPhotoMode && bodyLandmarks && stageIdx === 0) {
19282
19275
  setStageIdx(1);
@@ -19894,7 +19887,7 @@ function MeasurementOverlay({ lines, fitRows, show, imgWidth, imgHeight }) {
19894
19887
  const curvePath = `M ${x1} ${cy} Q ${midX} ${cy + curveDepth} ${x2} ${cy}`;
19895
19888
  const lineLen = width * 1.05;
19896
19889
  const labelText = fitRow ? fitRow.fit === "good" ? "✓ Fit" : fitRow.isLength ? fitRow.fit.includes("short") || fitRow.fit.includes("tight") ? "Short" : "Long" : fitRow.fit.includes("tight") ? "Tight" : "Loose" : label;
19897
- const labelFont = Math.round(14 * scale);
19890
+ const labelFont = Math.max(14, Math.round(22 * scale));
19898
19891
  const labelWidthEst = labelText.length * labelFont * 0.62;
19899
19892
  const rightSpace = W2 - x2 - 12 * scale;
19900
19893
  const flipLeft = rightSpace < labelWidthEst;
@@ -29114,7 +29107,7 @@ function PrimeStyleTryonInner({
29114
29107
  const jointCount = lmObj ? Object.keys(lmObj).filter((k2) => k2 !== "imageWidth" && k2 !== "imageHeight" && lmObj[k2]).length : 0;
29115
29108
  console.log(`[ps-sdk:debug] payload → bodyLandmarks=${!!lmObj}(${jointCount} joints)`);
29116
29109
  }
29117
- const minVisible = new Promise((r2) => setTimeout(r2, 6e3));
29110
+ const minVisible = new Promise((r2) => setTimeout(r2, 2e3));
29118
29111
  try {
29119
29112
  const tReq = Date.now();
29120
29113
  const payloadBytes = JSON.stringify(payload).length;
@@ -29349,18 +29342,18 @@ function PrimeStyleTryonInner({
29349
29342
  }
29350
29343
  }, [selectedFile, productImage, productTitle, sizingResult, onProcessing, onError, handleVtoUpdate]);
29351
29344
  reactExports.useEffect(() => {
29352
- if (!sizingResult) {
29345
+ if (view !== "size-result") {
29353
29346
  autoTryOnFiredRef.current = false;
29354
29347
  return;
29355
29348
  }
29356
- if (sizingResult.found === false) return;
29357
29349
  if (noFitFoundRef.current) return;
29358
29350
  if (autoTryOnFiredRef.current) return;
29359
29351
  if (tryOnProcessing || resultImageUrl) return;
29360
- if (!selectedFile && !selectedFileRef.current) return;
29352
+ const file = selectedFile || selectedFileRef.current;
29353
+ if (!file) return;
29361
29354
  autoTryOnFiredRef.current = true;
29362
29355
  handleTryOnSubmit();
29363
- }, [sizingResult, tryOnProcessing, resultImageUrl, selectedFile, handleTryOnSubmit]);
29356
+ }, [view, selectedFile, tryOnProcessing, resultImageUrl, handleTryOnSubmit]);
29364
29357
  const handleDownload = reactExports.useCallback(() => {
29365
29358
  if (!resultImageUrl) return;
29366
29359
  if (resultImageUrl.startsWith("data:")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.10.141",
3
+ "version": "5.10.143",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",