drawer.kleep.ai. The SDK exposes one component + two methods, mirroring the iOS surface.
Installation
Each release is published as an npm tarball on
cdn.kleep.ai. Two URL shapes are available:
Latest stable (auto-updates with every new stable release — pre-releases never move this pointer):
v1.0.0 and 1.0.0 with the desired release tag. The two listed packages are peer dependencies — the SDK requires them but lets you control the version.
The published tarball includes a SHA-256 alongside (<tarball>.sha256 / latest.tgz.sha256) if you want to verify integrity before installing.
Expo
Both peer deps are pre-bundled in Expo Go (SDK 54+). No extra setup needed in dev. For production builds,expo prebuild picks them up automatically.
Bare React Native
Permissions
For the footwear flow (camera scan), add to
ios/<App>/Info.plist:
android/app/src/main/AndroidManifest.xml:
Configure once at app boot
| Field | Required | Description |
|---|---|---|
publicId | yes | UUID identifying your retailer (provided by Kleep) |
language | no | 'fr' | 'en' | 'de' | 'it' | 'es' | 'nl' | 'pt' | 'ja' | 'ko' | 'pl' | 'br' | 'dk' | 'fi' | 'se' | 'gb' |
Usage
Method 1: Kleep.checkProduct
Call this on PDP mount. The result drives the “Find my size” CTA — whether to render it, and what label to show.
| parameter | priority | description |
|---|---|---|
productId | required | Your product ID at the retailer |
recommendable | recommendedSize | What to render |
|---|---|---|
false | — | Hide the CTA (product not eligible for Kleep) |
true | absent | CTA: “Trouver ma taille” |
true | "M" | CTA: “Taille recommandée: M” |
(publicId, productId) for the gate and (publicId, productId, mid) for the recommended size. Re-rendering the PDP or navigating back is free.
Implementation example
Method 2: <KleepFindSizeView>
Mount this component to open the size-finder drawer in a fullscreen Modal+WebView. Controlled-component pattern: you own the visible state, the SDK requests close via onDismiss.
| prop | priority | description |
|---|---|---|
visible | required | Controls Modal visibility |
productId | required | Same as in checkProduct |
onDismiss | required | Fired when the user closes the drawer (X / swipe / back). Host MUST flip visible to false |
variantId | optional | Pre-selects a variant for the recommendation |
customerId | optional | CRM identifier for cross-session linking |
language | optional | Overrides the SDK-level language for this open |
countryCode | optional | e.g. "FR", "US" — drives unit system + bra-size defaults |
stocks | optional | { [variantId]: number | boolean } — drawer renders unavailable / partial-stock UI |
mock | optional | true → drawer skips real recommendation API calls (QA only) |
forceState | optional | 'outOfRange' | 'unavailable' | 'error' | 'qrcode' — QA hatch to render an end-state directly |
warmRestore | optional | { mid, uid } — pre-load an existing measurement (skip intro flow). Same-device restore is already automatic via AsyncStorage |
extraParams | optional | Raw Record<string, string> appended to the drawer URL (escape hatch) |
onAddToCart | optional | (event: { variantId, size? }) => void — user tapped the in-drawer “Add to cart” CTA. Host adds the variant to its cart |
onSelectSize | optional | (event: { size }) => void — user picked a size on the Result screen. Host should sync its PDP size picker |
onMessage | optional | Debug hook — fires for every inbound postMessage parsed from the drawer |
style | optional | StyleProp<ViewStyle> — container style override |
webViewProps | optional | Forwarded to react-native-webview for advanced customisation |
- Bridges the drawer’s iframe-style
window.parent.postMessageto the React Native bridge - Persists
mid/uidto AsyncStorage when the drawer pushes them - Responds to
getMid/getUid/getSizespostMessages from the drawer - Calls
Kleep.checkProducton open to resolve the flow (clothing / lingerie / footwear / children) — uses the same 5-min cache as your CTA call, so it’s free if you’ve already invokedcheckProduct
Method 3: Kleep.track
Fire-and-forget analytics. Never throws.
| parameter | priority | description |
|---|---|---|
eventName | required | Name of the event |
options.customerId | optional | CRM identifier |
options.parameters | optional | Record<string, unknown> — arbitrary event data |
| eventName | Trigger |
|---|---|
product_viewed | Upon PDP viewed |
product_added_to_cart | Upon product added to the cart |
checkout_completed | Upon order confirmation after the payment |
product_viewed example
product_added_to_cart example
checkout_completed example
Cache invalidation
The SDK keeps two in-memory caches (5 min TTL each):
- Product gate —
(publicId, productId) → { recommendable, category, productFound } - Recommended size —
(publicId, productId, mid) → size label
