@primestyleai/tryon 5.8.17 → 5.8.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.
@@ -10750,10 +10750,13 @@ function PrimeStyleTryonInner({
10750
10750
  );
10751
10751
  const handleUseActiveProfile = useCallback(() => {
10752
10752
  const p = profiles.find((x) => x.id === activeProfileId);
10753
- if (!p || !p.measurements || Object.keys(p.measurements).length === 0) return;
10753
+ if (!p) return;
10754
+ const hasIdentity = (p.height ?? 0) > 0 && (p.weight ?? 0) > 0;
10755
+ if (!hasIdentity) return;
10754
10756
  setSizingResult(null);
10755
10757
  setSizingLoading(true);
10756
- setEstimationDone(true);
10758
+ const hasStoredMeasurements = !!p.measurements && Object.keys(p.measurements).length > 0;
10759
+ setEstimationDone(hasStoredMeasurements);
10757
10760
  setView("size-result");
10758
10761
  recommendForProduct({
10759
10762
  productId: effectiveProductId,
@@ -10765,6 +10768,7 @@ function PrimeStyleTryonInner({
10765
10768
  skipCache: true
10766
10769
  }).then((res) => {
10767
10770
  if (res?.raw) setSizingResult(res.raw);
10771
+ setEstimationDone(true);
10768
10772
  }).catch(() => {
10769
10773
  }).finally(() => setSizingLoading(false));
10770
10774
  }, [profiles, activeProfileId, effectiveProductId, productTitle, productImage, sizeGuideData, apiUrl]);
@@ -11613,7 +11617,7 @@ function PrimeStyleTryonInner({
11613
11617
  setSizingUnit,
11614
11618
  hasActiveProfileWithMeasurements: (() => {
11615
11619
  const p = profiles.find((x) => x.id === activeProfileId);
11616
- return !!(p && p.measurements && Object.keys(p.measurements).length > 0);
11620
+ return !!(p && (p.height ?? 0) > 0 && (p.weight ?? 0) > 0);
11617
11621
  })(),
11618
11622
  onUseActiveProfile: handleUseActiveProfile,
11619
11623
  activeProfileName: (() => {
@@ -20174,10 +20174,13 @@ function PrimeStyleTryonInner({
20174
20174
  );
20175
20175
  const handleUseActiveProfile = reactExports.useCallback(() => {
20176
20176
  const p2 = profiles.find((x2) => x2.id === activeProfileId);
20177
- if (!p2 || !p2.measurements || Object.keys(p2.measurements).length === 0) return;
20177
+ if (!p2) return;
20178
+ const hasIdentity = (p2.height ?? 0) > 0 && (p2.weight ?? 0) > 0;
20179
+ if (!hasIdentity) return;
20178
20180
  setSizingResult(null);
20179
20181
  setSizingLoading(true);
20180
- setEstimationDone(true);
20182
+ const hasStoredMeasurements = !!p2.measurements && Object.keys(p2.measurements).length > 0;
20183
+ setEstimationDone(hasStoredMeasurements);
20181
20184
  setView("size-result");
20182
20185
  recommendForProduct({
20183
20186
  productId: effectiveProductId,
@@ -20189,6 +20192,7 @@ function PrimeStyleTryonInner({
20189
20192
  skipCache: true
20190
20193
  }).then((res) => {
20191
20194
  if (res?.raw) setSizingResult(res.raw);
20195
+ setEstimationDone(true);
20192
20196
  }).catch(() => {
20193
20197
  }).finally(() => setSizingLoading(false));
20194
20198
  }, [profiles, activeProfileId, effectiveProductId, productTitle, productImage, sizeGuideData, apiUrl]);
@@ -21037,7 +21041,7 @@ function PrimeStyleTryonInner({
21037
21041
  setSizingUnit,
21038
21042
  hasActiveProfileWithMeasurements: (() => {
21039
21043
  const p2 = profiles.find((x2) => x2.id === activeProfileId);
21040
- return !!(p2 && p2.measurements && Object.keys(p2.measurements).length > 0);
21044
+ return !!(p2 && (p2.height ?? 0) > 0 && (p2.weight ?? 0) > 0);
21041
21045
  })(),
21042
21046
  onUseActiveProfile: handleUseActiveProfile,
21043
21047
  activeProfileName: (() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.8.17",
3
+ "version": "5.8.18",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",