@primestyleai/tryon 3.6.6 → 3.7.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 +25 -14
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -966,9 +966,17 @@ function PrimeStyleTryonInner({
|
|
|
966
966
|
sizingMethod === "exact" ? /* @__PURE__ */ jsx(Fragment, { children: (() => {
|
|
967
967
|
const reqFields = dynamicFields.filter((f) => f.required);
|
|
968
968
|
const optFields = dynamicFields.filter((f) => !f.required);
|
|
969
|
+
const isShoeProduct = reqFields.some((f) => f.category === "shoe");
|
|
970
|
+
const isClothingProduct = reqFields.some((f) => f.category === "body");
|
|
969
971
|
const renderField = (field) => {
|
|
970
972
|
if (["shoeEU", "shoeUS", "shoeUK"].includes(field.key)) {
|
|
971
|
-
|
|
973
|
+
const regionField = shoeField;
|
|
974
|
+
const key = regionField.key;
|
|
975
|
+
const showOriginal = field.key !== key;
|
|
976
|
+
return /* @__PURE__ */ jsxs("span", { children: [
|
|
977
|
+
/* @__PURE__ */ jsx(InputRow, { label: `${regionField.label}${field.required ? " *" : ""}`, fieldKey: key, placeholder: regionField.ph }),
|
|
978
|
+
showOriginal && /* @__PURE__ */ jsx(InputRow, { label: field.label, fieldKey: field.key, placeholder: field.placeholder })
|
|
979
|
+
] }, field.key);
|
|
972
980
|
}
|
|
973
981
|
const phNum = parseFloat(field.placeholder?.replace(/[^0-9.]/g, "") || "");
|
|
974
982
|
const phIn = !isNaN(phNum) && phNum > 0 && field.unit === "cm" ? String(Math.round(phNum / 2.54)) : "";
|
|
@@ -985,6 +993,20 @@ function PrimeStyleTryonInner({
|
|
|
985
993
|
field.key
|
|
986
994
|
);
|
|
987
995
|
};
|
|
996
|
+
const profileExtras = [];
|
|
997
|
+
if (isShoeProduct && !dynamicFields.some((f) => f.category === "body")) {
|
|
998
|
+
const bodyFields = isFemale ? FALLBACK_FIELDS_FEMALE : FALLBACK_FIELDS_MALE;
|
|
999
|
+
for (const f of bodyFields) {
|
|
1000
|
+
if (!dynamicFields.some((d) => d.key === f.key)) {
|
|
1001
|
+
profileExtras.push({ ...f, required: false });
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
if (isClothingProduct && !dynamicFields.some((f) => f.category === "shoe")) {
|
|
1006
|
+
profileExtras.push({ key: "footLengthCm", label: "Foot length", required: false, unit: "cm", placeholder: "e.g. 27", category: "shoe" });
|
|
1007
|
+
profileExtras.push({ key: shoeField.key, label: shoeField.label, required: false, unit: "size", placeholder: shoeField.ph, category: "shoe" });
|
|
1008
|
+
}
|
|
1009
|
+
const allOptFields = [...optFields, ...profileExtras];
|
|
988
1010
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
989
1011
|
reqFields.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
990
1012
|
/* @__PURE__ */ jsx("div", { className: "ps-tryon-section-label", children: "Required for this product" }),
|
|
@@ -1006,7 +1028,7 @@ function PrimeStyleTryonInner({
|
|
|
1006
1028
|
fp
|
|
1007
1029
|
)) })
|
|
1008
1030
|
] }),
|
|
1009
|
-
|
|
1031
|
+
allOptFields.length > 0 && /* @__PURE__ */ jsxs("div", { className: "ps-tryon-optional-section", children: [
|
|
1010
1032
|
/* @__PURE__ */ jsxs("button", { className: "ps-tryon-optional-toggle", onClick: (e) => {
|
|
1011
1033
|
const wrap = e.target.closest(".ps-tryon-optional-section").querySelector(".ps-tryon-optional-fields");
|
|
1012
1034
|
const arrow = e.target.closest(".ps-tryon-optional-toggle").querySelector(".ps-tryon-chevron");
|
|
@@ -1019,18 +1041,7 @@ function PrimeStyleTryonInner({
|
|
|
1019
1041
|
/* @__PURE__ */ jsx("span", { children: "Optional — improve accuracy & save to profile" }),
|
|
1020
1042
|
/* @__PURE__ */ jsx("span", { className: "ps-tryon-chevron", children: "▾" })
|
|
1021
1043
|
] }),
|
|
1022
|
-
/* @__PURE__ */
|
|
1023
|
-
optFields.map(renderField),
|
|
1024
|
-
!dynamicFields.some((f) => f.category === "shoe") && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1025
|
-
/* @__PURE__ */ jsx(InputRow, { label: "Foot length", fieldKey: "footLengthCm", placeholder: isCm ? "e.g. 27" : "e.g. 10.5", type: "number", unit: sizingUnit }),
|
|
1026
|
-
/* @__PURE__ */ jsx(InputRow, { label: shoeField.label, fieldKey: shoeField.key, placeholder: shoeField.ph })
|
|
1027
|
-
] })
|
|
1028
|
-
] })
|
|
1029
|
-
] }),
|
|
1030
|
-
optFields.length === 0 && !dynamicFields.some((f) => f.category === "shoe") && /* @__PURE__ */ jsxs("div", { className: "ps-tryon-shoe-section", children: [
|
|
1031
|
-
/* @__PURE__ */ jsx("div", { className: "ps-tryon-shoe-title", children: "Shoe sizing (optional)" }),
|
|
1032
|
-
/* @__PURE__ */ jsx(InputRow, { label: "Foot length", fieldKey: "footLengthCm", placeholder: isCm ? "e.g. 27" : "e.g. 10.5", type: "number", unit: sizingUnit }),
|
|
1033
|
-
/* @__PURE__ */ jsx(InputRow, { label: shoeField.label, fieldKey: shoeField.key, placeholder: shoeField.ph })
|
|
1044
|
+
/* @__PURE__ */ jsx("div", { className: "ps-tryon-optional-fields", style: { display: "none" }, children: allOptFields.map(renderField) })
|
|
1034
1045
|
] })
|
|
1035
1046
|
] });
|
|
1036
1047
|
})() }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|