@startsimpli/funnels 0.1.4 → 0.1.5
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/package.json +9 -31
- package/src/api/README.md +507 -0
- package/src/api/adapter.ts +106 -0
- package/src/api/client.test.ts +640 -0
- package/src/api/client.ts +385 -0
- package/src/api/default-adapter.ts +243 -0
- package/src/api/index.ts +24 -0
- package/src/components/FilterRuleEditor/ARCHITECTURE.md +354 -0
- package/src/components/FilterRuleEditor/FieldSelector.tsx +91 -0
- package/src/components/FilterRuleEditor/FilterRuleEditor.stories.tsx +462 -0
- package/src/components/FilterRuleEditor/FilterRuleEditor.test.tsx +520 -0
- package/src/components/FilterRuleEditor/FilterRuleEditor.tsx +225 -0
- package/src/components/FilterRuleEditor/LogicToggle.tsx +64 -0
- package/src/components/FilterRuleEditor/OperatorSelector.tsx +75 -0
- package/src/components/FilterRuleEditor/README.md +291 -0
- package/src/components/FilterRuleEditor/RuleRow.tsx +246 -0
- package/src/components/FilterRuleEditor/ValueInputs/BooleanValueInput.tsx +54 -0
- package/src/components/FilterRuleEditor/ValueInputs/ChoiceValueInput.tsx +83 -0
- package/src/components/FilterRuleEditor/ValueInputs/DateValueInput.tsx +70 -0
- package/src/components/FilterRuleEditor/ValueInputs/MultiChoiceValueInput.tsx +132 -0
- package/src/components/FilterRuleEditor/ValueInputs/NumberValueInput.tsx +73 -0
- package/src/components/FilterRuleEditor/ValueInputs/TextValueInput.tsx +50 -0
- package/src/components/FilterRuleEditor/ValueInputs/index.ts +12 -0
- package/src/components/FilterRuleEditor/constants.ts +64 -0
- package/src/components/FilterRuleEditor/index.ts +14 -0
- package/src/components/FunnelCard/DESIGN.md +447 -0
- package/src/components/FunnelCard/FunnelCard.stories.tsx +484 -0
- package/src/components/FunnelCard/FunnelCard.test.ts +257 -0
- package/src/components/FunnelCard/FunnelCard.test.tsx +336 -0
- package/src/components/FunnelCard/FunnelCard.tsx +204 -0
- package/src/components/FunnelCard/FunnelStats.tsx +68 -0
- package/src/components/FunnelCard/IMPLEMENTATION_SUMMARY.md +505 -0
- package/src/components/FunnelCard/INSTALLATION.md +304 -0
- package/src/components/FunnelCard/MatchBar.tsx +49 -0
- package/src/components/FunnelCard/README.md +294 -0
- package/src/components/FunnelCard/StageIndicator.tsx +62 -0
- package/src/components/FunnelCard/StatusBadge.tsx +52 -0
- package/src/components/FunnelCard/index.ts +14 -0
- package/src/components/FunnelPreview/EntityCard.tsx +72 -0
- package/src/components/FunnelPreview/FunnelPreview.stories.tsx +227 -0
- package/src/components/FunnelPreview/FunnelPreview.test.tsx +316 -0
- package/src/components/FunnelPreview/FunnelPreview.tsx +249 -0
- package/src/components/FunnelPreview/LoadingPreview.tsx +60 -0
- package/src/components/FunnelPreview/PreviewStats.tsx +78 -0
- package/src/components/FunnelPreview/README.md +337 -0
- package/src/components/FunnelPreview/StageBreakdown.tsx +94 -0
- package/src/components/FunnelPreview/example.tsx +286 -0
- package/src/components/FunnelPreview/index.ts +14 -0
- package/src/components/FunnelRunHistory/COMPONENT_SUMMARY.md +246 -0
- package/src/components/FunnelRunHistory/FunnelRunHistory.stories.tsx +272 -0
- package/src/components/FunnelRunHistory/FunnelRunHistory.test.tsx +323 -0
- package/src/components/FunnelRunHistory/FunnelRunHistory.tsx +329 -0
- package/src/components/FunnelRunHistory/README.md +325 -0
- package/src/components/FunnelRunHistory/RunActions.tsx +168 -0
- package/src/components/FunnelRunHistory/RunDetailsModal.tsx +221 -0
- package/src/components/FunnelRunHistory/RunFilters.tsx +128 -0
- package/src/components/FunnelRunHistory/RunRow.tsx +122 -0
- package/src/components/FunnelRunHistory/RunStatusBadge.tsx +75 -0
- package/src/components/FunnelRunHistory/StageBreakdownList.tsx +110 -0
- package/src/components/FunnelRunHistory/index.ts +51 -0
- package/src/components/FunnelRunHistory/types.ts +40 -0
- package/src/components/FunnelRunHistory/utils.test.ts +126 -0
- package/src/components/FunnelRunHistory/utils.ts +100 -0
- package/src/components/FunnelStageBuilder/AddStageButton.tsx +52 -0
- package/src/components/FunnelStageBuilder/FunnelStageBuilder.css +413 -0
- package/src/components/FunnelStageBuilder/FunnelStageBuilder.stories.tsx +312 -0
- package/src/components/FunnelStageBuilder/FunnelStageBuilder.test.tsx +304 -0
- package/src/components/FunnelStageBuilder/FunnelStageBuilder.tsx +321 -0
- package/src/components/FunnelStageBuilder/README.md +341 -0
- package/src/components/FunnelStageBuilder/StageActions.test.tsx +205 -0
- package/src/components/FunnelStageBuilder/StageActions.tsx +126 -0
- package/src/components/FunnelStageBuilder/StageCard.tsx +202 -0
- package/src/components/FunnelStageBuilder/StageForm.tsx +262 -0
- package/src/components/FunnelStageBuilder/TagInput.test.tsx +178 -0
- package/src/components/FunnelStageBuilder/TagInput.tsx +129 -0
- package/src/components/FunnelStageBuilder/index.ts +21 -0
- package/src/components/FunnelVisualFlow/FlowLegend.tsx +77 -0
- package/{dist/components/index.css → src/components/FunnelVisualFlow/FunnelVisualFlow.css} +89 -13
- package/src/components/FunnelVisualFlow/FunnelVisualFlow.stories.tsx +254 -0
- package/src/components/FunnelVisualFlow/FunnelVisualFlow.test.tsx +208 -0
- package/src/components/FunnelVisualFlow/FunnelVisualFlow.tsx +229 -0
- package/src/components/FunnelVisualFlow/README.md +323 -0
- package/src/components/FunnelVisualFlow/StageNode.tsx +188 -0
- package/src/components/FunnelVisualFlow/example.tsx +227 -0
- package/src/components/FunnelVisualFlow/index.ts +10 -0
- package/src/components/index.ts +102 -0
- package/src/core/README.md +307 -0
- package/src/core/engine.test.ts +1087 -0
- package/src/core/engine.ts +329 -0
- package/src/core/evaluator.example.ts +353 -0
- package/src/core/evaluator.test.ts +639 -0
- package/src/core/evaluator.ts +261 -0
- package/src/core/field-resolver.example.ts +175 -0
- package/src/core/field-resolver.test.ts +541 -0
- package/src/core/field-resolver.ts +247 -0
- package/src/core/index.ts +34 -0
- package/src/core/operators.test.ts +539 -0
- package/src/core/operators.ts +241 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/useDebouncedValue.ts +28 -0
- package/src/index.ts +155 -0
- package/src/store/README.md +342 -0
- package/src/store/create-funnel-store.test.ts +686 -0
- package/src/store/create-funnel-store.ts +538 -0
- package/src/store/index.ts +9 -0
- package/src/store/types.ts +294 -0
- package/src/stories/CrossDomain.stories.tsx +149 -0
- package/src/stories/Welcome.stories.tsx +81 -0
- package/src/stories/demo-data/index.ts +3 -0
- package/src/stories/demo-data/investors.ts +216 -0
- package/src/stories/demo-data/leads.ts +223 -0
- package/src/stories/demo-data/recipes.ts +217 -0
- package/src/test/setup.ts +5 -0
- package/src/types/index.ts +843 -0
- package/dist/client-3ESO2NHy.d.ts +0 -310
- package/dist/client-CZu03ACp.d.cts +0 -310
- package/dist/components/index.cjs +0 -3241
- package/dist/components/index.cjs.map +0 -1
- package/dist/components/index.css.map +0 -1
- package/dist/components/index.d.cts +0 -726
- package/dist/components/index.d.ts +0 -726
- package/dist/components/index.js +0 -3194
- package/dist/components/index.js.map +0 -1
- package/dist/core/index.cjs +0 -500
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.d.cts +0 -359
- package/dist/core/index.d.ts +0 -359
- package/dist/core/index.js +0 -486
- package/dist/core/index.js.map +0 -1
- package/dist/hooks/index.cjs +0 -20
- package/dist/hooks/index.cjs.map +0 -1
- package/dist/hooks/index.d.cts +0 -11
- package/dist/hooks/index.d.ts +0 -11
- package/dist/hooks/index.js +0 -18
- package/dist/hooks/index.js.map +0 -1
- package/dist/index-BGDEXbuz.d.cts +0 -434
- package/dist/index-BGDEXbuz.d.ts +0 -434
- package/dist/index.cjs +0 -4499
- package/dist/index.cjs.map +0 -1
- package/dist/index.css +0 -198
- package/dist/index.css.map +0 -1
- package/dist/index.d.cts +0 -99
- package/dist/index.d.ts +0 -99
- package/dist/index.js +0 -4421
- package/dist/index.js.map +0 -1
- package/dist/store/index.cjs +0 -389
- package/dist/store/index.cjs.map +0 -1
- package/dist/store/index.d.cts +0 -225
- package/dist/store/index.d.ts +0 -225
- package/dist/store/index.js +0 -386
- package/dist/store/index.js.map +0 -1
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
import { i as Funnel, C as CreateFunnelInput, U as UpdateFunnelInput, a as CreateStageInput, m as FunnelStage, p as UpdateStageInput, k as FunnelRun, j as FunnelResult } from './index-BGDEXbuz.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ApiAdapter Interface
|
|
5
|
-
*
|
|
6
|
-
* Generic HTTP adapter for flexible API integration.
|
|
7
|
-
* Consumers can provide their own implementation to handle:
|
|
8
|
-
* - Custom authentication (JWT, API keys, OAuth)
|
|
9
|
-
* - Custom headers (tenant IDs, correlation IDs)
|
|
10
|
-
* - Custom error handling
|
|
11
|
-
* - Request/response transformation
|
|
12
|
-
*
|
|
13
|
-
* @packageDocumentation
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Generic API adapter interface
|
|
17
|
-
*
|
|
18
|
-
* Allows applications to inject their own HTTP client
|
|
19
|
-
* with custom auth, headers, error handling, etc.
|
|
20
|
-
*/
|
|
21
|
-
interface ApiAdapter {
|
|
22
|
-
/**
|
|
23
|
-
* HTTP GET request
|
|
24
|
-
*
|
|
25
|
-
* @param url - Full or relative URL to fetch
|
|
26
|
-
* @param params - Optional query parameters
|
|
27
|
-
* @returns Parsed response data
|
|
28
|
-
* @throws ApiError on HTTP error or network failure
|
|
29
|
-
*/
|
|
30
|
-
get<T>(url: string, params?: Record<string, any>): Promise<T>;
|
|
31
|
-
/**
|
|
32
|
-
* HTTP POST request
|
|
33
|
-
*
|
|
34
|
-
* @param url - Full or relative URL
|
|
35
|
-
* @param data - Request body (will be JSON serialized)
|
|
36
|
-
* @returns Parsed response data
|
|
37
|
-
* @throws ApiError on HTTP error or network failure
|
|
38
|
-
*/
|
|
39
|
-
post<T>(url: string, data: any): Promise<T>;
|
|
40
|
-
/**
|
|
41
|
-
* HTTP PATCH request
|
|
42
|
-
*
|
|
43
|
-
* @param url - Full or relative URL
|
|
44
|
-
* @param data - Request body (will be JSON serialized)
|
|
45
|
-
* @returns Parsed response data
|
|
46
|
-
* @throws ApiError on HTTP error or network failure
|
|
47
|
-
*/
|
|
48
|
-
patch<T>(url: string, data: any): Promise<T>;
|
|
49
|
-
/**
|
|
50
|
-
* HTTP DELETE request
|
|
51
|
-
*
|
|
52
|
-
* @param url - Full or relative URL
|
|
53
|
-
* @returns Parsed response data (often empty)
|
|
54
|
-
* @throws ApiError on HTTP error or network failure
|
|
55
|
-
*/
|
|
56
|
-
delete<T>(url: string): Promise<T>;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Standard API error structure
|
|
60
|
-
*/
|
|
61
|
-
interface ApiError extends Error {
|
|
62
|
-
/** HTTP status code (404, 500, etc) */
|
|
63
|
-
status?: number;
|
|
64
|
-
/** Error code from API */
|
|
65
|
-
code?: string;
|
|
66
|
-
/** Response body (if available) */
|
|
67
|
-
response?: any;
|
|
68
|
-
/** Original error (network, parse, etc) */
|
|
69
|
-
cause?: Error;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Create ApiError from response
|
|
73
|
-
*/
|
|
74
|
-
declare function createApiError(message: string, status?: number, response?: any, cause?: Error): ApiError;
|
|
75
|
-
/**
|
|
76
|
-
* Type guard for ApiError
|
|
77
|
-
*/
|
|
78
|
-
declare function isApiError(error: unknown): error is ApiError;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* FunnelApiClient - Generic API client for funnel operations
|
|
82
|
-
*
|
|
83
|
-
* Adapter-based client that works with any HTTP implementation.
|
|
84
|
-
* Consumers inject their own ApiAdapter for custom auth, headers, error handling.
|
|
85
|
-
*
|
|
86
|
-
* @packageDocumentation
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* List filters for funnels
|
|
91
|
-
*/
|
|
92
|
-
interface FunnelListFilters {
|
|
93
|
-
/** Filter by status */
|
|
94
|
-
status?: 'draft' | 'active' | 'paused' | 'archived';
|
|
95
|
-
/** Filter by input type */
|
|
96
|
-
input_type?: string;
|
|
97
|
-
/** Filter by owner */
|
|
98
|
-
owner_id?: string;
|
|
99
|
-
/** Filter by team */
|
|
100
|
-
team_id?: string;
|
|
101
|
-
/** Search by name */
|
|
102
|
-
search?: string;
|
|
103
|
-
/** Pagination: page number (1-indexed) */
|
|
104
|
-
page?: number;
|
|
105
|
-
/** Pagination: page size */
|
|
106
|
-
page_size?: number;
|
|
107
|
-
/** Ordering: field name (prefix with - for descending) */
|
|
108
|
-
ordering?: string;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* List response with pagination
|
|
112
|
-
*/
|
|
113
|
-
interface PaginatedResponse<T> {
|
|
114
|
-
count: number;
|
|
115
|
-
next: string | null;
|
|
116
|
-
previous: string | null;
|
|
117
|
-
results: T[];
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Preview result (client-side evaluation)
|
|
121
|
-
*/
|
|
122
|
-
interface PreviewResult<TEntity = any> {
|
|
123
|
-
/** Sample entities that would match */
|
|
124
|
-
matched_entities: TEntity[];
|
|
125
|
-
/** Sample entities that would be excluded */
|
|
126
|
-
excluded_entities: TEntity[];
|
|
127
|
-
/** Stage-by-stage breakdown */
|
|
128
|
-
stage_breakdown: {
|
|
129
|
-
stage_id: string;
|
|
130
|
-
stage_name: string;
|
|
131
|
-
input_count: number;
|
|
132
|
-
matched_count: number;
|
|
133
|
-
excluded_count: number;
|
|
134
|
-
}[];
|
|
135
|
-
/** Total counts */
|
|
136
|
-
total_input: number;
|
|
137
|
-
total_matched: number;
|
|
138
|
-
total_excluded: number;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Generic API client for funnel operations
|
|
142
|
-
*
|
|
143
|
-
* Usage:
|
|
144
|
-
* ```ts
|
|
145
|
-
* const adapter = new FetchAdapter({ headers: { 'Authorization': 'Bearer token' } });
|
|
146
|
-
* const client = new FunnelApiClient(adapter, 'https://api.example.com');
|
|
147
|
-
*
|
|
148
|
-
* const funnels = await client.listFunnels({ status: 'active' });
|
|
149
|
-
* const funnel = await client.getFunnel('funnel-123');
|
|
150
|
-
* const run = await client.runFunnel('funnel-123');
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
declare class FunnelApiClient {
|
|
154
|
-
private adapter;
|
|
155
|
-
private baseUrl;
|
|
156
|
-
constructor(adapter: ApiAdapter, baseUrl: string);
|
|
157
|
-
/**
|
|
158
|
-
* Build full URL for endpoint
|
|
159
|
-
*/
|
|
160
|
-
private url;
|
|
161
|
-
/**
|
|
162
|
-
* List funnels with optional filters
|
|
163
|
-
*
|
|
164
|
-
* @param filters - Optional filters (status, owner, pagination, etc)
|
|
165
|
-
* @returns Paginated list of funnels
|
|
166
|
-
*/
|
|
167
|
-
listFunnels<TEntity = any>(filters?: FunnelListFilters): Promise<PaginatedResponse<Funnel<TEntity>>>;
|
|
168
|
-
/**
|
|
169
|
-
* Get single funnel by ID
|
|
170
|
-
*
|
|
171
|
-
* @param id - Funnel ID
|
|
172
|
-
* @returns Funnel detail
|
|
173
|
-
* @throws ApiError with status 404 if not found
|
|
174
|
-
*/
|
|
175
|
-
getFunnel<TEntity = any>(id: string): Promise<Funnel<TEntity>>;
|
|
176
|
-
/**
|
|
177
|
-
* Create new funnel
|
|
178
|
-
*
|
|
179
|
-
* @param data - Funnel creation data
|
|
180
|
-
* @returns Created funnel
|
|
181
|
-
* @throws ApiError with status 400 if validation fails
|
|
182
|
-
*/
|
|
183
|
-
createFunnel<TEntity = any>(data: CreateFunnelInput<TEntity>): Promise<Funnel<TEntity>>;
|
|
184
|
-
/**
|
|
185
|
-
* Update existing funnel
|
|
186
|
-
*
|
|
187
|
-
* @param id - Funnel ID
|
|
188
|
-
* @param data - Funnel update data
|
|
189
|
-
* @returns Updated funnel
|
|
190
|
-
* @throws ApiError with status 404 if not found, 400 if validation fails
|
|
191
|
-
*/
|
|
192
|
-
updateFunnel<TEntity = any>(id: string, data: Partial<UpdateFunnelInput<TEntity>>): Promise<Funnel<TEntity>>;
|
|
193
|
-
/**
|
|
194
|
-
* Delete funnel
|
|
195
|
-
*
|
|
196
|
-
* @param id - Funnel ID
|
|
197
|
-
* @throws ApiError with status 404 if not found
|
|
198
|
-
*/
|
|
199
|
-
deleteFunnel(id: string): Promise<void>;
|
|
200
|
-
/**
|
|
201
|
-
* Create stage in funnel
|
|
202
|
-
*
|
|
203
|
-
* @param funnelId - Funnel ID
|
|
204
|
-
* @param data - Stage creation data
|
|
205
|
-
* @returns Created stage
|
|
206
|
-
* @throws ApiError with status 404 if funnel not found, 400 if validation fails
|
|
207
|
-
*/
|
|
208
|
-
createStage<TEntity = any>(funnelId: string, data: CreateStageInput<TEntity>): Promise<FunnelStage<TEntity>>;
|
|
209
|
-
/**
|
|
210
|
-
* Update stage
|
|
211
|
-
*
|
|
212
|
-
* @param funnelId - Funnel ID
|
|
213
|
-
* @param stageId - Stage ID
|
|
214
|
-
* @param data - Stage update data
|
|
215
|
-
* @returns Updated stage
|
|
216
|
-
* @throws ApiError with status 404 if not found, 400 if validation fails
|
|
217
|
-
*/
|
|
218
|
-
updateStage<TEntity = any>(funnelId: string, stageId: string, data: Partial<UpdateStageInput<TEntity>>): Promise<FunnelStage<TEntity>>;
|
|
219
|
-
/**
|
|
220
|
-
* Delete stage
|
|
221
|
-
*
|
|
222
|
-
* @param funnelId - Funnel ID
|
|
223
|
-
* @param stageId - Stage ID
|
|
224
|
-
* @throws ApiError with status 404 if not found
|
|
225
|
-
*/
|
|
226
|
-
deleteStage(funnelId: string, stageId: string): Promise<void>;
|
|
227
|
-
/**
|
|
228
|
-
* Trigger funnel run
|
|
229
|
-
*
|
|
230
|
-
* @param funnelId - Funnel ID
|
|
231
|
-
* @param options - Optional run configuration (trigger_type, metadata, etc)
|
|
232
|
-
* @returns Created funnel run (status: pending or running)
|
|
233
|
-
* @throws ApiError with status 404 if funnel not found, 400 if validation fails
|
|
234
|
-
*/
|
|
235
|
-
runFunnel(funnelId: string, options?: {
|
|
236
|
-
trigger_type?: 'manual' | 'scheduled' | 'webhook' | 'api';
|
|
237
|
-
metadata?: Record<string, any>;
|
|
238
|
-
}): Promise<FunnelRun>;
|
|
239
|
-
/**
|
|
240
|
-
* Get funnel run history
|
|
241
|
-
*
|
|
242
|
-
* @param funnelId - Funnel ID
|
|
243
|
-
* @param filters - Optional filters (status, pagination, etc)
|
|
244
|
-
* @returns List of funnel runs
|
|
245
|
-
* @throws ApiError with status 404 if funnel not found
|
|
246
|
-
*/
|
|
247
|
-
getFunnelRuns(funnelId: string, filters?: {
|
|
248
|
-
status?: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
249
|
-
page?: number;
|
|
250
|
-
page_size?: number;
|
|
251
|
-
ordering?: string;
|
|
252
|
-
}): Promise<PaginatedResponse<FunnelRun>>;
|
|
253
|
-
/**
|
|
254
|
-
* Get single run detail
|
|
255
|
-
*
|
|
256
|
-
* @param runId - Run ID
|
|
257
|
-
* @returns Funnel run detail
|
|
258
|
-
* @throws ApiError with status 404 if not found
|
|
259
|
-
*/
|
|
260
|
-
getFunnelRun(runId: string): Promise<FunnelRun>;
|
|
261
|
-
/**
|
|
262
|
-
* Get run results (entities that were processed)
|
|
263
|
-
*
|
|
264
|
-
* @param runId - Run ID
|
|
265
|
-
* @param filters - Optional filters (matched, pagination, etc)
|
|
266
|
-
* @returns Paginated list of results
|
|
267
|
-
* @throws ApiError with status 404 if run not found
|
|
268
|
-
*/
|
|
269
|
-
getFunnelResults<TEntity = any>(runId: string, filters?: {
|
|
270
|
-
matched?: boolean;
|
|
271
|
-
page?: number;
|
|
272
|
-
page_size?: number;
|
|
273
|
-
}): Promise<PaginatedResponse<FunnelResult<TEntity>>>;
|
|
274
|
-
/**
|
|
275
|
-
* Cancel running funnel
|
|
276
|
-
*
|
|
277
|
-
* @param runId - Run ID
|
|
278
|
-
* @returns Updated run with status 'cancelled'
|
|
279
|
-
* @throws ApiError with status 404 if not found, 400 if already completed
|
|
280
|
-
*/
|
|
281
|
-
cancelFunnelRun(runId: string): Promise<FunnelRun>;
|
|
282
|
-
/**
|
|
283
|
-
* Preview funnel with sample entities (client-side evaluation)
|
|
284
|
-
*
|
|
285
|
-
* Useful for testing funnel logic before running on full dataset.
|
|
286
|
-
* Does NOT hit the server - evaluates locally.
|
|
287
|
-
*
|
|
288
|
-
* Note: This requires the evaluation engine to be available client-side.
|
|
289
|
-
* If not available, this will throw an error.
|
|
290
|
-
*
|
|
291
|
-
* @param funnel - Funnel definition
|
|
292
|
-
* @param sampleEntities - Sample entities to test
|
|
293
|
-
* @returns Preview results showing which entities would match/exclude
|
|
294
|
-
*/
|
|
295
|
-
previewFunnel<TEntity = any>(funnel: Funnel<TEntity>, sampleEntities: TEntity[]): Promise<PreviewResult<TEntity>>;
|
|
296
|
-
/**
|
|
297
|
-
* Server-side preview (recommended)
|
|
298
|
-
*
|
|
299
|
-
* Send sample entities to server for evaluation.
|
|
300
|
-
* Useful for testing funnel logic before running on full dataset.
|
|
301
|
-
*
|
|
302
|
-
* @param funnelId - Funnel ID
|
|
303
|
-
* @param sampleEntities - Sample entities to test
|
|
304
|
-
* @returns Preview results
|
|
305
|
-
* @throws ApiError with status 404 if funnel not found
|
|
306
|
-
*/
|
|
307
|
-
previewFunnelServer<TEntity = any>(funnelId: string, sampleEntities: TEntity[]): Promise<PreviewResult<TEntity>>;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export { type ApiAdapter as A, FunnelApiClient as F, type PaginatedResponse as P, type ApiError as a, type FunnelListFilters as b, createApiError as c, isApiError as i };
|
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
import { i as Funnel, C as CreateFunnelInput, U as UpdateFunnelInput, a as CreateStageInput, m as FunnelStage, p as UpdateStageInput, k as FunnelRun, j as FunnelResult } from './index-BGDEXbuz.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ApiAdapter Interface
|
|
5
|
-
*
|
|
6
|
-
* Generic HTTP adapter for flexible API integration.
|
|
7
|
-
* Consumers can provide their own implementation to handle:
|
|
8
|
-
* - Custom authentication (JWT, API keys, OAuth)
|
|
9
|
-
* - Custom headers (tenant IDs, correlation IDs)
|
|
10
|
-
* - Custom error handling
|
|
11
|
-
* - Request/response transformation
|
|
12
|
-
*
|
|
13
|
-
* @packageDocumentation
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Generic API adapter interface
|
|
17
|
-
*
|
|
18
|
-
* Allows applications to inject their own HTTP client
|
|
19
|
-
* with custom auth, headers, error handling, etc.
|
|
20
|
-
*/
|
|
21
|
-
interface ApiAdapter {
|
|
22
|
-
/**
|
|
23
|
-
* HTTP GET request
|
|
24
|
-
*
|
|
25
|
-
* @param url - Full or relative URL to fetch
|
|
26
|
-
* @param params - Optional query parameters
|
|
27
|
-
* @returns Parsed response data
|
|
28
|
-
* @throws ApiError on HTTP error or network failure
|
|
29
|
-
*/
|
|
30
|
-
get<T>(url: string, params?: Record<string, any>): Promise<T>;
|
|
31
|
-
/**
|
|
32
|
-
* HTTP POST request
|
|
33
|
-
*
|
|
34
|
-
* @param url - Full or relative URL
|
|
35
|
-
* @param data - Request body (will be JSON serialized)
|
|
36
|
-
* @returns Parsed response data
|
|
37
|
-
* @throws ApiError on HTTP error or network failure
|
|
38
|
-
*/
|
|
39
|
-
post<T>(url: string, data: any): Promise<T>;
|
|
40
|
-
/**
|
|
41
|
-
* HTTP PATCH request
|
|
42
|
-
*
|
|
43
|
-
* @param url - Full or relative URL
|
|
44
|
-
* @param data - Request body (will be JSON serialized)
|
|
45
|
-
* @returns Parsed response data
|
|
46
|
-
* @throws ApiError on HTTP error or network failure
|
|
47
|
-
*/
|
|
48
|
-
patch<T>(url: string, data: any): Promise<T>;
|
|
49
|
-
/**
|
|
50
|
-
* HTTP DELETE request
|
|
51
|
-
*
|
|
52
|
-
* @param url - Full or relative URL
|
|
53
|
-
* @returns Parsed response data (often empty)
|
|
54
|
-
* @throws ApiError on HTTP error or network failure
|
|
55
|
-
*/
|
|
56
|
-
delete<T>(url: string): Promise<T>;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Standard API error structure
|
|
60
|
-
*/
|
|
61
|
-
interface ApiError extends Error {
|
|
62
|
-
/** HTTP status code (404, 500, etc) */
|
|
63
|
-
status?: number;
|
|
64
|
-
/** Error code from API */
|
|
65
|
-
code?: string;
|
|
66
|
-
/** Response body (if available) */
|
|
67
|
-
response?: any;
|
|
68
|
-
/** Original error (network, parse, etc) */
|
|
69
|
-
cause?: Error;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Create ApiError from response
|
|
73
|
-
*/
|
|
74
|
-
declare function createApiError(message: string, status?: number, response?: any, cause?: Error): ApiError;
|
|
75
|
-
/**
|
|
76
|
-
* Type guard for ApiError
|
|
77
|
-
*/
|
|
78
|
-
declare function isApiError(error: unknown): error is ApiError;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* FunnelApiClient - Generic API client for funnel operations
|
|
82
|
-
*
|
|
83
|
-
* Adapter-based client that works with any HTTP implementation.
|
|
84
|
-
* Consumers inject their own ApiAdapter for custom auth, headers, error handling.
|
|
85
|
-
*
|
|
86
|
-
* @packageDocumentation
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* List filters for funnels
|
|
91
|
-
*/
|
|
92
|
-
interface FunnelListFilters {
|
|
93
|
-
/** Filter by status */
|
|
94
|
-
status?: 'draft' | 'active' | 'paused' | 'archived';
|
|
95
|
-
/** Filter by input type */
|
|
96
|
-
input_type?: string;
|
|
97
|
-
/** Filter by owner */
|
|
98
|
-
owner_id?: string;
|
|
99
|
-
/** Filter by team */
|
|
100
|
-
team_id?: string;
|
|
101
|
-
/** Search by name */
|
|
102
|
-
search?: string;
|
|
103
|
-
/** Pagination: page number (1-indexed) */
|
|
104
|
-
page?: number;
|
|
105
|
-
/** Pagination: page size */
|
|
106
|
-
page_size?: number;
|
|
107
|
-
/** Ordering: field name (prefix with - for descending) */
|
|
108
|
-
ordering?: string;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* List response with pagination
|
|
112
|
-
*/
|
|
113
|
-
interface PaginatedResponse<T> {
|
|
114
|
-
count: number;
|
|
115
|
-
next: string | null;
|
|
116
|
-
previous: string | null;
|
|
117
|
-
results: T[];
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Preview result (client-side evaluation)
|
|
121
|
-
*/
|
|
122
|
-
interface PreviewResult<TEntity = any> {
|
|
123
|
-
/** Sample entities that would match */
|
|
124
|
-
matched_entities: TEntity[];
|
|
125
|
-
/** Sample entities that would be excluded */
|
|
126
|
-
excluded_entities: TEntity[];
|
|
127
|
-
/** Stage-by-stage breakdown */
|
|
128
|
-
stage_breakdown: {
|
|
129
|
-
stage_id: string;
|
|
130
|
-
stage_name: string;
|
|
131
|
-
input_count: number;
|
|
132
|
-
matched_count: number;
|
|
133
|
-
excluded_count: number;
|
|
134
|
-
}[];
|
|
135
|
-
/** Total counts */
|
|
136
|
-
total_input: number;
|
|
137
|
-
total_matched: number;
|
|
138
|
-
total_excluded: number;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Generic API client for funnel operations
|
|
142
|
-
*
|
|
143
|
-
* Usage:
|
|
144
|
-
* ```ts
|
|
145
|
-
* const adapter = new FetchAdapter({ headers: { 'Authorization': 'Bearer token' } });
|
|
146
|
-
* const client = new FunnelApiClient(adapter, 'https://api.example.com');
|
|
147
|
-
*
|
|
148
|
-
* const funnels = await client.listFunnels({ status: 'active' });
|
|
149
|
-
* const funnel = await client.getFunnel('funnel-123');
|
|
150
|
-
* const run = await client.runFunnel('funnel-123');
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
declare class FunnelApiClient {
|
|
154
|
-
private adapter;
|
|
155
|
-
private baseUrl;
|
|
156
|
-
constructor(adapter: ApiAdapter, baseUrl: string);
|
|
157
|
-
/**
|
|
158
|
-
* Build full URL for endpoint
|
|
159
|
-
*/
|
|
160
|
-
private url;
|
|
161
|
-
/**
|
|
162
|
-
* List funnels with optional filters
|
|
163
|
-
*
|
|
164
|
-
* @param filters - Optional filters (status, owner, pagination, etc)
|
|
165
|
-
* @returns Paginated list of funnels
|
|
166
|
-
*/
|
|
167
|
-
listFunnels<TEntity = any>(filters?: FunnelListFilters): Promise<PaginatedResponse<Funnel<TEntity>>>;
|
|
168
|
-
/**
|
|
169
|
-
* Get single funnel by ID
|
|
170
|
-
*
|
|
171
|
-
* @param id - Funnel ID
|
|
172
|
-
* @returns Funnel detail
|
|
173
|
-
* @throws ApiError with status 404 if not found
|
|
174
|
-
*/
|
|
175
|
-
getFunnel<TEntity = any>(id: string): Promise<Funnel<TEntity>>;
|
|
176
|
-
/**
|
|
177
|
-
* Create new funnel
|
|
178
|
-
*
|
|
179
|
-
* @param data - Funnel creation data
|
|
180
|
-
* @returns Created funnel
|
|
181
|
-
* @throws ApiError with status 400 if validation fails
|
|
182
|
-
*/
|
|
183
|
-
createFunnel<TEntity = any>(data: CreateFunnelInput<TEntity>): Promise<Funnel<TEntity>>;
|
|
184
|
-
/**
|
|
185
|
-
* Update existing funnel
|
|
186
|
-
*
|
|
187
|
-
* @param id - Funnel ID
|
|
188
|
-
* @param data - Funnel update data
|
|
189
|
-
* @returns Updated funnel
|
|
190
|
-
* @throws ApiError with status 404 if not found, 400 if validation fails
|
|
191
|
-
*/
|
|
192
|
-
updateFunnel<TEntity = any>(id: string, data: Partial<UpdateFunnelInput<TEntity>>): Promise<Funnel<TEntity>>;
|
|
193
|
-
/**
|
|
194
|
-
* Delete funnel
|
|
195
|
-
*
|
|
196
|
-
* @param id - Funnel ID
|
|
197
|
-
* @throws ApiError with status 404 if not found
|
|
198
|
-
*/
|
|
199
|
-
deleteFunnel(id: string): Promise<void>;
|
|
200
|
-
/**
|
|
201
|
-
* Create stage in funnel
|
|
202
|
-
*
|
|
203
|
-
* @param funnelId - Funnel ID
|
|
204
|
-
* @param data - Stage creation data
|
|
205
|
-
* @returns Created stage
|
|
206
|
-
* @throws ApiError with status 404 if funnel not found, 400 if validation fails
|
|
207
|
-
*/
|
|
208
|
-
createStage<TEntity = any>(funnelId: string, data: CreateStageInput<TEntity>): Promise<FunnelStage<TEntity>>;
|
|
209
|
-
/**
|
|
210
|
-
* Update stage
|
|
211
|
-
*
|
|
212
|
-
* @param funnelId - Funnel ID
|
|
213
|
-
* @param stageId - Stage ID
|
|
214
|
-
* @param data - Stage update data
|
|
215
|
-
* @returns Updated stage
|
|
216
|
-
* @throws ApiError with status 404 if not found, 400 if validation fails
|
|
217
|
-
*/
|
|
218
|
-
updateStage<TEntity = any>(funnelId: string, stageId: string, data: Partial<UpdateStageInput<TEntity>>): Promise<FunnelStage<TEntity>>;
|
|
219
|
-
/**
|
|
220
|
-
* Delete stage
|
|
221
|
-
*
|
|
222
|
-
* @param funnelId - Funnel ID
|
|
223
|
-
* @param stageId - Stage ID
|
|
224
|
-
* @throws ApiError with status 404 if not found
|
|
225
|
-
*/
|
|
226
|
-
deleteStage(funnelId: string, stageId: string): Promise<void>;
|
|
227
|
-
/**
|
|
228
|
-
* Trigger funnel run
|
|
229
|
-
*
|
|
230
|
-
* @param funnelId - Funnel ID
|
|
231
|
-
* @param options - Optional run configuration (trigger_type, metadata, etc)
|
|
232
|
-
* @returns Created funnel run (status: pending or running)
|
|
233
|
-
* @throws ApiError with status 404 if funnel not found, 400 if validation fails
|
|
234
|
-
*/
|
|
235
|
-
runFunnel(funnelId: string, options?: {
|
|
236
|
-
trigger_type?: 'manual' | 'scheduled' | 'webhook' | 'api';
|
|
237
|
-
metadata?: Record<string, any>;
|
|
238
|
-
}): Promise<FunnelRun>;
|
|
239
|
-
/**
|
|
240
|
-
* Get funnel run history
|
|
241
|
-
*
|
|
242
|
-
* @param funnelId - Funnel ID
|
|
243
|
-
* @param filters - Optional filters (status, pagination, etc)
|
|
244
|
-
* @returns List of funnel runs
|
|
245
|
-
* @throws ApiError with status 404 if funnel not found
|
|
246
|
-
*/
|
|
247
|
-
getFunnelRuns(funnelId: string, filters?: {
|
|
248
|
-
status?: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
249
|
-
page?: number;
|
|
250
|
-
page_size?: number;
|
|
251
|
-
ordering?: string;
|
|
252
|
-
}): Promise<PaginatedResponse<FunnelRun>>;
|
|
253
|
-
/**
|
|
254
|
-
* Get single run detail
|
|
255
|
-
*
|
|
256
|
-
* @param runId - Run ID
|
|
257
|
-
* @returns Funnel run detail
|
|
258
|
-
* @throws ApiError with status 404 if not found
|
|
259
|
-
*/
|
|
260
|
-
getFunnelRun(runId: string): Promise<FunnelRun>;
|
|
261
|
-
/**
|
|
262
|
-
* Get run results (entities that were processed)
|
|
263
|
-
*
|
|
264
|
-
* @param runId - Run ID
|
|
265
|
-
* @param filters - Optional filters (matched, pagination, etc)
|
|
266
|
-
* @returns Paginated list of results
|
|
267
|
-
* @throws ApiError with status 404 if run not found
|
|
268
|
-
*/
|
|
269
|
-
getFunnelResults<TEntity = any>(runId: string, filters?: {
|
|
270
|
-
matched?: boolean;
|
|
271
|
-
page?: number;
|
|
272
|
-
page_size?: number;
|
|
273
|
-
}): Promise<PaginatedResponse<FunnelResult<TEntity>>>;
|
|
274
|
-
/**
|
|
275
|
-
* Cancel running funnel
|
|
276
|
-
*
|
|
277
|
-
* @param runId - Run ID
|
|
278
|
-
* @returns Updated run with status 'cancelled'
|
|
279
|
-
* @throws ApiError with status 404 if not found, 400 if already completed
|
|
280
|
-
*/
|
|
281
|
-
cancelFunnelRun(runId: string): Promise<FunnelRun>;
|
|
282
|
-
/**
|
|
283
|
-
* Preview funnel with sample entities (client-side evaluation)
|
|
284
|
-
*
|
|
285
|
-
* Useful for testing funnel logic before running on full dataset.
|
|
286
|
-
* Does NOT hit the server - evaluates locally.
|
|
287
|
-
*
|
|
288
|
-
* Note: This requires the evaluation engine to be available client-side.
|
|
289
|
-
* If not available, this will throw an error.
|
|
290
|
-
*
|
|
291
|
-
* @param funnel - Funnel definition
|
|
292
|
-
* @param sampleEntities - Sample entities to test
|
|
293
|
-
* @returns Preview results showing which entities would match/exclude
|
|
294
|
-
*/
|
|
295
|
-
previewFunnel<TEntity = any>(funnel: Funnel<TEntity>, sampleEntities: TEntity[]): Promise<PreviewResult<TEntity>>;
|
|
296
|
-
/**
|
|
297
|
-
* Server-side preview (recommended)
|
|
298
|
-
*
|
|
299
|
-
* Send sample entities to server for evaluation.
|
|
300
|
-
* Useful for testing funnel logic before running on full dataset.
|
|
301
|
-
*
|
|
302
|
-
* @param funnelId - Funnel ID
|
|
303
|
-
* @param sampleEntities - Sample entities to test
|
|
304
|
-
* @returns Preview results
|
|
305
|
-
* @throws ApiError with status 404 if funnel not found
|
|
306
|
-
*/
|
|
307
|
-
previewFunnelServer<TEntity = any>(funnelId: string, sampleEntities: TEntity[]): Promise<PreviewResult<TEntity>>;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export { type ApiAdapter as A, FunnelApiClient as F, type PaginatedResponse as P, type ApiError as a, type FunnelListFilters as b, createApiError as c, isApiError as i };
|