@bebranded/bb-contents 1.0.42-beta → 1.0.43-beta
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/bb-contents.js +24 -5
- package/package.json +1 -1
package/bb-contents.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* BeBranded Contents
|
|
3
3
|
* Contenus additionnels français pour Webflow
|
|
4
|
-
* @version 1.0.
|
|
4
|
+
* @version 1.0.43-beta
|
|
5
5
|
* @author BeBranded
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @website https://www.bebranded.xyz
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
// Configuration
|
|
19
19
|
const config = {
|
|
20
|
-
version: '1.0.
|
|
20
|
+
version: '1.0.43-beta',
|
|
21
21
|
debug: true, // Activé temporairement pour debug
|
|
22
22
|
prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
|
|
23
23
|
youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
|
|
@@ -617,6 +617,8 @@
|
|
|
617
617
|
const videoCount = bbContents._getAttr(element, 'bb-youtube-video-count') || '10';
|
|
618
618
|
const allowShorts = bbContents._getAttr(element, 'bb-youtube-allow-shorts') === 'true';
|
|
619
619
|
const language = bbContents._getAttr(element, 'bb-youtube-language') || 'fr';
|
|
620
|
+
|
|
621
|
+
// Vérifier la configuration au moment de l'initialisation
|
|
620
622
|
const endpoint = bbContents.config.youtubeEndpoint;
|
|
621
623
|
|
|
622
624
|
console.log('[DEBUG] YouTube config:', {channelId, videoCount, allowShorts, language, endpoint});
|
|
@@ -627,9 +629,26 @@
|
|
|
627
629
|
}
|
|
628
630
|
|
|
629
631
|
if (!endpoint) {
|
|
630
|
-
//
|
|
631
|
-
|
|
632
|
-
|
|
632
|
+
// Attendre que la configuration soit définie (max 5 secondes)
|
|
633
|
+
const retryCount = element.getAttribute('data-youtube-retry-count') || '0';
|
|
634
|
+
const retries = parseInt(retryCount);
|
|
635
|
+
|
|
636
|
+
if (retries < 50) { // 50 * 100ms = 5 secondes max
|
|
637
|
+
console.log('[DEBUG] YouTube endpoint not configured yet, waiting... (attempt', retries + 1, ')');
|
|
638
|
+
element.innerHTML = '<div style="padding: 20px; text-align: center; color: #6b7280;">Configuration YouTube en cours...</div>';
|
|
639
|
+
element.setAttribute('data-youtube-retry-count', (retries + 1).toString());
|
|
640
|
+
|
|
641
|
+
// Réessayer dans 100ms
|
|
642
|
+
setTimeout(() => {
|
|
643
|
+
this.init(scope);
|
|
644
|
+
}, 100);
|
|
645
|
+
return;
|
|
646
|
+
} else {
|
|
647
|
+
// Timeout après 5 secondes
|
|
648
|
+
console.log('[DEBUG] YouTube endpoint configuration timeout');
|
|
649
|
+
element.innerHTML = '<div style="padding: 20px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; color: #dc2626;"><strong>Configuration YouTube manquante</strong><br>Ajoutez dans le <head> :<br><code style="display: block; background: #f3f4f6; padding: 10px; margin: 10px 0; border-radius: 4px; font-family: monospace;"><script><br>bbContents.config.youtubeEndpoint = \'votre-worker-url\';<br></script></code></div>';
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
633
652
|
}
|
|
634
653
|
|
|
635
654
|
// Chercher le template pour une vidéo (directement dans l'élément ou dans un conteneur)
|