@bitux/review-layer-react 0.1.0 → 0.1.1
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/README.md +15 -5
- package/dist/ReviewProvider.d.ts +5 -2
- package/dist/index.d.ts +1 -1
- package/dist/review-layer-react.js +567 -565
- package/dist/review-layer-react.js.map +1 -1
- package/dist/review-layer-react.umd.cjs +10 -10
- package/dist/review-layer-react.umd.cjs.map +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ import { ReviewProvider } from "@bitux/review-layer-react";
|
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
- **enabled**: activa o desactiva el SDK (p. ej. `import.meta.env.DEV` o `import.meta.env.VITE_REVIEW_ENABLED`).
|
|
30
|
-
- **apiUrl**: base URL de la API (
|
|
30
|
+
- **apiUrl**: base URL de la API (opcional). Si no la pasas, en producción se usa la API en Render (`https://review-layer-api.onrender.com/api`). En desarrollo local puedes pasar `http://localhost:8000/api`.
|
|
31
31
|
- **apiKey**: API key del proyecto (generado en el backend por equipo/proyecto).
|
|
32
32
|
|
|
33
33
|
## Atajos
|
|
@@ -43,7 +43,7 @@ En modo revisión:
|
|
|
43
43
|
|
|
44
44
|
## Variables de entorno (ejemplo)
|
|
45
45
|
|
|
46
|
-
En
|
|
46
|
+
En desarrollo local puedes apuntar a tu API:
|
|
47
47
|
|
|
48
48
|
```env
|
|
49
49
|
VITE_REVIEW_API_URL=http://localhost:8000/api
|
|
@@ -52,14 +52,16 @@ VITE_REVIEW_API_KEY=rl_xxx
|
|
|
52
52
|
|
|
53
53
|
```tsx
|
|
54
54
|
<ReviewProvider
|
|
55
|
-
enabled={
|
|
56
|
-
apiUrl={import.meta.env.VITE_REVIEW_API_URL
|
|
55
|
+
enabled={true}
|
|
56
|
+
apiUrl={import.meta.env.VITE_REVIEW_API_URL}
|
|
57
57
|
apiKey={import.meta.env.VITE_REVIEW_API_KEY ?? ""}
|
|
58
58
|
>
|
|
59
59
|
<App />
|
|
60
60
|
</ReviewProvider>
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
+
Si no pasas `apiUrl` (o la dejas `undefined`), el SDK usa por defecto la API en Render (`https://review-layer-api.onrender.com/api`), así que en producción no hace falta configurar nada más.
|
|
64
|
+
|
|
63
65
|
## Navegación SPA (React Router, etc.)
|
|
64
66
|
|
|
65
67
|
Si usas rutas del lado cliente, al cambiar de ruta conviene volver a cargar los comentarios de la página actual. Usa el hook `useReview` y llama a `loadComments()` cuando cambie la ruta:
|
|
@@ -127,4 +129,12 @@ npm login
|
|
|
127
129
|
npm publish
|
|
128
130
|
```
|
|
129
131
|
|
|
130
|
-
|
|
132
|
+
**Publicar una nueva versión (sube patch, minor o major y publica):**
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
npm run release:patch # 0.1.0 → 0.1.1 (cambios pequeños, fixes)
|
|
136
|
+
npm run release:minor # 0.1.0 → 0.2.0 (nuevas funciones, compatible)
|
|
137
|
+
npm run release:major # 0.1.0 → 1.0.0 (cambios que rompen compatibilidad)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Cada script actualiza la versión en `package.json`, hace `build` y `npm publish`. Luego haz commit y tag en git si quieres (ej. `git add package.json package-lock.json && git commit -m "v0.1.1" && git tag v0.1.1`).
|
package/dist/ReviewProvider.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Reviewer, Comment } from './utils/api';
|
|
2
2
|
|
|
3
|
+
/** URL por defecto de la API en producción (Render). Si no pasas apiUrl, se usa esta. */
|
|
4
|
+
export declare const DEFAULT_API_URL = "https://review-layer-api.onrender.com/api";
|
|
3
5
|
interface ReviewContextValue {
|
|
4
6
|
apiUrl: string;
|
|
5
7
|
apiKey: string;
|
|
@@ -15,8 +17,9 @@ export declare function useReview(): ReviewContextValue;
|
|
|
15
17
|
export interface ReviewProviderProps {
|
|
16
18
|
children: React.ReactNode;
|
|
17
19
|
enabled?: boolean;
|
|
18
|
-
|
|
20
|
+
/** URL base de la API. Si no se pasa, se usa la de producción (Render). */
|
|
21
|
+
apiUrl?: string;
|
|
19
22
|
apiKey: string;
|
|
20
23
|
}
|
|
21
|
-
export declare function ReviewProvider({ children, enabled, apiUrl, apiKey, }: ReviewProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function ReviewProvider({ children, enabled, apiUrl: apiUrlProp, apiKey, }: ReviewProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
22
25
|
export {};
|
package/dist/index.d.ts
CHANGED