lf-pagebuilder-vue 0.0.16 → 0.0.17

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 CHANGED
@@ -99,6 +99,7 @@ import { Pagebuilder } from 'lf-pagebuilder-vue';
99
99
 
100
100
  | Prop | Tipo | Default | Descripción |
101
101
  |------|------|---------|-------------|
102
+ | `limboToken` | `string` | - | Token JWT de Limbo, obtenido server-side con `fetchLimboToken()` |
102
103
  | `isProduction` | `boolean` | `false` | `true` = API producción, `false` = API desarrollo |
103
104
  | `debugMode` | `boolean` | `false` | Activa el modo debug |
104
105
  | `submitForm` | `boolean` | `false` | Envía el formulario automáticamente |
@@ -177,29 +178,36 @@ PUBLIC_LIMBO_PUBLIC_KEY=pk_tu_public_key
177
178
  IS_PROD=FALSE
178
179
  ```
179
180
 
180
- **2. Crear endpoint proxy** (`src/pages/api/limbo-token.ts`):
181
-
182
- ```ts
183
- import { createLimboTokenHandler } from 'lf-pagebuilder-vue/limbo';
184
-
185
- export const POST = createLimboTokenHandler({
186
- publicKey: import.meta.env.PUBLIC_LIMBO_PUBLIC_KEY,
187
- isProduction: import.meta.env.IS_PROD === 'TRUE'
188
- });
189
- ```
190
-
191
- **3. Pasar las props al Pagebuilder:**
181
+ **2. Obtener token server-side y pasarlo al componente:**
192
182
 
193
183
  ```astro
184
+ ---
185
+ import { Pagebuilder } from 'lf-pagebuilder-vue';
186
+ import { fetchLimboToken } from 'lf-pagebuilder-vue/limbo';
187
+
188
+ let limboToken = '';
189
+ try {
190
+ const result = await fetchLimboToken({
191
+ publicKey: import.meta.env.PUBLIC_LIMBO_PUBLIC_KEY || '',
192
+ isProduction: import.meta.env.IS_PROD === 'TRUE'
193
+ });
194
+ limboToken = result.token;
195
+ } catch (e) {
196
+ console.error('[Pagebuilder] Error obteniendo token de Limbo:', e);
197
+ }
198
+ ---
199
+
194
200
  <Pagebuilder
195
- limboPublicKey={import.meta.env.PUBLIC_LIMBO_PUBLIC_KEY}
201
+ limboToken={limboToken}
196
202
  isProduction={import.meta.env.IS_PROD === 'TRUE'}
197
203
  inputId="mi-input"
198
204
  client:only="vue"
199
205
  />
200
206
  ```
201
207
 
202
- La URL de la API de Limbo se determina automáticamente según `isProduction`.
208
+ El token se obtiene en el frontmatter (server-side), evitando exponer la Public Key al cliente. La URL de la API de Limbo se determina automáticamente según `isProduction`. Los assets de `limbo-component` se cargan internamente desde el paquete npm (no se usa CDN externo).
209
+
210
+ Para más detalles, consulta [README_LIMBO.md](README_LIMBO.md).
203
211
 
204
212
  ---
205
213
 
@@ -4,20 +4,16 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
4
4
  submitForm?: boolean;
5
5
  inputId?: string | null;
6
6
  excludeComponentTypes?: string[];
7
- /** Public Key de Limbo (pk_xxx) - Si se proporciona, se inicializa Limbo automáticamente */
8
- limboPublicKey?: string;
9
- /** URL del endpoint proxy para obtener tokens (default: '/api/limbo-token') */
10
- limboTokenEndpoint?: string;
7
+ /** Token JWT de Limbo - obtenido server-side con fetchLimboToken() */
8
+ limboToken?: string;
11
9
  }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
12
10
  isProduction?: boolean;
13
11
  debugMode?: boolean;
14
12
  submitForm?: boolean;
15
13
  inputId?: string | null;
16
14
  excludeComponentTypes?: string[];
17
- /** Public Key de Limbo (pk_xxx) - Si se proporciona, se inicializa Limbo automáticamente */
18
- limboPublicKey?: string;
19
- /** URL del endpoint proxy para obtener tokens (default: '/api/limbo-token') */
20
- limboTokenEndpoint?: string;
15
+ /** Token JWT de Limbo - obtenido server-side con fetchLimboToken() */
16
+ limboToken?: string;
21
17
  }>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
22
18
  export default _default;
23
19
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;