@primestyleai/tryon 3.2.0 → 3.2.2
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 +24 -18
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -434,8 +434,6 @@ function PrimeStyleTryonInner({
|
|
|
434
434
|
if (sizeGuide?.found) payload.sizeGuide = sizeGuide;
|
|
435
435
|
if (sizingMethod === "exact") {
|
|
436
436
|
const m = { gender: formRef.current.gender || "male" };
|
|
437
|
-
if (formRef.current.height) m.heightCm = heightUnit === "ft" ? ftInToCm(parseFloat(formRef.current.heightFeet || "0"), parseFloat(formRef.current.heightInches || "0")) : parseFloat(formRef.current.height);
|
|
438
|
-
if (formRef.current.weight) m.weightKg = weightUnit === "lbs" ? lbsToKg(parseFloat(formRef.current.weight)) : parseFloat(formRef.current.weight);
|
|
439
437
|
const keys = ["chest", "bust", "waist", "hips", "shoulderWidth", "sleeveLength", "inseam", "neckCircumference", "footLengthCm"];
|
|
440
438
|
for (const k of keys) {
|
|
441
439
|
if (formRef.current[k]) m[k] = sizingUnit === "in" ? inToCm(parseFloat(formRef.current[k])) : parseFloat(formRef.current[k]);
|
|
@@ -469,7 +467,13 @@ function PrimeStyleTryonInner({
|
|
|
469
467
|
const data = await res.json();
|
|
470
468
|
setSizingResult(data);
|
|
471
469
|
} else {
|
|
472
|
-
|
|
470
|
+
const errBody = await res.text().catch(() => "");
|
|
471
|
+
console.error("[PrimeStyle] Sizing API error:", res.status, errBody);
|
|
472
|
+
try {
|
|
473
|
+
const parsed = JSON.parse(errBody);
|
|
474
|
+
if (parsed.issues) console.error("[PrimeStyle] Validation issues:", JSON.stringify(parsed.issues, null, 2));
|
|
475
|
+
} catch {
|
|
476
|
+
}
|
|
473
477
|
}
|
|
474
478
|
} catch (err) {
|
|
475
479
|
console.warn("[PrimeStyle] Sizing request failed:", err);
|
|
@@ -886,16 +890,6 @@ function PrimeStyleTryonInner({
|
|
|
886
890
|
setHeightUnit(v === "cm" ? "cm" : "ft");
|
|
887
891
|
setWeightUnit(v === "cm" ? "kg" : "lbs");
|
|
888
892
|
} }) }),
|
|
889
|
-
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-input-row", children: [
|
|
890
|
-
/* @__PURE__ */ jsx("label", { children: "Height" }),
|
|
891
|
-
heightUnit === "ft" ? /* @__PURE__ */ jsxs("div", { className: "ps-tryon-height-ft", children: [
|
|
892
|
-
/* @__PURE__ */ jsx("input", { type: "number", placeholder: "5", defaultValue: formRef.current.heightFeet || "", onInput: (e) => updateField("heightFeet", e.target.value) }),
|
|
893
|
-
/* @__PURE__ */ jsx("span", { children: "ft" }),
|
|
894
|
-
/* @__PURE__ */ jsx("input", { type: "number", placeholder: "4", defaultValue: formRef.current.heightInches || "", onInput: (e) => updateField("heightInches", e.target.value) }),
|
|
895
|
-
/* @__PURE__ */ jsx("span", { children: "in" })
|
|
896
|
-
] }) : /* @__PURE__ */ jsx("input", { type: "number", placeholder: "e.g. 175", defaultValue: formRef.current.height || "", onInput: (e) => updateField("height", e.target.value) }),
|
|
897
|
-
/* @__PURE__ */ jsx(UnitToggle, { options: [{ label: "cm", value: "cm" }, { label: "ft", value: "ft" }], value: heightUnit, onChange: setHeightUnit })
|
|
898
|
-
] }),
|
|
899
893
|
sizingMethod === "exact" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
900
894
|
isFemale ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
901
895
|
/* @__PURE__ */ jsx(InputRow, { label: "Bust *", fieldKey: "bust", placeholder: isCm ? "e.g. 88" : "e.g. 35", type: "number", unit: sizingUnit }),
|
|
@@ -931,11 +925,23 @@ function PrimeStyleTryonInner({
|
|
|
931
925
|
/* @__PURE__ */ jsx(InputRow, { label: "Foot length", fieldKey: "footLengthCm", placeholder: isCm ? "e.g. 27" : "e.g. 10.5", type: "number", unit: sizingUnit }),
|
|
932
926
|
/* @__PURE__ */ jsx(InputRow, { label: shoeField.label, fieldKey: shoeField.key, placeholder: shoeField.ph })
|
|
933
927
|
] })
|
|
934
|
-
] }) : /* @__PURE__ */
|
|
935
|
-
/* @__PURE__ */
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
928
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
929
|
+
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-input-row", children: [
|
|
930
|
+
/* @__PURE__ */ jsx("label", { children: "Height *" }),
|
|
931
|
+
heightUnit === "ft" ? /* @__PURE__ */ jsxs("div", { className: "ps-tryon-height-ft", children: [
|
|
932
|
+
/* @__PURE__ */ jsx("input", { type: "number", placeholder: "5", defaultValue: formRef.current.heightFeet || "", onInput: (e) => updateField("heightFeet", e.target.value) }),
|
|
933
|
+
/* @__PURE__ */ jsx("span", { children: "ft" }),
|
|
934
|
+
/* @__PURE__ */ jsx("input", { type: "number", placeholder: "4", defaultValue: formRef.current.heightInches || "", onInput: (e) => updateField("heightInches", e.target.value) }),
|
|
935
|
+
/* @__PURE__ */ jsx("span", { children: "in" })
|
|
936
|
+
] }) : /* @__PURE__ */ jsx("input", { type: "number", placeholder: "e.g. 175", defaultValue: formRef.current.height || "", onInput: (e) => updateField("height", e.target.value) }),
|
|
937
|
+
/* @__PURE__ */ jsx(UnitToggle, { options: [{ label: "cm", value: "cm" }, { label: "ft", value: "ft" }], value: heightUnit, onChange: setHeightUnit })
|
|
938
|
+
] }),
|
|
939
|
+
/* @__PURE__ */ jsxs("div", { className: "ps-tryon-input-row", children: [
|
|
940
|
+
/* @__PURE__ */ jsx("label", { children: "Weight *" }),
|
|
941
|
+
/* @__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) }),
|
|
942
|
+
/* @__PURE__ */ jsx(UnitToggle, { options: [{ label: "kg", value: "kg" }, { label: "lbs", value: "lbs" }], value: weightUnit, onChange: setWeightUnit })
|
|
943
|
+
] })
|
|
944
|
+
] }),
|
|
939
945
|
/* @__PURE__ */ jsx("p", { className: "ps-tryon-disclaimer", children: "Fill in what you know — more measurements = better accuracy." }),
|
|
940
946
|
/* @__PURE__ */ jsxs("button", { className: "ps-tryon-submit", onClick: handleSubmit, children: [
|
|
941
947
|
"Get My Size & Try On ",
|