@primestyleai/tryon 5.5.23 → 5.5.24

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.
Files changed (2) hide show
  1. package/dist/react/index.js +32 -17
  2. package/package.json +1 -1
@@ -5376,18 +5376,16 @@ function SectionDetailView({
5376
5376
  const userNum = userMeasurements[m.measurement.toLowerCase()] || pNumFn(m.userValue);
5377
5377
  let { min: rMin, max: rMax } = pRangeFn(m.chartRange);
5378
5378
  let chartLabel = m.chartRange;
5379
- if (displaySize !== recSize) {
5380
- const alt = chartRangeFor(m.measurement, displaySize);
5381
- if (alt) {
5382
- chartLabel = alt.range;
5383
- rMin = alt.min;
5384
- rMax = alt.max;
5385
- }
5379
+ const alt = chartRangeFor(m.measurement, displaySize);
5380
+ if (alt) {
5381
+ chartLabel = alt.range;
5382
+ rMin = alt.min;
5383
+ rMax = alt.max;
5386
5384
  }
5387
5385
  const range = rMax - rMin;
5388
5386
  const threshold = range > 0 ? range * 0.5 : rMin * 0.05 || 3;
5389
5387
  let fit;
5390
- const tol = Math.max((rMax || rMin) * 5e-3, 0.25);
5388
+ const tol = Math.max((rMax || rMin) * 0.03, 0.5);
5391
5389
  if (userNum >= rMin - tol && userNum <= rMax + tol) fit = "good";
5392
5390
  else if (userNum < rMin) {
5393
5391
  const diff = rMin - userNum;
@@ -5400,7 +5398,9 @@ function SectionDetailView({
5400
5398
  });
5401
5399
  }, [sectionResult, lengthEntry, userMeasurements, displaySize, recSize, chartRangeFor, selectedLength, recLength]);
5402
5400
  const displayLength = selectedLength || recLength;
5403
- const goodCount = fitRows.filter((r) => r.fit === "good").length;
5401
+ const goodCount = fitRows.filter(
5402
+ (r) => r.fit === "good" || r.fit === "a-bit-tight" || r.fit === "a-bit-loose"
5403
+ ).length;
5404
5404
  const matchPercent = fitRows.length > 0 ? Math.round(goodCount / fitRows.length * 100) : 0;
5405
5405
  const secAny = sectionResult;
5406
5406
  const backendLength = secAny?.length || displayLength;
@@ -5409,6 +5409,21 @@ function SectionDetailView({
5409
5409
  const backendAvailableLengths = secAny?.availableLengths || [];
5410
5410
  const finalDisplayLength = selectedLength || backendLength;
5411
5411
  const finalAllSizes = backendAvailableSizes.length > 0 ? backendAvailableSizes : allSizes;
5412
+ const visibleSizes = (() => {
5413
+ if (finalAllSizes.length <= 3) return finalAllSizes;
5414
+ const idx = finalAllSizes.indexOf(recSize);
5415
+ if (idx < 0) return finalAllSizes.slice(0, 3);
5416
+ const start = Math.max(0, Math.min(finalAllSizes.length - 3, idx - 1));
5417
+ return finalAllSizes.slice(start, start + 3);
5418
+ })();
5419
+ const lengthOptions = backendAvailableLengths.length > 0 ? backendAvailableLengths : lengthSizes;
5420
+ const visibleLengths = (() => {
5421
+ if (lengthOptions.length <= 3) return lengthOptions;
5422
+ const idx = lengthOptions.indexOf(backendLength);
5423
+ if (idx < 0) return lengthOptions.slice(0, 3);
5424
+ const start = Math.max(0, Math.min(lengthOptions.length - 3, idx - 1));
5425
+ return lengthOptions.slice(start, start + 3);
5426
+ })();
5412
5427
  if (isMobileProp) {
5413
5428
  const cleanSectionName = sectionName.replace(/\s*[—–-]\s*.*/g, "");
5414
5429
  const measurementDesc = (area) => {
@@ -5503,9 +5518,9 @@ function SectionDetailView({
5503
5518
  ] }, i);
5504
5519
  }) })
5505
5520
  ] }),
5506
- finalAllSizes.length > 1 && /* @__PURE__ */ jsxs("div", { className: "ps-msd-sizes", children: [
5521
+ visibleSizes.length > 1 && /* @__PURE__ */ jsxs("div", { className: "ps-msd-sizes", children: [
5507
5522
  /* @__PURE__ */ jsx("span", { className: "ps-msd-sizes-label", children: t("TRY ANOTHER SIZE") }),
5508
- /* @__PURE__ */ jsx("div", { className: "ps-msd-sizes-pills", children: finalAllSizes.map((s) => {
5523
+ /* @__PURE__ */ jsx("div", { className: "ps-msd-sizes-pills", children: visibleSizes.map((s) => {
5509
5524
  const isActive = s === displaySize;
5510
5525
  return /* @__PURE__ */ jsx(
5511
5526
  "button",
@@ -5519,9 +5534,9 @@ function SectionDetailView({
5519
5534
  );
5520
5535
  }) })
5521
5536
  ] }),
5522
- (backendAvailableLengths.length > 0 || lengthSizes.length > 0) && /* @__PURE__ */ jsxs("div", { className: "ps-msd-sizes", children: [
5537
+ visibleLengths.length > 0 && /* @__PURE__ */ jsxs("div", { className: "ps-msd-sizes", children: [
5523
5538
  /* @__PURE__ */ jsx("span", { className: "ps-msd-sizes-label", children: t("LENGTH ADJUSTMENT") }),
5524
- /* @__PURE__ */ jsx("div", { className: "ps-msd-sizes-pills", children: (backendAvailableLengths.length > 0 ? backendAvailableLengths : lengthSizes).map((s) => {
5539
+ /* @__PURE__ */ jsx("div", { className: "ps-msd-sizes-pills", children: visibleLengths.map((s) => {
5525
5540
  const isActive = finalDisplayLength === s;
5526
5541
  return /* @__PURE__ */ jsx(
5527
5542
  "button",
@@ -5585,7 +5600,7 @@ function SectionDetailView({
5585
5600
  ] }, i);
5586
5601
  }) })
5587
5602
  ] }) }),
5588
- finalAllSizes.length > 1 && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.8vw" }, children: [
5603
+ visibleSizes.length > 1 && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.8vw" }, children: [
5589
5604
  /* @__PURE__ */ jsxs("span", { style: { fontSize: "0.6vw", fontWeight: 700, color: "var(--ps-text-secondary)", textTransform: "uppercase", letterSpacing: "0.1em", display: "block", marginBottom: "0.4vw" }, children: [
5590
5605
  t("Select"),
5591
5606
  " ",
@@ -5593,7 +5608,7 @@ function SectionDetailView({
5593
5608
  " ",
5594
5609
  t("Size")
5595
5610
  ] }),
5596
- /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "0.3vw", flexWrap: "wrap" }, children: finalAllSizes.map((s) => {
5611
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "0.3vw", flexWrap: "wrap" }, children: visibleSizes.map((s) => {
5597
5612
  const isActive = s === displaySize;
5598
5613
  return /* @__PURE__ */ jsx(
5599
5614
  "button",
@@ -5619,9 +5634,9 @@ function SectionDetailView({
5619
5634
  );
5620
5635
  }) })
5621
5636
  ] }),
5622
- (backendAvailableLengths.length > 0 || lengthSizes.length > 0) && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.8vw", marginTop: "0.4vw" }, children: [
5637
+ visibleLengths.length > 0 && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.8vw", marginTop: "0.4vw" }, children: [
5623
5638
  /* @__PURE__ */ jsx("span", { style: { fontSize: "0.6vw", fontWeight: 700, color: "var(--ps-text-secondary)", textTransform: "uppercase", letterSpacing: "0.1em", display: "block", marginBottom: "0.4vw" }, children: t("Length Adjustment") }),
5624
- /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "0.3vw", flexWrap: "wrap" }, children: (backendAvailableLengths.length > 0 ? backendAvailableLengths : lengthSizes).map((s) => {
5639
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "0.3vw", flexWrap: "wrap" }, children: visibleLengths.map((s) => {
5625
5640
  const isActive = finalDisplayLength === s;
5626
5641
  return /* @__PURE__ */ jsx(
5627
5642
  "button",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.5.23",
3
+ "version": "5.5.24",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",