@primestyleai/tryon 5.4.3 → 5.4.5

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 +135 -74
  2. package/package.json +1 -1
@@ -4020,7 +4020,6 @@ function SectionDetailView({
4020
4020
  return [...new Set(raw)];
4021
4021
  }, [section, sizeColIdx, sizeHeader]);
4022
4022
  const displaySize = selectedSize || recSize;
4023
- const isRecommended = displaySize === recSize;
4024
4023
  const chartRangeFor = useCallback((measurement, size) => {
4025
4024
  const b = measurement.toLowerCase().trim();
4026
4025
  const preferCm = unitLbl === "cm" || unitLbl === "";
@@ -4137,87 +4136,149 @@ function SectionDetailView({
4137
4136
  return { area: m.measurement, userNum, chartLabel: cleanNumFn(chartLabel), fit, isLength: false };
4138
4137
  });
4139
4138
  }, [sectionResult, lengthEntry, userMeasurements, displaySize, recSize, chartRangeFor, selectedLength, recLength]);
4140
- return /* @__PURE__ */ jsxs("div", { className: "ps-tryon-sec-detail", children: [
4141
- /* @__PURE__ */ jsx("div", { style: { marginBottom: "0.3vw" }, children: /* @__PURE__ */ jsxs("button", { className: "ps-bp-back-btn", onClick: onBack, type: "button", children: [
4142
- /* @__PURE__ */ jsx("span", { className: "ps-bp-back-arrow", children: "←" }),
4143
- " ",
4144
- t("Back to sections")
4145
- ] }) }),
4146
- /* @__PURE__ */ jsxs("div", { className: "ps-tryon-sec-detail-header", children: [
4147
- /* @__PURE__ */ jsx("div", { className: "ps-tryon-sec-detail-icon", children: /* @__PURE__ */ jsx(GarmentIcon, { name: sectionName, size: 28 }) }),
4148
- /* @__PURE__ */ jsx("span", { className: "ps-tryon-sec-detail-name", children: sectionName })
4149
- ] }),
4150
- /* @__PURE__ */ jsx("div", { className: "ps-tryon-sr-size-hero", children: (() => {
4151
- const overallFit = fitRows.length > 0 ? fitRows.every((r) => r.fit === "good") ? "good" : fitRows.some((r) => r.fit.includes("tight")) ? "tight" : "loose" : "good";
4152
- const fitLabel = overallFit === "good" ? t("Perfect Fit") : overallFit === "tight" ? t("Tight Fit") : t("Relaxed Fit");
4153
- const fitColor = overallFit === "good" ? "#16a34a" : overallFit === "tight" ? "#dc2626" : "#d97706";
4154
- return /* @__PURE__ */ jsxs(Fragment, { children: [
4155
- /* @__PURE__ */ jsx("span", { style: { fontSize: "0.65vw", fontWeight: 700, color: fitColor, textTransform: "uppercase", letterSpacing: "0.1em" }, children: fitLabel }),
4156
- /* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-size-letter", children: displaySize }),
4157
- /* @__PURE__ */ jsx("div", { className: "ps-tryon-sr-size-meta", children: /* @__PURE__ */ jsx("span", { className: `ps-tryon-sr-size-label${isRecommended ? "" : " ps-not-rec"}`, children: isRecommended ? t("RECOMMENDED SIZE") : t("NOT RECOMMENDED") }) })
4158
- ] });
4159
- })() }),
4160
- fitRows.length > 0 && /* @__PURE__ */ jsxs("table", { className: "ps-tryon-sr-fit-table", children: [
4161
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
4162
- /* @__PURE__ */ jsx("th", {}),
4163
- /* @__PURE__ */ jsx("th", { children: t("You") }),
4164
- /* @__PURE__ */ jsx("th", { children: t("Garment") }),
4165
- /* @__PURE__ */ jsx("th", { children: t("Your fit") })
4139
+ const displayLength = selectedLength || recLength;
4140
+ const goodCount = fitRows.filter((r) => r.fit === "good").length;
4141
+ const matchPercent = fitRows.length > 0 ? Math.round(goodCount / fitRows.length * 100) : 0;
4142
+ const secAny = sectionResult;
4143
+ const backendLength = secAny?.length || displayLength;
4144
+ const backendSize = secAny?.size || displaySize;
4145
+ const backendAvailableLengths = secAny?.availableLengths || [];
4146
+ const finalDisplayLength = selectedLength || backendLength;
4147
+ return /* @__PURE__ */ jsxs("div", { className: "ps-tryon-sec-detail", style: { padding: "1.5vw", display: "flex", flexDirection: "column", height: "100%" }, children: [
4148
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
4149
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "0.75vw", fontWeight: 700, color: "var(--ps-accent)", textTransform: "uppercase", letterSpacing: "0.12em" }, children: t("Recommended Size") }),
4150
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "baseline", gap: "0.5vw", marginTop: "0.3vw", marginBottom: "0.4vw" }, children: [
4151
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "3.5vw", fontWeight: 300, color: "var(--ps-text-primary)", lineHeight: 1, letterSpacing: "-0.02em" }, children: backendSize }),
4152
+ finalDisplayLength && /* @__PURE__ */ jsx("span", { style: { fontSize: "1.4vw", fontWeight: 400, color: "var(--ps-text-secondary)" }, children: finalDisplayLength })
4153
+ ] }),
4154
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.4vw", marginBottom: "1.2vw" }, children: [
4155
+ /* @__PURE__ */ jsxs("svg", { width: "1vw", height: "1vw", viewBox: "0 0 16 16", fill: "none", children: [
4156
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "8", fill: "var(--ps-accent)" }),
4157
+ /* @__PURE__ */ jsx("path", { d: "M4.5 8L7 10.5L11.5 5.5", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
4158
+ ] }),
4159
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: "0.75vw", color: "var(--ps-text-secondary)" }, children: [
4160
+ matchPercent,
4161
+ "% ",
4162
+ t("Match based on your silhouette profile")
4163
+ ] })
4164
+ ] }),
4165
+ fitRows.length > 0 && /* @__PURE__ */ jsx("div", { style: { background: "white", borderRadius: "0.5vw", border: "1px solid rgba(0,0,0,0.06)", overflow: "hidden", marginBottom: "1.2vw" }, children: /* @__PURE__ */ jsxs("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
4166
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
4167
+ /* @__PURE__ */ jsx("th", { style: { textAlign: "left", padding: "0.5vw 0.6vw", fontSize: "0.6vw", fontWeight: 600, color: "var(--ps-text-secondary)", textTransform: "uppercase", letterSpacing: "0.08em", borderBottom: "1px solid rgba(0,0,0,0.06)" }, children: t("Measurement") }),
4168
+ /* @__PURE__ */ jsx("th", { style: { textAlign: "left", padding: "0.5vw 0.6vw", fontSize: "0.6vw", fontWeight: 600, color: "var(--ps-text-secondary)", textTransform: "uppercase", letterSpacing: "0.08em", borderBottom: "1px solid rgba(0,0,0,0.06)" }, children: t("Your Body") }),
4169
+ /* @__PURE__ */ jsx("th", { style: { textAlign: "left", padding: "0.5vw 0.6vw", fontSize: "0.6vw", fontWeight: 600, color: "var(--ps-text-secondary)", textTransform: "uppercase", letterSpacing: "0.08em", borderBottom: "1px solid rgba(0,0,0,0.06)" }, children: t("Garment Spec") }),
4170
+ /* @__PURE__ */ jsx("th", { style: { textAlign: "right", padding: "0.5vw 0.6vw", fontSize: "0.6vw", fontWeight: 600, color: "var(--ps-text-secondary)", textTransform: "uppercase", letterSpacing: "0.08em", borderBottom: "1px solid rgba(0,0,0,0.06)" }, children: t("Fit Result") })
4171
+ ] }) }),
4172
+ /* @__PURE__ */ jsx("tbody", { children: fitRows.map((row, i) => {
4173
+ const fitColor = row.fit === "good" ? "#2154EF" : row.fit.includes("tight") ? "#dc2626" : "#d97706";
4174
+ const fitBg = row.fit === "good" ? "rgba(33,84,239,0.08)" : row.fit.includes("tight") ? "rgba(220,38,38,0.08)" : "rgba(217,119,6,0.08)";
4175
+ return /* @__PURE__ */ jsxs("tr", { style: { borderBottom: i < fitRows.length - 1 ? "1px solid rgba(0,0,0,0.04)" : "none" }, children: [
4176
+ /* @__PURE__ */ jsx("td", { style: { padding: "0.55vw 0.6vw", fontSize: "0.75vw", fontWeight: 500, color: "var(--ps-text-primary)" }, children: row.area }),
4177
+ /* @__PURE__ */ jsxs("td", { style: { padding: "0.55vw 0.6vw", fontSize: "0.75vw", color: "var(--ps-text-secondary)" }, children: [
4178
+ row.userNum,
4179
+ " ",
4180
+ unitLbl
4181
+ ] }),
4182
+ /* @__PURE__ */ jsx("td", { style: { padding: "0.55vw 0.6vw", fontSize: "0.75vw", color: "var(--ps-text-secondary)" }, children: row.chartLabel }),
4183
+ /* @__PURE__ */ jsx("td", { style: { padding: "0.55vw 0.6vw", textAlign: "right" }, children: /* @__PURE__ */ jsx("span", { style: { fontSize: "0.6vw", fontWeight: 600, color: fitColor, background: fitBg, borderRadius: "1vw", padding: "0.15vw 0.5vw", whiteSpace: "nowrap" }, children: row.isLength ? lengthFitLabelFn(row.fit, t) : fitLabelFn(row.fit, t) }) })
4184
+ ] }, i);
4185
+ }) })
4166
4186
  ] }) }),
4167
- /* @__PURE__ */ jsx("tbody", { children: fitRows.map((row, i) => /* @__PURE__ */ jsxs("tr", { children: [
4168
- /* @__PURE__ */ jsx("td", { className: "ps-tryon-sr-ft-area", children: row.area }),
4169
- /* @__PURE__ */ jsxs("td", { className: "ps-tryon-sr-ft-you", children: [
4170
- row.userNum,
4187
+ allSizes.length > 1 && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.8vw" }, children: [
4188
+ /* @__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: [
4189
+ t("Select"),
4171
4190
  " ",
4172
- unitLbl
4191
+ sectionName,
4192
+ " ",
4193
+ t("Size")
4173
4194
  ] }),
4174
- /* @__PURE__ */ jsx("td", { className: "ps-tryon-sr-ft-garment", children: row.chartLabel }),
4175
- /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("span", { className: `ps-tryon-sr-fit-status ps-fit-${row.fit}`, children: row.isLength ? lengthFitLabelFn(row.fit, t) : fitLabelFn(row.fit, t) }) })
4176
- ] }, i)) })
4195
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "0.3vw", flexWrap: "wrap" }, children: allSizes.map((s) => {
4196
+ const isActive = s === displaySize;
4197
+ return /* @__PURE__ */ jsx(
4198
+ "button",
4199
+ {
4200
+ onClick: () => setSelectedSize(s === recSize ? null : s),
4201
+ style: {
4202
+ padding: "0.35vw 0.7vw",
4203
+ borderRadius: "0.35vw",
4204
+ fontSize: "0.7vw",
4205
+ fontWeight: 600,
4206
+ border: isActive ? "2px solid var(--ps-accent)" : "1.5px solid rgba(0,0,0,0.12)",
4207
+ background: isActive ? "var(--ps-accent)" : "transparent",
4208
+ color: isActive ? "white" : "var(--ps-text-primary)",
4209
+ cursor: "pointer",
4210
+ transition: "all 0.2s",
4211
+ fontFamily: "inherit",
4212
+ minWidth: "2vw",
4213
+ textAlign: "center"
4214
+ },
4215
+ children: s
4216
+ },
4217
+ s
4218
+ );
4219
+ }) })
4220
+ ] }),
4221
+ (backendAvailableLengths.length > 0 || lengthSizes.length > 0) && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "0.8vw" }, children: [
4222
+ /* @__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") }),
4223
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "0.3vw", flexWrap: "wrap" }, children: (backendAvailableLengths.length > 0 ? backendAvailableLengths : lengthSizes).map((s) => {
4224
+ const isActive = finalDisplayLength === s;
4225
+ return /* @__PURE__ */ jsx(
4226
+ "button",
4227
+ {
4228
+ onClick: () => setSelectedLength(s === backendLength ? null : s),
4229
+ style: {
4230
+ padding: "0.35vw 0.7vw",
4231
+ borderRadius: "0.35vw",
4232
+ fontSize: "0.7vw",
4233
+ fontWeight: 600,
4234
+ border: isActive ? "2px solid var(--ps-accent)" : "1.5px solid rgba(0,0,0,0.12)",
4235
+ background: isActive ? "var(--ps-accent)" : "transparent",
4236
+ color: isActive ? "white" : "var(--ps-text-primary)",
4237
+ cursor: "pointer",
4238
+ transition: "all 0.2s",
4239
+ fontFamily: "inherit"
4240
+ },
4241
+ children: s
4242
+ },
4243
+ s
4244
+ );
4245
+ }) })
4246
+ ] })
4177
4247
  ] }),
4178
- allSizes.length > 1 && (() => {
4179
- const recIdx = allSizes.indexOf(recSize);
4180
- const tightSize = recIdx > 0 ? allSizes[recIdx - 1] : null;
4181
- const looseSize = recIdx < allSizes.length - 1 ? allSizes[recIdx + 1] : null;
4182
- const chips = [tightSize, recSize, looseSize].filter(Boolean);
4183
- return /* @__PURE__ */ jsx("div", { className: "ps-tryon-sr-chips", children: chips.map((s) => /* @__PURE__ */ jsxs(
4248
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", paddingTop: "0.6vw", borderTop: "1px solid rgba(0,0,0,0.06)", marginTop: "auto" }, children: [
4249
+ /* @__PURE__ */ jsxs("button", { className: "ps-bp-back-btn", onClick: onBack, type: "button", style: { fontSize: "0.7vw" }, children: [
4250
+ /* @__PURE__ */ jsx("span", { className: "ps-bp-back-arrow", children: "←" }),
4251
+ " ",
4252
+ t("Back to sections")
4253
+ ] }),
4254
+ /* @__PURE__ */ jsxs(
4184
4255
  "button",
4185
4256
  {
4186
- className: `ps-tryon-sr-chip${s === displaySize ? " ps-active" : ""}${s === recSize && s !== displaySize ? " ps-recommended" : ""}`,
4187
- onClick: () => setSelectedSize(s === recSize ? null : s),
4257
+ onClick: onBack,
4258
+ style: {
4259
+ padding: "0.45vw 1.2vw",
4260
+ borderRadius: "0.4vw",
4261
+ fontSize: "0.7vw",
4262
+ fontWeight: 600,
4263
+ background: "var(--ps-accent)",
4264
+ color: "white",
4265
+ border: "none",
4266
+ cursor: "pointer",
4267
+ fontFamily: "inherit",
4268
+ display: "flex",
4269
+ alignItems: "center",
4270
+ gap: "0.3vw",
4271
+ transition: "opacity 0.2s"
4272
+ },
4273
+ onMouseEnter: (e) => e.currentTarget.style.opacity = "0.9",
4274
+ onMouseLeave: (e) => e.currentTarget.style.opacity = "1",
4188
4275
  children: [
4189
- s,
4190
- s === recSize && /* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-rec-dot" }),
4191
- s !== recSize && /* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-chip-hint", children: s === tightSize ? t("tighter") : t("looser") })
4276
+ t("Continue"),
4277
+ " "
4192
4278
  ]
4193
- },
4194
- s
4195
- )) });
4196
- })(),
4197
- lengthSizes.length > 0 && /* @__PURE__ */ jsxs("div", { className: "ps-tryon-sec-length-row", children: [
4198
- /* @__PURE__ */ jsx("span", { className: "ps-tryon-sec-length-label", children: t("Length") }),
4199
- /* @__PURE__ */ jsx("div", { className: "ps-tryon-sr-chips", children: lengthSizes.map((s) => {
4200
- const active = (selectedLength || recLength) === s;
4201
- const isRec = s === recLength;
4202
- return /* @__PURE__ */ jsxs(
4203
- "button",
4204
- {
4205
- className: `ps-tryon-sr-chip${active ? " ps-active" : ""}${isRec && !active ? " ps-recommended" : ""}`,
4206
- onClick: () => setSelectedLength(s === recLength ? null : s),
4207
- children: [
4208
- s,
4209
- isRec && /* @__PURE__ */ jsx("span", { className: "ps-tryon-sr-rec-dot" })
4210
- ]
4211
- },
4212
- s
4213
- );
4214
- }) })
4215
- ] }),
4216
- /* @__PURE__ */ jsx("div", { style: { marginTop: "0.5vw" }, children: /* @__PURE__ */ jsxs("button", { className: "ps-bp-back-btn", onClick: onBack, type: "button", children: [
4217
- /* @__PURE__ */ jsx("span", { className: "ps-bp-back-arrow", children: "←" }),
4218
- " ",
4219
- t("Back to sections")
4220
- ] }) })
4279
+ }
4280
+ )
4281
+ ] })
4221
4282
  ] });
4222
4283
  }
4223
4284
  function SizeResultView({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.4.3",
3
+ "version": "5.4.5",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",