@primestyleai/tryon 5.3.3 → 5.3.4

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.
Files changed (2) hide show
  1. package/dist/react/index.js +41 -28
  2. package/package.json +1 -1
@@ -2,6 +2,7 @@
2
2
  import { P as PrimeStyleError, L as LOCALE_LABELS, b as SUPPORTED_LOCALES, a as compressImage, c as createT, A as ApiClient, S as SseClient, i as isValidImageFile } from "../index-J6U0-q_3.js";
3
3
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
4
4
  import { useState, useRef, useCallback, useEffect, useMemo } from "react";
5
+ import { createPortal } from "react-dom";
5
6
  const LEFT_SHOULDER = 11;
6
7
  const RIGHT_SHOULDER = 12;
7
8
  const LEFT_ELBOW = 13;
@@ -3341,9 +3342,11 @@ function LangSwitcher({ activeLocale: current, onSelect }) {
3341
3342
  };
3342
3343
  document.addEventListener("mousedown", handler);
3343
3344
  window.addEventListener("resize", updatePos);
3345
+ window.addEventListener("scroll", updatePos, true);
3344
3346
  return () => {
3345
3347
  document.removeEventListener("mousedown", handler);
3346
3348
  window.removeEventListener("resize", updatePos);
3349
+ window.removeEventListener("scroll", updatePos, true);
3347
3350
  };
3348
3351
  }, [open, updatePos]);
3349
3352
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -3360,34 +3363,37 @@ function LangSwitcher({ activeLocale: current, onSelect }) {
3360
3363
  ]
3361
3364
  }
3362
3365
  ),
3363
- open && /* @__PURE__ */ jsx(
3364
- "div",
3365
- {
3366
- ref: dropRef,
3367
- className: "ps-tryon-lang-dropdown",
3368
- style: {
3369
- position: "fixed",
3370
- top: pos.top,
3371
- right: pos.right,
3372
- zIndex: 9999999
3373
- },
3374
- children: /* @__PURE__ */ jsx("div", { className: "ps-tryon-lang-list", children: SUPPORTED_LOCALES.map((code) => /* @__PURE__ */ jsxs(
3375
- "button",
3376
- {
3377
- className: `ps-tryon-lang-item${code === current ? " ps-selected" : ""}`,
3378
- onClick: () => {
3379
- onSelect(code);
3380
- setOpen(false);
3381
- },
3382
- children: [
3383
- /* @__PURE__ */ jsx("span", { className: "ps-tryon-lang-name", children: LOCALE_LABELS[code] || code }),
3384
- /* @__PURE__ */ jsx("span", { className: "ps-tryon-lang-code", children: code.toUpperCase() }),
3385
- code === current && /* @__PURE__ */ jsx("span", { className: "ps-tryon-lang-check", children: /* @__PURE__ */ jsx(CheckIcon, { size: 12 }) })
3386
- ]
3366
+ open && createPortal(
3367
+ /* @__PURE__ */ jsx(
3368
+ "div",
3369
+ {
3370
+ ref: dropRef,
3371
+ className: "ps-tryon-lang-dropdown",
3372
+ style: {
3373
+ position: "fixed",
3374
+ top: pos.top,
3375
+ right: pos.right,
3376
+ zIndex: 9999999
3387
3377
  },
3388
- code
3389
- )) })
3390
- }
3378
+ children: /* @__PURE__ */ jsx("div", { className: "ps-tryon-lang-list", children: SUPPORTED_LOCALES.map((code) => /* @__PURE__ */ jsxs(
3379
+ "button",
3380
+ {
3381
+ className: `ps-tryon-lang-item${code === current ? " ps-selected" : ""}`,
3382
+ onClick: () => {
3383
+ onSelect(code);
3384
+ setOpen(false);
3385
+ },
3386
+ children: [
3387
+ /* @__PURE__ */ jsx("span", { className: "ps-tryon-lang-name", children: LOCALE_LABELS[code] || code }),
3388
+ /* @__PURE__ */ jsx("span", { className: "ps-tryon-lang-code", children: code.toUpperCase() }),
3389
+ code === current && /* @__PURE__ */ jsx("span", { className: "ps-tryon-lang-check", children: /* @__PURE__ */ jsx(CheckIcon, { size: 12 }) })
3390
+ ]
3391
+ },
3392
+ code
3393
+ )) })
3394
+ }
3395
+ ),
3396
+ document.body
3391
3397
  )
3392
3398
  ] });
3393
3399
  }
@@ -4659,7 +4665,14 @@ function SizeResultView({
4659
4665
  const isRecommended = displaySize === origSize;
4660
4666
  const displayFitRows = useMemo(() => {
4661
4667
  if (!sizingResult?.matchDetails?.length) return [];
4662
- return sizingResult.matchDetails.map((m) => {
4668
+ const seen = /* @__PURE__ */ new Set();
4669
+ const unique = sizingResult.matchDetails.filter((m) => {
4670
+ const key = m.measurement.toLowerCase().replace(/\s*\(.*?\)\s*/g, "").trim();
4671
+ if (seen.has(key)) return false;
4672
+ seen.add(key);
4673
+ return true;
4674
+ });
4675
+ return unique.map((m) => {
4663
4676
  const userNum = pNumFn(m.userValue);
4664
4677
  let chartLabel = m.chartRange;
4665
4678
  let fit = m.fit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "5.3.3",
3
+ "version": "5.3.4",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",