diff --git a/src/composables/useNotifications.js b/src/composables/useNotifications.js index e49c8a9..dccfc4d 100644 --- a/src/composables/useNotifications.js +++ b/src/composables/useNotifications.js @@ -33,6 +33,15 @@ export function useNotifications() { let ownerId = null; let pollTimer = null; + // Label curto do botão do toast baseado no deeplink + function defaultActionLabel(deeplink) { + if (!deeplink) return null; + if (deeplink.includes('creditos-whatsapp')) return 'Ir pra loja'; + if (deeplink.includes('whatsapp-pessoal')) return 'Ver conexão'; + if (deeplink.includes('whatsapp-oficial')) return 'Ver canal oficial'; + return 'Abrir'; + } + function showToastFor(item) { if (item?.type !== 'system_alert') return; if (alertedIds.has(item.id)) return; @@ -43,7 +52,12 @@ export function useNotifications() { summary: payload.title || 'Alerta do sistema', detail: payload.detail || '', life: STICKY_TOAST_LIFE_MS, - closable: true + closable: true, + group: 'system-alerts', + data: { + deeplink: payload.deeplink, + actionLabel: payload.actionLabel || defaultActionLabel(payload.deeplink) + } }); } diff --git a/src/layout/AppLayout.vue b/src/layout/AppLayout.vue index 914c7a3..fecf9d3 100644 --- a/src/layout/AppLayout.vue +++ b/src/layout/AppLayout.vue @@ -17,7 +17,18 @@