@primestyleai/tryon 5.8.56 → 5.8.58

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.
@@ -8238,10 +8238,17 @@ function SectionDetailView({
8238
8238
  }
8239
8239
  const range = rMax - rMin;
8240
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);
8241
8243
  let fit;
8242
8244
  const tol = Math.max((rMax || rMin) * 0.03, 0.5);
8243
- if (userNum >= rMin - tol && userNum <= rMax + tol) fit = "good";
8244
- 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) {
8245
8252
  const diff = rMin - userNum;
8246
8253
  fit = diff > threshold * 2 ? "too-loose" : diff > threshold ? "loose" : "a-bit-loose";
8247
8254
  } else {
@@ -13042,13 +13049,26 @@ function buildFieldsFromSizeGuide$2(sizeGuide) {
13042
13049
  const req = sizeGuide?.requiredFields;
13043
13050
  if (!req || req.length === 0) return FALLBACK_FOOT_FIELDS;
13044
13051
  const SIZE_CODE_KEYS = /* @__PURE__ */ new Set(["size", "country", "eu", "__skip__", "shoeEU", "shoeUS", "shoeUK", "shoeJP"]);
13045
- const out = req.filter((f) => !SIZE_CODE_KEYS.has(f.key) && f.unit !== "size").map((f) => ({
13046
- key: f.key,
13047
- label: f.label || f.key,
13048
- placeholder: { cm: f.placeholder || "", in: f.placeholder || "" },
13049
- min: 0,
13050
- step: 0.5
13051
- }));
13052
+ const defaultPlaceholderFor = (key, label) => {
13053
+ const exact = FALLBACK_FOOT_FIELDS.find((f) => f.key === key);
13054
+ if (exact) return exact.placeholder;
13055
+ const looksLikeFoot = /foot|length/i.test(key) || /foot|length/i.test(label);
13056
+ if (looksLikeFoot) return FALLBACK_FOOT_FIELDS[0].placeholder;
13057
+ return { cm: "", in: "" };
13058
+ };
13059
+ const out = req.filter((f) => !SIZE_CODE_KEYS.has(f.key) && f.unit !== "size").map((f) => {
13060
+ const fallback = defaultPlaceholderFor(f.key, f.label || "");
13061
+ return {
13062
+ key: f.key,
13063
+ label: f.label || f.key,
13064
+ placeholder: {
13065
+ cm: f.placeholder || fallback.cm,
13066
+ in: f.placeholder || fallback.in
13067
+ },
13068
+ min: 0,
13069
+ step: 0.5
13070
+ };
13071
+ });
13052
13072
  return out.length > 0 ? out : FALLBACK_FOOT_FIELDS;
13053
13073
  }
13054
13074
  function FootSizeView(props) {
@@ -17662,10 +17662,17 @@ function SectionDetailView({
17662
17662
  }
17663
17663
  const range = rMax - rMin;
17664
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);
17665
17667
  let fit;
17666
17668
  const tol = Math.max((rMax || rMin) * 0.03, 0.5);
17667
- if (userNum >= rMin - tol && userNum <= rMax + tol) fit = "good";
17668
- 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) {
17669
17676
  const diff = rMin - userNum;
17670
17677
  fit = diff > threshold * 2 ? "too-loose" : diff > threshold ? "loose" : "a-bit-loose";
17671
17678
  } else {
@@ -22466,13 +22473,26 @@ function buildFieldsFromSizeGuide$2(sizeGuide) {
22466
22473
  const req = sizeGuide?.requiredFields;
22467
22474
  if (!req || req.length === 0) return FALLBACK_FOOT_FIELDS;
22468
22475
  const SIZE_CODE_KEYS = /* @__PURE__ */ new Set(["size", "country", "eu", "__skip__", "shoeEU", "shoeUS", "shoeUK", "shoeJP"]);
22469
- const out = req.filter((f2) => !SIZE_CODE_KEYS.has(f2.key) && f2.unit !== "size").map((f2) => ({
22470
- key: f2.key,
22471
- label: f2.label || f2.key,
22472
- placeholder: { cm: f2.placeholder || "", in: f2.placeholder || "" },
22473
- min: 0,
22474
- step: 0.5
22475
- }));
22476
+ const defaultPlaceholderFor = (key, label) => {
22477
+ const exact = FALLBACK_FOOT_FIELDS.find((f2) => f2.key === key);
22478
+ if (exact) return exact.placeholder;
22479
+ const looksLikeFoot = /foot|length/i.test(key) || /foot|length/i.test(label);
22480
+ if (looksLikeFoot) return FALLBACK_FOOT_FIELDS[0].placeholder;
22481
+ return { cm: "", in: "" };
22482
+ };
22483
+ const out = req.filter((f2) => !SIZE_CODE_KEYS.has(f2.key) && f2.unit !== "size").map((f2) => {
22484
+ const fallback = defaultPlaceholderFor(f2.key, f2.label || "");
22485
+ return {
22486
+ key: f2.key,
22487
+ label: f2.label || f2.key,
22488
+ placeholder: {
22489
+ cm: f2.placeholder || fallback.cm,
22490
+ in: f2.placeholder || fallback.in
22491
+ },
22492
+ min: 0,
22493
+ step: 0.5
22494
+ };
22495
+ });
22476
22496
  return out.length > 0 ? out : FALLBACK_FOOT_FIELDS;
22477
22497
  }
22478
22498
  function FootSizeView(props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.8.56",
3
+ "version": "5.8.58",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",