SDK Feedback
Le SDK Checkflow (@checkflow/sdk) est un outil léger à intégrer dans votre application pour collecter les retours utilisateurs : bug reports, suggestions, captures d’écran et annotations visuelles.
Fonctionnalités
| Fonctionnalité | Description |
|---|---|
| Widget flottant | Bouton de feedback personnalisable avec formulaire intégré |
| Capture d’écran | Screenshot automatique de la page via html2canvas |
| Annotations visuelles | Cliquez pour surligner des éléments de la page |
| Contexte automatique | URL, viewport, navigateur, OS, locale, timezone |
| Console & erreurs | Intercepte console.log/warn/error + erreurs JS |
| Métriques de performance | FCP, DOM load, page load times |
| Interception réseau | Capture les requêtes HTTP échouées |
| Multi-framework | React/Next.js, Vue/Nuxt, Vanilla JS |
Installation
npm install @checkflow/sdkIntégration Vanilla JS
import { init } from '@checkflow/sdk';
init({
apiKey: 'ck_live_...',
widget: {
position: 'bottom-right',
color: '#6366f1',
text: 'Report Bug',
showOnInit: true,
},
});🎬 Vidéo / GIF — Widget de feedback en action dans une app
Intégration React / Next.js
Initialisation (layout ou _app)
import { useCheckflowInit } from '@checkflow/sdk/react';
export default function Layout({ children }) {
useCheckflowInit({ apiKey: 'ck_live_...' });
return <>{children}</>;
}Utilisation dans un composant
import { useCheckflowFeedback } from '@checkflow/sdk/react';
function MyComponent() {
const { send, screenshot, highlight } = useCheckflowFeedback();
const reportBug = async () => {
const img = await screenshot();
const annotations = await highlight();
await send({ title: 'Bug report', type: 'BUG' });
};
return <button onClick={reportBug}>Signaler un bug</button>;
}📸 Capture d’écran — Intégration React avec le hook useCheckflowFeedback
Intégration Vue / Nuxt
Plugin (main.ts)
import { createCheckflowPlugin } from '@checkflow/sdk/vue';
app.use(createCheckflowPlugin({ apiKey: 'ck_live_...' }));Composable
<script setup>
import { useCheckflow } from '@checkflow/sdk/vue';
const { send, screenshot, highlight } = useCheckflow();
</script>API Programmatique
Pour un contrôle total, utilisez l’API directement :
import {
sendFeedback,
captureScreenshot,
startHighlighting,
showWidget,
hideWidget,
destroy,
} from '@checkflow/sdk';
// Envoyer un feedback
await sendFeedback({ title: 'Bug', type: 'BUG', priority: 'HIGH' });
// Capturer un screenshot
const dataUrl = await captureScreenshot();
// Démarrer le mode annotation
const annotations = await startHighlighting();
// Contrôle du widget
showWidget();
hideWidget();
destroy();Configuration Complète
| Option | Type | Défaut | Description |
|---|---|---|---|
apiKey | string | requis | Clé API du projet (format ck_live_...) |
endpoint | string | https://api.checkflow.space/api/v1 | URL de l’API backend |
environment | string | production | Nom de l’environnement |
enabled | boolean | true | Activer/désactiver le SDK |
widget.position | string | bottom-right | Position du widget (bottom-right, bottom-left, top-right, top-left) |
widget.color | string | #1e3a5f | Couleur d’accent du widget |
widget.text | string | Report Bug | Texte du bouton |
widget.showOnInit | boolean | true | Afficher le widget au chargement |
Obtenir une Clé API
- Allez dans votre projet Checkflow
- Page Feedback > Section Clés API
- Cliquez sur “Créer une clé”
- Copiez la clé
ck_live_...
📸 Capture d’écran — Création d’une clé API dans le dashboard
Données Collectées Automatiquement
Quand un feedback est envoyé via le SDK, les données suivantes sont collectées automatiquement :
| Donnée | Exemple |
|---|---|
| URL de la page | https://monapp.com/dashboard |
| Viewport | 1920x1080 |
| Navigateur | Chrome 120 |
| OS | macOS 14.2 |
| Locale | fr-FR |
| Timezone | Europe/Paris |
| Console logs | Derniers logs/warnings/errors |
| Erreurs JS | Stack traces des erreurs |
| Performance | FCP: 1.2s, DOM Load: 0.8s |
| Screenshot | Image base64 de la page |
| Annotations | Éléments surlignés par l’utilisateur |
📸 Capture d’écran — Détail d’un feedback reçu via SDK avec toutes les métadonnées
Architecture du SDK
Le SDK est composé de plusieurs modules internes :
| Module | Rôle |
|---|---|
collector.ts | Collecte le contexte navigateur (URL, viewport, OS…) |
screenshot.ts | Capture d’écran via html2canvas |
highlighter.ts | Mode clic-pour-surligner des éléments |
annotation/ | Éditeur d’annotations visuelles avec toolbar |
console-interceptor.ts | Intercepte les logs console |
network-interceptor.ts | Intercepte les requêtes réseau échouées |
widget.ts | Widget flottant avec formulaire |
react.ts | Hooks React (useCheckflowInit, useCheckflowFeedback) |
vue.ts | Plugin et composable Vue (createCheckflowPlugin, useCheckflow) |
Last updated on