@supalytics/cli 0.3.3 → 0.3.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/api.ts +6 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supalytics/cli",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "CLI for Supalytics web analytics",
5
5
  "type": "module",
6
6
  "bin": {
package/src/api.ts CHANGED
@@ -75,7 +75,7 @@ export async function query(
75
75
  Authorization: `Bearer ${apiKey}`,
76
76
  "Content-Type": "application/json",
77
77
  },
78
- body: JSON.stringify(request),
78
+ body: JSON.stringify({ ...request, domain: site }),
79
79
  });
80
80
 
81
81
  if (!response.ok) {
@@ -177,7 +177,7 @@ export async function listEvents(
177
177
  );
178
178
  }
179
179
 
180
- const params = new URLSearchParams({ period, limit: String(limit) });
180
+ const params = new URLSearchParams({ period, limit: String(limit), domain: site });
181
181
  if (isDev) {
182
182
  params.set("is_dev", "true");
183
183
  }
@@ -208,7 +208,7 @@ export async function getEventProperties(
208
208
  throw new Error(`Not authenticated. Run \`supalytics login\` first.`);
209
209
  }
210
210
 
211
- const params = new URLSearchParams({ period });
211
+ const params = new URLSearchParams({ period, domain: site });
212
212
  if (isDev) {
213
213
  params.set("is_dev", "true");
214
214
  }
@@ -247,6 +247,7 @@ export async function getPropertyBreakdown(
247
247
  period,
248
248
  limit: String(limit),
249
249
  include_revenue: String(includeRevenue),
250
+ domain: site,
250
251
  });
251
252
  if (isDev) {
252
253
  params.set("is_dev", "true");
@@ -311,12 +312,11 @@ export async function getRealtime(site: string, isDev: boolean = false): Promise
311
312
  );
312
313
  }
313
314
 
314
- const params = new URLSearchParams();
315
+ const params = new URLSearchParams({ domain: site });
315
316
  if (isDev) {
316
317
  params.set("is_dev", "true");
317
318
  }
318
- const url = params.toString() ? `${API_BASE}/v1/realtime?${params}` : `${API_BASE}/v1/realtime`;
319
- const response = await fetch(url, {
319
+ const response = await fetch(`${API_BASE}/v1/realtime?${params}`, {
320
320
  headers: { Authorization: `Bearer ${apiKey}` },
321
321
  });
322
322