@primestyleai/tryon 5.5.26 → 5.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.
- package/dist/react/PrimeStyleTryonInner.d.ts +1 -1
- package/dist/react/index.d.ts +6 -1
- package/dist/react/index.js +837 -23
- package/dist/react/recommendForProduct.d.ts +61 -0
- package/dist/react/styles.d.ts +1 -1
- package/dist/react/types.d.ts +42 -1
- package/dist/react/usePrimeStyleSize.d.ts +21 -0
- package/dist/react/utils/storage.d.ts +15 -0
- package/dist/react/views/MySizingProfilesView.d.ts +23 -0
- package/dist/react/views/SizeResultView.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Profile, SizingResult, ProfileMeasurements } from "./types";
|
|
2
|
+
export interface RecommendForProductInput {
|
|
3
|
+
productId: string;
|
|
4
|
+
productTitle: string;
|
|
5
|
+
productImage?: string;
|
|
6
|
+
/** Raw size guide data — pass the same value you'd pass to <PrimeStyleTryon sizeGuideData={...}/> */
|
|
7
|
+
sizeGuideData?: unknown;
|
|
8
|
+
/** Optional explicit profile (otherwise uses the active profile from localStorage) */
|
|
9
|
+
profile?: Profile | null;
|
|
10
|
+
/** Optional API URL override (otherwise reads NEXT_PUBLIC_PRIMESTYLE_API_URL) */
|
|
11
|
+
apiUrl?: string;
|
|
12
|
+
/** Optional API key override (otherwise reads NEXT_PUBLIC_PRIMESTYLE_API_KEY) */
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
/** Skip the localStorage cache (forces a fresh /sizing/recommend call) */
|
|
15
|
+
skipCache?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface RecommendForProductResult {
|
|
18
|
+
/** The recommended size (e.g. "M", "42") */
|
|
19
|
+
recommendedSize: string;
|
|
20
|
+
/** "high" | "medium" | "low" */
|
|
21
|
+
confidence?: string;
|
|
22
|
+
/** For multi-section products: section name → recommended size */
|
|
23
|
+
sections?: Record<string, string>;
|
|
24
|
+
/** The profile this recommendation was computed against */
|
|
25
|
+
profileId: string;
|
|
26
|
+
/** Whether this came from the in-memory cache (no network call) */
|
|
27
|
+
fromCache: boolean;
|
|
28
|
+
/** Full sizing result for downstream use */
|
|
29
|
+
raw?: SizingResult;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Headless auto-sizing — given a product and an active profile, returns the
|
|
33
|
+
* recommended size WITHOUT opening the SDK modal. Caches results per
|
|
34
|
+
* (profile, product) so repeat visits are instant.
|
|
35
|
+
*
|
|
36
|
+
* Returns null if there is no active profile yet — the host page should
|
|
37
|
+
* fall back to its existing "Find Your Size" CTA which opens the modal.
|
|
38
|
+
*/
|
|
39
|
+
export declare function recommendForProduct(input: RecommendForProductInput): Promise<RecommendForProductResult | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Convenience: estimate full body measurements via /sizing/estimate so they
|
|
42
|
+
* can be persisted to a profile. Used internally when the user finishes the
|
|
43
|
+
* body profile flow — gives us measurements for ANY future product.
|
|
44
|
+
*/
|
|
45
|
+
export declare function estimateFullMeasurements(args: {
|
|
46
|
+
apiUrl?: string;
|
|
47
|
+
apiKey?: string;
|
|
48
|
+
height: number;
|
|
49
|
+
weight: number;
|
|
50
|
+
heightUnit: "cm" | "in" | "ft";
|
|
51
|
+
weightUnit: "kg" | "lbs";
|
|
52
|
+
gender: "male" | "female";
|
|
53
|
+
age?: number;
|
|
54
|
+
chestProfile?: string;
|
|
55
|
+
midsectionProfile?: string;
|
|
56
|
+
hipProfile?: string;
|
|
57
|
+
bodyImage?: string;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
estimates: ProfileMeasurements;
|
|
60
|
+
unit: "cm" | "in";
|
|
61
|
+
} | null>;
|