@mintlify/cli 4.0.1228 → 4.0.1230

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.
@@ -1,146 +0,0 @@
1
- import { authenticatedFetch } from '../authenticatedFetch.js';
2
- import { API_URL } from '../constants.js';
3
- import type {
4
- BucketThreadsResponse,
5
- BucketsResponse,
6
- ConversationResponse,
7
- FeedbackByPageResponse,
8
- FeedbackResponse,
9
- KpiResponse,
10
- SearchResponse,
11
- ViewsResponse,
12
- VisitorsResponse,
13
- } from './types.js';
14
-
15
- type Params = Record<string, string | number | undefined>;
16
-
17
- async function request<T>(path: string, params: Params = {}): Promise<T> {
18
- const url = new URL(`${API_URL}/api/cli/analytics${path}`);
19
- for (const [key, value] of Object.entries(params)) {
20
- if (value !== undefined) url.searchParams.set(key, String(value));
21
- }
22
-
23
- const res = await authenticatedFetch(url.toString(), {
24
- headers: { Accept: 'application/json' },
25
- });
26
-
27
- if (!res.ok) {
28
- const body = await res.text().catch(() => '');
29
- throw new Error(`API error (${res.status}): ${body || res.statusText}`);
30
- }
31
-
32
- return res.json() as Promise<T>;
33
- }
34
-
35
- export function getKpi(
36
- opts: {
37
- dateFrom: string;
38
- dateTo: string;
39
- page?: string;
40
- },
41
- subdomain?: string
42
- ) {
43
- return request<KpiResponse>('/kpi', { ...opts, subdomain });
44
- }
45
-
46
- export function getFeedback(
47
- opts: {
48
- dateFrom: string;
49
- dateTo: string;
50
- limit?: number;
51
- cursor?: string;
52
- source?: string;
53
- status?: string;
54
- },
55
- subdomain?: string
56
- ) {
57
- return request<FeedbackResponse>('/feedback', { ...opts, subdomain });
58
- }
59
-
60
- export function getFeedbackByPage(
61
- opts: {
62
- dateFrom: string;
63
- dateTo: string;
64
- limit?: number;
65
- source?: string;
66
- status?: string;
67
- },
68
- subdomain?: string
69
- ) {
70
- return request<FeedbackByPageResponse>('/feedback/by-page', { ...opts, subdomain });
71
- }
72
-
73
- export function getConversations(
74
- opts: {
75
- dateFrom: string;
76
- dateTo: string;
77
- limit?: number;
78
- cursor?: string;
79
- },
80
- subdomain?: string
81
- ) {
82
- return request<ConversationResponse>('/assistant', { ...opts, subdomain });
83
- }
84
-
85
- export function getSearches(
86
- opts: {
87
- dateFrom: string;
88
- dateTo: string;
89
- limit?: number;
90
- cursor?: string;
91
- },
92
- subdomain?: string
93
- ) {
94
- return request<SearchResponse>('/searches', { ...opts, subdomain });
95
- }
96
-
97
- export function getViews(
98
- opts: {
99
- dateFrom: string;
100
- dateTo: string;
101
- limit?: number;
102
- offset?: number;
103
- },
104
- subdomain?: string
105
- ) {
106
- return request<ViewsResponse>('/views', { ...opts, subdomain });
107
- }
108
-
109
- export function getVisitors(
110
- opts: {
111
- dateFrom: string;
112
- dateTo: string;
113
- limit?: number;
114
- offset?: number;
115
- },
116
- subdomain?: string
117
- ) {
118
- return request<VisitorsResponse>('/visitors', { ...opts, subdomain });
119
- }
120
-
121
- export function getBuckets(
122
- opts: {
123
- dateFrom?: string;
124
- dateTo?: string;
125
- topK?: number;
126
- },
127
- subdomain?: string
128
- ) {
129
- return request<BucketsResponse>('/conversations/buckets', { ...opts, subdomain });
130
- }
131
-
132
- export function getBucketThreads(
133
- bucketId: string,
134
- opts: {
135
- dateFrom?: string;
136
- dateTo?: string;
137
- limit?: number;
138
- cursor?: string;
139
- },
140
- subdomain?: string
141
- ) {
142
- return request<BucketThreadsResponse>(`/conversations/buckets/${encodeURIComponent(bucketId)}`, {
143
- ...opts,
144
- subdomain,
145
- });
146
- }
@@ -1,13 +0,0 @@
1
- export function num(n: number): string {
2
- return n.toLocaleString('en-US');
3
- }
4
-
5
- export function pct(n: number, total: number): string {
6
- if (total === 0) return '\u2014';
7
- return ((n / total) * 100).toFixed(1) + '%';
8
- }
9
-
10
- export function truncate(s: string, max: number): string {
11
- if (s.length <= max) return s;
12
- return s.slice(0, max - 1) + '\u2026';
13
- }