diff --git a/.gitignore b/.gitignore index c7c30a1..8b23c98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ *.ps1 zips/ +.playwright-mcp/ +.claude/ node_modules/ .next/ -next-env.d.ts \ No newline at end of file +next-env.d.ts diff --git a/mvp/b2b/index.html b/mvp/b2b/index.html index 5bf2078..5548211 100644 --- a/mvp/b2b/index.html +++ b/mvp/b2b/index.html @@ -1508,7 +1508,7 @@ h3, h4, h5, h6 { Preguntas
- Entrar + Entrar Empezar gratis
diff --git a/mvp/b2c/drizzle/0006_aspiring_susan_delgado.sql b/mvp/b2c/drizzle/0006_aspiring_susan_delgado.sql new file mode 100644 index 0000000..377d3ed --- /dev/null +++ b/mvp/b2c/drizzle/0006_aspiring_susan_delgado.sql @@ -0,0 +1,33 @@ +CREATE TYPE "public"."testimonio_estado" AS ENUM('pendiente', 'publicado', 'oculto');--> statement-breakpoint +CREATE TABLE "testimonio_fotos" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "testimonio_id" uuid NOT NULL, + "url" text NOT NULL, + "orden" integer DEFAULT 0 NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "testimonios" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "tenant_id" uuid NOT NULL, + "lead_id" uuid, + "nombre" text NOT NULL, + "contexto" text, + "rating" integer NOT NULL, + "texto" text NOT NULL, + "estado" "testimonio_estado" DEFAULT 'pendiente' NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +ALTER TABLE "leads" ADD COLUMN "testimonio_solicitado_at" timestamp with time zone;--> statement-breakpoint +ALTER TABLE "tenants" ADD COLUMN "seo_title" text;--> statement-breakpoint +ALTER TABLE "tenants" ADD COLUMN "seo_description" text;--> statement-breakpoint +ALTER TABLE "tenants" ADD COLUMN "about_enabled" boolean DEFAULT false NOT NULL;--> statement-breakpoint +ALTER TABLE "tenants" ADD COLUMN "about_foto_url" text;--> statement-breakpoint +ALTER TABLE "tenants" ADD COLUMN "about_texto" text;--> statement-breakpoint +ALTER TABLE "tenants" ADD COLUMN "anios_experiencia" integer;--> statement-breakpoint +ALTER TABLE "testimonio_fotos" ADD CONSTRAINT "testimonio_fotos_testimonio_id_testimonios_id_fk" FOREIGN KEY ("testimonio_id") REFERENCES "public"."testimonios"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "testimonios" ADD CONSTRAINT "testimonios_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "testimonios" ADD CONSTRAINT "testimonios_lead_id_leads_id_fk" FOREIGN KEY ("lead_id") REFERENCES "public"."leads"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +CREATE INDEX "testimonios_tenant_estado_idx" ON "testimonios" USING btree ("tenant_id","estado");--> statement-breakpoint +CREATE INDEX "testimonios_lead_idx" ON "testimonios" USING btree ("lead_id"); \ No newline at end of file diff --git a/mvp/b2c/drizzle/0007_pale_chat.sql b/mvp/b2c/drizzle/0007_pale_chat.sql new file mode 100644 index 0000000..49973b1 --- /dev/null +++ b/mvp/b2c/drizzle/0007_pale_chat.sql @@ -0,0 +1,13 @@ +CREATE TABLE "galeria_fotos" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "tenant_id" uuid NOT NULL, + "url" text NOT NULL, + "titulo" text, + "orden" integer DEFAULT 0 NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +ALTER TABLE "tenants" ADD COLUMN "theme_preset" text DEFAULT 'pizarra' NOT NULL;--> statement-breakpoint +ALTER TABLE "tenants" ADD COLUMN "theme_color" text;--> statement-breakpoint +ALTER TABLE "galeria_fotos" ADD CONSTRAINT "galeria_fotos_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +CREATE INDEX "galeria_tenant_idx" ON "galeria_fotos" USING btree ("tenant_id"); \ No newline at end of file diff --git a/mvp/b2c/drizzle/meta/0006_snapshot.json b/mvp/b2c/drizzle/meta/0006_snapshot.json new file mode 100644 index 0000000..b23694c --- /dev/null +++ b/mvp/b2c/drizzle/meta/0006_snapshot.json @@ -0,0 +1,1488 @@ +{ + "id": "a8e37a10-3711-4a96-bbd5-3031dcbac788", + "prevId": "c521ce73-a6cb-43d8-b3f6-54761e69cea8", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.catalog_items": { + "name": "catalog_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "categoria": { + "name": "categoria", + "type": "categoria_material", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "calidad": { + "name": "calidad", + "type": "calidad", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "precio_unit": { + "name": "precio_unit", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "unidad": { + "name": "unidad", + "type": "unidad_medida", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "descriptor_render": { + "name": "descriptor_render", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "es_default": { + "name": "es_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sku": { + "name": "sku", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "catalog_tenant_idx": { + "name": "catalog_tenant_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "catalog_tenant_sku_idx": { + "name": "catalog_tenant_sku_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sku", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "catalog_items_tenant_id_tenants_id_fk": { + "name": "catalog_items_tenant_id_tenants_id_fk", + "tableFrom": "catalog_items", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lead_estado_history": { + "name": "lead_estado_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "lead_id": { + "name": "lead_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "estado": { + "name": "estado", + "type": "lead_estado", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "changed_at": { + "name": "changed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "changed_by": { + "name": "changed_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "lead_estado_history_lead_id_leads_id_fk": { + "name": "lead_estado_history_lead_id_leads_id_fk", + "tableFrom": "lead_estado_history", + "tableTo": "leads", + "columnsFrom": [ + "lead_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lead_fotos": { + "name": "lead_fotos", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "lead_id": { + "name": "lead_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "lead_fotos_lead_id_leads_id_fk": { + "name": "lead_fotos_lead_id_leads_id_fk", + "tableFrom": "lead_fotos", + "tableTo": "leads", + "columnsFrom": [ + "lead_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lead_pipeline_eventos": { + "name": "lead_pipeline_eventos", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "lead_id": { + "name": "lead_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "stage": { + "name": "stage", + "type": "pipeline_stage", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "occurred_at": { + "name": "occurred_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "lead_pipeline_eventos_lead_id_leads_id_fk": { + "name": "lead_pipeline_eventos_lead_id_leads_id_fk", + "tableFrom": "lead_pipeline_eventos", + "tableTo": "leads", + "columnsFrom": [ + "lead_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.leads": { + "name": "leads", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "telefono": { + "name": "telefono", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provincia": { + "name": "provincia", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tipo_reforma": { + "name": "tipo_reforma", + "type": "tipo_reforma", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "consent_privacidad": { + "name": "consent_privacidad", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "consent_contratacion": { + "name": "consent_contratacion", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pipeline_stage": { + "name": "pipeline_stage", + "type": "pipeline_stage", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'form_completado'" + }, + "estado": { + "name": "estado", + "type": "lead_estado", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'nuevo'" + }, + "presupuesto_estimado": { + "name": "presupuesto_estimado", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "transcripcion": { + "name": "transcripcion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "entidades": { + "name": "entidades", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "render_url": { + "name": "render_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "pdf_url": { + "name": "pdf_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "audio_url": { + "name": "audio_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notas": { + "name": "notas", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "testimonio_solicitado_at": { + "name": "testimonio_solicitado_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "m2_suelo": { + "name": "m2_suelo", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "altura_techo": { + "name": "altura_techo", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "calidad_global": { + "name": "calidad_global", + "type": "calidad", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "estructural": { + "name": "estructural", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "material_selections": { + "name": "material_selections", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "desglose_snapshot": { + "name": "desglose_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "urgencia": { + "name": "urgencia", + "type": "urgencia", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "presupuesto_target": { + "name": "presupuesto_target", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "taste_text": { + "name": "taste_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "preferences_snapshot": { + "name": "preferences_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "leads_tenant_created_idx": { + "name": "leads_tenant_created_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "leads_estado_idx": { + "name": "leads_estado_idx", + "columns": [ + { + "expression": "estado", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "leads_tenant_id_tenants_id_fk": { + "name": "leads_tenant_id_tenants_id_fk", + "tableFrom": "leads", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.plans": { + "name": "plans", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "precio_mensual": { + "name": "precio_mensual", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "leads_incluidos": { + "name": "leads_incluidos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "features": { + "name": "features", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "activo": { + "name": "activo", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "plans_slug_unique": { + "name": "plans_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.precision_history": { + "name": "precision_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "lead_id": { + "name": "lead_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "estimated": { + "name": "estimated", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "final": { + "name": "final", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "delta_pct": { + "name": "delta_pct", + "type": "numeric(6, 2)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "precision_history_lead_id_leads_id_fk": { + "name": "precision_history_lead_id_leads_id_fk", + "tableFrom": "precision_history", + "tableTo": "leads", + "columnsFrom": [ + "lead_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pricing_config": { + "name": "pricing_config", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "altura_techo_default": { + "name": "altura_techo_default", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": 2.5 + }, + "factor_zona": { + "name": "factor_zona", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "mano_obra": { + "name": "mano_obra", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pricing_config_tenant_id_tenants_id_fk": { + "name": "pricing_config_tenant_id_tenants_id_fk", + "tableFrom": "pricing_config", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "pricing_config_tenant_id_unique": { + "name": "pricing_config_tenant_id_unique", + "nullsNotDistinct": false, + "columns": [ + "tenant_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sessions": { + "name": "sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "sessions_user_idx": { + "name": "sessions_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sessions_user_id_users_id_fk": { + "name": "sessions_user_id_users_id_fk", + "tableFrom": "sessions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "sessions_token_hash_unique": { + "name": "sessions_token_hash_unique", + "nullsNotDistinct": false, + "columns": [ + "token_hash" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tenants": { + "name": "tenants", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre_empresa": { + "name": "nombre_empresa", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo_url": { + "name": "logo_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provincia": { + "name": "provincia", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "whatsapp_business": { + "name": "whatsapp_business", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "seo_title": { + "name": "seo_title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "seo_description": { + "name": "seo_description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "about_enabled": { + "name": "about_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "about_foto_url": { + "name": "about_foto_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "about_texto": { + "name": "about_texto", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "anios_experiencia": { + "name": "anios_experiencia", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "cif": { + "name": "cif", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "direccion": { + "name": "direccion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "telefono": { + "name": "telefono", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "web": { + "name": "web", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plan_id": { + "name": "plan_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "subscription_status": { + "name": "subscription_status", + "type": "subscription_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'trial'" + }, + "envio_presupuesto": { + "name": "envio_presupuesto", + "type": "envio_presupuesto_mode", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'automatico'" + }, + "trial_ends_at": { + "name": "trial_ends_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tenants_plan_id_plans_id_fk": { + "name": "tenants_plan_id_plans_id_fk", + "tableFrom": "tenants", + "tableTo": "plans", + "columnsFrom": [ + "plan_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tenants_slug_unique": { + "name": "tenants_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.testimonio_fotos": { + "name": "testimonio_fotos", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "testimonio_id": { + "name": "testimonio_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "testimonio_fotos_testimonio_id_testimonios_id_fk": { + "name": "testimonio_fotos_testimonio_id_testimonios_id_fk", + "tableFrom": "testimonio_fotos", + "tableTo": "testimonios", + "columnsFrom": [ + "testimonio_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.testimonios": { + "name": "testimonios", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "lead_id": { + "name": "lead_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "contexto": { + "name": "contexto", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "texto": { + "name": "texto", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "estado": { + "name": "estado", + "type": "testimonio_estado", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pendiente'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "testimonios_tenant_estado_idx": { + "name": "testimonios_tenant_estado_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "estado", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "testimonios_lead_idx": { + "name": "testimonios_lead_idx", + "columns": [ + { + "expression": "lead_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "testimonios_tenant_id_tenants_id_fk": { + "name": "testimonios_tenant_id_tenants_id_fk", + "tableFrom": "testimonios", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "testimonios_lead_id_leads_id_fk": { + "name": "testimonios_lead_id_leads_id_fk", + "tableFrom": "testimonios", + "tableTo": "leads", + "columnsFrom": [ + "lead_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password_hash": { + "name": "password_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "user_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'reformista'" + }, + "tenant_id": { + "name": "tenant_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "user_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'activo'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "users_tenant_idx": { + "name": "users_tenant_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "users_tenant_id_tenants_id_fk": { + "name": "users_tenant_id_tenants_id_fk", + "tableFrom": "users", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.calidad": { + "name": "calidad", + "schema": "public", + "values": [ + "basica", + "media", + "premium" + ] + }, + "public.categoria_material": { + "name": "categoria_material", + "schema": "public", + "values": [ + "suelo", + "pared", + "pintura", + "mobiliario" + ] + }, + "public.envio_presupuesto_mode": { + "name": "envio_presupuesto_mode", + "schema": "public", + "values": [ + "automatico", + "revision" + ] + }, + "public.lead_estado": { + "name": "lead_estado", + "schema": "public", + "values": [ + "nuevo", + "contactado", + "visita_agendada", + "presupuesto_enviado", + "ganado", + "perdido" + ] + }, + "public.pipeline_stage": { + "name": "pipeline_stage", + "schema": "public", + "values": [ + "form_completado", + "fotos_subidas", + "prellamada_enviada", + "llamada_completada", + "render_generado", + "presupuesto_generado", + "whatsapp_entregado" + ] + }, + "public.subscription_status": { + "name": "subscription_status", + "schema": "public", + "values": [ + "trial", + "activo", + "cancelado", + "vencido" + ] + }, + "public.testimonio_estado": { + "name": "testimonio_estado", + "schema": "public", + "values": [ + "pendiente", + "publicado", + "oculto" + ] + }, + "public.tipo_reforma": { + "name": "tipo_reforma", + "schema": "public", + "values": [ + "cocina", + "bano", + "salon", + "comedor", + "integral", + "otro" + ] + }, + "public.unidad_medida": { + "name": "unidad_medida", + "schema": "public", + "values": [ + "m2", + "ml", + "ud" + ] + }, + "public.urgencia": { + "name": "urgencia", + "schema": "public", + "values": [ + "alta", + "media", + "baja" + ] + }, + "public.user_role": { + "name": "user_role", + "schema": "public", + "values": [ + "reformista", + "admin" + ] + }, + "public.user_status": { + "name": "user_status", + "schema": "public", + "values": [ + "activo", + "deshabilitado" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/mvp/b2c/drizzle/meta/0007_snapshot.json b/mvp/b2c/drizzle/meta/0007_snapshot.json new file mode 100644 index 0000000..4964861 --- /dev/null +++ b/mvp/b2c/drizzle/meta/0007_snapshot.json @@ -0,0 +1,1583 @@ +{ + "id": "97f9780b-4aa5-45e4-96d5-f4b7d8334a11", + "prevId": "a8e37a10-3711-4a96-bbd5-3031dcbac788", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.catalog_items": { + "name": "catalog_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "categoria": { + "name": "categoria", + "type": "categoria_material", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "calidad": { + "name": "calidad", + "type": "calidad", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "precio_unit": { + "name": "precio_unit", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "unidad": { + "name": "unidad", + "type": "unidad_medida", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "descriptor_render": { + "name": "descriptor_render", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "es_default": { + "name": "es_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sku": { + "name": "sku", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "catalog_tenant_idx": { + "name": "catalog_tenant_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "catalog_tenant_sku_idx": { + "name": "catalog_tenant_sku_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sku", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "catalog_items_tenant_id_tenants_id_fk": { + "name": "catalog_items_tenant_id_tenants_id_fk", + "tableFrom": "catalog_items", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.galeria_fotos": { + "name": "galeria_fotos", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "galeria_tenant_idx": { + "name": "galeria_tenant_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "galeria_fotos_tenant_id_tenants_id_fk": { + "name": "galeria_fotos_tenant_id_tenants_id_fk", + "tableFrom": "galeria_fotos", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lead_estado_history": { + "name": "lead_estado_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "lead_id": { + "name": "lead_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "estado": { + "name": "estado", + "type": "lead_estado", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "changed_at": { + "name": "changed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "changed_by": { + "name": "changed_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "lead_estado_history_lead_id_leads_id_fk": { + "name": "lead_estado_history_lead_id_leads_id_fk", + "tableFrom": "lead_estado_history", + "tableTo": "leads", + "columnsFrom": [ + "lead_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lead_fotos": { + "name": "lead_fotos", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "lead_id": { + "name": "lead_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "lead_fotos_lead_id_leads_id_fk": { + "name": "lead_fotos_lead_id_leads_id_fk", + "tableFrom": "lead_fotos", + "tableTo": "leads", + "columnsFrom": [ + "lead_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lead_pipeline_eventos": { + "name": "lead_pipeline_eventos", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "lead_id": { + "name": "lead_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "stage": { + "name": "stage", + "type": "pipeline_stage", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "occurred_at": { + "name": "occurred_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "lead_pipeline_eventos_lead_id_leads_id_fk": { + "name": "lead_pipeline_eventos_lead_id_leads_id_fk", + "tableFrom": "lead_pipeline_eventos", + "tableTo": "leads", + "columnsFrom": [ + "lead_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.leads": { + "name": "leads", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "telefono": { + "name": "telefono", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provincia": { + "name": "provincia", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tipo_reforma": { + "name": "tipo_reforma", + "type": "tipo_reforma", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "consent_privacidad": { + "name": "consent_privacidad", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "consent_contratacion": { + "name": "consent_contratacion", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pipeline_stage": { + "name": "pipeline_stage", + "type": "pipeline_stage", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'form_completado'" + }, + "estado": { + "name": "estado", + "type": "lead_estado", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'nuevo'" + }, + "presupuesto_estimado": { + "name": "presupuesto_estimado", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "transcripcion": { + "name": "transcripcion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "entidades": { + "name": "entidades", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "render_url": { + "name": "render_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "pdf_url": { + "name": "pdf_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "audio_url": { + "name": "audio_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "notas": { + "name": "notas", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "testimonio_solicitado_at": { + "name": "testimonio_solicitado_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "m2_suelo": { + "name": "m2_suelo", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "altura_techo": { + "name": "altura_techo", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "calidad_global": { + "name": "calidad_global", + "type": "calidad", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "estructural": { + "name": "estructural", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "material_selections": { + "name": "material_selections", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "desglose_snapshot": { + "name": "desglose_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "urgencia": { + "name": "urgencia", + "type": "urgencia", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "presupuesto_target": { + "name": "presupuesto_target", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "taste_text": { + "name": "taste_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "preferences_snapshot": { + "name": "preferences_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "leads_tenant_created_idx": { + "name": "leads_tenant_created_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "leads_estado_idx": { + "name": "leads_estado_idx", + "columns": [ + { + "expression": "estado", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "leads_tenant_id_tenants_id_fk": { + "name": "leads_tenant_id_tenants_id_fk", + "tableFrom": "leads", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.plans": { + "name": "plans", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "precio_mensual": { + "name": "precio_mensual", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "leads_incluidos": { + "name": "leads_incluidos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "features": { + "name": "features", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "activo": { + "name": "activo", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "plans_slug_unique": { + "name": "plans_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.precision_history": { + "name": "precision_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "lead_id": { + "name": "lead_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "estimated": { + "name": "estimated", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "final": { + "name": "final", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "delta_pct": { + "name": "delta_pct", + "type": "numeric(6, 2)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "precision_history_lead_id_leads_id_fk": { + "name": "precision_history_lead_id_leads_id_fk", + "tableFrom": "precision_history", + "tableTo": "leads", + "columnsFrom": [ + "lead_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pricing_config": { + "name": "pricing_config", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "altura_techo_default": { + "name": "altura_techo_default", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": 2.5 + }, + "factor_zona": { + "name": "factor_zona", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "mano_obra": { + "name": "mano_obra", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "pricing_config_tenant_id_tenants_id_fk": { + "name": "pricing_config_tenant_id_tenants_id_fk", + "tableFrom": "pricing_config", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "pricing_config_tenant_id_unique": { + "name": "pricing_config_tenant_id_unique", + "nullsNotDistinct": false, + "columns": [ + "tenant_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sessions": { + "name": "sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "sessions_user_idx": { + "name": "sessions_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sessions_user_id_users_id_fk": { + "name": "sessions_user_id_users_id_fk", + "tableFrom": "sessions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "sessions_token_hash_unique": { + "name": "sessions_token_hash_unique", + "nullsNotDistinct": false, + "columns": [ + "token_hash" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tenants": { + "name": "tenants", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre_empresa": { + "name": "nombre_empresa", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo_url": { + "name": "logo_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provincia": { + "name": "provincia", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "whatsapp_business": { + "name": "whatsapp_business", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "seo_title": { + "name": "seo_title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "seo_description": { + "name": "seo_description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "about_enabled": { + "name": "about_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "about_foto_url": { + "name": "about_foto_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "about_texto": { + "name": "about_texto", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "anios_experiencia": { + "name": "anios_experiencia", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "theme_preset": { + "name": "theme_preset", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pizarra'" + }, + "theme_color": { + "name": "theme_color", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cif": { + "name": "cif", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "direccion": { + "name": "direccion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "telefono": { + "name": "telefono", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "web": { + "name": "web", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plan_id": { + "name": "plan_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "subscription_status": { + "name": "subscription_status", + "type": "subscription_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'trial'" + }, + "envio_presupuesto": { + "name": "envio_presupuesto", + "type": "envio_presupuesto_mode", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'automatico'" + }, + "trial_ends_at": { + "name": "trial_ends_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "tenants_plan_id_plans_id_fk": { + "name": "tenants_plan_id_plans_id_fk", + "tableFrom": "tenants", + "tableTo": "plans", + "columnsFrom": [ + "plan_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tenants_slug_unique": { + "name": "tenants_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.testimonio_fotos": { + "name": "testimonio_fotos", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "testimonio_id": { + "name": "testimonio_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "testimonio_fotos_testimonio_id_testimonios_id_fk": { + "name": "testimonio_fotos_testimonio_id_testimonios_id_fk", + "tableFrom": "testimonio_fotos", + "tableTo": "testimonios", + "columnsFrom": [ + "testimonio_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.testimonios": { + "name": "testimonios", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "lead_id": { + "name": "lead_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "contexto": { + "name": "contexto", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "texto": { + "name": "texto", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "estado": { + "name": "estado", + "type": "testimonio_estado", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pendiente'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "testimonios_tenant_estado_idx": { + "name": "testimonios_tenant_estado_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "estado", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "testimonios_lead_idx": { + "name": "testimonios_lead_idx", + "columns": [ + { + "expression": "lead_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "testimonios_tenant_id_tenants_id_fk": { + "name": "testimonios_tenant_id_tenants_id_fk", + "tableFrom": "testimonios", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "testimonios_lead_id_leads_id_fk": { + "name": "testimonios_lead_id_leads_id_fk", + "tableFrom": "testimonios", + "tableTo": "leads", + "columnsFrom": [ + "lead_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password_hash": { + "name": "password_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "user_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'reformista'" + }, + "tenant_id": { + "name": "tenant_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "user_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'activo'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "users_tenant_idx": { + "name": "users_tenant_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "users_tenant_id_tenants_id_fk": { + "name": "users_tenant_id_tenants_id_fk", + "tableFrom": "users", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.calidad": { + "name": "calidad", + "schema": "public", + "values": [ + "basica", + "media", + "premium" + ] + }, + "public.categoria_material": { + "name": "categoria_material", + "schema": "public", + "values": [ + "suelo", + "pared", + "pintura", + "mobiliario" + ] + }, + "public.envio_presupuesto_mode": { + "name": "envio_presupuesto_mode", + "schema": "public", + "values": [ + "automatico", + "revision" + ] + }, + "public.lead_estado": { + "name": "lead_estado", + "schema": "public", + "values": [ + "nuevo", + "contactado", + "visita_agendada", + "presupuesto_enviado", + "ganado", + "perdido" + ] + }, + "public.pipeline_stage": { + "name": "pipeline_stage", + "schema": "public", + "values": [ + "form_completado", + "fotos_subidas", + "prellamada_enviada", + "llamada_completada", + "render_generado", + "presupuesto_generado", + "whatsapp_entregado" + ] + }, + "public.subscription_status": { + "name": "subscription_status", + "schema": "public", + "values": [ + "trial", + "activo", + "cancelado", + "vencido" + ] + }, + "public.testimonio_estado": { + "name": "testimonio_estado", + "schema": "public", + "values": [ + "pendiente", + "publicado", + "oculto" + ] + }, + "public.tipo_reforma": { + "name": "tipo_reforma", + "schema": "public", + "values": [ + "cocina", + "bano", + "salon", + "comedor", + "integral", + "otro" + ] + }, + "public.unidad_medida": { + "name": "unidad_medida", + "schema": "public", + "values": [ + "m2", + "ml", + "ud" + ] + }, + "public.urgencia": { + "name": "urgencia", + "schema": "public", + "values": [ + "alta", + "media", + "baja" + ] + }, + "public.user_role": { + "name": "user_role", + "schema": "public", + "values": [ + "reformista", + "admin" + ] + }, + "public.user_status": { + "name": "user_status", + "schema": "public", + "values": [ + "activo", + "deshabilitado" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/mvp/b2c/drizzle/meta/_journal.json b/mvp/b2c/drizzle/meta/_journal.json index 041c1e8..1eef9c9 100644 --- a/mvp/b2c/drizzle/meta/_journal.json +++ b/mvp/b2c/drizzle/meta/_journal.json @@ -43,6 +43,20 @@ "when": 1780237037524, "tag": "0005_tearful_maverick", "breakpoints": true + }, + { + "idx": 6, + "version": "7", + "when": 1780308810691, + "tag": "0006_aspiring_susan_delgado", + "breakpoints": true + }, + { + "idx": 7, + "version": "7", + "when": 1780313493522, + "tag": "0007_pale_chat", + "breakpoints": true } ] } \ No newline at end of file diff --git a/mvp/b2c/next.config.ts b/mvp/b2c/next.config.ts index fffffc4..05c7a96 100644 --- a/mvp/b2c/next.config.ts +++ b/mvp/b2c/next.config.ts @@ -4,10 +4,17 @@ const nextConfig: NextConfig = { // @react-pdf/renderer usa módulos nativos/wasm (yoga, fontkit) que no deben bundlearse. serverExternalPackages: ['@react-pdf/renderer'], async rewrites() { - return [ - // Landing B2B estática (mvp/b2b) servida en /b2b. El fichero vive en public/b2b.html. - { source: "/b2b", destination: "/b2b.html" }, - ]; + // beforeFiles: estas reglas ganan a las rutas del filesystem (incluida [slug]). + // La raíz y /b2b sirven la landing B2B estática (public/b2b.html); cada reformista + // tiene su funnel en /{slug} vía app/[slug]/page.tsx. + return { + beforeFiles: [ + { source: "/", destination: "/b2b.html" }, + { source: "/b2b", destination: "/b2b.html" }, + ], + afterFiles: [], + fallback: [], + }; }, }; diff --git a/mvp/b2c/package-lock.json b/mvp/b2c/package-lock.json index b885150..568ee9b 100644 --- a/mvp/b2c/package-lock.json +++ b/mvp/b2c/package-lock.json @@ -17,6 +17,7 @@ "postgres": "^3.4.9", "react": "19.2.4", "react-dom": "19.2.4", + "react-easy-crop": "^5.5.7", "tailwindcss": "^4.3.0", "zod": "^4.4.3" }, @@ -7209,6 +7210,12 @@ "svg-arc-to-cubic-bezier": "^3.0.0" } }, + "node_modules/normalize-wheel": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz", + "integrity": "sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA==", + "license": "BSD-3-Clause" + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -7635,6 +7642,20 @@ "react": "^19.2.4" } }, + "node_modules/react-easy-crop": { + "version": "5.5.7", + "resolved": "https://registry.npmjs.org/react-easy-crop/-/react-easy-crop-5.5.7.tgz", + "integrity": "sha512-kYo4NtMeXFQB7h1U+h5yhUkE46WQbQdq7if54uDlbMdZHdRgNehfvaFrXnFw5NR1PNoUOJIfTwLnWmEx/MaZnA==", + "license": "MIT", + "dependencies": { + "normalize-wheel": "^1.0.1", + "tslib": "^2.0.1" + }, + "peerDependencies": { + "react": ">=16.4.0", + "react-dom": ">=16.4.0" + } + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", diff --git a/mvp/b2c/package.json b/mvp/b2c/package.json index f4fba54..633a7a3 100644 --- a/mvp/b2c/package.json +++ b/mvp/b2c/package.json @@ -26,6 +26,7 @@ "postgres": "^3.4.9", "react": "19.2.4", "react-dom": "19.2.4", + "react-easy-crop": "^5.5.7", "tailwindcss": "^4.3.0", "zod": "^4.4.3" }, diff --git a/mvp/b2c/public/b2b-assets/fonts/00430955-27e4-4cea-b94e-787f11af509f.woff2 b/mvp/b2c/public/b2b-assets/fonts/00430955-27e4-4cea-b94e-787f11af509f.woff2 new file mode 100644 index 0000000..479d010 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/00430955-27e4-4cea-b94e-787f11af509f.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/12581ec4-115f-4ba1-8b57-50addc6b546c.woff2 b/mvp/b2c/public/b2b-assets/fonts/12581ec4-115f-4ba1-8b57-50addc6b546c.woff2 new file mode 100644 index 0000000..4d09cda Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/12581ec4-115f-4ba1-8b57-50addc6b546c.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/158fbdf5-8d90-47a9-bc8e-5d21e3bafce8.woff2 b/mvp/b2c/public/b2b-assets/fonts/158fbdf5-8d90-47a9-bc8e-5d21e3bafce8.woff2 new file mode 100644 index 0000000..a40c469 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/158fbdf5-8d90-47a9-bc8e-5d21e3bafce8.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/15d36112-e39a-4059-ae12-06c58a5747ac.woff2 b/mvp/b2c/public/b2b-assets/fonts/15d36112-e39a-4059-ae12-06c58a5747ac.woff2 new file mode 100644 index 0000000..0caad58 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/15d36112-e39a-4059-ae12-06c58a5747ac.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/3564a927-e275-4816-b6c1-cc99fc1dcdab.woff2 b/mvp/b2c/public/b2b-assets/fonts/3564a927-e275-4816-b6c1-cc99fc1dcdab.woff2 new file mode 100644 index 0000000..197abca Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/3564a927-e275-4816-b6c1-cc99fc1dcdab.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/40945437-5659-40b2-bfd8-fd664ad1615e.woff2 b/mvp/b2c/public/b2b-assets/fonts/40945437-5659-40b2-bfd8-fd664ad1615e.woff2 new file mode 100644 index 0000000..024f077 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/40945437-5659-40b2-bfd8-fd664ad1615e.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/421ba28b-7abe-4b86-a87c-fcd3e94378f7.woff2 b/mvp/b2c/public/b2b-assets/fonts/421ba28b-7abe-4b86-a87c-fcd3e94378f7.woff2 new file mode 100644 index 0000000..0ad6971 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/421ba28b-7abe-4b86-a87c-fcd3e94378f7.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/49e48789-614f-48bf-9256-df3caab8c123.woff2 b/mvp/b2c/public/b2b-assets/fonts/49e48789-614f-48bf-9256-df3caab8c123.woff2 new file mode 100644 index 0000000..d750914 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/49e48789-614f-48bf-9256-df3caab8c123.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/4d99cd2e-393d-4b95-bcfa-8f2a24ac6f7b.woff2 b/mvp/b2c/public/b2b-assets/fonts/4d99cd2e-393d-4b95-bcfa-8f2a24ac6f7b.woff2 new file mode 100644 index 0000000..e38f553 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/4d99cd2e-393d-4b95-bcfa-8f2a24ac6f7b.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/556fa156-4d6a-481e-a43b-d7ab5fb934a9.woff2 b/mvp/b2c/public/b2b-assets/fonts/556fa156-4d6a-481e-a43b-d7ab5fb934a9.woff2 new file mode 100644 index 0000000..a53d52d Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/556fa156-4d6a-481e-a43b-d7ab5fb934a9.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/60f0ecce-40bf-4952-a5d0-c64eb7d90838.woff2 b/mvp/b2c/public/b2b-assets/fonts/60f0ecce-40bf-4952-a5d0-c64eb7d90838.woff2 new file mode 100644 index 0000000..1f71909 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/60f0ecce-40bf-4952-a5d0-c64eb7d90838.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/a7d33cb8-a5f1-44bf-bf3c-564e7ea0619a.woff2 b/mvp/b2c/public/b2b-assets/fonts/a7d33cb8-a5f1-44bf-bf3c-564e7ea0619a.woff2 new file mode 100644 index 0000000..289de93 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/a7d33cb8-a5f1-44bf-bf3c-564e7ea0619a.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/af8b43b5-1741-407a-be2e-9881a5996d70.woff2 b/mvp/b2c/public/b2b-assets/fonts/af8b43b5-1741-407a-be2e-9881a5996d70.woff2 new file mode 100644 index 0000000..82f9668 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/af8b43b5-1741-407a-be2e-9881a5996d70.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/c4f99f5c-1856-4a0e-9de5-7834190c77b0.woff2 b/mvp/b2c/public/b2b-assets/fonts/c4f99f5c-1856-4a0e-9de5-7834190c77b0.woff2 new file mode 100644 index 0000000..6e7141f Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/c4f99f5c-1856-4a0e-9de5-7834190c77b0.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/c8bfb9ea-7aca-4f8d-8f7c-3e648ef6cb5b.woff2 b/mvp/b2c/public/b2b-assets/fonts/c8bfb9ea-7aca-4f8d-8f7c-3e648ef6cb5b.woff2 new file mode 100644 index 0000000..de83a9c Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/c8bfb9ea-7aca-4f8d-8f7c-3e648ef6cb5b.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/ca40d6e0-4a50-4481-8e30-74c159ef9cee.woff2 b/mvp/b2c/public/b2b-assets/fonts/ca40d6e0-4a50-4481-8e30-74c159ef9cee.woff2 new file mode 100644 index 0000000..de39acb Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/ca40d6e0-4a50-4481-8e30-74c159ef9cee.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/fonts/e9c2548b-cd31-41e0-bc94-aac65cc4b6eb.woff2 b/mvp/b2c/public/b2b-assets/fonts/e9c2548b-cd31-41e0-bc94-aac65cc4b6eb.woff2 new file mode 100644 index 0000000..d15208d Binary files /dev/null and b/mvp/b2c/public/b2b-assets/fonts/e9c2548b-cd31-41e0-bc94-aac65cc4b6eb.woff2 differ diff --git a/mvp/b2c/public/b2b-assets/img/antes-bano.webp b/mvp/b2c/public/b2b-assets/img/antes-bano.webp new file mode 100644 index 0000000..b653c65 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/img/antes-bano.webp differ diff --git a/mvp/b2c/public/b2b-assets/img/antes-comedor.webp b/mvp/b2c/public/b2b-assets/img/antes-comedor.webp new file mode 100644 index 0000000..0c2f99e Binary files /dev/null and b/mvp/b2c/public/b2b-assets/img/antes-comedor.webp differ diff --git a/mvp/b2c/public/b2b-assets/img/antes.webp b/mvp/b2c/public/b2b-assets/img/antes.webp new file mode 100644 index 0000000..717d873 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/img/antes.webp differ diff --git a/mvp/b2c/public/b2b-assets/img/despues-bano.webp b/mvp/b2c/public/b2b-assets/img/despues-bano.webp new file mode 100644 index 0000000..be8ebc4 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/img/despues-bano.webp differ diff --git a/mvp/b2c/public/b2b-assets/img/despues-comedor.webp b/mvp/b2c/public/b2b-assets/img/despues-comedor.webp new file mode 100644 index 0000000..8e0d92f Binary files /dev/null and b/mvp/b2c/public/b2b-assets/img/despues-comedor.webp differ diff --git a/mvp/b2c/public/b2b-assets/img/despues.webp b/mvp/b2c/public/b2b-assets/img/despues.webp new file mode 100644 index 0000000..63dc5f2 Binary files /dev/null and b/mvp/b2c/public/b2b-assets/img/despues.webp differ diff --git a/mvp/b2c/public/b2b-assets/img/icon.svg b/mvp/b2c/public/b2b-assets/img/icon.svg new file mode 100644 index 0000000..722500d --- /dev/null +++ b/mvp/b2c/public/b2b-assets/img/icon.svg @@ -0,0 +1,4 @@ + + + R + diff --git a/mvp/b2c/public/b2b.html b/mvp/b2c/public/b2b.html index 5302911..9ee10b0 100644 --- a/mvp/b2c/public/b2b.html +++ b/mvp/b2c/public/b2b.html @@ -1,181 +1,2136 @@ - - - - Reformix — Para reformistas - - - + + + +Reformix — Para reformistas + + + + + -
- - - - R - + + +
+ +
+ + +
+
+
+ Para empresas de reformas en España +

+ Averigua cuánto vale cada obra antes de coger el coche. +

+

+ El asistente de voz de Reformix atiende la llamada de tu cliente, le pide las fotos y te devuelve un render y un presupuesto orientativo por partidas. Llegas a cada visita sabiendo el tamaño real del trabajo — y solo te desplazas a las obras que te rentan. +

+ +
+ Sin tarjeta para probar + Tu número, tu marca + Cancela cuando quieras +
+
+ + +
+
+ + + + panel.reformix.es / leads +
+
+
+
MR
+
+
María Rivas · Cocina · Madrid
+
Hace 4 min · 24 m² · calidad media
+
Nuevo
+
+
+ 12.400€ + orientativo +
+
+
+
JF
+
+
Jorge Fernández · Baño completo · Pinto
+
Hace 32 min · 6 m² · calidad premium
+
📞 Contactado
+
+
+ 9.150€ + orientativo +
+
+
+
CL
+
+
Carmen López · Reforma integral · Móstoles
+
Ayer · 72 m² · calidad media
+
📅 Visita martes 10:30
+
+
+ 41.800€ + orientativo +
+
+
+ +
+
+ +
+
+ Llamada nueva + +34 663 ··· 21 · 00:47 +
+
+
+
+ +
+
+ Render listo + Cocina · 3 propuestas +
+
+
+
+
+ + +
+
+
+

Reformistas que ya prueban Reformix en Madrid, Valencia y Sevilla

+
Obras Bermejo
+
CASAFINA
+
Reformas 71
+
Talleres Quintana
+
VEGA&HIJOS
+
Atelier Río
+
+
-
Unpacking...
- + if (reduce || !('IntersectionObserver' in window)) { + targets.forEach(function (t) { t.classList.add('is-visible'); }); + return; + } - + var io = new IntersectionObserver(function (entries, obs) { + entries.forEach(function (entry) { + if (!entry.isIntersecting) return; + var el = entry.target; + el.classList.add('is-visible'); + var nums = el.querySelectorAll ? el.querySelectorAll('.stat .num em') : []; + if (el.matches && el.matches('.stat')) { + var ownNum = el.querySelector('.num em'); + if (ownNum) countUp(ownNum); + } + Array.prototype.forEach.call(nums, countUp); + obs.unobserve(el); + }); + }, { rootMargin: '0px 0px -10% 0px', threshold: 0.15 }); - + targets.forEach(function (t) { io.observe(t); }); +})(); + - - - \ No newline at end of file + \ No newline at end of file diff --git a/mvp/b2c/src/app/[slug]/page.tsx b/mvp/b2c/src/app/[slug]/page.tsx new file mode 100644 index 0000000..2b9d7f2 --- /dev/null +++ b/mvp/b2c/src/app/[slug]/page.tsx @@ -0,0 +1,68 @@ +import type { Metadata } from 'next'; +import { notFound } from 'next/navigation'; +import Hero from '@/components/Hero/Hero'; +import ReformaSlider from '@/components/ReformaSlider/ReformaSlider'; +import Features from '@/components/Features/Features'; +import QuienesSomos from '@/components/funnel/QuienesSomos'; +import TestimoniosCliente from '@/components/funnel/TestimoniosCliente'; +import GaleriaTrabajos from '@/components/funnel/GaleriaTrabajos'; +import Footer from '@/components/Footer/Footer'; +import TenantBrand from '@/components/funnel/TenantBrand'; +import { getTenantBySlug, getPublishedTestimonios, getGaleria } from '@/lib/funnel/public-queries'; +import { resolveTheme, themeStyle } from '@/lib/funnel/themes'; + +export const dynamic = 'force-dynamic'; + +export async function generateMetadata({ + params, +}: { + params: Promise<{ slug: string }>; +}): Promise { + const { slug } = await params; + const tenant = await getTenantBySlug(slug); + if (!tenant) return { title: 'Reforma no encontrada' }; + return { + title: tenant.seoTitle ?? `${tenant.nombreEmpresa} · Presupuesto de reforma`, + description: + tenant.seoDescription ?? + `Pide tu presupuesto de reforma a ${tenant.nombreEmpresa}. Render IA y presupuesto orientativo en minutos.`, + }; +} + +export default async function FunnelPage({ params }: { params: Promise<{ slug: string }> }) { + const { slug } = await params; + const tenant = await getTenantBySlug(slug); + if (!tenant) notFound(); + + const [testimonios, galeria] = await Promise.all([ + getPublishedTestimonios(tenant.id), + getGaleria(tenant.id), + ]); + + const theme = resolveTheme(tenant.themePreset, tenant.themeColor); + + return ( +
+ +
+ + + + {tenant.aboutEnabled && tenant.aboutTexto && ( + + )} + + {testimonios.length > 0 && } +
+
+
+ ); +} diff --git a/mvp/b2c/src/app/globals.css b/mvp/b2c/src/app/globals.css index 9ea7a94..02cdd60 100644 --- a/mvp/b2c/src/app/globals.css +++ b/mvp/b2c/src/app/globals.css @@ -1,5 +1,24 @@ @import "tailwindcss"; +/* Instrument Serif (display) — usada por los presets de tema con titulares serif. + Los .woff2 viven en /public/b2b-assets/fonts. */ +@font-face { + font-family: 'Instrument Serif'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url('/b2b-assets/fonts/421ba28b-7abe-4b86-a87c-fcd3e94378f7.woff2') format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} +@font-face { + font-family: 'Instrument Serif'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url('/b2b-assets/fonts/15d36112-e39a-4059-ae12-06c58a5747ac.woff2') format('woff2'); + unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; +} + @theme { /* Colors */ --color-black: #0a0a0a; @@ -25,6 +44,15 @@ /* Fonts */ --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; + --font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif; + + /* Paleta de marca B2B "Architectural Warmth" — panel y área autenticada */ + --color-primary-50: #f4f8f5; + --color-primary-100: #e8f0eb; + --color-primary-500: #4d8a6d; + --color-primary-700: #2f5c46; + --color-primary-900: #1f3a2e; + --color-stone-50: #f7f8f7; /* Transitions */ --transition-fast: 150ms ease; @@ -111,4 +139,23 @@ .badge-accent { @apply bg-accent-light text-accent; } + + /* Botón con el color de marca del reformista (tema de la landing). */ + .btn-brand { + background-color: var(--brand, #0a0a0a); + color: var(--brand-contrast, #ffffff); + border: 2px solid var(--brand, #0a0a0a); + } + .btn-brand:hover { + background-color: var(--brand-dark, #1a1a1a); + border-color: var(--brand-dark, #1a1a1a); + transform: translateY(-1px); + } +} + +/* Presets de tema con titulares en serif (terracota, arena). */ +.theme-serif :is(h1, h2, h3) { + font-family: 'Instrument Serif', Georgia, 'Times New Roman', serif; + font-weight: 400; + letter-spacing: -0.01em; } \ No newline at end of file diff --git a/mvp/b2c/src/app/login/page.tsx b/mvp/b2c/src/app/login/page.tsx index 6b8e762..4348829 100644 --- a/mvp/b2c/src/app/login/page.tsx +++ b/mvp/b2c/src/app/login/page.tsx @@ -1,27 +1,59 @@ 'use client'; +import Link from 'next/link'; import { useActionState } from 'react'; import { login } from './actions'; +import AuthShell from '@/components/auth/AuthShell'; export default function LoginPage() { const [error, formAction, pending] = useActionState(login, null); return ( -
-
-

Entra en tu panel

+ + +
+

Entra en tu panel

+

Gestiona tus leads y tu funnel.

+
+ + {error &&

{error}

} - + +

+ ¿No tienes cuenta?{' '} + + Empieza gratis + +

-
+ ); } diff --git a/mvp/b2c/src/app/opinion/[id]/page.tsx b/mvp/b2c/src/app/opinion/[id]/page.tsx new file mode 100644 index 0000000..afe8594 --- /dev/null +++ b/mvp/b2c/src/app/opinion/[id]/page.tsx @@ -0,0 +1,50 @@ +import { notFound } from 'next/navigation'; +import { getLeadForReview } from '@/lib/funnel/public-queries'; +import { enviarOpinion } from '../actions'; +import OpinionForm from '@/components/funnel/OpinionForm'; +import TenantBrand from '@/components/funnel/TenantBrand'; + +export const dynamic = 'force-dynamic'; + +export default async function OpinionPage({ params }: { params: Promise<{ id: string }> }) { + const { id } = await params; + const data = await getLeadForReview(id); + if (!data || !data.tenant) notFound(); + + const { lead, tenant, yaEnviado } = data; + + return ( + <> + +
+
+

+ {lead.nombre.split(' ')[0]}, ¿qué tal fue tu reforma con {tenant.nombreEmpresa}? +

+

+ Tu opinión nos ayuda muchísimo. Cuéntanos cómo fue y, si quieres, sube alguna foto del + resultado. +

+
+ + {yaEnviado ? ( +
+ +

Ya hemos recibido tu opinión

+

¡Gracias por tomarte el tiempo!

+
+ ) : ( +
+ +
+ )} +
+ + ); +} diff --git a/mvp/b2c/src/app/opinion/actions.ts b/mvp/b2c/src/app/opinion/actions.ts new file mode 100644 index 0000000..748fdf1 --- /dev/null +++ b/mvp/b2c/src/app/opinion/actions.ts @@ -0,0 +1,74 @@ +'use server'; + +import { db } from '@/db'; +import { testimonios, testimonioFotos } from '@/db/schema'; +import { getLeadForReview } from '@/lib/funnel/public-queries'; + +const MAX_FOTOS = 4; +const MAX_FOTO_BYTES = 6 * 1024 * 1024; // 6 MB por foto + +export type EnviarOpinionResult = { ok: boolean; error?: string }; + +async function fileToDataUri(file: File): Promise { + if (file.size === 0 || file.size > MAX_FOTO_BYTES) return null; + if (!file.type.startsWith('image/')) return null; + const buffer = Buffer.from(await file.arrayBuffer()); + return `data:${file.type};base64,${buffer.toString('base64')}`; +} + +// El cliente final deja su opinión desde el funnel de review (/opinion/[id]). +// Entra como 'pendiente'; el reformista la aprueba antes de que salga en su landing. +export async function enviarOpinion( + leadId: string, + _prev: EnviarOpinionResult | null, + formData: FormData +): Promise { + const data = await getLeadForReview(leadId); + if (!data || !data.tenant) { + return { ok: false, error: 'No hemos podido identificar tu solicitud.' }; + } + if (data.yaEnviado) { + return { ok: false, error: 'Ya hemos recibido tu opinión. ¡Gracias!' }; + } + + const rating = Number(formData.get('rating')); + if (!Number.isInteger(rating) || rating < 1 || rating > 5) { + return { ok: false, error: 'Selecciona una valoración de 1 a 5 estrellas.' }; + } + + const texto = String(formData.get('texto') ?? '').trim(); + if (texto.length < 10) { + return { ok: false, error: 'Cuéntanos un poco más sobre tu experiencia (mínimo 10 caracteres).' }; + } + + const nombre = String(formData.get('nombre') ?? '').trim() || data.lead.nombre; + const contexto = String(formData.get('contexto') ?? '').trim() || null; + + const archivos = formData.getAll('fotos').filter((f): f is File => f instanceof File); + const dataUris: string[] = []; + for (const file of archivos.slice(0, MAX_FOTOS)) { + const uri = await fileToDataUri(file); + if (uri) dataUris.push(uri); + } + + const [testimonio] = await db + .insert(testimonios) + .values({ + tenantId: data.tenant.id, + leadId, + nombre, + contexto, + rating, + texto, + estado: 'pendiente', + }) + .returning({ id: testimonios.id }); + + if (dataUris.length > 0) { + await db.insert(testimonioFotos).values( + dataUris.map((url, orden) => ({ testimonioId: testimonio.id, url, orden })) + ); + } + + return { ok: true }; +} diff --git a/mvp/b2c/src/app/opinion/layout.tsx b/mvp/b2c/src/app/opinion/layout.tsx new file mode 100644 index 0000000..3336672 --- /dev/null +++ b/mvp/b2c/src/app/opinion/layout.tsx @@ -0,0 +1,12 @@ +export default function OpinionLayout({ children }: { children: React.ReactNode }) { + return ( +
+
{children}
+
+
+ Tu opinión ayuda a otros clientes a decidir con confianza. +
+
+
+ ); +} diff --git a/mvp/b2c/src/app/page.tsx b/mvp/b2c/src/app/page.tsx deleted file mode 100644 index 0dd2c41..0000000 --- a/mvp/b2c/src/app/page.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import Navbar from '@/components/Navbar/Navbar'; -import Hero from '@/components/Hero/Hero'; -import ReformaSlider from '@/components/ReformaSlider/ReformaSlider'; -import Features from '@/components/Features/Features'; -import Testimonials from '@/components/Testimonials/Testimonials'; -import ContactForm from '@/components/ContactForm/ContactForm'; -import Footer from '@/components/Footer/Footer'; - -export default function Home() { - return ( - <> - {/* */} -
- - - - -
-