@primestyleai/tryon 3.8.0 → 3.9.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/PrimeStyleTryon.d.ts +1 -0
- package/dist/i18n/cs.d.ts +5 -0
- package/dist/i18n/da.d.ts +5 -0
- package/dist/i18n/de.d.ts +5 -0
- package/dist/i18n/en.d.ts +9 -0
- package/dist/i18n/es.d.ts +5 -0
- package/dist/i18n/fi.d.ts +5 -0
- package/dist/i18n/fr.d.ts +5 -0
- package/dist/i18n/index.d.ts +37 -0
- package/dist/i18n/it.d.ts +5 -0
- package/dist/i18n/ja.d.ts +5 -0
- package/dist/i18n/ko.d.ts +5 -0
- package/dist/i18n/nb.d.ts +5 -0
- package/dist/i18n/nl.d.ts +5 -0
- package/dist/i18n/pl.d.ts +5 -0
- package/dist/i18n/pt-br.d.ts +5 -0
- package/dist/i18n/pt-pt.d.ts +5 -0
- package/dist/i18n/sv.d.ts +5 -0
- package/dist/i18n/th.d.ts +5 -0
- package/dist/i18n/tr.d.ts +5 -0
- package/dist/i18n/zh-cn.d.ts +5 -0
- package/dist/i18n/zh-tw.d.ts +5 -0
- package/dist/index-B0KE3c8S.js +2951 -0
- package/dist/index.d.ts +2 -0
- package/dist/primestyle-tryon.js +35 -24
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +139 -121
- package/package.json +1 -1
- package/dist/image-utils-C9bJ1zKO.js +0 -186
package/dist/react/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect,
|
|
4
|
-
import { A as ApiClient, S as SseClient, i as isValidImageFile,
|
|
3
|
+
import { useState, useEffect, useMemo, useRef, useCallback } from "react";
|
|
4
|
+
import { c as createT, A as ApiClient, S as SseClient, i as isValidImageFile, a as compressImage, P as PrimeStyleError } from "../index-B0KE3c8S.js";
|
|
5
5
|
const HEADER_ALIASES = {
|
|
6
6
|
// ── Size label columns (skipped during field derivation) ──
|
|
7
7
|
size: "__size__",
|
|
@@ -524,11 +524,12 @@ function PrimeStyleTryon(props) {
|
|
|
524
524
|
function PrimeStyleTryonInner({
|
|
525
525
|
productImage,
|
|
526
526
|
productTitle = "Product",
|
|
527
|
-
buttonText
|
|
527
|
+
buttonText,
|
|
528
528
|
apiUrl,
|
|
529
529
|
showPoweredBy = true,
|
|
530
530
|
showIcon = true,
|
|
531
531
|
buttonIcon,
|
|
532
|
+
locale,
|
|
532
533
|
buttonStyles: btnS = {},
|
|
533
534
|
modalStyles: mdlS = {},
|
|
534
535
|
classNames: cn = {},
|
|
@@ -542,6 +543,8 @@ function PrimeStyleTryonInner({
|
|
|
542
543
|
onError,
|
|
543
544
|
sizeGuideData
|
|
544
545
|
}) {
|
|
546
|
+
const t = useMemo(() => createT(locale), [locale]);
|
|
547
|
+
const resolvedButtonText = buttonText ?? t("Virtual Try-On");
|
|
545
548
|
const [view, setView] = useState("idle");
|
|
546
549
|
const [selectedFile, setSelectedFile] = useState(null);
|
|
547
550
|
const [previewUrl, setPreviewUrl] = useState(null);
|
|
@@ -610,12 +613,12 @@ function PrimeStyleTryonInner({
|
|
|
610
613
|
if (progressIntervalRef.current) return;
|
|
611
614
|
progressRef.current = 0;
|
|
612
615
|
const statuses = [
|
|
613
|
-
{ at: 0, text: "Preparing your image..." },
|
|
614
|
-
{ at: 15, text: "Analyzing body proportions..." },
|
|
615
|
-
{ at: 30, text: "Matching garment to your photo..." },
|
|
616
|
-
{ at: 50, text: "Generating virtual try-on..." },
|
|
617
|
-
{ at: 75, text: "Refining details..." },
|
|
618
|
-
{ at: 90, text: "Almost there..." }
|
|
616
|
+
{ at: 0, text: t("Preparing your image...") },
|
|
617
|
+
{ at: 15, text: t("Analyzing body proportions...") },
|
|
618
|
+
{ at: 30, text: t("Matching garment to your photo...") },
|
|
619
|
+
{ at: 50, text: t("Generating virtual try-on...") },
|
|
620
|
+
{ at: 75, text: t("Refining details...") },
|
|
621
|
+
{ at: 90, text: t("Almost there...") }
|
|
619
622
|
];
|
|
620
623
|
progressIntervalRef.current = setInterval(() => {
|
|
621
624
|
const p = progressRef.current;
|
|
@@ -751,13 +754,13 @@ function PrimeStyleTryonInner({
|
|
|
751
754
|
}, [onClose, previewUrl]);
|
|
752
755
|
const handleFileSelect = useCallback((file) => {
|
|
753
756
|
if (!isValidImageFile(file)) {
|
|
754
|
-
setErrorMessage("Please upload a JPEG, PNG, or WebP image.");
|
|
757
|
+
setErrorMessage(t("Please upload a JPEG, PNG, or WebP image."));
|
|
755
758
|
setView("error");
|
|
756
759
|
onError?.({ message: "Invalid file type", code: "INVALID_FILE" });
|
|
757
760
|
return;
|
|
758
761
|
}
|
|
759
762
|
if (file.size > 10 * 1024 * 1024) {
|
|
760
|
-
setErrorMessage("Image must be under 10MB.");
|
|
763
|
+
setErrorMessage(t("Image must be under 10MB."));
|
|
761
764
|
setView("error");
|
|
762
765
|
onError?.({ message: "File too large", code: "FILE_TOO_LARGE" });
|
|
763
766
|
return;
|
|
@@ -791,7 +794,7 @@ function PrimeStyleTryonInner({
|
|
|
791
794
|
progressRef.current = 100;
|
|
792
795
|
if (progressBarRef.current) progressBarRef.current.style.width = "100%";
|
|
793
796
|
if (progressTextRef.current) progressTextRef.current.textContent = "100%";
|
|
794
|
-
if (progressStatusRef.current) progressStatusRef.current.textContent = "Complete!";
|
|
797
|
+
if (progressStatusRef.current) progressStatusRef.current.textContent = t("Complete!");
|
|
795
798
|
cleanupJob();
|
|
796
799
|
setTimeout(() => setView("result"), 400);
|
|
797
800
|
onComplete?.({ jobId: update.galleryId, imageUrl: update.imageUrl });
|
|
@@ -800,7 +803,7 @@ function PrimeStyleTryonInner({
|
|
|
800
803
|
if (!completedRef.current) {
|
|
801
804
|
completedRef.current = true;
|
|
802
805
|
cleanupJob();
|
|
803
|
-
const msg = update.error || "Try-on generation failed";
|
|
806
|
+
const msg = update.error || t("Try-on generation failed");
|
|
804
807
|
setErrorMessage(msg);
|
|
805
808
|
setView("error");
|
|
806
809
|
onError?.({ message: msg });
|
|
@@ -875,7 +878,7 @@ function PrimeStyleTryonInner({
|
|
|
875
878
|
}, [apiUrl, sizingMethod, sizingCountry, heightUnit, weightUnit, sizingUnit, sizeGuide, productTitle, dynamicFields]);
|
|
876
879
|
const handleTryOnSubmit = useCallback(async () => {
|
|
877
880
|
if (!selectedFile || !apiRef.current || !sseRef.current) {
|
|
878
|
-
const msg = !apiRef.current ? "
|
|
881
|
+
const msg = !apiRef.current ? t("SDK not configured. Please provide an API key.") : t("Something went wrong");
|
|
879
882
|
setErrorMessage(msg);
|
|
880
883
|
setView("error");
|
|
881
884
|
onError?.({ message: msg, code: "SDK_NOT_CONFIGURED" });
|
|
@@ -910,7 +913,7 @@ function PrimeStyleTryonInner({
|
|
|
910
913
|
}
|
|
911
914
|
}, 3e3);
|
|
912
915
|
} catch (err) {
|
|
913
|
-
const message = err instanceof Error ? err.message : "Failed to start try-on";
|
|
916
|
+
const message = err instanceof Error ? err.message : t("Failed to start try-on");
|
|
914
917
|
const code = err instanceof PrimeStyleError ? err.code : void 0;
|
|
915
918
|
setErrorMessage(message);
|
|
916
919
|
setView("error");
|
|
@@ -1084,12 +1087,13 @@ function PrimeStyleTryonInner({
|
|
|
1084
1087
|
}, []);
|
|
1085
1088
|
const shoeField = useMemo(() => {
|
|
1086
1089
|
const map = {
|
|
1087
|
-
US: { key: "shoeUS",
|
|
1088
|
-
UK: { key: "shoeUK",
|
|
1089
|
-
AU: { key: "shoeUK",
|
|
1090
|
+
US: { key: "shoeUS", labelKey: "Shoe size (US)", ph: "e.g. 10" },
|
|
1091
|
+
UK: { key: "shoeUK", labelKey: "Shoe size (UK)", ph: "e.g. 9" },
|
|
1092
|
+
AU: { key: "shoeUK", labelKey: "Shoe size (UK)", ph: "e.g. 9" }
|
|
1090
1093
|
};
|
|
1091
|
-
|
|
1092
|
-
|
|
1094
|
+
const raw = map[sizingCountry] || { key: "shoeEU", labelKey: "Shoe size (EU)", ph: "e.g. 43" };
|
|
1095
|
+
return { key: raw.key, label: t(raw.labelKey), ph: raw.ph };
|
|
1096
|
+
}, [sizingCountry, t]);
|
|
1093
1097
|
const rootVars = {
|
|
1094
1098
|
"--ps-btn-bg": btnS.backgroundColor,
|
|
1095
1099
|
"--ps-btn-color": btnS.textColor,
|
|
@@ -1133,7 +1137,7 @@ function PrimeStyleTryonInner({
|
|
|
1133
1137
|
i > 1 && /* @__PURE__ */ jsx("div", { className: `ps-tryon-stepper-line${i <= stepIndex ? " ps-done" : ""}` }),
|
|
1134
1138
|
/* @__PURE__ */ jsxs("div", { className: `ps-tryon-stepper-step${i < stepIndex ? " ps-done" : i === stepIndex ? " ps-active" : ""}`, children: [
|
|
1135
1139
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-stepper-circle", children: i < stepIndex ? /* @__PURE__ */ jsx(CheckIcon, {}) : i }),
|
|
1136
|
-
/* @__PURE__ */ jsx("div", { className: "ps-tryon-stepper-label", children: STEP_LABELS[i] })
|
|
1140
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-stepper-label", children: t(STEP_LABELS[i]) })
|
|
1137
1141
|
] })
|
|
1138
1142
|
] }, i)) }) });
|
|
1139
1143
|
}
|
|
@@ -1162,33 +1166,35 @@ function PrimeStyleTryonInner({
|
|
|
1162
1166
|
/* @__PURE__ */ jsx("img", { src: productImage, alt: "Product", className: "ps-tryon-welcome-product" }),
|
|
1163
1167
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-welcome-sparkle", children: /* @__PURE__ */ jsx(SparkleIcon, { size: 20 }) })
|
|
1164
1168
|
] }),
|
|
1165
|
-
/* @__PURE__ */ jsx("h2", { className: "ps-tryon-welcome-title", children: "Find Your Perfect Size" }),
|
|
1166
|
-
/* @__PURE__ */ jsx("p", { className: "ps-tryon-welcome-sub", children: "Get your size instantly, then try it on" })
|
|
1169
|
+
/* @__PURE__ */ jsx("h2", { className: "ps-tryon-welcome-title", children: t("Find Your Perfect Size") }),
|
|
1170
|
+
/* @__PURE__ */ jsx("p", { className: "ps-tryon-welcome-sub", children: t("Get your size instantly, then try it on") })
|
|
1167
1171
|
] }),
|
|
1168
1172
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-features", children: [
|
|
1169
|
-
{ icon: /* @__PURE__ */ jsx(RulerIcon, {}), title: "Get Your Size", desc: "Instant fit recommendation" },
|
|
1170
|
-
{ icon: /* @__PURE__ */ jsx(CameraIcon, {}), title: "Try It On", desc: "See how it looks on you" }
|
|
1173
|
+
{ icon: /* @__PURE__ */ jsx(RulerIcon, {}), title: t("Get Your Size"), desc: t("Instant fit recommendation") },
|
|
1174
|
+
{ icon: /* @__PURE__ */ jsx(CameraIcon, {}), title: t("Try It On"), desc: t("See how it looks on you") }
|
|
1171
1175
|
].map((f, i) => /* @__PURE__ */ jsxs("div", { className: "ps-tryon-feature", children: [
|
|
1172
1176
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-feature-icon", children: f.icon }),
|
|
1173
1177
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-feature-title", children: f.title }),
|
|
1174
1178
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-feature-desc", children: f.desc })
|
|
1175
1179
|
] }, i)) }),
|
|
1176
1180
|
/* @__PURE__ */ jsxs("button", { className: "ps-tryon-cta", onClick: () => setView("sizing-choice"), children: [
|
|
1177
|
-
"Find My Size
|
|
1181
|
+
t("Find My Size"),
|
|
1182
|
+
" ",
|
|
1178
1183
|
/* @__PURE__ */ jsx(ArrowRightIcon, {})
|
|
1179
1184
|
] }),
|
|
1180
|
-
/* @__PURE__ */ jsx("div", { className: "ps-tryon-welcome-note", children: "Takes less than a minute" })
|
|
1185
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-welcome-note", children: t("Takes less than a minute") })
|
|
1181
1186
|
] });
|
|
1182
1187
|
}
|
|
1183
1188
|
function UploadView() {
|
|
1184
1189
|
return /* @__PURE__ */ jsx(Fragment, { children: selectedFile && previewUrl ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1185
1190
|
/* @__PURE__ */ jsxs("div", { className: cx("ps-tryon-preview", cn.preview), children: [
|
|
1186
1191
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-preview-blur", style: { backgroundImage: `url(${previewUrl})` } }),
|
|
1187
|
-
/* @__PURE__ */ jsx("img", { src: previewUrl, alt: "Your photo", className: cn.previewImage }),
|
|
1192
|
+
/* @__PURE__ */ jsx("img", { src: previewUrl, alt: t("Your photo"), className: cn.previewImage }),
|
|
1188
1193
|
/* @__PURE__ */ jsx("button", { onClick: handleRemovePreview, className: cx("ps-tryon-preview-remove", cn.removeButton), children: "×" })
|
|
1189
1194
|
] }),
|
|
1190
1195
|
/* @__PURE__ */ jsxs("button", { onClick: handleTryOnSubmit, className: cx("ps-tryon-submit", cn.submitButton), children: [
|
|
1191
|
-
"Try It On
|
|
1196
|
+
t("Try It On"),
|
|
1197
|
+
" ",
|
|
1192
1198
|
/* @__PURE__ */ jsx(ArrowRightIcon, {})
|
|
1193
1199
|
] })
|
|
1194
1200
|
] }) : /* @__PURE__ */ jsxs(
|
|
@@ -1222,8 +1228,8 @@ function PrimeStyleTryonInner({
|
|
|
1222
1228
|
}
|
|
1223
1229
|
),
|
|
1224
1230
|
/* @__PURE__ */ jsx(UploadIcon, {}),
|
|
1225
|
-
/* @__PURE__ */ jsx("p", { className: cx("ps-tryon-upload-text", cn.uploadText), children: "Upload a full body photo" }),
|
|
1226
|
-
/* @__PURE__ */ jsx("p", { className: cx("ps-tryon-upload-hint", cn.uploadHint), children: "JPEG, PNG or WebP (max 10MB)" })
|
|
1231
|
+
/* @__PURE__ */ jsx("p", { className: cx("ps-tryon-upload-text", cn.uploadText), children: t("Upload a full body photo") }),
|
|
1232
|
+
/* @__PURE__ */ jsx("p", { className: cx("ps-tryon-upload-hint", cn.uploadHint), children: t("JPEG, PNG or WebP (max 10MB)") })
|
|
1227
1233
|
]
|
|
1228
1234
|
}
|
|
1229
1235
|
) });
|
|
@@ -1235,16 +1241,17 @@ function PrimeStyleTryonInner({
|
|
|
1235
1241
|
return /* @__PURE__ */ jsx("div", { className: "ps-tryon-sizing-choice", children: /* @__PURE__ */ jsxs("div", { className: "ps-tryon-sg-checking", children: [
|
|
1236
1242
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-sg-checking-icon", children: /* @__PURE__ */ jsx(RulerIcon, { size: 32 }) }),
|
|
1237
1243
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-sg-checking-bar-wrap", children: /* @__PURE__ */ jsx("div", { className: "ps-tryon-sg-checking-bar" }) }),
|
|
1238
|
-
/* @__PURE__ */ jsx("h3", { className: "ps-tryon-section-title", children: "Checking size guide..." }),
|
|
1239
|
-
/* @__PURE__ */ jsx("p", { className: "ps-tryon-sg-checking-sub", children: "Looking for size chart data for this product" })
|
|
1244
|
+
/* @__PURE__ */ jsx("h3", { className: "ps-tryon-section-title", children: t("Checking size guide...") }),
|
|
1245
|
+
/* @__PURE__ */ jsx("p", { className: "ps-tryon-sg-checking-sub", children: t("Looking for size chart data for this product") })
|
|
1240
1246
|
] }) });
|
|
1241
1247
|
}
|
|
1242
1248
|
return /* @__PURE__ */ jsxs("div", { className: "ps-tryon-sizing-choice", children: [
|
|
1243
|
-
/* @__PURE__ */ jsx("h3", { className: "ps-tryon-section-title", children: "How would you like to find your size?" }),
|
|
1244
|
-
sgChecked && !sgAvailable && /* @__PURE__ */ jsx("div", { className: "ps-tryon-sg-notice", children: "Size guide is not available for this product — sizing will use standard measurements" }),
|
|
1249
|
+
/* @__PURE__ */ jsx("h3", { className: "ps-tryon-section-title", children: t("How would you like to find your size?") }),
|
|
1250
|
+
sgChecked && !sgAvailable && /* @__PURE__ */ jsx("div", { className: "ps-tryon-sg-notice", children: t("Size guide is not available for this product — sizing will use standard measurements") }),
|
|
1245
1251
|
sgChecked && sgAvailable && /* @__PURE__ */ jsxs("div", { className: "ps-tryon-sg-notice ps-tryon-sg-found", children: [
|
|
1246
1252
|
/* @__PURE__ */ jsx(CheckIcon, { size: 14 }),
|
|
1247
|
-
"
|
|
1253
|
+
" ",
|
|
1254
|
+
t("Size guide found for this product")
|
|
1248
1255
|
] }),
|
|
1249
1256
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-choice-cards", children: [
|
|
1250
1257
|
/* @__PURE__ */ jsxs("button", { className: "ps-tryon-choice-card", onClick: () => {
|
|
@@ -1253,10 +1260,10 @@ function PrimeStyleTryonInner({
|
|
|
1253
1260
|
}, children: [
|
|
1254
1261
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-icon", children: /* @__PURE__ */ jsx(RulerIcon, { size: 24 }) }),
|
|
1255
1262
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-choice-info", children: [
|
|
1256
|
-
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-title", children: "Enter my measurements" }),
|
|
1257
|
-
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-desc", children: sizeGuide?.requiredFields?.length ? sizeGuide.requiredFields.filter((f) => f.required).slice(0, 3).map((f) => f.label).join(", ") + (sizeGuide.requiredFields.length > 3 ? "
|
|
1263
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-title", children: t("Enter my measurements") }),
|
|
1264
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-desc", children: sizeGuide?.requiredFields?.length ? sizeGuide.requiredFields.filter((f) => f.required).slice(0, 3).map((f) => t(f.label)).join(", ") + (sizeGuide.requiredFields.length > 3 ? ` ${t("& more")}` : "") : t("Chest, waist, hips, shoes & more") })
|
|
1258
1265
|
] }),
|
|
1259
|
-
/* @__PURE__ */ jsx("span", { className: "ps-tryon-choice-badge", children: "Best accuracy" })
|
|
1266
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-choice-badge", children: t("Best accuracy") })
|
|
1260
1267
|
] }),
|
|
1261
1268
|
/* @__PURE__ */ jsxs("button", { className: "ps-tryon-choice-card", onClick: () => {
|
|
1262
1269
|
setSizingMethod("quick");
|
|
@@ -1264,8 +1271,8 @@ function PrimeStyleTryonInner({
|
|
|
1264
1271
|
}, children: [
|
|
1265
1272
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-icon", children: /* @__PURE__ */ jsx(SparkleIcon, { size: 24 }) }),
|
|
1266
1273
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-choice-info", children: [
|
|
1267
|
-
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-title", children: "Just height & weight" }),
|
|
1268
|
-
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-desc", children: "Quick estimate in seconds" })
|
|
1274
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-title", children: t("Just height & weight") }),
|
|
1275
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-desc", children: t("Quick estimate in seconds") })
|
|
1269
1276
|
] })
|
|
1270
1277
|
] }),
|
|
1271
1278
|
/* @__PURE__ */ jsxs("button", { className: "ps-tryon-choice-card", onClick: () => {
|
|
@@ -1274,8 +1281,8 @@ function PrimeStyleTryonInner({
|
|
|
1274
1281
|
}, children: [
|
|
1275
1282
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-icon", children: /* @__PURE__ */ jsx(CameraIcon, { size: 24 }) }),
|
|
1276
1283
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-choice-info", children: [
|
|
1277
|
-
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-title", children: "Skip, just try it on" }),
|
|
1278
|
-
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-desc", children: "Upload a photo to see how it looks" })
|
|
1284
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-title", children: t("Skip, just try it on") }),
|
|
1285
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-choice-desc", children: t("Upload a photo to see how it looks") })
|
|
1279
1286
|
] })
|
|
1280
1287
|
] })
|
|
1281
1288
|
] })
|
|
@@ -1289,37 +1296,38 @@ function PrimeStyleTryonInner({
|
|
|
1289
1296
|
return /* @__PURE__ */ jsxs("div", { className: "ps-tryon-sizing-form", children: [
|
|
1290
1297
|
/* @__PURE__ */ jsxs("button", { className: "ps-tryon-back", onClick: () => setView("sizing-choice"), children: [
|
|
1291
1298
|
/* @__PURE__ */ jsx(ArrowLeftIcon, {}),
|
|
1292
|
-
"
|
|
1299
|
+
" ",
|
|
1300
|
+
t("Back")
|
|
1293
1301
|
] }),
|
|
1294
1302
|
sizingMethod === "exact" && profiles.length > 0 && /* @__PURE__ */ jsx("div", { className: "ps-tryon-profile-bar", children: /* @__PURE__ */ jsxs("select", { className: "ps-tryon-profile-select", value: activeProfileId || "", onChange: (e) => {
|
|
1295
1303
|
if (e.target.value) applyProfile(e.target.value);
|
|
1296
1304
|
}, children: [
|
|
1297
|
-
/* @__PURE__ */ jsx("option", { value: "", children: "Auto-fill from saved profile..." }),
|
|
1305
|
+
/* @__PURE__ */ jsx("option", { value: "", children: t("Auto-fill from saved profile...") }),
|
|
1298
1306
|
profiles.map((p) => /* @__PURE__ */ jsxs("option", { value: p.id, children: [
|
|
1299
1307
|
p.name,
|
|
1300
1308
|
" (",
|
|
1301
|
-
p.gender === "female" ? "Women's" : "Men's",
|
|
1309
|
+
p.gender === "female" ? t("Women's") : t("Men's"),
|
|
1302
1310
|
")"
|
|
1303
1311
|
] }, p.id))
|
|
1304
1312
|
] }) }),
|
|
1305
1313
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-input-row", children: [
|
|
1306
|
-
/* @__PURE__ */ jsx("label", { children: "I'm shopping for" }),
|
|
1314
|
+
/* @__PURE__ */ jsx("label", { children: t("I'm shopping for") }),
|
|
1307
1315
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-unit-toggle", children: [
|
|
1308
1316
|
/* @__PURE__ */ jsx("button", { className: `ps-tryon-unit-btn${!isFemale ? " ps-active" : ""}`, onClick: () => {
|
|
1309
1317
|
updateField("gender", "male");
|
|
1310
1318
|
setFormGender("male");
|
|
1311
|
-
}, children: "Men's" }),
|
|
1319
|
+
}, children: t("Men's") }),
|
|
1312
1320
|
/* @__PURE__ */ jsx("button", { className: `ps-tryon-unit-btn${isFemale ? " ps-active" : ""}`, onClick: () => {
|
|
1313
1321
|
updateField("gender", "female");
|
|
1314
1322
|
setFormGender("female");
|
|
1315
|
-
}, children: "Women's" })
|
|
1323
|
+
}, children: t("Women's") })
|
|
1316
1324
|
] })
|
|
1317
1325
|
] }),
|
|
1318
1326
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-input-row", children: [
|
|
1319
|
-
/* @__PURE__ */ jsx("label", { children: "Sizing region" }),
|
|
1320
|
-
/* @__PURE__ */ jsx("select", { className: "ps-tryon-country-select", value: sizingCountry, onChange: (e) => setSizingCountry(e.target.value), children: SIZING_COUNTRIES.map((c) => /* @__PURE__ */ jsx("option", { value: c.code, children: c.label }, c.code)) })
|
|
1327
|
+
/* @__PURE__ */ jsx("label", { children: t("Sizing region") }),
|
|
1328
|
+
/* @__PURE__ */ jsx("select", { className: "ps-tryon-country-select", value: sizingCountry, onChange: (e) => setSizingCountry(e.target.value), children: SIZING_COUNTRIES.map((c) => /* @__PURE__ */ jsx("option", { value: c.code, children: t(c.label) }, c.code)) })
|
|
1321
1329
|
] }),
|
|
1322
|
-
sizingMethod === "exact" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(UnitToggle, { options: [{ label: "cm", value: "cm" }, { label: "in", value: "in" }], value: sizingUnit, onChange: (v) => {
|
|
1330
|
+
sizingMethod === "exact" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(UnitToggle, { options: [{ label: t("cm"), value: "cm" }, { label: t("in"), value: "in" }], value: sizingUnit, onChange: (v) => {
|
|
1323
1331
|
setSizingUnit(v);
|
|
1324
1332
|
setHeightUnit(v === "cm" ? "cm" : "ft");
|
|
1325
1333
|
setWeightUnit(v === "cm" ? "kg" : "lbs");
|
|
@@ -1336,7 +1344,7 @@ function PrimeStyleTryonInner({
|
|
|
1336
1344
|
const showOriginal = field.key !== key;
|
|
1337
1345
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
1338
1346
|
/* @__PURE__ */ jsx(InputRow, { label: `${regionField.label}${field.required ? " *" : ""}`, fieldKey: key, placeholder: regionField.ph }),
|
|
1339
|
-
showOriginal && /* @__PURE__ */ jsx(InputRow, { label: field.label, fieldKey: field.key, placeholder: field.placeholder })
|
|
1347
|
+
showOriginal && /* @__PURE__ */ jsx(InputRow, { label: t(field.label), fieldKey: field.key, placeholder: field.placeholder })
|
|
1340
1348
|
] }, field.key);
|
|
1341
1349
|
}
|
|
1342
1350
|
const phNum = parseFloat(field.placeholder?.replace(/[^0-9.]/g, "") || "");
|
|
@@ -1345,7 +1353,7 @@ function PrimeStyleTryonInner({
|
|
|
1345
1353
|
return /* @__PURE__ */ jsx(
|
|
1346
1354
|
InputRow,
|
|
1347
1355
|
{
|
|
1348
|
-
label: `${field.label}${field.required ? " *" : ""}`,
|
|
1356
|
+
label: `${t(field.label)}${field.required ? " *" : ""}`,
|
|
1349
1357
|
fieldKey: field.key,
|
|
1350
1358
|
placeholder,
|
|
1351
1359
|
type: "number",
|
|
@@ -1370,11 +1378,11 @@ function PrimeStyleTryonInner({
|
|
|
1370
1378
|
const allOptFields = [...optFields, ...profileExtras];
|
|
1371
1379
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1372
1380
|
reqFields.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1373
|
-
/* @__PURE__ */ jsx("div", { className: "ps-tryon-section-label", children: "Required for this product" }),
|
|
1381
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-section-label", children: t("Required for this product") }),
|
|
1374
1382
|
reqFields.map(renderField)
|
|
1375
1383
|
] }),
|
|
1376
1384
|
isFemale && /* @__PURE__ */ jsxs("div", { className: "ps-tryon-input-row", children: [
|
|
1377
|
-
/* @__PURE__ */ jsx("label", { children: "Fit type" }),
|
|
1385
|
+
/* @__PURE__ */ jsx("label", { children: t("Fit type") }),
|
|
1378
1386
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-unit-toggle", children: ["petite", "standard", "tall", "plus"].map((fp) => /* @__PURE__ */ jsx(
|
|
1379
1387
|
"button",
|
|
1380
1388
|
{
|
|
@@ -1382,9 +1390,10 @@ function PrimeStyleTryonInner({
|
|
|
1382
1390
|
onClick: (e) => {
|
|
1383
1391
|
updateField("fitPreference", fp);
|
|
1384
1392
|
const btns = e.target.parentElement.querySelectorAll(".ps-tryon-unit-btn");
|
|
1385
|
-
btns.forEach((b) => b.classList.toggle("ps-active", b.
|
|
1393
|
+
btns.forEach((b) => b.classList.toggle("ps-active", b.dataset.fp === fp));
|
|
1386
1394
|
},
|
|
1387
|
-
|
|
1395
|
+
"data-fp": fp,
|
|
1396
|
+
children: t(fp.charAt(0).toUpperCase() + fp.slice(1))
|
|
1388
1397
|
},
|
|
1389
1398
|
fp
|
|
1390
1399
|
)) })
|
|
@@ -1399,7 +1408,7 @@ function PrimeStyleTryonInner({
|
|
|
1399
1408
|
if (arrow) arrow.style.transform = open ? "rotate(0deg)" : "rotate(180deg)";
|
|
1400
1409
|
}
|
|
1401
1410
|
}, children: [
|
|
1402
|
-
/* @__PURE__ */ jsx("span", { children: "Optional — improve accuracy & save to profile" }),
|
|
1411
|
+
/* @__PURE__ */ jsx("span", { children: t("Optional — improve accuracy & save to profile") }),
|
|
1403
1412
|
/* @__PURE__ */ jsx("span", { className: "ps-tryon-chevron", children: "▾" })
|
|
1404
1413
|
] }),
|
|
1405
1414
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-optional-fields", style: { display: "none" }, children: allOptFields.map(renderField) })
|
|
@@ -1407,33 +1416,39 @@ function PrimeStyleTryonInner({
|
|
|
1407
1416
|
] });
|
|
1408
1417
|
})() }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1409
1418
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-input-row", children: [
|
|
1410
|
-
/* @__PURE__ */
|
|
1419
|
+
/* @__PURE__ */ jsxs("label", { children: [
|
|
1420
|
+
t("Height"),
|
|
1421
|
+
" *"
|
|
1422
|
+
] }),
|
|
1411
1423
|
heightUnit === "ft" ? /* @__PURE__ */ jsxs("div", { className: "ps-tryon-height-ft", children: [
|
|
1412
1424
|
/* @__PURE__ */ jsx("input", { type: "number", placeholder: "5", defaultValue: formRef.current.heightFeet || "", onInput: (e) => updateField("heightFeet", e.target.value) }),
|
|
1413
|
-
/* @__PURE__ */ jsx("span", { children: "ft" }),
|
|
1425
|
+
/* @__PURE__ */ jsx("span", { children: t("ft") }),
|
|
1414
1426
|
/* @__PURE__ */ jsx("input", { type: "number", placeholder: "4", defaultValue: formRef.current.heightInches || "", onInput: (e) => updateField("heightInches", e.target.value) }),
|
|
1415
|
-
/* @__PURE__ */ jsx("span", { children: "in" })
|
|
1427
|
+
/* @__PURE__ */ jsx("span", { children: t("in") })
|
|
1416
1428
|
] }) : /* @__PURE__ */ jsx("input", { type: "number", placeholder: "e.g. 175", defaultValue: formRef.current.height || "", onInput: (e) => updateField("height", e.target.value) }),
|
|
1417
|
-
/* @__PURE__ */ jsx(UnitToggle, { options: [{ label: "cm", value: "cm" }, { label: "ft", value: "ft" }], value: heightUnit, onChange: setHeightUnit })
|
|
1429
|
+
/* @__PURE__ */ jsx(UnitToggle, { options: [{ label: t("cm"), value: "cm" }, { label: t("ft"), value: "ft" }], value: heightUnit, onChange: setHeightUnit })
|
|
1418
1430
|
] }),
|
|
1419
1431
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-input-row", children: [
|
|
1420
|
-
/* @__PURE__ */
|
|
1432
|
+
/* @__PURE__ */ jsxs("label", { children: [
|
|
1433
|
+
t("Weight"),
|
|
1434
|
+
" *"
|
|
1435
|
+
] }),
|
|
1421
1436
|
/* @__PURE__ */ jsx("input", { type: "number", placeholder: weightUnit === "lbs" ? "e.g. 170" : "e.g. 75", defaultValue: formRef.current.weight || "", onInput: (e) => updateField("weight", e.target.value) }),
|
|
1422
|
-
/* @__PURE__ */ jsx(UnitToggle, { options: [{ label: "kg", value: "kg" }, { label: "lbs", value: "lbs" }], value: weightUnit, onChange: setWeightUnit })
|
|
1437
|
+
/* @__PURE__ */ jsx(UnitToggle, { options: [{ label: t("kg"), value: "kg" }, { label: t("lbs"), value: "lbs" }], value: weightUnit, onChange: setWeightUnit })
|
|
1423
1438
|
] })
|
|
1424
1439
|
] }),
|
|
1425
|
-
/* @__PURE__ */ jsx("p", { className: "ps-tryon-disclaimer", children: "Fill in what you know — more measurements = better accuracy." }),
|
|
1440
|
+
/* @__PURE__ */ jsx("p", { className: "ps-tryon-disclaimer", children: t("Fill in what you know — more measurements = better accuracy.") }),
|
|
1426
1441
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-form-save-toggle", children: [
|
|
1427
1442
|
/* @__PURE__ */ jsxs("label", { className: "ps-tryon-form-save-check", children: [
|
|
1428
1443
|
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: saveToggle, onChange: (e) => setSaveToggle(e.target.checked) }),
|
|
1429
|
-
/* @__PURE__ */ jsx("span", { children: "Save as profile" })
|
|
1444
|
+
/* @__PURE__ */ jsx("span", { children: t("Save as profile") })
|
|
1430
1445
|
] }),
|
|
1431
1446
|
saveToggle && /* @__PURE__ */ jsx(
|
|
1432
1447
|
"input",
|
|
1433
1448
|
{
|
|
1434
1449
|
type: "text",
|
|
1435
1450
|
className: "ps-tryon-form-save-name",
|
|
1436
|
-
placeholder: "Profile name (e.g. John, Sarah)",
|
|
1451
|
+
placeholder: t("Profile name (e.g. John, Sarah)"),
|
|
1437
1452
|
value: saveFormName,
|
|
1438
1453
|
onChange: (e) => setSaveFormName(e.target.value)
|
|
1439
1454
|
}
|
|
@@ -1447,50 +1462,51 @@ function PrimeStyleTryonInner({
|
|
|
1447
1462
|
submitSizing();
|
|
1448
1463
|
setView("size-result");
|
|
1449
1464
|
}, children: [
|
|
1450
|
-
"Get My Size
|
|
1465
|
+
t("Get My Size"),
|
|
1466
|
+
" ",
|
|
1451
1467
|
/* @__PURE__ */ jsx(ArrowRightIcon, {})
|
|
1452
1468
|
] })
|
|
1453
1469
|
] }, `form-${formGender}-${sizingUnit}-${heightUnit}-${sizingCountry}-${formKey}`);
|
|
1454
1470
|
}
|
|
1455
1471
|
function SizeResultView() {
|
|
1456
1472
|
const [showFitDetails, setShowFitDetails] = useState(false);
|
|
1457
|
-
const confidenceLabel = sizingResult?.confidence === "high" ? "High Confidence" : sizingResult?.confidence === "medium" ? "Medium Confidence" : sizingResult?.confidence === "low" ? "Low Confidence" : "";
|
|
1473
|
+
const confidenceLabel = sizingResult?.confidence === "high" ? t("High Confidence") : sizingResult?.confidence === "medium" ? t("Medium Confidence") : sizingResult?.confidence === "low" ? t("Low Confidence") : "";
|
|
1458
1474
|
return /* @__PURE__ */ jsxs("div", { className: "ps-tryon-size-result-view", children: [
|
|
1459
1475
|
sizingLoading && !sizingResult && /* @__PURE__ */ jsxs("div", { className: "ps-tryon-size-recommend ps-tryon-sizing-loading", children: [
|
|
1460
1476
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-size-loading-spinner" }),
|
|
1461
|
-
/* @__PURE__ */ jsx("p", { className: "ps-tryon-size-reasoning", children: "Analyzing your size..." })
|
|
1477
|
+
/* @__PURE__ */ jsx("p", { className: "ps-tryon-size-reasoning", children: t("Analyzing your size...") })
|
|
1462
1478
|
] }),
|
|
1463
1479
|
sizingResult && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1464
1480
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-size-recommend", children: [
|
|
1465
|
-
/* @__PURE__ */ jsx("h3", { className: "ps-tryon-size-title", children: "Your Size" }),
|
|
1481
|
+
/* @__PURE__ */ jsx("h3", { className: "ps-tryon-size-title", children: t("Your Size") }),
|
|
1466
1482
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-size-hero-row", children: [
|
|
1467
1483
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-size-badge", children: sizingResult.recommendedSize }),
|
|
1468
1484
|
/* @__PURE__ */ jsx("span", { className: `ps-tryon-size-conf-label ps-conf-${sizingResult.confidence}`, children: confidenceLabel })
|
|
1469
1485
|
] }),
|
|
1470
1486
|
sizingResult.sections && Object.keys(sizingResult.sections).length > 1 && /* @__PURE__ */ jsxs("div", { className: "ps-tryon-multi-section", children: [
|
|
1471
|
-
/* @__PURE__ */ jsx("h4", { className: "ps-tryon-fit-summary-title", children: "Sizing by Garment" }),
|
|
1487
|
+
/* @__PURE__ */ jsx("h4", { className: "ps-tryon-fit-summary-title", children: t("Sizing by Garment") }),
|
|
1472
1488
|
Object.entries(sizingResult.sections).map(([name, sec]) => /* @__PURE__ */ jsxs("div", { className: "ps-tryon-section-row", children: [
|
|
1473
1489
|
/* @__PURE__ */ jsx("span", { className: "ps-tryon-section-name", children: name }),
|
|
1474
1490
|
/* @__PURE__ */ jsx("span", { className: "ps-tryon-size-badge ps-tryon-section-badge", children: sec.recommendedSize })
|
|
1475
1491
|
] }, name))
|
|
1476
1492
|
] }),
|
|
1477
1493
|
sizingResult.matchDetails && sizingResult.matchDetails.length > 0 && /* @__PURE__ */ jsxs("div", { className: "ps-tryon-fit-summary", children: [
|
|
1478
|
-
/* @__PURE__ */ jsx("h4", { className: "ps-tryon-fit-summary-title", children: "Fit Summary" }),
|
|
1494
|
+
/* @__PURE__ */ jsx("h4", { className: "ps-tryon-fit-summary-title", children: t("Fit Summary") }),
|
|
1479
1495
|
sizingResult.matchDetails.map((m, i) => /* @__PURE__ */ jsxs("div", { className: "ps-tryon-fit-row", children: [
|
|
1480
1496
|
/* @__PURE__ */ jsx("span", { className: `ps-tryon-fit-icon ps-fit-icon-${m.fit}`, children: m.fit === "good" ? "✓" : m.fit === "tight" ? "↑" : "↓" }),
|
|
1481
1497
|
/* @__PURE__ */ jsxs("span", { className: "ps-tryon-fit-text", children: [
|
|
1482
1498
|
/* @__PURE__ */ jsx("strong", { children: m.measurement }),
|
|
1483
1499
|
" ",
|
|
1484
|
-
m.fit === "good" ? "within range" : m.fit === "tight" ? "may be snug" : "may be loose"
|
|
1500
|
+
m.fit === "good" ? t("within range") : m.fit === "tight" ? t("may be snug") : t("may be loose")
|
|
1485
1501
|
] })
|
|
1486
1502
|
] }, i)),
|
|
1487
|
-
/* @__PURE__ */ jsx("button", { className: "ps-tryon-fit-details-toggle", onClick: () => setShowFitDetails(!showFitDetails), children: showFitDetails ? "Hide details
|
|
1503
|
+
/* @__PURE__ */ jsx("button", { className: "ps-tryon-fit-details-toggle", onClick: () => setShowFitDetails(!showFitDetails), children: showFitDetails ? `${t("Hide details")} ↑` : `${t("See details")} ↓` }),
|
|
1488
1504
|
showFitDetails && /* @__PURE__ */ jsxs("table", { className: "ps-tryon-fit-table", children: [
|
|
1489
1505
|
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1490
|
-
/* @__PURE__ */ jsx("th", { children: "Area" }),
|
|
1491
|
-
/* @__PURE__ */ jsx("th", { children: "You" }),
|
|
1492
|
-
/* @__PURE__ */ jsx("th", { children: "Chart" }),
|
|
1493
|
-
/* @__PURE__ */ jsx("th", { children: "Fit" })
|
|
1506
|
+
/* @__PURE__ */ jsx("th", { children: t("Area") }),
|
|
1507
|
+
/* @__PURE__ */ jsx("th", { children: t("You") }),
|
|
1508
|
+
/* @__PURE__ */ jsx("th", { children: t("Chart") }),
|
|
1509
|
+
/* @__PURE__ */ jsx("th", { children: t("Fit") })
|
|
1494
1510
|
] }) }),
|
|
1495
1511
|
/* @__PURE__ */ jsx("tbody", { children: sizingResult.matchDetails.map((m, i) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
1496
1512
|
/* @__PURE__ */ jsx("td", { children: m.measurement }),
|
|
@@ -1501,7 +1517,7 @@ function PrimeStyleTryonInner({
|
|
|
1501
1517
|
] })
|
|
1502
1518
|
] }),
|
|
1503
1519
|
sizingResult.internationalSizes && Object.keys(sizingResult.internationalSizes).length > 0 && /* @__PURE__ */ jsxs("div", { className: "ps-tryon-equiv-section", children: [
|
|
1504
|
-
/* @__PURE__ */ jsx("h4", { className: "ps-tryon-equiv-title", children: "Equivalent Sizes" }),
|
|
1520
|
+
/* @__PURE__ */ jsx("h4", { className: "ps-tryon-equiv-title", children: t("Equivalent Sizes") }),
|
|
1505
1521
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-equiv-chips", children: Object.entries(sizingResult.internationalSizes).map(([k, v]) => /* @__PURE__ */ jsxs("div", { className: "ps-tryon-equiv-chip", children: [
|
|
1506
1522
|
/* @__PURE__ */ jsx("span", { className: "ps-tryon-equiv-region", children: k }),
|
|
1507
1523
|
/* @__PURE__ */ jsx("span", { className: "ps-tryon-equiv-value", children: v })
|
|
@@ -1511,10 +1527,11 @@ function PrimeStyleTryonInner({
|
|
|
1511
1527
|
] }),
|
|
1512
1528
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-tryon-cta", children: [
|
|
1513
1529
|
/* @__PURE__ */ jsxs("button", { className: "ps-tryon-cta", onClick: () => setView("upload"), children: [
|
|
1514
|
-
"See how it looks on you
|
|
1530
|
+
t("See how it looks on you"),
|
|
1531
|
+
" ",
|
|
1515
1532
|
/* @__PURE__ */ jsx(ArrowRightIcon, {})
|
|
1516
1533
|
] }),
|
|
1517
|
-
/* @__PURE__ */ jsx("button", { className: "ps-tryon-btn-secondary", onClick: handleClose, children: "Done" })
|
|
1534
|
+
/* @__PURE__ */ jsx("button", { className: "ps-tryon-btn-secondary", onClick: handleClose, children: t("Done") })
|
|
1518
1535
|
] })
|
|
1519
1536
|
] })
|
|
1520
1537
|
] });
|
|
@@ -1535,7 +1552,7 @@ function PrimeStyleTryonInner({
|
|
|
1535
1552
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-processing-image-wrap", children: [
|
|
1536
1553
|
previewUrl && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1537
1554
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-processing-blur", style: { backgroundImage: `url(${previewUrl})` } }),
|
|
1538
|
-
/* @__PURE__ */ jsx("img", { src: previewUrl, alt: "Your photo", className: "ps-tryon-processing-model" })
|
|
1555
|
+
/* @__PURE__ */ jsx("img", { src: previewUrl, alt: t("Your photo"), className: "ps-tryon-processing-model" })
|
|
1539
1556
|
] }),
|
|
1540
1557
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-scan-line" }),
|
|
1541
1558
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-scan-overlay" })
|
|
@@ -1544,21 +1561,21 @@ function PrimeStyleTryonInner({
|
|
|
1544
1561
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-progress-bar-wrap", children: /* @__PURE__ */ jsx("div", { ref: barCb, className: "ps-tryon-progress-bar-fill" }) }),
|
|
1545
1562
|
/* @__PURE__ */ jsx("span", { ref: pctCb, className: "ps-tryon-progress-pct", children: "0%" })
|
|
1546
1563
|
] }),
|
|
1547
|
-
/* @__PURE__ */ jsx("div", { ref: statusCb, className: cx("ps-tryon-processing-text", cn.processingText), children: "Preparing your image..." }),
|
|
1548
|
-
/* @__PURE__ */ jsx("p", { className: cx("ps-tryon-processing-sub", cn.processingSubText), children: "This usually takes 15-25 seconds" })
|
|
1564
|
+
/* @__PURE__ */ jsx("div", { ref: statusCb, className: cx("ps-tryon-processing-text", cn.processingText), children: t("Preparing your image...") }),
|
|
1565
|
+
/* @__PURE__ */ jsx("p", { className: cx("ps-tryon-processing-sub", cn.processingSubText), children: t("This usually takes 15-25 seconds") })
|
|
1549
1566
|
] });
|
|
1550
1567
|
}
|
|
1551
1568
|
function ResultView() {
|
|
1552
1569
|
return /* @__PURE__ */ jsxs("div", { className: "ps-tryon-result-layout", children: [
|
|
1553
|
-
resultImageUrl && /* @__PURE__ */ jsx("div", { className: "ps-tryon-result-image-col", children: /* @__PURE__ */ jsx("img", { src: resultImageUrl, alt: "Try-on result", className: cn.resultImage }) }),
|
|
1570
|
+
resultImageUrl && /* @__PURE__ */ jsx("div", { className: "ps-tryon-result-image-col", children: /* @__PURE__ */ jsx("img", { src: resultImageUrl, alt: t("Try-on result"), className: cn.resultImage }) }),
|
|
1554
1571
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-result-info-col", children: [
|
|
1555
1572
|
sizingResult && /* @__PURE__ */ jsx("div", { className: "ps-tryon-size-recommend ps-tryon-size-compact", children: /* @__PURE__ */ jsxs("div", { className: "ps-tryon-size-hero-row", children: [
|
|
1556
|
-
/* @__PURE__ */ jsx("span", { className: "ps-tryon-size-compact-label", children: "Your size:" }),
|
|
1573
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-size-compact-label", children: t("Your size:") }),
|
|
1557
1574
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-size-badge", children: sizingResult.recommendedSize })
|
|
1558
1575
|
] }) }),
|
|
1559
1576
|
/* @__PURE__ */ jsxs("div", { className: cx("ps-tryon-result-actions", cn.resultActions), children: [
|
|
1560
|
-
/* @__PURE__ */ jsx("button", { onClick: handleDownload, className: cx("ps-tryon-btn-download", cn.downloadButton), children: "Download" }),
|
|
1561
|
-
/* @__PURE__ */ jsx("button", { onClick: handleRetry, className: cx("ps-tryon-btn-retry", cn.retryButton), children: "Start Over" })
|
|
1577
|
+
/* @__PURE__ */ jsx("button", { onClick: handleDownload, className: cx("ps-tryon-btn-download", cn.downloadButton), children: t("Download") }),
|
|
1578
|
+
/* @__PURE__ */ jsx("button", { onClick: handleRetry, className: cx("ps-tryon-btn-retry", cn.retryButton), children: t("Start Over") })
|
|
1562
1579
|
] })
|
|
1563
1580
|
] })
|
|
1564
1581
|
] });
|
|
@@ -1566,8 +1583,8 @@ function PrimeStyleTryonInner({
|
|
|
1566
1583
|
function ErrorView() {
|
|
1567
1584
|
return /* @__PURE__ */ jsxs("div", { className: cx("ps-tryon-error", cn.error), children: [
|
|
1568
1585
|
/* @__PURE__ */ jsx(AlertIcon, {}),
|
|
1569
|
-
/* @__PURE__ */ jsx("p", { className: cx("ps-tryon-error-text", cn.errorText), children: errorMessage || "Something went wrong" }),
|
|
1570
|
-
/* @__PURE__ */ jsx("button", { onClick: handleRetry, className: cx("ps-tryon-submit", cn.submitButton), children: "Try Again" })
|
|
1586
|
+
/* @__PURE__ */ jsx("p", { className: cx("ps-tryon-error-text", cn.errorText), children: errorMessage || t("Something went wrong") }),
|
|
1587
|
+
/* @__PURE__ */ jsx("button", { onClick: handleRetry, className: cx("ps-tryon-submit", cn.submitButton), children: t("Try Again") })
|
|
1571
1588
|
] });
|
|
1572
1589
|
}
|
|
1573
1590
|
function DrawerPanel() {
|
|
@@ -1575,9 +1592,9 @@ function PrimeStyleTryonInner({
|
|
|
1575
1592
|
return /* @__PURE__ */ jsxs("div", { className: `ps-tryon-drawer${drawer ? " ps-tryon-drawer-open" : ""}`, children: [
|
|
1576
1593
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-drawer-header", children: [
|
|
1577
1594
|
/* @__PURE__ */ jsx("button", { className: "ps-tryon-drawer-back", onClick: () => setDrawer(null), children: /* @__PURE__ */ jsx(ArrowLeftIcon, {}) }),
|
|
1578
|
-
/* @__PURE__ */ jsx("span", { className: "ps-tryon-drawer-title", children: drawer === "profiles" ? "My Profiles" : "History" })
|
|
1595
|
+
/* @__PURE__ */ jsx("span", { className: "ps-tryon-drawer-title", children: drawer === "profiles" ? t("My Profiles") : t("History") })
|
|
1579
1596
|
] }),
|
|
1580
|
-
/* @__PURE__ */ jsx("div", { className: "ps-tryon-drawer-list", children: drawer === "profiles" ? profiles.length === 0 ? /* @__PURE__ */ jsx("div", { className: "ps-tryon-drawer-empty", children: "No saved profiles yet." }) : profiles.map((p) => /* @__PURE__ */ jsxs("div", { className: "ps-tryon-profile-item", onClick: () => {
|
|
1597
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-drawer-list", children: drawer === "profiles" ? profiles.length === 0 ? /* @__PURE__ */ jsx("div", { className: "ps-tryon-drawer-empty", children: t("No saved profiles yet.") }) : profiles.map((p) => /* @__PURE__ */ jsxs("div", { className: "ps-tryon-profile-item", onClick: () => {
|
|
1581
1598
|
setProfileDetail(p);
|
|
1582
1599
|
setDrawer(null);
|
|
1583
1600
|
}, children: [
|
|
@@ -1585,18 +1602,18 @@ function PrimeStyleTryonInner({
|
|
|
1585
1602
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-profile-info", children: [
|
|
1586
1603
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-profile-name", children: p.name }),
|
|
1587
1604
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-profile-detail", children: [
|
|
1588
|
-
p.gender === "female" ? "Women's" : "Men's",
|
|
1589
|
-
p.heightCm ? ` · ${Math.round(p.heightCm)}cm` : ""
|
|
1605
|
+
p.gender === "female" ? t("Women's") : t("Men's"),
|
|
1606
|
+
p.heightCm ? ` · ${Math.round(p.heightCm)}${t("cm")}` : ""
|
|
1590
1607
|
] })
|
|
1591
1608
|
] }),
|
|
1592
1609
|
/* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
1593
|
-
] }, p.id)) : history.length === 0 ? /* @__PURE__ */ jsx("div", { className: "ps-tryon-drawer-empty", children: "No history yet." }) : history.map((entry, idx) => /* @__PURE__ */ jsxs("div", { className: "ps-tryon-history-item", children: [
|
|
1610
|
+
] }, p.id)) : history.length === 0 ? /* @__PURE__ */ jsx("div", { className: "ps-tryon-drawer-empty", children: t("No history yet.") }) : history.map((entry, idx) => /* @__PURE__ */ jsxs("div", { className: "ps-tryon-history-item", children: [
|
|
1594
1611
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-history-images", children: [
|
|
1595
1612
|
entry.productImage && /* @__PURE__ */ jsx("img", { src: entry.productImage, alt: "", className: "ps-tryon-history-thumb" }),
|
|
1596
1613
|
entry.resultImageUrl && /* @__PURE__ */ jsx("img", { src: entry.resultImageUrl, alt: "", className: "ps-tryon-history-result-img" })
|
|
1597
1614
|
] }),
|
|
1598
1615
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-history-info", children: [
|
|
1599
|
-
/* @__PURE__ */ jsx("div", { className: "ps-tryon-history-product", children: entry.productTitle || "Product" }),
|
|
1616
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-history-product", children: entry.productTitle || t("Product") }),
|
|
1600
1617
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-history-meta", children: [
|
|
1601
1618
|
entry.profileName ? `${entry.profileName} · ` : "",
|
|
1602
1619
|
new Date(entry.date).toLocaleDateString()
|
|
@@ -1617,20 +1634,20 @@ function PrimeStyleTryonInner({
|
|
|
1617
1634
|
if (!profileDetail) return null;
|
|
1618
1635
|
const p = profileDetail;
|
|
1619
1636
|
const measurements = [
|
|
1620
|
-
{ label: "Height", value: p.heightCm, unit: "cm" },
|
|
1621
|
-
{ label: "Weight", value: p.weightKg, unit: "kg" },
|
|
1622
|
-
{ label: "Chest", value: p.chest, unit: "cm" },
|
|
1623
|
-
{ label: "Bust", value: p.bust, unit: "cm" },
|
|
1624
|
-
{ label: "Waist", value: p.waist, unit: "cm" },
|
|
1625
|
-
{ label: "Hips", value: p.hips, unit: "cm" },
|
|
1626
|
-
{ label: "Shoulders", value: p.shoulderWidth, unit: "cm" },
|
|
1627
|
-
{ label: "Sleeve", value: p.sleeveLength, unit: "cm" },
|
|
1628
|
-
{ label: "Inseam", value: p.inseam, unit: "cm" },
|
|
1629
|
-
{ label: "Neck", value: p.neckCircumference, unit: "cm" },
|
|
1630
|
-
{ label: "Foot", value: p.footLengthCm, unit: "cm" },
|
|
1631
|
-
{ label: "Shoe EU", value: p.shoeEU ? Number(p.shoeEU) : void 0, unit: "" },
|
|
1632
|
-
{ label: "Shoe US", value: p.shoeUS ? Number(p.shoeUS) : void 0, unit: "" },
|
|
1633
|
-
{ label: "Shoe UK", value: p.shoeUK ? Number(p.shoeUK) : void 0, unit: "" }
|
|
1637
|
+
{ label: t("Height"), value: p.heightCm, unit: t("cm") },
|
|
1638
|
+
{ label: t("Weight"), value: p.weightKg, unit: t("kg") },
|
|
1639
|
+
{ label: t("Chest"), value: p.chest, unit: t("cm") },
|
|
1640
|
+
{ label: t("Bust"), value: p.bust, unit: t("cm") },
|
|
1641
|
+
{ label: t("Waist"), value: p.waist, unit: t("cm") },
|
|
1642
|
+
{ label: t("Hips"), value: p.hips, unit: t("cm") },
|
|
1643
|
+
{ label: t("Shoulders"), value: p.shoulderWidth, unit: t("cm") },
|
|
1644
|
+
{ label: t("Sleeve"), value: p.sleeveLength, unit: t("cm") },
|
|
1645
|
+
{ label: t("Inseam"), value: p.inseam, unit: t("cm") },
|
|
1646
|
+
{ label: t("Neck"), value: p.neckCircumference, unit: t("cm") },
|
|
1647
|
+
{ label: t("Foot"), value: p.footLengthCm, unit: t("cm") },
|
|
1648
|
+
{ label: t("Shoe EU"), value: p.shoeEU ? Number(p.shoeEU) : void 0, unit: "" },
|
|
1649
|
+
{ label: t("Shoe US"), value: p.shoeUS ? Number(p.shoeUS) : void 0, unit: "" },
|
|
1650
|
+
{ label: t("Shoe UK"), value: p.shoeUK ? Number(p.shoeUK) : void 0, unit: "" }
|
|
1634
1651
|
].filter((m) => m.value);
|
|
1635
1652
|
return /* @__PURE__ */ jsx("div", { className: "ps-tryon-detail-overlay", onClick: (e) => {
|
|
1636
1653
|
if (e.target === e.currentTarget) setProfileDetail(null);
|
|
@@ -1643,8 +1660,7 @@ function PrimeStyleTryonInner({
|
|
|
1643
1660
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-detail-gender", children: [
|
|
1644
1661
|
/* @__PURE__ */ jsx(UserIcon, { size: 18 }),
|
|
1645
1662
|
" ",
|
|
1646
|
-
p.gender === "female" ? "Women's" : "Men's"
|
|
1647
|
-
" Profile"
|
|
1663
|
+
p.gender === "female" ? t("Women's Profile") : t("Men's Profile")
|
|
1648
1664
|
] }),
|
|
1649
1665
|
measurements.length > 0 && /* @__PURE__ */ jsx("div", { className: "ps-tryon-detail-grid", children: measurements.map((m) => /* @__PURE__ */ jsxs("div", { className: "ps-tryon-detail-cell", children: [
|
|
1650
1666
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-detail-cell-label", children: m.label }),
|
|
@@ -1654,7 +1670,8 @@ function PrimeStyleTryonInner({
|
|
|
1654
1670
|
] })
|
|
1655
1671
|
] }, m.label)) }),
|
|
1656
1672
|
p.createdAt && /* @__PURE__ */ jsxs("div", { className: "ps-tryon-detail-date", children: [
|
|
1657
|
-
"Saved
|
|
1673
|
+
t("Saved"),
|
|
1674
|
+
" ",
|
|
1658
1675
|
new Date(p.createdAt).toLocaleDateString()
|
|
1659
1676
|
] }),
|
|
1660
1677
|
/* @__PURE__ */ jsxs("button", { className: "ps-tryon-detail-delete", onClick: () => {
|
|
@@ -1663,7 +1680,8 @@ function PrimeStyleTryonInner({
|
|
|
1663
1680
|
setProfileDetail(null);
|
|
1664
1681
|
}, children: [
|
|
1665
1682
|
/* @__PURE__ */ jsx(TrashIcon, {}),
|
|
1666
|
-
"
|
|
1683
|
+
" ",
|
|
1684
|
+
t("Delete Profile")
|
|
1667
1685
|
] })
|
|
1668
1686
|
] })
|
|
1669
1687
|
] }) });
|
|
@@ -1693,16 +1711,16 @@ function PrimeStyleTryonInner({
|
|
|
1693
1711
|
return /* @__PURE__ */ jsxs("div", { className: cx("ps-tryon-root", cn.root || className), style: { ...cssVars, ...style }, "data-ps-tryon": true, children: [
|
|
1694
1712
|
/* @__PURE__ */ jsxs("button", { onClick: handleOpen, className: cx("ps-tryon-btn", cn.button), children: [
|
|
1695
1713
|
showIcon !== false && (buttonIcon || /* @__PURE__ */ jsx(CameraIcon, {})),
|
|
1696
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
1714
|
+
/* @__PURE__ */ jsx("span", { children: resolvedButtonText })
|
|
1697
1715
|
] }),
|
|
1698
1716
|
view !== "idle" && /* @__PURE__ */ jsx("div", { className: cx("ps-tryon-overlay", cn.overlay), onClick: (e) => {
|
|
1699
1717
|
if (e.target === e.currentTarget) handleClose();
|
|
1700
1718
|
}, children: /* @__PURE__ */ jsxs("div", { className: cx(`ps-tryon-modal${view === "result" && resultImageUrl && sizingResult ? " ps-tryon-modal-wide" : ""}`, cn.modal), onClick: (e) => e.stopPropagation(), children: [
|
|
1701
1719
|
/* @__PURE__ */ jsxs("div", { className: cx("ps-tryon-header", cn.header), children: [
|
|
1702
|
-
/* @__PURE__ */ jsx("span", { className: cx("ps-tryon-title", cn.title), children: "Virtual Try-On" }),
|
|
1720
|
+
/* @__PURE__ */ jsx("span", { className: cx("ps-tryon-title", cn.title), children: t("Virtual Try-On") }),
|
|
1703
1721
|
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-header-actions", children: [
|
|
1704
|
-
profiles.length > 0 && /* @__PURE__ */ jsx("button", { className: "ps-tryon-header-icon", title: "Profiles", onClick: () => setDrawer(drawer === "profiles" ? null : "profiles"), children: /* @__PURE__ */ jsx(UserIcon, {}) }),
|
|
1705
|
-
history.length > 0 && /* @__PURE__ */ jsx("button", { className: "ps-tryon-header-icon", title: "History", onClick: () => setDrawer(drawer === "history" ? null : "history"), children: /* @__PURE__ */ jsx(ClockIcon, {}) }),
|
|
1722
|
+
profiles.length > 0 && /* @__PURE__ */ jsx("button", { className: "ps-tryon-header-icon", title: t("Profiles"), onClick: () => setDrawer(drawer === "profiles" ? null : "profiles"), children: /* @__PURE__ */ jsx(UserIcon, {}) }),
|
|
1723
|
+
history.length > 0 && /* @__PURE__ */ jsx("button", { className: "ps-tryon-header-icon", title: t("History"), onClick: () => setDrawer(drawer === "history" ? null : "history"), children: /* @__PURE__ */ jsx(ClockIcon, {}) }),
|
|
1706
1724
|
/* @__PURE__ */ jsx("button", { onClick: handleClose, className: cx("ps-tryon-close", cn.closeButton), children: /* @__PURE__ */ jsx(XIcon, {}) })
|
|
1707
1725
|
] })
|
|
1708
1726
|
] }),
|
|
@@ -1712,7 +1730,7 @@ function PrimeStyleTryonInner({
|
|
|
1712
1730
|
/* @__PURE__ */ jsx(DrawerPanel, {})
|
|
1713
1731
|
] }),
|
|
1714
1732
|
showPoweredBy && /* @__PURE__ */ jsxs("div", { className: cx("ps-tryon-powered", cn.poweredBy), children: [
|
|
1715
|
-
"Powered by",
|
|
1733
|
+
t("Powered by"),
|
|
1716
1734
|
" ",
|
|
1717
1735
|
/* @__PURE__ */ jsx("a", { href: "https://myaifitting.com", target: "_blank", rel: "noopener noreferrer", children: "PrimeStyle AI" })
|
|
1718
1736
|
] })
|