veo-sdk 0.1.0 → 0.2.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/dist/index.d.cts CHANGED
@@ -1,3 +1,5 @@
1
+ export { P as PreviewGuideInput, a as PreviewHandle, b as PreviewResult, c as closeGuidePreview, p as previewGuide } from './guide-preview-CO5ShtNf.cjs';
2
+
1
3
  /**
2
4
  * Configuración de la autocaptura de interacciones del DOM.
3
5
  */
@@ -31,8 +33,6 @@ interface VeoAutocaptureConfig {
31
33
  interface VeoConfig {
32
34
  /** API key pública del workspace (formato pk_xxx). */
33
35
  apiKey: string;
34
- /** URL base del backend de Veo. */
35
- apiUrl: string;
36
36
  /** Intervalo en ms para flush automático de la queue. Default: 5000. */
37
37
  flushInterval?: number;
38
38
  /** Tamaño máximo del batch antes de flush. Default: 20. */
@@ -49,6 +49,20 @@ interface VeoConfig {
49
49
  * tooltips. Default: `false`.
50
50
  */
51
51
  guides?: boolean;
52
+ /**
53
+ * URL del bundle del builder (`veo-builder.js`). Solo se carga cuando la
54
+ * página trae `?veoBuilder=<token>` (modo edición desde el dashboard). Si
55
+ * se omite, el SDK la deriva del `<script>` que cargó `veo.js`.
56
+ */
57
+ builderUrl?: string;
58
+ /**
59
+ * URL del bundle de guías (`veo-guides.js`). En el build IIFE (`veo.js`) los
60
+ * renderers de guías se cargan PEREZOSAMENTE desde acá (solo con `guides:true`
61
+ * o al usar `veo.preview()`), para mantener `veo.js` chico. Si se omite, se
62
+ * deriva del `<script>` que cargó `veo.js`. (En ESM/CJS no aplica: el bundler
63
+ * incluye/treeshake las guías estáticamente.)
64
+ */
65
+ guidesUrl?: string;
52
66
  }
53
67
  /**
54
68
  * Información del end user (usuario final).
@@ -118,9 +132,33 @@ interface VeoClient {
118
132
  */
119
133
  getEndUserId(): string | null;
120
134
  /** @internal Consumido por plugins. NO es API estable para usuarios. */
135
+ getAnonymousId(): string;
136
+ /** @internal Consumido por plugins. NO es API estable para usuarios. */
121
137
  getSessionId(): string;
122
138
  }
123
139
 
140
+ interface GuidesPluginConfig {
141
+ apiUrl: string;
142
+ apiKey: string;
143
+ debug?: boolean;
144
+ }
145
+ /**
146
+ * Plugin que renderiza guías in-app (modal/banner/tooltip) consultando
147
+ * `GET /v1/guides/resolve` y registra las interacciones en
148
+ * `POST /v1/guides/:id/interactions` vía queue dedicada con retry y
149
+ * sendBeacon en pagehide.
150
+ *
151
+ * Opt-in: `init({ ..., guides: true })`. El plugin escucha
152
+ * `pageview` e `identify` del client; el payload del evento ya trae
153
+ * `sessionId` y `endUserId` para que no necesitemos consultar al
154
+ * client en cada disparo.
155
+ *
156
+ * Frequency híbrida: el backend filtra autoritariamente; el cache
157
+ * local (`GuideFrequencyCache`) solo previene el flash visual cuando
158
+ * la interaction aún no se persistió.
159
+ */
160
+ declare function guidesPlugin(config: GuidesPluginConfig): VeoPlugin;
161
+
124
162
  /**
125
163
  * Tipos del contrato HTTP entre el SDK y el backend.
126
164
  * Versión 1.
@@ -157,6 +195,7 @@ declare class Client implements VeoClient {
157
195
  flush(): Promise<void>;
158
196
  use(plugin: VeoPlugin): VeoClient;
159
197
  getEndUserId(): string | null;
198
+ getAnonymousId(): string;
160
199
  getSessionId(): string;
161
200
  /**
162
201
  * Suscribe `listener` a `event`. Devuelve una función para desuscribir.
@@ -181,28 +220,6 @@ declare class Client implements VeoClient {
181
220
  */
182
221
  declare function autocapturePlugin(config?: VeoAutocaptureConfig): VeoPlugin;
183
222
 
184
- interface GuidesPluginConfig {
185
- apiUrl: string;
186
- apiKey: string;
187
- debug?: boolean;
188
- }
189
- /**
190
- * Plugin que renderiza guías in-app (modal/banner/tooltip) consultando
191
- * `GET /v1/guides/resolve` y registra las interacciones en
192
- * `POST /v1/guides/:id/interactions` vía queue dedicada con retry y
193
- * sendBeacon en pagehide.
194
- *
195
- * Opt-in: `init({ ..., guides: true })`. El plugin escucha
196
- * `pageview` e `identify` del client; el payload del evento ya trae
197
- * `sessionId` y `endUserId` para que no necesitemos consultar al
198
- * client en cada disparo.
199
- *
200
- * Frequency híbrida: el backend filtra autoritariamente; el cache
201
- * local (`GuideFrequencyCache`) solo previene el flash visual cuando
202
- * la interaction aún no se persistió.
203
- */
204
- declare function guidesPlugin(config: GuidesPluginConfig): VeoPlugin;
205
-
206
223
  /**
207
224
  * Helper de identidad para definir un plugin con inferencia de tipos.
208
225
  * No transforma nada; mejora la ergonomía y deja un punto de extensión futuro.
@@ -224,10 +241,8 @@ declare function spaRouterPlugin(): VeoPlugin;
224
241
  * ```ts
225
242
  * import { init } from '@veo/sdk';
226
243
  *
227
- * const veo = init({
228
- * apiKey: 'pk_xxx',
229
- * apiUrl: 'https://api.veo.io'
230
- * });
244
+ * // apiUrl es opcional: por defecto apunta al backend gestionado de Veo.
245
+ * const veo = init({ apiKey: 'pk_xxx' });
231
246
  *
232
247
  * veo.identify({ visitor: { id: 'user_123' } });
233
248
  * veo.track('button_clicked');
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { P as PreviewGuideInput, a as PreviewHandle, b as PreviewResult, c as closeGuidePreview, p as previewGuide } from './guide-preview-CO5ShtNf.js';
2
+
1
3
  /**
2
4
  * Configuración de la autocaptura de interacciones del DOM.
3
5
  */
@@ -31,8 +33,6 @@ interface VeoAutocaptureConfig {
31
33
  interface VeoConfig {
32
34
  /** API key pública del workspace (formato pk_xxx). */
33
35
  apiKey: string;
34
- /** URL base del backend de Veo. */
35
- apiUrl: string;
36
36
  /** Intervalo en ms para flush automático de la queue. Default: 5000. */
37
37
  flushInterval?: number;
38
38
  /** Tamaño máximo del batch antes de flush. Default: 20. */
@@ -49,6 +49,20 @@ interface VeoConfig {
49
49
  * tooltips. Default: `false`.
50
50
  */
51
51
  guides?: boolean;
52
+ /**
53
+ * URL del bundle del builder (`veo-builder.js`). Solo se carga cuando la
54
+ * página trae `?veoBuilder=<token>` (modo edición desde el dashboard). Si
55
+ * se omite, el SDK la deriva del `<script>` que cargó `veo.js`.
56
+ */
57
+ builderUrl?: string;
58
+ /**
59
+ * URL del bundle de guías (`veo-guides.js`). En el build IIFE (`veo.js`) los
60
+ * renderers de guías se cargan PEREZOSAMENTE desde acá (solo con `guides:true`
61
+ * o al usar `veo.preview()`), para mantener `veo.js` chico. Si se omite, se
62
+ * deriva del `<script>` que cargó `veo.js`. (En ESM/CJS no aplica: el bundler
63
+ * incluye/treeshake las guías estáticamente.)
64
+ */
65
+ guidesUrl?: string;
52
66
  }
53
67
  /**
54
68
  * Información del end user (usuario final).
@@ -118,9 +132,33 @@ interface VeoClient {
118
132
  */
119
133
  getEndUserId(): string | null;
120
134
  /** @internal Consumido por plugins. NO es API estable para usuarios. */
135
+ getAnonymousId(): string;
136
+ /** @internal Consumido por plugins. NO es API estable para usuarios. */
121
137
  getSessionId(): string;
122
138
  }
123
139
 
140
+ interface GuidesPluginConfig {
141
+ apiUrl: string;
142
+ apiKey: string;
143
+ debug?: boolean;
144
+ }
145
+ /**
146
+ * Plugin que renderiza guías in-app (modal/banner/tooltip) consultando
147
+ * `GET /v1/guides/resolve` y registra las interacciones en
148
+ * `POST /v1/guides/:id/interactions` vía queue dedicada con retry y
149
+ * sendBeacon en pagehide.
150
+ *
151
+ * Opt-in: `init({ ..., guides: true })`. El plugin escucha
152
+ * `pageview` e `identify` del client; el payload del evento ya trae
153
+ * `sessionId` y `endUserId` para que no necesitemos consultar al
154
+ * client en cada disparo.
155
+ *
156
+ * Frequency híbrida: el backend filtra autoritariamente; el cache
157
+ * local (`GuideFrequencyCache`) solo previene el flash visual cuando
158
+ * la interaction aún no se persistió.
159
+ */
160
+ declare function guidesPlugin(config: GuidesPluginConfig): VeoPlugin;
161
+
124
162
  /**
125
163
  * Tipos del contrato HTTP entre el SDK y el backend.
126
164
  * Versión 1.
@@ -157,6 +195,7 @@ declare class Client implements VeoClient {
157
195
  flush(): Promise<void>;
158
196
  use(plugin: VeoPlugin): VeoClient;
159
197
  getEndUserId(): string | null;
198
+ getAnonymousId(): string;
160
199
  getSessionId(): string;
161
200
  /**
162
201
  * Suscribe `listener` a `event`. Devuelve una función para desuscribir.
@@ -181,28 +220,6 @@ declare class Client implements VeoClient {
181
220
  */
182
221
  declare function autocapturePlugin(config?: VeoAutocaptureConfig): VeoPlugin;
183
222
 
184
- interface GuidesPluginConfig {
185
- apiUrl: string;
186
- apiKey: string;
187
- debug?: boolean;
188
- }
189
- /**
190
- * Plugin que renderiza guías in-app (modal/banner/tooltip) consultando
191
- * `GET /v1/guides/resolve` y registra las interacciones en
192
- * `POST /v1/guides/:id/interactions` vía queue dedicada con retry y
193
- * sendBeacon en pagehide.
194
- *
195
- * Opt-in: `init({ ..., guides: true })`. El plugin escucha
196
- * `pageview` e `identify` del client; el payload del evento ya trae
197
- * `sessionId` y `endUserId` para que no necesitemos consultar al
198
- * client en cada disparo.
199
- *
200
- * Frequency híbrida: el backend filtra autoritariamente; el cache
201
- * local (`GuideFrequencyCache`) solo previene el flash visual cuando
202
- * la interaction aún no se persistió.
203
- */
204
- declare function guidesPlugin(config: GuidesPluginConfig): VeoPlugin;
205
-
206
223
  /**
207
224
  * Helper de identidad para definir un plugin con inferencia de tipos.
208
225
  * No transforma nada; mejora la ergonomía y deja un punto de extensión futuro.
@@ -224,10 +241,8 @@ declare function spaRouterPlugin(): VeoPlugin;
224
241
  * ```ts
225
242
  * import { init } from '@veo/sdk';
226
243
  *
227
- * const veo = init({
228
- * apiKey: 'pk_xxx',
229
- * apiUrl: 'https://api.veo.io'
230
- * });
244
+ * // apiUrl es opcional: por defecto apunta al backend gestionado de Veo.
245
+ * const veo = init({ apiKey: 'pk_xxx' });
231
246
  *
232
247
  * veo.identify({ visitor: { id: 'user_123' } });
233
248
  * veo.track('button_clicked');