@marvalt/madapter 2.2.2 → 2.3.2
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/dist/generators/index.d.ts +24 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators.cjs +462 -0
- package/dist/generators.cjs.map +1 -0
- package/dist/generators.esm.js +459 -0
- package/dist/generators.esm.js.map +1 -0
- package/dist/index.cjs +0 -244
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +60 -112
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -243
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license GPL-3.0-or-later
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the MarVAlt Open SDK.
|
|
5
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
15
|
+
* See the GNU General Public License for more details.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Generator exports for Node.js environments only
|
|
19
|
+
* Do NOT import this in browser code!
|
|
20
|
+
*/
|
|
21
|
+
export { MauticGenerator, generateMauticData } from './mautic-generator';
|
|
22
|
+
export type { MauticGeneratorConfig } from '../types/config';
|
|
23
|
+
export type { MauticStaticData, MauticFormData } from '../types/static-data';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEzE,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fs = require('fs');
|
|
4
|
+
var path = require('path');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @license GPL-3.0-or-later
|
|
8
|
+
*
|
|
9
|
+
* This file is part of the MarVAlt Open SDK.
|
|
10
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
11
|
+
*
|
|
12
|
+
* This program is free software: you can redistribute it and/or modify
|
|
13
|
+
* it under the terms of the GNU General Public License as published by
|
|
14
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
15
|
+
* (at your option) any later version.
|
|
16
|
+
*
|
|
17
|
+
* This program is distributed in the hope that it will be useful,
|
|
18
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
20
|
+
* See the GNU General Public License for more details.
|
|
21
|
+
*/
|
|
22
|
+
class MauticClient {
|
|
23
|
+
constructor(config) {
|
|
24
|
+
this.config = config;
|
|
25
|
+
// Convention-based: Always use /api/mautic-submit unless explicitly overridden
|
|
26
|
+
this.proxyEndpoint = config.proxyEndpoint || '/api/mautic-submit';
|
|
27
|
+
}
|
|
28
|
+
async makeRequest(endpoint, options = {}) {
|
|
29
|
+
// Always use proxy endpoint (convention-based)
|
|
30
|
+
const proxyEndpoint = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
|
|
31
|
+
const url = `${this.proxyEndpoint}?endpoint=${encodeURIComponent(proxyEndpoint)}`;
|
|
32
|
+
const isFormSubmission = endpoint.startsWith('/form/submit') ||
|
|
33
|
+
(endpoint.startsWith('/forms/') && endpoint.includes('/submit'));
|
|
34
|
+
const headers = {
|
|
35
|
+
...options.headers,
|
|
36
|
+
};
|
|
37
|
+
// Default JSON only for non-form submissions when a body exists and no explicit content-type provided
|
|
38
|
+
const hasBody = options.body != null && options.body !== undefined;
|
|
39
|
+
if (!isFormSubmission && hasBody && !('Content-Type' in headers)) {
|
|
40
|
+
headers['Content-Type'] = 'application/json';
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const response = await fetch(url, {
|
|
44
|
+
...options,
|
|
45
|
+
headers,
|
|
46
|
+
});
|
|
47
|
+
// Determine if this was a form submission based on the original endpoint
|
|
48
|
+
const wasFormSubmission = endpoint.startsWith('/form/submit') ||
|
|
49
|
+
(endpoint.startsWith('/forms/') && endpoint.includes('/submit'));
|
|
50
|
+
if (!response.ok) {
|
|
51
|
+
// For form submissions, some Mautic setups respond with an HTML 404 after a successful submit.
|
|
52
|
+
// Do not treat this as an error; let the frontend handle success/redirect messaging.
|
|
53
|
+
const isRedirect = response.status >= 300 && response.status < 400;
|
|
54
|
+
const isHtmlLike = (response.headers.get('content-type') || '').includes('text/html');
|
|
55
|
+
if (!(wasFormSubmission && (isRedirect || response.status === 404 || isHtmlLike))) {
|
|
56
|
+
throw new Error(`Mautic API request failed: ${response.status} ${response.statusText}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const responseText = await response.text();
|
|
60
|
+
// Handle empty responses
|
|
61
|
+
if (!responseText) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
// For Mautic form submissions, the response may be HTML. Try JSON first, fallback to text.
|
|
65
|
+
try {
|
|
66
|
+
return JSON.parse(responseText);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return responseText;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
74
|
+
console.error('Mautic API request error:', message);
|
|
75
|
+
throw new Error(message);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Submit a form to Mautic
|
|
80
|
+
*/
|
|
81
|
+
async submitForm(formId, submission) {
|
|
82
|
+
const endpoint = `/form/submit?formId=${formId}`;
|
|
83
|
+
// Encode as application/x-www-form-urlencoded to match Mautic expectations
|
|
84
|
+
const formParams = new URLSearchParams();
|
|
85
|
+
// Add fields
|
|
86
|
+
Object.entries(submission.fields || {}).forEach(([alias, value]) => {
|
|
87
|
+
if (Array.isArray(value)) {
|
|
88
|
+
value.forEach((v) => formParams.append(`mauticform[${alias}]`, String(v)));
|
|
89
|
+
}
|
|
90
|
+
else if (typeof value === 'boolean') {
|
|
91
|
+
formParams.append(`mauticform[${alias}]`, value ? '1' : '0');
|
|
92
|
+
}
|
|
93
|
+
else if (value != null) {
|
|
94
|
+
formParams.append(`mauticform[${alias}]`, String(value));
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
// Required hidden fields
|
|
98
|
+
formParams.append('mauticform[formId]', String(formId));
|
|
99
|
+
// Prevent Mautic from attempting a redirect; frontend will handle any redirect
|
|
100
|
+
formParams.append('mauticform[return]', '');
|
|
101
|
+
// Mautic submit flag similar to native form button name/value
|
|
102
|
+
formParams.append('mauticform[submit]', '1');
|
|
103
|
+
// Include formName only if provided (derived from cachedHtml)
|
|
104
|
+
if (submission.formName) {
|
|
105
|
+
formParams.append('mauticform[formName]', submission.formName);
|
|
106
|
+
}
|
|
107
|
+
return this.makeRequest(endpoint, {
|
|
108
|
+
method: 'POST',
|
|
109
|
+
headers: {
|
|
110
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
111
|
+
},
|
|
112
|
+
body: formParams.toString(),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Create a new contact in Mautic
|
|
117
|
+
*/
|
|
118
|
+
async createContact(contact) {
|
|
119
|
+
return this.makeRequest('/contacts/new', {
|
|
120
|
+
method: 'POST',
|
|
121
|
+
body: JSON.stringify(contact),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Update an existing contact in Mautic
|
|
126
|
+
*/
|
|
127
|
+
async updateContact(contactId, contact) {
|
|
128
|
+
return this.makeRequest(`/contacts/${contactId}/edit`, {
|
|
129
|
+
method: 'PATCH',
|
|
130
|
+
body: JSON.stringify(contact),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Get a contact by email
|
|
135
|
+
*/
|
|
136
|
+
async getContactByEmail(email) {
|
|
137
|
+
return this.makeRequest(`/contacts?search=email:${encodeURIComponent(email)}`);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Get all forms from Mautic
|
|
141
|
+
*/
|
|
142
|
+
async getForms() {
|
|
143
|
+
const response = await this.makeRequest('/forms');
|
|
144
|
+
return response.forms || [];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get a specific form by ID
|
|
148
|
+
*/
|
|
149
|
+
async getForm(formId) {
|
|
150
|
+
return this.makeRequest(`/forms/${formId}`);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Track an event in Mautic
|
|
154
|
+
*/
|
|
155
|
+
async trackEvent(eventName, eventData = {}) {
|
|
156
|
+
return this.makeRequest('/events', {
|
|
157
|
+
method: 'POST',
|
|
158
|
+
body: JSON.stringify({
|
|
159
|
+
eventName,
|
|
160
|
+
eventData,
|
|
161
|
+
}),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Add tags to a contact
|
|
166
|
+
*/
|
|
167
|
+
async addTagToContact(contactId, tags) {
|
|
168
|
+
return this.makeRequest(`/contacts/${contactId}/tags`, {
|
|
169
|
+
method: 'POST',
|
|
170
|
+
body: JSON.stringify({ tags }),
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Remove tags from a contact
|
|
175
|
+
*/
|
|
176
|
+
async removeTagFromContact(contactId, tags) {
|
|
177
|
+
return this.makeRequest(`/contacts/${contactId}/tags`, {
|
|
178
|
+
method: 'DELETE',
|
|
179
|
+
body: JSON.stringify({ tags }),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Get contact tags
|
|
184
|
+
*/
|
|
185
|
+
async getContactTags(contactId) {
|
|
186
|
+
return this.makeRequest(`/contacts/${contactId}/tags`);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get all tags
|
|
190
|
+
*/
|
|
191
|
+
async getTags() {
|
|
192
|
+
return this.makeRequest('/tags');
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Get segments
|
|
196
|
+
*/
|
|
197
|
+
async getSegments() {
|
|
198
|
+
return this.makeRequest('/segments');
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Add contact to segment
|
|
202
|
+
*/
|
|
203
|
+
async addContactToSegment(contactId, segmentId) {
|
|
204
|
+
return this.makeRequest(`/contacts/${contactId}/segments`, {
|
|
205
|
+
method: 'POST',
|
|
206
|
+
body: JSON.stringify({ segmentId }),
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Remove contact from segment
|
|
211
|
+
*/
|
|
212
|
+
async removeContactFromSegment(contactId, segmentId) {
|
|
213
|
+
return this.makeRequest(`/contacts/${contactId}/segments`, {
|
|
214
|
+
method: 'DELETE',
|
|
215
|
+
body: JSON.stringify({ segmentId }),
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @license GPL-3.0-or-later
|
|
222
|
+
*
|
|
223
|
+
* This file is part of the MarVAlt Open SDK.
|
|
224
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
225
|
+
*
|
|
226
|
+
* This program is free software: you can redistribute it and/or modify
|
|
227
|
+
* it under the terms of the GNU General Public License as published by
|
|
228
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
229
|
+
* (at your option) any later version.
|
|
230
|
+
*
|
|
231
|
+
* This program is distributed in the hope that it will be useful,
|
|
232
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
233
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
234
|
+
* See the GNU General Public License for more details.
|
|
235
|
+
*/
|
|
236
|
+
class MauticGenerator {
|
|
237
|
+
constructor(config) {
|
|
238
|
+
this.cachedToken = null;
|
|
239
|
+
this.config = config;
|
|
240
|
+
// Generator uses direct OAuth2 calls, not the client
|
|
241
|
+
// Client is only used for proxy mode (cloudflare_proxy)
|
|
242
|
+
this.client = new MauticClient({
|
|
243
|
+
apiUrl: config.apiUrl,
|
|
244
|
+
proxyEndpoint: config.cloudflareWorkerUrl,
|
|
245
|
+
timeout: config.timeout,
|
|
246
|
+
retries: config.retries,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Get OAuth2 token for direct mode API calls
|
|
251
|
+
*/
|
|
252
|
+
async getOAuth2Token() {
|
|
253
|
+
if (this.cachedToken && this.cachedToken.expires_at > Date.now() + 300000) {
|
|
254
|
+
console.log('🔑 Using cached OAuth2 token');
|
|
255
|
+
return this.cachedToken.access_token;
|
|
256
|
+
}
|
|
257
|
+
if (!this.config.clientId || !this.config.clientSecret) {
|
|
258
|
+
throw new Error('OAuth2 credentials (clientId, clientSecret) required for direct mode');
|
|
259
|
+
}
|
|
260
|
+
console.log('🔑 Fetching new OAuth2 token...');
|
|
261
|
+
const tokenUrl = `${this.config.apiUrl}/oauth/v2/token`;
|
|
262
|
+
const body = new URLSearchParams({
|
|
263
|
+
grant_type: 'client_credentials',
|
|
264
|
+
client_id: this.config.clientId,
|
|
265
|
+
client_secret: this.config.clientSecret,
|
|
266
|
+
});
|
|
267
|
+
const headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
268
|
+
if (this.config.cfAccessClientId && this.config.cfAccessClientSecret) {
|
|
269
|
+
headers['CF-Access-Client-Id'] = this.config.cfAccessClientId;
|
|
270
|
+
headers['CF-Access-Client-Secret'] = this.config.cfAccessClientSecret;
|
|
271
|
+
console.log('🔐 Added CF Access headers to OAuth2 token request');
|
|
272
|
+
}
|
|
273
|
+
const resp = await fetch(tokenUrl, { method: 'POST', headers, body: body.toString() });
|
|
274
|
+
if (!resp.ok) {
|
|
275
|
+
const errText = await resp.text();
|
|
276
|
+
throw new Error(`OAuth2 token failed: ${resp.status} ${errText}`);
|
|
277
|
+
}
|
|
278
|
+
const data = await resp.json();
|
|
279
|
+
this.cachedToken = {
|
|
280
|
+
access_token: data.access_token,
|
|
281
|
+
expires_at: Date.now() + (data.expires_in * 1000),
|
|
282
|
+
};
|
|
283
|
+
console.log('✅ OAuth2 token cached');
|
|
284
|
+
return this.cachedToken.access_token;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Generate static data for Mautic forms
|
|
288
|
+
*/
|
|
289
|
+
async generateStaticData() {
|
|
290
|
+
console.log('🔄 Generating Mautic forms JSON data...');
|
|
291
|
+
try {
|
|
292
|
+
const allForms = await this.fetchMauticFormsList();
|
|
293
|
+
console.log(`📝 Found ${allForms.length} forms`);
|
|
294
|
+
const forms = [];
|
|
295
|
+
for (const formSummary of allForms) {
|
|
296
|
+
const formId = formSummary.id?.toString();
|
|
297
|
+
if (!formId) {
|
|
298
|
+
console.warn(`⚠️ Form summary missing ID:`, formSummary);
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
try {
|
|
302
|
+
const formDetails = await this.fetchMauticForm(formId);
|
|
303
|
+
if (!formDetails) {
|
|
304
|
+
console.warn(`⚠️ No form details returned for form ${formId}`);
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
// Extract the form data with proper structure
|
|
308
|
+
const formData = {
|
|
309
|
+
id: formId,
|
|
310
|
+
name: formDetails.name || formSummary.name || `Form ${formId}`,
|
|
311
|
+
description: formDetails.description,
|
|
312
|
+
isPublished: formDetails.isPublished || formSummary.isPublished || false,
|
|
313
|
+
// Include post-submission behavior configuration
|
|
314
|
+
postAction: formDetails.postAction || 'message',
|
|
315
|
+
postActionProperty: formDetails.postActionProperty || 'Thank you for your submission!',
|
|
316
|
+
// Include other important form properties
|
|
317
|
+
formType: formDetails.formType || 'standalone',
|
|
318
|
+
// Extract fields with validation and properties
|
|
319
|
+
fields: (formDetails.fields || []).map((field) => ({
|
|
320
|
+
id: field.id,
|
|
321
|
+
label: field.label,
|
|
322
|
+
alias: field.alias,
|
|
323
|
+
type: field.type,
|
|
324
|
+
isRequired: field.isRequired || false,
|
|
325
|
+
validationMessage: field.validationMessage,
|
|
326
|
+
defaultValue: field.defaultValue,
|
|
327
|
+
properties: {
|
|
328
|
+
placeholder: field.properties?.placeholder,
|
|
329
|
+
cssClass: field.properties?.cssClass,
|
|
330
|
+
validation: field.properties?.validation,
|
|
331
|
+
options: field.properties?.options,
|
|
332
|
+
helpText: field.properties?.helpText,
|
|
333
|
+
size: field.properties?.size,
|
|
334
|
+
...field.properties
|
|
335
|
+
}
|
|
336
|
+
})),
|
|
337
|
+
// Extract actions
|
|
338
|
+
actions: (formDetails.actions || []).map((action) => ({
|
|
339
|
+
id: action.id,
|
|
340
|
+
name: action.name,
|
|
341
|
+
type: action.type,
|
|
342
|
+
properties: action.properties || {}
|
|
343
|
+
})),
|
|
344
|
+
// Include styling and behavior
|
|
345
|
+
cssClass: formDetails.cssClass,
|
|
346
|
+
submitAction: formDetails.submitAction,
|
|
347
|
+
// Keep the details for reference
|
|
348
|
+
...formSummary
|
|
349
|
+
};
|
|
350
|
+
forms.push(formData);
|
|
351
|
+
console.log(`✅ Processed form: ${formData.name} (ID: ${formId})`);
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
355
|
+
console.error(`❌ Error processing form ${formId}:`, message);
|
|
356
|
+
// Continue with other forms
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const staticData = {
|
|
360
|
+
generated_at: new Date().toISOString(),
|
|
361
|
+
total_forms: forms.length,
|
|
362
|
+
forms: forms.map((form) => ({
|
|
363
|
+
id: parseInt(form.id),
|
|
364
|
+
name: form.name,
|
|
365
|
+
alias: String(form.alias ?? (form.name || '').toLowerCase().replace(/\s+/g, '-')),
|
|
366
|
+
description: form.description,
|
|
367
|
+
isPublished: form.isPublished,
|
|
368
|
+
fields: form.fields,
|
|
369
|
+
actions: form.actions,
|
|
370
|
+
cssClass: form.cssClass,
|
|
371
|
+
submitAction: form.submitAction,
|
|
372
|
+
postAction: form.postAction,
|
|
373
|
+
postActionProperty: form.postActionProperty,
|
|
374
|
+
formType: form.formType,
|
|
375
|
+
}))
|
|
376
|
+
};
|
|
377
|
+
console.log(`✅ Generated static data for ${forms.length} forms`);
|
|
378
|
+
return staticData;
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
382
|
+
console.error('❌ Error generating Mautic static data:', message);
|
|
383
|
+
throw new Error(message);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Write static data to file
|
|
388
|
+
*/
|
|
389
|
+
async writeStaticData(staticData) {
|
|
390
|
+
const outputPath = path.resolve(this.config.outputPath);
|
|
391
|
+
const outputDir = path.dirname(outputPath);
|
|
392
|
+
// Ensure output directory exists
|
|
393
|
+
if (!fs.existsSync(outputDir)) {
|
|
394
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
395
|
+
}
|
|
396
|
+
// Write the static data
|
|
397
|
+
fs.writeFileSync(outputPath, JSON.stringify(staticData, null, 2));
|
|
398
|
+
console.log(`📁 Static data written to: ${outputPath}`);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Generate and write static data
|
|
402
|
+
*/
|
|
403
|
+
async generateAndWrite() {
|
|
404
|
+
const staticData = await this.generateStaticData();
|
|
405
|
+
await this.writeStaticData(staticData);
|
|
406
|
+
return staticData;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Fetch list of forms from Mautic
|
|
410
|
+
*/
|
|
411
|
+
async fetchMauticFormsList() {
|
|
412
|
+
if (this.config.authMode === 'cloudflare_proxy') {
|
|
413
|
+
const forms = await this.client.getForms();
|
|
414
|
+
return Array.isArray(forms) ? forms : [];
|
|
415
|
+
}
|
|
416
|
+
// Direct mode with OAuth2
|
|
417
|
+
const token = await this.getOAuth2Token();
|
|
418
|
+
const url = `${this.config.apiUrl}/api/forms`;
|
|
419
|
+
const headers = { 'Authorization': `Bearer ${token}` };
|
|
420
|
+
if (this.config.cfAccessClientId && this.config.cfAccessClientSecret) {
|
|
421
|
+
headers['CF-Access-Client-Id'] = this.config.cfAccessClientId;
|
|
422
|
+
headers['CF-Access-Client-Secret'] = this.config.cfAccessClientSecret;
|
|
423
|
+
}
|
|
424
|
+
const resp = await fetch(url, { headers });
|
|
425
|
+
if (!resp.ok)
|
|
426
|
+
throw new Error(`Failed to fetch forms: ${resp.status}`);
|
|
427
|
+
const data = await resp.json();
|
|
428
|
+
return Array.isArray(data.forms) ? data.forms : [];
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Fetch individual form details from Mautic
|
|
432
|
+
*/
|
|
433
|
+
async fetchMauticForm(formId) {
|
|
434
|
+
if (this.config.authMode === 'cloudflare_proxy') {
|
|
435
|
+
return this.client.getForm(parseInt(formId, 10));
|
|
436
|
+
}
|
|
437
|
+
// Direct mode with OAuth2
|
|
438
|
+
const token = await this.getOAuth2Token();
|
|
439
|
+
const url = `${this.config.apiUrl}/api/forms/${formId}`;
|
|
440
|
+
const headers = { 'Authorization': `Bearer ${token}` };
|
|
441
|
+
if (this.config.cfAccessClientId && this.config.cfAccessClientSecret) {
|
|
442
|
+
headers['CF-Access-Client-Id'] = this.config.cfAccessClientId;
|
|
443
|
+
headers['CF-Access-Client-Secret'] = this.config.cfAccessClientSecret;
|
|
444
|
+
}
|
|
445
|
+
const resp = await fetch(url, { headers });
|
|
446
|
+
if (!resp.ok)
|
|
447
|
+
throw new Error(`Failed to fetch form ${formId}: ${resp.status}`);
|
|
448
|
+
const data = await resp.json();
|
|
449
|
+
return data.form || data;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Generate Mautic static data with configuration
|
|
454
|
+
*/
|
|
455
|
+
async function generateMauticData(config) {
|
|
456
|
+
const generator = new MauticGenerator(config);
|
|
457
|
+
return generator.generateAndWrite();
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
exports.MauticGenerator = MauticGenerator;
|
|
461
|
+
exports.generateMauticData = generateMauticData;
|
|
462
|
+
//# sourceMappingURL=generators.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators.cjs","sources":["../src/client/mautic-client.ts","../src/generators/mautic-generator.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;AAeG;MAYU,YAAY,CAAA;AAIvB,IAAA,WAAA,CAAY,MAAoB,EAAA;AAC9B,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;;QAGpB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,IAAI,oBAAoB;IACnE;AAEQ,IAAA,MAAM,WAAW,CAAI,QAAgB,EAAE,UAAuB,EAAE,EAAA;;AAEtE,QAAA,MAAM,aAAa,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,QAAQ,GAAG,CAAA,CAAA,EAAI,QAAQ,EAAE;AAC1E,QAAA,MAAM,GAAG,GAAG,CAAA,EAAG,IAAI,CAAC,aAAa,CAAA,UAAA,EAAa,kBAAkB,CAAC,aAAa,CAAC,CAAA,CAAE;AAEjF,QAAA,MAAM,gBAAgB,GAAG,QAAQ,CAAC,UAAU,CAAC,cA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