featurely-site-manager 1.1.3 → 1.1.4

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/dist/index.js CHANGED
@@ -321,13 +321,22 @@ var _SiteManager = class _SiteManager {
321
321
  } catch (error) {
322
322
  this.consecutiveFetchFailures++;
323
323
  if (this.consecutiveFetchFailures <= _SiteManager.MAX_CONSECUTIVE_FAILURES) {
324
- console.error("Featurely Site Manager: Failed to fetch configuration", error);
324
+ const isNetworkError = error instanceof TypeError && (error.message.includes("NetworkError") || error.message.includes("Failed to fetch") || error.message.includes("fetch"));
325
+ if (isNetworkError) {
326
+ console.error(
327
+ `[Featurely] Network error \u2014 request to Featurely was blocked.
328
+ \u2192 If your site has a Content-Security-Policy, add 'https://www.featurely.no' to the connect-src directive.
329
+ Example: connect-src 'self' https://www.featurely.no ...`
330
+ );
331
+ } else {
332
+ console.error("Featurely Site Manager: Failed to fetch configuration", error);
333
+ }
325
334
  if (this.config.onError && error instanceof Error) {
326
335
  this.config.onError(error);
327
336
  }
328
337
  } else if (this.consecutiveFetchFailures === _SiteManager.MAX_CONSECUTIVE_FAILURES + 1) {
329
338
  console.error(
330
- `Featurely Site Manager: Silencing repeated fetch errors after ${_SiteManager.MAX_CONSECUTIVE_FAILURES} failures. Check your apiUrl configuration.`
339
+ `Featurely Site Manager: Silencing repeated fetch errors after ${_SiteManager.MAX_CONSECUTIVE_FAILURES} failures. Check your apiUrl and Content-Security-Policy configuration.`
331
340
  );
332
341
  }
333
342
  }
package/dist/index.mjs CHANGED
@@ -286,13 +286,22 @@ var _SiteManager = class _SiteManager {
286
286
  } catch (error) {
287
287
  this.consecutiveFetchFailures++;
288
288
  if (this.consecutiveFetchFailures <= _SiteManager.MAX_CONSECUTIVE_FAILURES) {
289
- console.error("Featurely Site Manager: Failed to fetch configuration", error);
289
+ const isNetworkError = error instanceof TypeError && (error.message.includes("NetworkError") || error.message.includes("Failed to fetch") || error.message.includes("fetch"));
290
+ if (isNetworkError) {
291
+ console.error(
292
+ `[Featurely] Network error \u2014 request to Featurely was blocked.
293
+ \u2192 If your site has a Content-Security-Policy, add 'https://www.featurely.no' to the connect-src directive.
294
+ Example: connect-src 'self' https://www.featurely.no ...`
295
+ );
296
+ } else {
297
+ console.error("Featurely Site Manager: Failed to fetch configuration", error);
298
+ }
290
299
  if (this.config.onError && error instanceof Error) {
291
300
  this.config.onError(error);
292
301
  }
293
302
  } else if (this.consecutiveFetchFailures === _SiteManager.MAX_CONSECUTIVE_FAILURES + 1) {
294
303
  console.error(
295
- `Featurely Site Manager: Silencing repeated fetch errors after ${_SiteManager.MAX_CONSECUTIVE_FAILURES} failures. Check your apiUrl configuration.`
304
+ `Featurely Site Manager: Silencing repeated fetch errors after ${_SiteManager.MAX_CONSECUTIVE_FAILURES} failures. Check your apiUrl and Content-Security-Policy configuration.`
296
305
  );
297
306
  }
298
307
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "featurely-site-manager",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Complete site management SDK for maintenance mode, status messages, feature flags, version checking, and analytics",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",