@primestyleai/tryon 5.6.19 → 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.
@@ -9399,6 +9399,7 @@ function BodyProfileView({
9399
9399
  onUseActiveProfile,
9400
9400
  activeProfileName,
9401
9401
  onStartFresh,
9402
+ activeProfile,
9402
9403
  onBack,
9403
9404
  t
9404
9405
  }) {
@@ -9407,15 +9408,42 @@ function BodyProfileView({
9407
9408
  step === "photo" ? 0 : steps.indexOf(step);
9408
9409
  const isMobile = useIsMobile();
9409
9410
  const imperial = isImperial(sizingCountry);
9410
- const [height, setHeight] = useState(formRef.current.height || "173");
9411
- const [heightFeet, setHeightFeet] = useState(formRef.current.heightFeet || "5");
9412
- const [heightInches, setHeightInches] = useState(formRef.current.heightInches || "8");
9413
- const [weight, setWeight] = useState(formRef.current.weight || (imperial ? "154" : "70"));
9414
- const [age, setAge] = useState(formRef.current.age || "30");
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);
9415
9441
  const [hUnit, setHUnit] = useState(
9416
- 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")
9417
9446
  );
9418
- const [wUnit, setWUnit] = useState(weightUnit || (imperial ? "lbs" : "kg"));
9419
9447
  const isImperialMode = hUnit === "in" || wUnit === "lbs";
9420
9448
  const [photoFile, setPhotoFile] = useState(null);
9421
9449
  const [photoPreview, setPhotoPreview] = useState(null);
@@ -11220,6 +11248,7 @@ function PrimeStyleTryonInner({
11220
11248
  const p = profiles.find((x) => x.id === activeProfileId);
11221
11249
  return p?.name || null;
11222
11250
  })(),
11251
+ activeProfile: profiles.find((x) => x.id === activeProfileId) || null,
11223
11252
  onStartFresh: () => {
11224
11253
  setActiveProfileId$1(null);
11225
11254
  formRef.current = {};
@@ -11245,7 +11274,8 @@ function PrimeStyleTryonInner({
11245
11274
  onSnapSubmit: handleSnapSubmit,
11246
11275
  onBack: handleClose,
11247
11276
  t
11248
- }
11277
+ },
11278
+ `bp-${activeProfileId || "anon"}`
11249
11279
  ) }, "v-bodyprofile");
11250
11280
  }
11251
11281
  case "estimation-review":
@@ -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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.6.19",
3
+ "version": "5.6.20",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",