@primestyleai/tryon 5.10.169 → 5.10.171

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.
@@ -1,17 +1,15 @@
1
1
  import type { FitAreaInfo } from "../types";
2
2
  import type { MeasurementLines } from "../pose-detect";
3
3
  export type GranularFit = "good" | "tight" | "loose" | "a-bit-tight" | "a-bit-loose" | "too-tight" | "too-loose";
4
- /** Compute granular fit label for a single measurement.
5
- * Tolerance buckets (in the chart's unit, half-inch / one-inch / two-inch):
6
- * - "good" : within the chart range ± a tiny float tolerance
7
- * - "a-bit-tight" : up to ½" (1.27 cm) past the upper edge
8
- * - "tight" : ½"–2" past the upper edge
9
- * - "too-tight" : > 2" past the upper edge
10
- * Mirror buckets on the loose side. The previous logic let anything
11
- * within ±1" of the range count as "perfect", so a 1.2" oversize
12
- * showed as "a bit tight" under the new thresholds it correctly
13
- * reads as "tight". This also tightens the match-percent score, since
14
- * fewer rows now fall in the good/a-bit buckets. */
4
+ /** Compute granular fit label for a single measurement. Mirrors the
5
+ * backend deterministic engine's edge-based thresholds so the FIT
6
+ * DIRECTIVES the SDK ships to /tryon match what the user reads in the
7
+ * table:
8
+ * - "good" : in chart range OR within ½" / 1.27 cm of nearest edge
9
+ * - "a-bit-X" : ½"–1" past the edge
10
+ * - "X" : 1"–2" past the edge
11
+ * - "too-X" : > 2" past the edge
12
+ * Where X is tight (over upper edge) or loose (under lower edge). */
15
13
  export declare function computeFit(userValue: number, chartRange: string, unit?: "in" | "cm" | "mm"): GranularFit;
16
14
  /**
17
15
  * Build FitAreaInfo[] from matchDetails + optional pose coordinates.
@@ -10098,14 +10098,15 @@ function parseNum(s) {
10098
10098
  function computeFit(userValue, chartRange, unit) {
10099
10099
  const { min: rMin, max: rMax } = parseRange(chartRange);
10100
10100
  if (rMin === 0 && rMax === 0) return "good";
10101
- const perfectTol = unit === "cm" ? 0.25 : unit === "mm" ? 2.5 : 0.1;
10102
- const aBitTol = unit === "cm" ? 1.27 : unit === "mm" ? 12.7 : 0.5;
10101
+ const perfectTol = unit === "cm" ? 1.27 : unit === "mm" ? 12.7 : 0.5;
10102
+ const aBitTol = unit === "cm" ? 2.54 : unit === "mm" ? 25.4 : 1;
10103
10103
  const tooFarTol = unit === "cm" ? 5.08 : unit === "mm" ? 50.8 : 2;
10104
- if (userValue >= rMin - perfectTol && userValue <= rMax + perfectTol) return "good";
10104
+ const inRange = userValue >= rMin && userValue <= rMax;
10105
+ const overEdge = inRange ? 0 : userValue > rMax ? userValue - rMax : rMin - userValue;
10106
+ if (inRange || overEdge <= perfectTol) return "good";
10105
10107
  const isUnder = userValue < rMin;
10106
- const diff = isUnder ? rMin - userValue : userValue - rMax;
10107
- if (diff > tooFarTol) return isUnder ? "too-loose" : "too-tight";
10108
- if (diff > aBitTol) return isUnder ? "loose" : "tight";
10108
+ if (overEdge > tooFarTol) return isUnder ? "too-loose" : "too-tight";
10109
+ if (overEdge > aBitTol) return isUnder ? "loose" : "tight";
10109
10110
  return isUnder ? "a-bit-loose" : "a-bit-tight";
10110
10111
  }
10111
10112
  const AREA_TO_POSE_KEY = {
@@ -23539,7 +23540,6 @@ function CreateProfileWizard({ onSave, onCancel, apiUrl, apiKey, onPhotoPreview,
23539
23540
  }
23540
23541
  await minHold;
23541
23542
  setEstimating(false);
23542
- setImageStep("name-photo");
23543
23543
  return;
23544
23544
  }
23545
23545
  if (imageStep === "details") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.10.169",
3
+ "version": "5.10.171",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",