featurely-site-manager 1.1.9 → 1.1.10

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
@@ -396,16 +396,21 @@ var _SiteManager = class _SiteManager {
396
396
  platform: typeof navigator !== "undefined" ? navigator.platform : void 0,
397
397
  appVersion: this.config.appVersion
398
398
  });
399
- const sentViaBeacon = typeof navigator !== "undefined" && typeof navigator.sendBeacon === "function" && navigator.sendBeacon(url, payload);
400
- if (!sentViaBeacon) {
401
- try {
402
- await fetch(url, {
403
- method: "POST",
404
- headers: { "Content-Type": "application/json" },
405
- body: payload
406
- });
407
- } catch (error) {
408
- console.error("Failed to send analytics event:", error);
399
+ try {
400
+ const res = await fetch(url, {
401
+ method: "POST",
402
+ headers: { "Content-Type": "application/json" },
403
+ body: payload,
404
+ keepalive: true
405
+ });
406
+ if (!res.ok) {
407
+ const body = await res.text().catch(() => "(unreadable)");
408
+ console.error(`[Featurely] Analytics event "${event.eventName}" rejected by server: ${res.status} ${res.statusText} \u2014 ${body}`);
409
+ }
410
+ } catch (fetchError) {
411
+ const sentViaBeacon = typeof navigator !== "undefined" && typeof navigator.sendBeacon === "function" && navigator.sendBeacon(url, payload);
412
+ if (!sentViaBeacon) {
413
+ console.error(`[Featurely] Failed to send analytics event "${event.eventName}":`, fetchError);
409
414
  }
410
415
  }
411
416
  }
package/dist/index.mjs CHANGED
@@ -361,16 +361,21 @@ var _SiteManager = class _SiteManager {
361
361
  platform: typeof navigator !== "undefined" ? navigator.platform : void 0,
362
362
  appVersion: this.config.appVersion
363
363
  });
364
- const sentViaBeacon = typeof navigator !== "undefined" && typeof navigator.sendBeacon === "function" && navigator.sendBeacon(url, payload);
365
- if (!sentViaBeacon) {
366
- try {
367
- await fetch(url, {
368
- method: "POST",
369
- headers: { "Content-Type": "application/json" },
370
- body: payload
371
- });
372
- } catch (error) {
373
- console.error("Failed to send analytics event:", error);
364
+ try {
365
+ const res = await fetch(url, {
366
+ method: "POST",
367
+ headers: { "Content-Type": "application/json" },
368
+ body: payload,
369
+ keepalive: true
370
+ });
371
+ if (!res.ok) {
372
+ const body = await res.text().catch(() => "(unreadable)");
373
+ console.error(`[Featurely] Analytics event "${event.eventName}" rejected by server: ${res.status} ${res.statusText} \u2014 ${body}`);
374
+ }
375
+ } catch (fetchError) {
376
+ const sentViaBeacon = typeof navigator !== "undefined" && typeof navigator.sendBeacon === "function" && navigator.sendBeacon(url, payload);
377
+ if (!sentViaBeacon) {
378
+ console.error(`[Featurely] Failed to send analytics event "${event.eventName}":`, fetchError);
374
379
  }
375
380
  }
376
381
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "featurely-site-manager",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
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",