@marvalt/madapter 2.3.4 → 2.3.6
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.map +1 -1
- package/dist/generators.cjs +2 -1
- package/dist/generators.cjs.map +1 -1
- package/dist/generators.esm.js +2 -1
- package/dist/generators.esm.js.map +1 -1
- package/dist/index.cjs +16 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +16 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/react/hooks/useMautic.d.ts.map +1 -1
- package/dist/server/mautic-proxy.d.ts.map +1 -1
- package/dist/server.cjs +88 -5
- package/dist/server.cjs.map +1 -1
- package/dist/server.esm.js +88 -5
- package/dist/server.esm.js.map +1 -1
- package/package.json +6 -1
package/dist/index.esm.js
CHANGED
|
@@ -77,7 +77,8 @@ class MauticClient {
|
|
|
77
77
|
* Submit a form to Mautic
|
|
78
78
|
*/
|
|
79
79
|
async submitForm(formId, submission) {
|
|
80
|
-
|
|
80
|
+
// Endpoint should be just the path, without query string (formId is in the body)
|
|
81
|
+
const endpoint = `/form/submit`;
|
|
81
82
|
// Encode as application/x-www-form-urlencoded to match Mautic expectations
|
|
82
83
|
const formParams = new URLSearchParams();
|
|
83
84
|
// Add fields
|
|
@@ -1826,6 +1827,20 @@ const getMauticClient = () => {
|
|
|
1826
1827
|
if (!defaultClient) {
|
|
1827
1828
|
// Lazy initialize the client from environment if not set by provider/service
|
|
1828
1829
|
const config = createMauticConfig();
|
|
1830
|
+
// In development with VITE_LOCAL_DEVELOPMENT=true, use Wrangler server for proxy
|
|
1831
|
+
try {
|
|
1832
|
+
// @ts-ignore - import.meta is a Vite-specific global
|
|
1833
|
+
const isDev = typeof import.meta !== 'undefined' && import.meta.env?.DEV;
|
|
1834
|
+
// @ts-ignore
|
|
1835
|
+
const isLocalDev = typeof import.meta !== 'undefined' && import.meta.env?.VITE_LOCAL_DEVELOPMENT === 'true';
|
|
1836
|
+
const useWranglerProxy = isDev && isLocalDev;
|
|
1837
|
+
if (useWranglerProxy) {
|
|
1838
|
+
config.proxyEndpoint = 'http://127.0.0.1:8788/api/mautic-submit';
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
catch (e) {
|
|
1842
|
+
// import.meta not available, use default config
|
|
1843
|
+
}
|
|
1829
1844
|
defaultClient = new MauticClient(config);
|
|
1830
1845
|
}
|
|
1831
1846
|
return defaultClient;
|