@primestyleai/tryon 5.8.17 → 5.8.19
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.
package/dist/react/index.js
CHANGED
|
@@ -10750,10 +10750,15 @@ function PrimeStyleTryonInner({
|
|
|
10750
10750
|
);
|
|
10751
10751
|
const handleUseActiveProfile = useCallback(() => {
|
|
10752
10752
|
const p = profiles.find((x) => x.id === activeProfileId);
|
|
10753
|
-
if (!p
|
|
10753
|
+
if (!p) return;
|
|
10754
|
+
const profileHeight = p.height ?? p.heightCm ?? 0;
|
|
10755
|
+
const profileWeight = p.weight ?? p.weightKg ?? 0;
|
|
10756
|
+
const hasIdentity = profileHeight > 0 && profileWeight > 0;
|
|
10757
|
+
if (!hasIdentity) return;
|
|
10754
10758
|
setSizingResult(null);
|
|
10755
10759
|
setSizingLoading(true);
|
|
10756
|
-
|
|
10760
|
+
const hasStoredMeasurements = !!p.measurements && Object.keys(p.measurements).length > 0;
|
|
10761
|
+
setEstimationDone(hasStoredMeasurements);
|
|
10757
10762
|
setView("size-result");
|
|
10758
10763
|
recommendForProduct({
|
|
10759
10764
|
productId: effectiveProductId,
|
|
@@ -10765,6 +10770,7 @@ function PrimeStyleTryonInner({
|
|
|
10765
10770
|
skipCache: true
|
|
10766
10771
|
}).then((res) => {
|
|
10767
10772
|
if (res?.raw) setSizingResult(res.raw);
|
|
10773
|
+
setEstimationDone(true);
|
|
10768
10774
|
}).catch(() => {
|
|
10769
10775
|
}).finally(() => setSizingLoading(false));
|
|
10770
10776
|
}, [profiles, activeProfileId, effectiveProductId, productTitle, productImage, sizeGuideData, apiUrl]);
|
|
@@ -11613,7 +11619,10 @@ function PrimeStyleTryonInner({
|
|
|
11613
11619
|
setSizingUnit,
|
|
11614
11620
|
hasActiveProfileWithMeasurements: (() => {
|
|
11615
11621
|
const p = profiles.find((x) => x.id === activeProfileId);
|
|
11616
|
-
|
|
11622
|
+
if (!p) return false;
|
|
11623
|
+
const ph = p.height ?? p.heightCm ?? 0;
|
|
11624
|
+
const pw = p.weight ?? p.weightKg ?? 0;
|
|
11625
|
+
return ph > 0 && pw > 0;
|
|
11617
11626
|
})(),
|
|
11618
11627
|
onUseActiveProfile: handleUseActiveProfile,
|
|
11619
11628
|
activeProfileName: (() => {
|
|
@@ -20174,10 +20174,15 @@ function PrimeStyleTryonInner({
|
|
|
20174
20174
|
);
|
|
20175
20175
|
const handleUseActiveProfile = reactExports.useCallback(() => {
|
|
20176
20176
|
const p2 = profiles.find((x2) => x2.id === activeProfileId);
|
|
20177
|
-
if (!p2
|
|
20177
|
+
if (!p2) return;
|
|
20178
|
+
const profileHeight = p2.height ?? p2.heightCm ?? 0;
|
|
20179
|
+
const profileWeight = p2.weight ?? p2.weightKg ?? 0;
|
|
20180
|
+
const hasIdentity = profileHeight > 0 && profileWeight > 0;
|
|
20181
|
+
if (!hasIdentity) return;
|
|
20178
20182
|
setSizingResult(null);
|
|
20179
20183
|
setSizingLoading(true);
|
|
20180
|
-
|
|
20184
|
+
const hasStoredMeasurements = !!p2.measurements && Object.keys(p2.measurements).length > 0;
|
|
20185
|
+
setEstimationDone(hasStoredMeasurements);
|
|
20181
20186
|
setView("size-result");
|
|
20182
20187
|
recommendForProduct({
|
|
20183
20188
|
productId: effectiveProductId,
|
|
@@ -20189,6 +20194,7 @@ function PrimeStyleTryonInner({
|
|
|
20189
20194
|
skipCache: true
|
|
20190
20195
|
}).then((res) => {
|
|
20191
20196
|
if (res?.raw) setSizingResult(res.raw);
|
|
20197
|
+
setEstimationDone(true);
|
|
20192
20198
|
}).catch(() => {
|
|
20193
20199
|
}).finally(() => setSizingLoading(false));
|
|
20194
20200
|
}, [profiles, activeProfileId, effectiveProductId, productTitle, productImage, sizeGuideData, apiUrl]);
|
|
@@ -21037,7 +21043,10 @@ function PrimeStyleTryonInner({
|
|
|
21037
21043
|
setSizingUnit,
|
|
21038
21044
|
hasActiveProfileWithMeasurements: (() => {
|
|
21039
21045
|
const p2 = profiles.find((x2) => x2.id === activeProfileId);
|
|
21040
|
-
|
|
21046
|
+
if (!p2) return false;
|
|
21047
|
+
const ph2 = p2.height ?? p2.heightCm ?? 0;
|
|
21048
|
+
const pw = p2.weight ?? p2.weightKg ?? 0;
|
|
21049
|
+
return ph2 > 0 && pw > 0;
|
|
21041
21050
|
})(),
|
|
21042
21051
|
onUseActiveProfile: handleUseActiveProfile,
|
|
21043
21052
|
activeProfileName: (() => {
|