@primestyleai/tryon 5.6.14 → 5.6.15

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.
@@ -3337,7 +3337,8 @@ const STYLES = `
3337
3337
  object-fit: contain; display: block;
3338
3338
  }
3339
3339
  .ps-pm-preview-empty {
3340
- display: flex; flex-direction: column; align-items: center;
3340
+ display: flex; flex-direction: column;
3341
+ align-items: center; justify-content: center;
3341
3342
  gap: 6px; padding: 24px;
3342
3343
  background: none; border: none;
3343
3344
  color: var(--ps-text-muted); cursor: pointer;
@@ -3621,16 +3622,53 @@ const STYLES = `
3621
3622
  }
3622
3623
  .ps-msr-product-img-wrap {
3623
3624
  position: relative; flex-shrink: 0;
3624
- width: 220px; height: 220px;
3625
+ width: 100%; max-width: 360px; height: 420px;
3625
3626
  border-radius: 12px; overflow: hidden;
3626
3627
  background: var(--ps-bg-secondary);
3627
3628
  display: flex; align-items: center; justify-content: center;
3628
3629
  }
3630
+ /* When showing the try-on result, give it a touch more presence */
3631
+ .ps-msr-product-img-wrap.ps-tryon {
3632
+ background: #0F0F10;
3633
+ }
3629
3634
  .ps-msr-product-img {
3630
3635
  max-width: 100%; max-height: 100%;
3631
3636
  width: auto; height: 100%;
3632
3637
  object-fit: contain; display: block;
3633
3638
  }
3639
+ /* Show-Fit / mediapipe overlay toggle pill — bottom-left of try-on hero */
3640
+ .ps-msr-fit-toggle {
3641
+ position: absolute; bottom: 10px; left: 10px;
3642
+ display: flex; align-items: center; gap: 6px;
3643
+ padding: 8px 12px;
3644
+ background: rgba(255,255,255,0.92);
3645
+ color: var(--ps-text-primary);
3646
+ border: none; border-radius: 999px;
3647
+ font-family: inherit; font-size: 11px; font-weight: 700;
3648
+ letter-spacing: 0.04em;
3649
+ cursor: pointer;
3650
+ box-shadow: 0 2px 8px rgba(0,0,0,0.18);
3651
+ backdrop-filter: blur(6px);
3652
+ -webkit-backdrop-filter: blur(6px);
3653
+ z-index: 2;
3654
+ }
3655
+ .ps-msr-fit-toggle:active { transform: scale(0.97); }
3656
+ .ps-msr-fit-toggle[aria-pressed="true"] {
3657
+ background: var(--ps-accent); color: #FFFFFF;
3658
+ }
3659
+ /* Bottom action row when try-on finished — Try Again + Continue Shopping */
3660
+ .ps-msr-bottom-row {
3661
+ display: flex; gap: 10px; align-items: stretch;
3662
+ }
3663
+ .ps-msr-bottom-row .ps-msr-tryon-cta { flex: 1; }
3664
+ .ps-msr-tryon-cta.ps-secondary {
3665
+ background: transparent;
3666
+ color: var(--ps-text-primary);
3667
+ border: 1.5px solid var(--ps-border-color);
3668
+ }
3669
+ .ps-msr-tryon-cta.ps-secondary:active {
3670
+ background: var(--ps-bg-secondary);
3671
+ }
3634
3672
  .ps-msr-bookmark {
3635
3673
  position: absolute; top: 10px; right: 10px;
3636
3674
  width: 30px; height: 30px; border-radius: 7px;
@@ -4793,9 +4831,9 @@ const STYLES = `
4793
4831
  .ps-pmv-actions-right { flex-wrap: wrap; }
4794
4832
  }
4795
4833
 
4796
- /* Big product image */
4834
+ /* Big product / try-on image */
4797
4835
  .ps-msd-image {
4798
- width: 100%; height: 240px;
4836
+ width: 100%; height: 420px;
4799
4837
  border-radius: 12px; overflow: hidden;
4800
4838
  background: var(--ps-bg-secondary);
4801
4839
  display: flex; align-items: center; justify-content: center;
@@ -6186,6 +6224,14 @@ function CameraIcon() {
6186
6224
  function BookmarkIcon() {
6187
6225
  return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", width: "14", height: "14", children: /* @__PURE__ */ jsx("path", { d: "M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z" }) });
6188
6226
  }
6227
+ function FitLinesIcon() {
6228
+ return /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
6229
+ /* @__PURE__ */ jsx("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
6230
+ /* @__PURE__ */ jsx("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
6231
+ /* @__PURE__ */ jsx("circle", { cx: "7", cy: "9", r: "2" }),
6232
+ /* @__PURE__ */ jsx("circle", { cx: "17", cy: "15", r: "2" })
6233
+ ] });
6234
+ }
6189
6235
  function MultiSectionMobile({
6190
6236
  productImage,
6191
6237
  productTitle,
@@ -6195,6 +6241,14 @@ function MultiSectionMobile({
6195
6241
  onSelectSection,
6196
6242
  onTryOn,
6197
6243
  tryOnProcessing,
6244
+ resultImageUrl,
6245
+ tryOnDone,
6246
+ onTryAgain,
6247
+ onClose,
6248
+ overlayNode,
6249
+ showLines,
6250
+ onToggleLines,
6251
+ onImageLoad,
6198
6252
  t
6199
6253
  }) {
6200
6254
  const matchPct = useMemo(() => {
@@ -6215,13 +6269,37 @@ function MultiSectionMobile({
6215
6269
  if (sizingResult?.confidence === "medium") return 84;
6216
6270
  return 72;
6217
6271
  }, [sizingResult]);
6272
+ const heroImage = resultImageUrl || productImage;
6273
+ const showingTryOn = !!resultImageUrl;
6218
6274
  return /* @__PURE__ */ jsxs("div", { className: "ps-msr-root", children: [
6219
6275
  /* @__PURE__ */ jsxs("div", { className: "ps-msr-scroll", children: [
6220
6276
  /* @__PURE__ */ jsx("div", { className: "ps-msr-eyebrow", children: t("Sizing Profile") }),
6221
6277
  /* @__PURE__ */ jsxs("div", { className: "ps-msr-product", children: [
6222
- /* @__PURE__ */ jsxs("div", { className: "ps-msr-product-img-wrap", children: [
6223
- /* @__PURE__ */ jsx("img", { src: productImage, alt: productTitle, className: "ps-msr-product-img" }),
6224
- /* @__PURE__ */ jsx("button", { type: "button", className: "ps-msr-bookmark", "aria-label": t("Save"), children: /* @__PURE__ */ jsx(BookmarkIcon, {}) })
6278
+ /* @__PURE__ */ jsxs("div", { className: `ps-msr-product-img-wrap${showingTryOn ? " ps-tryon" : ""}`, children: [
6279
+ /* @__PURE__ */ jsx(
6280
+ "img",
6281
+ {
6282
+ src: heroImage,
6283
+ alt: productTitle,
6284
+ className: "ps-msr-product-img",
6285
+ onLoad: onImageLoad
6286
+ }
6287
+ ),
6288
+ showLines && overlayNode,
6289
+ !showingTryOn && /* @__PURE__ */ jsx("button", { type: "button", className: "ps-msr-bookmark", "aria-label": t("Save"), children: /* @__PURE__ */ jsx(BookmarkIcon, {}) }),
6290
+ showingTryOn && onToggleLines && /* @__PURE__ */ jsxs(
6291
+ "button",
6292
+ {
6293
+ type: "button",
6294
+ className: "ps-msr-fit-toggle",
6295
+ onClick: onToggleLines,
6296
+ "aria-pressed": !!showLines,
6297
+ children: [
6298
+ /* @__PURE__ */ jsx(FitLinesIcon, {}),
6299
+ showLines ? t("Hide Fit") : t("Show Fit")
6300
+ ]
6301
+ }
6302
+ )
6225
6303
  ] }),
6226
6304
  /* @__PURE__ */ jsx("h2", { className: "ps-msr-product-name", children: productTitle })
6227
6305
  ] }),
@@ -6270,7 +6348,26 @@ function MultiSectionMobile({
6270
6348
  );
6271
6349
  }) })
6272
6350
  ] }),
6273
- /* @__PURE__ */ jsx("div", { className: "ps-msr-bottom", children: /* @__PURE__ */ jsxs(
6351
+ /* @__PURE__ */ jsx("div", { className: "ps-msr-bottom", children: tryOnDone ? /* @__PURE__ */ jsxs("div", { className: "ps-msr-bottom-row", children: [
6352
+ /* @__PURE__ */ jsx(
6353
+ "button",
6354
+ {
6355
+ type: "button",
6356
+ className: "ps-msr-tryon-cta ps-secondary",
6357
+ onClick: onTryAgain,
6358
+ children: t("Try Again")
6359
+ }
6360
+ ),
6361
+ /* @__PURE__ */ jsx(
6362
+ "button",
6363
+ {
6364
+ type: "button",
6365
+ className: "ps-msr-tryon-cta",
6366
+ onClick: onClose,
6367
+ children: t("Continue Shopping")
6368
+ }
6369
+ )
6370
+ ] }) : /* @__PURE__ */ jsxs(
6274
6371
  "button",
6275
6372
  {
6276
6373
  type: "button",
@@ -6498,7 +6595,12 @@ function SectionDetailView({
6498
6595
  t,
6499
6596
  productImage,
6500
6597
  productTitle,
6501
- isMobile: isMobileProp
6598
+ isMobile: isMobileProp,
6599
+ isTryOnImage,
6600
+ showLines,
6601
+ onToggleLines,
6602
+ overlayNode,
6603
+ onImageLoad
6502
6604
  }) {
6503
6605
  const recSize = sectionResult?.recommendedSize || "";
6504
6606
  const [selectedSize, setSelectedSize] = useState(null);
@@ -6706,7 +6808,36 @@ function SectionDetailView({
6706
6808
  ] }),
6707
6809
  /* @__PURE__ */ jsx("span", { className: "ps-msd-topbar-spacer" })
6708
6810
  ] }),
6709
- productImage && /* @__PURE__ */ jsx("div", { className: "ps-msd-image", children: /* @__PURE__ */ jsx("img", { src: productImage, alt: productTitle || "", className: "ps-msd-image-img" }) }),
6811
+ productImage && /* @__PURE__ */ jsxs("div", { className: `ps-msd-image${isTryOnImage ? " ps-tryon" : ""}`, children: [
6812
+ /* @__PURE__ */ jsx(
6813
+ "img",
6814
+ {
6815
+ src: productImage,
6816
+ alt: productTitle || "",
6817
+ className: "ps-msd-image-img",
6818
+ onLoad: onImageLoad
6819
+ }
6820
+ ),
6821
+ showLines && overlayNode,
6822
+ isTryOnImage && onToggleLines && /* @__PURE__ */ jsxs(
6823
+ "button",
6824
+ {
6825
+ type: "button",
6826
+ className: "ps-msr-fit-toggle",
6827
+ onClick: onToggleLines,
6828
+ "aria-pressed": !!showLines,
6829
+ children: [
6830
+ /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
6831
+ /* @__PURE__ */ jsx("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
6832
+ /* @__PURE__ */ jsx("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
6833
+ /* @__PURE__ */ jsx("circle", { cx: "7", cy: "9", r: "2" }),
6834
+ /* @__PURE__ */ jsx("circle", { cx: "17", cy: "15", r: "2" })
6835
+ ] }),
6836
+ showLines ? t("Hide Fit") : t("Show Fit")
6837
+ ]
6838
+ }
6839
+ )
6840
+ ] }),
6710
6841
  /* @__PURE__ */ jsxs("div", { className: "ps-msd-card", children: [
6711
6842
  /* @__PURE__ */ jsx("span", { className: "ps-msd-card-eyebrow", children: displaySize === backendSize ? t("RECOMMENDED SIZE") : t("TRYING SIZE") }),
6712
6843
  /* @__PURE__ */ jsxs("div", { className: "ps-msd-card-size-row", children: [
@@ -6964,6 +7095,8 @@ function SizeResultView({
6964
7095
  estimationDone = false,
6965
7096
  activeSection,
6966
7097
  setActiveSection,
7098
+ onResetTryOn,
7099
+ onClose,
6967
7100
  t
6968
7101
  }) {
6969
7102
  const unitLbl = sizingUnit === "cm" ? t("cm") : t("in");
@@ -7253,6 +7386,34 @@ function SizeResultView({
7253
7386
  productImage: resultImageUrl || productImage,
7254
7387
  productTitle,
7255
7388
  isMobile: true,
7389
+ isTryOnImage: !!resultImageUrl,
7390
+ showLines,
7391
+ onToggleLines: () => setShowLines(!showLines),
7392
+ onImageLoad: handleImgLoad,
7393
+ overlayNode: resultImageUrl && poseReady && poseLines ? /* @__PURE__ */ jsx(
7394
+ MeasurementOverlay,
7395
+ {
7396
+ lines: poseLines,
7397
+ fitRows: (() => {
7398
+ const all = [...sizingResult?.matchDetails || []];
7399
+ if (sizingResult?.sections) {
7400
+ for (const sec of Object.values(sizingResult.sections)) {
7401
+ if (sec.matchDetails) all.push(...sec.matchDetails);
7402
+ }
7403
+ }
7404
+ const seen = /* @__PURE__ */ new Set();
7405
+ return all.filter((m) => {
7406
+ const k = m.measurement.toLowerCase();
7407
+ if (seen.has(k)) return false;
7408
+ seen.add(k);
7409
+ return true;
7410
+ }).map((m) => ({ area: m.measurement, userNum: parseFloat(m.userValue) || 0, chartLabel: m.chartRange || "", fit: m.fit }));
7411
+ })(),
7412
+ show: showLines,
7413
+ imgWidth: imgDims.w,
7414
+ imgHeight: imgDims.h
7415
+ }
7416
+ ) : null,
7256
7417
  t
7257
7418
  }
7258
7419
  );
@@ -7290,6 +7451,41 @@ function SizeResultView({
7290
7451
  setShowPhotoGuide(true);
7291
7452
  },
7292
7453
  tryOnProcessing,
7454
+ resultImageUrl,
7455
+ tryOnDone: !!resultImageUrl && !tryOnProcessing,
7456
+ onTryAgain: () => {
7457
+ onResetTryOn?.();
7458
+ setGuideFile(null);
7459
+ setShowPhotoGuide(true);
7460
+ },
7461
+ onClose,
7462
+ showLines,
7463
+ onToggleLines: () => setShowLines(!showLines),
7464
+ onImageLoad: handleImgLoad,
7465
+ overlayNode: resultImageUrl && poseReady && poseLines ? /* @__PURE__ */ jsx(
7466
+ MeasurementOverlay,
7467
+ {
7468
+ lines: poseLines,
7469
+ fitRows: (() => {
7470
+ const all = [...sizingResult?.matchDetails || []];
7471
+ if (sizingResult?.sections) {
7472
+ for (const sec of Object.values(sizingResult.sections)) {
7473
+ if (sec.matchDetails) all.push(...sec.matchDetails);
7474
+ }
7475
+ }
7476
+ const seen = /* @__PURE__ */ new Set();
7477
+ return all.filter((m) => {
7478
+ const k = m.measurement.toLowerCase();
7479
+ if (seen.has(k)) return false;
7480
+ seen.add(k);
7481
+ return true;
7482
+ }).map((m) => ({ area: m.measurement, userNum: parseFloat(m.userValue) || 0, chartLabel: m.chartRange || "", fit: m.fit }));
7483
+ })(),
7484
+ show: showLines,
7485
+ imgWidth: imgDims.w,
7486
+ imgHeight: imgDims.h
7487
+ }
7488
+ ) : null,
7293
7489
  t
7294
7490
  }
7295
7491
  )
@@ -8575,25 +8771,6 @@ function CreateProfileCard({ onClick, t }) {
8575
8771
  /* @__PURE__ */ jsx("div", { className: "ps-msp-create-sub", children: t("ADD MEASUREMENTS & PHOTO") })
8576
8772
  ] });
8577
8773
  }
8578
- function SizeHistoryCard({ entry, profileName, t }) {
8579
- const date = new Date(entry.savedAt).toLocaleDateString(void 0, { month: "short", day: "numeric" });
8580
- return /* @__PURE__ */ jsxs("div", { className: "ps-msp-history-card", children: [
8581
- entry.productImage && /* @__PURE__ */ jsx("div", { className: "ps-msp-history-thumb", children: /* @__PURE__ */ jsx("img", { src: entry.productImage, alt: entry.productTitle }) }),
8582
- /* @__PURE__ */ jsxs("div", { className: "ps-msp-history-info", children: [
8583
- /* @__PURE__ */ jsx("div", { className: "ps-msp-history-name", children: entry.productTitle }),
8584
- profileName && /* @__PURE__ */ jsx("div", { className: "ps-msp-history-profile", children: profileName }),
8585
- /* @__PURE__ */ jsxs("div", { className: "ps-msp-history-meta", children: [
8586
- /* @__PURE__ */ jsx(ClockIcon, { size: 11 }),
8587
- " ",
8588
- date
8589
- ] })
8590
- ] }),
8591
- /* @__PURE__ */ jsxs("div", { className: "ps-msp-history-size", children: [
8592
- /* @__PURE__ */ jsx("span", { className: "ps-msp-history-size-label", children: t("SIZE") }),
8593
- /* @__PURE__ */ jsx("span", { className: "ps-msp-history-size-value", children: entry.recommendedSize })
8594
- ] })
8595
- ] });
8596
- }
8597
8774
  function MySizingProfilesView({
8598
8775
  profiles,
8599
8776
  activeProfileId,
@@ -8608,15 +8785,6 @@ function MySizingProfilesView({
8608
8785
  const [creating, setCreating] = useState(false);
8609
8786
  const [viewingId, setViewingId] = useState(null);
8610
8787
  const viewingProfile = viewingId ? profiles.find((p) => p.id === viewingId) || null : null;
8611
- const allHistory = useMemo(() => {
8612
- const items = [];
8613
- for (const p of profiles) {
8614
- for (const h of p.sizeHistory || []) {
8615
- items.push({ entry: h, profileName: p.name });
8616
- }
8617
- }
8618
- return items.sort((a, b) => b.entry.savedAt - a.entry.savedAt).slice(0, 12);
8619
- }, [profiles]);
8620
8788
  const handleSaveNewProfile = (data) => {
8621
8789
  onSaveNewProfile(data);
8622
8790
  setCreating(false);
@@ -8687,10 +8855,6 @@ function MySizingProfilesView({
8687
8855
  },
8688
8856
  p.id
8689
8857
  ))
8690
- ] }),
8691
- allHistory.length > 0 && /* @__PURE__ */ jsxs("div", { className: "ps-msp-history-section", children: [
8692
- /* @__PURE__ */ jsx("h3", { className: "ps-msp-history-title", children: t("Recent Size Calculations") }),
8693
- /* @__PURE__ */ jsx("div", { className: "ps-msp-history-list", children: allHistory.map(({ entry, profileName }) => /* @__PURE__ */ jsx(SizeHistoryCard, { entry, profileName, t }, `${entry.productId}-${entry.savedAt}`)) })
8694
8858
  ] })
8695
8859
  ] }) }) });
8696
8860
  }
@@ -11065,6 +11229,13 @@ function PrimeStyleTryonInner({
11065
11229
  bodyLandmarks,
11066
11230
  activeSection,
11067
11231
  setActiveSection,
11232
+ onResetTryOn: () => {
11233
+ setSelectedFile(null);
11234
+ if (previewUrl) URL.revokeObjectURL(previewUrl);
11235
+ setPreviewUrl(null);
11236
+ setResultImageUrl(null);
11237
+ },
11238
+ onClose: handleClose,
11068
11239
  t
11069
11240
  }
11070
11241
  ) }, "v-sizeresult");