featurely-site-manager 1.1.2 → 1.1.3

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
@@ -280,7 +280,22 @@ var _SiteManager = class _SiteManager {
280
280
  }
281
281
  );
282
282
  if (!response.ok) {
283
- throw new Error(`Failed to fetch site configuration: ${response.statusText}`);
283
+ const errorData = await response.json().catch(() => ({}));
284
+ const message = errorData.error || response.statusText;
285
+ if (response.status === 401) {
286
+ console.error(
287
+ `[Featurely] Invalid or missing API key. ${message}
288
+ \u2192 Check your API key at https://www.featurely.no/dashboard/settings`
289
+ );
290
+ this.stopPolling();
291
+ } else if (response.status === 403) {
292
+ console.error(
293
+ `[Featurely] Permission denied. ${message}
294
+ \u2192 Ensure your API key has the required permissions at https://www.featurely.no/dashboard/settings`
295
+ );
296
+ this.stopPolling();
297
+ }
298
+ throw new Error(`Failed to fetch site configuration: ${message}`);
284
299
  }
285
300
  const newConfig = await response.json();
286
301
  const configChanged = JSON.stringify(newConfig) !== JSON.stringify(this.siteConfig);
@@ -365,7 +380,8 @@ var _SiteManager = class _SiteManager {
365
380
  userId: this.config.userId,
366
381
  sessionId: this.sessionId,
367
382
  userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
368
- platform: typeof navigator !== "undefined" ? navigator.platform : void 0
383
+ platform: typeof navigator !== "undefined" ? navigator.platform : void 0,
384
+ appVersion: this.config.appVersion
369
385
  })
370
386
  }
371
387
  );
package/dist/index.mjs CHANGED
@@ -245,7 +245,22 @@ var _SiteManager = class _SiteManager {
245
245
  }
246
246
  );
247
247
  if (!response.ok) {
248
- throw new Error(`Failed to fetch site configuration: ${response.statusText}`);
248
+ const errorData = await response.json().catch(() => ({}));
249
+ const message = errorData.error || response.statusText;
250
+ if (response.status === 401) {
251
+ console.error(
252
+ `[Featurely] Invalid or missing API key. ${message}
253
+ \u2192 Check your API key at https://www.featurely.no/dashboard/settings`
254
+ );
255
+ this.stopPolling();
256
+ } else if (response.status === 403) {
257
+ console.error(
258
+ `[Featurely] Permission denied. ${message}
259
+ \u2192 Ensure your API key has the required permissions at https://www.featurely.no/dashboard/settings`
260
+ );
261
+ this.stopPolling();
262
+ }
263
+ throw new Error(`Failed to fetch site configuration: ${message}`);
249
264
  }
250
265
  const newConfig = await response.json();
251
266
  const configChanged = JSON.stringify(newConfig) !== JSON.stringify(this.siteConfig);
@@ -330,7 +345,8 @@ var _SiteManager = class _SiteManager {
330
345
  userId: this.config.userId,
331
346
  sessionId: this.sessionId,
332
347
  userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
333
- platform: typeof navigator !== "undefined" ? navigator.platform : void 0
348
+ platform: typeof navigator !== "undefined" ? navigator.platform : void 0,
349
+ appVersion: this.config.appVersion
334
350
  })
335
351
  }
336
352
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "featurely-site-manager",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
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",