@primestyleai/tryon 5.10.185 → 5.10.187
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/types.d.ts
CHANGED
|
@@ -109,6 +109,8 @@ export interface ProfileCompletionDraft {
|
|
|
109
109
|
bandSize?: string;
|
|
110
110
|
cupSize?: string;
|
|
111
111
|
braSizeRegion?: string;
|
|
112
|
+
photoBase64?: string;
|
|
113
|
+
photoUrl?: string;
|
|
112
114
|
customMeasurements?: Record<string, number>;
|
|
113
115
|
}
|
|
114
116
|
export interface HistoryEntry {
|
|
@@ -26352,6 +26352,7 @@ function CreateProfileWizard({ onSave, onCancel, initialMode, initialDraft, apiU
|
|
|
26352
26352
|
const seededUnit = draftUnit(initialDraft);
|
|
26353
26353
|
const seededHeight = draftHeightParts(initialDraft, seededUnit);
|
|
26354
26354
|
const seededGender = initialDraft?.gender === "female" ? "female" : "male";
|
|
26355
|
+
const seededPhotoRef = reactExports.useRef(initialDraft?.photoBase64 || initialDraft?.photoUrl || null);
|
|
26355
26356
|
const [mode, setMode] = reactExports.useState(initialMode ?? null);
|
|
26356
26357
|
const [manualStep, setManualStep] = reactExports.useState("identity");
|
|
26357
26358
|
const [imageStep, setImageStep] = reactExports.useState("name-photo");
|
|
@@ -26370,10 +26371,13 @@ function CreateProfileWizard({ onSave, onCancel, initialMode, initialDraft, apiU
|
|
|
26370
26371
|
const [weightVal, setWeightVal] = reactExports.useState(draftDisplayNumber(initialDraft?.weight));
|
|
26371
26372
|
const [ageVal, setAgeVal] = reactExports.useState(draftDisplayNumber(initialDraft?.age));
|
|
26372
26373
|
const [error, setError] = reactExports.useState("");
|
|
26373
|
-
const [photoBase64, setPhotoBase64] = reactExports.useState(
|
|
26374
|
+
const [photoBase64, setPhotoBase64] = reactExports.useState(() => seededPhotoRef.current);
|
|
26374
26375
|
const [photoUploading, setPhotoUploading] = reactExports.useState(false);
|
|
26375
26376
|
const [photoStatus, setPhotoStatus] = reactExports.useState("");
|
|
26376
26377
|
const [photoRejection, setPhotoRejection] = reactExports.useState(null);
|
|
26378
|
+
reactExports.useEffect(() => {
|
|
26379
|
+
if (seededPhotoRef.current) onPhotoPreview?.(seededPhotoRef.current);
|
|
26380
|
+
}, []);
|
|
26377
26381
|
const [scanLandmarks, setScanLandmarks] = reactExports.useState(null);
|
|
26378
26382
|
const [scanImgDims, setScanImgDims] = reactExports.useState({ w: 800, h: 1200 });
|
|
26379
26383
|
const [scanStageIdx, setScanStageIdx] = reactExports.useState(0);
|
|
@@ -28213,6 +28217,8 @@ function MySizingProfilesView({
|
|
|
28213
28217
|
const goBack = () => {
|
|
28214
28218
|
if (creating) {
|
|
28215
28219
|
setCreating(false);
|
|
28220
|
+
onProfileDraftConsumed?.();
|
|
28221
|
+
onPhotoPreview?.(null);
|
|
28216
28222
|
return;
|
|
28217
28223
|
}
|
|
28218
28224
|
if (viewingId !== null) {
|
|
@@ -28221,7 +28227,7 @@ function MySizingProfilesView({
|
|
|
28221
28227
|
}
|
|
28222
28228
|
};
|
|
28223
28229
|
onRegisterBackInterceptor(canGoBack, goBack);
|
|
28224
|
-
}, [creating, viewingId, onRegisterBackInterceptor]);
|
|
28230
|
+
}, [creating, viewingId, onRegisterBackInterceptor, onProfileDraftConsumed, onPhotoPreview]);
|
|
28225
28231
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-msp-root", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-msp-scroll", children: viewingProfile ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
28226
28232
|
ProfileMeasurementsView,
|
|
28227
28233
|
{
|
|
@@ -29617,6 +29623,9 @@ function BodyProfileView({
|
|
|
29617
29623
|
}
|
|
29618
29624
|
} : {},
|
|
29619
29625
|
...showGenderSpecificDetails && bandSize && cupSize ? {
|
|
29626
|
+
bandSize,
|
|
29627
|
+
cupSize,
|
|
29628
|
+
braSizeRegion,
|
|
29620
29629
|
braSize: {
|
|
29621
29630
|
band: parseFloat(bandSize),
|
|
29622
29631
|
cup: cupSize,
|
|
@@ -32322,6 +32331,17 @@ function positiveNumber(value) {
|
|
|
32322
32331
|
const n2 = typeof value === "number" ? value : parseFloat(String(value ?? ""));
|
|
32323
32332
|
return Number.isFinite(n2) && n2 > 0 ? n2 : void 0;
|
|
32324
32333
|
}
|
|
32334
|
+
function snapBraFields(data) {
|
|
32335
|
+
if (data.gender !== "female") return {};
|
|
32336
|
+
const band = data.bandSize ?? data.braSize?.band;
|
|
32337
|
+
const cup = data.cupSize ?? data.braSize?.cup;
|
|
32338
|
+
const region = data.braSizeRegion ?? data.braRegion ?? data.braSize?.region;
|
|
32339
|
+
return {
|
|
32340
|
+
...band != null && String(band).trim() ? { bandSize: String(band) } : {},
|
|
32341
|
+
...cup && String(cup).trim() ? { cupSize: String(cup) } : {},
|
|
32342
|
+
...region && String(region).trim() ? { braSizeRegion: String(region) } : {}
|
|
32343
|
+
};
|
|
32344
|
+
}
|
|
32325
32345
|
function validChestProfile(value) {
|
|
32326
32346
|
return value === "narrow" || value === "average" || value === "broad" ? value : void 0;
|
|
32327
32347
|
}
|
|
@@ -32702,6 +32722,8 @@ function PrimeStyleTryonInner({
|
|
|
32702
32722
|
const f2 = formRef.current || {};
|
|
32703
32723
|
const active = profiles.find((p2) => p2.id === activeProfileId) || null;
|
|
32704
32724
|
const gender = f2.gender === "female" || active?.gender === "female" ? "female" : "male";
|
|
32725
|
+
const profilePhoto = f2.photoBase64 || f2.bodyImage || active?.photoBase64 || active?.photoUrl;
|
|
32726
|
+
const normalizedProfilePhoto = profilePhoto ? normalizeProfilePhotoSource(profilePhoto) : null;
|
|
32705
32727
|
const customMeasurements = {};
|
|
32706
32728
|
const wristCircumference = positiveNumber(f2.wristCircumference);
|
|
32707
32729
|
if (wristCircumference != null) customMeasurements.wristCircumference = wristCircumference;
|
|
@@ -32723,6 +32745,7 @@ function PrimeStyleTryonInner({
|
|
|
32723
32745
|
bandSize: f2.bandSize || active?.bandSize,
|
|
32724
32746
|
cupSize: f2.cupSize || active?.cupSize,
|
|
32725
32747
|
braSizeRegion: f2.braSizeRegion || active?.braSizeRegion || "US",
|
|
32748
|
+
...normalizedProfilePhoto ? { photoBase64: normalizedProfilePhoto } : {},
|
|
32726
32749
|
...Object.keys(customMeasurements).length > 0 ? { customMeasurements } : {}
|
|
32727
32750
|
};
|
|
32728
32751
|
lsSet(PROFILE_COMPLETION_DRAFT_KEY, draft);
|
|
@@ -33140,6 +33163,14 @@ function PrimeStyleTryonInner({
|
|
|
33140
33163
|
setEstimationDone(true);
|
|
33141
33164
|
return;
|
|
33142
33165
|
}
|
|
33166
|
+
if (targetId && formData.gender === "female" && (formData.bandSize || formData.cupSize || formData.braSizeRegion)) {
|
|
33167
|
+
updateProfile(targetId, {
|
|
33168
|
+
...formData.bandSize ? { bandSize: formData.bandSize } : {},
|
|
33169
|
+
...formData.cupSize ? { cupSize: formData.cupSize } : {},
|
|
33170
|
+
...formData.braSizeRegion ? { braSizeRegion: formData.braSizeRegion } : {}
|
|
33171
|
+
});
|
|
33172
|
+
setProfiles(lsGet("profiles", []));
|
|
33173
|
+
}
|
|
33143
33174
|
if (options?.skipBodyEstimate) {
|
|
33144
33175
|
console.log("[ps-sdk:persist] skipping body estimates — face/head flow (no body context)");
|
|
33145
33176
|
} else if (targetId && recommendation?.estimates) {
|
|
@@ -33187,7 +33218,14 @@ function PrimeStyleTryonInner({
|
|
|
33187
33218
|
heightUnit: p2.heightUnit || "cm",
|
|
33188
33219
|
weightUnit: p2.weightUnit || "kg",
|
|
33189
33220
|
gender: p2.gender,
|
|
33190
|
-
age: p2.age
|
|
33221
|
+
age: p2.age,
|
|
33222
|
+
...snapBraFields({
|
|
33223
|
+
gender: p2.gender,
|
|
33224
|
+
bandSize: p2.bandSize,
|
|
33225
|
+
cupSize: p2.cupSize,
|
|
33226
|
+
braSizeRegion: p2.braSizeRegion,
|
|
33227
|
+
braRegion: p2.braRegion
|
|
33228
|
+
})
|
|
33191
33229
|
});
|
|
33192
33230
|
} catch {
|
|
33193
33231
|
}
|
|
@@ -33643,7 +33681,13 @@ function PrimeStyleTryonInner({
|
|
|
33643
33681
|
age: src.age != null ? Number(src.age) : void 0,
|
|
33644
33682
|
chestProfile: src.chestProfile,
|
|
33645
33683
|
midsectionProfile: src.midsectionProfile,
|
|
33646
|
-
hipProfile: src.hipProfile
|
|
33684
|
+
hipProfile: src.hipProfile,
|
|
33685
|
+
...snapBraFields({
|
|
33686
|
+
gender: src.gender,
|
|
33687
|
+
bandSize: formRef.current.bandSize,
|
|
33688
|
+
cupSize: formRef.current.cupSize,
|
|
33689
|
+
braSizeRegion: formRef.current.braSizeRegion
|
|
33690
|
+
})
|
|
33647
33691
|
},
|
|
33648
33692
|
data
|
|
33649
33693
|
);
|
|
@@ -33775,6 +33819,12 @@ function PrimeStyleTryonInner({
|
|
|
33775
33819
|
formRef.current.weightUnit = data.weightUnit;
|
|
33776
33820
|
formRef.current.gender = data.gender;
|
|
33777
33821
|
if (data.age != null) formRef.current.age = String(data.age);
|
|
33822
|
+
formRef.current.bodyImage = data.photoBase64;
|
|
33823
|
+
formRef.current.photoBase64 = data.photoBase64;
|
|
33824
|
+
const braFields = snapBraFields(data);
|
|
33825
|
+
if (braFields.bandSize) formRef.current.bandSize = braFields.bandSize;
|
|
33826
|
+
if (braFields.cupSize) formRef.current.cupSize = braFields.cupSize;
|
|
33827
|
+
if (braFields.braSizeRegion) formRef.current.braSizeRegion = braFields.braSizeRegion;
|
|
33778
33828
|
if (data.extraMeasurements) {
|
|
33779
33829
|
for (const [key2, value] of Object.entries(data.extraMeasurements)) {
|
|
33780
33830
|
formRef.current[key2] = String(value);
|
|
@@ -33851,7 +33901,8 @@ function PrimeStyleTryonInner({
|
|
|
33851
33901
|
heightUnit: data.heightUnit,
|
|
33852
33902
|
weightUnit: data.weightUnit,
|
|
33853
33903
|
age: data.age,
|
|
33854
|
-
bodyImage: data.photoBase64
|
|
33904
|
+
bodyImage: data.photoBase64,
|
|
33905
|
+
...braFields
|
|
33855
33906
|
},
|
|
33856
33907
|
recData,
|
|
33857
33908
|
{ skipBodyEstimate: true }
|
|
@@ -33985,7 +34036,8 @@ function PrimeStyleTryonInner({
|
|
|
33985
34036
|
heightUnit: data.heightUnit,
|
|
33986
34037
|
weightUnit: data.weightUnit,
|
|
33987
34038
|
age: data.age,
|
|
33988
|
-
bodyImage: data.photoBase64
|
|
34039
|
+
bodyImage: data.photoBase64,
|
|
34040
|
+
...braFields
|
|
33989
34041
|
},
|
|
33990
34042
|
recData
|
|
33991
34043
|
);
|