@primestyleai/tryon 5.10.123 → 5.10.124

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.
@@ -20113,10 +20113,15 @@ function SectionDetailView({
20113
20113
  if (!details.length) return [];
20114
20114
  const isFromLength = new Set(lengthDetails.map((m2) => m2.measurement));
20115
20115
  if (hasLengthSource) isFromLength.add("Height");
20116
+ const activeLengthLabel = selectedLength || effectiveRecLength;
20116
20117
  return details.map((m2) => {
20117
20118
  if (isFromLength.has(m2.measurement)) {
20118
20119
  const userNum2 = userMeasurements[m2.measurement.toLowerCase()] || pNumFn(m2.userValue);
20119
- const lookup2 = allSizes?.[displaySize]?.[m2.measurement];
20120
+ const lengthAllSizes = lengthEntry?.secResult?.allSizes;
20121
+ const lookupByLengthEntry = activeLengthLabel ? lengthAllSizes?.[activeLengthLabel]?.[m2.measurement] : void 0;
20122
+ const lookupByLength = activeLengthLabel ? allSizes?.[activeLengthLabel]?.[m2.measurement] : void 0;
20123
+ const lookupBySize = allSizes?.[displaySize]?.[m2.measurement];
20124
+ const lookup2 = lookupByLengthEntry ?? lookupByLength ?? lookupBySize;
20120
20125
  const chartRange2 = lookup2?.chartRange ?? m2.chartRange;
20121
20126
  const fit2 = lookup2?.fit ?? m2.fit ?? "good";
20122
20127
  return {
@@ -20141,7 +20146,7 @@ function SectionDetailView({
20141
20146
  isLength: isDirectional
20142
20147
  };
20143
20148
  });
20144
- }, [sectionResult, lengthEntry, userMeasurements, renderRaw, allSizes, displaySize]);
20149
+ }, [sectionResult, lengthEntry, userMeasurements, renderRaw, allSizes, displaySize, selectedLength]);
20145
20150
  const goodCount = fitRows.filter(
20146
20151
  (r2) => r2.fit === "good" || r2.fit === "a-bit-tight" || r2.fit === "a-bit-loose"
20147
20152
  ).length;
@@ -21157,14 +21162,19 @@ function SizeResultView({
21157
21162
  })(),
21158
21163
  onBack: () => setActiveSection(null),
21159
21164
  internationalSizes: entry.secResult?.internationalSizes,
21160
- productImage: resultImageUrl || productImage,
21165
+ productImage: tryOnProcessing && previewUrl ? previewUrl : resultImageUrl || productImage,
21161
21166
  productTitle,
21162
21167
  isMobile: true,
21163
- isTryOnImage: !!resultImageUrl,
21168
+ isTryOnImage: !!resultImageUrl && !tryOnProcessing,
21169
+ tryOnProcessing,
21170
+ tryOnStartedAt,
21164
21171
  showLines,
21165
21172
  onToggleLines: isAccessory ? void 0 : () => setShowLines(!showLines),
21166
21173
  onImageLoad: handleImgLoad,
21167
- overlayNode: resultImageUrl && poseReady && poseLines ? /* @__PURE__ */ jsxRuntimeExports.jsx(
21174
+ overlayNode: tryOnProcessing ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
21175
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TryOnGenerationBadge, { tryOnStartedAt: tryOnStartedAt ?? null, t: t2 }),
21176
+ /* @__PURE__ */ jsxRuntimeExports.jsx(RegenScanOverlay, { active: true })
21177
+ ] }) : resultImageUrl && poseReady && poseLines ? /* @__PURE__ */ jsxRuntimeExports.jsx(
21168
21178
  MeasurementOverlay,
21169
21179
  {
21170
21180
  lines: poseLines,
@@ -21195,7 +21205,19 @@ function SizeResultView({
21195
21205
  ] });
21196
21206
  }
21197
21207
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-tryon-v2", children: [
21198
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-tryon-v2-bg", style: { position: "relative" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: resultImageUrl || productImage, alt: productTitle, className: "ps-tryon-v2-bg-img" }) }),
21208
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-tryon-v2-bg", style: { position: "relative" }, children: [
21209
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
21210
+ "img",
21211
+ {
21212
+ src: tryOnProcessing && previewUrl ? previewUrl : resultImageUrl || productImage,
21213
+ alt: productTitle,
21214
+ className: "ps-tryon-v2-bg-img",
21215
+ onLoad: handleImgLoad
21216
+ }
21217
+ ),
21218
+ tryOnProcessing && /* @__PURE__ */ jsxRuntimeExports.jsx(TryOnGenerationBadge, { tryOnStartedAt: tryOnStartedAt ?? null, t: t2 }),
21219
+ /* @__PURE__ */ jsxRuntimeExports.jsx(RegenScanOverlay, { active: !!tryOnProcessing })
21220
+ ] }),
21199
21221
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-tryon-v2-panel", children: [
21200
21222
  mismatchNotice,
21201
21223
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -21217,6 +21239,8 @@ function SizeResultView({
21217
21239
  })(),
21218
21240
  onBack: () => setActiveSection(null),
21219
21241
  internationalSizes: entry.secResult?.internationalSizes,
21242
+ tryOnProcessing,
21243
+ tryOnStartedAt,
21220
21244
  t: t2,
21221
21245
  allSizes: entry.secResult?.allSizes ?? sizingResult?.allSizes
21222
21246
  }
@@ -26787,7 +26811,7 @@ function CameraUploadIcon() {
26787
26811
  function AccessorySizeView({
26788
26812
  title,
26789
26813
  fields,
26790
- unitOptions = [{ label: "Centimeters", value: "cm" }, { label: "Inches", value: "in" }],
26814
+ unitOptions,
26791
26815
  photoVariant = "full-body",
26792
26816
  disablePhotoUpload = false,
26793
26817
  productImage,
@@ -26815,6 +26839,10 @@ function AccessorySizeView({
26815
26839
  });
26816
26840
  return init;
26817
26841
  });
26842
+ const resolvedUnitOptions = unitOptions ?? [
26843
+ { label: t2("Centimeters"), value: "cm" },
26844
+ { label: t2("Inches"), value: "in" }
26845
+ ];
26818
26846
  const [error, setError] = reactExports.useState("");
26819
26847
  const fileInputRef = reactExports.useRef(null);
26820
26848
  const [photoPreview, setPhotoPreview] = reactExports.useState(null);
@@ -26901,7 +26929,7 @@ function AccessorySizeView({
26901
26929
  gender: formRef.current.gender || "male"
26902
26930
  });
26903
26931
  };
26904
- const activeUnitLabel = unitOptions.find((o) => o.value === sizingUnit)?.label || unitOptions[0].label;
26932
+ const activeUnitLabel = resolvedUnitOptions.find((o) => o.value === sizingUnit)?.label || resolvedUnitOptions[0].label;
26905
26933
  if (isMobile && step === "photo") {
26906
26934
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bp-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
26907
26935
  PhotoStepMobile,
@@ -26925,7 +26953,7 @@ function AccessorySizeView({
26925
26953
  if (isMobile) {
26926
26954
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bp-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-bpm-root", children: [
26927
26955
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bpm-header", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "ps-bpm-title", children: t2(title) }) }),
26928
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bpm-toggle", style: { padding: "0 4%" }, children: unitOptions.map((opt) => /* @__PURE__ */ jsxRuntimeExports.jsx(
26956
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bpm-toggle", style: { padding: "0 4%" }, children: resolvedUnitOptions.map((opt) => /* @__PURE__ */ jsxRuntimeExports.jsx(
26929
26957
  "button",
26930
26958
  {
26931
26959
  type: "button",
@@ -26997,7 +27025,7 @@ function AccessorySizeView({
26997
27025
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bp-image", style: { position: "relative" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: productImage, alt: productTitle, className: "ps-bp-image-img" }) }),
26998
27026
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bp-root", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-bp-step ps-bp-step-enter", children: [
26999
27027
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: "0.6vw", marginBottom: "0.3vw" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "ps-bp-title", style: { margin: 0 }, children: t2(title) }) }),
27000
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bp-system-toggle", children: unitOptions.map((opt) => /* @__PURE__ */ jsxRuntimeExports.jsx(
27028
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bp-system-toggle", children: resolvedUnitOptions.map((opt) => /* @__PURE__ */ jsxRuntimeExports.jsx(
27001
27029
  "button",
27002
27030
  {
27003
27031
  type: "button",
@@ -27364,7 +27392,7 @@ function AccessorySizeView({
27364
27392
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { style: { margin: "0.2vw 0 0", fontSize: "0.65vw", color: "var(--ps-text-muted)" }, children: t2("Enter your measurements OR upload a photo — we'll use whichever you provide.") })
27365
27393
  ] }),
27366
27394
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.7vw" }, children: [
27367
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bp-system-toggle", style: { alignSelf: "center" }, children: unitOptions.map((opt) => /* @__PURE__ */ jsxRuntimeExports.jsx(
27395
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-bp-system-toggle", style: { alignSelf: "center" }, children: resolvedUnitOptions.map((opt) => /* @__PURE__ */ jsxRuntimeExports.jsx(
27368
27396
  "button",
27369
27397
  {
27370
27398
  type: "button",
@@ -27537,130 +27565,141 @@ function AccessorySizeView({
27537
27565
  ] })
27538
27566
  ] }) }) });
27539
27567
  }
27540
- const FALLBACK_FOOT_FIELDS = [
27541
- {
27542
- key: "footLengthCm",
27543
- label: "Foot Length",
27544
- placeholder: { cm: "e.g. 26.5", in: "e.g. 10.5" },
27545
- hint: "Measure from heel to longest toe",
27546
- min: 10,
27547
- max: 35,
27548
- step: 0.5
27549
- }
27550
- ];
27551
- function buildFieldsFromSizeGuide$2(sizeGuide) {
27568
+ function buildFallbackFootFields(t2) {
27569
+ return [
27570
+ {
27571
+ key: "footLengthCm",
27572
+ label: t2("Foot Length"),
27573
+ placeholder: { cm: "e.g. 26.5", in: "e.g. 10.5" },
27574
+ hint: t2("Measure from heel to longest toe"),
27575
+ min: 10,
27576
+ max: 35,
27577
+ step: 0.5
27578
+ }
27579
+ ];
27580
+ }
27581
+ function buildFieldsFromSizeGuide$2(sizeGuide, t2) {
27582
+ const fallback = buildFallbackFootFields(t2);
27552
27583
  const req = sizeGuide?.requiredFields;
27553
- if (!req || req.length === 0) return FALLBACK_FOOT_FIELDS;
27584
+ if (!req || req.length === 0) return fallback;
27554
27585
  const SIZE_CODE_KEYS = /* @__PURE__ */ new Set(["size", "country", "eu", "__skip__", "shoeEU", "shoeUS", "shoeUK", "shoeJP"]);
27555
27586
  const defaultPlaceholderFor = (key, label) => {
27556
- const exact = FALLBACK_FOOT_FIELDS.find((f2) => f2.key === key);
27587
+ const exact = fallback.find((f2) => f2.key === key);
27557
27588
  if (exact) return exact.placeholder;
27558
27589
  const looksLikeFoot = /foot|length/i.test(key) || /foot|length/i.test(label);
27559
- if (looksLikeFoot) return FALLBACK_FOOT_FIELDS[0].placeholder;
27590
+ if (looksLikeFoot) return fallback[0].placeholder;
27560
27591
  return { cm: "", in: "" };
27561
27592
  };
27562
27593
  const out = req.filter((f2) => !SIZE_CODE_KEYS.has(f2.key) && f2.unit !== "size").map((f2) => {
27563
- const fallback = defaultPlaceholderFor(f2.key, f2.label || "");
27594
+ const ph2 = defaultPlaceholderFor(f2.key, f2.label || "");
27564
27595
  return {
27565
27596
  key: f2.key,
27566
- label: f2.label || f2.key,
27597
+ label: t2(f2.label || f2.key),
27567
27598
  placeholder: {
27568
- cm: f2.placeholder || fallback.cm,
27569
- in: f2.placeholder || fallback.in
27599
+ cm: f2.placeholder || ph2.cm,
27600
+ in: f2.placeholder || ph2.in
27570
27601
  },
27571
27602
  min: 0,
27572
27603
  step: 0.5
27573
27604
  };
27574
27605
  });
27575
- return out.length > 0 ? out : FALLBACK_FOOT_FIELDS;
27606
+ return out.length > 0 ? out : fallback;
27576
27607
  }
27577
27608
  function FootSizeView(props) {
27578
- const { sizeGuide, ...rest } = props;
27579
- const fields = buildFieldsFromSizeGuide$2(sizeGuide);
27609
+ const { sizeGuide, t: t2, ...rest } = props;
27610
+ const fields = buildFieldsFromSizeGuide$2(sizeGuide, t2);
27580
27611
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
27581
27612
  AccessorySizeView,
27582
27613
  {
27583
- title: "Shoe Size",
27614
+ title: t2("Shoe Size"),
27584
27615
  fields,
27585
27616
  disablePhotoUpload: true,
27617
+ t: t2,
27586
27618
  ...rest
27587
27619
  }
27588
27620
  );
27589
27621
  }
27590
- const FALLBACK_HEAD_FIELDS = [
27591
- {
27592
- key: "headCircumference",
27593
- label: "Head Circumference",
27594
- placeholder: { cm: "e.g. 57", in: "e.g. 22.5" },
27595
- hint: "Wrap a tape around the widest part of your head",
27596
- min: 48,
27597
- max: 65,
27598
- step: 0.5
27599
- }
27600
- ];
27601
- function buildFieldsFromSizeGuide$1(sizeGuide) {
27622
+ function buildFallbackHeadFields(t2) {
27623
+ return [
27624
+ {
27625
+ key: "headCircumference",
27626
+ label: t2("Head Circumference"),
27627
+ placeholder: { cm: "e.g. 57", in: "e.g. 22.5" },
27628
+ hint: t2("Wrap a tape around the widest part of your head"),
27629
+ min: 48,
27630
+ max: 65,
27631
+ step: 0.5
27632
+ }
27633
+ ];
27634
+ }
27635
+ function buildFieldsFromSizeGuide$1(sizeGuide, t2) {
27602
27636
  const req = sizeGuide?.requiredFields;
27603
- if (!req || req.length === 0) return FALLBACK_HEAD_FIELDS;
27637
+ if (!req || req.length === 0) return buildFallbackHeadFields(t2);
27604
27638
  const SIZE_CODE_KEYS = /* @__PURE__ */ new Set(["size", "country", "eu", "__skip__"]);
27605
27639
  return req.filter((f2) => !SIZE_CODE_KEYS.has(f2.key) && f2.unit !== "size").map((f2) => ({
27606
27640
  key: f2.key,
27607
- label: f2.label || f2.key,
27641
+ label: t2(f2.label || f2.key),
27608
27642
  placeholder: { cm: f2.placeholder || "", in: f2.placeholder || "" },
27609
27643
  min: 0,
27610
27644
  step: 0.5
27611
27645
  }));
27612
27646
  }
27613
27647
  function HeadSizeView(props) {
27614
- const { sizeGuide, ...rest } = props;
27615
- const fields = buildFieldsFromSizeGuide$1(sizeGuide);
27648
+ const { sizeGuide, t: t2, ...rest } = props;
27649
+ const fields = buildFieldsFromSizeGuide$1(sizeGuide, t2);
27616
27650
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
27617
27651
  AccessorySizeView,
27618
27652
  {
27619
- title: "Headwear Measurements",
27653
+ title: t2("Headwear Measurements"),
27620
27654
  fields,
27621
27655
  photoVariant: "close-up",
27656
+ t: t2,
27622
27657
  ...rest
27623
27658
  }
27624
27659
  );
27625
27660
  }
27626
- const FALLBACK_FACE_FIELDS = [
27627
- {
27628
- key: "lensWidth",
27629
- label: "Lens Width",
27630
- // `cm` key = mm placeholder (default eyewear unit); `in` key = cm placeholder.
27631
- placeholder: { mm: "e.g. 52", cm: "e.g. 5.2" },
27632
- hint: "Width of one lens",
27633
- min: 0,
27634
- step: 1
27635
- },
27636
- {
27637
- key: "bridgeWidth",
27638
- label: "Bridge",
27639
- placeholder: { mm: "e.g. 18", cm: "e.g. 1.8" },
27640
- hint: "Distance over the nose between lenses",
27641
- min: 0,
27642
- step: 1
27643
- },
27644
- {
27645
- key: "templeLength",
27646
- label: "Arm Length",
27647
- placeholder: { mm: "e.g. 140", cm: "e.g. 14" },
27648
- hint: "Length of the arm from hinge to tip",
27649
- min: 0,
27650
- step: 1
27651
- }
27652
- ];
27653
- const EYEWEAR_UNIT_OPTIONS = [
27654
- { label: "Millimetre", value: "mm" },
27655
- { label: "Centimetre", value: "cm" }
27656
- ];
27657
- function buildFieldsFromSizeGuide(sizeGuide) {
27661
+ function buildFallbackFaceFields(t2) {
27662
+ return [
27663
+ {
27664
+ key: "lensWidth",
27665
+ label: t2("Lens Width"),
27666
+ // `cm` key = mm placeholder (default eyewear unit); `in` key = cm placeholder.
27667
+ placeholder: { mm: "e.g. 52", cm: "e.g. 5.2" },
27668
+ hint: t2("Width of one lens"),
27669
+ min: 0,
27670
+ step: 1
27671
+ },
27672
+ {
27673
+ key: "bridgeWidth",
27674
+ label: t2("Bridge"),
27675
+ placeholder: { mm: "e.g. 18", cm: "e.g. 1.8" },
27676
+ hint: t2("Distance over the nose between lenses"),
27677
+ min: 0,
27678
+ step: 1
27679
+ },
27680
+ {
27681
+ key: "templeLength",
27682
+ label: t2("Arm Length"),
27683
+ placeholder: { mm: "e.g. 140", cm: "e.g. 14" },
27684
+ hint: t2("Length of the arm from hinge to tip"),
27685
+ min: 0,
27686
+ step: 1
27687
+ }
27688
+ ];
27689
+ }
27690
+ function buildEyewearUnitOptions(t2) {
27691
+ return [
27692
+ { label: t2("Millimetre"), value: "mm" },
27693
+ { label: t2("Centimetre"), value: "cm" }
27694
+ ];
27695
+ }
27696
+ function buildFieldsFromSizeGuide(sizeGuide, t2) {
27658
27697
  const req = sizeGuide?.requiredFields;
27659
- if (!req || req.length === 0) return FALLBACK_FACE_FIELDS;
27698
+ if (!req || req.length === 0) return buildFallbackFaceFields(t2);
27660
27699
  const SIZE_CODE_KEYS = /* @__PURE__ */ new Set(["size", "country", "eu", "__skip__"]);
27661
27700
  return req.filter((f2) => !SIZE_CODE_KEYS.has(f2.key) && f2.unit !== "size").map((f2) => ({
27662
27701
  key: f2.key,
27663
- label: f2.label || f2.key,
27702
+ label: t2(f2.label || f2.key),
27664
27703
  placeholder: {
27665
27704
  cm: f2.placeholder || "",
27666
27705
  in: f2.placeholder || ""
@@ -27670,15 +27709,16 @@ function buildFieldsFromSizeGuide(sizeGuide) {
27670
27709
  }));
27671
27710
  }
27672
27711
  function FaceSizeView(props) {
27673
- const { sizeGuide, ...rest } = props;
27674
- const fields = buildFieldsFromSizeGuide(sizeGuide);
27712
+ const { sizeGuide, t: t2, ...rest } = props;
27713
+ const fields = buildFieldsFromSizeGuide(sizeGuide, t2);
27675
27714
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
27676
27715
  AccessorySizeView,
27677
27716
  {
27678
- title: "Frame Measurements",
27717
+ title: t2("Frame Measurements"),
27679
27718
  fields,
27680
- unitOptions: EYEWEAR_UNIT_OPTIONS,
27719
+ unitOptions: buildEyewearUnitOptions(t2),
27681
27720
  photoVariant: "close-up",
27721
+ t: t2,
27682
27722
  ...rest
27683
27723
  }
27684
27724
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.10.123",
3
+ "version": "5.10.124",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",