@primestyleai/tryon 5.8.34 → 5.8.35
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
|
@@ -518,8 +518,8 @@ async function estimateFullMeasurements(args) {
|
|
|
518
518
|
"footLengthCm"
|
|
519
519
|
];
|
|
520
520
|
const payload = {
|
|
521
|
-
height: args.height,
|
|
522
|
-
weight: args.weight,
|
|
521
|
+
height: args.height ?? 0,
|
|
522
|
+
weight: args.weight ?? 0,
|
|
523
523
|
heightUnit: args.heightUnit,
|
|
524
524
|
weightUnit: args.weightUnit,
|
|
525
525
|
gender: args.gender,
|
|
@@ -539,7 +539,11 @@ async function estimateFullMeasurements(args) {
|
|
|
539
539
|
if (!res.ok) return null;
|
|
540
540
|
const data = await res.json();
|
|
541
541
|
if (!data?.estimates) return null;
|
|
542
|
-
return {
|
|
542
|
+
return {
|
|
543
|
+
estimates: data.estimates,
|
|
544
|
+
unit: data.unit || "cm",
|
|
545
|
+
userEstimates: data.userEstimates
|
|
546
|
+
};
|
|
543
547
|
} catch {
|
|
544
548
|
return null;
|
|
545
549
|
}
|
|
@@ -12476,11 +12480,12 @@ function PrimeStyleTryonInner({
|
|
|
12476
12480
|
const weightVal = newProfile.weightKg || newProfile.weight || 0;
|
|
12477
12481
|
const heightUnitVal = newProfile.sizingUnit === "in" ? "in" : "cm";
|
|
12478
12482
|
const weightUnitVal = newProfile.sizingUnit === "in" ? "lbs" : "kg";
|
|
12479
|
-
|
|
12483
|
+
const photoBase64 = newProfile.photoBase64;
|
|
12484
|
+
if (photoBase64 || heightVal > 0 && weightVal > 0) {
|
|
12480
12485
|
estimateFullMeasurements({
|
|
12481
12486
|
apiUrl,
|
|
12482
|
-
height: heightVal,
|
|
12483
|
-
weight: weightVal,
|
|
12487
|
+
height: heightVal > 0 ? heightVal : void 0,
|
|
12488
|
+
weight: weightVal > 0 ? weightVal : void 0,
|
|
12484
12489
|
heightUnit: heightUnitVal,
|
|
12485
12490
|
weightUnit: weightUnitVal,
|
|
12486
12491
|
gender: newProfile.gender,
|
|
@@ -12488,10 +12493,34 @@ function PrimeStyleTryonInner({
|
|
|
12488
12493
|
chestProfile: newProfile.chestProfile,
|
|
12489
12494
|
midsectionProfile: newProfile.midsectionProfile,
|
|
12490
12495
|
hipProfile: newProfile.hipProfile,
|
|
12491
|
-
bodyImage:
|
|
12496
|
+
bodyImage: photoBase64
|
|
12492
12497
|
}).then((est) => {
|
|
12493
12498
|
if (est) {
|
|
12494
12499
|
updateProfileMeasurements(newProfile.id, est.estimates, est.unit);
|
|
12500
|
+
if (est.userEstimates) {
|
|
12501
|
+
const all = lsGet("profiles", []);
|
|
12502
|
+
const idx = all.findIndex((p) => p.id === newProfile.id);
|
|
12503
|
+
if (idx >= 0) {
|
|
12504
|
+
const target = all[idx];
|
|
12505
|
+
const u = est.userEstimates;
|
|
12506
|
+
const patched = { ...target };
|
|
12507
|
+
if (u.height && !(target.height || target.heightCm)) {
|
|
12508
|
+
patched.height = u.height;
|
|
12509
|
+
patched.heightCm = u.height;
|
|
12510
|
+
patched.heightUnit = "cm";
|
|
12511
|
+
}
|
|
12512
|
+
if (u.weight && !(target.weight || target.weightKg)) {
|
|
12513
|
+
patched.weight = u.weight;
|
|
12514
|
+
patched.weightKg = u.weight;
|
|
12515
|
+
patched.weightUnit = "kg";
|
|
12516
|
+
}
|
|
12517
|
+
if (u.age && !target.age) {
|
|
12518
|
+
patched.age = u.age;
|
|
12519
|
+
}
|
|
12520
|
+
all[idx] = patched;
|
|
12521
|
+
lsSet("profiles", all);
|
|
12522
|
+
}
|
|
12523
|
+
}
|
|
12495
12524
|
setProfiles(lsGet("profiles", []));
|
|
12496
12525
|
}
|
|
12497
12526
|
}).catch(() => {
|
|
@@ -45,8 +45,8 @@ export declare function recommendForProduct(input: RecommendForProductInput): Pr
|
|
|
45
45
|
export declare function estimateFullMeasurements(args: {
|
|
46
46
|
apiUrl?: string;
|
|
47
47
|
apiKey?: string;
|
|
48
|
-
height
|
|
49
|
-
weight
|
|
48
|
+
height?: number;
|
|
49
|
+
weight?: number;
|
|
50
50
|
heightUnit: "cm" | "in" | "ft";
|
|
51
51
|
weightUnit: "kg" | "lbs";
|
|
52
52
|
gender: "male" | "female";
|
|
@@ -58,4 +58,9 @@ export declare function estimateFullMeasurements(args: {
|
|
|
58
58
|
}): Promise<{
|
|
59
59
|
estimates: ProfileMeasurements;
|
|
60
60
|
unit: "cm" | "in";
|
|
61
|
+
userEstimates?: {
|
|
62
|
+
height?: number;
|
|
63
|
+
weight?: number;
|
|
64
|
+
age?: number;
|
|
65
|
+
};
|
|
61
66
|
} | null>;
|
|
@@ -9942,8 +9942,8 @@ async function estimateFullMeasurements(args) {
|
|
|
9942
9942
|
"footLengthCm"
|
|
9943
9943
|
];
|
|
9944
9944
|
const payload = {
|
|
9945
|
-
height: args.height,
|
|
9946
|
-
weight: args.weight,
|
|
9945
|
+
height: args.height ?? 0,
|
|
9946
|
+
weight: args.weight ?? 0,
|
|
9947
9947
|
heightUnit: args.heightUnit,
|
|
9948
9948
|
weightUnit: args.weightUnit,
|
|
9949
9949
|
gender: args.gender,
|
|
@@ -9963,7 +9963,11 @@ async function estimateFullMeasurements(args) {
|
|
|
9963
9963
|
if (!res.ok) return null;
|
|
9964
9964
|
const data = await res.json();
|
|
9965
9965
|
if (!data?.estimates) return null;
|
|
9966
|
-
return {
|
|
9966
|
+
return {
|
|
9967
|
+
estimates: data.estimates,
|
|
9968
|
+
unit: data.unit || "cm",
|
|
9969
|
+
userEstimates: data.userEstimates
|
|
9970
|
+
};
|
|
9967
9971
|
} catch {
|
|
9968
9972
|
return null;
|
|
9969
9973
|
}
|
|
@@ -21900,11 +21904,12 @@ function PrimeStyleTryonInner({
|
|
|
21900
21904
|
const weightVal = newProfile.weightKg || newProfile.weight || 0;
|
|
21901
21905
|
const heightUnitVal = newProfile.sizingUnit === "in" ? "in" : "cm";
|
|
21902
21906
|
const weightUnitVal = newProfile.sizingUnit === "in" ? "lbs" : "kg";
|
|
21903
|
-
|
|
21907
|
+
const photoBase64 = newProfile.photoBase64;
|
|
21908
|
+
if (photoBase64 || heightVal > 0 && weightVal > 0) {
|
|
21904
21909
|
estimateFullMeasurements({
|
|
21905
21910
|
apiUrl,
|
|
21906
|
-
height: heightVal,
|
|
21907
|
-
weight: weightVal,
|
|
21911
|
+
height: heightVal > 0 ? heightVal : void 0,
|
|
21912
|
+
weight: weightVal > 0 ? weightVal : void 0,
|
|
21908
21913
|
heightUnit: heightUnitVal,
|
|
21909
21914
|
weightUnit: weightUnitVal,
|
|
21910
21915
|
gender: newProfile.gender,
|
|
@@ -21912,10 +21917,34 @@ function PrimeStyleTryonInner({
|
|
|
21912
21917
|
chestProfile: newProfile.chestProfile,
|
|
21913
21918
|
midsectionProfile: newProfile.midsectionProfile,
|
|
21914
21919
|
hipProfile: newProfile.hipProfile,
|
|
21915
|
-
bodyImage:
|
|
21920
|
+
bodyImage: photoBase64
|
|
21916
21921
|
}).then((est) => {
|
|
21917
21922
|
if (est) {
|
|
21918
21923
|
updateProfileMeasurements(newProfile.id, est.estimates, est.unit);
|
|
21924
|
+
if (est.userEstimates) {
|
|
21925
|
+
const all = lsGet("profiles", []);
|
|
21926
|
+
const idx = all.findIndex((p2) => p2.id === newProfile.id);
|
|
21927
|
+
if (idx >= 0) {
|
|
21928
|
+
const target = all[idx];
|
|
21929
|
+
const u2 = est.userEstimates;
|
|
21930
|
+
const patched = { ...target };
|
|
21931
|
+
if (u2.height && !(target.height || target.heightCm)) {
|
|
21932
|
+
patched.height = u2.height;
|
|
21933
|
+
patched.heightCm = u2.height;
|
|
21934
|
+
patched.heightUnit = "cm";
|
|
21935
|
+
}
|
|
21936
|
+
if (u2.weight && !(target.weight || target.weightKg)) {
|
|
21937
|
+
patched.weight = u2.weight;
|
|
21938
|
+
patched.weightKg = u2.weight;
|
|
21939
|
+
patched.weightUnit = "kg";
|
|
21940
|
+
}
|
|
21941
|
+
if (u2.age && !target.age) {
|
|
21942
|
+
patched.age = u2.age;
|
|
21943
|
+
}
|
|
21944
|
+
all[idx] = patched;
|
|
21945
|
+
lsSet("profiles", all);
|
|
21946
|
+
}
|
|
21947
|
+
}
|
|
21919
21948
|
setProfiles(lsGet("profiles", []));
|
|
21920
21949
|
}
|
|
21921
21950
|
}).catch(() => {
|