@innertia-solutions/innertia-nuxt 0.1.20 → 0.1.22

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.
@@ -8,8 +8,6 @@ const props = defineProps({
8
8
  color: { type: String, default: 'slate' },
9
9
  })
10
10
 
11
- const slots = useSlots()
12
-
13
11
  const iconComponent = computed(() => props.icon ? TablerIcons[props.icon] ?? null : null)
14
12
 
15
13
  const iconColorClass = computed(() => ({
@@ -27,30 +25,30 @@ const iconColorClass = computed(() => ({
27
25
  <template>
28
26
  <div class="relative space-y-2">
29
27
 
30
- <!-- Page header card -->
31
- <div v-if="title" class="sticky top-0 z-20 -mx-3 -mt-3 px-3 pt-3 bg-background-1">
32
- <div v-if="$slots.breadcrumb" class="flex items-center gap-x-1 px-1 pt-2 pb-0.5">
33
- <slot name="breadcrumb" />
34
- </div>
35
- <div class="flex items-center justify-between bg-card border border-card-line rounded-2xl shadow-sm px-4 py-3">
36
- <div class="flex items-center gap-x-4 min-w-0">
37
- <div v-if="iconComponent" class="shrink-0 size-10 rounded-xl flex items-center justify-center border border-current/15" :class="iconColorClass">
38
- <component :is="iconComponent" class="size-5" stroke="1.5" />
39
- </div>
40
- <div class="min-w-0">
41
- <div class="flex items-baseline gap-x-2 flex-wrap">
28
+ <!-- Page header -->
29
+ <div v-if="title" class="sticky top-0 z-20 -mx-3 -mt-3 px-3 bg-background/60 backdrop-blur-md">
30
+
31
+ <!-- Breadcrumb -->
32
+ <div v-if="$slots.breadcrumb" class="flex items-center gap-x-1 px-1 pt-2 pb-0.5">
33
+ <slot name="breadcrumb" />
34
+ </div>
35
+
36
+ <!-- Header: icono + título + acciones -->
37
+ <div class="flex items-center justify-between px-1 py-2">
38
+ <div class="flex items-center gap-x-3 min-w-0">
39
+ <div v-if="iconComponent" class="shrink-0 size-10 rounded-xl flex items-center justify-center border border-current/15" :class="iconColorClass">
40
+ <component :is="iconComponent" class="size-5" stroke="1.5" />
41
+ </div>
42
+ <div class="min-w-0">
42
43
  <h1 class="text-lg font-semibold text-foreground">{{ title }}</h1>
43
- <template v-if="description">
44
- <span class="size-1 rounded-full bg-surface-1 shrink-0 self-center hidden sm:block" />
45
- <p class="text-sm text-muted-foreground">{{ description }}</p>
46
- </template>
44
+ <p v-if="description" class="text-sm text-muted-foreground">{{ description }}</p>
47
45
  </div>
48
46
  </div>
47
+ <div v-if="$slots.actions" class="flex items-center gap-x-2 shrink-0 ms-4">
48
+ <slot name="actions" />
49
+ </div>
49
50
  </div>
50
- <div v-if="$slots.actions" class="flex items-center gap-x-2 shrink-0 ms-4">
51
- <slot name="actions" />
52
- </div>
53
- </div>
51
+
54
52
  </div>
55
53
 
56
54
  <!-- Tabs -->
@@ -59,7 +57,9 @@ const iconColorClass = computed(() => ({
59
57
  </div>
60
58
 
61
59
  <!-- Page content -->
62
- <div class="relative"><slot /></div>
60
+ <div class="relative">
61
+ <slot />
62
+ </div>
63
63
 
64
64
  </div>
65
65
  </template>
@@ -37,12 +37,12 @@ export function useEntity() {
37
37
 
38
38
  const list = (params = {}) => useQuery({
39
39
  queryKey: computed(() => ['entities', toValue(params)]),
40
- queryFn: () => api.post('backoffice/entities', toValue(params)),
40
+ queryFn: () => api.post('entities', toValue(params)),
41
41
  })
42
42
 
43
43
  const detail = (id) => useQuery({
44
44
  queryKey: computed(() => ['entities', toValue(id)]),
45
- queryFn: () => api.get(`backoffice/entities/${toValue(id)}`),
45
+ queryFn: () => api.get(`entities/${toValue(id)}`),
46
46
  enabled: computed(() => !!toValue(id)),
47
47
  })
48
48
 
@@ -51,12 +51,12 @@ export function useEntity() {
51
51
  const invalidate = () => queryClient.invalidateQueries({ queryKey: ['entities'] })
52
52
 
53
53
  const create = () => useMutation({
54
- mutationFn: (data) => api.post('backoffice/entities', data),
54
+ mutationFn: (data) => api.post('entities', data),
55
55
  onSuccess: invalidate,
56
56
  })
57
57
 
58
58
  const update = () => useMutation({
59
- mutationFn: ({ id, ...data }) => api.put(`backoffice/entities/${id}`, data),
59
+ mutationFn: ({ id, ...data }) => api.put(`entities/${id}`, data),
60
60
  onSuccess: (_, { id }) => {
61
61
  queryClient.invalidateQueries({ queryKey: ['entities', id] })
62
62
  invalidate()
@@ -64,14 +64,14 @@ export function useEntity() {
64
64
  })
65
65
 
66
66
  const remove = () => useMutation({
67
- mutationFn: (id) => api.delete(`backoffice/entities/${id}`),
67
+ mutationFn: (id) => api.delete(`entities/${id}`),
68
68
  onSuccess: invalidate,
69
69
  })
70
70
 
71
71
  // Agregar acciones adicionales siguiendo el mismo patrón:
72
72
  //
73
73
  // const activate = () => useMutation({
74
- // mutationFn: (id) => api.post(`backoffice/entities/${id}/activate`),
74
+ // mutationFn: (id) => api.post(`entities/${id}/activate`),
75
75
  // onSuccess: invalidate,
76
76
  // })
77
77
 
@@ -17,7 +17,7 @@ export function usePermissions() {
17
17
  const hasAll = (permissions) => permissions.every(p => authStore.permissions.includes(p))
18
18
 
19
19
  /** Fetch all permission groups from backoffice — returns [{ category, category_alias, permissions[] }] */
20
- const all = (params = {}) => api.get('backoffice/permissions', { params })
20
+ const all = (params = {}) => api.get('permissions', { params })
21
21
 
22
22
  return { can, hasRole, hasAny, hasAll, all }
23
23
  }
@@ -6,12 +6,12 @@ export function useRoles() {
6
6
 
7
7
  const list = (params = {}) => useQuery({
8
8
  queryKey: computed(() => ['roles', toValue(params)]),
9
- queryFn: () => api.post('backoffice/roles', toValue(params)),
9
+ queryFn: () => api.post('roles', toValue(params)),
10
10
  })
11
11
 
12
12
  const detail = (id) => useQuery({
13
13
  queryKey: computed(() => ['roles', toValue(id)]),
14
- queryFn: () => api.get(`backoffice/roles/${toValue(id)}`),
14
+ queryFn: () => api.get(`roles/${toValue(id)}`),
15
15
  enabled: computed(() => !!toValue(id)),
16
16
  })
17
17
 
@@ -20,12 +20,12 @@ export function useRoles() {
20
20
  const invalidateRoles = () => queryClient.invalidateQueries({ queryKey: ['roles'] })
21
21
 
22
22
  const create = () => useMutation({
23
- mutationFn: (data) => api.post('backoffice/roles', data),
23
+ mutationFn: (data) => api.post('roles', data),
24
24
  onSuccess: invalidateRoles,
25
25
  })
26
26
 
27
27
  const update = () => useMutation({
28
- mutationFn: ({ id, ...data }) => api.put(`backoffice/roles/${id}`, data),
28
+ mutationFn: ({ id, ...data }) => api.put(`roles/${id}`, data),
29
29
  onSuccess: (_, { id }) => {
30
30
  queryClient.invalidateQueries({ queryKey: ['roles', id] })
31
31
  invalidateRoles()
@@ -33,13 +33,13 @@ export function useRoles() {
33
33
  })
34
34
 
35
35
  const remove = () => useMutation({
36
- mutationFn: (id) => api.delete(`backoffice/roles/${id}`),
36
+ mutationFn: (id) => api.delete(`roles/${id}`),
37
37
  onSuccess: invalidateRoles,
38
38
  })
39
39
 
40
40
  const syncPermissions = () => useMutation({
41
41
  mutationFn: ({ id, permissions }) =>
42
- api.post(`backoffice/roles/${id}/permissions`, { permissions }),
42
+ api.post(`roles/${id}/permissions`, { permissions }),
43
43
  onSuccess: (_, { id }) =>
44
44
  queryClient.invalidateQueries({ queryKey: ['roles', id] }),
45
45
  })
@@ -6,36 +6,36 @@ export function useUsers() {
6
6
 
7
7
  const list = (params = {}) => useQuery({
8
8
  queryKey: computed(() => ['users', toValue(params)]),
9
- queryFn: () => api.post('backoffice/users', toValue(params)),
9
+ queryFn: () => api.post('users', toValue(params)),
10
10
  })
11
11
 
12
12
  const detail = (id) => useQuery({
13
13
  queryKey: computed(() => ['users', toValue(id)]),
14
- queryFn: () => api.get(`backoffice/users/${toValue(id)}`),
14
+ queryFn: () => api.get(`users/${toValue(id)}`),
15
15
  enabled: computed(() => !!toValue(id)),
16
16
  })
17
17
 
18
18
  const roles = (userId) => useQuery({
19
19
  queryKey: computed(() => ['users', toValue(userId), 'roles']),
20
- queryFn: () => api.get(`backoffice/users/${toValue(userId)}/roles`),
20
+ queryFn: () => api.get(`users/${toValue(userId)}/roles`),
21
21
  enabled: computed(() => !!toValue(userId)),
22
22
  })
23
23
 
24
24
  const apps = (userId) => useQuery({
25
25
  queryKey: computed(() => ['users', toValue(userId), 'apps']),
26
- queryFn: () => api.get(`backoffice/users/${toValue(userId)}/apps`),
26
+ queryFn: () => api.get(`users/${toValue(userId)}/apps`),
27
27
  enabled: computed(() => !!toValue(userId)),
28
28
  })
29
29
 
30
30
  const sessions = (userId) => useQuery({
31
31
  queryKey: computed(() => ['users', toValue(userId), 'sessions']),
32
- queryFn: () => api.get(`backoffice/users/${toValue(userId)}/sessions`),
32
+ queryFn: () => api.get(`users/${toValue(userId)}/sessions`),
33
33
  enabled: computed(() => !!toValue(userId)),
34
34
  })
35
35
 
36
36
  const activityLog = (userId, params = {}) => useQuery({
37
37
  queryKey: computed(() => ['users', toValue(userId), 'activity', toValue(params)]),
38
- queryFn: () => api.get(`backoffice/users/${toValue(userId)}/activity`, toValue(params)),
38
+ queryFn: () => api.get(`users/${toValue(userId)}/activity`, toValue(params)),
39
39
  enabled: computed(() => !!toValue(userId)),
40
40
  })
41
41
 
@@ -44,12 +44,12 @@ export function useUsers() {
44
44
  const invalidateUsers = () => queryClient.invalidateQueries({ queryKey: ['users'] })
45
45
 
46
46
  const create = () => useMutation({
47
- mutationFn: (data) => api.post('backoffice/users', data),
47
+ mutationFn: (data) => api.post('users', data),
48
48
  onSuccess: invalidateUsers,
49
49
  })
50
50
 
51
51
  const update = () => useMutation({
52
- mutationFn: ({ id, ...data }) => api.put(`backoffice/users/${id}`, data),
52
+ mutationFn: ({ id, ...data }) => api.put(`users/${id}`, data),
53
53
  onSuccess: (_, { id }) => {
54
54
  queryClient.invalidateQueries({ queryKey: ['users', id] })
55
55
  invalidateUsers()
@@ -57,46 +57,46 @@ export function useUsers() {
57
57
  })
58
58
 
59
59
  const remove = () => useMutation({
60
- mutationFn: (id) => api.delete(`backoffice/users/${id}`),
60
+ mutationFn: (id) => api.delete(`users/${id}`),
61
61
  onSuccess: invalidateUsers,
62
62
  })
63
63
 
64
64
  const reactivate = () => useMutation({
65
- mutationFn: (id) => api.post(`backoffice/users/${id}/reactivate`),
65
+ mutationFn: (id) => api.post(`users/${id}/reactivate`),
66
66
  onSuccess: invalidateUsers,
67
67
  })
68
68
 
69
69
  const resetPassword = () => useMutation({
70
- mutationFn: ({ id, ...data }) => api.post(`backoffice/users/${id}/reset-password`, data),
70
+ mutationFn: ({ id, ...data }) => api.post(`users/${id}/reset-password`, data),
71
71
  })
72
72
 
73
73
  const assignRole = () => useMutation({
74
- mutationFn: ({ userId, role }) => api.post(`backoffice/users/${userId}/roles`, { role }),
74
+ mutationFn: ({ userId, role }) => api.post(`users/${userId}/roles`, { role }),
75
75
  onSuccess: (_, { userId }) =>
76
76
  queryClient.invalidateQueries({ queryKey: ['users', userId, 'roles'] }),
77
77
  })
78
78
 
79
79
  const removeRole = () => useMutation({
80
- mutationFn: ({ userId, role }) => api.delete(`backoffice/users/${userId}/roles/${role}`),
80
+ mutationFn: ({ userId, role }) => api.delete(`users/${userId}/roles/${role}`),
81
81
  onSuccess: (_, { userId }) =>
82
82
  queryClient.invalidateQueries({ queryKey: ['users', userId, 'roles'] }),
83
83
  })
84
84
 
85
85
  const syncApps = () => useMutation({
86
- mutationFn: ({ userId, apps }) => api.post(`backoffice/users/${userId}/apps/sync`, { apps }),
86
+ mutationFn: ({ userId, apps }) => api.post(`users/${userId}/apps/sync`, { apps }),
87
87
  onSuccess: (_, { userId }) =>
88
88
  queryClient.invalidateQueries({ queryKey: ['users', userId, 'apps'] }),
89
89
  })
90
90
 
91
91
  const revokeSession = () => useMutation({
92
92
  mutationFn: ({ userId, sessionId }) =>
93
- api.delete(`backoffice/users/${userId}/sessions/${sessionId}`),
93
+ api.delete(`users/${userId}/sessions/${sessionId}`),
94
94
  onSuccess: (_, { userId }) =>
95
95
  queryClient.invalidateQueries({ queryKey: ['users', userId, 'sessions'] }),
96
96
  })
97
97
 
98
98
  const revokeAllSessions = () => useMutation({
99
- mutationFn: (userId) => api.delete(`backoffice/users/${userId}/sessions`),
99
+ mutationFn: (userId) => api.delete(`users/${userId}/sessions`),
100
100
  onSuccess: (_, userId) =>
101
101
  queryClient.invalidateQueries({ queryKey: ['users', userId, 'sessions'] }),
102
102
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/innertia-nuxt",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Innertia Solutions — Nuxt layer unificada: core, auth, multitenancy, theme y app contexts",
5
5
  "keywords": [
6
6
  "nuxt",