@primestyleai/tryon 5.8.15 → 5.8.16

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.
@@ -8017,9 +8017,8 @@ function SizeResultView({
8017
8017
  onClick: () => {
8018
8018
  if (!guideFile) return;
8019
8019
  handleFileSelect(guideFile);
8020
- handleTryOnSubmit();
8020
+ handleTryOnSubmit(guideFile);
8021
8021
  setShowPhotoGuide(false);
8022
- setGuideFile(null);
8023
8022
  },
8024
8023
  children: t("START TRY-ON")
8025
8024
  }
@@ -8152,9 +8151,8 @@ function SizeResultView({
8152
8151
  /* @__PURE__ */ jsxs("button", { className: "ps-tryon-v2-cta", style: { marginTop: 0 }, disabled: !guideFile, onClick: () => {
8153
8152
  if (!guideFile) return;
8154
8153
  handleFileSelect(guideFile);
8155
- handleTryOnSubmit();
8154
+ handleTryOnSubmit(guideFile);
8156
8155
  setShowPhotoGuide(false);
8157
- setGuideFile(null);
8158
8156
  }, children: [
8159
8157
  /* @__PURE__ */ jsx(CameraIcon$1, { size: 14 }),
8160
8158
  " ",
@@ -11111,8 +11109,8 @@ function PrimeStyleTryonInner({
11111
11109
  }
11112
11110
  setSizingLoading(false);
11113
11111
  }, [apiUrl, productImage, productTitle, sizingUnit, weightUnit, sizingCountry, sizeGuide, dynamicFields, persistResultToProfile]);
11114
- const handleTryOnSubmit = useCallback(async () => {
11115
- const file = selectedFile || selectedFileRef.current;
11112
+ const handleTryOnSubmit = useCallback(async (overrideFile) => {
11113
+ const file = overrideFile || selectedFile || selectedFileRef.current;
11116
11114
  if (!file || !apiRef.current || !sseRef.current) {
11117
11115
  const msg = !apiRef.current ? t("SDK not configured. Please provide an API key.") : t("Please upload a photo first.");
11118
11116
  setErrorMessage(msg);
@@ -11120,10 +11118,14 @@ function PrimeStyleTryonInner({
11120
11118
  onError?.({ message: msg, code: "SDK_NOT_CONFIGURED" });
11121
11119
  return;
11122
11120
  }
11121
+ if (overrideFile && overrideFile !== selectedFile) {
11122
+ setSelectedFile(overrideFile);
11123
+ selectedFileRef.current = overrideFile;
11124
+ }
11123
11125
  completedRef.current = false;
11124
11126
  setTryOnProcessing(true);
11125
- const previewObjUrl = previewUrl || URL.createObjectURL(file);
11126
- if (!previewUrl) setPreviewUrl(previewObjUrl);
11127
+ const previewObjUrl = (overrideFile ? null : previewUrl) || URL.createObjectURL(file);
11128
+ if (overrideFile || !previewUrl) setPreviewUrl(previewObjUrl);
11127
11129
  modelPoseRef.current = null;
11128
11130
  setBodyLandmarks(null);
11129
11131
  detectMeasurementLines(previewObjUrl).then((lines) => {
@@ -19,7 +19,7 @@ export declare function SizeResultView({ sizingLoading, sizingResult, sizeGuide,
19
19
  previewUrl: string | null;
20
20
  handleFileSelect: (file: File) => void;
21
21
  handleRemovePreview: () => void;
22
- handleTryOnSubmit: () => void;
22
+ handleTryOnSubmit: (overrideFile?: File) => void;
23
23
  tryOnProcessing?: boolean;
24
24
  bodyLandmarks?: BodyLandmarks | null;
25
25
  activeSection: string | null;
@@ -17441,9 +17441,8 @@ function SizeResultView({
17441
17441
  onClick: () => {
17442
17442
  if (!guideFile) return;
17443
17443
  handleFileSelect(guideFile);
17444
- handleTryOnSubmit();
17444
+ handleTryOnSubmit(guideFile);
17445
17445
  setShowPhotoGuide(false);
17446
- setGuideFile(null);
17447
17446
  },
17448
17447
  children: t2("START TRY-ON")
17449
17448
  }
@@ -17576,9 +17575,8 @@ function SizeResultView({
17576
17575
  /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "ps-tryon-v2-cta", style: { marginTop: 0 }, disabled: !guideFile, onClick: () => {
17577
17576
  if (!guideFile) return;
17578
17577
  handleFileSelect(guideFile);
17579
- handleTryOnSubmit();
17578
+ handleTryOnSubmit(guideFile);
17580
17579
  setShowPhotoGuide(false);
17581
- setGuideFile(null);
17582
17580
  }, children: [
17583
17581
  /* @__PURE__ */ jsxRuntimeExports.jsx(CameraIcon$1, { size: 14 }),
17584
17582
  " ",
@@ -20535,8 +20533,8 @@ function PrimeStyleTryonInner({
20535
20533
  }
20536
20534
  setSizingLoading(false);
20537
20535
  }, [apiUrl, productImage, productTitle, sizingUnit, weightUnit, sizingCountry, sizeGuide, dynamicFields, persistResultToProfile]);
20538
- const handleTryOnSubmit = reactExports.useCallback(async () => {
20539
- const file = selectedFile || selectedFileRef.current;
20536
+ const handleTryOnSubmit = reactExports.useCallback(async (overrideFile) => {
20537
+ const file = overrideFile || selectedFile || selectedFileRef.current;
20540
20538
  if (!file || !apiRef.current || !sseRef.current) {
20541
20539
  const msg = !apiRef.current ? t2("SDK not configured. Please provide an API key.") : t2("Please upload a photo first.");
20542
20540
  setErrorMessage(msg);
@@ -20544,10 +20542,14 @@ function PrimeStyleTryonInner({
20544
20542
  onError?.({ message: msg, code: "SDK_NOT_CONFIGURED" });
20545
20543
  return;
20546
20544
  }
20545
+ if (overrideFile && overrideFile !== selectedFile) {
20546
+ setSelectedFile(overrideFile);
20547
+ selectedFileRef.current = overrideFile;
20548
+ }
20547
20549
  completedRef.current = false;
20548
20550
  setTryOnProcessing(true);
20549
- const previewObjUrl = previewUrl || URL.createObjectURL(file);
20550
- if (!previewUrl) setPreviewUrl(previewObjUrl);
20551
+ const previewObjUrl = (overrideFile ? null : previewUrl) || URL.createObjectURL(file);
20552
+ if (overrideFile || !previewUrl) setPreviewUrl(previewObjUrl);
20551
20553
  modelPoseRef.current = null;
20552
20554
  setBodyLandmarks(null);
20553
20555
  detectMeasurementLines(previewObjUrl).then((lines) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.8.15",
3
+ "version": "5.8.16",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",