@uptrademedia/site-kit 1.0.3 → 1.0.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 (77) hide show
  1. package/dist/SetupWizard-Cki06kB0.d.mts +12 -0
  2. package/dist/SetupWizard-Cki06kB0.d.ts +12 -0
  3. package/dist/analytics/index.d.mts +87 -0
  4. package/dist/analytics/index.d.ts +87 -0
  5. package/dist/blog/index.d.mts +24 -0
  6. package/dist/blog/index.d.ts +24 -0
  7. package/dist/{chunk-6EXHT7PS.mjs → chunk-2IHTEKHU.mjs} +5 -3
  8. package/dist/chunk-2IHTEKHU.mjs.map +1 -0
  9. package/dist/{chunk-63JNO4QN.mjs → chunk-DOHML47I.mjs} +2 -2
  10. package/dist/chunk-DOHML47I.mjs.map +1 -0
  11. package/dist/{chunk-YKMCG3DS.js → chunk-GAJLEDRD.js} +5 -3
  12. package/dist/chunk-GAJLEDRD.js.map +1 -0
  13. package/dist/{chunk-PYYEPAHL.js → chunk-K2HWVOEO.js} +2 -2
  14. package/dist/chunk-K2HWVOEO.js.map +1 -0
  15. package/dist/{chunk-JG2K4S2I.js → chunk-O2OHHBUD.js} +9 -9
  16. package/dist/chunk-O2OHHBUD.js.map +1 -0
  17. package/dist/{chunk-P7LGOKGI.mjs → chunk-XQJX252G.mjs} +9 -9
  18. package/dist/chunk-XQJX252G.mjs.map +1 -0
  19. package/dist/commerce/index.d.mts +168 -0
  20. package/dist/commerce/index.d.ts +168 -0
  21. package/dist/commerce/index.js +38 -38
  22. package/dist/commerce/index.mjs +1 -1
  23. package/dist/commerce/server.d.mts +98 -0
  24. package/dist/commerce/server.d.ts +98 -0
  25. package/dist/engage/index.d.mts +27 -0
  26. package/dist/engage/index.d.ts +27 -0
  27. package/dist/forms/index.d.mts +437 -0
  28. package/dist/forms/index.d.ts +437 -0
  29. package/dist/images/index.d.mts +133 -0
  30. package/dist/images/index.d.ts +133 -0
  31. package/dist/images/index.js +8 -8
  32. package/dist/images/index.mjs +1 -1
  33. package/dist/index.d.mts +649 -0
  34. package/dist/index.d.ts +649 -0
  35. package/dist/index.js +46 -46
  36. package/dist/index.mjs +3 -3
  37. package/dist/redirects/index.d.mts +72 -0
  38. package/dist/redirects/index.d.ts +72 -0
  39. package/dist/routing-BWjUF7lp.d.ts +105 -0
  40. package/dist/routing-CgmRi9tD.d.mts +105 -0
  41. package/dist/seo/index.d.mts +273 -0
  42. package/dist/seo/index.d.ts +273 -0
  43. package/dist/seo/server.d.mts +89 -0
  44. package/dist/seo/server.d.ts +89 -0
  45. package/dist/setup/client.d.mts +60 -0
  46. package/dist/setup/client.d.ts +60 -0
  47. package/dist/setup/index.d.mts +5 -0
  48. package/dist/setup/index.d.ts +5 -0
  49. package/dist/setup/index.js +2 -2
  50. package/dist/setup/index.mjs +1 -1
  51. package/dist/setup/server.d.mts +14 -0
  52. package/dist/setup/server.d.ts +14 -0
  53. package/dist/setup/server.js +2 -2
  54. package/dist/setup/server.mjs +1 -1
  55. package/dist/sitemap/index.d.mts +78 -0
  56. package/dist/sitemap/index.d.ts +78 -0
  57. package/dist/types-BDojCvvL.d.mts +156 -0
  58. package/dist/types-BDojCvvL.d.ts +156 -0
  59. package/dist/types-BmzutFwy.d.mts +227 -0
  60. package/dist/types-BmzutFwy.d.ts +227 -0
  61. package/dist/types-C0pJGfbH.d.mts +155 -0
  62. package/dist/types-C0pJGfbH.d.ts +155 -0
  63. package/dist/types-DA_Kocle.d.mts +127 -0
  64. package/dist/types-DA_Kocle.d.ts +127 -0
  65. package/dist/types-lFLKKn0G.d.mts +163 -0
  66. package/dist/types-lFLKKn0G.d.ts +163 -0
  67. package/dist/types-nB206tPK.d.mts +309 -0
  68. package/dist/types-nB206tPK.d.ts +309 -0
  69. package/dist/useEventModal-6U1pF3_g.d.mts +209 -0
  70. package/dist/useEventModal-BA8g-1-P.d.ts +209 -0
  71. package/package.json +1 -1
  72. package/dist/chunk-63JNO4QN.mjs.map +0 -1
  73. package/dist/chunk-6EXHT7PS.mjs.map +0 -1
  74. package/dist/chunk-JG2K4S2I.js.map +0 -1
  75. package/dist/chunk-P7LGOKGI.mjs.map +0 -1
  76. package/dist/chunk-PYYEPAHL.js.map +0 -1
  77. package/dist/chunk-YKMCG3DS.js.map +0 -1
@@ -0,0 +1,98 @@
1
+ import { O as OfferingType, C as CommerceOffering } from '../types-nB206tPK.js';
2
+
3
+ /**
4
+ * @uptrade/site-kit/commerce - Server-side utilities
5
+ *
6
+ * Helpers for server-side rendering and dynamic routes.
7
+ * Use in Next.js getStaticPaths, getStaticProps, or App Router.
8
+ */
9
+
10
+ interface ServerConfig {
11
+ supabaseUrl: string;
12
+ supabaseKey: string;
13
+ projectId: string;
14
+ }
15
+ /**
16
+ * Get all product slugs for static generation
17
+ *
18
+ * @example Next.js Pages Router
19
+ * export async function getStaticPaths() {
20
+ * const paths = await getProductPaths(config)
21
+ * return { paths, fallback: 'blocking' }
22
+ * }
23
+ */
24
+ declare function getProductPaths(config: ServerConfig): Promise<{
25
+ params: {
26
+ slug: string;
27
+ };
28
+ }[]>;
29
+ /**
30
+ * Get all event slugs for static generation
31
+ */
32
+ declare function getEventPaths(config: ServerConfig): Promise<{
33
+ params: {
34
+ slug: string;
35
+ };
36
+ }[]>;
37
+ /**
38
+ * Get all offering slugs for static generation (any type)
39
+ */
40
+ declare function getOfferingPaths(config: ServerConfig, type?: OfferingType | OfferingType[]): Promise<{
41
+ params: {
42
+ slug: string;
43
+ };
44
+ }[]>;
45
+ /**
46
+ * Fetch a single offering by slug (server-side)
47
+ *
48
+ * @example Next.js Pages Router
49
+ * export async function getStaticProps({ params }) {
50
+ * const product = await getOfferingBySlug(config, params.slug)
51
+ * if (!product) return { notFound: true }
52
+ * return { props: { product }, revalidate: 60 }
53
+ * }
54
+ */
55
+ declare function getOfferingBySlug(config: ServerConfig, slug: string): Promise<CommerceOffering | null>;
56
+ /**
57
+ * Fetch all offerings of a type (server-side)
58
+ */
59
+ declare function getOfferings(config: ServerConfig, options?: {
60
+ type?: OfferingType | OfferingType[];
61
+ category?: string;
62
+ limit?: number;
63
+ status?: string;
64
+ }): Promise<CommerceOffering[]>;
65
+ /**
66
+ * Fetch upcoming events (server-side)
67
+ */
68
+ declare function getUpcomingEvents(config: ServerConfig, options?: {
69
+ limit?: number;
70
+ category?: string;
71
+ }): Promise<CommerceOffering[]>;
72
+ /**
73
+ * Get next upcoming event (server-side)
74
+ */
75
+ declare function getNextEvent(config: ServerConfig, category?: string): Promise<CommerceOffering | null>;
76
+ /**
77
+ * Generate page metadata for an offering
78
+ *
79
+ * @example Next.js App Router
80
+ * export async function generateMetadata({ params }) {
81
+ * const product = await getOfferingBySlug(config, params.slug)
82
+ * return generateOfferingMetadata(product, 'https://example.com')
83
+ * }
84
+ */
85
+ declare function generateOfferingMetadata(offering: CommerceOffering | null, siteUrl: string): {
86
+ title: string;
87
+ description: string;
88
+ openGraph: {
89
+ title: string;
90
+ description: string;
91
+ images: string[];
92
+ type: string;
93
+ url: string;
94
+ };
95
+ } | null;
96
+ declare function createServerConfig(supabaseUrl: string, supabaseKey: string, projectId: string): ServerConfig;
97
+
98
+ export { createServerConfig, generateOfferingMetadata, getEventPaths, getNextEvent, getOfferingBySlug, getOfferingPaths, getOfferings, getProductPaths, getUpcomingEvents };
@@ -0,0 +1,27 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { C as ChatConfig } from '../types-C0pJGfbH.mjs';
3
+ export { d as ChatConversation, c as ChatMessage, f as EngageAnalytics, e as EngageConfig, E as EngageElement, T as TargetingRules, b as TriggerConfig, a as WidgetConfig, W as WidgetType } from '../types-C0pJGfbH.mjs';
4
+
5
+ /**
6
+ * @uptrade/site-kit/engage - Engage Widget
7
+ *
8
+ * Loads and renders engagement widgets (popups, nudges, bars, chat) via Portal API
9
+ */
10
+ interface EngageWidgetProps {
11
+ apiUrl?: string;
12
+ apiKey?: string;
13
+ position?: 'bottom-right' | 'bottom-left';
14
+ zIndex?: number;
15
+ chatEnabled?: boolean;
16
+ debug?: boolean;
17
+ }
18
+ declare function EngageWidget({ apiUrl: propApiUrl, apiKey: propApiKey, position, zIndex, chatEnabled, debug, }: EngageWidgetProps): react_jsx_runtime.JSX.Element;
19
+
20
+ interface ChatWidgetProps {
21
+ projectId: string;
22
+ config?: Partial<ChatConfig>;
23
+ signalApiUrl?: string;
24
+ }
25
+ declare function ChatWidget({ projectId, config, signalApiUrl }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
26
+
27
+ export { ChatConfig, ChatWidget, EngageWidget };
@@ -0,0 +1,27 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { C as ChatConfig } from '../types-C0pJGfbH.js';
3
+ export { d as ChatConversation, c as ChatMessage, f as EngageAnalytics, e as EngageConfig, E as EngageElement, T as TargetingRules, b as TriggerConfig, a as WidgetConfig, W as WidgetType } from '../types-C0pJGfbH.js';
4
+
5
+ /**
6
+ * @uptrade/site-kit/engage - Engage Widget
7
+ *
8
+ * Loads and renders engagement widgets (popups, nudges, bars, chat) via Portal API
9
+ */
10
+ interface EngageWidgetProps {
11
+ apiUrl?: string;
12
+ apiKey?: string;
13
+ position?: 'bottom-right' | 'bottom-left';
14
+ zIndex?: number;
15
+ chatEnabled?: boolean;
16
+ debug?: boolean;
17
+ }
18
+ declare function EngageWidget({ apiUrl: propApiUrl, apiKey: propApiKey, position, zIndex, chatEnabled, debug, }: EngageWidgetProps): react_jsx_runtime.JSX.Element;
19
+
20
+ interface ChatWidgetProps {
21
+ projectId: string;
22
+ config?: Partial<ChatConfig>;
23
+ signalApiUrl?: string;
24
+ }
25
+ declare function ChatWidget({ projectId, config, signalApiUrl }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
26
+
27
+ export { ChatConfig, ChatWidget, EngageWidget };
@@ -0,0 +1,437 @@
1
+ import { F as FormSubmission, M as ManagedFormConfig, a as FormField$2, b as ManagedFormProps, c as FormRenderProps } from '../types-lFLKKn0G.mjs';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import React__default from 'react';
4
+
5
+ /**
6
+ * @uptrade/site-kit/forms - Forms API Client
7
+ *
8
+ * Full API client for form management. Allows developers to create, update,
9
+ * and delete forms programmatically. Changes sync to Portal automatically.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * import { formsApi } from '@uptrade/site-kit/forms'
14
+ *
15
+ * // Create a new form
16
+ * const form = await formsApi.create({
17
+ * projectId: 'xxx',
18
+ * slug: 'contact-us',
19
+ * name: 'Contact Form',
20
+ * formType: 'prospect',
21
+ * fields: [
22
+ * { slug: 'name', label: 'Name', fieldType: 'text', isRequired: true },
23
+ * { slug: 'email', label: 'Email', fieldType: 'email', isRequired: true },
24
+ * { slug: 'message', label: 'Message', fieldType: 'textarea' },
25
+ * ]
26
+ * })
27
+ *
28
+ * // Update fields
29
+ * await formsApi.update(form.id, {
30
+ * fields: [...form.fields, { slug: 'phone', label: 'Phone', fieldType: 'phone' }]
31
+ * })
32
+ * ```
33
+ */
34
+ type FormType = 'prospect' | 'contact' | 'support' | 'feedback' | 'newsletter' | 'custom';
35
+ type FieldType = 'text' | 'email' | 'phone' | 'number' | 'textarea' | 'select' | 'multi_select' | 'radio' | 'checkbox' | 'date' | 'time' | 'datetime' | 'url' | 'file' | 'rating' | 'slider' | 'hidden' | 'heading' | 'paragraph';
36
+ type FieldWidth = 'full' | 'half' | 'third' | 'quarter';
37
+ interface FieldOption {
38
+ value: string;
39
+ label: string;
40
+ disabled?: boolean;
41
+ }
42
+ interface FieldValidation {
43
+ min?: number;
44
+ max?: number;
45
+ minLength?: number;
46
+ maxLength?: number;
47
+ pattern?: string;
48
+ patternMessage?: string;
49
+ }
50
+ interface FieldConditional {
51
+ field: string;
52
+ operator: 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'is_empty' | 'not_empty' | 'greater_than' | 'less_than';
53
+ value?: string | number | boolean;
54
+ }
55
+ interface FormField$1 {
56
+ id?: string;
57
+ slug: string;
58
+ label: string;
59
+ fieldType: FieldType;
60
+ placeholder?: string;
61
+ helpText?: string;
62
+ defaultValue?: string;
63
+ isRequired?: boolean;
64
+ validation?: FieldValidation;
65
+ options?: FieldOption[];
66
+ conditional?: FieldConditional;
67
+ width?: FieldWidth;
68
+ sortOrder?: number;
69
+ destinationField?: string;
70
+ stepId?: string;
71
+ }
72
+ interface FormStep {
73
+ id?: string;
74
+ stepNumber: number;
75
+ title?: string;
76
+ description?: string;
77
+ condition?: FieldConditional;
78
+ }
79
+ interface Form {
80
+ id: string;
81
+ projectId: string;
82
+ slug: string;
83
+ name: string;
84
+ description?: string;
85
+ formType: FormType;
86
+ successMessage: string;
87
+ redirectUrl?: string;
88
+ notificationEmails?: string[];
89
+ submitButtonText: string;
90
+ layout: 'stacked' | 'inline' | 'grid';
91
+ showProgress: boolean;
92
+ enableSaveDraft: boolean;
93
+ isActive: boolean;
94
+ createdAt: string;
95
+ updatedAt: string;
96
+ fields?: FormField$1[];
97
+ steps?: FormStep[];
98
+ }
99
+ interface CreateFormInput {
100
+ projectId: string;
101
+ slug: string;
102
+ name: string;
103
+ description?: string;
104
+ formType?: FormType;
105
+ successMessage?: string;
106
+ redirectUrl?: string;
107
+ notificationEmails?: string[];
108
+ submitButtonText?: string;
109
+ layout?: 'stacked' | 'inline' | 'grid';
110
+ showProgress?: boolean;
111
+ enableSaveDraft?: boolean;
112
+ isActive?: boolean;
113
+ fields?: FormField$1[];
114
+ steps?: FormStep[];
115
+ }
116
+ interface UpdateFormInput {
117
+ slug?: string;
118
+ name?: string;
119
+ description?: string;
120
+ formType?: FormType;
121
+ successMessage?: string;
122
+ redirectUrl?: string;
123
+ notificationEmails?: string[];
124
+ submitButtonText?: string;
125
+ layout?: 'stacked' | 'inline' | 'grid';
126
+ showProgress?: boolean;
127
+ enableSaveDraft?: boolean;
128
+ isActive?: boolean;
129
+ fields?: FormField$1[];
130
+ steps?: FormStep[];
131
+ }
132
+ interface FormsListOptions {
133
+ projectId?: string;
134
+ formType?: FormType;
135
+ isActive?: boolean;
136
+ search?: string;
137
+ }
138
+ interface FormsApiConfig {
139
+ baseUrl: string;
140
+ apiKey?: string;
141
+ getAuthToken?: () => Promise<string> | string;
142
+ }
143
+ /**
144
+ * Configure the forms API client
145
+ */
146
+ declare function configureFormsApi(options: FormsApiConfig): void;
147
+ declare const formsApi: {
148
+ /**
149
+ * List all forms for a project
150
+ */
151
+ list(options?: FormsListOptions): Promise<Form[]>;
152
+ /**
153
+ * Get a single form by ID or slug
154
+ */
155
+ get(idOrSlug: string): Promise<Form>;
156
+ /**
157
+ * Create a new form
158
+ */
159
+ create(input: CreateFormInput): Promise<Form>;
160
+ /**
161
+ * Update an existing form
162
+ */
163
+ update(id: string, input: UpdateFormInput): Promise<Form>;
164
+ /**
165
+ * Delete a form
166
+ */
167
+ delete(id: string): Promise<void>;
168
+ /**
169
+ * Add a field to an existing form
170
+ */
171
+ addField(formId: string, field: FormField$1): Promise<Form>;
172
+ /**
173
+ * Update a field in an existing form
174
+ */
175
+ updateField(formId: string, fieldSlug: string, updates: Partial<FormField$1>): Promise<Form>;
176
+ /**
177
+ * Remove a field from a form
178
+ */
179
+ removeField(formId: string, fieldSlug: string): Promise<Form>;
180
+ /**
181
+ * Reorder fields in a form
182
+ */
183
+ reorderFields(formId: string, fieldSlugs: string[]): Promise<Form>;
184
+ /**
185
+ * Clone a form
186
+ */
187
+ clone(formId: string, newSlug: string, newName?: string): Promise<Form>;
188
+ /**
189
+ * Activate or deactivate a form
190
+ */
191
+ setActive(formId: string, isActive: boolean): Promise<Form>;
192
+ /**
193
+ * Sync a form definition to the backend
194
+ * Creates the form if it doesn't exist, updates if it does
195
+ * Perfect for defining forms in code during development
196
+ *
197
+ * @example
198
+ * ```tsx
199
+ * // In your app initialization or form component
200
+ * await formsApi.sync({
201
+ * slug: 'contact',
202
+ * name: 'Contact Form',
203
+ * formType: 'prospect',
204
+ * fields: [
205
+ * field.text('name', 'Your Name', { isRequired: true }),
206
+ * field.email('email', 'Email Address'),
207
+ * field.phone('phone', 'Phone Number'),
208
+ * field.textarea('message', 'Message'),
209
+ * ]
210
+ * })
211
+ * ```
212
+ */
213
+ sync(input: Omit<CreateFormInput, "projectId">): Promise<Form & {
214
+ synced: boolean;
215
+ created: boolean;
216
+ updated: boolean;
217
+ }>;
218
+ /**
219
+ * Sync multiple forms at once
220
+ * Useful for initializing all forms in your app
221
+ */
222
+ syncAll(forms: Array<Omit<CreateFormInput, "projectId">>): Promise<Array<Form & {
223
+ synced: boolean;
224
+ created: boolean;
225
+ updated: boolean;
226
+ }>>;
227
+ };
228
+ /**
229
+ * Helper functions to build field definitions
230
+ */
231
+ declare const field: {
232
+ text: (slug: string, label: string, options?: Partial<FormField$1>) => FormField$1;
233
+ email: (slug: string, label: string, options?: Partial<FormField$1>) => FormField$1;
234
+ phone: (slug: string, label: string, options?: Partial<FormField$1>) => FormField$1;
235
+ textarea: (slug: string, label: string, options?: Partial<FormField$1>) => FormField$1;
236
+ select: (slug: string, label: string, choices: Array<{
237
+ value: string;
238
+ label: string;
239
+ }>, options?: Partial<FormField$1>) => FormField$1;
240
+ radio: (slug: string, label: string, choices: Array<{
241
+ value: string;
242
+ label: string;
243
+ }>, options?: Partial<FormField$1>) => FormField$1;
244
+ checkbox: (slug: string, label: string, options?: Partial<FormField$1>) => FormField$1;
245
+ date: (slug: string, label: string, options?: Partial<FormField$1>) => FormField$1;
246
+ number: (slug: string, label: string, options?: Partial<FormField$1>) => FormField$1;
247
+ rating: (slug: string, label: string, options?: Partial<FormField$1>) => FormField$1;
248
+ file: (slug: string, label: string, options?: Partial<FormField$1>) => FormField$1;
249
+ hidden: (slug: string, defaultValue: string) => FormField$1;
250
+ heading: (slug: string, label: string) => FormField$1;
251
+ paragraph: (slug: string, label: string) => FormField$1;
252
+ };
253
+ interface FormDefinition extends Omit<CreateFormInput, 'projectId'> {
254
+ slug: string;
255
+ name: string;
256
+ fields: FormField$1[];
257
+ }
258
+ /**
259
+ * Define a form declaratively
260
+ * Returns a form definition that can be synced to the backend
261
+ *
262
+ * @example
263
+ * ```tsx
264
+ * // forms/contact.ts
265
+ * import { defineForm, field } from '@uptrade/site-kit/forms'
266
+ *
267
+ * export const contactForm = defineForm({
268
+ * slug: 'contact',
269
+ * name: 'Contact Us',
270
+ * formType: 'prospect',
271
+ * successMessage: 'Thanks! We\'ll be in touch soon.',
272
+ * fields: [
273
+ * field.text('name', 'Your Name', { isRequired: true }),
274
+ * field.email('email', 'Email Address'),
275
+ * field.phone('phone', 'Phone Number'),
276
+ * field.select('service', 'Service Needed', [
277
+ * { value: 'consultation', label: 'Free Consultation' },
278
+ * { value: 'representation', label: 'Legal Representation' },
279
+ * ]),
280
+ * field.textarea('message', 'Tell us about your case'),
281
+ * ]
282
+ * })
283
+ *
284
+ * // Then in your app:
285
+ * await formsApi.sync(contactForm)
286
+ * ```
287
+ */
288
+ declare function defineForm(definition: FormDefinition): FormDefinition;
289
+ /**
290
+ * Initialize multiple forms and sync them to the backend
291
+ * Call this once during app initialization (e.g., in layout.tsx or _app.tsx)
292
+ *
293
+ * @example
294
+ * ```tsx
295
+ * // app/layout.tsx
296
+ * import { initializeForms } from '@uptrade/site-kit/forms'
297
+ * import { contactForm } from './forms/contact'
298
+ * import { consultationForm } from './forms/consultation'
299
+ *
300
+ * // Initialize forms (runs once per build/server start in dev)
301
+ * if (process.env.NODE_ENV === 'development') {
302
+ * initializeForms([contactForm, consultationForm])
303
+ * }
304
+ * ```
305
+ */
306
+ declare function initializeForms(forms: FormDefinition[]): Promise<void>;
307
+
308
+ /**
309
+ * @uptrade/site-kit/forms - useForm Hook
310
+ *
311
+ * Headless hook for complete control over form rendering.
312
+ * Fetches form config from API, handles validation, state, and submission.
313
+ *
314
+ * @example
315
+ * ```tsx
316
+ * const { form, fields, values, errors, setFieldValue, submit, isSubmitting } = useForm('contact-form')
317
+ *
318
+ * return (
319
+ * <form onSubmit={(e) => { e.preventDefault(); submit() }}>
320
+ * {fields.map(field => (
321
+ * <MyCustomInput
322
+ * key={field.slug}
323
+ * label={field.label}
324
+ * value={values[field.slug]}
325
+ * error={errors[field.slug]}
326
+ * onChange={(val) => setFieldValue(field.slug, val)}
327
+ * />
328
+ * ))}
329
+ * <button type="submit" disabled={isSubmitting}>Submit</button>
330
+ * </form>
331
+ * )
332
+ * ```
333
+ */
334
+
335
+ interface UseFormOptions {
336
+ /** Project ID (defaults to SiteKitProvider config) */
337
+ projectId?: string;
338
+ /** Callback when form submits successfully */
339
+ onSuccess?: (submission: FormSubmission) => void;
340
+ /** Callback when submission fails */
341
+ onError?: (error: Error) => void;
342
+ /** Initial values to prefill */
343
+ initialValues?: Record<string, unknown>;
344
+ /** Auto-redirect after success (override form config) */
345
+ redirectUrl?: string | false;
346
+ }
347
+ interface UseFormReturn {
348
+ /** Form configuration (null while loading) */
349
+ form: ManagedFormConfig | null;
350
+ /** Loading state */
351
+ isLoading: boolean;
352
+ /** Error fetching form */
353
+ fetchError: Error | null;
354
+ /** All form fields */
355
+ allFields: FormField$2[];
356
+ /** Fields for current step (multi-step) or all fields (single step) */
357
+ fields: FormField$2[];
358
+ /** Visible fields only (respecting conditional logic) */
359
+ visibleFields: FormField$2[];
360
+ /** Current form values */
361
+ values: Record<string, unknown>;
362
+ /** Current validation errors */
363
+ errors: Record<string, string>;
364
+ /** Set a single field value */
365
+ setFieldValue: (key: string, value: unknown) => void;
366
+ /** Set multiple field values at once */
367
+ setValues: (values: Record<string, unknown>) => void;
368
+ /** Clear all errors */
369
+ clearErrors: () => void;
370
+ /** Multi-step state */
371
+ step: number;
372
+ totalSteps: number;
373
+ isMultiStep: boolean;
374
+ progress: number;
375
+ /** Multi-step navigation */
376
+ nextStep: () => boolean;
377
+ prevStep: () => void;
378
+ goToStep: (step: number) => void;
379
+ canGoNext: boolean;
380
+ canGoPrev: boolean;
381
+ isLastStep: boolean;
382
+ /** Validate current step */
383
+ validate: () => boolean;
384
+ /** Validate a single field */
385
+ validateField: (field: FormField$2) => string | null;
386
+ /** Check if a field is visible (conditional logic) */
387
+ isFieldVisible: (field: FormField$2) => boolean;
388
+ /** Submit the form */
389
+ submit: () => Promise<void>;
390
+ /** Submission state */
391
+ isSubmitting: boolean;
392
+ isComplete: boolean;
393
+ /** Reset form to initial state */
394
+ reset: () => void;
395
+ }
396
+ declare function useForm(formIdOrSlug: string, options?: UseFormOptions): UseFormReturn;
397
+
398
+ declare function ManagedForm({ formId, projectId, className, onSuccess, onError, children, }: ManagedFormProps): react_jsx_runtime.JSX.Element;
399
+
400
+ interface FormClientProps {
401
+ config: ManagedFormConfig;
402
+ className?: string;
403
+ onSuccess?: (submission: FormSubmission) => void;
404
+ onError?: (error: Error) => void;
405
+ customRender?: (props: FormRenderProps) => React__default.ReactNode;
406
+ }
407
+ declare function FormClient({ config, className, onSuccess, onError, customRender, }: FormClientProps): react_jsx_runtime.JSX.Element;
408
+
409
+ interface FormFieldProps {
410
+ field: FormField$2;
411
+ value: unknown;
412
+ error?: string;
413
+ onChange: (value: unknown) => void;
414
+ /** Optional class name prefix for custom styling */
415
+ classPrefix?: string;
416
+ }
417
+ declare function FormField({ field, value, error, onChange, classPrefix }: FormFieldProps): react_jsx_runtime.JSX.Element;
418
+
419
+ /**
420
+ * @uptrade/site-kit/forms - Form Tracking Hook
421
+ *
422
+ * Tracks form analytics including step progress and abandonment
423
+ */
424
+ interface UseFormTrackingOptions {
425
+ formId: string;
426
+ totalSteps: number;
427
+ enabled?: boolean;
428
+ debug?: boolean;
429
+ }
430
+ interface FormTrackingReturn {
431
+ trackStepChange: (step: number) => void;
432
+ trackComplete: () => void;
433
+ sessionId: string;
434
+ }
435
+ declare function useFormTracking({ formId, totalSteps, enabled, debug, }: UseFormTrackingOptions): FormTrackingReturn;
436
+
437
+ export { type CreateFormInput, type FieldType, type Form, FormClient, type FormDefinition, type FormField$1 as FormField, FormField as FormFieldComponent, FormField$2 as FormFieldConfig, type FormStep, FormSubmission, type FormType, type FormsListOptions, ManagedForm, ManagedFormConfig, type UpdateFormInput, type UseFormOptions, type UseFormReturn, configureFormsApi, defineForm, field, formsApi, initializeForms, useForm, useFormTracking };