@primestyleai/tryon 5.10.4 → 5.10.6

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.
@@ -2113,7 +2113,10 @@ const STYLES = `
2113
2113
  MobileScanningView — row of ring + bar + percent, same tokens. */
2114
2114
  .ps-tryon-progress-wrap {
2115
2115
  display: flex; align-items: center; gap: 12px;
2116
- width: 100%; max-width: 360px; margin-top: 18px;
2116
+ /* Fixed logical width so neither the ring nor the bar reflow when the
2117
+ sibling stage text changes character count each tick. */
2118
+ width: min(320px, calc(100% - 24px));
2119
+ margin-top: 18px;
2117
2120
  }
2118
2121
  .ps-tryon-progress-wrap .ps-tryon-progress-bar-wrap {
2119
2122
  flex: 1; height: 6px; border-radius: 4px; overflow: hidden;
@@ -7715,13 +7718,11 @@ function MobileScanningView({
7715
7718
  ),
7716
7719
  isPhotoMode && bodyLandmarks && /* @__PURE__ */ jsx("div", { className: "ps-msc-pose-wrap", children: /* @__PURE__ */ jsx(MobileSkeleton, { landmarks: bodyLandmarks, w: dims.w, h: dims.h }) })
7717
7720
  ] }),
7718
- /* @__PURE__ */ jsxs("div", { className: "ps-msc-stage", children: [
7719
- /* @__PURE__ */ jsxs("div", { className: "ps-msc-stage-slot", children: [
7720
- /* @__PURE__ */ jsx("div", { className: "ps-msc-stage-title", children: current.title }),
7721
- /* @__PURE__ */ jsx("div", { className: "ps-msc-stage-desc", children: current.desc })
7722
- ] }, stageIdx),
7723
- tryOnProcessing && /* @__PURE__ */ jsx(MscTryOnProgress, { t })
7724
- ] }),
7721
+ /* @__PURE__ */ jsx("div", { className: "ps-msc-stage", children: /* @__PURE__ */ jsxs("div", { className: "ps-msc-stage-slot", children: [
7722
+ /* @__PURE__ */ jsx("div", { className: "ps-msc-stage-title", children: current.title }),
7723
+ /* @__PURE__ */ jsx("div", { className: "ps-msc-stage-desc", children: current.desc })
7724
+ ] }, stageIdx) }),
7725
+ tryOnProcessing && /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "center", padding: "0 16px", width: "100%" }, children: /* @__PURE__ */ jsx(MscTryOnProgress, { t }) }),
7725
7726
  /* @__PURE__ */ jsx("div", { className: "ps-bpm-spacer" }),
7726
7727
  /* @__PURE__ */ jsx("div", { className: "ps-bpm-bottom", children: /* @__PURE__ */ jsx(
7727
7728
  MobileBottomTabs,
@@ -8825,6 +8826,78 @@ function SectionDetailView({
8825
8826
  backendLength ? ` (${backendLength})` : "",
8826
8827
  " ",
8827
8828
  t("based on your measurements and the garment's tailoring chart.")
8829
+ ] }),
8830
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 10, padding: "12px 0 4px", flexShrink: 0 }, children: [
8831
+ /* @__PURE__ */ jsxs(
8832
+ "button",
8833
+ {
8834
+ type: "button",
8835
+ className: "ps-bp-back-btn",
8836
+ onClick: onBack,
8837
+ style: { fontSize: 13, padding: "10px 6px" },
8838
+ children: [
8839
+ /* @__PURE__ */ jsx("span", { className: "ps-bp-back-arrow", children: "←" }),
8840
+ " ",
8841
+ backLabel || t("Back")
8842
+ ]
8843
+ }
8844
+ ),
8845
+ /* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
8846
+ onTryOn ? /* @__PURE__ */ jsxs(
8847
+ "button",
8848
+ {
8849
+ type: "button",
8850
+ onClick: onTryOn,
8851
+ disabled: tryOnProcessing,
8852
+ style: {
8853
+ flex: 1,
8854
+ padding: "12px 16px",
8855
+ borderRadius: 10,
8856
+ background: "var(--ps-accent)",
8857
+ color: "white",
8858
+ border: "none",
8859
+ fontSize: 14,
8860
+ fontWeight: 700,
8861
+ fontFamily: "inherit",
8862
+ cursor: tryOnProcessing ? "default" : "pointer",
8863
+ opacity: tryOnProcessing ? 0.6 : 1,
8864
+ display: "flex",
8865
+ alignItems: "center",
8866
+ justifyContent: "center",
8867
+ gap: 6
8868
+ },
8869
+ children: [
8870
+ /* @__PURE__ */ jsx(CameraIcon$1, { size: 14 }),
8871
+ tryOnProcessing ? t("Processing...") : t("Try It On")
8872
+ ]
8873
+ }
8874
+ ) : /* @__PURE__ */ jsxs(
8875
+ "button",
8876
+ {
8877
+ type: "button",
8878
+ onClick: onBack,
8879
+ style: {
8880
+ flex: 1,
8881
+ padding: "12px 16px",
8882
+ borderRadius: 10,
8883
+ background: "var(--ps-accent)",
8884
+ color: "white",
8885
+ border: "none",
8886
+ fontSize: 14,
8887
+ fontWeight: 700,
8888
+ fontFamily: "inherit",
8889
+ cursor: "pointer",
8890
+ display: "flex",
8891
+ alignItems: "center",
8892
+ justifyContent: "center",
8893
+ gap: 6
8894
+ },
8895
+ children: [
8896
+ continueLabel || t("Continue"),
8897
+ " →"
8898
+ ]
8899
+ }
8900
+ )
8828
8901
  ] })
8829
8902
  ] }) });
8830
8903
  }
@@ -13109,7 +13182,7 @@ function AccessorySizeView({
13109
13182
  },
13110
13183
  opt.value
13111
13184
  )) }),
13112
- /* @__PURE__ */ jsxs("div", { style: { flex: 1, overflowY: "auto" }, children: [
13185
+ /* @__PURE__ */ jsxs("div", { style: { padding: "0 4%" }, children: [
13113
13186
  fields.map((f) => /* @__PURE__ */ jsxs("div", { className: "ps-bpm-row", children: [
13114
13187
  /* @__PURE__ */ jsx("span", { className: "ps-bpm-label", children: t(f.label).toUpperCase() }),
13115
13188
  /* @__PURE__ */ jsxs("div", { className: "ps-bpm-inline-group", children: [
@@ -13129,8 +13202,9 @@ function AccessorySizeView({
13129
13202
  /* @__PURE__ */ jsx("span", { className: "ps-bpm-unit", children: activeUnitLabel.toLowerCase() })
13130
13203
  ] })
13131
13204
  ] }, f.key)),
13132
- error && /* @__PURE__ */ jsx("p", { className: "ps-acc-error", style: { padding: "0 4%" }, children: error })
13205
+ error && /* @__PURE__ */ jsx("p", { className: "ps-acc-error", style: { paddingTop: 8 }, children: error })
13133
13206
  ] }),
13207
+ /* @__PURE__ */ jsx("div", { style: { flex: 1, minHeight: 16 } }),
13134
13208
  !disablePhotoUpload && /* @__PURE__ */ jsxs(Fragment, { children: [
13135
13209
  /* @__PURE__ */ jsx("div", { className: "ps-bpm-or", children: /* @__PURE__ */ jsx("span", { children: t("or") }) }),
13136
13210
  /* @__PURE__ */ jsxs("button", { type: "button", className: "ps-bpm-upload-link", onClick: () => setStep("photo"), children: [
@@ -13139,7 +13213,6 @@ function AccessorySizeView({
13139
13213
  /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", width: "14", height: "14", children: /* @__PURE__ */ jsx("polyline", { points: "9 18 15 12 9 6" }) })
13140
13214
  ] })
13141
13215
  ] }),
13142
- /* @__PURE__ */ jsx("div", { className: "ps-bpm-spacer" }),
13143
13216
  /* @__PURE__ */ jsxs("div", { className: "ps-bpm-bottom", children: [
13144
13217
  /* @__PURE__ */ jsxs("button", { type: "button", className: "ps-bpm-next-btn", onClick: handleManualSubmit, children: [
13145
13218
  t("Find My Size"),
@@ -13713,7 +13786,9 @@ function PrimeStyleTryonInner({
13713
13786
  const [heightUnit, setHeightUnit] = useState(imperial ? "in" : "cm");
13714
13787
  const [weightUnit, setWeightUnit] = useState(imperial ? "lbs" : "kg");
13715
13788
  useEffect(() => {
13716
- if (detectMeasurementType(productTitle) === "foot") setSizingUnit("cm");
13789
+ const mtype = detectMeasurementType(productTitle);
13790
+ if (mtype === "foot" || mtype === "head") setSizingUnit("cm");
13791
+ else if (mtype === "face") setSizingUnit("mm");
13717
13792
  }, [productTitle]);
13718
13793
  const formRef = useRef({});
13719
13794
  const [formGender, setFormGender] = useState("male");
@@ -14535,7 +14610,12 @@ function PrimeStyleTryonInner({
14535
14610
  setBodyLandmarks(lm);
14536
14611
  return lm;
14537
14612
  }).catch(() => null);
14538
- const landmarks = await landmarksPromise;
14613
+ const LANDMARK_TIMEOUT_MS = 2500;
14614
+ const landmarks = await Promise.race([
14615
+ landmarksPromise,
14616
+ new Promise((resolve) => setTimeout(() => resolve(null), LANDMARK_TIMEOUT_MS))
14617
+ ]);
14618
+ if (!landmarks) console.log("[ps-sdk] landmarks not ready in", LANDMARK_TIMEOUT_MS, "ms — proceeding without them");
14539
14619
  const payload = {
14540
14620
  method: "photo",
14541
14621
  locale: sizingCountry,