PluginProbe
Extendify / 3.1.5
Extendify v3.1.5
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / src / Notifications / slots.js

slots.js in Extendify 3.1.5, at src/Notifications/slots.js

39 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { Bar } from './templates/Bar';
2 import { Card } from './templates/Card';
3 import { Pill } from './templates/Pill';
4
5 export const SLOTS = {
6 ADMIN_DASHBOARD: 'admin-dashboard',
7 ADMIN_OTHERS: 'admin-others',
8 ADMIN_ASSIST: 'admin-assist',
9 AGENT_CHAT: 'agent-chat',
10 FRONTEND_BOTTOM: 'frontend-bottom',
11 FRONTEND_TOPBAR: 'frontend-topbar',
12 };
13
14 // agent-chat is null because the Agent renders it as a chat suggestion.
15 const TEMPLATES = {
16 [SLOTS.ADMIN_DASHBOARD]: Card,
17 [SLOTS.ADMIN_OTHERS]: Card,
18 [SLOTS.ADMIN_ASSIST]: Card,
19 [SLOTS.AGENT_CHAT]: null,
20 [SLOTS.FRONTEND_BOTTOM]: Bar,
21 [SLOTS.FRONTEND_TOPBAR]: Pill,
22 };
23
24 export const templateFor = (slot) => TEMPLATES[slot] ?? null;
25
26 // Deciding this inside Pill would count a view for a pill that never rendered.
27 const REQUIREMENTS = {
28 [SLOTS.FRONTEND_TOPBAR]: (notification, href) =>
29 Boolean(notification['cta-label'] && href),
30 };
31
32 export const fillsSlot = (slot, notification, href) =>
33 REQUIREMENTS[slot]?.(notification, href) ?? true;
34
35 // The pill stays as the persistent reminder after the bar is dismissed.
36 const DISMISSAL_EXEMPT = [SLOTS.FRONTEND_TOPBAR];
37
38 export const ignoresDismissal = (slot) => DISMISSAL_EXEMPT.includes(slot);
39