@primestyleai/tryon 5.10.4 → 5.10.5

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.
@@ -8825,6 +8825,78 @@ function SectionDetailView({
8825
8825
  backendLength ? ` (${backendLength})` : "",
8826
8826
  " ",
8827
8827
  t("based on your measurements and the garment's tailoring chart.")
8828
+ ] }),
8829
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 10, padding: "12px 0 4px", flexShrink: 0 }, children: [
8830
+ /* @__PURE__ */ jsxs(
8831
+ "button",
8832
+ {
8833
+ type: "button",
8834
+ className: "ps-bp-back-btn",
8835
+ onClick: onBack,
8836
+ style: { fontSize: 13, padding: "10px 6px" },
8837
+ children: [
8838
+ /* @__PURE__ */ jsx("span", { className: "ps-bp-back-arrow", children: "←" }),
8839
+ " ",
8840
+ backLabel || t("Back")
8841
+ ]
8842
+ }
8843
+ ),
8844
+ /* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
8845
+ onTryOn ? /* @__PURE__ */ jsxs(
8846
+ "button",
8847
+ {
8848
+ type: "button",
8849
+ onClick: onTryOn,
8850
+ disabled: tryOnProcessing,
8851
+ style: {
8852
+ flex: 1,
8853
+ padding: "12px 16px",
8854
+ borderRadius: 10,
8855
+ background: "var(--ps-accent)",
8856
+ color: "white",
8857
+ border: "none",
8858
+ fontSize: 14,
8859
+ fontWeight: 700,
8860
+ fontFamily: "inherit",
8861
+ cursor: tryOnProcessing ? "default" : "pointer",
8862
+ opacity: tryOnProcessing ? 0.6 : 1,
8863
+ display: "flex",
8864
+ alignItems: "center",
8865
+ justifyContent: "center",
8866
+ gap: 6
8867
+ },
8868
+ children: [
8869
+ /* @__PURE__ */ jsx(CameraIcon$1, { size: 14 }),
8870
+ tryOnProcessing ? t("Processing...") : t("Try It On")
8871
+ ]
8872
+ }
8873
+ ) : /* @__PURE__ */ jsxs(
8874
+ "button",
8875
+ {
8876
+ type: "button",
8877
+ onClick: onBack,
8878
+ style: {
8879
+ flex: 1,
8880
+ padding: "12px 16px",
8881
+ borderRadius: 10,
8882
+ background: "var(--ps-accent)",
8883
+ color: "white",
8884
+ border: "none",
8885
+ fontSize: 14,
8886
+ fontWeight: 700,
8887
+ fontFamily: "inherit",
8888
+ cursor: "pointer",
8889
+ display: "flex",
8890
+ alignItems: "center",
8891
+ justifyContent: "center",
8892
+ gap: 6
8893
+ },
8894
+ children: [
8895
+ continueLabel || t("Continue"),
8896
+ " →"
8897
+ ]
8898
+ }
8899
+ )
8828
8900
  ] })
8829
8901
  ] }) });
8830
8902
  }
@@ -13109,7 +13181,7 @@ function AccessorySizeView({
13109
13181
  },
13110
13182
  opt.value
13111
13183
  )) }),
13112
- /* @__PURE__ */ jsxs("div", { style: { flex: 1, overflowY: "auto" }, children: [
13184
+ /* @__PURE__ */ jsxs("div", { style: { padding: "0 4%" }, children: [
13113
13185
  fields.map((f) => /* @__PURE__ */ jsxs("div", { className: "ps-bpm-row", children: [
13114
13186
  /* @__PURE__ */ jsx("span", { className: "ps-bpm-label", children: t(f.label).toUpperCase() }),
13115
13187
  /* @__PURE__ */ jsxs("div", { className: "ps-bpm-inline-group", children: [
@@ -13129,8 +13201,9 @@ function AccessorySizeView({
13129
13201
  /* @__PURE__ */ jsx("span", { className: "ps-bpm-unit", children: activeUnitLabel.toLowerCase() })
13130
13202
  ] })
13131
13203
  ] }, f.key)),
13132
- error && /* @__PURE__ */ jsx("p", { className: "ps-acc-error", style: { padding: "0 4%" }, children: error })
13204
+ error && /* @__PURE__ */ jsx("p", { className: "ps-acc-error", style: { paddingTop: 8 }, children: error })
13133
13205
  ] }),
13206
+ /* @__PURE__ */ jsx("div", { style: { flex: 1, minHeight: 16 } }),
13134
13207
  !disablePhotoUpload && /* @__PURE__ */ jsxs(Fragment, { children: [
13135
13208
  /* @__PURE__ */ jsx("div", { className: "ps-bpm-or", children: /* @__PURE__ */ jsx("span", { children: t("or") }) }),
13136
13209
  /* @__PURE__ */ jsxs("button", { type: "button", className: "ps-bpm-upload-link", onClick: () => setStep("photo"), children: [
@@ -13139,7 +13212,6 @@ function AccessorySizeView({
13139
13212
  /* @__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
13213
  ] })
13141
13214
  ] }),
13142
- /* @__PURE__ */ jsx("div", { className: "ps-bpm-spacer" }),
13143
13215
  /* @__PURE__ */ jsxs("div", { className: "ps-bpm-bottom", children: [
13144
13216
  /* @__PURE__ */ jsxs("button", { type: "button", className: "ps-bpm-next-btn", onClick: handleManualSubmit, children: [
13145
13217
  t("Find My Size"),
@@ -13713,7 +13785,9 @@ function PrimeStyleTryonInner({
13713
13785
  const [heightUnit, setHeightUnit] = useState(imperial ? "in" : "cm");
13714
13786
  const [weightUnit, setWeightUnit] = useState(imperial ? "lbs" : "kg");
13715
13787
  useEffect(() => {
13716
- if (detectMeasurementType(productTitle) === "foot") setSizingUnit("cm");
13788
+ const mtype = detectMeasurementType(productTitle);
13789
+ if (mtype === "foot" || mtype === "head") setSizingUnit("cm");
13790
+ else if (mtype === "face") setSizingUnit("mm");
13717
13791
  }, [productTitle]);
13718
13792
  const formRef = useRef({});
13719
13793
  const [formGender, setFormGender] = useState("male");
@@ -14535,7 +14609,12 @@ function PrimeStyleTryonInner({
14535
14609
  setBodyLandmarks(lm);
14536
14610
  return lm;
14537
14611
  }).catch(() => null);
14538
- const landmarks = await landmarksPromise;
14612
+ const LANDMARK_TIMEOUT_MS = 2500;
14613
+ const landmarks = await Promise.race([
14614
+ landmarksPromise,
14615
+ new Promise((resolve) => setTimeout(() => resolve(null), LANDMARK_TIMEOUT_MS))
14616
+ ]);
14617
+ if (!landmarks) console.log("[ps-sdk] landmarks not ready in", LANDMARK_TIMEOUT_MS, "ms — proceeding without them");
14539
14618
  const payload = {
14540
14619
  method: "photo",
14541
14620
  locale: sizingCountry,
@@ -18250,6 +18250,78 @@ function SectionDetailView({
18250
18250
  backendLength ? ` (${backendLength})` : "",
18251
18251
  " ",
18252
18252
  t2("based on your measurements and the garment's tailoring chart.")
18253
+ ] }),
18254
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", gap: 10, padding: "12px 0 4px", flexShrink: 0 }, children: [
18255
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
18256
+ "button",
18257
+ {
18258
+ type: "button",
18259
+ className: "ps-bp-back-btn",
18260
+ onClick: onBack,
18261
+ style: { fontSize: 13, padding: "10px 6px" },
18262
+ children: [
18263
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ps-bp-back-arrow", children: "←" }),
18264
+ " ",
18265
+ backLabel || t2("Back")
18266
+ ]
18267
+ }
18268
+ ),
18269
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { flex: 1 } }),
18270
+ onTryOn ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
18271
+ "button",
18272
+ {
18273
+ type: "button",
18274
+ onClick: onTryOn,
18275
+ disabled: tryOnProcessing,
18276
+ style: {
18277
+ flex: 1,
18278
+ padding: "12px 16px",
18279
+ borderRadius: 10,
18280
+ background: "var(--ps-accent)",
18281
+ color: "white",
18282
+ border: "none",
18283
+ fontSize: 14,
18284
+ fontWeight: 700,
18285
+ fontFamily: "inherit",
18286
+ cursor: tryOnProcessing ? "default" : "pointer",
18287
+ opacity: tryOnProcessing ? 0.6 : 1,
18288
+ display: "flex",
18289
+ alignItems: "center",
18290
+ justifyContent: "center",
18291
+ gap: 6
18292
+ },
18293
+ children: [
18294
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CameraIcon$1, { size: 14 }),
18295
+ tryOnProcessing ? t2("Processing...") : t2("Try It On")
18296
+ ]
18297
+ }
18298
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
18299
+ "button",
18300
+ {
18301
+ type: "button",
18302
+ onClick: onBack,
18303
+ style: {
18304
+ flex: 1,
18305
+ padding: "12px 16px",
18306
+ borderRadius: 10,
18307
+ background: "var(--ps-accent)",
18308
+ color: "white",
18309
+ border: "none",
18310
+ fontSize: 14,
18311
+ fontWeight: 700,
18312
+ fontFamily: "inherit",
18313
+ cursor: "pointer",
18314
+ display: "flex",
18315
+ alignItems: "center",
18316
+ justifyContent: "center",
18317
+ gap: 6
18318
+ },
18319
+ children: [
18320
+ continueLabel || t2("Continue"),
18321
+ " →"
18322
+ ]
18323
+ }
18324
+ )
18253
18325
  ] })
18254
18326
  ] }) });
18255
18327
  }
@@ -22534,7 +22606,7 @@ function AccessorySizeView({
22534
22606
  },
22535
22607
  opt.value
22536
22608
  )) }),
22537
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { flex: 1, overflowY: "auto" }, children: [
22609
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { padding: "0 4%" }, children: [
22538
22610
  fields.map((f2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-bpm-row", children: [
22539
22611
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ps-bpm-label", children: t2(f2.label).toUpperCase() }),
22540
22612
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-bpm-inline-group", children: [
@@ -22554,8 +22626,9 @@ function AccessorySizeView({
22554
22626
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ps-bpm-unit", children: activeUnitLabel.toLowerCase() })
22555
22627
  ] })
22556
22628
  ] }, f2.key)),
22557
- error && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "ps-acc-error", style: { padding: "0 4%" }, children: error })
22629
+ error && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "ps-acc-error", style: { paddingTop: 8 }, children: error })
22558
22630
  ] }),
22631
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { flex: 1, minHeight: 16 } }),
22559
22632
  !disablePhotoUpload && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
22560
22633
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bpm-or", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("or") }) }),
22561
22634
  /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "ps-bpm-upload-link", onClick: () => setStep("photo"), children: [
@@ -22564,7 +22637,6 @@ function AccessorySizeView({
22564
22637
  /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", width: "14", height: "14", children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "9 18 15 12 9 6" }) })
22565
22638
  ] })
22566
22639
  ] }),
22567
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bpm-spacer" }),
22568
22640
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-bpm-bottom", children: [
22569
22641
  /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: "ps-bpm-next-btn", onClick: handleManualSubmit, children: [
22570
22642
  t2("Find My Size"),
@@ -23138,7 +23210,9 @@ function PrimeStyleTryonInner({
23138
23210
  const [heightUnit, setHeightUnit] = reactExports.useState(imperial ? "in" : "cm");
23139
23211
  const [weightUnit, setWeightUnit] = reactExports.useState(imperial ? "lbs" : "kg");
23140
23212
  reactExports.useEffect(() => {
23141
- if (detectMeasurementType(productTitle) === "foot") setSizingUnit("cm");
23213
+ const mtype = detectMeasurementType(productTitle);
23214
+ if (mtype === "foot" || mtype === "head") setSizingUnit("cm");
23215
+ else if (mtype === "face") setSizingUnit("mm");
23142
23216
  }, [productTitle]);
23143
23217
  const formRef = reactExports.useRef({});
23144
23218
  const [formGender, setFormGender] = reactExports.useState("male");
@@ -23960,7 +24034,12 @@ function PrimeStyleTryonInner({
23960
24034
  setBodyLandmarks(lm);
23961
24035
  return lm;
23962
24036
  }).catch(() => null);
23963
- const landmarks = await landmarksPromise;
24037
+ const LANDMARK_TIMEOUT_MS = 2500;
24038
+ const landmarks = await Promise.race([
24039
+ landmarksPromise,
24040
+ new Promise((resolve) => setTimeout(() => resolve(null), LANDMARK_TIMEOUT_MS))
24041
+ ]);
24042
+ if (!landmarks) console.log("[ps-sdk] landmarks not ready in", LANDMARK_TIMEOUT_MS, "ms — proceeding without them");
23964
24043
  const payload = {
23965
24044
  method: "photo",
23966
24045
  locale: sizingCountry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.10.4",
3
+ "version": "5.10.5",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",