@ecency/sdk 1.5.2 → 1.5.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.
@@ -3342,7 +3342,7 @@ function getStatsQueryOptions({
3342
3342
  queryKey: ["integrations", "plausible", url, dimensions, metrics],
3343
3343
  queryFn: async () => {
3344
3344
  const fetchApi = getBoundFetch();
3345
- const response = await fetchApi(`https://ecency.com/api/stats`, {
3345
+ const response = await fetchApi(`${CONFIG.privateApiHost}/api/stats`, {
3346
3346
  method: "POST",
3347
3347
  body: JSON.stringify({
3348
3348
  metrics,
@@ -4549,7 +4549,16 @@ async function parseJsonResponse3(response) {
4549
4549
  error.data = errorData;
4550
4550
  throw error;
4551
4551
  }
4552
- return await response.json();
4552
+ const text = await response.text();
4553
+ if (!text || text.trim() === "") {
4554
+ return "";
4555
+ }
4556
+ try {
4557
+ return JSON.parse(text);
4558
+ } catch (e) {
4559
+ console.warn("[SDK] Failed to parse JSON response:", e, "Response:", text);
4560
+ return "";
4561
+ }
4553
4562
  }
4554
4563
  async function signUp(username, email, referral) {
4555
4564
  const fetchApi = getBoundFetch();