@primestyleai/tryon 5.7.10 → 5.8.0

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.
@@ -10058,14 +10058,14 @@ const STYLES$1 = `
10058
10058
  .ps-tryon-modal {
10059
10059
  background: var(--ps-modal-bg, #FFFFFF); color: var(--ps-modal-color, #1C1D1E);
10060
10060
  border-radius: var(--ps-modal-radius, 0.83vw); width: var(--ps-modal-width, 100%);
10061
- max-width: var(--ps-modal-max-width, 36vw); max-height: 92vh; overflow-y: auto;
10061
+ max-width: var(--ps-modal-max-width, min(36vw, 560px)); max-height: min(92vh, 800px); overflow-y: auto;
10062
10062
  font-family: var(--ps-modal-font, system-ui, -apple-system, sans-serif);
10063
10063
  box-shadow: 0 1.3vw 2.6vw rgba(0,0,0,0.08); animation: ps-slide-up 0.3s ease;
10064
10064
  scrollbar-width: thin; scrollbar-color: var(--ps-border-color) transparent;
10065
10065
  flex-shrink: 0;
10066
10066
  }
10067
- .ps-tryon-modal-wide { max-width: 55vw; width: 55vw; height: 70vh; max-height: 70vh; display: flex; flex-direction: column; overflow: visible; transition: height 0.45s cubic-bezier(0.32, 0.72, 0, 1), max-height 0.45s cubic-bezier(0.32, 0.72, 0, 1); }
10068
- .ps-tryon-modal-tall.ps-tryon-modal-wide { height: 88vh; max-height: 88vh; }
10067
+ .ps-tryon-modal-wide { max-width: min(55vw, 900px); width: min(55vw, 900px); height: min(70vh, 680px); max-height: min(70vh, 680px); display: flex; flex-direction: column; overflow: visible; transition: height 0.45s cubic-bezier(0.32, 0.72, 0, 1), max-height 0.45s cubic-bezier(0.32, 0.72, 0, 1); }
10068
+ .ps-tryon-modal-tall.ps-tryon-modal-wide { height: min(88vh, 800px); max-height: min(88vh, 800px); }
10069
10069
  .ps-tryon-modal:has(.ps-tryon-drawer-open) { overflow: hidden; }
10070
10070
  @keyframes ps-slide-up { from { transform: translateY(1.04vw) scale(0.97); opacity: 0; filter: blur(4px); } to { transform: none; opacity: 1; filter: none; } }
10071
10071
 
@@ -13107,11 +13107,11 @@ const STYLES$1 = `
13107
13107
  overflow: hidden;
13108
13108
  }
13109
13109
  .ps-msc-stage-slot {
13110
- animation: ps-msc-stage-in 0.5s cubic-bezier(0.32, 0.72, 0, 1);
13110
+ animation: ps-msc-stage-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
13111
13111
  }
13112
13112
  @keyframes ps-msc-stage-in {
13113
- from { opacity: 0; transform: translateY(14px); }
13114
- to { opacity: 1; transform: translateY(0); }
13113
+ 0% { opacity: 0; transform: translateY(18px); filter: blur(4px); }
13114
+ 100% { opacity: 1; transform: translateY(0); filter: blur(0); }
13115
13115
  }
13116
13116
  .ps-msc-stage-title {
13117
13117
  font-size: 16px; font-weight: 700;
@@ -13673,6 +13673,86 @@ const STYLES$1 = `
13673
13673
  border-color: var(--ps-accent);
13674
13674
  color: var(--ps-accent);
13675
13675
  }
13676
+ .ps-msp-card-delete {
13677
+ width: 36px; height: 36px;
13678
+ background: var(--ps-bg-primary);
13679
+ border: 1px solid var(--ps-border-subtle);
13680
+ border-radius: 6px;
13681
+ display: flex; align-items: center; justify-content: center;
13682
+ color: var(--ps-text-secondary); cursor: pointer;
13683
+ transition: border-color 0.15s, color 0.15s;
13684
+ }
13685
+ .ps-msp-card-delete:hover {
13686
+ border-color: #F87171;
13687
+ color: #F87171;
13688
+ }
13689
+
13690
+ /* Edit measurements modal */
13691
+ .ps-msp-edit-overlay {
13692
+ position: absolute; inset: 0; z-index: 100;
13693
+ background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
13694
+ display: flex; align-items: center; justify-content: center;
13695
+ padding: 16px; animation: ps-fade-in 0.2s ease;
13696
+ }
13697
+ .ps-msp-edit-modal {
13698
+ background: var(--ps-bg-primary); border-radius: 14px;
13699
+ width: 100%; max-width: 380px; padding: 20px;
13700
+ box-shadow: 0 12px 40px rgba(0,0,0,0.15);
13701
+ animation: ps-slide-up 0.25s ease;
13702
+ }
13703
+ .ps-msp-edit-header {
13704
+ display: flex; align-items: center; justify-content: space-between;
13705
+ margin-bottom: 16px;
13706
+ }
13707
+ .ps-msp-edit-header h3 {
13708
+ font-size: 16px; font-weight: 600; color: var(--ps-text-primary); margin: 0;
13709
+ }
13710
+ .ps-msp-edit-close {
13711
+ background: none; border: none; color: var(--ps-text-secondary);
13712
+ cursor: pointer; padding: 4px;
13713
+ }
13714
+ .ps-msp-edit-grid {
13715
+ display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
13716
+ margin-bottom: 18px;
13717
+ }
13718
+ .ps-msp-edit-field {
13719
+ display: flex; flex-direction: column; gap: 4px;
13720
+ }
13721
+ .ps-msp-edit-label {
13722
+ font-size: 10px; font-weight: 600; text-transform: uppercase;
13723
+ letter-spacing: 0.06em; color: var(--ps-text-muted);
13724
+ }
13725
+ .ps-msp-edit-input-wrap {
13726
+ display: flex; align-items: center;
13727
+ border: 1px solid var(--ps-border-color); border-radius: 8px;
13728
+ overflow: hidden; background: var(--ps-bg-secondary);
13729
+ }
13730
+ .ps-msp-edit-input {
13731
+ flex: 1; border: none; background: transparent; padding: 8px 10px;
13732
+ font-size: 14px; color: var(--ps-text-primary); outline: none;
13733
+ min-width: 0; -moz-appearance: textfield;
13734
+ }
13735
+ .ps-msp-edit-input::-webkit-inner-spin-button,
13736
+ .ps-msp-edit-input::-webkit-outer-spin-button { -webkit-appearance: none; }
13737
+ .ps-msp-edit-input:focus { box-shadow: inset 0 0 0 1px var(--ps-accent); }
13738
+ .ps-msp-edit-unit {
13739
+ font-size: 11px; color: var(--ps-text-muted); padding-right: 10px;
13740
+ font-weight: 500; flex-shrink: 0;
13741
+ }
13742
+ .ps-msp-edit-actions {
13743
+ display: flex; gap: 8px; justify-content: flex-end;
13744
+ }
13745
+ .ps-msp-edit-cancel {
13746
+ padding: 8px 16px; font-size: 13px; font-weight: 500;
13747
+ border: 1px solid var(--ps-border-color); border-radius: 8px;
13748
+ background: transparent; color: var(--ps-text-secondary); cursor: pointer;
13749
+ }
13750
+ .ps-msp-edit-save {
13751
+ padding: 8px 20px; font-size: 13px; font-weight: 600;
13752
+ border: none; border-radius: 8px;
13753
+ background: var(--ps-accent); color: #fff; cursor: pointer;
13754
+ }
13755
+ .ps-msp-edit-save:hover { opacity: 0.9; }
13676
13756
 
13677
13757
  /* "Create New Profile" empty card */
13678
13758
  .ps-msp-card-create {
@@ -18206,11 +18286,83 @@ function ProfileMeasurementsView({
18206
18286
  ] })
18207
18287
  ] });
18208
18288
  }
18289
+ function EditMeasurementsModal({
18290
+ profile,
18291
+ onSave,
18292
+ onCancel,
18293
+ t: t2
18294
+ }) {
18295
+ const m2 = profile.measurements || {};
18296
+ const fields = [
18297
+ { key: "bust", label: "Bust" },
18298
+ { key: "waist", label: "Waist" },
18299
+ { key: "hips", label: "Hips" },
18300
+ { key: "shoulderWidth", label: "Shoulder" },
18301
+ { key: "sleeveLength", label: "Sleeve" },
18302
+ { key: "neckCircumference", label: "Neck" },
18303
+ { key: "inseam", label: "Inseam" },
18304
+ { key: "thighCircumference", label: "Thigh" }
18305
+ ];
18306
+ const [values, setValues] = reactExports.useState(() => {
18307
+ const init = {};
18308
+ fields.forEach((f2) => {
18309
+ init[f2.key] = m2[f2.key] != null ? String(Math.round(m2[f2.key] * 10) / 10) : "";
18310
+ });
18311
+ return init;
18312
+ });
18313
+ const unit = profile.measurementsUnit || "cm";
18314
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-msp-edit-overlay", onClick: onCancel, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-msp-edit-modal", onClick: (e) => e.stopPropagation(), children: [
18315
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-msp-edit-header", children: [
18316
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { children: t2("Edit Measurements") }),
18317
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "ps-msp-edit-close", onClick: onCancel, "aria-label": t2("Close"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", width: "18", height: "18", children: [
18318
+ /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
18319
+ /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
18320
+ ] }) })
18321
+ ] }),
18322
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-msp-edit-grid", children: fields.map((f2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "ps-msp-edit-field", children: [
18323
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ps-msp-edit-label", children: t2(f2.label) }),
18324
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-msp-edit-input-wrap", children: [
18325
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18326
+ "input",
18327
+ {
18328
+ type: "number",
18329
+ step: "0.1",
18330
+ className: "ps-msp-edit-input",
18331
+ value: values[f2.key] || "",
18332
+ onChange: (e) => setValues((v2) => ({ ...v2, [f2.key]: e.target.value })),
18333
+ placeholder: "—"
18334
+ }
18335
+ ),
18336
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ps-msp-edit-unit", children: unit })
18337
+ ] })
18338
+ ] }, f2.key)) }),
18339
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-msp-edit-actions", children: [
18340
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "ps-msp-edit-cancel", onClick: onCancel, children: t2("Cancel") }),
18341
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18342
+ "button",
18343
+ {
18344
+ type: "button",
18345
+ className: "ps-msp-edit-save",
18346
+ onClick: () => {
18347
+ const updated = { ...profile.measurements || {} };
18348
+ fields.forEach((f2) => {
18349
+ const v2 = parseFloat(values[f2.key]);
18350
+ if (!isNaN(v2) && v2 > 0) updated[f2.key] = v2;
18351
+ });
18352
+ onSave(updated);
18353
+ },
18354
+ children: t2("Save")
18355
+ }
18356
+ )
18357
+ ] })
18358
+ ] }) });
18359
+ }
18209
18360
  function ProfileCard({
18210
18361
  profile,
18211
18362
  isActive,
18212
18363
  onSelect,
18213
18364
  onEdit,
18365
+ onDelete,
18214
18366
  onOpenDetail,
18215
18367
  t: t2
18216
18368
  }) {
@@ -18272,6 +18424,13 @@ function ProfileCard({
18272
18424
  /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "ps-msp-card-edit", onClick: onEdit, "aria-label": t2("Edit"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", width: "14", height: "14", children: [
18273
18425
  /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
18274
18426
  /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })
18427
+ ] }) }),
18428
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "ps-msp-card-delete", onClick: (e) => {
18429
+ e.stopPropagation();
18430
+ if (confirm(t2("Delete this profile?"))) onDelete();
18431
+ }, "aria-label": t2("Delete"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", width: "14", height: "14", children: [
18432
+ /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "3 6 5 6 21 6" }),
18433
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
18275
18434
  ] }) })
18276
18435
  ] })
18277
18436
  ]
@@ -18301,79 +18460,99 @@ function MySizingProfilesView({
18301
18460
  }) {
18302
18461
  const [creating, setCreating] = reactExports.useState(false);
18303
18462
  const [viewingId, setViewingId] = reactExports.useState(null);
18463
+ const [editingId, setEditingId] = reactExports.useState(null);
18304
18464
  const viewingProfile = viewingId ? profiles.find((p2) => p2.id === viewingId) || null : null;
18465
+ const editingProfile = editingId ? profiles.find((p2) => p2.id === editingId) || null : null;
18305
18466
  const handleSaveNewProfile = (data) => {
18306
18467
  onSaveNewProfile(data);
18307
18468
  setCreating(false);
18308
18469
  };
18309
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-msp-root", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-msp-scroll", children: viewingProfile ? (
18310
- /* ── Profile detail view (full body measurements) ── */
18311
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18312
- ProfileMeasurementsView,
18313
- {
18314
- profile: viewingProfile,
18315
- isActive: viewingProfile.id === activeProfileId,
18316
- onSelect: () => {
18317
- onSelectProfile(viewingProfile.id);
18318
- setViewingId(null);
18319
- },
18320
- onSaveMeasurements: (m2) => onSaveProfileMeasurements(viewingProfile.id, m2),
18321
- onDelete: () => {
18322
- onDeleteProfile(viewingProfile.id);
18323
- setViewingId(null);
18324
- },
18325
- onBack: () => setViewingId(null),
18326
- onSave: () => setViewingId(null),
18327
- t: t2
18328
- }
18329
- )
18330
- ) : creating ? (
18331
- /* ── Multi-step create wizard (Identity → Silhouette) ── */
18332
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18333
- CreateProfileWizard,
18334
- {
18335
- onSave: (data) => {
18336
- handleSaveNewProfile(data);
18337
- setTimeout(() => {
18338
- const latest = typeof window !== "undefined" ? (() => {
18339
- try {
18340
- const raw = localStorage.getItem("primestyle_profiles");
18341
- if (raw) {
18342
- const list = JSON.parse(raw);
18343
- if (list.length > 0) return list[0].id;
18470
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-msp-root", children: [
18471
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ps-msp-scroll", children: viewingProfile ? (
18472
+ /* ── Profile detail view (full body measurements) ── */
18473
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18474
+ ProfileMeasurementsView,
18475
+ {
18476
+ profile: viewingProfile,
18477
+ isActive: viewingProfile.id === activeProfileId,
18478
+ onSelect: () => {
18479
+ onSelectProfile(viewingProfile.id);
18480
+ setViewingId(null);
18481
+ },
18482
+ onSaveMeasurements: (m2) => onSaveProfileMeasurements(viewingProfile.id, m2),
18483
+ onDelete: () => {
18484
+ onDeleteProfile(viewingProfile.id);
18485
+ setViewingId(null);
18486
+ },
18487
+ onBack: () => setViewingId(null),
18488
+ onSave: () => setViewingId(null),
18489
+ t: t2
18490
+ }
18491
+ )
18492
+ ) : creating ? (
18493
+ /* ── Multi-step create wizard (Identity → Silhouette) ── */
18494
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18495
+ CreateProfileWizard,
18496
+ {
18497
+ onSave: (data) => {
18498
+ handleSaveNewProfile(data);
18499
+ setTimeout(() => {
18500
+ const latest = typeof window !== "undefined" ? (() => {
18501
+ try {
18502
+ const raw = localStorage.getItem("primestyle_profiles");
18503
+ if (raw) {
18504
+ const list = JSON.parse(raw);
18505
+ if (list.length > 0) return list[0].id;
18506
+ }
18507
+ } catch {
18344
18508
  }
18345
- } catch {
18346
- }
18347
- return null;
18348
- })() : null;
18349
- if (latest) setViewingId(latest);
18350
- }, 50);
18509
+ return null;
18510
+ })() : null;
18511
+ if (latest) setViewingId(latest);
18512
+ }, 50);
18513
+ },
18514
+ onCancel: () => setCreating(false),
18515
+ t: t2
18516
+ }
18517
+ )
18518
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
18519
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-msp-header", children: [
18520
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "ps-msp-title", children: t2("My Sizing Profiles") }),
18521
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "ps-msp-subtitle", children: t2("Manage your bespoke silhouettes. Switch between profiles for different fits or create a new one for specific garment types.") })
18522
+ ] }),
18523
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-msp-grid", children: [
18524
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CreateProfileCard, { onClick: () => setCreating(true), t: t2 }),
18525
+ profiles.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
18526
+ ProfileCard,
18527
+ {
18528
+ profile: p2,
18529
+ isActive: p2.id === activeProfileId,
18530
+ onSelect: () => onSelectProfile(p2.id),
18531
+ onEdit: () => setEditingId(p2.id),
18532
+ onDelete: () => {
18533
+ onDeleteProfile(p2.id);
18534
+ if (viewingId === p2.id) setViewingId(null);
18535
+ },
18536
+ onOpenDetail: () => setViewingId(p2.id),
18537
+ t: t2
18538
+ },
18539
+ p2.id
18540
+ ))
18541
+ ] })
18542
+ ] }) }),
18543
+ editingProfile && /* @__PURE__ */ jsxRuntimeExports.jsx(
18544
+ EditMeasurementsModal,
18545
+ {
18546
+ profile: editingProfile,
18547
+ onSave: (m2) => {
18548
+ onSaveProfileMeasurements(editingProfile.id, m2);
18549
+ setEditingId(null);
18351
18550
  },
18352
- onCancel: () => setCreating(false),
18551
+ onCancel: () => setEditingId(null),
18353
18552
  t: t2
18354
18553
  }
18355
18554
  )
18356
- ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
18357
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-msp-header", children: [
18358
- /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "ps-msp-title", children: t2("My Sizing Profiles") }),
18359
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "ps-msp-subtitle", children: t2("Manage your bespoke silhouettes. Switch between profiles for different fits or create a new one for specific garment types.") })
18360
- ] }),
18361
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ps-msp-grid", children: [
18362
- /* @__PURE__ */ jsxRuntimeExports.jsx(CreateProfileCard, { onClick: () => setCreating(true), t: t2 }),
18363
- profiles.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
18364
- ProfileCard,
18365
- {
18366
- profile: p2,
18367
- isActive: p2.id === activeProfileId,
18368
- onSelect: () => onSelectProfile(p2.id),
18369
- onEdit: () => onEditProfile(p2),
18370
- onOpenDetail: () => setViewingId(p2.id),
18371
- t: t2
18372
- },
18373
- p2.id
18374
- ))
18375
- ] })
18376
- ] }) }) });
18555
+ ] });
18377
18556
  }
18378
18557
  function ResultView({ setView }) {
18379
18558
  reactExports.useEffect(() => {
@@ -18811,7 +18990,7 @@ function ImageOptionCard({
18811
18990
  );
18812
18991
  }
18813
18992
  const MALE_STEPS = ["basics", "chest", "midsection", "seat"];
18814
- const FEMALE_STEPS = ["basics", "midsection", "seat", "hips", "bra"];
18993
+ const FEMALE_STEPS = ["basics", "midsection", "seat", "hips"];
18815
18994
  const BAND_SIZES = {
18816
18995
  US: ["28", "30", "32", "34", "36", "38", "40", "42", "44", "46", "48", "50", "52", "54", "56"],
18817
18996
  UK: ["28", "30", "32", "34", "36", "38", "40", "42", "44", "46", "48", "50", "52", "54", "56"],
@@ -19683,6 +19862,7 @@ function PrimeStyleTryonInner({
19683
19862
  const [profileSaved, setProfileSaved] = reactExports.useState(false);
19684
19863
  const [drawer, setDrawer] = reactExports.useState(null);
19685
19864
  const [profileDetail, setProfileDetail] = reactExports.useState(null);
19865
+ const prevViewRef = reactExports.useRef(null);
19686
19866
  const fileInputRef = reactExports.useRef(null);
19687
19867
  const apiRef = reactExports.useRef(null);
19688
19868
  const sseRef = reactExports.useRef(null);
@@ -19935,6 +20115,14 @@ function PrimeStyleTryonInner({
19935
20115
  onClose?.();
19936
20116
  }, [onClose, previewUrl]);
19937
20117
  const handleBack = reactExports.useCallback(() => {
20118
+ if (drawer) {
20119
+ setDrawer(null);
20120
+ if (prevViewRef.current) {
20121
+ setView(prevViewRef.current);
20122
+ prevViewRef.current = null;
20123
+ }
20124
+ return;
20125
+ }
19938
20126
  switch (view) {
19939
20127
  case "body-profile":
19940
20128
  handleClose();
@@ -19956,13 +20144,13 @@ function PrimeStyleTryonInner({
19956
20144
  setView("body-profile");
19957
20145
  break;
19958
20146
  case "profiles":
19959
- setView("body-profile");
20147
+ handleClose();
19960
20148
  break;
19961
20149
  default:
19962
20150
  handleClose();
19963
20151
  break;
19964
20152
  }
19965
- }, [view, activeSection, handleClose]);
20153
+ }, [view, drawer, activeSection, handleClose]);
19966
20154
  const showBackButton = view !== "idle" && view !== "processing" && view !== "result" && view !== "welcome" && view !== "body-profile" && view !== "size-result";
19967
20155
  const handleFileSelect = reactExports.useCallback((file) => {
19968
20156
  if (!isValidImageFile(file)) {
@@ -20953,7 +21141,14 @@ function PrimeStyleTryonInner({
20953
21141
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cx("ps-tryon-header ps-tryon-header-minimal", cn.header), children: [
20954
21142
  /* @__PURE__ */ jsxRuntimeExports.jsx(LangSwitcher, { activeLocale, onSelect: setActiveLocale }),
20955
21143
  /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ps-tryon-header-icon", title: t2("Profiles"), onClick: () => setView(view === "profiles" ? "body-profile" : "profiles"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(UserIcon, {}) }),
20956
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ps-tryon-header-icon", title: t2("History"), onClick: () => setDrawer(drawer === "history" ? null : "history"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ClockIcon, {}) }),
21144
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ps-tryon-header-icon", title: t2("History"), onClick: () => {
21145
+ if (drawer === "history") {
21146
+ setDrawer(null);
21147
+ } else {
21148
+ prevViewRef.current = view;
21149
+ setDrawer("history");
21150
+ }
21151
+ }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ClockIcon, {}) }),
20957
21152
  /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: handleClose, className: cx("ps-tryon-close", cn.closeButton), children: /* @__PURE__ */ jsxRuntimeExports.jsx(XIcon, {}) })
20958
21153
  ] }),
20959
21154
  view !== "body-profile" && view !== "processing" && !(view === "size-result" && sizeGuide?.sections && Object.keys(sizeGuide.sections).length > 1) && /* @__PURE__ */ jsxRuntimeExports.jsx(Stepper, { view, stepIndex }),
@@ -21381,9 +21576,13 @@ function buildPropsFromDataAttrs(data) {
21381
21576
  }
21382
21577
  async function fetchSizeGuideForProduct(proxyUrl, productId) {
21383
21578
  try {
21384
- const url = `${proxyUrl}/api/v1/sizeguide-lookup?productId=${encodeURIComponent(productId)}`;
21385
- console.log(`${TAG} fetching size guide ${url}`);
21386
- const res = await fetch(url, { method: "GET" });
21579
+ const url = `${proxyUrl}/api/v1/sizeguide-lookup`;
21580
+ console.log(`${TAG} fetching size guide ${url} (productId=${productId})`);
21581
+ const res = await fetch(url, {
21582
+ method: "POST",
21583
+ headers: { "Content-Type": "application/json" },
21584
+ body: JSON.stringify({ productId })
21585
+ });
21387
21586
  if (!res.ok) {
21388
21587
  console.warn(`${TAG} size guide lookup failed: ${res.status}`);
21389
21588
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.7.10",
3
+ "version": "5.8.0",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",