flowgrid-sdk 1.0.0
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/LICENSE +21 -0
- package/dist/browser.d.ts +119 -0
- package/dist/flowgrid.min.js +2 -0
- package/dist/flowgrid.min.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/client/enterprise-ftrpc.d.ts +51 -0
- package/dist/lib/client/ftrpc.d.ts +43 -0
- package/dist/lib/client/modules.d.ts +104 -0
- package/dist/lib/features/analytics/attribution.d.ts +257 -0
- package/dist/lib/features/analytics/events.d.ts +304 -0
- package/dist/lib/features/analytics/funnels.d.ts +291 -0
- package/dist/lib/features/analytics/heatmaps.d.ts +247 -0
- package/dist/lib/features/analytics/identify.d.ts +273 -0
- package/dist/lib/features/analytics/index.d.ts +22 -0
- package/dist/lib/features/analytics/page-views.d.ts +250 -0
- package/dist/lib/features/analytics/performance.d.ts +281 -0
- package/dist/lib/features/analytics/retention.d.ts +294 -0
- package/dist/lib/features/analytics/sessions.d.ts +277 -0
- package/dist/lib/features/core/activation.d.ts +239 -0
- package/dist/lib/features/core/experiment.d.ts +286 -0
- package/dist/lib/features/core/feature-flag.d.ts +264 -0
- package/dist/lib/features/core/index.d.ts +14 -0
- package/dist/lib/features/core/track-feature.d.ts +220 -0
- package/dist/lib/features/core/track-prompt.d.ts +247 -0
- package/dist/lib/features/ecommerce/cart.d.ts +298 -0
- package/dist/lib/features/ecommerce/checkout.d.ts +324 -0
- package/dist/lib/features/ecommerce/index.d.ts +26 -0
- package/dist/lib/features/ecommerce/inventory.d.ts +221 -0
- package/dist/lib/features/ecommerce/ltv.d.ts +258 -0
- package/dist/lib/features/ecommerce/products.d.ts +268 -0
- package/dist/lib/features/ecommerce/promotions.d.ts +266 -0
- package/dist/lib/features/ecommerce/purchases.d.ts +287 -0
- package/dist/lib/features/ecommerce/refunds.d.ts +232 -0
- package/dist/lib/features/ecommerce/search.d.ts +225 -0
- package/dist/lib/features/ecommerce/subscriptions.d.ts +281 -0
- package/dist/lib/features/ecommerce/wishlist.d.ts +236 -0
- package/dist/lib/features/enterprise/acquisition.d.ts +373 -0
- package/dist/lib/features/enterprise/alerts.d.ts +348 -0
- package/dist/lib/features/enterprise/churn.d.ts +288 -0
- package/dist/lib/features/enterprise/cohorts.d.ts +270 -0
- package/dist/lib/features/enterprise/engagement.d.ts +233 -0
- package/dist/lib/features/enterprise/forecasting.d.ts +351 -0
- package/dist/lib/features/enterprise/index.d.ts +20 -0
- package/dist/lib/features/enterprise/monetization.d.ts +356 -0
- package/dist/lib/features/enterprise/multi-path-funnels.d.ts +327 -0
- package/dist/lib/features/enterprise/paths.d.ts +332 -0
- package/dist/lib/features/enterprise/security.d.ts +387 -0
- package/dist/lib/features/enterprise/support.d.ts +329 -0
- package/dist/lib/frameworks/index.d.ts +9 -0
- package/dist/lib/frameworks/nextjs/client.d.ts +208 -0
- package/dist/lib/frameworks/nextjs/index.d.ts +29 -0
- package/dist/lib/frameworks/nextjs/server.d.ts +201 -0
- package/dist/lib/frameworks/node/index.d.ts +265 -0
- package/dist/lib/frameworks/nuxt/index.d.ts +190 -0
- package/dist/lib/frameworks/react/index.d.ts +245 -0
- package/dist/lib/frameworks/vue/index.d.ts +275 -0
- package/dist/lib/types/analytics.d.ts +365 -0
- package/dist/lib/types/common.d.ts +230 -0
- package/dist/lib/types/ecommerce.d.ts +309 -0
- package/dist/lib/types/index.d.ts +7 -0
- package/dist/lib/utils/functions.d.ts +1 -0
- package/package.json +139 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ecommerce - Refund Tracking
|
|
3
|
+
* @module features/ecommerce/refunds
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Track refunds, returns, and order cancellations with
|
|
7
|
+
* reason analysis and revenue impact.
|
|
8
|
+
*
|
|
9
|
+
* @useCases
|
|
10
|
+
* - Track full and partial refunds
|
|
11
|
+
* - Analyze refund reasons
|
|
12
|
+
* - Monitor return rates by product
|
|
13
|
+
* - Calculate net revenue after refunds
|
|
14
|
+
* - Identify problematic products
|
|
15
|
+
*
|
|
16
|
+
* @metrics
|
|
17
|
+
* - Total refunds
|
|
18
|
+
* - Refund rate
|
|
19
|
+
* - Average refund value
|
|
20
|
+
* - Refunds by reason
|
|
21
|
+
* - Net revenue impact
|
|
22
|
+
*
|
|
23
|
+
* @chartData
|
|
24
|
+
* - Bar chart: Refunds by reason
|
|
25
|
+
* - Line chart: Refund trends
|
|
26
|
+
* - Table: Products with highest return rates
|
|
27
|
+
* - KPI: Refund rate vs benchmark
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const refunds = new Refunds(webId, endpoint, apiKey);
|
|
32
|
+
*
|
|
33
|
+
* // Track a refund
|
|
34
|
+
* await refunds.track({
|
|
35
|
+
* orderId: 'ORD-12345',
|
|
36
|
+
* refundId: 'REF-001',
|
|
37
|
+
* amount: 49.99,
|
|
38
|
+
* currency: 'USD',
|
|
39
|
+
* reason: 'defective',
|
|
40
|
+
* isFullRefund: false
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
import { FTRPC } from "../../client/ftrpc";
|
|
45
|
+
import { Refund, CartItem, MoneyValue, DateRangeFilter, TimeSeriesData } from "../../types";
|
|
46
|
+
/**
|
|
47
|
+
* Configuration for tracking a refund.
|
|
48
|
+
*/
|
|
49
|
+
export interface RefundConfig extends Refund {
|
|
50
|
+
/** User ID */
|
|
51
|
+
userId?: string;
|
|
52
|
+
/** Initiated by (customer or admin) */
|
|
53
|
+
initiatedBy?: 'customer' | 'admin' | 'system';
|
|
54
|
+
/** Custom properties */
|
|
55
|
+
properties?: Record<string, unknown>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Refund event response from API.
|
|
59
|
+
*/
|
|
60
|
+
export interface RefundResponse {
|
|
61
|
+
eventName: string;
|
|
62
|
+
properties: Record<string, unknown>;
|
|
63
|
+
response: {
|
|
64
|
+
refundId: string;
|
|
65
|
+
orderId: string;
|
|
66
|
+
tracked: boolean;
|
|
67
|
+
refundedAmount: number;
|
|
68
|
+
};
|
|
69
|
+
timestamp: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Refund analytics data for charts.
|
|
73
|
+
*/
|
|
74
|
+
export interface RefundAnalyticsData {
|
|
75
|
+
/** Summary metrics */
|
|
76
|
+
summary: {
|
|
77
|
+
totalRefunds: number;
|
|
78
|
+
totalRefundValue: MoneyValue;
|
|
79
|
+
refundRate: number;
|
|
80
|
+
averageRefundValue: MoneyValue;
|
|
81
|
+
fullRefundCount: number;
|
|
82
|
+
partialRefundCount: number;
|
|
83
|
+
};
|
|
84
|
+
/** Refunds time series */
|
|
85
|
+
timeSeries: TimeSeriesData;
|
|
86
|
+
/** Refunds by reason */
|
|
87
|
+
byReason: Array<{
|
|
88
|
+
reason: string;
|
|
89
|
+
count: number;
|
|
90
|
+
totalValue: number;
|
|
91
|
+
percentage: number;
|
|
92
|
+
}>;
|
|
93
|
+
/** Products with highest refund rates */
|
|
94
|
+
topRefundedProducts: Array<{
|
|
95
|
+
productId: string;
|
|
96
|
+
productName: string;
|
|
97
|
+
refundCount: number;
|
|
98
|
+
refundValue: number;
|
|
99
|
+
refundRate: number;
|
|
100
|
+
}>;
|
|
101
|
+
/** Revenue impact */
|
|
102
|
+
revenueImpact: {
|
|
103
|
+
grossRevenue: MoneyValue;
|
|
104
|
+
refundedAmount: MoneyValue;
|
|
105
|
+
netRevenue: MoneyValue;
|
|
106
|
+
refundImpactPercent: number;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Refunds - Track refunds and returns.
|
|
111
|
+
*
|
|
112
|
+
* @extends FTRPC
|
|
113
|
+
*
|
|
114
|
+
* @description
|
|
115
|
+
* Provides refund tracking capabilities including:
|
|
116
|
+
* - Full refund tracking
|
|
117
|
+
* - Partial refund tracking
|
|
118
|
+
* - Refund reason analysis
|
|
119
|
+
* - Return rate monitoring
|
|
120
|
+
* - Revenue impact calculation
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* const refunds = new Refunds(webId, endpoint, apiKey);
|
|
125
|
+
*
|
|
126
|
+
* // Track full refund
|
|
127
|
+
* await refunds.track({
|
|
128
|
+
* orderId: 'ORD-12345',
|
|
129
|
+
* refundId: 'REF-001',
|
|
130
|
+
* amount: 149.99,
|
|
131
|
+
* currency: 'USD',
|
|
132
|
+
* reason: 'customer_request',
|
|
133
|
+
* isFullRefund: true
|
|
134
|
+
* });
|
|
135
|
+
*
|
|
136
|
+
* // Track partial refund with items
|
|
137
|
+
* await refunds.track({
|
|
138
|
+
* orderId: 'ORD-12345',
|
|
139
|
+
* refundId: 'REF-002',
|
|
140
|
+
* items: [refundedItem],
|
|
141
|
+
* amount: 49.99,
|
|
142
|
+
* currency: 'USD',
|
|
143
|
+
* reason: 'defective',
|
|
144
|
+
* isFullRefund: false
|
|
145
|
+
* });
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export declare class Refunds extends FTRPC {
|
|
149
|
+
/**
|
|
150
|
+
* Tracks a refund event.
|
|
151
|
+
*
|
|
152
|
+
* @param config - Refund configuration
|
|
153
|
+
* @returns Promise resolving to refund response
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* await refunds.track({
|
|
158
|
+
* orderId: 'ORD-98765',
|
|
159
|
+
* refundId: 'REF-123',
|
|
160
|
+
* items: [
|
|
161
|
+
* { productId: 'PROD-1', name: 'Widget', price: 29.99, quantity: 1, lineTotal: 29.99 }
|
|
162
|
+
* ],
|
|
163
|
+
* amount: 29.99,
|
|
164
|
+
* currency: 'USD',
|
|
165
|
+
* reason: 'wrong_item',
|
|
166
|
+
* isFullRefund: false,
|
|
167
|
+
* initiatedBy: 'customer'
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
track(config: RefundConfig): Promise<RefundResponse>;
|
|
172
|
+
/**
|
|
173
|
+
* Tracks a refund request (before processing).
|
|
174
|
+
*
|
|
175
|
+
* @param orderId - Original order ID
|
|
176
|
+
* @param items - Items requested for refund
|
|
177
|
+
* @param reason - Refund reason
|
|
178
|
+
* @returns Promise resolving to request response
|
|
179
|
+
*/
|
|
180
|
+
request(orderId: string, items?: CartItem[], reason?: string): Promise<RefundResponse>;
|
|
181
|
+
/**
|
|
182
|
+
* Tracks refund approval.
|
|
183
|
+
*
|
|
184
|
+
* @param refundId - Refund identifier
|
|
185
|
+
* @param approvedAmount - Approved refund amount
|
|
186
|
+
* @returns Promise resolving to approval response
|
|
187
|
+
*/
|
|
188
|
+
approve(refundId: string, approvedAmount: number): Promise<RefundResponse>;
|
|
189
|
+
/**
|
|
190
|
+
* Tracks refund denial.
|
|
191
|
+
*
|
|
192
|
+
* @param refundId - Refund identifier
|
|
193
|
+
* @param denialReason - Reason for denial
|
|
194
|
+
* @returns Promise resolving to denial response
|
|
195
|
+
*/
|
|
196
|
+
deny(refundId: string, denialReason: string): Promise<RefundResponse>;
|
|
197
|
+
/**
|
|
198
|
+
* Tracks refund completion (money returned).
|
|
199
|
+
*
|
|
200
|
+
* @param refundId - Refund identifier
|
|
201
|
+
* @param processedAmount - Amount actually refunded
|
|
202
|
+
* @returns Promise resolving to completion response
|
|
203
|
+
*/
|
|
204
|
+
complete(refundId: string, processedAmount: number): Promise<RefundResponse>;
|
|
205
|
+
/**
|
|
206
|
+
* Retrieves refund analytics for dashboards and charts.
|
|
207
|
+
*
|
|
208
|
+
* @param filter - Date range filter
|
|
209
|
+
* @returns Promise resolving to refund analytics
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```typescript
|
|
213
|
+
* const analytics = await refunds.getAnalytics({
|
|
214
|
+
* range: 'last30days'
|
|
215
|
+
* });
|
|
216
|
+
*
|
|
217
|
+
* // Bar chart - refunds by reason
|
|
218
|
+
* const reasonChart = analytics.byReason.map(r => ({
|
|
219
|
+
* name: r.reason,
|
|
220
|
+
* value: r.count
|
|
221
|
+
* }));
|
|
222
|
+
*
|
|
223
|
+
* // Table - problematic products
|
|
224
|
+
* const problemProducts = analytics.topRefundedProducts;
|
|
225
|
+
*
|
|
226
|
+
* // Revenue impact KPI
|
|
227
|
+
* const impact = analytics.revenueImpact.refundImpactPercent;
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
getAnalytics(filter?: DateRangeFilter): Promise<RefundAnalyticsData>;
|
|
231
|
+
}
|
|
232
|
+
export default Refunds;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ecommerce - Search Analytics
|
|
3
|
+
* @module features/ecommerce/search
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Track site search behavior to improve product discovery
|
|
7
|
+
* and conversion from search results.
|
|
8
|
+
*
|
|
9
|
+
* @useCases
|
|
10
|
+
* - Track search queries and results
|
|
11
|
+
* - Identify zero-result searches
|
|
12
|
+
* - Measure search-to-purchase conversion
|
|
13
|
+
* - Analyze popular search terms
|
|
14
|
+
* - Optimize search suggestions
|
|
15
|
+
*
|
|
16
|
+
* @metrics
|
|
17
|
+
* - Search volume
|
|
18
|
+
* - Zero-result rate
|
|
19
|
+
* - Search refinement rate
|
|
20
|
+
* - Click-through rate from search
|
|
21
|
+
* - Conversion from search
|
|
22
|
+
*
|
|
23
|
+
* @chartData
|
|
24
|
+
* - Word cloud: Popular search terms
|
|
25
|
+
* - Bar chart: Top queries
|
|
26
|
+
* - Table: Zero-result queries
|
|
27
|
+
* - Funnel: Search to purchase
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const search = new SearchAnalytics(webId, endpoint, apiKey);
|
|
32
|
+
*
|
|
33
|
+
* // Track search
|
|
34
|
+
* await search.track({
|
|
35
|
+
* query: 'wireless headphones',
|
|
36
|
+
* resultsCount: 42,
|
|
37
|
+
* filters: { brand: 'Sony' }
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
import { FTRPC } from "../../client/ftrpc";
|
|
42
|
+
import { Product, DateRangeFilter, TimeSeriesData } from "../../types";
|
|
43
|
+
/**
|
|
44
|
+
* Search query configuration.
|
|
45
|
+
*/
|
|
46
|
+
export interface SearchConfig {
|
|
47
|
+
/** Search query */
|
|
48
|
+
query: string;
|
|
49
|
+
/** Number of results */
|
|
50
|
+
resultsCount: number;
|
|
51
|
+
/** Search category/scope */
|
|
52
|
+
category?: string;
|
|
53
|
+
/** Applied filters */
|
|
54
|
+
filters?: Record<string, string | string[]>;
|
|
55
|
+
/** Sort order */
|
|
56
|
+
sortBy?: string;
|
|
57
|
+
/** Page number */
|
|
58
|
+
page?: number;
|
|
59
|
+
/** User ID */
|
|
60
|
+
userId?: string;
|
|
61
|
+
/** Session ID */
|
|
62
|
+
sessionId?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Search result click configuration.
|
|
66
|
+
*/
|
|
67
|
+
export interface SearchClickConfig {
|
|
68
|
+
/** Original search query */
|
|
69
|
+
query: string;
|
|
70
|
+
/** Product clicked */
|
|
71
|
+
product: Product;
|
|
72
|
+
/** Position in results */
|
|
73
|
+
position: number;
|
|
74
|
+
/** Results page number */
|
|
75
|
+
page?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Search response from API.
|
|
79
|
+
*/
|
|
80
|
+
export interface SearchResponse {
|
|
81
|
+
eventName: string;
|
|
82
|
+
properties: Record<string, unknown>;
|
|
83
|
+
response: {
|
|
84
|
+
searchId: string;
|
|
85
|
+
tracked: boolean;
|
|
86
|
+
};
|
|
87
|
+
timestamp: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Search analytics data.
|
|
91
|
+
*/
|
|
92
|
+
export interface SearchAnalyticsData {
|
|
93
|
+
/** Summary metrics */
|
|
94
|
+
summary: {
|
|
95
|
+
totalSearches: number;
|
|
96
|
+
uniqueSearchers: number;
|
|
97
|
+
zeroResultSearches: number;
|
|
98
|
+
zeroResultRate: number;
|
|
99
|
+
avgResultsPerSearch: number;
|
|
100
|
+
searchToClickRate: number;
|
|
101
|
+
searchToConversionRate: number;
|
|
102
|
+
};
|
|
103
|
+
/** Top search queries */
|
|
104
|
+
topQueries: Array<{
|
|
105
|
+
query: string;
|
|
106
|
+
searches: number;
|
|
107
|
+
clicks: number;
|
|
108
|
+
conversions: number;
|
|
109
|
+
ctr: number;
|
|
110
|
+
conversionRate: number;
|
|
111
|
+
}>;
|
|
112
|
+
/** Zero-result queries */
|
|
113
|
+
zeroResultQueries: Array<{
|
|
114
|
+
query: string;
|
|
115
|
+
occurrences: number;
|
|
116
|
+
lastSearched: string;
|
|
117
|
+
}>;
|
|
118
|
+
/** Popular filters */
|
|
119
|
+
popularFilters: Array<{
|
|
120
|
+
filterName: string;
|
|
121
|
+
filterValue: string;
|
|
122
|
+
usageCount: number;
|
|
123
|
+
}>;
|
|
124
|
+
/** Search trends */
|
|
125
|
+
trends: TimeSeriesData;
|
|
126
|
+
/** Search to purchase funnel */
|
|
127
|
+
funnel: {
|
|
128
|
+
searches: number;
|
|
129
|
+
resultsViewed: number;
|
|
130
|
+
productClicked: number;
|
|
131
|
+
addedToCart: number;
|
|
132
|
+
purchased: number;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* SearchAnalytics - Track site search behavior.
|
|
137
|
+
*
|
|
138
|
+
* @extends FTRPC
|
|
139
|
+
*
|
|
140
|
+
* @description
|
|
141
|
+
* Provides search analytics including:
|
|
142
|
+
* - Search query tracking
|
|
143
|
+
* - Result click tracking
|
|
144
|
+
* - Zero-result detection
|
|
145
|
+
* - Search refinement tracking
|
|
146
|
+
* - Search to conversion analysis
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* const search = new SearchAnalytics(webId, endpoint, apiKey);
|
|
151
|
+
*
|
|
152
|
+
* // Track search
|
|
153
|
+
* await search.track({
|
|
154
|
+
* query: 'running shoes',
|
|
155
|
+
* resultsCount: 156,
|
|
156
|
+
* filters: { size: '10', color: 'black' },
|
|
157
|
+
* sortBy: 'price_asc'
|
|
158
|
+
* });
|
|
159
|
+
*
|
|
160
|
+
* // Track click from search results
|
|
161
|
+
* await search.trackClick({
|
|
162
|
+
* query: 'running shoes',
|
|
163
|
+
* product: clickedProduct,
|
|
164
|
+
* position: 3
|
|
165
|
+
* });
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
export declare class SearchAnalytics extends FTRPC {
|
|
169
|
+
/**
|
|
170
|
+
* Tracks a search query.
|
|
171
|
+
*
|
|
172
|
+
* @param config - Search configuration
|
|
173
|
+
* @returns Promise resolving to search response
|
|
174
|
+
*/
|
|
175
|
+
track(config: SearchConfig): Promise<SearchResponse>;
|
|
176
|
+
/**
|
|
177
|
+
* Tracks a click on search result.
|
|
178
|
+
*
|
|
179
|
+
* @param config - Search click configuration
|
|
180
|
+
* @returns Promise resolving to search response
|
|
181
|
+
*/
|
|
182
|
+
trackClick(config: SearchClickConfig): Promise<SearchResponse>;
|
|
183
|
+
/**
|
|
184
|
+
* Tracks search refinement (modifying search).
|
|
185
|
+
*
|
|
186
|
+
* @param originalQuery - Original search query
|
|
187
|
+
* @param refinedQuery - New/refined query
|
|
188
|
+
* @param refinementType - Type of refinement
|
|
189
|
+
* @returns Promise resolving to search response
|
|
190
|
+
*/
|
|
191
|
+
trackRefinement(originalQuery: string, refinedQuery: string, refinementType: 'query_change' | 'add_filter' | 'remove_filter' | 'sort_change'): Promise<SearchResponse>;
|
|
192
|
+
/**
|
|
193
|
+
* Tracks autocomplete/suggestion selection.
|
|
194
|
+
*
|
|
195
|
+
* @param partialQuery - Partial query typed
|
|
196
|
+
* @param selectedSuggestion - Suggestion selected
|
|
197
|
+
* @param suggestionPosition - Position of suggestion
|
|
198
|
+
* @returns Promise resolving to search response
|
|
199
|
+
*/
|
|
200
|
+
trackSuggestion(partialQuery: string, selectedSuggestion: string, suggestionPosition: number): Promise<SearchResponse>;
|
|
201
|
+
/**
|
|
202
|
+
* Gets search analytics for dashboards.
|
|
203
|
+
*
|
|
204
|
+
* @param filter - Date range filter
|
|
205
|
+
* @returns Promise resolving to search analytics
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const analytics = await search.getAnalytics({
|
|
210
|
+
* range: 'last30days'
|
|
211
|
+
* });
|
|
212
|
+
*
|
|
213
|
+
* // Word cloud data
|
|
214
|
+
* const wordCloud = analytics.topQueries.map(q => ({
|
|
215
|
+
* text: q.query,
|
|
216
|
+
* value: q.searches
|
|
217
|
+
* }));
|
|
218
|
+
*
|
|
219
|
+
* // Table - zero result queries to fix
|
|
220
|
+
* const toFix = analytics.zeroResultQueries;
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
getAnalytics(filter?: DateRangeFilter): Promise<SearchAnalyticsData>;
|
|
224
|
+
}
|
|
225
|
+
export default SearchAnalytics;
|