@marvalt/madapter 1.0.14
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 +28 -0
- package/README.md +422 -0
- package/dist/client/mautic-client.d.ts +88 -0
- package/dist/client/mautic-client.d.ts.map +1 -0
- package/dist/data/mautic-data-store.d.ts +84 -0
- package/dist/data/mautic-data-store.d.ts.map +1 -0
- package/dist/generators/mautic-generator.d.ts +48 -0
- package/dist/generators/mautic-generator.d.ts.map +1 -0
- package/dist/index.cjs +3199 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +770 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +3141 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/react/components/MauticForm.d.ts +31 -0
- package/dist/react/components/MauticForm.d.ts.map +1 -0
- package/dist/react/components/MauticTracking.d.ts +42 -0
- package/dist/react/components/MauticTracking.d.ts.map +1 -0
- package/dist/react/hooks/useMautic.d.ts +98 -0
- package/dist/react/hooks/useMautic.d.ts.map +1 -0
- package/dist/react/providers/MauticProvider.d.ts +42 -0
- package/dist/react/providers/MauticProvider.d.ts.map +1 -0
- package/dist/service/mautic-service.d.ts +40 -0
- package/dist/service/mautic-service.d.ts.map +1 -0
- package/dist/setupTests.d.ts +18 -0
- package/dist/setupTests.d.ts.map +1 -0
- package/dist/types/config.d.ts +46 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/mautic.d.ts +108 -0
- package/dist/types/mautic.d.ts.map +1 -0
- package/dist/types/static-data.d.ts +59 -0
- package/dist/types/static-data.d.ts.map +1 -0
- package/dist/utils/config.d.ts +54 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/validation.d.ts +58 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/package.json +90 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,770 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @license GPL-3.0-or-later
|
|
6
|
+
*
|
|
7
|
+
* This file is part of the MarVAlt Open SDK.
|
|
8
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
9
|
+
*
|
|
10
|
+
* This program is free software: you can redistribute it and/or modify
|
|
11
|
+
* it under the terms of the GNU General Public License as published by
|
|
12
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
13
|
+
* (at your option) any later version.
|
|
14
|
+
*
|
|
15
|
+
* This program is distributed in the hope that it will be useful,
|
|
16
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
18
|
+
* See the GNU General Public License for more details.
|
|
19
|
+
*/
|
|
20
|
+
type AuthMode = 'cloudflare_proxy' | 'direct';
|
|
21
|
+
interface MauticConfig {
|
|
22
|
+
authMode: AuthMode;
|
|
23
|
+
apiUrl?: string;
|
|
24
|
+
cloudflareWorkerUrl?: string;
|
|
25
|
+
appId?: string;
|
|
26
|
+
workerSecret?: string;
|
|
27
|
+
timeout?: number;
|
|
28
|
+
retries?: number;
|
|
29
|
+
}
|
|
30
|
+
interface MauticGeneratorConfig {
|
|
31
|
+
authMode: AuthMode;
|
|
32
|
+
apiUrl?: string;
|
|
33
|
+
cloudflareWorkerUrl?: string;
|
|
34
|
+
appId?: string;
|
|
35
|
+
workerSecret?: string;
|
|
36
|
+
outputPath: string;
|
|
37
|
+
formIds?: number[];
|
|
38
|
+
includeInactive?: boolean;
|
|
39
|
+
timeout?: number;
|
|
40
|
+
retries?: number;
|
|
41
|
+
}
|
|
42
|
+
interface MauticTrackingConfig {
|
|
43
|
+
enabled?: boolean;
|
|
44
|
+
mauticUrl?: string;
|
|
45
|
+
proxyUrl?: string;
|
|
46
|
+
appId?: string;
|
|
47
|
+
workerSecret?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @license GPL-3.0-or-later
|
|
52
|
+
*
|
|
53
|
+
* This file is part of the MarVAlt Open SDK.
|
|
54
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
55
|
+
*
|
|
56
|
+
* This program is free software: you can redistribute it and/or modify
|
|
57
|
+
* it under the terms of the GNU General Public License as published by
|
|
58
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
59
|
+
* (at your option) any later version.
|
|
60
|
+
*
|
|
61
|
+
* This program is distributed in the hope that it will be useful,
|
|
62
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
63
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
64
|
+
* See the GNU General Public License for more details.
|
|
65
|
+
*/
|
|
66
|
+
interface MauticContact {
|
|
67
|
+
id?: number;
|
|
68
|
+
email: string;
|
|
69
|
+
firstname?: string;
|
|
70
|
+
lastname?: string;
|
|
71
|
+
company?: string;
|
|
72
|
+
phone?: string;
|
|
73
|
+
tags?: string[];
|
|
74
|
+
customFields?: {
|
|
75
|
+
[key: string]: unknown;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
interface MauticFormSubmission {
|
|
79
|
+
formId: number;
|
|
80
|
+
fields: {
|
|
81
|
+
[fieldName: string]: unknown;
|
|
82
|
+
};
|
|
83
|
+
contact?: MauticContact;
|
|
84
|
+
formName?: string;
|
|
85
|
+
returnUrl?: string;
|
|
86
|
+
}
|
|
87
|
+
interface MauticFormField {
|
|
88
|
+
id: number;
|
|
89
|
+
label: string;
|
|
90
|
+
alias: string;
|
|
91
|
+
type: string;
|
|
92
|
+
isRequired: boolean;
|
|
93
|
+
validationMessage?: string;
|
|
94
|
+
defaultValue?: string;
|
|
95
|
+
properties?: {
|
|
96
|
+
placeholder?: string;
|
|
97
|
+
cssClass?: string;
|
|
98
|
+
validation?: string[];
|
|
99
|
+
options?: string[];
|
|
100
|
+
helpText?: string;
|
|
101
|
+
size?: string;
|
|
102
|
+
[key: string]: unknown;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
interface MauticFormAction {
|
|
106
|
+
id: number;
|
|
107
|
+
name: string;
|
|
108
|
+
type: 'email' | 'notification' | 'tag' | 'segment';
|
|
109
|
+
properties: {
|
|
110
|
+
email?: string;
|
|
111
|
+
subject?: string;
|
|
112
|
+
message?: string;
|
|
113
|
+
tags?: string[];
|
|
114
|
+
segmentId?: number;
|
|
115
|
+
[key: string]: unknown;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
interface MauticForm$1 {
|
|
119
|
+
id: number;
|
|
120
|
+
name: string;
|
|
121
|
+
alias?: string;
|
|
122
|
+
description?: string;
|
|
123
|
+
fields: MauticFormField[];
|
|
124
|
+
actions: MauticFormAction[];
|
|
125
|
+
cssClass?: string;
|
|
126
|
+
submitAction?: string;
|
|
127
|
+
postAction?: string;
|
|
128
|
+
postActionProperty?: string;
|
|
129
|
+
formType?: string;
|
|
130
|
+
isPublished?: boolean;
|
|
131
|
+
}
|
|
132
|
+
interface MauticFormConfig {
|
|
133
|
+
id: number;
|
|
134
|
+
name: string;
|
|
135
|
+
description?: string;
|
|
136
|
+
fields: MauticFormField[];
|
|
137
|
+
actions: MauticFormAction[];
|
|
138
|
+
cssClass?: string;
|
|
139
|
+
submitAction?: string;
|
|
140
|
+
postAction?: string;
|
|
141
|
+
postActionProperty?: string;
|
|
142
|
+
formType?: string;
|
|
143
|
+
isPublished?: boolean;
|
|
144
|
+
}
|
|
145
|
+
interface MauticEvent {
|
|
146
|
+
eventName: string;
|
|
147
|
+
eventData?: Record<string, any>;
|
|
148
|
+
email?: string;
|
|
149
|
+
contactId?: number;
|
|
150
|
+
}
|
|
151
|
+
interface MauticApiResponse<T = any> {
|
|
152
|
+
success: boolean;
|
|
153
|
+
data?: T;
|
|
154
|
+
error?: string;
|
|
155
|
+
message?: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @license GPL-3.0-or-later
|
|
160
|
+
*
|
|
161
|
+
* This file is part of the MarVAlt Open SDK.
|
|
162
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
163
|
+
*
|
|
164
|
+
* This program is free software: you can redistribute it and/or modify
|
|
165
|
+
* it under the terms of the GNU General Public License as published by
|
|
166
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
167
|
+
* (at your option) any later version.
|
|
168
|
+
*
|
|
169
|
+
* This program is distributed in the hope that it will be useful,
|
|
170
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
171
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
172
|
+
* See the GNU General Public License for more details.
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
declare class MauticClient {
|
|
176
|
+
private baseUrl;
|
|
177
|
+
private proxyUrl?;
|
|
178
|
+
private appId?;
|
|
179
|
+
private workerSecret?;
|
|
180
|
+
private useProxy;
|
|
181
|
+
private isConfigured;
|
|
182
|
+
private config;
|
|
183
|
+
constructor(config: MauticConfig);
|
|
184
|
+
private validateConfiguration;
|
|
185
|
+
private getAuthHeaders;
|
|
186
|
+
private makeRequest;
|
|
187
|
+
/**
|
|
188
|
+
* Submit a form to Mautic
|
|
189
|
+
*/
|
|
190
|
+
submitForm(formId: number, submission: MauticFormSubmission): Promise<MauticApiResponse>;
|
|
191
|
+
/**
|
|
192
|
+
* Create a new contact in Mautic
|
|
193
|
+
*/
|
|
194
|
+
createContact(contact: MauticContact): Promise<MauticApiResponse>;
|
|
195
|
+
/**
|
|
196
|
+
* Update an existing contact in Mautic
|
|
197
|
+
*/
|
|
198
|
+
updateContact(contactId: number, contact: Partial<MauticContact>): Promise<MauticApiResponse>;
|
|
199
|
+
/**
|
|
200
|
+
* Get a contact by email
|
|
201
|
+
*/
|
|
202
|
+
getContactByEmail(email: string): Promise<MauticApiResponse>;
|
|
203
|
+
/**
|
|
204
|
+
* Get all forms from Mautic
|
|
205
|
+
*/
|
|
206
|
+
getForms(): Promise<MauticForm$1[]>;
|
|
207
|
+
/**
|
|
208
|
+
* Get a specific form by ID
|
|
209
|
+
*/
|
|
210
|
+
getForm(formId: number): Promise<MauticForm$1>;
|
|
211
|
+
/**
|
|
212
|
+
* Track an event in Mautic
|
|
213
|
+
*/
|
|
214
|
+
trackEvent(eventName: string, eventData?: Record<string, any>): Promise<MauticApiResponse>;
|
|
215
|
+
/**
|
|
216
|
+
* Add tags to a contact
|
|
217
|
+
*/
|
|
218
|
+
addTagToContact(contactId: number, tags: string[]): Promise<MauticApiResponse>;
|
|
219
|
+
/**
|
|
220
|
+
* Remove tags from a contact
|
|
221
|
+
*/
|
|
222
|
+
removeTagFromContact(contactId: number, tags: string[]): Promise<MauticApiResponse>;
|
|
223
|
+
/**
|
|
224
|
+
* Get contact tags
|
|
225
|
+
*/
|
|
226
|
+
getContactTags(contactId: number): Promise<MauticApiResponse>;
|
|
227
|
+
/**
|
|
228
|
+
* Get all tags
|
|
229
|
+
*/
|
|
230
|
+
getTags(): Promise<MauticApiResponse>;
|
|
231
|
+
/**
|
|
232
|
+
* Get segments
|
|
233
|
+
*/
|
|
234
|
+
getSegments(): Promise<MauticApiResponse>;
|
|
235
|
+
/**
|
|
236
|
+
* Add contact to segment
|
|
237
|
+
*/
|
|
238
|
+
addContactToSegment(contactId: number, segmentId: number): Promise<MauticApiResponse>;
|
|
239
|
+
/**
|
|
240
|
+
* Remove contact from segment
|
|
241
|
+
*/
|
|
242
|
+
removeContactFromSegment(contactId: number, segmentId: number): Promise<MauticApiResponse>;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* @license GPL-3.0-or-later
|
|
247
|
+
*
|
|
248
|
+
* This file is part of the MarVAlt Open SDK.
|
|
249
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
250
|
+
*
|
|
251
|
+
* This program is free software: you can redistribute it and/or modify
|
|
252
|
+
* it under the terms of the GNU General Public License as published by
|
|
253
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
254
|
+
* (at your option) any later version.
|
|
255
|
+
*
|
|
256
|
+
* This program is distributed in the hope that it will be useful,
|
|
257
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
258
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
259
|
+
* See the GNU General Public License for more details.
|
|
260
|
+
*/
|
|
261
|
+
|
|
262
|
+
declare class MauticService {
|
|
263
|
+
private client;
|
|
264
|
+
constructor();
|
|
265
|
+
isServiceConfigured(): boolean;
|
|
266
|
+
submitForm(formId: number, formData: MauticFormSubmission): Promise<any>;
|
|
267
|
+
getForms(): Promise<MauticForm$1[]>;
|
|
268
|
+
getForm(formId: number): Promise<MauticForm$1>;
|
|
269
|
+
getFormConfig(formId: number): Promise<MauticFormConfig>;
|
|
270
|
+
getFormFields(formId: number): Promise<MauticFormField[]>;
|
|
271
|
+
getFormActions(formId: number): Promise<MauticFormAction[]>;
|
|
272
|
+
getFormValidation(formId: number): Promise<Record<string, any>>;
|
|
273
|
+
createContact(contact: MauticContact): Promise<any>;
|
|
274
|
+
updateContact(contactId: number, contact: Partial<MauticContact>): Promise<any>;
|
|
275
|
+
getContact(contactId: number): Promise<MauticContact>;
|
|
276
|
+
getContactByEmail(email: string): Promise<MauticContact | null>;
|
|
277
|
+
addTagToContact(contactId: number, tags: string[]): Promise<any>;
|
|
278
|
+
removeTagFromContact(contactId: number, tags: string[]): Promise<any>;
|
|
279
|
+
trackEvent(eventName: string, eventData?: Record<string, any>): Promise<any>;
|
|
280
|
+
}
|
|
281
|
+
declare const mauticService: MauticService;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* @license GPL-3.0-or-later
|
|
285
|
+
*
|
|
286
|
+
* This file is part of the MarVAlt Open SDK.
|
|
287
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
288
|
+
*
|
|
289
|
+
* This program is free software: you can redistribute it and/or modify
|
|
290
|
+
* it under the terms of the GNU General Public License as published by
|
|
291
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
292
|
+
* (at your option) any later version.
|
|
293
|
+
*
|
|
294
|
+
* This program is distributed in the hope that it will be useful,
|
|
295
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
296
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
297
|
+
* See the GNU General Public License for more details.
|
|
298
|
+
*/
|
|
299
|
+
|
|
300
|
+
interface MauticStaticData {
|
|
301
|
+
generated_at: string;
|
|
302
|
+
total_forms: number;
|
|
303
|
+
forms: MauticForm$1[];
|
|
304
|
+
}
|
|
305
|
+
interface MauticFormData {
|
|
306
|
+
id: string;
|
|
307
|
+
name: string;
|
|
308
|
+
description?: string;
|
|
309
|
+
isPublished: boolean;
|
|
310
|
+
postAction?: string;
|
|
311
|
+
postActionProperty?: string;
|
|
312
|
+
formType?: string;
|
|
313
|
+
fields: Array<{
|
|
314
|
+
id: number;
|
|
315
|
+
label: string;
|
|
316
|
+
alias: string;
|
|
317
|
+
type: string;
|
|
318
|
+
isRequired: boolean;
|
|
319
|
+
validationMessage?: string;
|
|
320
|
+
defaultValue?: string;
|
|
321
|
+
properties?: {
|
|
322
|
+
placeholder?: string;
|
|
323
|
+
cssClass?: string;
|
|
324
|
+
validation?: string[];
|
|
325
|
+
options?: string[];
|
|
326
|
+
helpText?: string;
|
|
327
|
+
size?: string;
|
|
328
|
+
[key: string]: unknown;
|
|
329
|
+
};
|
|
330
|
+
}>;
|
|
331
|
+
actions: Array<{
|
|
332
|
+
id: number;
|
|
333
|
+
name: string;
|
|
334
|
+
type: string;
|
|
335
|
+
properties: Record<string, unknown>;
|
|
336
|
+
}>;
|
|
337
|
+
cssClass?: string;
|
|
338
|
+
submitAction?: string;
|
|
339
|
+
[key: string]: unknown;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* @license GPL-3.0-or-later
|
|
344
|
+
*
|
|
345
|
+
* This file is part of the MarVAlt Open SDK.
|
|
346
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
347
|
+
*
|
|
348
|
+
* This program is free software: you can redistribute it and/or modify
|
|
349
|
+
* it under the terms of the GNU General Public License as published by
|
|
350
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
351
|
+
* (at your option) any later version.
|
|
352
|
+
*
|
|
353
|
+
* This program is distributed in the hope that it will be useful,
|
|
354
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
355
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
356
|
+
* See the GNU General Public License for more details.
|
|
357
|
+
*/
|
|
358
|
+
|
|
359
|
+
declare class MauticGenerator {
|
|
360
|
+
private client;
|
|
361
|
+
private config;
|
|
362
|
+
constructor(config: MauticGeneratorConfig);
|
|
363
|
+
/**
|
|
364
|
+
* Generate static data for Mautic forms
|
|
365
|
+
*/
|
|
366
|
+
generateStaticData(): Promise<MauticStaticData>;
|
|
367
|
+
/**
|
|
368
|
+
* Write static data to file
|
|
369
|
+
*/
|
|
370
|
+
writeStaticData(staticData: MauticStaticData): Promise<void>;
|
|
371
|
+
/**
|
|
372
|
+
* Generate and write static data
|
|
373
|
+
*/
|
|
374
|
+
generateAndWrite(): Promise<MauticStaticData>;
|
|
375
|
+
/**
|
|
376
|
+
* Fetch list of forms from Mautic
|
|
377
|
+
*/
|
|
378
|
+
private fetchMauticFormsList;
|
|
379
|
+
/**
|
|
380
|
+
* Fetch individual form details from Mautic
|
|
381
|
+
*/
|
|
382
|
+
private fetchMauticForm;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Generate Mautic static data with configuration
|
|
386
|
+
*/
|
|
387
|
+
declare function generateMauticData(config: MauticGeneratorConfig): Promise<MauticStaticData>;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* @license GPL-3.0-or-later
|
|
391
|
+
*
|
|
392
|
+
* This file is part of the MarVAlt Open SDK.
|
|
393
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
394
|
+
*
|
|
395
|
+
* This program is free software: you can redistribute it and/or modify
|
|
396
|
+
* it under the terms of the GNU General Public License as published by
|
|
397
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
398
|
+
* (at your option) any later version.
|
|
399
|
+
*
|
|
400
|
+
* This program is distributed in the hope that it will be useful,
|
|
401
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
402
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
403
|
+
* See the GNU General Public License for more details.
|
|
404
|
+
*/
|
|
405
|
+
|
|
406
|
+
interface MauticFormProps {
|
|
407
|
+
formId: string;
|
|
408
|
+
title?: string;
|
|
409
|
+
description?: string;
|
|
410
|
+
className?: string;
|
|
411
|
+
form?: MauticForm$1;
|
|
412
|
+
onSubmit?: (data: any) => void;
|
|
413
|
+
onSuccess?: (data: any) => void;
|
|
414
|
+
onError?: (error: Error) => void;
|
|
415
|
+
}
|
|
416
|
+
declare const MauticForm: React.FC<MauticFormProps>;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* @license GPL-3.0-or-later
|
|
420
|
+
*
|
|
421
|
+
* This file is part of the MarVAlt Open SDK.
|
|
422
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
423
|
+
*
|
|
424
|
+
* This program is free software: you can redistribute it and/or modify
|
|
425
|
+
* it under the terms of the GNU General Public License as published by
|
|
426
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
427
|
+
* (at your option) any later version.
|
|
428
|
+
*
|
|
429
|
+
* This program is distributed in the hope that it will be useful,
|
|
430
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
431
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
432
|
+
* See the GNU General Public License for more details.
|
|
433
|
+
*/
|
|
434
|
+
|
|
435
|
+
interface MauticTrackingProps extends MauticTrackingConfig {
|
|
436
|
+
children?: React.ReactNode;
|
|
437
|
+
}
|
|
438
|
+
declare global {
|
|
439
|
+
interface Window {
|
|
440
|
+
mt: any;
|
|
441
|
+
MauticTrackingObject: string;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
declare const MauticTracking: React.FC<MauticTrackingProps>;
|
|
445
|
+
/**
|
|
446
|
+
* Hook to check if Mautic tracking is available
|
|
447
|
+
*/
|
|
448
|
+
declare const useMauticTracking: () => boolean;
|
|
449
|
+
/**
|
|
450
|
+
* Hook to track Mautic events
|
|
451
|
+
*/
|
|
452
|
+
declare const useMauticEvent: () => {
|
|
453
|
+
isAvailable: boolean;
|
|
454
|
+
trackEvent: (eventName: string, eventData?: Record<string, any>) => void;
|
|
455
|
+
trackPageview: () => void;
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Set the default Mautic client for hooks
|
|
460
|
+
*/
|
|
461
|
+
declare const setMauticClient: (client: MauticClient) => void;
|
|
462
|
+
/**
|
|
463
|
+
* Custom hook for submitting forms to Mautic
|
|
464
|
+
*/
|
|
465
|
+
declare const useMauticFormSubmission: () => _tanstack_react_query.UseMutationResult<MauticApiResponse<any>, Error, MauticFormSubmission, unknown>;
|
|
466
|
+
/**
|
|
467
|
+
* Custom hook for creating Mautic contacts
|
|
468
|
+
*/
|
|
469
|
+
declare const useMauticCreateContact: () => _tanstack_react_query.UseMutationResult<MauticApiResponse<any>, Error, MauticContact, unknown>;
|
|
470
|
+
/**
|
|
471
|
+
* Custom hook for updating Mautic contacts
|
|
472
|
+
*/
|
|
473
|
+
declare const useMauticUpdateContact: () => _tanstack_react_query.UseMutationResult<MauticApiResponse<any>, Error, {
|
|
474
|
+
contactId: number;
|
|
475
|
+
contact: Partial<MauticContact>;
|
|
476
|
+
}, unknown>;
|
|
477
|
+
/**
|
|
478
|
+
* Custom hook for fetching Mautic contact by email
|
|
479
|
+
*/
|
|
480
|
+
declare const useMauticContactByEmail: (email: string) => _tanstack_react_query.UseQueryResult<MauticApiResponse<any>, Error>;
|
|
481
|
+
/**
|
|
482
|
+
* Custom hook for fetching Mautic forms
|
|
483
|
+
*/
|
|
484
|
+
declare const useMauticForms: () => _tanstack_react_query.UseQueryResult<MauticForm$1[], Error>;
|
|
485
|
+
/**
|
|
486
|
+
* Custom hook for fetching a specific Mautic form
|
|
487
|
+
*/
|
|
488
|
+
declare const useMauticForm: (formId: number) => _tanstack_react_query.UseQueryResult<MauticForm$1, Error>;
|
|
489
|
+
/**
|
|
490
|
+
* Custom hook for tracking Mautic events
|
|
491
|
+
*/
|
|
492
|
+
declare const useMauticEventTracking: () => _tanstack_react_query.UseMutationResult<MauticApiResponse<any>, Error, {
|
|
493
|
+
email: string;
|
|
494
|
+
eventName: string;
|
|
495
|
+
eventData?: Record<string, any>;
|
|
496
|
+
}, unknown>;
|
|
497
|
+
/**
|
|
498
|
+
* Custom hook for adding tags to contacts
|
|
499
|
+
*/
|
|
500
|
+
declare const useMauticAddTags: () => _tanstack_react_query.UseMutationResult<MauticApiResponse<any>, Error, {
|
|
501
|
+
contactId: number;
|
|
502
|
+
tags: string[];
|
|
503
|
+
}, unknown>;
|
|
504
|
+
/**
|
|
505
|
+
* Custom hook for removing tags from contacts
|
|
506
|
+
*/
|
|
507
|
+
declare const useMauticRemoveTags: () => _tanstack_react_query.UseMutationResult<MauticApiResponse<any>, Error, {
|
|
508
|
+
contactId: number;
|
|
509
|
+
tags: string[];
|
|
510
|
+
}, unknown>;
|
|
511
|
+
/**
|
|
512
|
+
* Custom hook for getting contact tags
|
|
513
|
+
*/
|
|
514
|
+
declare const useMauticContactTags: (contactId: number) => _tanstack_react_query.UseQueryResult<MauticApiResponse<any>, Error>;
|
|
515
|
+
/**
|
|
516
|
+
* Custom hook for getting all tags
|
|
517
|
+
*/
|
|
518
|
+
declare const useMauticTags: () => _tanstack_react_query.UseQueryResult<MauticApiResponse<any>, Error>;
|
|
519
|
+
/**
|
|
520
|
+
* Custom hook for getting segments
|
|
521
|
+
*/
|
|
522
|
+
declare const useMauticSegments: () => _tanstack_react_query.UseQueryResult<MauticApiResponse<any>, Error>;
|
|
523
|
+
/**
|
|
524
|
+
* Custom hook for adding contact to segment
|
|
525
|
+
*/
|
|
526
|
+
declare const useMauticAddToSegment: () => _tanstack_react_query.UseMutationResult<MauticApiResponse<any>, Error, {
|
|
527
|
+
contactId: number;
|
|
528
|
+
segmentId: number;
|
|
529
|
+
}, unknown>;
|
|
530
|
+
/**
|
|
531
|
+
* Custom hook for removing contact from segment
|
|
532
|
+
*/
|
|
533
|
+
declare const useMauticRemoveFromSegment: () => _tanstack_react_query.UseMutationResult<MauticApiResponse<any>, Error, {
|
|
534
|
+
contactId: number;
|
|
535
|
+
segmentId: number;
|
|
536
|
+
}, unknown>;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* @license GPL-3.0-or-later
|
|
540
|
+
*
|
|
541
|
+
* This file is part of the MarVAlt Open SDK.
|
|
542
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
543
|
+
*
|
|
544
|
+
* This program is free software: you can redistribute it and/or modify
|
|
545
|
+
* it under the terms of the GNU General Public License as published by
|
|
546
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
547
|
+
* (at your option) any later version.
|
|
548
|
+
*
|
|
549
|
+
* This program is distributed in the hope that it will be useful,
|
|
550
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
551
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
552
|
+
* See the GNU General Public License for more details.
|
|
553
|
+
*/
|
|
554
|
+
|
|
555
|
+
interface MauticContextValue {
|
|
556
|
+
client: MauticClient;
|
|
557
|
+
config: MauticConfig;
|
|
558
|
+
}
|
|
559
|
+
interface MauticProviderProps {
|
|
560
|
+
config: MauticConfig;
|
|
561
|
+
children: React.ReactNode;
|
|
562
|
+
}
|
|
563
|
+
declare const MauticProvider: React.FC<MauticProviderProps>;
|
|
564
|
+
/**
|
|
565
|
+
* Hook to use Mautic context
|
|
566
|
+
*/
|
|
567
|
+
declare const useMauticContext: () => MauticContextValue;
|
|
568
|
+
/**
|
|
569
|
+
* Hook to get Mautic client from context
|
|
570
|
+
*/
|
|
571
|
+
declare const useMauticClient: () => MauticClient;
|
|
572
|
+
/**
|
|
573
|
+
* Hook to get Mautic config from context
|
|
574
|
+
*/
|
|
575
|
+
declare const useMauticConfig: () => MauticConfig;
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* @license GPL-3.0-or-later
|
|
579
|
+
*
|
|
580
|
+
* This file is part of the MarVAlt Open SDK.
|
|
581
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
582
|
+
*
|
|
583
|
+
* This program is free software: you can redistribute it and/or modify
|
|
584
|
+
* it under the terms of the GNU General Public License as published by
|
|
585
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
586
|
+
* (at your option) any later version.
|
|
587
|
+
*
|
|
588
|
+
* This program is distributed in the hope that it will be useful,
|
|
589
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
590
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
591
|
+
* See the GNU General Public License for more details.
|
|
592
|
+
*/
|
|
593
|
+
|
|
594
|
+
interface MauticDataStore {
|
|
595
|
+
generated_at: string;
|
|
596
|
+
forms: MauticForm$1[];
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Load Mautic data from JSON file
|
|
600
|
+
*/
|
|
601
|
+
declare const loadMauticData: () => Promise<MauticDataStore>;
|
|
602
|
+
/**
|
|
603
|
+
* Get the current Mautic data store
|
|
604
|
+
*/
|
|
605
|
+
declare const getMauticData: () => MauticDataStore;
|
|
606
|
+
/**
|
|
607
|
+
* Get all published forms
|
|
608
|
+
*/
|
|
609
|
+
declare const getPublishedForms: () => MauticForm$1[];
|
|
610
|
+
/**
|
|
611
|
+
* Get form by ID
|
|
612
|
+
*/
|
|
613
|
+
declare const getFormById: (id: number) => MauticForm$1 | undefined;
|
|
614
|
+
/**
|
|
615
|
+
* Get form by alias
|
|
616
|
+
*/
|
|
617
|
+
declare const getFormByAlias: (alias: string) => MauticForm$1 | undefined;
|
|
618
|
+
/**
|
|
619
|
+
* Get forms by type
|
|
620
|
+
*/
|
|
621
|
+
declare const getFormsByType: (type: string) => MauticForm$1[];
|
|
622
|
+
/**
|
|
623
|
+
* Get forms by field type
|
|
624
|
+
*/
|
|
625
|
+
declare const getFormsByFieldType: (fieldType: string) => MauticForm$1[];
|
|
626
|
+
/**
|
|
627
|
+
* Search forms by name or description
|
|
628
|
+
*/
|
|
629
|
+
declare const searchForms: (query: string) => MauticForm$1[];
|
|
630
|
+
/**
|
|
631
|
+
* Get form field by alias
|
|
632
|
+
*/
|
|
633
|
+
declare const getFormFieldByAlias: (formId: number, fieldAlias: string) => MauticFormField | undefined;
|
|
634
|
+
/**
|
|
635
|
+
* Get all unique field types across all forms
|
|
636
|
+
*/
|
|
637
|
+
declare const getAllFieldTypes: () => string[];
|
|
638
|
+
/**
|
|
639
|
+
* Get forms count by status
|
|
640
|
+
*/
|
|
641
|
+
declare const getFormsCountByStatus: () => {
|
|
642
|
+
total: number;
|
|
643
|
+
published: number;
|
|
644
|
+
unpublished: number;
|
|
645
|
+
};
|
|
646
|
+
/**
|
|
647
|
+
* Check if data store is loaded
|
|
648
|
+
*/
|
|
649
|
+
declare const isDataLoaded: () => boolean;
|
|
650
|
+
/**
|
|
651
|
+
* Get data store metadata
|
|
652
|
+
*/
|
|
653
|
+
declare const getDataMetadata: () => {
|
|
654
|
+
generated_at: string;
|
|
655
|
+
total_forms: number;
|
|
656
|
+
published_forms: number;
|
|
657
|
+
field_types: string[];
|
|
658
|
+
form_types: (string | undefined)[];
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* @license GPL-3.0-or-later
|
|
663
|
+
*
|
|
664
|
+
* This file is part of the MarVAlt Open SDK.
|
|
665
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
666
|
+
*
|
|
667
|
+
* This program is free software: you can redistribute it and/or modify
|
|
668
|
+
* it under the terms of the GNU General Public License as published by
|
|
669
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
670
|
+
* (at your option) any later version.
|
|
671
|
+
*
|
|
672
|
+
* This program is distributed in the hope that it will be useful,
|
|
673
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
674
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
675
|
+
* See the GNU General Public License for more details.
|
|
676
|
+
*/
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Create Mautic configuration from environment variables
|
|
680
|
+
*/
|
|
681
|
+
declare const createMauticConfig: (overrides?: Partial<MauticConfig>) => MauticConfig;
|
|
682
|
+
/**
|
|
683
|
+
* Validate Mautic configuration
|
|
684
|
+
*/
|
|
685
|
+
declare const validateMauticConfig: (config: MauticConfig) => {
|
|
686
|
+
isValid: boolean;
|
|
687
|
+
errors: string[];
|
|
688
|
+
};
|
|
689
|
+
/**
|
|
690
|
+
* Get default Mautic configuration
|
|
691
|
+
*/
|
|
692
|
+
declare const getDefaultMauticConfig: () => MauticConfig;
|
|
693
|
+
/**
|
|
694
|
+
* Merge Mautic configurations
|
|
695
|
+
*/
|
|
696
|
+
declare const mergeMauticConfig: (base: MauticConfig, overrides: Partial<MauticConfig>) => MauticConfig;
|
|
697
|
+
/**
|
|
698
|
+
* Check if Mautic is enabled based on configuration
|
|
699
|
+
*/
|
|
700
|
+
declare const isMauticEnabled: (config: MauticConfig) => boolean;
|
|
701
|
+
/**
|
|
702
|
+
* Get Mautic configuration summary (for debugging)
|
|
703
|
+
*/
|
|
704
|
+
declare const getMauticConfigSummary: (config: MauticConfig) => {
|
|
705
|
+
authMode: AuthMode;
|
|
706
|
+
hasApiUrl: boolean;
|
|
707
|
+
hasCloudflareWorkerUrl: boolean;
|
|
708
|
+
hasAppId: boolean;
|
|
709
|
+
hasWorkerSecret: boolean;
|
|
710
|
+
timeout: number | undefined;
|
|
711
|
+
retries: number | undefined;
|
|
712
|
+
isEnabled: boolean;
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* @license GPL-3.0-or-later
|
|
717
|
+
*
|
|
718
|
+
* This file is part of the MarVAlt Open SDK.
|
|
719
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
720
|
+
*
|
|
721
|
+
* This program is free software: you can redistribute it and/or modify
|
|
722
|
+
* it under the terms of the GNU General Public License as published by
|
|
723
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
724
|
+
* (at your option) any later version.
|
|
725
|
+
*
|
|
726
|
+
* This program is distributed in the hope that it will be useful,
|
|
727
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
728
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
729
|
+
* See the GNU General Public License for more details.
|
|
730
|
+
*/
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Validate email address
|
|
734
|
+
*/
|
|
735
|
+
declare const isValidEmail: (email: string) => boolean;
|
|
736
|
+
/**
|
|
737
|
+
* Validate phone number (basic validation)
|
|
738
|
+
*/
|
|
739
|
+
declare const isValidPhone: (phone: string) => boolean;
|
|
740
|
+
/**
|
|
741
|
+
* Validate URL
|
|
742
|
+
*/
|
|
743
|
+
declare const isValidUrl: (url: string) => boolean;
|
|
744
|
+
/**
|
|
745
|
+
* Validate required field
|
|
746
|
+
*/
|
|
747
|
+
declare const isRequiredFieldValid: (value: any) => boolean;
|
|
748
|
+
/**
|
|
749
|
+
* Validate field based on its type and configuration
|
|
750
|
+
*/
|
|
751
|
+
declare const validateField: (field: MauticFormField, value: any) => string | null;
|
|
752
|
+
/**
|
|
753
|
+
* Validate form data against form fields
|
|
754
|
+
*/
|
|
755
|
+
declare const validateFormData: (fields: MauticFormField[], formData: Record<string, any>) => Record<string, string>;
|
|
756
|
+
/**
|
|
757
|
+
* Check if form data is valid
|
|
758
|
+
*/
|
|
759
|
+
declare const isFormDataValid: (fields: MauticFormField[], formData: Record<string, any>) => boolean;
|
|
760
|
+
/**
|
|
761
|
+
* Sanitize form data
|
|
762
|
+
*/
|
|
763
|
+
declare const sanitizeFormData: (formData: Record<string, any>) => Record<string, any>;
|
|
764
|
+
/**
|
|
765
|
+
* Format form data for submission
|
|
766
|
+
*/
|
|
767
|
+
declare const formatFormDataForSubmission: (formData: Record<string, any>) => Record<string, any>;
|
|
768
|
+
|
|
769
|
+
export { MauticClient, MauticForm, MauticGenerator, MauticProvider, MauticService, MauticTracking, createMauticConfig, formatFormDataForSubmission, generateMauticData, getAllFieldTypes, getDataMetadata, getDefaultMauticConfig, getFormByAlias, getFormById, getFormFieldByAlias, getFormsByFieldType, getFormsByType, getFormsCountByStatus, getMauticConfigSummary, getMauticData, getPublishedForms, isDataLoaded, isFormDataValid, isMauticEnabled, isRequiredFieldValid, isValidEmail, isValidPhone, isValidUrl, loadMauticData, mauticService, mergeMauticConfig, sanitizeFormData, searchForms, setMauticClient, useMauticAddTags, useMauticAddToSegment, useMauticClient, useMauticConfig, useMauticContactByEmail, useMauticContactTags, useMauticContext, useMauticCreateContact, useMauticEvent, useMauticEventTracking, useMauticForm, useMauticFormSubmission, useMauticForms, useMauticRemoveFromSegment, useMauticRemoveTags, useMauticSegments, useMauticTags, useMauticTracking, useMauticUpdateContact, validateField, validateFormData, validateMauticConfig };
|
|
770
|
+
export type { AuthMode, MauticApiResponse, MauticConfig, MauticContact, MauticEvent, MauticFormAction, MauticFormConfig, MauticFormData, MauticFormField, MauticFormSubmission, MauticForm$1 as MauticFormType, MauticGeneratorConfig, MauticStaticData, MauticTrackingConfig };
|