@marvalt/madapter 1.0.14 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/mautic-client.d.ts +1 -8
- package/dist/client/mautic-client.d.ts.map +1 -1
- package/dist/generators/mautic-generator.d.ts +5 -0
- package/dist/generators/mautic-generator.d.ts.map +1 -1
- package/dist/index.cjs +436 -507
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +25 -21
- package/dist/index.esm.js +436 -506
- package/dist/index.esm.js.map +1 -1
- package/dist/react/components/MauticTracking.d.ts.map +1 -1
- package/dist/server/index.d.ts +18 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/mautic-proxy.d.ts +28 -0
- package/dist/server/mautic-proxy.d.ts.map +1 -0
- package/dist/server.cjs +156 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.esm.js +154 -0
- package/dist/server.esm.js.map +1 -0
- package/dist/service/mautic-service.d.ts +1 -1
- package/dist/service/mautic-service.d.ts.map +1 -1
- package/dist/types/config.d.ts +16 -8
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/config.d.ts +3 -5
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/package.json +9 -2
- package/scripts/postinstall.cjs +114 -0
- package/scripts/postinstall.js +114 -0
- package/templates/mautic-submit.ts +19 -0
package/dist/index.d.ts
CHANGED
|
@@ -18,21 +18,31 @@ import * as _tanstack_react_query from '@tanstack/react-query';
|
|
|
18
18
|
* See the GNU General Public License for more details.
|
|
19
19
|
*/
|
|
20
20
|
type AuthMode = 'cloudflare_proxy' | 'direct';
|
|
21
|
+
/**
|
|
22
|
+
* Mautic client configuration (for runtime/browser use)
|
|
23
|
+
* Convention-based: Uses /api/mautic-submit by default
|
|
24
|
+
*/
|
|
21
25
|
interface MauticConfig {
|
|
22
|
-
|
|
26
|
+
/** Mautic instance URL (e.g., https://your-mautic.com) */
|
|
23
27
|
apiUrl?: string;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Proxy endpoint for server-side authentication
|
|
30
|
+
* @default '/api/mautic-submit'
|
|
31
|
+
*/
|
|
32
|
+
proxyEndpoint?: string;
|
|
33
|
+
/** Request timeout in milliseconds */
|
|
27
34
|
timeout?: number;
|
|
35
|
+
/** Number of retry attempts */
|
|
28
36
|
retries?: number;
|
|
29
37
|
}
|
|
30
38
|
interface MauticGeneratorConfig {
|
|
31
39
|
authMode: AuthMode;
|
|
32
40
|
apiUrl?: string;
|
|
33
41
|
cloudflareWorkerUrl?: string;
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
clientId?: string;
|
|
43
|
+
clientSecret?: string;
|
|
44
|
+
cfAccessClientId?: string;
|
|
45
|
+
cfAccessClientSecret?: string;
|
|
36
46
|
outputPath: string;
|
|
37
47
|
formIds?: number[];
|
|
38
48
|
includeInactive?: boolean;
|
|
@@ -43,8 +53,6 @@ interface MauticTrackingConfig {
|
|
|
43
53
|
enabled?: boolean;
|
|
44
54
|
mauticUrl?: string;
|
|
45
55
|
proxyUrl?: string;
|
|
46
|
-
appId?: string;
|
|
47
|
-
workerSecret?: string;
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
/**
|
|
@@ -173,16 +181,9 @@ interface MauticApiResponse<T = any> {
|
|
|
173
181
|
*/
|
|
174
182
|
|
|
175
183
|
declare class MauticClient {
|
|
176
|
-
private
|
|
177
|
-
private proxyUrl?;
|
|
178
|
-
private appId?;
|
|
179
|
-
private workerSecret?;
|
|
180
|
-
private useProxy;
|
|
181
|
-
private isConfigured;
|
|
184
|
+
private proxyEndpoint;
|
|
182
185
|
private config;
|
|
183
186
|
constructor(config: MauticConfig);
|
|
184
|
-
private validateConfiguration;
|
|
185
|
-
private getAuthHeaders;
|
|
186
187
|
private makeRequest;
|
|
187
188
|
/**
|
|
188
189
|
* Submit a form to Mautic
|
|
@@ -278,7 +279,7 @@ declare class MauticService {
|
|
|
278
279
|
removeTagFromContact(contactId: number, tags: string[]): Promise<any>;
|
|
279
280
|
trackEvent(eventName: string, eventData?: Record<string, any>): Promise<any>;
|
|
280
281
|
}
|
|
281
|
-
declare
|
|
282
|
+
declare let mauticService: MauticService | null;
|
|
282
283
|
|
|
283
284
|
/**
|
|
284
285
|
* @license GPL-3.0-or-later
|
|
@@ -359,7 +360,12 @@ interface MauticFormData {
|
|
|
359
360
|
declare class MauticGenerator {
|
|
360
361
|
private client;
|
|
361
362
|
private config;
|
|
363
|
+
private cachedToken;
|
|
362
364
|
constructor(config: MauticGeneratorConfig);
|
|
365
|
+
/**
|
|
366
|
+
* Get OAuth2 token for direct mode API calls
|
|
367
|
+
*/
|
|
368
|
+
private getOAuth2Token;
|
|
363
369
|
/**
|
|
364
370
|
* Generate static data for Mautic forms
|
|
365
371
|
*/
|
|
@@ -677,6 +683,7 @@ declare const getDataMetadata: () => {
|
|
|
677
683
|
|
|
678
684
|
/**
|
|
679
685
|
* Create Mautic configuration from environment variables
|
|
686
|
+
* Convention-based: Uses /api/mautic-submit by default
|
|
680
687
|
*/
|
|
681
688
|
declare const createMauticConfig: (overrides?: Partial<MauticConfig>) => MauticConfig;
|
|
682
689
|
/**
|
|
@@ -702,11 +709,8 @@ declare const isMauticEnabled: (config: MauticConfig) => boolean;
|
|
|
702
709
|
* Get Mautic configuration summary (for debugging)
|
|
703
710
|
*/
|
|
704
711
|
declare const getMauticConfigSummary: (config: MauticConfig) => {
|
|
705
|
-
authMode: AuthMode;
|
|
706
712
|
hasApiUrl: boolean;
|
|
707
|
-
|
|
708
|
-
hasAppId: boolean;
|
|
709
|
-
hasWorkerSecret: boolean;
|
|
713
|
+
proxyEndpoint: string;
|
|
710
714
|
timeout: number | undefined;
|
|
711
715
|
retries: number | undefined;
|
|
712
716
|
isEnabled: boolean;
|