@primestyleai/tryon 5.5.23 → 5.5.25

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 +39 -25
  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;
@@ -5399,16 +5397,32 @@ function SectionDetailView({
5399
5397
  return { area: m.measurement, userNum, chartLabel: cleanNumFn(chartLabel), fit, isLength: false };
5400
5398
  });
5401
5399
  }, [sectionResult, lengthEntry, userMeasurements, displaySize, recSize, chartRangeFor, selectedLength, recLength]);
5402
- const displayLength = selectedLength || recLength;
5403
- const goodCount = fitRows.filter((r) => r.fit === "good").length;
5400
+ const goodCount = fitRows.filter(
5401
+ (r) => r.fit === "good" || r.fit === "a-bit-tight" || r.fit === "a-bit-loose"
5402
+ ).length;
5404
5403
  const matchPercent = fitRows.length > 0 ? Math.round(goodCount / fitRows.length * 100) : 0;
5405
5404
  const secAny = sectionResult;
5406
- const backendLength = secAny?.length || displayLength;
5407
- const backendSize = secAny?.size || displaySize;
5405
+ const backendSize = secAny?.size || recSize;
5406
+ const backendLength = secAny?.length || recLength;
5408
5407
  const backendAvailableSizes = secAny?.availableSizes || [];
5409
5408
  const backendAvailableLengths = secAny?.availableLengths || [];
5410
5409
  const finalDisplayLength = selectedLength || backendLength;
5411
5410
  const finalAllSizes = backendAvailableSizes.length > 0 ? backendAvailableSizes : allSizes;
5411
+ const visibleSizes = (() => {
5412
+ if (finalAllSizes.length <= 3) return finalAllSizes;
5413
+ const idx = finalAllSizes.indexOf(recSize);
5414
+ if (idx < 0) return finalAllSizes.slice(0, 3);
5415
+ const start = Math.max(0, Math.min(finalAllSizes.length - 3, idx - 1));
5416
+ return finalAllSizes.slice(start, start + 3);
5417
+ })();
5418
+ const lengthOptions = backendAvailableLengths.length > 0 ? backendAvailableLengths : lengthSizes;
5419
+ const visibleLengths = (() => {
5420
+ if (lengthOptions.length <= 3) return lengthOptions;
5421
+ const idx = lengthOptions.indexOf(backendLength);
5422
+ if (idx < 0) return lengthOptions.slice(0, 3);
5423
+ const start = Math.max(0, Math.min(lengthOptions.length - 3, idx - 1));
5424
+ return lengthOptions.slice(start, start + 3);
5425
+ })();
5412
5426
  if (isMobileProp) {
5413
5427
  const cleanSectionName = sectionName.replace(/\s*[—–-]\s*.*/g, "");
5414
5428
  const measurementDesc = (area) => {
@@ -5448,9 +5462,9 @@ function SectionDetailView({
5448
5462
  ] }),
5449
5463
  productImage && /* @__PURE__ */ jsx("div", { className: "ps-msd-image", children: /* @__PURE__ */ jsx("img", { src: productImage, alt: productTitle || "", className: "ps-msd-image-img" }) }),
5450
5464
  /* @__PURE__ */ jsxs("div", { className: "ps-msd-card", children: [
5451
- /* @__PURE__ */ jsx("span", { className: "ps-msd-card-eyebrow", children: t("RECOMMENDED SIZE") }),
5465
+ /* @__PURE__ */ jsx("span", { className: "ps-msd-card-eyebrow", children: displaySize === backendSize ? t("RECOMMENDED SIZE") : t("TRYING SIZE") }),
5452
5466
  /* @__PURE__ */ jsxs("div", { className: "ps-msd-card-size-row", children: [
5453
- /* @__PURE__ */ jsx("span", { className: "ps-msd-card-size", children: backendSize }),
5467
+ /* @__PURE__ */ jsx("span", { className: "ps-msd-card-size", children: displaySize }),
5454
5468
  finalDisplayLength && /* @__PURE__ */ jsx("span", { className: "ps-msd-card-size-meta", children: finalDisplayLength })
5455
5469
  ] }),
5456
5470
  /* @__PURE__ */ jsx("div", { className: "ps-msd-card-divider" }),
@@ -5491,7 +5505,7 @@ function SectionDetailView({
5491
5505
  /* @__PURE__ */ jsxs("span", { className: "ps-msd-cell-label", children: [
5492
5506
  t("SIZE"),
5493
5507
  " ",
5494
- backendSize
5508
+ displaySize
5495
5509
  ] }),
5496
5510
  /* @__PURE__ */ jsx("span", { className: "ps-msd-cell-value", children: row.chartLabel })
5497
5511
  ] })
@@ -5503,9 +5517,9 @@ function SectionDetailView({
5503
5517
  ] }, i);
5504
5518
  }) })
5505
5519
  ] }),
5506
- finalAllSizes.length > 1 && /* @__PURE__ */ jsxs("div", { className: "ps-msd-sizes", children: [
5520
+ visibleSizes.length > 1 && /* @__PURE__ */ jsxs("div", { className: "ps-msd-sizes", children: [
5507
5521
  /* @__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) => {
5522
+ /* @__PURE__ */ jsx("div", { className: "ps-msd-sizes-pills", children: visibleSizes.map((s) => {
5509
5523
  const isActive = s === displaySize;
5510
5524
  return /* @__PURE__ */ jsx(
5511
5525
  "button",
@@ -5519,9 +5533,9 @@ function SectionDetailView({
5519
5533
  );
5520
5534
  }) })
5521
5535
  ] }),
5522
- (backendAvailableLengths.length > 0 || lengthSizes.length > 0) && /* @__PURE__ */ jsxs("div", { className: "ps-msd-sizes", children: [
5536
+ visibleLengths.length > 0 && /* @__PURE__ */ jsxs("div", { className: "ps-msd-sizes", children: [
5523
5537
  /* @__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) => {
5538
+ /* @__PURE__ */ jsx("div", { className: "ps-msd-sizes-pills", children: visibleLengths.map((s) => {
5525
5539
  const isActive = finalDisplayLength === s;
5526
5540
  return /* @__PURE__ */ jsx(
5527
5541
  "button",
@@ -5539,7 +5553,7 @@ function SectionDetailView({
5539
5553
  t("*Our sizing engine recommends"),
5540
5554
  " ",
5541
5555
  backendSize,
5542
- finalDisplayLength ? ` (${finalDisplayLength})` : "",
5556
+ backendLength ? ` (${backendLength})` : "",
5543
5557
  " ",
5544
5558
  t("based on your measurements and the garment's tailoring chart.")
5545
5559
  ] })
@@ -5549,7 +5563,7 @@ function SectionDetailView({
5549
5563
  /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
5550
5564
  /* @__PURE__ */ jsx("span", { style: { fontSize: "0.75vw", fontWeight: 700, color: "var(--ps-accent)", textTransform: "uppercase", letterSpacing: "0.12em" }, children: isRecommended ? t("Recommended Size") : t("Not Recommended") }),
5551
5565
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "baseline", gap: "0.5vw", marginTop: "0.3vw", marginBottom: "0.4vw" }, children: [
5552
- /* @__PURE__ */ jsx("span", { style: { fontSize: "3.5vw", fontWeight: 300, color: "var(--ps-text-primary)", lineHeight: 1, letterSpacing: "-0.02em" }, children: backendSize }),
5566
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "3.5vw", fontWeight: 300, color: "var(--ps-text-primary)", lineHeight: 1, letterSpacing: "-0.02em" }, children: displaySize }),
5553
5567
  finalDisplayLength && /* @__PURE__ */ jsx("span", { style: { fontSize: "1.4vw", fontWeight: 400, color: "var(--ps-text-secondary)" }, children: finalDisplayLength })
5554
5568
  ] }),
5555
5569
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.4vw", marginBottom: "1.2vw" }, children: [
@@ -5585,7 +5599,7 @@ function SectionDetailView({
5585
5599
  ] }, i);
5586
5600
  }) })
5587
5601
  ] }) }),
5588
- finalAllSizes.length > 1 && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.8vw" }, children: [
5602
+ visibleSizes.length > 1 && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.8vw" }, children: [
5589
5603
  /* @__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
5604
  t("Select"),
5591
5605
  " ",
@@ -5593,7 +5607,7 @@ function SectionDetailView({
5593
5607
  " ",
5594
5608
  t("Size")
5595
5609
  ] }),
5596
- /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "0.3vw", flexWrap: "wrap" }, children: finalAllSizes.map((s) => {
5610
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "0.3vw", flexWrap: "wrap" }, children: visibleSizes.map((s) => {
5597
5611
  const isActive = s === displaySize;
5598
5612
  return /* @__PURE__ */ jsx(
5599
5613
  "button",
@@ -5619,9 +5633,9 @@ function SectionDetailView({
5619
5633
  );
5620
5634
  }) })
5621
5635
  ] }),
5622
- (backendAvailableLengths.length > 0 || lengthSizes.length > 0) && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.8vw", marginTop: "0.4vw" }, children: [
5636
+ visibleLengths.length > 0 && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.8vw", marginTop: "0.4vw" }, children: [
5623
5637
  /* @__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) => {
5638
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "0.3vw", flexWrap: "wrap" }, children: visibleLengths.map((s) => {
5625
5639
  const isActive = finalDisplayLength === s;
5626
5640
  return /* @__PURE__ */ jsx(
5627
5641
  "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.25",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",