@primestyleai/tryon 5.8.55 → 5.8.57

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.
@@ -7821,6 +7821,7 @@ function SkeletonOverlay({ landmarks, imgWidth, imgHeight }) {
7821
7821
  SKELETON_CONNECTIONS.map(([a, b], i) => {
7822
7822
  const pa = landmarks[a];
7823
7823
  const pb = landmarks[b];
7824
+ if (!pa || !pb || typeof pa !== "object" || typeof pb !== "object" || typeof pa.x !== "number" || typeof pa.y !== "number" || typeof pb.x !== "number" || typeof pb.y !== "number") return null;
7824
7825
  return /* @__PURE__ */ jsx(
7825
7826
  "line",
7826
7827
  {
@@ -7837,7 +7838,7 @@ function SkeletonOverlay({ landmarks, imgWidth, imgHeight }) {
7837
7838
  `l-${i}`
7838
7839
  );
7839
7840
  }),
7840
- Object.entries(landmarks).map(([key, v], i) => /* @__PURE__ */ jsxs("g", { children: [
7841
+ Object.entries(landmarks).filter(([, v]) => v && typeof v === "object" && typeof v.x === "number" && typeof v.y === "number").map(([key, v], i) => /* @__PURE__ */ jsxs("g", { children: [
7841
7842
  /* @__PURE__ */ jsx(
7842
7843
  "circle",
7843
7844
  {
@@ -7881,6 +7882,7 @@ function MeasurementOverlay({ lines, fitRows, show, imgWidth, imgHeight }) {
7881
7882
  const strokeW = Math.max(5, 3 * scale);
7882
7883
  const dotR = Math.max(7, 5 * scale);
7883
7884
  return /* @__PURE__ */ jsx("svg", { className: "ps-tryon-pose-overlay", viewBox: `0 0 ${W} ${H}`, preserveAspectRatio: "xMidYMid meet", children: areas.map(({ key, line, label }, i) => {
7885
+ if (!line || typeof line.x1 !== "number" || typeof line.x2 !== "number" || typeof line.y !== "number") return null;
7884
7886
  const x1 = line.x1 * W;
7885
7887
  const x2 = line.x2 * W;
7886
7888
  const cy = line.y * H;
@@ -8236,10 +8238,17 @@ function SectionDetailView({
8236
8238
  }
8237
8239
  const range = rMax - rMin;
8238
8240
  const threshold = range > 0 ? range * 0.5 : rMin * 0.05 || 3;
8241
+ const measLower = m.measurement.toLowerCase();
8242
+ const isDirectional = /length|inseam|sleeve|hem|rise/.test(measLower);
8239
8243
  let fit;
8240
8244
  const tol = Math.max((rMax || rMin) * 0.03, 0.5);
8241
- if (userNum >= rMin - tol && userNum <= rMax + tol) fit = "good";
8242
- else if (userNum < rMin) {
8245
+ if (userNum >= rMin - tol && userNum <= rMax + tol) {
8246
+ fit = "good";
8247
+ } else if (isDirectional) {
8248
+ const diff = userNum > rMax ? userNum - rMax : rMin - userNum;
8249
+ const bucket = diff > threshold * 2 ? "too-" : diff > threshold ? "" : "a-bit-";
8250
+ fit = bucket + (userNum > rMax ? "short" : "long");
8251
+ } else if (userNum < rMin) {
8243
8252
  const diff = rMin - userNum;
8244
8253
  fit = diff > threshold * 2 ? "too-loose" : diff > threshold ? "loose" : "a-bit-loose";
8245
8254
  } else {
@@ -17245,6 +17245,7 @@ function SkeletonOverlay({ landmarks, imgWidth, imgHeight }) {
17245
17245
  SKELETON_CONNECTIONS.map(([a, b], i) => {
17246
17246
  const pa2 = landmarks[a];
17247
17247
  const pb2 = landmarks[b];
17248
+ if (!pa2 || !pb2 || typeof pa2 !== "object" || typeof pb2 !== "object" || typeof pa2.x !== "number" || typeof pa2.y !== "number" || typeof pb2.x !== "number" || typeof pb2.y !== "number") return null;
17248
17249
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
17249
17250
  "line",
17250
17251
  {
@@ -17261,7 +17262,7 @@ function SkeletonOverlay({ landmarks, imgWidth, imgHeight }) {
17261
17262
  `l-${i}`
17262
17263
  );
17263
17264
  }),
17264
- Object.entries(landmarks).map(([key, v2], i) => /* @__PURE__ */ jsxRuntimeExports.jsxs("g", { children: [
17265
+ Object.entries(landmarks).filter(([, v2]) => v2 && typeof v2 === "object" && typeof v2.x === "number" && typeof v2.y === "number").map(([key, v2], i) => /* @__PURE__ */ jsxRuntimeExports.jsxs("g", { children: [
17265
17266
  /* @__PURE__ */ jsxRuntimeExports.jsx(
17266
17267
  "circle",
17267
17268
  {
@@ -17305,6 +17306,7 @@ function MeasurementOverlay({ lines, fitRows, show, imgWidth, imgHeight }) {
17305
17306
  const strokeW = Math.max(5, 3 * scale);
17306
17307
  const dotR = Math.max(7, 5 * scale);
17307
17308
  return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { className: "ps-tryon-pose-overlay", viewBox: `0 0 ${W2} ${H2}`, preserveAspectRatio: "xMidYMid meet", children: areas.map(({ key, line, label }, i) => {
17309
+ if (!line || typeof line.x1 !== "number" || typeof line.x2 !== "number" || typeof line.y !== "number") return null;
17308
17310
  const x1 = line.x1 * W2;
17309
17311
  const x2 = line.x2 * W2;
17310
17312
  const cy = line.y * H2;
@@ -17660,10 +17662,17 @@ function SectionDetailView({
17660
17662
  }
17661
17663
  const range = rMax - rMin;
17662
17664
  const threshold = range > 0 ? range * 0.5 : rMin * 0.05 || 3;
17665
+ const measLower = m2.measurement.toLowerCase();
17666
+ const isDirectional = /length|inseam|sleeve|hem|rise/.test(measLower);
17663
17667
  let fit;
17664
17668
  const tol = Math.max((rMax || rMin) * 0.03, 0.5);
17665
- if (userNum >= rMin - tol && userNum <= rMax + tol) fit = "good";
17666
- else if (userNum < rMin) {
17669
+ if (userNum >= rMin - tol && userNum <= rMax + tol) {
17670
+ fit = "good";
17671
+ } else if (isDirectional) {
17672
+ const diff = userNum > rMax ? userNum - rMax : rMin - userNum;
17673
+ const bucket = diff > threshold * 2 ? "too-" : diff > threshold ? "" : "a-bit-";
17674
+ fit = bucket + (userNum > rMax ? "short" : "long");
17675
+ } else if (userNum < rMin) {
17667
17676
  const diff = rMin - userNum;
17668
17677
  fit = diff > threshold * 2 ? "too-loose" : diff > threshold ? "loose" : "a-bit-loose";
17669
17678
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.8.55",
3
+ "version": "5.8.57",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",