@innertia-solutions/innertia-nuxt 0.1.6 → 0.1.8

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.
@@ -1,5 +1,5 @@
1
1
  // useTenantStore auto-imported.
2
- // Server-only: valida el tenant via GET /ping con X-Tenant header.
2
+ // Server-only: valida el tenant via GET /status con X-Tenant header.
3
3
  // Usa la URL interna del backend (apiInternalUrl) para evitar pasar por el proxy de Nitro.
4
4
  // Solo activo en mode === 'saas'.
5
5
  export default defineNuxtRouteMiddleware(async (to) => {
@@ -31,13 +31,22 @@ export default defineNuxtRouteMiddleware(async (to) => {
31
31
  // URL interna del backend (no pasa por el proxy Nitro — no existe en SSR)
32
32
  const config = useRuntimeConfig()
33
33
  const internalUrl = (config as any).apiInternalUrl || 'http://api:80'
34
- const pingUrl = `${internalUrl}/ping`
34
+ const statusUrl = `${internalUrl}/status`
35
35
 
36
- console.log(`[tenant:validate] ping → ${pingUrl} (X-Tenant: ${tenantSlug})`)
36
+ console.log(`[tenant:validate] status → ${statusUrl} (X-Tenant: ${tenantSlug})`)
37
37
 
38
38
  try {
39
- const data = await $fetch<{ ok: boolean; tenant: { id: number; status: string; config: any } }>(
40
- pingUrl,
39
+ // Shape esperado:
40
+ // { ok, tenant: { id, key, name, status, isActive },
41
+ // features: { organizations, teams, twoFactor, oauth: [] },
42
+ // branding: { demo } }
43
+ const data = await $fetch<{
44
+ ok: boolean
45
+ tenant: { id: number; key: string; name: string; status: string; isActive: boolean }
46
+ features?: Record<string, any>
47
+ branding?: Record<string, any>
48
+ }>(
49
+ statusUrl,
41
50
  {
42
51
  headers: { 'X-Tenant': tenantSlug, 'Accept': 'application/json' },
43
52
  timeout: 5000,
@@ -51,8 +60,17 @@ export default defineNuxtRouteMiddleware(async (to) => {
51
60
  return navigateTo('/tenant-error?reason=inactive')
52
61
  }
53
62
 
63
+ // tenantStore.setTenant expects (id, config). Combinamos features + branding como config
64
+ // para compatibilidad con consumidores existentes que leen tenantStore.config.
54
65
  const tenantStore = useTenantStore()
55
- tenantStore.setTenant(data.tenant.id, data.tenant.config ?? {})
66
+ tenantStore.setTenant(data.tenant.id, {
67
+ ...(data.tenant ?? {}),
68
+ features: data.features ?? {},
69
+ branding: data.branding ?? {},
70
+ // Compatibilidad con código viejo que lee config.demo y config.oauthProviders directo
71
+ demo: data.branding?.demo ?? null,
72
+ oauthProviders: data.features?.oauth ?? [],
73
+ })
56
74
  console.log(`[tenant:validate] OK — tenant id=${data.tenant.id} status=${data.tenant.status}`)
57
75
  } catch (e: any) {
58
76
  const status = e?.response?.status
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/innertia-nuxt",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Innertia Solutions — Nuxt layer unificada: core, auth, multitenancy, theme y app contexts",
5
5
  "keywords": [
6
6
  "nuxt",
package/theme.css CHANGED
@@ -1,5 +1,19 @@
1
1
  @import "tailwindcss";
2
2
  @import "preline/variants.css";
3
+
4
+ /* Tailwind v4 — escanea las plantillas de la propia librería para generar
5
+ las utility classes que estos archivos usan. Sin esto, las clases como
6
+ `bg-navbar-inverse`, `text-foreground`, etc. NO se generan en el bundle
7
+ del consumer porque Tailwind no detecta automáticamente código dentro
8
+ de node_modules. */
9
+ @source "./components/**/*.{vue,ts,js}";
10
+ @source "./layouts/**/*.{vue,ts,js}";
11
+ @source "./pages/**/*.{vue,ts,js}";
12
+ @source "./composables/**/*.{ts,js}";
13
+ @source "./plugins/**/*.{ts,js}";
14
+ @source "./middleware/**/*.{ts,js}";
15
+ @source "./error.vue";
16
+
3
17
  @import "./css/themes/harvest.css";
4
18
  @import "./css/themes/retro.css";
5
19
  @import "./css/themes/ocean.css";