@primestyleai/tryon 5.10.16 → 5.10.18

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.
@@ -19307,7 +19307,13 @@ function SizeResultView({
19307
19307
  unitLbl,
19308
19308
  chartUnit: resultUnit,
19309
19309
  lengthEntry: null,
19310
- onBack: resultImageUrl ? onClose || (() => setView("body-profile")) : () => setView("body-profile"),
19310
+ onBack: () => {
19311
+ if (resultImageUrl) {
19312
+ onResetTryOn?.();
19313
+ } else {
19314
+ setView("body-profile");
19315
+ }
19316
+ },
19311
19317
  backLabel: t2("Back"),
19312
19318
  internationalSizes: sizingResult?.internationalSizes,
19313
19319
  onTryOn: resultImageUrl || vtoExcluded ? void 0 : handleSingleTryOn,
@@ -19355,7 +19361,13 @@ function SizeResultView({
19355
19361
  unitLbl,
19356
19362
  chartUnit: resultUnit,
19357
19363
  lengthEntry: null,
19358
- onBack: resultImageUrl ? onClose || (() => setView("body-profile")) : () => setView("body-profile"),
19364
+ onBack: () => {
19365
+ if (resultImageUrl) {
19366
+ onResetTryOn?.();
19367
+ } else {
19368
+ setView("body-profile");
19369
+ }
19370
+ },
19359
19371
  backLabel: t2("Back"),
19360
19372
  internationalSizes: sizingResult?.internationalSizes,
19361
19373
  onTryOn: resultImageUrl || vtoExcluded ? void 0 : handleSingleTryOn,
@@ -24147,6 +24159,16 @@ function PrimeStyleTryonInner({
24147
24159
  const minVisible = new Promise((r2) => setTimeout(r2, 4500));
24148
24160
  try {
24149
24161
  const faceResult = await detectFaceMeasurements(objUrl);
24162
+ if (!faceResult) {
24163
+ console.warn("[ps-sdk] face detection returned no result — likely a full-body photo for a face/head product");
24164
+ await minVisible;
24165
+ const msg = measurementType === "head" ? t2("We couldn't detect your head clearly. Please upload a close-up photo that shows your full head and ears.") : t2("We couldn't detect your face clearly. Please upload a close-up selfie that shows both eyes.");
24166
+ setErrorMessage(msg);
24167
+ setView("error");
24168
+ onError?.({ message: msg, code: "FACE_DETECTION_FAILED" });
24169
+ setSizingLoading(false);
24170
+ return;
24171
+ }
24150
24172
  if (faceResult) setFaceLandmarks(faceResult.landmarks);
24151
24173
  const facePayload = {
24152
24174
  product: { title: productTitle, productId: effectiveProductId },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.10.16",
3
+ "version": "5.10.18",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",