@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.
@@ -3317,7 +3317,7 @@ function getStatsQueryOptions({
3317
3317
  queryKey: ["integrations", "plausible", url, dimensions, metrics],
3318
3318
  queryFn: async () => {
3319
3319
  const fetchApi = getBoundFetch();
3320
- const response = await fetchApi(`https://ecency.com/api/stats`, {
3320
+ const response = await fetchApi(`${CONFIG.privateApiHost}/api/stats`, {
3321
3321
  method: "POST",
3322
3322
  body: JSON.stringify({
3323
3323
  metrics,
@@ -4524,7 +4524,16 @@ async function parseJsonResponse3(response) {
4524
4524
  error.data = errorData;
4525
4525
  throw error;
4526
4526
  }
4527
- return await response.json();
4527
+ const text = await response.text();
4528
+ if (!text || text.trim() === "") {
4529
+ return "";
4530
+ }
4531
+ try {
4532
+ return JSON.parse(text);
4533
+ } catch (e) {
4534
+ console.warn("[SDK] Failed to parse JSON response:", e, "Response:", text);
4535
+ return "";
4536
+ }
4528
4537
  }
4529
4538
  async function signUp(username, email, referral) {
4530
4539
  const fetchApi = getBoundFetch();