@primestyleai/tryon 4.3.2 → 4.6.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.
Files changed (66) hide show
  1. package/dist/api-client.d.ts +2 -2
  2. package/dist/i18n.d.ts +20 -0
  3. package/dist/index-J6U0-q_3.js +2638 -0
  4. package/dist/index.d.ts +2 -1
  5. package/dist/locales/ar.d.ts +2 -0
  6. package/dist/locales/da.d.ts +2 -0
  7. package/dist/locales/de.d.ts +2 -0
  8. package/dist/locales/es.d.ts +2 -0
  9. package/dist/locales/fi.d.ts +2 -0
  10. package/dist/locales/fr.d.ts +2 -0
  11. package/dist/locales/index.d.ts +1 -0
  12. package/dist/locales/it.d.ts +2 -0
  13. package/dist/locales/ja.d.ts +2 -0
  14. package/dist/locales/ko.d.ts +2 -0
  15. package/dist/locales/nb.d.ts +2 -0
  16. package/dist/locales/nl.d.ts +2 -0
  17. package/dist/locales/pl.d.ts +2 -0
  18. package/dist/locales/pt.d.ts +2 -0
  19. package/dist/locales/ru.d.ts +2 -0
  20. package/dist/locales/sv.d.ts +2 -0
  21. package/dist/locales/th.d.ts +2 -0
  22. package/dist/locales/tr.d.ts +2 -0
  23. package/dist/locales/vi.d.ts +2 -0
  24. package/dist/locales/zh.d.ts +2 -0
  25. package/dist/pose-detect.d.ts +73 -0
  26. package/dist/primestyle-tryon.css +1 -0
  27. package/dist/primestyle-tryon.js +14 -3
  28. package/dist/react/PrimeStyleTryon.d.ts +2 -0
  29. package/dist/react/PrimeStyleTryonInner.d.ts +2 -0
  30. package/dist/react/assets/body-illustrations-png.d.ts +36 -0
  31. package/dist/react/assets/body-illustrations.d.ts +36 -0
  32. package/dist/react/components/DrawerPanel.d.ts +13 -0
  33. package/dist/react/components/FullChartOverlay.d.ts +1 -0
  34. package/dist/react/components/InputRow.d.ts +9 -0
  35. package/dist/react/components/LangSwitcher.d.ts +4 -0
  36. package/dist/react/components/ProfileDetailModal.d.ts +10 -0
  37. package/dist/react/components/ProfileEditView.d.ts +8 -0
  38. package/dist/react/components/Stepper.d.ts +5 -0
  39. package/dist/react/components/UnitToggle.d.ts +8 -0
  40. package/dist/react/constants.d.ts +17 -0
  41. package/dist/react/icons.d.ts +64 -0
  42. package/dist/react/index.d.ts +3 -35
  43. package/dist/react/index.js +6945 -2399
  44. package/dist/react/styles.d.ts +1 -0
  45. package/dist/react/types.d.ts +106 -0
  46. package/dist/react/utils/classnames.d.ts +1 -0
  47. package/dist/react/utils/locale.d.ts +3 -0
  48. package/dist/react/utils/storage.d.ts +3 -0
  49. package/dist/react/utils/units.d.ts +6 -0
  50. package/dist/react/views/BodyProfileView.d.ts +41 -0
  51. package/dist/react/views/ErrorView.d.ts +8 -0
  52. package/dist/react/views/EstimationReviewView.d.ts +21 -0
  53. package/dist/react/views/HeightPickerView.d.ts +8 -0
  54. package/dist/react/views/ProcessingView.d.ts +11 -0
  55. package/dist/react/views/QuizView.d.ts +9 -0
  56. package/dist/react/views/ResultView.d.ts +4 -0
  57. package/dist/react/views/SizeResultView.d.ts +27 -0
  58. package/dist/react/views/SizingChoiceView.d.ts +37 -0
  59. package/dist/react/views/UploadView.d.ts +14 -0
  60. package/dist/react/views/WeightPickerView.d.ts +8 -0
  61. package/dist/react/views/WelcomeView.d.ts +7 -0
  62. package/dist/sizing/fit-compute.d.ts +15 -0
  63. package/dist/sizing/normalizer.d.ts +9 -33
  64. package/dist/types.d.ts +41 -0
  65. package/package.json +7 -3
  66. package/dist/index-CILUifQv.js +0 -2991
@@ -0,0 +1,37 @@
1
+ import type { TranslateFn } from "../../i18n";
2
+ import type { ViewState, SizeGuide, SizeGuideField, Profile, BodyType } from "../types";
3
+ export declare function SizingChoiceView({ productImage, productTitle, sizeGuide, sizeGuideFetching, formRef, formGender, formKey, setFormKey, setFormGender, sizingUnit, setSizingUnit, heightUnit, setHeightUnit, weightUnit, setWeightUnit, sizingCountry, profiles, activeProfileId, applyProfile, dynamicFields, shoeField, updateField, setSizingMethod, setSizingLoading, setView, submitSizing, saveProfile, onQuickEstimate, t, }: {
4
+ productImage: string;
5
+ productTitle: string;
6
+ sizeGuide: SizeGuide | null;
7
+ sizeGuideFetching: boolean;
8
+ formRef: React.MutableRefObject<Record<string, string>>;
9
+ formGender: string;
10
+ formKey: number;
11
+ setFormKey: React.Dispatch<React.SetStateAction<number>>;
12
+ setFormGender: (g: string) => void;
13
+ sizingUnit: string;
14
+ setSizingUnit: (u: string) => void;
15
+ heightUnit: string;
16
+ setHeightUnit: (u: string) => void;
17
+ weightUnit: string;
18
+ setWeightUnit: (u: string) => void;
19
+ sizingCountry: string;
20
+ profiles: Profile[];
21
+ activeProfileId: string | null;
22
+ applyProfile: (id: string) => void;
23
+ dynamicFields: SizeGuideField[];
24
+ shoeField: {
25
+ key: string;
26
+ label: string;
27
+ ph: string;
28
+ };
29
+ updateField: (key: string, val: string) => void;
30
+ setSizingMethod: (m: "exact" | "quick" | null) => void;
31
+ setSizingLoading: (v: boolean) => void;
32
+ setView: (v: ViewState) => void;
33
+ submitSizing: (mode: "exact" | "quick") => void;
34
+ saveProfile: (name: string) => void;
35
+ onQuickEstimate: (height: number, weight: number, heightUnit: string, weightUnit: string, gender: string, age?: number, bodyType?: BodyType) => void;
36
+ t: TranslateFn;
37
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import type { PrimeStyleClassNames } from "../../types";
2
+ import type { TranslateFn } from "../../i18n";
3
+ export declare function UploadView({ selectedFile, previewUrl, dragOver, setDragOver, fileInputRef, handleFileSelect, handleRemovePreview, handleTryOnSubmit, cn, t, }: {
4
+ selectedFile: File | null;
5
+ previewUrl: string | null;
6
+ dragOver: boolean;
7
+ setDragOver: (v: boolean) => void;
8
+ fileInputRef: React.RefObject<HTMLInputElement>;
9
+ handleFileSelect: (file: File) => void;
10
+ handleRemovePreview: () => void;
11
+ handleTryOnSubmit: () => void;
12
+ cn: PrimeStyleClassNames;
13
+ t: TranslateFn;
14
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import type { TranslateFn } from "../../i18n";
2
+ export declare function WeightPickerView({ initialKg, weightUnit, onNext, onUnitChange, t, }: {
3
+ initialKg: number;
4
+ weightUnit: string;
5
+ onNext: (kg: number) => void;
6
+ onUnitChange: (unit: string) => void;
7
+ t: TranslateFn;
8
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { TranslateFn } from "../../i18n";
2
+ import type { ViewState } from "../types";
3
+ export declare function WelcomeView({ productImage, setView, t, }: {
4
+ productImage: string;
5
+ setView: (v: ViewState) => void;
6
+ t: TranslateFn;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import type { FitAreaInfo } from "../types";
2
+ import type { MeasurementLines } from "../pose-detect";
3
+ export type GranularFit = "good" | "tight" | "loose" | "a-bit-tight" | "a-bit-loose" | "too-tight" | "too-loose";
4
+ /** Compute granular fit label for a single measurement */
5
+ export declare function computeFit(userValue: number, chartRange: string): GranularFit;
6
+ /**
7
+ * Build FitAreaInfo[] from matchDetails + optional pose coordinates.
8
+ * This is what gets sent to the backend so Gemini knows how to render each body region.
9
+ */
10
+ export declare function buildFitInfo(matchDetails: Array<{
11
+ measurement: string;
12
+ userValue: string;
13
+ chartRange: string;
14
+ fit: string;
15
+ }>, poseLines?: MeasurementLines | null): FitAreaInfo[];
@@ -1,35 +1,11 @@
1
- export interface SizeGuideField {
2
- key: string;
3
- label: string;
4
- required: boolean;
5
- unit: "cm" | "size" | string;
6
- placeholder?: string;
7
- category: "body" | "shoe" | "other";
8
- }
9
- export interface NormalizedSection {
10
- headers: string[];
11
- rows: string[][];
12
- requiredFields: SizeGuideField[];
13
- }
14
- export interface NormalizedSizeGuide {
15
- found: true;
16
- title?: string;
17
- headers: string[];
18
- rows: string[][];
19
- requiredFields: SizeGuideField[];
20
- sections?: Record<string, NormalizedSection>;
21
- }
22
- export type NormalizerResult = {
23
- success: true;
24
- data: NormalizedSizeGuide;
25
- } | {
26
- success: false;
27
- reason: string;
28
- };
29
- export declare function deriveRequiredFields(headers: string[]): SizeGuideField[];
30
1
  /**
31
- * Attempts to normalise `sizeGuideData` (any format) into a structured
32
- * `NormalizedSizeGuide`. Returns `{ success: false }` for unrecognised
33
- * formats (HTML, images, free-form text) so the caller can fall back to AI.
2
+ * Size-guide normalizer accepts many input formats and returns a unified
3
+ * { headers, rows, requiredFields } structure for deterministic sizing.
34
4
  */
35
- export declare function normalizeSizeGuide(input: unknown): NormalizerResult;
5
+ import type { NormalizedSizeGuide } from "../types";
6
+ export interface NormalizeSizeGuideResult {
7
+ success: boolean;
8
+ data?: NormalizedSizeGuide;
9
+ reason?: string;
10
+ }
11
+ export declare function normalizeSizeGuide(input: unknown): NormalizeSizeGuideResult;
package/dist/types.d.ts CHANGED
@@ -52,6 +52,28 @@ export interface ModalStyles {
52
52
  primaryButtonBorderRadius?: string;
53
53
  loaderColor?: string;
54
54
  resultBorderRadius?: string;
55
+ /** Accent color used throughout the SDK (default: #bb945c) */
56
+ accentColor?: string;
57
+ /** Accent hover color (default: #a07d4e) */
58
+ accentHoverColor?: string;
59
+ /** Accent light color for gradients (default: #d6ba7d) */
60
+ accentLightColor?: string;
61
+ /** Primary text color (default: #fff) */
62
+ textPrimaryColor?: string;
63
+ /** Secondary text color (default: #999) */
64
+ textSecondaryColor?: string;
65
+ /** Muted text color (default: #666) */
66
+ textMutedColor?: string;
67
+ /** Border color (default: #333) */
68
+ borderColor?: string;
69
+ /** Secondary background (default: #1a1b1a) */
70
+ secondaryBackgroundColor?: string;
71
+ /** Error color (default: #ef4444) */
72
+ errorColor?: string;
73
+ /** Success color (default: #4ade80) */
74
+ successColor?: string;
75
+ /** Logo height (default: 2.8vw) */
76
+ logoHeight?: string;
55
77
  }
56
78
  /** Try-on job submission response */
57
79
  export interface TryOnResponse {
@@ -176,6 +198,8 @@ export interface SectionRecommendation {
176
198
  /** Full sizing recommendation result */
177
199
  export interface SizingResult {
178
200
  recommendedSize: string;
201
+ tightSize?: string | null;
202
+ looseSize?: string | null;
179
203
  recommendedLength?: string | null;
180
204
  confidence: "high" | "medium" | "low" | string;
181
205
  reasoning: string;
@@ -184,6 +208,23 @@ export interface SizingResult {
184
208
  method?: "deterministic" | "ai";
185
209
  sections?: Record<string, SectionRecommendation>;
186
210
  }
211
+ /** Fit info for a body area — tells Gemini how the garment should render at this region */
212
+ export interface FitAreaInfo {
213
+ /** Body area name (e.g. "Chest", "Waist", "Hips") */
214
+ area: string;
215
+ /** Fit classification */
216
+ fit: "good" | "tight" | "loose" | "a-bit-tight" | "a-bit-loose" | "too-tight" | "too-loose";
217
+ /** User's measurement value in cm */
218
+ userValue?: number;
219
+ /** Garment's size chart range for this area (e.g. "96-100") */
220
+ garmentRange?: string;
221
+ /** Normalised body coordinate — vertical position (0 = top, 1 = bottom) */
222
+ y?: number;
223
+ /** Normalised body coordinate — left edge of this region */
224
+ x1?: number;
225
+ /** Normalised body coordinate — right edge of this region */
226
+ x2?: number;
227
+ }
187
228
  /** Custom events emitted by the component */
188
229
  export interface PrimeStyleEvents {
189
230
  "ps:open": CustomEvent<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primestyleai/tryon",
3
- "version": "4.3.2",
3
+ "version": "4.6.0",
4
4
  "description": "PrimeStyle Virtual Try-On SDK — React component & Web Component",
5
5
  "type": "module",
6
6
  "main": "dist/primestyle-tryon.js",
@@ -14,7 +14,8 @@
14
14
  "./react": {
15
15
  "import": "./dist/react/index.js",
16
16
  "types": "./dist/react/index.d.ts"
17
- }
17
+ },
18
+ "./style.css": "./dist/primestyle-tryon.css"
18
19
  },
19
20
  "files": [
20
21
  "dist",
@@ -23,7 +24,7 @@
23
24
  ],
24
25
  "scripts": {
25
26
  "dev": "vite build --watch",
26
- "build": "vite build && tsc --emitDeclarationOnly",
27
+ "build": "vite build && tsc --emitDeclarationOnly && node scripts/extract-css.mjs",
27
28
  "prepublishOnly": "npm run build"
28
29
  },
29
30
  "keywords": [
@@ -53,5 +54,8 @@
53
54
  "terser": "^5.31.0",
54
55
  "typescript": "^5.5.0",
55
56
  "vite": "^5.4.0"
57
+ },
58
+ "dependencies": {
59
+ "@primestyleai/tryon": "^4.3.2"
56
60
  }
57
61
  }