lf-pagebuilder-vue 0.0.15 → 0.0.16
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 +45 -22
- package/dist/components/BodySection.vue.d.ts +55 -0
- package/dist/components/ColConfig.vue.d.ts +55 -0
- package/dist/components/ComponentsBox.vue.d.ts +36 -0
- package/dist/components/FeedComponent.vue.d.ts +72 -0
- package/dist/components/FieldsForm.vue.d.ts +55 -0
- package/dist/components/GlobalConfig.vue.d.ts +81 -0
- package/dist/components/InitialComponent.vue.d.ts +93 -0
- package/dist/components/Pagebuilder.vue.d.ts +31 -0
- package/dist/components/RowConfig.vue.d.ts +38 -0
- package/dist/components/SourceFilter.vue.d.ts +36 -0
- package/dist/index.d.ts +95 -663
- package/dist/limbo/index.d.ts +10 -0
- package/dist/limbo/tokenHandler.d.ts +81 -0
- package/dist/limbo.cjs +1 -0
- package/dist/limbo.d.ts +3 -0
- package/dist/limbo.js +90 -0
- package/dist/mocks/libreria-astro-lefebvre.d.ts +77 -0
- package/dist/symfony-entry.d.ts +29 -0
- package/package.json +10 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Limbo Integration Module
|
|
3
|
+
*
|
|
4
|
+
* Re-exporta las utilidades de Limbo desde lf-pagebuilder-vue.
|
|
5
|
+
* El portal consumidor importa desde aquí:
|
|
6
|
+
*
|
|
7
|
+
* import { createLimboTokenHandler } from 'lf-pagebuilder-vue/limbo';
|
|
8
|
+
*/
|
|
9
|
+
export { createLimboTokenHandler, LIMBO_API_URLS, LIMBO_ENV_VARS, type LimboTokenConfig, type LimboTokenResponse, } from './tokenHandler';
|
|
10
|
+
export { default } from './tokenHandler';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Limbo Token Handler
|
|
3
|
+
*
|
|
4
|
+
* Handler genérico para obtener tokens JWT de Limbo.
|
|
5
|
+
* Framework-agnostic: funciona en Astro, Next.js, Express, etc.
|
|
6
|
+
*
|
|
7
|
+
* La URL de la API de Limbo se determina automáticamente según `isProduction`:
|
|
8
|
+
* - Producción: https://limbo.lefebvre.es
|
|
9
|
+
* - Desarrollo: https://led-dev-limbo-dev.eu.els.local
|
|
10
|
+
*
|
|
11
|
+
* @example Astro
|
|
12
|
+
* ```ts
|
|
13
|
+
* // src/pages/api/limbo-token.ts
|
|
14
|
+
* import { createLimboTokenHandler } from 'lf-pagebuilder-vue/limbo';
|
|
15
|
+
*
|
|
16
|
+
* export const POST = createLimboTokenHandler({
|
|
17
|
+
* publicKey: import.meta.env.PUBLIC_LIMBO_PUBLIC_KEY,
|
|
18
|
+
* isProduction: import.meta.env.IS_PROD === 'TRUE'
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example Next.js App Router
|
|
23
|
+
* ```ts
|
|
24
|
+
* // app/api/limbo-token/route.ts
|
|
25
|
+
* import { createLimboTokenHandler } from 'lf-pagebuilder-vue/limbo';
|
|
26
|
+
*
|
|
27
|
+
* export const POST = createLimboTokenHandler({
|
|
28
|
+
* publicKey: process.env.PUBLIC_LIMBO_PUBLIC_KEY!,
|
|
29
|
+
* isProduction: process.env.NODE_ENV === 'production'
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
/** URLs por defecto de la API de Limbo */
|
|
34
|
+
declare const LIMBO_API_URLS: {
|
|
35
|
+
readonly production: "https://limbo.lefebvre.es";
|
|
36
|
+
readonly development: "https://led-dev-limbo-dev.eu.els.local";
|
|
37
|
+
};
|
|
38
|
+
export interface LimboTokenConfig {
|
|
39
|
+
/** Public Key del portal de Limbo (pk_xxx) */
|
|
40
|
+
publicKey: string;
|
|
41
|
+
/** ¿Usar API de producción? (default: false = desarrollo) */
|
|
42
|
+
isProduction?: boolean;
|
|
43
|
+
/** URL base de la API de Limbo (opcional, se determina por isProduction si no se especifica) */
|
|
44
|
+
limboApiUrl?: string;
|
|
45
|
+
/** Permitir override de publicKey desde el body de la request (default: true) */
|
|
46
|
+
allowPublicKeyOverride?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface LimboTokenResponse {
|
|
49
|
+
success: boolean;
|
|
50
|
+
token?: string;
|
|
51
|
+
expires_in?: number;
|
|
52
|
+
error?: string;
|
|
53
|
+
details?: string;
|
|
54
|
+
hint?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Crea un handler para obtener tokens JWT de Limbo.
|
|
58
|
+
*
|
|
59
|
+
* Este handler actúa como proxy para evitar problemas de CORS,
|
|
60
|
+
* haciendo la petición a Limbo desde el servidor.
|
|
61
|
+
*
|
|
62
|
+
* @param config - Configuración con publicKey e isProduction
|
|
63
|
+
* @returns Handler compatible con Astro, Next.js, y otros frameworks
|
|
64
|
+
*/
|
|
65
|
+
export declare function createLimboTokenHandler(config: LimboTokenConfig): ({ request }: {
|
|
66
|
+
request: Request;
|
|
67
|
+
}) => Promise<Response>;
|
|
68
|
+
/**
|
|
69
|
+
* URLs por defecto de la API de Limbo (exportadas para referencia).
|
|
70
|
+
*/
|
|
71
|
+
export { LIMBO_API_URLS };
|
|
72
|
+
/**
|
|
73
|
+
* Variables de entorno necesarias.
|
|
74
|
+
*/
|
|
75
|
+
export declare const LIMBO_ENV_VARS: {
|
|
76
|
+
/** Variable de entorno para la Public Key (con prefijo PUBLIC_ para cliente) */
|
|
77
|
+
readonly PUBLIC_KEY: "PUBLIC_LIMBO_PUBLIC_KEY";
|
|
78
|
+
/** Variable de entorno para indicar si es producción */
|
|
79
|
+
readonly IS_PROD: "IS_PROD";
|
|
80
|
+
};
|
|
81
|
+
export default createLimboTokenHandler;
|
package/dist/limbo.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={production:"https://limbo.lefebvre.es",development:"https://led-dev-limbo-dev.eu.els.local"};function l(c){const{publicKey:n,isProduction:i=!1,limboApiUrl:u,allowPublicKeyOverride:p=!0}=c,a=u||(i?t.production:t.development);return n||console.error("[Limbo Token Handler] PUBLIC_LIMBO_PUBLIC_KEY no está configurada"),console.log(`[Limbo Token Handler] Configurado para ${i?"PRODUCCIÓN":"DESARROLLO"}: ${a}`),async function({request:d}){try{let e=n;if(p)try{const r=await d.json();r.public_key&&(e=r.public_key)}catch{}if(!e)return new Response(JSON.stringify({success:!1,error:"PUBLIC_LIMBO_PUBLIC_KEY no configurada"}),{status:400,headers:{"Content-Type":"application/json"}});const o=`${a}/auth/token`;console.log("[Limbo Proxy] Requesting token from:",o),console.log("[Limbo Proxy] Using public_key:",e.substring(0,10)+"...");const s=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({public_key:e})});if(!s.ok){const r=await s.text();return console.error("[Limbo Proxy] Error response:",s.status,r),new Response(JSON.stringify({success:!1,error:`API error: ${s.status}`,details:r}),{status:s.status,headers:{"Content-Type":"application/json"}})}const f=await s.json();return console.log("[Limbo Proxy] Token obtained successfully"),new Response(JSON.stringify(f),{status:200,headers:{"Content-Type":"application/json"}})}catch(e){console.error("[Limbo Proxy] Error completo:",e);let o="Unknown error";return e instanceof Error&&(o=e.message,"cause"in e&&e.cause&&(o+=` (cause: ${JSON.stringify(e.cause)})`)),new Response(JSON.stringify({success:!1,error:o,hint:"Verifica que la API de Limbo sea accesible desde el servidor"}),{status:500,headers:{"Content-Type":"application/json"}})}}}const y={PUBLIC_KEY:"PUBLIC_LIMBO_PUBLIC_KEY",IS_PROD:"IS_PROD"};exports.LIMBO_API_URLS=t;exports.LIMBO_ENV_VARS=y;exports.createLimboTokenHandler=l;exports.default=l;
|
package/dist/limbo.d.ts
ADDED
package/dist/limbo.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const a = {
|
|
2
|
+
production: "https://limbo.lefebvre.es",
|
|
3
|
+
development: "https://led-dev-limbo-dev.eu.els.local"
|
|
4
|
+
};
|
|
5
|
+
function y(c) {
|
|
6
|
+
const {
|
|
7
|
+
publicKey: n,
|
|
8
|
+
isProduction: t = !1,
|
|
9
|
+
limboApiUrl: l,
|
|
10
|
+
allowPublicKeyOverride: u = !0
|
|
11
|
+
} = c, i = l || (t ? a.production : a.development);
|
|
12
|
+
return n || console.error("[Limbo Token Handler] PUBLIC_LIMBO_PUBLIC_KEY no está configurada"), console.log(`[Limbo Token Handler] Configurado para ${t ? "PRODUCCIÓN" : "DESARROLLO"}: ${i}`), async function({ request: p }) {
|
|
13
|
+
try {
|
|
14
|
+
let e = n;
|
|
15
|
+
if (u)
|
|
16
|
+
try {
|
|
17
|
+
const r = await p.json();
|
|
18
|
+
r.public_key && (e = r.public_key);
|
|
19
|
+
} catch {
|
|
20
|
+
}
|
|
21
|
+
if (!e)
|
|
22
|
+
return new Response(
|
|
23
|
+
JSON.stringify({
|
|
24
|
+
success: !1,
|
|
25
|
+
error: "PUBLIC_LIMBO_PUBLIC_KEY no configurada"
|
|
26
|
+
}),
|
|
27
|
+
{
|
|
28
|
+
status: 400,
|
|
29
|
+
headers: { "Content-Type": "application/json" }
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
const o = `${i}/auth/token`;
|
|
33
|
+
console.log("[Limbo Proxy] Requesting token from:", o), console.log("[Limbo Proxy] Using public_key:", e.substring(0, 10) + "...");
|
|
34
|
+
const s = await fetch(o, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
headers: {
|
|
37
|
+
"Content-Type": "application/json"
|
|
38
|
+
},
|
|
39
|
+
body: JSON.stringify({
|
|
40
|
+
public_key: e
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
if (!s.ok) {
|
|
44
|
+
const r = await s.text();
|
|
45
|
+
return console.error("[Limbo Proxy] Error response:", s.status, r), new Response(
|
|
46
|
+
JSON.stringify({
|
|
47
|
+
success: !1,
|
|
48
|
+
error: `API error: ${s.status}`,
|
|
49
|
+
details: r
|
|
50
|
+
}),
|
|
51
|
+
{
|
|
52
|
+
status: s.status,
|
|
53
|
+
headers: { "Content-Type": "application/json" }
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
const d = await s.json();
|
|
58
|
+
return console.log("[Limbo Proxy] Token obtained successfully"), new Response(JSON.stringify(d), {
|
|
59
|
+
status: 200,
|
|
60
|
+
headers: { "Content-Type": "application/json" }
|
|
61
|
+
});
|
|
62
|
+
} catch (e) {
|
|
63
|
+
console.error("[Limbo Proxy] Error completo:", e);
|
|
64
|
+
let o = "Unknown error";
|
|
65
|
+
return e instanceof Error && (o = e.message, "cause" in e && e.cause && (o += ` (cause: ${JSON.stringify(e.cause)})`)), new Response(
|
|
66
|
+
JSON.stringify({
|
|
67
|
+
success: !1,
|
|
68
|
+
error: o,
|
|
69
|
+
hint: "Verifica que la API de Limbo sea accesible desde el servidor"
|
|
70
|
+
}),
|
|
71
|
+
{
|
|
72
|
+
status: 500,
|
|
73
|
+
headers: { "Content-Type": "application/json" }
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const b = {
|
|
80
|
+
/** Variable de entorno para la Public Key (con prefijo PUBLIC_ para cliente) */
|
|
81
|
+
PUBLIC_KEY: "PUBLIC_LIMBO_PUBLIC_KEY",
|
|
82
|
+
/** Variable de entorno para indicar si es producción */
|
|
83
|
+
IS_PROD: "IS_PROD"
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
86
|
+
a as LIMBO_API_URLS,
|
|
87
|
+
b as LIMBO_ENV_VARS,
|
|
88
|
+
y as createLimboTokenHandler,
|
|
89
|
+
y as default
|
|
90
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock de libreria-astro-lefebvre para el build de Symfony
|
|
3
|
+
*
|
|
4
|
+
* Los componentes se pueden inyectar de dos formas:
|
|
5
|
+
* 1. Definiendo window.LF_PAGEBUILDER_COMPONENTS antes de cargar el script
|
|
6
|
+
* 2. Usando LfPagebuilder.setComponents(componentes) después de cargar
|
|
7
|
+
*
|
|
8
|
+
* Ejemplo de uso en Twig/Symfony:
|
|
9
|
+
* <script>
|
|
10
|
+
* window.LF_PAGEBUILDER_COMPONENTS = {
|
|
11
|
+
* "hero-banner": {
|
|
12
|
+
* name: "Hero Banner",
|
|
13
|
+
* component_name: "HeroBanner",
|
|
14
|
+
* description: "Banner principal",
|
|
15
|
+
* category: "Cabecera",
|
|
16
|
+
* framework: "Astro",
|
|
17
|
+
* tags: ["hero", "banner"],
|
|
18
|
+
* fields: [
|
|
19
|
+
* { name: "title", label: "Título", type: "text", mandatory: true }
|
|
20
|
+
* ]
|
|
21
|
+
* }
|
|
22
|
+
* };
|
|
23
|
+
* </script>
|
|
24
|
+
* <script src="lf-pagebuilder-iife.js"></script>
|
|
25
|
+
*/
|
|
26
|
+
interface ComponentField {
|
|
27
|
+
name: string;
|
|
28
|
+
label: string;
|
|
29
|
+
type: 'text' | 'textArea' | 'image' | 'select' | 'boolean';
|
|
30
|
+
mandatory?: boolean;
|
|
31
|
+
example_value?: string | boolean;
|
|
32
|
+
options?: string[];
|
|
33
|
+
image_cuts?: {
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
label: string;
|
|
37
|
+
required?: boolean;
|
|
38
|
+
}[];
|
|
39
|
+
mappedTo?: string;
|
|
40
|
+
}
|
|
41
|
+
interface PageComponent {
|
|
42
|
+
id?: string;
|
|
43
|
+
name: string;
|
|
44
|
+
component_name: string;
|
|
45
|
+
description: string;
|
|
46
|
+
category: string;
|
|
47
|
+
framework: string;
|
|
48
|
+
tags: string[];
|
|
49
|
+
fields: ComponentField[];
|
|
50
|
+
repeat_data?: any;
|
|
51
|
+
}
|
|
52
|
+
type ComponentsRegistry = Record<string, PageComponent>;
|
|
53
|
+
/**
|
|
54
|
+
* Retorna la lista de componentes disponibles
|
|
55
|
+
* Primero busca en window.LF_PAGEBUILDER_COMPONENTS, si no existe usa los por defecto
|
|
56
|
+
*/
|
|
57
|
+
export declare function listComponents(): ComponentsRegistry;
|
|
58
|
+
/**
|
|
59
|
+
* Permite establecer los componentes dinámicamente
|
|
60
|
+
* Útil para cargarlos vía AJAX después de que la página cargue
|
|
61
|
+
*/
|
|
62
|
+
export declare function setComponents(components: ComponentsRegistry): void;
|
|
63
|
+
/**
|
|
64
|
+
* Añade un componente al registro
|
|
65
|
+
*/
|
|
66
|
+
export declare function addComponent(key: string, component: PageComponent): void;
|
|
67
|
+
/**
|
|
68
|
+
* Obtiene los componentes por defecto
|
|
69
|
+
*/
|
|
70
|
+
export declare function getDefaultComponents(): ComponentsRegistry;
|
|
71
|
+
declare const _default: {
|
|
72
|
+
listComponents: typeof listComponents;
|
|
73
|
+
setComponents: typeof setComponents;
|
|
74
|
+
addComponent: typeof addComponent;
|
|
75
|
+
getDefaultComponents: typeof getDefaultComponents;
|
|
76
|
+
};
|
|
77
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createApp } from 'vue';
|
|
2
|
+
import { setComponents, addComponent, getDefaultComponents, listComponents } from './mocks/libreria-astro-lefebvre';
|
|
3
|
+
|
|
4
|
+
interface PagebuilderInstance {
|
|
5
|
+
app: ReturnType<typeof createApp>;
|
|
6
|
+
container: HTMLElement;
|
|
7
|
+
input: HTMLInputElement;
|
|
8
|
+
unmount: () => void;
|
|
9
|
+
}
|
|
10
|
+
interface LfPagebuilderConfig {
|
|
11
|
+
isProduction?: boolean;
|
|
12
|
+
selector?: string;
|
|
13
|
+
onReady?: (instance: PagebuilderInstance) => void;
|
|
14
|
+
onChange?: (config: any, input: HTMLInputElement) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Inicializa el Pagebuilder en todos los elementos que coincidan con el selector
|
|
18
|
+
*/
|
|
19
|
+
declare function init(config?: LfPagebuilderConfig): PagebuilderInstance[];
|
|
20
|
+
/**
|
|
21
|
+
* Destruye todas las instancias del Pagebuilder
|
|
22
|
+
*/
|
|
23
|
+
declare function destroyAll(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Obtiene todas las instancias activas
|
|
26
|
+
*/
|
|
27
|
+
declare function getInstances(): PagebuilderInstance[];
|
|
28
|
+
export { init, destroyAll, getInstances, setComponents, addComponent, getDefaultComponents, listComponents };
|
|
29
|
+
export type { PagebuilderInstance, LfPagebuilderConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lf-pagebuilder-vue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "Constructor de páginas visual basado en Vue.js que permite crear y diseñar páginas web de forma intuitiva mediante componentes arrastrables y configurables",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
"require": "./dist/index.cjs",
|
|
13
13
|
"types": "./dist/index.d.ts"
|
|
14
14
|
},
|
|
15
|
+
"./limbo": {
|
|
16
|
+
"import": "./dist/limbo.js",
|
|
17
|
+
"require": "./dist/limbo.cjs",
|
|
18
|
+
"types": "./dist/limbo.d.ts"
|
|
19
|
+
},
|
|
15
20
|
"./styles": "./dist/styles.css"
|
|
16
21
|
},
|
|
17
22
|
"files": [
|
|
@@ -26,9 +31,12 @@
|
|
|
26
31
|
"build:symfony": "vite build --config vite.config.symfony.ts",
|
|
27
32
|
"build:all": "npm run build && npm run build:symfony"
|
|
28
33
|
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"libreria-astro-lefebvre": "latest",
|
|
36
|
+
"limbo-component": "latest"
|
|
37
|
+
},
|
|
29
38
|
"peerDependencies": {
|
|
30
39
|
"@vueup/vue-quill": "^1.2.0",
|
|
31
|
-
"libreria-astro-lefebvre": "latest",
|
|
32
40
|
"vue": "^3.3.0",
|
|
33
41
|
"vuedraggable": "^4.1.0"
|
|
34
42
|
},
|