@bebranded/bb-contents 1.0.47-beta → 1.0.48-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.
Files changed (2) hide show
  1. package/bb-contents.js +4 -21
  2. 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.47-beta
4
+ * @version 1.0.48-beta
5
5
  * @author BeBranded
6
6
  * @license MIT
7
7
  * @website https://www.bebranded.xyz
@@ -22,8 +22,8 @@
22
22
 
23
23
  // Configuration
24
24
  const config = {
25
- version: '1.0.47-beta',
26
- debug: true, // Activé temporairement pour debug
25
+ version: '1.0.48-beta',
26
+ debug: false, // Debug désactivé
27
27
  prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
28
28
  youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
29
29
  i18n: {
@@ -175,14 +175,12 @@
175
175
  checkYouTubeConfig: function() {
176
176
  // Vérifier si la configuration a été définie après le chargement
177
177
  if (this.config.youtubeEndpoint) {
178
- console.log('[DEBUG] YouTube endpoint found:', this.config.youtubeEndpoint);
179
178
  return true;
180
179
  }
181
180
 
182
181
  // Vérifier dans l'objet temporaire
183
182
  if (window._bbContentsConfig && window._bbContentsConfig.youtubeEndpoint) {
184
183
  this.config.youtubeEndpoint = window._bbContentsConfig.youtubeEndpoint;
185
- console.log('[DEBUG] YouTube endpoint found in temp config:', this.config.youtubeEndpoint);
186
184
  return true;
187
185
  }
188
186
 
@@ -633,7 +631,6 @@
633
631
  this.cleanCache();
634
632
 
635
633
  const elements = scope.querySelectorAll('[bb-youtube-channel]');
636
- console.log('[DEBUG] YouTube elements found:', elements.length);
637
634
  if (elements.length === 0) return;
638
635
 
639
636
  // Module détecté: youtube
@@ -666,7 +663,6 @@
666
663
  // Vérifier la configuration au moment de l'initialisation
667
664
  const endpoint = bbContents.checkYouTubeConfig() ? bbContents.config.youtubeEndpoint : null;
668
665
 
669
- console.log('[DEBUG] YouTube element config:', {channelId, videoCount, allowShorts, language, endpoint});
670
666
 
671
667
  if (!channelId) {
672
668
  return;
@@ -678,7 +674,6 @@
678
674
  const retries = parseInt(retryCount);
679
675
 
680
676
  if (retries < 50) { // 50 * 100ms = 5 secondes max
681
- console.log('[DEBUG] YouTube endpoint not configured yet, waiting... (attempt', retries + 1, ')');
682
677
  element.innerHTML = '<div style="padding: 20px; text-align: center; color: #6b7280;">Configuration YouTube en cours...</div>';
683
678
  element.setAttribute('data-youtube-retry-count', (retries + 1).toString());
684
679
 
@@ -689,7 +684,6 @@
689
684
  return;
690
685
  } else {
691
686
  // Timeout après 5 secondes
692
- console.log('[DEBUG] YouTube endpoint configuration timeout');
693
687
  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 &lt;head&gt; :<br><code style="display: block; background: #f3f4f6; padding: 10px; margin: 10px 0; border-radius: 4px; font-family: monospace;">&lt;script&gt;<br>bbContents.config.youtubeEndpoint = \'votre-worker-url\';<br>&lt;/script&gt;</code></div>';
694
688
  return;
695
689
  }
@@ -725,7 +719,6 @@
725
719
 
726
720
  if (cachedData && cachedData.value) {
727
721
  // Données YouTube récupérées du cache (économie API)
728
- console.log('[DEBUG] Using cached YouTube data for element');
729
722
  this.generateYouTubeFeed(container, template, cachedData.value, allowShorts, language);
730
723
  return;
731
724
  }
@@ -733,7 +726,6 @@
733
726
  // Vérifier si un appel API est déjà en cours pour cette clé
734
727
  const loadingKey = `loading_${cacheKey}`;
735
728
  if (window[loadingKey]) {
736
- console.log('[DEBUG] API call already in progress, waiting...');
737
729
  // Attendre que l'autre appel se termine
738
730
  const checkLoading = () => {
739
731
  if (!window[loadingKey]) {
@@ -759,17 +751,14 @@
759
751
  container.innerHTML = '<div style="padding: 20px; text-align: center; color: #6b7280;">Chargement des vidéos YouTube...</div>';
760
752
 
761
753
  // Appeler l'API via le Worker
762
- console.log('[DEBUG] Fetching YouTube data from:', `${endpoint}?channelId=${channelId}&maxResults=${videoCount}&allowShorts=${allowShorts}`);
763
754
  fetch(`${endpoint}?channelId=${channelId}&maxResults=${videoCount}&allowShorts=${allowShorts}`)
764
755
  .then(response => {
765
- console.log('[DEBUG] YouTube API response status:', response.status);
766
756
  if (!response.ok) {
767
757
  throw new Error(`HTTP ${response.status}`);
768
758
  }
769
759
  return response.json();
770
760
  })
771
761
  .then(data => {
772
- console.log('[DEBUG] YouTube API data received:', data);
773
762
  if (data.error) {
774
763
  throw new Error(data.error.message || 'Erreur API YouTube');
775
764
  }
@@ -784,7 +773,7 @@
784
773
  window[loadingKey] = false;
785
774
  })
786
775
  .catch(error => {
787
- console.error('[DEBUG] YouTube API error:', error);
776
+ console.error('Erreur API YouTube:', error);
788
777
  // Erreur dans le module youtube
789
778
 
790
779
  // Libérer le verrou en cas d'erreur
@@ -795,12 +784,10 @@
795
784
  if (expiredCache) {
796
785
  try {
797
786
  const cachedData = JSON.parse(expiredCache);
798
- console.log('[DEBUG] Using expired cache:', cachedData);
799
787
  // Utilisation du cache expiré en cas d'erreur API
800
788
  this.generateYouTubeFeed(container, template, cachedData.value, allowShorts, language);
801
789
  return;
802
790
  } catch (e) {
803
- console.error('[DEBUG] Cache parsing error:', e);
804
791
  // Ignorer les erreurs de parsing
805
792
  }
806
793
  }
@@ -810,16 +797,13 @@
810
797
  },
811
798
 
812
799
  generateYouTubeFeed: function(container, template, data, allowShorts, language = 'fr') {
813
- console.log('[DEBUG] generateYouTubeFeed called with data:', data);
814
800
  if (!data || !data.items || data.items.length === 0) {
815
- console.log('[DEBUG] No videos found in data or data is undefined');
816
801
  container.innerHTML = '<div style="padding: 20px; text-align: center; color: #6b7280;">Aucune vidéo trouvée</div>';
817
802
  return;
818
803
  }
819
804
 
820
805
  // Les vidéos sont déjà filtrées par l'API YouTube selon allowShorts
821
806
  let videos = data.items;
822
- console.log('[DEBUG] Processing', videos.length, 'videos');
823
807
  // Vidéos reçues de l'API
824
808
 
825
809
  // Vider le conteneur (en préservant les éléments marquee)
@@ -1023,7 +1007,6 @@
1023
1007
  window.configureYouTube = function(endpoint) {
1024
1008
  if (bbContents) {
1025
1009
  bbContents.config.youtubeEndpoint = endpoint;
1026
- console.log('[DEBUG] YouTube endpoint configured globally:', endpoint);
1027
1010
  // Réinitialiser les modules YouTube
1028
1011
  bbContents.reinit();
1029
1012
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.47-beta",
3
+ "version": "1.0.48-beta",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {