Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ The following will list basic installation instructions, assuming you're already
- Save the newly created overlay
- Share your StreamElements Account ID and JWT Token with your coach at Ulule to finish activating the widget

⚠️ If you were using the widget prior to July 2026, you must copy the new `index.html` content into your StreamElements **HTML** tab AND the new `fields.json` content into your **Fields** tab. Older installs still load the previous direct socket script and will not receive the new broadcast events correctly. The external HTML/JS cannot save those fields automatically.
⚠️ If you were using the widget prior to August 2026, you must copy the new `index.html` content into your StreamElements **HTML** tab AND the new `fields.json` content into your **Fields** tab. Older installs still load the previous direct socket script and will not receive the new broadcast events correctly. The external HTML/JS cannot save those fields automatically.

August 2026 update note:

- You can now configure the alert display duration.
- You can now test the alert using a button in the Notification settings.

### Advanced configuration:

Expand Down
14 changes: 14 additions & 0 deletions src/alert/fields.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{
"notificationScreenTime": {
"label": "Temps d'affichage de la notification en secondes",
"type": "number",
"value": 3,
"min": 1,
"step": 1,
"group": "Notification"
},
"notificationSoundEnabled": {
"label": "Son de notification",
"type": "checkbox",
Expand All @@ -10,6 +18,12 @@
"type": "sound-input",
"group": "Notification"
},
"testNotification": {
"label": "Tester la notification",
"type": "button",
"value": "test",
"group": "Notification"
},
"enableFreeTierAlert": {
"label": "Alerte lors d'un abonnement gratuit",
"type": "checkbox",
Expand Down
41 changes: 40 additions & 1 deletion src/alert/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,44 @@ window.addEventListener('onWidgetLoad', (obj) => {
function handleEventReceived(obj = {}) {
const detail = obj.detail || {}

const listener = obj.detail.listener
const data = obj.detail.event

if (data.listener === 'widget-button') {
if (data.field === 'testNotification') {
const emulated = new CustomEvent('onEventReceived', {
detail: {
listener: 'order',
event: {
currency: '€',
order_total: '35',
project: {
lang: 'fr',
title: {
fr: 'Un chouette projet',
en: 'A nice project',
},
},
rewards: [
{
price: '30',
title: {
fr: 'Le pack découverte',
en: 'Discovery pack',
},
},
],
tip: '5',
user: {
user_name: 'Jane Doe',
},
},
},
})
window.dispatchEvent(emulated)
}
}

if (detail.listener !== 'order') {
return
}
Expand Down Expand Up @@ -161,7 +199,7 @@ window.addEventListener('onWidgetLoad', (obj) => {

setTimeout(() => {
element.remove()
}, 5000)
}, settings.notificationScreenTime * 1000)
}

function logo() {
Expand Down Expand Up @@ -196,6 +234,7 @@ function normalizeSettings(fieldData) {
highlightFontWeight: fieldData.highlightFontWeight || '700',
notificationSound: fieldData.notificationSound,
notificationSoundEnabled: booleanOrDefault(fieldData.notificationSoundEnabled, false),
notificationScreenTime: numberOrDefault(fieldData.notificationScreenTime, 3),
}
}

Expand Down