@primestyleai/tryon 5.6.18 → 5.6.20
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
|
@@ -330,12 +330,30 @@ async function recommendForProduct(input) {
|
|
|
330
330
|
if (!input.skipCache) {
|
|
331
331
|
const cached = getCachedSize(profile, input.productId);
|
|
332
332
|
if (cached) {
|
|
333
|
+
const reconstructedRaw = cached.sectionsFull ? {
|
|
334
|
+
recommendedSize: cached.recommendedSize,
|
|
335
|
+
confidence: cached.confidence || "high",
|
|
336
|
+
reasoning: "",
|
|
337
|
+
recommendedLength: cached.recommendedLength,
|
|
338
|
+
sections: Object.fromEntries(
|
|
339
|
+
Object.entries(cached.sectionsFull).map(([name, sec]) => [
|
|
340
|
+
name,
|
|
341
|
+
{ ...sec, matchDetails: [] }
|
|
342
|
+
])
|
|
343
|
+
)
|
|
344
|
+
} : {
|
|
345
|
+
recommendedSize: cached.recommendedSize,
|
|
346
|
+
confidence: cached.confidence || "high",
|
|
347
|
+
reasoning: "",
|
|
348
|
+
recommendedLength: cached.recommendedLength
|
|
349
|
+
};
|
|
333
350
|
return {
|
|
334
351
|
recommendedSize: cached.recommendedSize,
|
|
335
352
|
confidence: cached.confidence,
|
|
336
353
|
sections: cached.sections,
|
|
337
354
|
profileId: profile.id,
|
|
338
|
-
fromCache: true
|
|
355
|
+
fromCache: true,
|
|
356
|
+
raw: reconstructedRaw
|
|
339
357
|
};
|
|
340
358
|
}
|
|
341
359
|
}
|
|
@@ -405,6 +423,19 @@ async function recommendForProduct(input) {
|
|
|
405
423
|
const sectionsMap = result.sections ? Object.fromEntries(
|
|
406
424
|
Object.entries(result.sections).map(([name, sec]) => [name, sec.recommendedSize])
|
|
407
425
|
) : void 0;
|
|
426
|
+
const sectionsFull = result.sections ? Object.fromEntries(
|
|
427
|
+
Object.entries(result.sections).map(([name, sec]) => [
|
|
428
|
+
name,
|
|
429
|
+
{
|
|
430
|
+
recommendedSize: sec.recommendedSize,
|
|
431
|
+
// Backend may include these on merged Jacket/Pants entries
|
|
432
|
+
size: sec.size,
|
|
433
|
+
length: sec.length,
|
|
434
|
+
availableSizes: sec.availableSizes,
|
|
435
|
+
availableLengths: sec.availableLengths
|
|
436
|
+
}
|
|
437
|
+
])
|
|
438
|
+
) : void 0;
|
|
408
439
|
addSizeToHistory(profile.id, {
|
|
409
440
|
productId: input.productId,
|
|
410
441
|
productTitle: input.productTitle,
|
|
@@ -412,6 +443,8 @@ async function recommendForProduct(input) {
|
|
|
412
443
|
recommendedSize: result.recommendedSize,
|
|
413
444
|
confidence: result.confidence,
|
|
414
445
|
sections: sectionsMap,
|
|
446
|
+
sectionsFull,
|
|
447
|
+
recommendedLength: result.recommendedLength || void 0,
|
|
415
448
|
savedAt: Date.now()
|
|
416
449
|
});
|
|
417
450
|
return {
|
|
@@ -9366,6 +9399,7 @@ function BodyProfileView({
|
|
|
9366
9399
|
onUseActiveProfile,
|
|
9367
9400
|
activeProfileName,
|
|
9368
9401
|
onStartFresh,
|
|
9402
|
+
activeProfile,
|
|
9369
9403
|
onBack,
|
|
9370
9404
|
t
|
|
9371
9405
|
}) {
|
|
@@ -9374,15 +9408,42 @@ function BodyProfileView({
|
|
|
9374
9408
|
step === "photo" ? 0 : steps.indexOf(step);
|
|
9375
9409
|
const isMobile = useIsMobile();
|
|
9376
9410
|
const imperial = isImperial(sizingCountry);
|
|
9377
|
-
const
|
|
9378
|
-
const
|
|
9379
|
-
const
|
|
9380
|
-
const
|
|
9381
|
-
const
|
|
9411
|
+
const profileHeight = activeProfile?.height;
|
|
9412
|
+
const profileWeight = activeProfile?.weight;
|
|
9413
|
+
const profileAge = activeProfile?.age;
|
|
9414
|
+
const profileHUnit = activeProfile?.heightUnit === "ft" ? "in" : activeProfile?.heightUnit;
|
|
9415
|
+
const profileWUnit = activeProfile?.weightUnit;
|
|
9416
|
+
const seedHeightCm = (() => {
|
|
9417
|
+
if (profileHeight != null && profileHUnit === "cm") return String(Math.round(profileHeight));
|
|
9418
|
+
if (profileHeight != null && (profileHUnit === "in" || profileHUnit === "ft"))
|
|
9419
|
+
return String(Math.round(profileHeight * 2.54));
|
|
9420
|
+
return formRef.current.height || "173";
|
|
9421
|
+
})();
|
|
9422
|
+
const seedTotalIn = (() => {
|
|
9423
|
+
if (profileHeight != null && (profileHUnit === "in" || profileHUnit === "ft"))
|
|
9424
|
+
return Math.round(profileHeight);
|
|
9425
|
+
if (profileHeight != null && profileHUnit === "cm")
|
|
9426
|
+
return Math.round(profileHeight / 2.54);
|
|
9427
|
+
return null;
|
|
9428
|
+
})();
|
|
9429
|
+
const seedHeightFeet = seedTotalIn != null ? String(Math.floor(seedTotalIn / 12)) : formRef.current.heightFeet || "5";
|
|
9430
|
+
const seedHeightInches = seedTotalIn != null ? String(seedTotalIn % 12) : formRef.current.heightInches || "8";
|
|
9431
|
+
const seedWeight = (() => {
|
|
9432
|
+
if (profileWeight != null) return String(Math.round(profileWeight));
|
|
9433
|
+
return formRef.current.weight || (imperial ? "154" : "70");
|
|
9434
|
+
})();
|
|
9435
|
+
const seedAge = profileAge != null ? String(profileAge) : formRef.current.age || "30";
|
|
9436
|
+
const [height, setHeight] = useState(seedHeightCm);
|
|
9437
|
+
const [heightFeet, setHeightFeet] = useState(seedHeightFeet);
|
|
9438
|
+
const [heightInches, setHeightInches] = useState(seedHeightInches);
|
|
9439
|
+
const [weight, setWeight] = useState(seedWeight);
|
|
9440
|
+
const [age, setAge] = useState(seedAge);
|
|
9382
9441
|
const [hUnit, setHUnit] = useState(
|
|
9383
|
-
heightUnit === "ft" ? "in" : heightUnit || (imperial ? "in" : "cm")
|
|
9442
|
+
profileHUnit || (heightUnit === "ft" ? "in" : heightUnit || (imperial ? "in" : "cm"))
|
|
9443
|
+
);
|
|
9444
|
+
const [wUnit, setWUnit] = useState(
|
|
9445
|
+
profileWUnit || weightUnit || (imperial ? "lbs" : "kg")
|
|
9384
9446
|
);
|
|
9385
|
-
const [wUnit, setWUnit] = useState(weightUnit || (imperial ? "lbs" : "kg"));
|
|
9386
9447
|
const isImperialMode = hUnit === "in" || wUnit === "lbs";
|
|
9387
9448
|
const [photoFile, setPhotoFile] = useState(null);
|
|
9388
9449
|
const [photoPreview, setPhotoPreview] = useState(null);
|
|
@@ -11187,6 +11248,7 @@ function PrimeStyleTryonInner({
|
|
|
11187
11248
|
const p = profiles.find((x) => x.id === activeProfileId);
|
|
11188
11249
|
return p?.name || null;
|
|
11189
11250
|
})(),
|
|
11251
|
+
activeProfile: profiles.find((x) => x.id === activeProfileId) || null,
|
|
11190
11252
|
onStartFresh: () => {
|
|
11191
11253
|
setActiveProfileId$1(null);
|
|
11192
11254
|
formRef.current = {};
|
|
@@ -11212,7 +11274,8 @@ function PrimeStyleTryonInner({
|
|
|
11212
11274
|
onSnapSubmit: handleSnapSubmit,
|
|
11213
11275
|
onBack: handleClose,
|
|
11214
11276
|
t
|
|
11215
|
-
}
|
|
11277
|
+
},
|
|
11278
|
+
`bp-${activeProfileId || "anon"}`
|
|
11216
11279
|
) }, "v-bodyprofile");
|
|
11217
11280
|
}
|
|
11218
11281
|
case "estimation-review":
|
package/dist/react/types.d.ts
CHANGED
|
@@ -32,6 +32,18 @@ export interface SizeHistoryEntry {
|
|
|
32
32
|
confidence?: string;
|
|
33
33
|
/** For multi-section products: { "Jacket Size": "50", "Pants": "34", ... } */
|
|
34
34
|
sections?: Record<string, string>;
|
|
35
|
+
/** Full per-section data (size/length/availableSizes/...) — preserved so
|
|
36
|
+
* cached recommendations carry the same detail as a fresh API response. */
|
|
37
|
+
sectionsFull?: Record<string, {
|
|
38
|
+
recommendedSize: string;
|
|
39
|
+
size?: string;
|
|
40
|
+
length?: string;
|
|
41
|
+
availableSizes?: string[];
|
|
42
|
+
availableLengths?: string[];
|
|
43
|
+
}>;
|
|
44
|
+
/** Top-level recommended length (single-piece products that have a separate
|
|
45
|
+
* length axis like Regular / Long / Short). */
|
|
46
|
+
recommendedLength?: string;
|
|
35
47
|
savedAt: number;
|
|
36
48
|
}
|
|
37
49
|
export interface Profile {
|
|
@@ -48,8 +48,11 @@ interface BodyProfileViewProps {
|
|
|
48
48
|
/** Deselect the active profile so the user can run a fresh AI sizing flow
|
|
49
49
|
* with full body-shape questions. */
|
|
50
50
|
onStartFresh?: () => void;
|
|
51
|
+
/** Active profile — when set, its height/weight/age/gender seed the basics
|
|
52
|
+
* inputs so the SDK opens with the user's saved values, not the defaults. */
|
|
53
|
+
activeProfile?: import("../types").Profile | null;
|
|
51
54
|
onBack: () => void;
|
|
52
55
|
t: TranslateFn;
|
|
53
56
|
}
|
|
54
|
-
export declare function BodyProfileView({ productImage, productTitle, isWomen, formRef, sizingCountry, heightUnit, setHeightUnit, weightUnit, setWeightUnit, sizingUnit, setSizingUnit, onComplete, onSnapSubmit, hasActiveProfileWithMeasurements, onUseActiveProfile, activeProfileName, onStartFresh, onBack, t, }: BodyProfileViewProps): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export declare function BodyProfileView({ productImage, productTitle, isWomen, formRef, sizingCountry, heightUnit, setHeightUnit, weightUnit, setWeightUnit, sizingUnit, setSizingUnit, onComplete, onSnapSubmit, hasActiveProfileWithMeasurements, onUseActiveProfile, activeProfileName, onStartFresh, activeProfile, onBack, t, }: BodyProfileViewProps): import("react/jsx-runtime").JSX.Element;
|
|
55
58
|
export {};
|