This gist provides notifications for the Epicshop platform. Notifications are loaded on demand and shown to users based on specific criteria.
Notifications are defined in the notifications.json5
file. Each notification
is an object with the following properties:
id
: A unique string identifier for the notification.title
: The notification title.message
: The notification message.type
: The notification type (info
,warning
, ordanger
).link
(optional): A URL for users to learn more.expiresAt
(optional): A date after which the notification will no longer be shown.products
(optional): An array of product filters (see below).
The products
field allows you to target notifications to specific products or
product slugs. If the products
field is omitted, the notification will be
shown to all users. If present, it should be an array of objects with the
following structure:
products: [
{
host: 'www.epicai.pro', // required: the product host
slug: 'mcp-fundamentals', // optional: the product slug
},
// ...more product filters
]
How filtering works:
- If
products
is not specified, the notification is shown to all users. - If
products
is specified, the notification is only shown if the current product'shost
matches one of thehost
values in the array. - If a
slug
is provided in a product filter, the notification is only shown if both thehost
andslug
match the current product. - If a product filter only specifies
host
(noslug
), the notification is shown to all users of that host, regardless of slug.
Example:
{
id: 'new-feature',
title: 'Check out our new feature!',
message: 'We just launched something awesome.',
type: 'info',
products: [
{ host: 'www.epicai.pro' }, // All users on epicai.pro
{ host: 'another.host.com', slug: 'special-course' }, // Only users on another.host.com/special-course
],
expiresAt: null, // never expire
}
- Notifications are fetched from this gist and parsed as JSON5.
- Expired notifications (where
expiresAt
is in the past) are filtered out. - Product filtering is applied as described above.
- Users can mute notifications, which hides them in the future.