@innertia-solutions/innertia-nuxt 0.1.89 → 0.1.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/app.config.ts +8 -0
- package/components/App/NotificationBell.vue +4 -1
- package/components/App/NotificationHistory.vue +4 -2
- package/components/Integrations/ApiKeys.vue +297 -0
- package/components/Integrations/Developers.vue +60 -0
- package/components/Integrations/Webhooks.vue +458 -0
- package/components/Integrations/__tests__/sfc-compile.test.ts +31 -0
- package/components/Mail/BrandingPreview.vue +60 -0
- package/components/Mail/BrandingSettings.vue +141 -0
- package/components/Notifications/Preferences.vue +98 -0
- package/components/Notifications/__tests__/sfc-compile.test.ts +34 -0
- package/components/Platform/Emails.vue +133 -0
- package/components/Platform/MailSettings.vue +213 -0
- package/composables/__tests__/useNotifications.test.ts +32 -0
- package/composables/internal/__tests__/forcePassword.test.ts +37 -0
- package/composables/internal/__tests__/mailBranding.test.ts +35 -0
- package/composables/internal/forcePassword.ts +39 -0
- package/composables/internal/mailBranding.ts +62 -0
- package/composables/useIntegrations/index.ts +136 -0
- package/composables/useIntegrations/internal/__tests__/integrations.test.ts +112 -0
- package/composables/useIntegrations/internal/integrations.ts +276 -0
- package/composables/useNotificationHistory/index.ts +8 -7
- package/composables/useNotificationPreferences/index.ts +28 -0
- package/composables/useNotificationPreferences/internal/__tests__/preferences.test.ts +39 -0
- package/composables/useNotificationPreferences/internal/preferences.ts +66 -0
- package/composables/useNotifications.js +10 -5
- package/docs/correos-notificaciones.md +101 -0
- package/docs/webhooks-api.md +88 -0
- package/middleware/06.force-password.global.ts +14 -0
- package/middleware/platform-owner.ts +12 -0
- package/nuxt.config.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { IconSend, IconPalette } from '@tabler/icons-vue'
|
|
3
|
+
import { DEFAULT_BRAND_COLOR, validateBranding } from '../../composables/internal/mailBranding'
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Mail.BrandingSettings — marca del espacio para los correos de negocio ("Sistema › Marca").
|
|
7
|
+
* Backend: \Innertia\Mail\Routes::tenantBranding('settings/branding') → GET|PUT, POST /test.
|
|
8
|
+
*
|
|
9
|
+
* <Mail.BrandingSettings />
|
|
10
|
+
* <Mail.BrandingSettings>
|
|
11
|
+
* <template #logo-picker="{ set }"><MiSelectorDeArchivos @picked="(f) => set({ logo_file_id: f.id })" /></template>
|
|
12
|
+
* </Mail.BrandingSettings>
|
|
13
|
+
*
|
|
14
|
+
* Vista previa en vivo, aviso de cambios sin guardar y "Enviarme un correo de prueba" (usa lo guardado).
|
|
15
|
+
*/
|
|
16
|
+
const props = withDefaults(defineProps<{ endpoint?: string }>(), { endpoint: 'settings/branding' })
|
|
17
|
+
|
|
18
|
+
const api = useApi()
|
|
19
|
+
const toast = useToast()
|
|
20
|
+
const queryClient = useQueryClient()
|
|
21
|
+
const base = props.endpoint.replace(/^\/+|\/+$/g, '')
|
|
22
|
+
|
|
23
|
+
const { data, isPending } = useQuery({ queryKey: ['mail', 'branding', base], queryFn: () => api.get(base) })
|
|
24
|
+
|
|
25
|
+
const FIELDS = ['display_name', 'logo_url', 'logo_file_id', 'color', 'footer_address', 'footer_phone'] as const
|
|
26
|
+
type Field = typeof FIELDS[number]
|
|
27
|
+
const form = reactive<Record<Field, string>>(Object.fromEntries(FIELDS.map(f => [f, ''])) as any)
|
|
28
|
+
const errors = reactive<Record<string, string | null>>({})
|
|
29
|
+
FIELDS.forEach(f => watch(() => form[f], () => { errors[f] = null }))
|
|
30
|
+
|
|
31
|
+
const saved = ref('')
|
|
32
|
+
const snapshot = () => JSON.stringify(form)
|
|
33
|
+
const isDirty = computed(() => snapshot() !== saved.value)
|
|
34
|
+
const platform = computed(() => (data.value as any)?.platform ?? null)
|
|
35
|
+
const previewFields = computed(() => ({
|
|
36
|
+
...form,
|
|
37
|
+
// Un logo desde Archivos se ve con la URL resuelta por el servidor (una vez guardado).
|
|
38
|
+
logo_url: form.logo_url || (form.logo_file_id && !isDirty.value ? (data.value as any)?.resolved?.logo_url : '') || '',
|
|
39
|
+
}))
|
|
40
|
+
|
|
41
|
+
watch(data, (v: any) => {
|
|
42
|
+
if (!v) return
|
|
43
|
+
FIELDS.forEach((f) => { form[f] = v.branding?.[f] ?? '' })
|
|
44
|
+
saved.value = snapshot()
|
|
45
|
+
}, { immediate: true })
|
|
46
|
+
|
|
47
|
+
function set(values: Partial<Record<Field, string | null>>) {
|
|
48
|
+
for (const [k, v] of Object.entries(values)) {
|
|
49
|
+
if ((FIELDS as readonly string[]).includes(k)) form[k as Field] = v ?? ''
|
|
50
|
+
}
|
|
51
|
+
if (values.logo_file_id) form.logo_url = ''
|
|
52
|
+
if (values.logo_url) form.logo_file_id = ''
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const saving = ref(false)
|
|
56
|
+
async function save() {
|
|
57
|
+
Object.assign(errors, validateBranding(form))
|
|
58
|
+
if (Object.values(errors).some(Boolean)) return
|
|
59
|
+
saving.value = true
|
|
60
|
+
try {
|
|
61
|
+
const payload = Object.fromEntries(FIELDS.map(f => [f, form[f].trim() || null]))
|
|
62
|
+
const res = await api.put(base, payload)
|
|
63
|
+
queryClient.setQueryData(['mail', 'branding', base], { ...(data.value as any), ...res })
|
|
64
|
+
saved.value = snapshot()
|
|
65
|
+
toast.success('Marca guardada.')
|
|
66
|
+
} catch (e: any) {
|
|
67
|
+
const fieldErrors = e?.data?.errors ?? {}
|
|
68
|
+
FIELDS.forEach((f) => { errors[f] = fieldErrors[f]?.[0] ?? null })
|
|
69
|
+
if (!FIELDS.some(f => errors[f])) toast.error(e?.data?.message ?? 'No se pudo guardar.')
|
|
70
|
+
} finally {
|
|
71
|
+
saving.value = false
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function discard() {
|
|
76
|
+
const v: any = data.value
|
|
77
|
+
FIELDS.forEach((f) => { form[f] = v?.branding?.[f] ?? '' })
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const testing = ref(false)
|
|
81
|
+
async function sendTest() {
|
|
82
|
+
if (isDirty.value) { toast.error('Guarda los cambios antes de probar: la prueba usa la marca guardada.'); return }
|
|
83
|
+
testing.value = true
|
|
84
|
+
try {
|
|
85
|
+
const res: any = await api.post(`${base}/test`, {})
|
|
86
|
+
toast.success(`Correo de prueba enviado a ${res?.sent_to ?? 'tu correo'}.`)
|
|
87
|
+
} catch (e: any) {
|
|
88
|
+
toast.error(e?.data?.message ?? 'No se pudo enviar la prueba.')
|
|
89
|
+
} finally {
|
|
90
|
+
testing.value = false
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
onBeforeRouteLeave(() => {
|
|
95
|
+
if (isDirty.value && import.meta.client) return window.confirm('Tienes cambios sin guardar. ¿Salir igual?')
|
|
96
|
+
})
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<template>
|
|
100
|
+
<div class="space-y-5">
|
|
101
|
+
<div v-if="isPending" class="p-8 text-center text-sm text-muted-foreground">Cargando…</div>
|
|
102
|
+
<div v-else class="grid lg:grid-cols-2 gap-5 items-start">
|
|
103
|
+
<div class="space-y-4">
|
|
104
|
+
<div class="bg-card border border-card-line rounded-card p-5 space-y-4">
|
|
105
|
+
<Forms.Input v-model="form.display_name" label="Nombre visible" :placeholder="platform?.name ?? ''" :error="errors.display_name" hint="Aparece en el encabezado de los correos si no hay logo." />
|
|
106
|
+
<div class="space-y-2">
|
|
107
|
+
<Forms.Input v-model="form.logo_url" label="URL del logo" placeholder="https://…/logo.png" :error="errors.logo_url" hint="Imagen pública (PNG o SVG). Si no carga, el correo muestra el nombre." />
|
|
108
|
+
<slot name="logo-picker" :set="set" />
|
|
109
|
+
<p v-if="form.logo_file_id" class="text-xs text-muted-foreground">
|
|
110
|
+
Logo desde Documentos seleccionado.
|
|
111
|
+
<button type="button" class="text-red-500 hover:underline" @click="form.logo_file_id = ''">Quitar</button>
|
|
112
|
+
</p>
|
|
113
|
+
</div>
|
|
114
|
+
<div>
|
|
115
|
+
<label class="block text-sm font-medium text-foreground mb-1">Color</label>
|
|
116
|
+
<div class="flex items-start gap-3">
|
|
117
|
+
<input v-model="form.color" type="color" class="h-9 w-14 rounded-control border border-card-line bg-transparent p-1 cursor-pointer" />
|
|
118
|
+
<Forms.Input v-model="form.color" class="w-40" :placeholder="platform?.color ?? DEFAULT_BRAND_COLOR" :error="errors.color" />
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
<div class="grid sm:grid-cols-2 gap-4">
|
|
122
|
+
<Forms.Input v-model="form.footer_address" label="Dirección (pie)" placeholder="Av. Principal 123, Ciudad" :error="errors.footer_address" />
|
|
123
|
+
<Forms.Input v-model="form.footer_phone" label="Teléfono (pie)" placeholder="+56 72 000 0000" :error="errors.footer_phone" />
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div class="flex flex-wrap items-center justify-end gap-2">
|
|
128
|
+
<span v-if="isDirty" class="text-xs text-amber-600 dark:text-amber-400 mr-auto">Tienes cambios sin guardar.</span>
|
|
129
|
+
<App.Button v-if="isDirty" text="Descartar" severity="secondary" size="sm" @click="discard" />
|
|
130
|
+
<App.Button text="Enviarme un correo de prueba" :icon="IconSend" severity="secondary" size="sm" :disabled="isDirty" :loading="testing" @click="sendTest" />
|
|
131
|
+
<App.Button text="Guardar" severity="primary" size="sm" :disabled="!isDirty" :loading="saving" @click="save" />
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
<div class="space-y-2">
|
|
136
|
+
<p class="text-sm font-medium text-foreground flex items-center gap-1.5"><IconPalette class="size-4" :stroke-width="1.5" /> Vista previa</p>
|
|
137
|
+
<Mail.BrandingPreview :branding="previewFields" :platform="platform" />
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</template>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { IconBell, IconMail, IconLock } from '@tabler/icons-vue'
|
|
3
|
+
import {
|
|
4
|
+
CHANNELS, CHANNEL_LABELS, clonePreferences, diffPreferences, groupByCategory, togglePreference,
|
|
5
|
+
type Channel, type NoticeTypePreference,
|
|
6
|
+
} from '../../composables/useNotificationPreferences/internal/preferences'
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Notifications.Preferences — qué avisos recibe el usuario y por qué canal (campanita/correo).
|
|
10
|
+
* Los avisos críticos de cuenta se muestran bloqueados (el servidor ignora apagarlos).
|
|
11
|
+
* Backend: \Innertia\Notifications\Routes::preferences() (GET|PUT me/notification-preferences).
|
|
12
|
+
*
|
|
13
|
+
* <Notifications.Preferences /> // backoffice
|
|
14
|
+
* <Notifications.Preferences endpoint="platform/me/notification-preferences" />
|
|
15
|
+
*/
|
|
16
|
+
const props = withDefaults(defineProps<{ endpoint?: string }>(), { endpoint: 'me/notification-preferences' })
|
|
17
|
+
|
|
18
|
+
const toast = useToast()
|
|
19
|
+
const { query, save } = useNotificationPreferences({ base: props.endpoint })
|
|
20
|
+
|
|
21
|
+
const original = computed<NoticeTypePreference[]>(() => (query.data.value as any)?.data ?? [])
|
|
22
|
+
const items = ref<NoticeTypePreference[]>([])
|
|
23
|
+
watch(original, (v) => { items.value = clonePreferences(v) }, { immediate: true })
|
|
24
|
+
|
|
25
|
+
const changes = computed(() => diffPreferences(original.value, items.value))
|
|
26
|
+
const groups = computed(() => groupByCategory(items.value))
|
|
27
|
+
const icons: Record<Channel, any> = { bell: IconBell, mail: IconMail }
|
|
28
|
+
|
|
29
|
+
function set(key: string, channel: Channel, enabled: boolean) {
|
|
30
|
+
items.value = togglePreference(items.value, key, channel, enabled)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function submit() {
|
|
34
|
+
if (!changes.value.length) return
|
|
35
|
+
try {
|
|
36
|
+
await save.mutateAsync(changes.value)
|
|
37
|
+
toast.success('Preferencias guardadas.')
|
|
38
|
+
} catch (e: any) {
|
|
39
|
+
toast.error(e?.data?.message ?? 'No se pudieron guardar las preferencias.')
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function discard() {
|
|
44
|
+
items.value = clonePreferences(original.value)
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<template>
|
|
49
|
+
<div class="space-y-4">
|
|
50
|
+
<div v-if="query.isPending.value" class="p-8 text-center text-sm text-muted-foreground">Cargando…</div>
|
|
51
|
+
<div v-else-if="query.isError.value" class="p-8 text-center text-sm text-muted-foreground">
|
|
52
|
+
No se pudieron cargar tus preferencias.
|
|
53
|
+
<button type="button" class="text-primary hover:underline" @click="query.refetch()">Reintentar</button>
|
|
54
|
+
</div>
|
|
55
|
+
<div v-else-if="!items.length" class="p-8 text-center text-sm text-muted-foreground">No hay avisos configurables.</div>
|
|
56
|
+
|
|
57
|
+
<template v-else>
|
|
58
|
+
<div v-for="g in groups" :key="g.category" class="bg-card border border-card-line rounded-card overflow-hidden">
|
|
59
|
+
<div class="flex items-center gap-3 px-5 py-3 border-b border-card-line bg-muted/30">
|
|
60
|
+
<p class="flex-1 text-sm font-semibold text-foreground">{{ g.label }}</p>
|
|
61
|
+
<span v-for="c in CHANNELS" :key="c" class="w-20 text-center text-xs font-medium text-muted-foreground inline-flex items-center justify-center gap-1">
|
|
62
|
+
<component :is="icons[c]" class="size-3.5" :stroke-width="1.75" />{{ CHANNEL_LABELS[c] }}
|
|
63
|
+
</span>
|
|
64
|
+
</div>
|
|
65
|
+
<ul class="divide-y divide-card-line">
|
|
66
|
+
<li v-for="t in g.items" :key="t.key" class="flex items-center gap-3 px-5 py-3">
|
|
67
|
+
<div class="flex-1 min-w-0">
|
|
68
|
+
<p class="text-sm font-medium text-foreground flex items-center gap-1.5">
|
|
69
|
+
{{ t.label }}
|
|
70
|
+
<IconLock v-if="t.critical" class="size-3.5 text-muted-foreground" :stroke-width="1.75" title="Aviso de seguridad: no se puede desactivar" />
|
|
71
|
+
</p>
|
|
72
|
+
<p v-if="t.description" class="text-xs text-muted-foreground">{{ t.description }}</p>
|
|
73
|
+
</div>
|
|
74
|
+
<label v-for="c in CHANNELS" :key="c" class="w-20 flex justify-center">
|
|
75
|
+
<input
|
|
76
|
+
type="checkbox"
|
|
77
|
+
class="size-4 rounded border-card-line text-primary focus:ring-primary/30 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
78
|
+
:checked="t.preferences[c]?.enabled"
|
|
79
|
+
:disabled="t.preferences[c]?.locked || !t.preferences[c]?.available"
|
|
80
|
+
:aria-label="`${t.label}: ${CHANNEL_LABELS[c]}`"
|
|
81
|
+
@change="set(t.key, c, ($event.target as HTMLInputElement).checked)"
|
|
82
|
+
/>
|
|
83
|
+
</label>
|
|
84
|
+
</li>
|
|
85
|
+
</ul>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<p class="text-xs text-muted-foreground flex items-center gap-1">
|
|
89
|
+
<IconLock class="size-3.5" :stroke-width="1.75" /> Los avisos de seguridad de tu cuenta siempre se envían.
|
|
90
|
+
</p>
|
|
91
|
+
|
|
92
|
+
<div class="flex justify-end gap-2">
|
|
93
|
+
<App.Button v-if="changes.length" text="Descartar" severity="secondary" size="sm" @click="discard" />
|
|
94
|
+
<App.Button text="Guardar" severity="primary" size="sm" :disabled="!changes.length" :loading="save.isPending.value" @click="submit" />
|
|
95
|
+
</div>
|
|
96
|
+
</template>
|
|
97
|
+
</div>
|
|
98
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { readFileSync } from 'node:fs'
|
|
3
|
+
import { resolve } from 'node:path'
|
|
4
|
+
import { parse, compileScript, compileTemplate } from 'vue/compiler-sfc'
|
|
5
|
+
|
|
6
|
+
// Componentes de avisos, correo y marca: compilan (script + template) sin errores.
|
|
7
|
+
const COMPONENTS = [
|
|
8
|
+
'../Preferences.vue',
|
|
9
|
+
'../../Platform/Emails.vue',
|
|
10
|
+
'../../Platform/MailSettings.vue',
|
|
11
|
+
'../../Mail/BrandingPreview.vue',
|
|
12
|
+
'../../Mail/BrandingSettings.vue',
|
|
13
|
+
'../../App/NotificationBell.vue',
|
|
14
|
+
'../../App/NotificationHistory.vue',
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
describe('SFC de avisos y correo compilan', () => {
|
|
18
|
+
for (const rel of COMPONENTS) {
|
|
19
|
+
it(rel, () => {
|
|
20
|
+
const filename = resolve(__dirname, rel)
|
|
21
|
+
const { descriptor, errors } = parse(readFileSync(filename, 'utf8'), { filename })
|
|
22
|
+
expect(errors).toEqual([])
|
|
23
|
+
|
|
24
|
+
const script = compileScript(descriptor, { id: rel })
|
|
25
|
+
const tpl = compileTemplate({
|
|
26
|
+
source: descriptor.template!.content,
|
|
27
|
+
filename,
|
|
28
|
+
id: rel,
|
|
29
|
+
compilerOptions: { bindingMetadata: script.bindings },
|
|
30
|
+
})
|
|
31
|
+
expect(tpl.errors).toEqual([])
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
})
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { IconSend, IconSearch } from '@tabler/icons-vue'
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Platform.Emails — registro de correos enviados (/platform/emails).
|
|
6
|
+
* Backend: \Innertia\Mail\Routes::platform('') → GET emails, GET emails/types.
|
|
7
|
+
* Filtros: búsqueda (destinatario/asunto), estado, tipo y espacio. Los fallidos muestran el motivo.
|
|
8
|
+
*
|
|
9
|
+
* <Platform.Emails />
|
|
10
|
+
* <Platform.Emails :tenants="[{ value: 'uuid', label: 'Rancagua' }]" />
|
|
11
|
+
*/
|
|
12
|
+
const props = withDefaults(defineProps<{
|
|
13
|
+
endpoint?: string
|
|
14
|
+
tenants?: { value: string; label: string }[]
|
|
15
|
+
}>(), { endpoint: 'platform/emails', tenants: () => [] })
|
|
16
|
+
|
|
17
|
+
const api = useApi()
|
|
18
|
+
const base = props.endpoint.replace(/^\/+|\/+$/g, '')
|
|
19
|
+
|
|
20
|
+
const search = ref('')
|
|
21
|
+
const status = ref<string | null>('')
|
|
22
|
+
const type = ref<string | null>('')
|
|
23
|
+
const tenant = ref<string | null>('')
|
|
24
|
+
const page = ref(1)
|
|
25
|
+
const expanded = ref<string | null>(null)
|
|
26
|
+
|
|
27
|
+
const params = computed(() => ({
|
|
28
|
+
page: page.value,
|
|
29
|
+
...(search.value ? { search: search.value } : {}),
|
|
30
|
+
...(status.value ? { status: status.value } : {}),
|
|
31
|
+
...(type.value ? { type: type.value } : {}),
|
|
32
|
+
...(tenant.value ? { tenant_id: tenant.value } : {}),
|
|
33
|
+
}))
|
|
34
|
+
|
|
35
|
+
const { data, isPending } = useQuery({
|
|
36
|
+
queryKey: computed(() => ['platform', 'emails', base, params.value]),
|
|
37
|
+
queryFn: () => api.get(base, { params: params.value }),
|
|
38
|
+
placeholderData: (prev: any) => prev,
|
|
39
|
+
})
|
|
40
|
+
const { data: typesData } = useQuery({ queryKey: ['platform', 'emails', base, 'types'], queryFn: () => api.get(`${base}/types`) })
|
|
41
|
+
|
|
42
|
+
const rows = computed<any[]>(() => (data.value as any)?.data ?? [])
|
|
43
|
+
const lastPage = computed(() => (data.value as any)?.last_page ?? 1)
|
|
44
|
+
const typeOptions = computed(() => ((typesData.value as any)?.data ?? []).map((t: string) => ({ value: t, label: t })))
|
|
45
|
+
|
|
46
|
+
watch([search, status, type, tenant], () => { page.value = 1 })
|
|
47
|
+
|
|
48
|
+
const STATUS: Record<string, { label: string; class: string }> = {
|
|
49
|
+
queued: { label: 'En cola', class: 'bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-400' },
|
|
50
|
+
sent: { label: 'Enviado', class: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-400' },
|
|
51
|
+
failed: { label: 'Fallido', class: 'bg-red-100 text-red-700 dark:bg-red-500/15 dark:text-red-400' },
|
|
52
|
+
pending: { label: 'Pendiente', class: 'bg-slate-100 text-slate-600 dark:bg-slate-700/40 dark:text-slate-300' },
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function fmtDate(v?: string | null) {
|
|
56
|
+
return v ? new Date(v).toLocaleString('es-CL', { dateStyle: 'medium', timeStyle: 'short' }) : '—'
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<div class="space-y-5">
|
|
62
|
+
<div class="flex items-center gap-3">
|
|
63
|
+
<div class="size-10 rounded-xl bg-primary/10 text-primary flex items-center justify-center shrink-0">
|
|
64
|
+
<IconSend class="size-5" :stroke-width="1.5" />
|
|
65
|
+
</div>
|
|
66
|
+
<div>
|
|
67
|
+
<h1 class="text-lg font-semibold text-foreground">Correos enviados</h1>
|
|
68
|
+
<p class="text-sm text-muted-foreground">Registro de los correos que envía la plataforma.</p>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<div class="flex flex-wrap items-end gap-3">
|
|
73
|
+
<div class="relative flex-1 min-w-56">
|
|
74
|
+
<IconSearch class="absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" />
|
|
75
|
+
<input
|
|
76
|
+
v-model="search"
|
|
77
|
+
type="search"
|
|
78
|
+
placeholder="Buscar por destinatario o asunto…"
|
|
79
|
+
class="w-full pl-9 pr-3 h-9 rounded-control border border-card-line bg-card text-sm text-foreground focus:outline-hidden focus:ring-2 focus:ring-primary/30"
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="w-44"><Forms.Select v-model="status" placeholder="Todos los estados" :options="[{ value: 'sent', label: 'Enviado' }, { value: 'queued', label: 'En cola' }, { value: 'failed', label: 'Fallido' }]" /></div>
|
|
83
|
+
<div class="w-56"><Forms.Select :key="typeOptions.length" v-model="type" placeholder="Todos los tipos" :options="typeOptions" /></div>
|
|
84
|
+
<div v-if="tenants.length" class="w-56"><Forms.Select v-model="tenant" placeholder="Todos los espacios" :options="tenants" /></div>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div class="bg-card border border-card-line rounded-card overflow-hidden">
|
|
88
|
+
<div v-if="isPending" class="p-8 text-center text-sm text-muted-foreground">Cargando…</div>
|
|
89
|
+
<div v-else-if="!rows.length" class="p-10 text-center text-sm text-muted-foreground">Sin correos registrados.</div>
|
|
90
|
+
<div v-else class="overflow-x-auto">
|
|
91
|
+
<table class="w-full min-w-[720px] text-sm">
|
|
92
|
+
<thead class="bg-muted/40 text-muted-foreground">
|
|
93
|
+
<tr class="text-left">
|
|
94
|
+
<th class="font-medium px-4 py-2.5">Fecha</th>
|
|
95
|
+
<th class="font-medium px-4 py-2.5">Destinatario</th>
|
|
96
|
+
<th class="font-medium px-4 py-2.5">Asunto</th>
|
|
97
|
+
<th class="font-medium px-4 py-2.5">Tipo</th>
|
|
98
|
+
<th class="font-medium px-4 py-2.5">Espacio</th>
|
|
99
|
+
<th class="font-medium px-4 py-2.5">Estado</th>
|
|
100
|
+
</tr>
|
|
101
|
+
</thead>
|
|
102
|
+
<tbody class="divide-y divide-card-line">
|
|
103
|
+
<template v-for="r in rows" :key="r.id">
|
|
104
|
+
<tr class="hover:bg-muted/30" :class="{ 'cursor-pointer': r.exception }" @click="r.exception && (expanded = expanded === r.id ? null : r.id)">
|
|
105
|
+
<td class="px-4 py-2.5 text-muted-foreground whitespace-nowrap">{{ fmtDate(r.sent_at ?? r.created_at) }}</td>
|
|
106
|
+
<td class="px-4 py-2.5 text-foreground break-all">{{ r.to }}</td>
|
|
107
|
+
<td class="px-4 py-2.5 text-foreground">{{ r.subject }}</td>
|
|
108
|
+
<td class="px-4 py-2.5 text-muted-foreground font-mono text-xs">{{ r.type ?? '—' }}</td>
|
|
109
|
+
<td class="px-4 py-2.5 text-muted-foreground">{{ r.tenant_name ?? (r.tenant_id ? r.tenant_id : 'Plataforma') }}</td>
|
|
110
|
+
<td class="px-4 py-2.5">
|
|
111
|
+
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium" :class="STATUS[r.status]?.class ?? STATUS.pending.class">
|
|
112
|
+
{{ STATUS[r.status]?.label ?? r.status }}
|
|
113
|
+
</span>
|
|
114
|
+
</td>
|
|
115
|
+
</tr>
|
|
116
|
+
<tr v-if="expanded === r.id && r.exception">
|
|
117
|
+
<td colspan="6" class="px-4 py-3 bg-red-50 dark:bg-red-500/10 text-xs text-red-700 dark:text-red-300 break-all">
|
|
118
|
+
<span class="font-medium">Motivo:</span> {{ r.exception }}
|
|
119
|
+
</td>
|
|
120
|
+
</tr>
|
|
121
|
+
</template>
|
|
122
|
+
</tbody>
|
|
123
|
+
</table>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div v-if="lastPage > 1" class="flex items-center justify-end gap-2">
|
|
128
|
+
<App.Button text="Anterior" severity="secondary" size="sm" :disabled="page <= 1" @click="page--" />
|
|
129
|
+
<span class="text-xs text-muted-foreground">Página {{ page }} de {{ lastPage }}</span>
|
|
130
|
+
<App.Button text="Siguiente" severity="secondary" size="sm" :disabled="page >= lastPage" @click="page++" />
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</template>
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { IconMail, IconSend } from '@tabler/icons-vue'
|
|
3
|
+
import { HEX_COLOR } from '../../composables/internal/mailBranding'
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Platform.MailSettings — configuración de correo de la plataforma (solo owner).
|
|
7
|
+
* Backend: \Innertia\Mail\Routes::platform('') → GET|PUT mail-settings, DELETE mail-settings/resend-key,
|
|
8
|
+
* POST mail-settings/test. Página sugerida:
|
|
9
|
+
*
|
|
10
|
+
* definePageMeta({ layout: 'platform', middleware: ['platform-owner'] })
|
|
11
|
+
* <Platform.MailSettings>
|
|
12
|
+
* <template #logo-picker="{ set }"><MiSelector @picked="set" /></template> // opcional
|
|
13
|
+
* </Platform.MailSettings>
|
|
14
|
+
*
|
|
15
|
+
* Validación por campo (local + 422), aviso de cambios sin guardar, confirmación al borrar la
|
|
16
|
+
* key de Resend, correo de prueba con la configuración guardada y vista previa (en vivo y del
|
|
17
|
+
* correo realmente enviado).
|
|
18
|
+
*/
|
|
19
|
+
const props = withDefaults(defineProps<{ endpoint?: string }>(), { endpoint: 'platform/mail-settings' })
|
|
20
|
+
|
|
21
|
+
const api = useApi()
|
|
22
|
+
const toast = useToast()
|
|
23
|
+
const { confirm } = useModal()
|
|
24
|
+
const queryClient = useQueryClient()
|
|
25
|
+
const base = props.endpoint.replace(/^\/+|\/+$/g, '')
|
|
26
|
+
const queryKey = ['platform', 'mail-settings', base]
|
|
27
|
+
|
|
28
|
+
const { data, isPending } = useQuery({ queryKey, queryFn: () => api.get(base) })
|
|
29
|
+
|
|
30
|
+
const form = reactive({ mailer: 'smtp', from_name: '', from_address: '', logo_url: '', brand_color: '#6366f1' })
|
|
31
|
+
const resendKeyInput = ref('')
|
|
32
|
+
const resendKeySet = ref(false)
|
|
33
|
+
|
|
34
|
+
const BASE_MAILERS = [
|
|
35
|
+
{ value: 'smtp', label: 'Mailpit / SMTP (desarrollo)' },
|
|
36
|
+
{ value: 'resend', label: 'Resend (producción)' },
|
|
37
|
+
]
|
|
38
|
+
const MAILERS = computed(() => ((data.value as any)?.mailer === 'log' || form.mailer === 'log')
|
|
39
|
+
? [...BASE_MAILERS, { value: 'log', label: 'Registro (solo pruebas)' }]
|
|
40
|
+
: BASE_MAILERS)
|
|
41
|
+
|
|
42
|
+
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
|
43
|
+
const HTTP_URL = /^https?:\/\//i
|
|
44
|
+
const FIELDS = ['from_name', 'from_address', 'logo_url', 'brand_color'] as const
|
|
45
|
+
const errors = reactive<Record<string, string | null>>(Object.fromEntries(FIELDS.map(f => [f, null])))
|
|
46
|
+
FIELDS.forEach(f => watch(() => form[f], () => { errors[f] = null }))
|
|
47
|
+
|
|
48
|
+
const savedSnapshot = ref('')
|
|
49
|
+
const snapshot = () => JSON.stringify({ ...form })
|
|
50
|
+
const isDirty = computed(() => snapshot() !== savedSnapshot.value || !!resendKeyInput.value.trim())
|
|
51
|
+
|
|
52
|
+
watch(data, (v: any) => {
|
|
53
|
+
if (!v) return
|
|
54
|
+
form.mailer = v.mailer ?? 'smtp'
|
|
55
|
+
form.from_name = v.from_name ?? ''
|
|
56
|
+
form.from_address = v.from_address ?? ''
|
|
57
|
+
form.logo_url = v.logo_url ?? ''
|
|
58
|
+
form.brand_color = v.brand_color ?? '#6366f1'
|
|
59
|
+
resendKeySet.value = !!v.resend_api_key_set
|
|
60
|
+
resendKeyInput.value = ''
|
|
61
|
+
savedSnapshot.value = snapshot()
|
|
62
|
+
}, { immediate: true })
|
|
63
|
+
|
|
64
|
+
const preview = computed(() => ({ name: form.from_name || 'Plataforma', logo_url: form.logo_url, color: form.brand_color }))
|
|
65
|
+
|
|
66
|
+
const saving = ref(false)
|
|
67
|
+
async function save() {
|
|
68
|
+
FIELDS.forEach((f) => { errors[f] = null })
|
|
69
|
+
if (form.from_address && !EMAIL.test(form.from_address.trim())) errors.from_address = 'Ingresa un correo válido, por ejemplo no-reply@tudominio.cl.'
|
|
70
|
+
if (form.logo_url && !HTTP_URL.test(form.logo_url.trim())) errors.logo_url = 'La URL del logo debe comenzar con http:// o https://.'
|
|
71
|
+
if (form.brand_color && !HEX_COLOR.test(form.brand_color.trim())) errors.brand_color = 'El color de marca debe ser un hexadecimal como #6366f1 o #fff.'
|
|
72
|
+
if (FIELDS.some(f => errors[f])) return
|
|
73
|
+
saving.value = true
|
|
74
|
+
try {
|
|
75
|
+
const payload: Record<string, any> = { ...form }
|
|
76
|
+
if (resendKeyInput.value.trim()) payload.resend_api_key = resendKeyInput.value.trim()
|
|
77
|
+
const res = await api.put(base, payload)
|
|
78
|
+
queryClient.setQueryData(queryKey, res)
|
|
79
|
+
savedSnapshot.value = snapshot()
|
|
80
|
+
resendKeyInput.value = ''
|
|
81
|
+
toast.success('Configuración de correo guardada.')
|
|
82
|
+
} catch (e: any) {
|
|
83
|
+
const fieldErrors = e?.data?.errors ?? {}
|
|
84
|
+
FIELDS.forEach((f) => { errors[f] = fieldErrors[f]?.[0] ?? null })
|
|
85
|
+
if (!FIELDS.some(f => errors[f])) toast.error(e?.data?.message ?? 'No se pudo guardar.')
|
|
86
|
+
} finally {
|
|
87
|
+
saving.value = false
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function clearResendKey() {
|
|
92
|
+
if (!await confirm({ severity: 'danger', title: 'Eliminar API key de Resend', message: 'Se borrará la API key guardada. Si Resend es el proveedor activo, los correos dejarán de enviarse hasta que configures una nueva.', confirmText: 'Eliminar' })) return
|
|
93
|
+
try {
|
|
94
|
+
const res = await api.delete(`${base}/resend-key`)
|
|
95
|
+
queryClient.setQueryData(queryKey, res)
|
|
96
|
+
toast.success('API key de Resend eliminada.')
|
|
97
|
+
} catch (e: any) {
|
|
98
|
+
toast.error(e?.data?.message ?? 'No se pudo eliminar.')
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const testEmail = ref('')
|
|
103
|
+
const testEmailError = ref<string | null>(null)
|
|
104
|
+
const sentHtml = ref<string | null>(null)
|
|
105
|
+
watch(testEmail, () => { testEmailError.value = null })
|
|
106
|
+
const testing = ref(false)
|
|
107
|
+
async function sendTest() {
|
|
108
|
+
if (testing.value) return
|
|
109
|
+
if (isDirty.value) { toast.error('Guarda los cambios antes de probar: la prueba usa la configuración guardada.'); return }
|
|
110
|
+
if (!testEmail.value) { testEmailError.value = 'Ingresa un correo de destino.'; return }
|
|
111
|
+
if (!EMAIL.test(testEmail.value.trim())) { testEmailError.value = 'Ingresa un correo válido.'; return }
|
|
112
|
+
testing.value = true
|
|
113
|
+
try {
|
|
114
|
+
const res: any = await api.post(`${base}/test`, { email: testEmail.value.trim() })
|
|
115
|
+
sentHtml.value = res?.html ?? null
|
|
116
|
+
toast.success(`Correo de prueba enviado a ${testEmail.value}.`)
|
|
117
|
+
} catch (e: any) {
|
|
118
|
+
testEmailError.value = e?.data?.errors?.email?.[0] ?? null
|
|
119
|
+
if (!testEmailError.value) toast.error(e?.data?.message ?? 'No se pudo enviar la prueba.')
|
|
120
|
+
} finally {
|
|
121
|
+
testing.value = false
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
onBeforeRouteLeave(() => {
|
|
126
|
+
if (isDirty.value && import.meta.client) return window.confirm('Tienes cambios sin guardar. ¿Salir igual?')
|
|
127
|
+
})
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
<template>
|
|
131
|
+
<div class="max-w-4xl mx-auto space-y-5">
|
|
132
|
+
<div class="flex items-center gap-3">
|
|
133
|
+
<div class="size-10 rounded-xl bg-primary/10 text-primary flex items-center justify-center shrink-0">
|
|
134
|
+
<IconMail class="size-5" :stroke-width="1.5" />
|
|
135
|
+
</div>
|
|
136
|
+
<div class="flex-1 min-w-0">
|
|
137
|
+
<h1 class="text-lg font-semibold text-foreground">Configuración de correo</h1>
|
|
138
|
+
<p class="text-sm text-muted-foreground">Proveedor, remitente y marca de los correos que envía la plataforma.</p>
|
|
139
|
+
</div>
|
|
140
|
+
<span v-if="isDirty" class="text-xs text-amber-600 dark:text-amber-400">Cambios sin guardar</span>
|
|
141
|
+
<App.Button v-if="!isPending" text="Guardar" severity="primary" size="sm" :disabled="!isDirty" :loading="saving" @click="save" />
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div v-if="isPending" class="p-8 text-center text-sm text-muted-foreground">Cargando…</div>
|
|
145
|
+
|
|
146
|
+
<div v-else class="grid lg:grid-cols-[1fr_320px] gap-5 items-start">
|
|
147
|
+
<div class="space-y-5">
|
|
148
|
+
<div class="bg-card border border-card-line rounded-card p-5 space-y-4">
|
|
149
|
+
<p class="text-sm font-semibold text-foreground">Proveedor de envío</p>
|
|
150
|
+
<Forms.Select v-model="form.mailer" label="Proveedor" :clearable="false" :options="MAILERS" />
|
|
151
|
+
|
|
152
|
+
<div v-if="form.mailer === 'resend'" class="space-y-1.5">
|
|
153
|
+
<label class="block text-sm font-medium text-foreground">API key de Resend</label>
|
|
154
|
+
<div class="flex items-center gap-3">
|
|
155
|
+
<input
|
|
156
|
+
v-model="resendKeyInput"
|
|
157
|
+
type="password"
|
|
158
|
+
autocomplete="off"
|
|
159
|
+
:placeholder="resendKeySet ? '•••••••••• (guardada)' : 're_xxxxxxxxxxxx'"
|
|
160
|
+
class="flex-1 h-9 rounded-control border border-card-line bg-card text-sm text-foreground px-3 focus:outline-hidden focus:ring-2 focus:ring-primary/30"
|
|
161
|
+
/>
|
|
162
|
+
<button v-if="resendKeySet" type="button" class="text-xs text-red-500 hover:underline shrink-0" @click="clearResendKey">Eliminar</button>
|
|
163
|
+
</div>
|
|
164
|
+
<p class="text-xs text-muted-foreground">
|
|
165
|
+
Se guarda encriptada. Déjala en blanco para conservar la actual.
|
|
166
|
+
<span v-if="resendKeySet" class="text-emerald-600 dark:text-emerald-400">Hay una key configurada.</span>
|
|
167
|
+
<span v-else class="text-amber-600 dark:text-amber-400">Aún no hay key configurada.</span>
|
|
168
|
+
</p>
|
|
169
|
+
<p class="text-xs text-muted-foreground">El dominio del remitente debe estar verificado en Resend.</p>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<div class="bg-card border border-card-line rounded-card p-5 space-y-4">
|
|
174
|
+
<p class="text-sm font-semibold text-foreground">Remitente y marca</p>
|
|
175
|
+
<div class="grid sm:grid-cols-2 gap-4">
|
|
176
|
+
<Forms.Input v-model="form.from_name" maxlength="120" label="Nombre del remitente" placeholder="Mi plataforma" :error="errors.from_name" />
|
|
177
|
+
<Forms.Input v-model="form.from_address" label="Correo del remitente" type="email" placeholder="no-reply@tudominio.cl" :error="errors.from_address" />
|
|
178
|
+
</div>
|
|
179
|
+
<div class="space-y-2">
|
|
180
|
+
<Forms.Input v-model="form.logo_url" label="URL del logo (correos)" placeholder="https://…/logo.png" :error="errors.logo_url" />
|
|
181
|
+
<slot name="logo-picker" :set="(url: string) => (form.logo_url = url)" />
|
|
182
|
+
</div>
|
|
183
|
+
<div>
|
|
184
|
+
<label class="block text-sm font-medium text-foreground mb-1">Color de marca</label>
|
|
185
|
+
<div class="flex items-start gap-3">
|
|
186
|
+
<input v-model="form.brand_color" type="color" class="h-9 w-14 rounded-control border border-card-line bg-transparent p-1 cursor-pointer" />
|
|
187
|
+
<Forms.Input v-model="form.brand_color" class="w-40" placeholder="#6366f1" :error="errors.brand_color" />
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
<div class="bg-card border border-card-line rounded-card p-5 space-y-3">
|
|
193
|
+
<div class="flex items-center gap-2">
|
|
194
|
+
<IconSend class="size-4 text-muted-foreground" />
|
|
195
|
+
<p class="text-sm font-medium text-foreground">Enviar correo de prueba</p>
|
|
196
|
+
</div>
|
|
197
|
+
<p class="text-xs text-muted-foreground">Envía un correo de ejemplo con la configuración guardada.</p>
|
|
198
|
+
<div class="flex items-end gap-2">
|
|
199
|
+
<Forms.Input v-model="testEmail" label="Correo de destino" type="email" placeholder="tu@correo.com" :error="testEmailError" class="flex-1 min-w-0" @keydown.enter.prevent="sendTest" />
|
|
200
|
+
<App.Button text="Enviar prueba" :icon="IconSend" severity="secondary" size="sm" :loading="testing" :disabled="isDirty" @click="sendTest" />
|
|
201
|
+
</div>
|
|
202
|
+
<p v-if="isDirty" class="text-xs text-amber-600 dark:text-amber-400">Guarda los cambios antes de probar: la prueba usa la configuración guardada.</p>
|
|
203
|
+
<iframe v-if="sentHtml" :srcdoc="sentHtml" title="Correo de prueba enviado" sandbox="" class="w-full h-96 rounded-card border border-card-line bg-white" />
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<div class="space-y-2 lg:sticky lg:top-4">
|
|
208
|
+
<p class="text-sm font-medium text-foreground">Vista previa</p>
|
|
209
|
+
<Mail.BrandingPreview :platform="preview" title="¡La configuración de correo funciona!" body="Así se verán los correos de cuenta (invitación, recuperación, códigos)." action="Botón de ejemplo" />
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
</template>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
2
|
+
|
|
3
|
+
const calls: string[] = []
|
|
4
|
+
const api = {
|
|
5
|
+
get: vi.fn(async (url: string) => { calls.push(`GET ${url}`); return { data: [], unread: 0 } }),
|
|
6
|
+
patch: vi.fn(async (url: string) => { calls.push(`PATCH ${url}`) }),
|
|
7
|
+
delete: vi.fn(async (url: string) => { calls.push(`DELETE ${url}`) }),
|
|
8
|
+
}
|
|
9
|
+
const store = { setNotifications: vi.fn(), markRead: vi.fn(), markAllRead: vi.fn(), remove: vi.fn() }
|
|
10
|
+
vi.stubGlobal('useApi', () => api)
|
|
11
|
+
vi.stubGlobal('useNotificationsStore', () => store)
|
|
12
|
+
|
|
13
|
+
const { useNotifications } = await import('../useNotifications.js')
|
|
14
|
+
|
|
15
|
+
describe('useNotifications (campanita)', () => {
|
|
16
|
+
beforeEach(() => { calls.length = 0 })
|
|
17
|
+
|
|
18
|
+
it('por defecto habla con notifications (backoffice)', async () => {
|
|
19
|
+
const n = useNotifications()
|
|
20
|
+
await n.fetchNotifications({ all: 1 })
|
|
21
|
+
await n.markAsRead('a')
|
|
22
|
+
expect(calls).toEqual(['GET notifications', 'PATCH notifications/a/read'])
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('en platform usa el endpoint configurado', async () => {
|
|
26
|
+
const n = useNotifications({ base: '/platform/notifications/' })
|
|
27
|
+
await n.fetchNotifications()
|
|
28
|
+
await n.markAllAsRead()
|
|
29
|
+
await n.remove('b')
|
|
30
|
+
expect(calls).toEqual(['GET platform/notifications', 'PATCH platform/notifications/read-all', 'DELETE platform/notifications/b'])
|
|
31
|
+
})
|
|
32
|
+
})
|