@primestyleai/tryon 5.8.5 → 5.8.7
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 +83 -172
- package/dist/react/styles.d.ts +1 -1
- package/dist/storefront/primestyle-tryon.js +83 -172
- package/package.json +1 -1
|
@@ -10404,7 +10404,7 @@ const STYLES$1 = `
|
|
|
10404
10404
|
/* ═══════════ V2 Redesign — Editorial luxury ═══════════ */
|
|
10405
10405
|
.ps-tryon-v2 {
|
|
10406
10406
|
display: flex; gap: 1.2vw; flex: 1; min-height: 0;
|
|
10407
|
-
height:
|
|
10407
|
+
height: 100%; overflow: hidden;
|
|
10408
10408
|
}
|
|
10409
10409
|
|
|
10410
10410
|
/* Left image column — proper contained display */
|
|
@@ -16717,7 +16717,6 @@ function SizeResultView({
|
|
|
16717
16717
|
}) {
|
|
16718
16718
|
const unitLbl = sizingUnit === "cm" ? t2("cm") : t2("in");
|
|
16719
16719
|
const [editVals, setEditVals] = reactExports.useState({});
|
|
16720
|
-
const cleanNum = cleanNumFn;
|
|
16721
16720
|
const pRange = pRangeFn;
|
|
16722
16721
|
const cellVal = reactExports.useCallback((row, colIdx, header) => {
|
|
16723
16722
|
return cellValFn(row, colIdx, header);
|
|
@@ -16826,8 +16825,7 @@ function SizeResultView({
|
|
|
16826
16825
|
setGuidePreviewUrl(null);
|
|
16827
16826
|
}, [guideFile]);
|
|
16828
16827
|
const displaySize = selectedSize || origSize;
|
|
16829
|
-
|
|
16830
|
-
const displayFitRows = reactExports.useMemo(() => {
|
|
16828
|
+
reactExports.useMemo(() => {
|
|
16831
16829
|
if (!sizingResult?.matchDetails?.length) return [];
|
|
16832
16830
|
const seen = /* @__PURE__ */ new Set();
|
|
16833
16831
|
const unique = sizingResult.matchDetails.filter((m2) => {
|
|
@@ -16861,7 +16859,7 @@ function SizeResultView({
|
|
|
16861
16859
|
return { area: m2.measurement, userNum: pNumFn(m2.userValue), chartLabel, fit };
|
|
16862
16860
|
});
|
|
16863
16861
|
}, [sizingResult, displaySize, origSize, chartRangeFor]);
|
|
16864
|
-
|
|
16862
|
+
reactExports.useMemo(() => {
|
|
16865
16863
|
if (!sizeGuide?.headers || !sizeGuide?.rows || sizeColIdx < 0) return null;
|
|
16866
16864
|
const row = sizeGuide.rows.find((r2) => cellVal(r2, sizeColIdx, sizeHeader) === displaySize);
|
|
16867
16865
|
if (!row) return null;
|
|
@@ -17192,172 +17190,71 @@ function SizeResultView({
|
|
|
17192
17190
|
] }, "panel-results")
|
|
17193
17191
|
] })
|
|
17194
17192
|
) : (
|
|
17195
|
-
/* ── SINGLE-PIECE —
|
|
17196
|
-
|
|
17197
|
-
|
|
17198
|
-
|
|
17199
|
-
|
|
17200
|
-
|
|
17201
|
-
|
|
17202
|
-
|
|
17203
|
-
|
|
17204
|
-
|
|
17205
|
-
|
|
17206
|
-
|
|
17207
|
-
|
|
17208
|
-
|
|
17209
|
-
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
|
|
17215
|
-
|
|
17216
|
-
|
|
17217
|
-
|
|
17218
|
-
|
|
17219
|
-
|
|
17220
|
-
|
|
17221
|
-
|
|
17222
|
-
|
|
17223
|
-
|
|
17224
|
-
|
|
17225
|
-
|
|
17226
|
-
|
|
17227
|
-
|
|
17228
|
-
|
|
17229
|
-
|
|
17230
|
-
|
|
17193
|
+
/* ── SINGLE-PIECE — rendered via SectionDetailView for visual parity with multi-garment ── */
|
|
17194
|
+
(() => {
|
|
17195
|
+
const singleSection = sizeGuide?.found ? { headers: sizeGuide.headers || [], rows: sizeGuide.rows || [], requiredFields: sizeGuide.requiredFields || [] } : { headers: [], rows: [], requiredFields: [] };
|
|
17196
|
+
const singleResult = { recommendedSize: sizingResult?.recommendedSize || "", matchDetails: sizingResult?.matchDetails || [] };
|
|
17197
|
+
const singleUserMeasurements = {};
|
|
17198
|
+
if (sizingResult?.matchDetails) {
|
|
17199
|
+
for (const m2 of sizingResult.matchDetails) singleUserMeasurements[m2.measurement.toLowerCase()] = pNumFn(m2.userValue);
|
|
17200
|
+
}
|
|
17201
|
+
const sectionName = productTitle || t2("Size");
|
|
17202
|
+
if (isMobile) {
|
|
17203
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
17204
|
+
SectionDetailView,
|
|
17205
|
+
{
|
|
17206
|
+
sectionName,
|
|
17207
|
+
section: singleSection,
|
|
17208
|
+
sectionResult: singleResult,
|
|
17209
|
+
userMeasurements: singleUserMeasurements,
|
|
17210
|
+
unitLbl,
|
|
17211
|
+
lengthEntry: null,
|
|
17212
|
+
onBack: () => setView("body-profile"),
|
|
17213
|
+
productImage: resultImageUrl || productImage,
|
|
17214
|
+
productTitle,
|
|
17215
|
+
isMobile: true,
|
|
17216
|
+
isTryOnImage: !!resultImageUrl,
|
|
17217
|
+
showLines,
|
|
17218
|
+
onToggleLines: () => setShowLines(!showLines),
|
|
17219
|
+
onImageLoad: handleImgLoad,
|
|
17220
|
+
overlayNode: resultImageUrl && poseReady && poseLines ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
17221
|
+
MeasurementOverlay,
|
|
17222
|
+
{
|
|
17223
|
+
lines: poseLines,
|
|
17224
|
+
fitRows: (sizingResult?.matchDetails || []).map((m2) => ({ area: m2.measurement, userNum: parseFloat(m2.userValue) || 0, chartLabel: m2.chartRange || "", fit: m2.fit })),
|
|
17225
|
+
show: showLines,
|
|
17226
|
+
imgWidth: imgDims.w,
|
|
17227
|
+
imgHeight: imgDims.h
|
|
17228
|
+
}
|
|
17229
|
+
) : null,
|
|
17230
|
+
t: t2
|
|
17231
|
+
}
|
|
17232
|
+
);
|
|
17233
|
+
}
|
|
17234
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-tryon-v2", children: [
|
|
17235
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-tryon-v2-bg", style: { position: "relative" }, children: [
|
|
17236
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: resultImageUrl || productImage, alt: productTitle, className: "ps-tryon-v2-bg-img", onLoad: handleImgLoad }),
|
|
17237
|
+
resultImageUrl && poseReady && poseLines && /* @__PURE__ */ jsxRuntimeExports.jsx(MeasurementOverlay, { lines: poseLines, fitRows: (sizingResult?.matchDetails || []).map((m2) => ({ area: m2.measurement, userNum: parseFloat(m2.userValue) || 0, chartLabel: m2.chartRange || "", fit: m2.fit })), show: showLines, imgWidth: imgDims.w, imgHeight: imgDims.h }),
|
|
17238
|
+
resultImageUrl && !tryOnProcessing && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { position: "absolute", bottom: "0.5vw", left: "0.5vw", zIndex: 3, display: "flex", flexDirection: "column", gap: "0.3vw" }, children: [
|
|
17239
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ps-tryon-sr-glass-btn", onClick: () => setShowLines(!showLines), children: showLines ? t2("Hide Fit") : t2("Show Fit") }),
|
|
17240
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ps-tryon-sr-glass-btn", onClick: handleDownload, children: t2("Download") })
|
|
17231
17241
|
] })
|
|
17232
17242
|
] }),
|
|
17233
|
-
|
|
17234
|
-
|
|
17235
|
-
|
|
17236
|
-
|
|
17237
|
-
|
|
17238
|
-
|
|
17239
|
-
|
|
17240
|
-
|
|
17241
|
-
|
|
17242
|
-
|
|
17243
|
-
|
|
17244
|
-
|
|
17245
|
-
|
|
17246
|
-
|
|
17247
|
-
|
|
17248
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { children: displayFitRows.map((row, i) => /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { children: [
|
|
17249
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "ps-tryon-sr-ft-area", children: row.area }),
|
|
17250
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("td", { className: "ps-tryon-sr-ft-you", children: [
|
|
17251
|
-
row.userNum,
|
|
17252
|
-
" ",
|
|
17253
|
-
unitLbl
|
|
17254
|
-
] }),
|
|
17255
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "ps-tryon-sr-ft-garment", children: row.chartLabel }),
|
|
17256
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `ps-tryon-sr-fit-status ps-fit-${row.fit}`, children: fitLabelFn(row.fit, t2) }) })
|
|
17257
|
-
] }, i)) })
|
|
17258
|
-
] }),
|
|
17259
|
-
resultTab === "chart" && sizeGuideRow && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-tryon-sr-fit-list", children: sizeGuideRow.map((entry, i) => {
|
|
17260
|
-
const raw = cleanNum(entry.value);
|
|
17261
|
-
const isCmVal = /cm/i.test(entry.value) || /cm/i.test(entry.header);
|
|
17262
|
-
const needConvert = isCmVal && sizingUnit === "in";
|
|
17263
|
-
const nums = raw.split("–").map(Number).filter((n2) => !isNaN(n2));
|
|
17264
|
-
const display = needConvert && nums.length > 0 ? nums.map((n2) => +(n2 / 2.54).toFixed(1)).join("–") : raw;
|
|
17265
|
-
const isWeight = /weight|kg/i.test(entry.header);
|
|
17266
|
-
const wUnit = isWeight ? /kg/i.test(entry.value) ? "kg" : "lbs" : unitLbl;
|
|
17267
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-tryon-sr-fit-item", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-tryon-sr-fit-head", children: [
|
|
17268
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ps-tryon-sr-fit-area", children: entry.header }),
|
|
17269
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ps-tryon-sr-fit-range", children: [
|
|
17270
|
-
isWeight ? raw : display,
|
|
17271
|
-
" ",
|
|
17272
|
-
isWeight ? wUnit : unitLbl
|
|
17273
|
-
] })
|
|
17274
|
-
] }) }, i);
|
|
17275
|
-
}) }),
|
|
17276
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-tryon-sr-chips", children: [
|
|
17277
|
-
sizingResult.tightSize && sizingResult.tightSize !== origSize && sizingResult.tightSize !== sizingResult.looseSize && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
17278
|
-
"button",
|
|
17279
|
-
{
|
|
17280
|
-
className: `ps-tryon-sr-chip${displaySize === sizingResult.tightSize ? " ps-active" : ""}`,
|
|
17281
|
-
onClick: () => setSelectedSize(sizingResult.tightSize),
|
|
17282
|
-
children: [
|
|
17283
|
-
sizingResult.tightSize,
|
|
17284
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ps-tryon-sr-chip-hint", children: t2("tighter") })
|
|
17285
|
-
]
|
|
17286
|
-
}
|
|
17287
|
-
),
|
|
17288
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
17289
|
-
"button",
|
|
17290
|
-
{
|
|
17291
|
-
className: `ps-tryon-sr-chip ps-recommended${displaySize === origSize ? " ps-active" : ""}`,
|
|
17292
|
-
onClick: () => setSelectedSize(null),
|
|
17293
|
-
children: [
|
|
17294
|
-
origSize,
|
|
17295
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ps-tryon-sr-rec-dot" })
|
|
17296
|
-
]
|
|
17297
|
-
}
|
|
17298
|
-
),
|
|
17299
|
-
sizingResult.looseSize && sizingResult.looseSize !== origSize && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
17300
|
-
"button",
|
|
17301
|
-
{
|
|
17302
|
-
className: `ps-tryon-sr-chip${displaySize === sizingResult.looseSize ? " ps-active" : ""}`,
|
|
17303
|
-
onClick: () => setSelectedSize(sizingResult.looseSize),
|
|
17304
|
-
children: [
|
|
17305
|
-
sizingResult.looseSize,
|
|
17306
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ps-tryon-sr-chip-hint", children: t2("looser") })
|
|
17307
|
-
]
|
|
17308
|
-
}
|
|
17309
|
-
)
|
|
17310
|
-
] }),
|
|
17311
|
-
displayFitRows.length === 0 && !sizeGuideRow && sizingResult.reasoning && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-tryon-sr-reasoning", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: sizingResult.reasoning }) }),
|
|
17312
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-bp-nav", children: [
|
|
17313
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "ps-bp-back-btn", onClick: () => setView("body-profile"), type: "button", children: [
|
|
17314
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ps-bp-back-arrow", children: "←" }),
|
|
17315
|
-
" ",
|
|
17316
|
-
t2("Back")
|
|
17317
|
-
] }),
|
|
17318
|
-
!resultImageUrl && !tryOnProcessing && /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "ps-bp-next-btn", onClick: () => {
|
|
17319
|
-
setGuideFile(null);
|
|
17320
|
-
setShowPhotoGuide(true);
|
|
17321
|
-
}, children: [
|
|
17322
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CameraIcon$1, { size: 14 }),
|
|
17323
|
-
" ",
|
|
17324
|
-
t2("Try It On")
|
|
17325
|
-
] }),
|
|
17326
|
-
tryOnProcessing && !resultImageUrl && /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "ps-bp-next-btn", disabled: true, children: [
|
|
17327
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-tryon-size-loading-spinner", style: { width: "0.9vw", height: "0.9vw", borderWidth: "1.5px", display: "inline-block" } }),
|
|
17328
|
-
" ",
|
|
17329
|
-
t2("Processing...")
|
|
17330
|
-
] }),
|
|
17331
|
-
resultImageUrl && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
17332
|
-
"button",
|
|
17333
|
-
{
|
|
17334
|
-
className: "ps-bp-next-btn",
|
|
17335
|
-
disabled: retryLoading,
|
|
17336
|
-
onClick: () => {
|
|
17337
|
-
const fitInfo = (sizingResult?.matchDetails || []).map((m2) => ({
|
|
17338
|
-
area: m2.measurement,
|
|
17339
|
-
fit: m2.fit,
|
|
17340
|
-
userValue: parseFloat(m2.userValue) || void 0,
|
|
17341
|
-
garmentRange: m2.chartRange || void 0
|
|
17342
|
-
}));
|
|
17343
|
-
onRetryWithFit(fitInfo);
|
|
17344
|
-
},
|
|
17345
|
-
children: retryLoading ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
17346
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-tryon-size-loading-spinner", style: { width: "0.9vw", height: "0.9vw", borderWidth: "1.5px", display: "inline-block" } }),
|
|
17347
|
-
" ",
|
|
17348
|
-
t2("Generating...")
|
|
17349
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
17350
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CameraIcon$1, { size: 14 }),
|
|
17351
|
-
" ",
|
|
17352
|
-
t2("Try on size"),
|
|
17353
|
-
" ",
|
|
17354
|
-
displaySize
|
|
17355
|
-
] })
|
|
17356
|
-
}
|
|
17357
|
-
)
|
|
17358
|
-
] })
|
|
17359
|
-
] })
|
|
17360
|
-
] })
|
|
17243
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-tryon-v2-panel", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
17244
|
+
SectionDetailView,
|
|
17245
|
+
{
|
|
17246
|
+
sectionName,
|
|
17247
|
+
section: singleSection,
|
|
17248
|
+
sectionResult: singleResult,
|
|
17249
|
+
userMeasurements: singleUserMeasurements,
|
|
17250
|
+
unitLbl,
|
|
17251
|
+
lengthEntry: null,
|
|
17252
|
+
onBack: () => setView("body-profile"),
|
|
17253
|
+
t: t2
|
|
17254
|
+
}
|
|
17255
|
+
) }, "panel-single")
|
|
17256
|
+
] });
|
|
17257
|
+
})()
|
|
17361
17258
|
),
|
|
17362
17259
|
showPhotoGuide && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-tryon-sr-chart-overlay", children: isMobile ? (
|
|
17363
17260
|
/* ── Mobile: same layout as the AI-sizing photo step
|
|
@@ -20159,7 +20056,8 @@ function PrimeStyleTryonInner({
|
|
|
20159
20056
|
setView("body-profile");
|
|
20160
20057
|
break;
|
|
20161
20058
|
case "profiles":
|
|
20162
|
-
|
|
20059
|
+
setView(prevViewRef.current || "body-profile");
|
|
20060
|
+
prevViewRef.current = null;
|
|
20163
20061
|
break;
|
|
20164
20062
|
default:
|
|
20165
20063
|
handleClose();
|
|
@@ -21155,12 +21053,25 @@ function PrimeStyleTryonInner({
|
|
|
21155
21053
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cx("ps-tryon-overlay", cn.overlay), style: cssVars, "data-ps-tryon-portal": true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cx(`ps-tryon-modal${view === "result" && resultImageUrl && sizingResult || view === "size-result" || view === "estimation-review" || view === "body-profile" || view === "profiles" ? " ps-tryon-modal-wide" : ""}${view === "profiles" ? " ps-tryon-modal-tall" : ""}`, cn.modal), onClick: (e) => e.stopPropagation(), children: [
|
|
21156
21054
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cx("ps-tryon-header ps-tryon-header-minimal", cn.header), children: [
|
|
21157
21055
|
/* @__PURE__ */ jsxRuntimeExports.jsx(LangSwitcher, { activeLocale, onSelect: setActiveLocale }),
|
|
21158
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ps-tryon-header-icon", title: t2("Profiles"), onClick: () =>
|
|
21056
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ps-tryon-header-icon", title: t2("Profiles"), onClick: () => {
|
|
21057
|
+
if (drawer) setDrawer(null);
|
|
21058
|
+
if (view === "profiles") {
|
|
21059
|
+
setView(prevViewRef.current || "body-profile");
|
|
21060
|
+
prevViewRef.current = null;
|
|
21061
|
+
} else {
|
|
21062
|
+
prevViewRef.current = view;
|
|
21063
|
+
setView("profiles");
|
|
21064
|
+
}
|
|
21065
|
+
}, children: /* @__PURE__ */ jsxRuntimeExports.jsx(UserIcon, {}) }),
|
|
21159
21066
|
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ps-tryon-header-icon", title: t2("History"), onClick: () => {
|
|
21067
|
+
if (view === "profiles") {
|
|
21068
|
+
setView(prevViewRef.current || "body-profile");
|
|
21069
|
+
prevViewRef.current = null;
|
|
21070
|
+
}
|
|
21160
21071
|
if (drawer === "history") {
|
|
21161
21072
|
setDrawer(null);
|
|
21162
21073
|
} else {
|
|
21163
|
-
prevViewRef.current = view;
|
|
21074
|
+
prevViewRef.current = prevViewRef.current || view;
|
|
21164
21075
|
setDrawer("history");
|
|
21165
21076
|
}
|
|
21166
21077
|
}, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ClockIcon, {}) }),
|