@primestyleai/tryon 3.16.0 → 3.17.0
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.
- package/dist/react/index.js +88 -49
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -860,8 +860,12 @@ function PrimeStyleTryonInner({
|
|
|
860
860
|
if (!isNaN(v)) userMeas[k] = sizingUnit === "in" ? inToCm(v) : v;
|
|
861
861
|
}
|
|
862
862
|
if (Object.keys(userMeas).length === 0) return null;
|
|
863
|
-
|
|
864
|
-
|
|
863
|
+
let idx = sizeGuide.headers.findIndex((h) => /^size$/i.test(h.trim()));
|
|
864
|
+
if (idx < 0) idx = sizeGuide.headers.findIndex((h) => /size|taglia|größe|taille/i.test(h.trim()));
|
|
865
|
+
if (idx < 0) {
|
|
866
|
+
const firstColVals = sizeGuide.rows.map((r) => r[0]?.trim() || "");
|
|
867
|
+
idx = firstColVals.some((v) => /^(XXS|XS|S|M|L|XL|XXL|XXXL|\d{1,3})$/i.test(v)) ? 0 : 0;
|
|
868
|
+
}
|
|
865
869
|
const colMap = [];
|
|
866
870
|
const intlCols = [];
|
|
867
871
|
sizeGuide.headers.forEach((h, i) => {
|
|
@@ -872,7 +876,11 @@ function PrimeStyleTryonInner({
|
|
|
872
876
|
intlCols.push({ hi: i, code: clean.toUpperCase() });
|
|
873
877
|
return;
|
|
874
878
|
}
|
|
875
|
-
|
|
879
|
+
let fk = HEADER_MAP[clean];
|
|
880
|
+
if (!fk) {
|
|
881
|
+
const pk = Object.keys(HEADER_MAP).find((k) => clean.includes(k));
|
|
882
|
+
if (pk) fk = HEADER_MAP[pk];
|
|
883
|
+
}
|
|
876
884
|
if (fk && userMeas[fk] !== void 0) colMap.push({ hi: i, formKey: fk, label: h.trim() });
|
|
877
885
|
});
|
|
878
886
|
if (colMap.length === 0) return null;
|
|
@@ -1597,8 +1605,14 @@ function PrimeStyleTryonInner({
|
|
|
1597
1605
|
foot: "footLengthCm",
|
|
1598
1606
|
"foot length": "footLengthCm"
|
|
1599
1607
|
};
|
|
1600
|
-
|
|
1601
|
-
|
|
1608
|
+
let idx = sizeGuide.headers.findIndex((h) => /^size$/i.test(h.trim()));
|
|
1609
|
+
if (idx < 0) idx = sizeGuide.headers.findIndex((h) => /size|taglia|größe|taille/i.test(h.trim()));
|
|
1610
|
+
if (idx < 0) {
|
|
1611
|
+
const firstColVals = sizeGuide.rows.map((r) => r[0]?.trim() || "");
|
|
1612
|
+
const looksLikeSize = firstColVals.some((v) => /^(XXS|XS|S|M|L|XL|XXL|XXXL|\d{1,3})$/i.test(v));
|
|
1613
|
+
idx = looksLikeSize ? 0 : -1;
|
|
1614
|
+
}
|
|
1615
|
+
if (idx < 0) idx = 0;
|
|
1602
1616
|
const measCols = [];
|
|
1603
1617
|
const intlCols = [];
|
|
1604
1618
|
sizeGuide.headers.forEach((h, i) => {
|
|
@@ -1609,8 +1623,10 @@ function PrimeStyleTryonInner({
|
|
|
1609
1623
|
intlCols.push({ headerIdx: i, code: clean.toUpperCase() });
|
|
1610
1624
|
} else if (MEAS_MAP[clean]) {
|
|
1611
1625
|
measCols.push({ headerIdx: i, label: h.trim(), formKey: MEAS_MAP[clean] });
|
|
1612
|
-
} else if (
|
|
1613
|
-
|
|
1626
|
+
} else if (clean && clean !== "size") {
|
|
1627
|
+
const partialKey = Object.keys(MEAS_MAP).find((k) => clean.includes(k));
|
|
1628
|
+
const fk = partialKey ? MEAS_MAP[partialKey] : clean.replace(/\s+/g, "");
|
|
1629
|
+
measCols.push({ headerIdx: i, label: h.trim(), formKey: fk });
|
|
1614
1630
|
}
|
|
1615
1631
|
});
|
|
1616
1632
|
const sizes = sizeGuide.rows.map((row) => {
|
|
@@ -1629,7 +1645,7 @@ function PrimeStyleTryonInner({
|
|
|
1629
1645
|
}
|
|
1630
1646
|
return { label, measurements, intl };
|
|
1631
1647
|
});
|
|
1632
|
-
return { sizes, measCols, intlCols };
|
|
1648
|
+
return { sizes: sizes.filter((s) => s.label.trim()), measCols, intlCols };
|
|
1633
1649
|
}, [sizeGuide]);
|
|
1634
1650
|
const getUserVal = useCallback((formKey2) => {
|
|
1635
1651
|
const edited = editedValues[formKey2];
|
|
@@ -1732,49 +1748,72 @@ function PrimeStyleTryonInner({
|
|
|
1732
1748
|
/* @__PURE__ */ jsx("strong", { children: activeSize })
|
|
1733
1749
|
] })
|
|
1734
1750
|
] }),
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
" (",
|
|
1743
|
-
|
|
1744
|
-
|
|
1751
|
+
(() => {
|
|
1752
|
+
const hasDynamic = activeFit && activeFit.length > 0;
|
|
1753
|
+
const hasBackend = sizingResult.matchDetails && sizingResult.matchDetails.length > 0;
|
|
1754
|
+
if (hasDynamic) return /* @__PURE__ */ jsxs("div", { className: "ps-tryon-sr-fit", children: [
|
|
1755
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-sr-label", children: t("Fit Analysis") }),
|
|
1756
|
+
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-sr-fit-table", children: [
|
|
1757
|
+
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-sr-fit-header", children: [
|
|
1758
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-area", children: t("Area") }),
|
|
1759
|
+
/* @__PURE__ */ jsxs("span", { className: "ps-tryon-sr-fit-col-you", children: [
|
|
1760
|
+
t("You"),
|
|
1761
|
+
" (",
|
|
1762
|
+
unitLabel,
|
|
1763
|
+
")"
|
|
1764
|
+
] }),
|
|
1765
|
+
/* @__PURE__ */ jsxs("span", { className: "ps-tryon-sr-fit-col-chart", children: [
|
|
1766
|
+
t("Chart"),
|
|
1767
|
+
" (",
|
|
1768
|
+
unitLabel,
|
|
1769
|
+
")"
|
|
1770
|
+
] }),
|
|
1771
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-fit", children: t("Fit") })
|
|
1745
1772
|
] }),
|
|
1746
|
-
/* @__PURE__ */ jsxs("
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-area", children: row.label }),
|
|
1756
|
-
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-you", children: /* @__PURE__ */ jsx(
|
|
1757
|
-
"input",
|
|
1758
|
-
{
|
|
1759
|
-
type: "number",
|
|
1760
|
-
className: "ps-tryon-sr-fit-input",
|
|
1761
|
-
defaultValue: isCmResult ? Math.round(row.userVal) : cmToIn(row.userVal),
|
|
1762
|
-
onBlur: (e) => {
|
|
1763
|
-
const val = e.target.value;
|
|
1764
|
-
setEditedValues((prev) => ({ ...prev, [row.formKey]: val }));
|
|
1773
|
+
activeFit.map((row, i) => /* @__PURE__ */ jsxs("div", { className: `ps-tryon-sr-fit-row ps-fit-${row.fit}`, children: [
|
|
1774
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-area", children: row.label }),
|
|
1775
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-you", children: /* @__PURE__ */ jsx(
|
|
1776
|
+
"input",
|
|
1777
|
+
{
|
|
1778
|
+
type: "number",
|
|
1779
|
+
className: "ps-tryon-sr-fit-input",
|
|
1780
|
+
defaultValue: isCmResult ? Math.round(row.userVal) : cmToIn(row.userVal),
|
|
1781
|
+
onBlur: (e) => setEditedValues((prev) => ({ ...prev, [row.formKey]: e.target.value }))
|
|
1765
1782
|
}
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
] }
|
|
1774
|
-
] }
|
|
1775
|
-
] })
|
|
1776
|
-
|
|
1777
|
-
|
|
1783
|
+
) }),
|
|
1784
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-chart", children: fmtRange(row.chartMin, row.chartMax) }),
|
|
1785
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-fit", children: /* @__PURE__ */ jsxs("span", { className: `ps-tryon-sr-fit-badge ps-fit-${row.fit}`, children: [
|
|
1786
|
+
row.fit === "good" ? "✓" : row.fit === "tight" ? "↑" : "↓",
|
|
1787
|
+
" ",
|
|
1788
|
+
row.fit === "good" ? t("within range") : row.fit === "tight" ? t("may be snug") : t("may be loose")
|
|
1789
|
+
] }) })
|
|
1790
|
+
] }, i))
|
|
1791
|
+
] })
|
|
1792
|
+
] });
|
|
1793
|
+
if (hasBackend) return /* @__PURE__ */ jsxs("div", { className: "ps-tryon-sr-fit", children: [
|
|
1794
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-sr-label", children: t("Fit Analysis") }),
|
|
1795
|
+
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-sr-fit-table", children: [
|
|
1796
|
+
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-sr-fit-header", children: [
|
|
1797
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-area", children: t("Area") }),
|
|
1798
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-you", children: t("You") }),
|
|
1799
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-chart", children: t("Chart") }),
|
|
1800
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-fit", children: t("Fit") })
|
|
1801
|
+
] }),
|
|
1802
|
+
sizingResult.matchDetails.map((m, i) => /* @__PURE__ */ jsxs("div", { className: `ps-tryon-sr-fit-row ps-fit-${m.fit}`, children: [
|
|
1803
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-area", children: m.measurement }),
|
|
1804
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-you", children: m.userValue }),
|
|
1805
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-chart", children: m.chartRange }),
|
|
1806
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-fit-col-fit", children: /* @__PURE__ */ jsxs("span", { className: `ps-tryon-sr-fit-badge ps-fit-${m.fit}`, children: [
|
|
1807
|
+
m.fit === "good" ? "✓" : m.fit === "tight" ? "↑" : "↓",
|
|
1808
|
+
" ",
|
|
1809
|
+
m.fit === "good" ? t("within range") : m.fit === "tight" ? t("may be snug") : t("may be loose")
|
|
1810
|
+
] }) })
|
|
1811
|
+
] }, i))
|
|
1812
|
+
] })
|
|
1813
|
+
] });
|
|
1814
|
+
if (sizingResult.reasoning) return /* @__PURE__ */ jsx("div", { className: "ps-tryon-sr-reasoning", children: /* @__PURE__ */ jsx("p", { children: sizingResult.reasoning }) });
|
|
1815
|
+
return null;
|
|
1816
|
+
})(),
|
|
1778
1817
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-sr-ctas", children: [
|
|
1779
1818
|
/* @__PURE__ */ jsxs("button", { className: "ps-tryon-cta", onClick: () => setView("upload"), children: [
|
|
1780
1819
|
t("See how it looks on you"),
|