multisite-cms-mcp 1.0.6 → 1.0.7
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-conversion-guide.d.ts","sourceRoot":"","sources":["../../src/tools/get-conversion-guide.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"get-conversion-guide.d.ts","sourceRoot":"","sources":["../../src/tools/get-conversion-guide.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAugB1H;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAkD1E"}
|
|
@@ -363,33 +363,34 @@ Forms are automatically captured by the CMS.
|
|
|
363
363
|
|
|
364
364
|
## Form Handler Script
|
|
365
365
|
|
|
366
|
-
Add to your JavaScript:
|
|
366
|
+
Add to your JavaScript (typically /public/js/main.js):
|
|
367
367
|
|
|
368
368
|
\`\`\`javascript
|
|
369
369
|
document.querySelectorAll('form[data-form-name]').forEach(form => {
|
|
370
370
|
form.addEventListener('submit', async (e) => {
|
|
371
371
|
e.preventDefault();
|
|
372
372
|
|
|
373
|
+
const formName = form.dataset.formName || 'general';
|
|
373
374
|
const formData = new FormData(form);
|
|
374
375
|
const data = Object.fromEntries(formData);
|
|
375
376
|
|
|
376
|
-
|
|
377
|
+
// IMPORTANT: Endpoint is /_forms/{formName}
|
|
378
|
+
const response = await fetch('/_forms/' + formName, {
|
|
377
379
|
method: 'POST',
|
|
378
380
|
headers: { 'Content-Type': 'application/json' },
|
|
379
|
-
body: JSON.stringify(
|
|
380
|
-
formName: form.dataset.formName,
|
|
381
|
-
data: data
|
|
382
|
-
})
|
|
381
|
+
body: JSON.stringify(data)
|
|
383
382
|
});
|
|
384
383
|
|
|
385
384
|
if (response.ok) {
|
|
386
385
|
form.reset();
|
|
387
|
-
alert('Thank you!');
|
|
386
|
+
alert(form.dataset.successMessage || 'Thank you!');
|
|
388
387
|
}
|
|
389
388
|
});
|
|
390
389
|
});
|
|
391
390
|
\`\`\`
|
|
392
391
|
|
|
392
|
+
**CRITICAL:** The form endpoint is \`/_forms/{formName}\` - NOT \`/api/forms/submit\`
|
|
393
|
+
|
|
393
394
|
## Naming Conventions
|
|
394
395
|
|
|
395
396
|
- Contact form → \`contact\`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-schema.d.ts","sourceRoot":"","sources":["../../src/tools/get-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"get-schema.d.ts","sourceRoot":"","sources":["../../src/tools/get-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAmOjD"}
|
package/dist/tools/get-schema.js
CHANGED
|
@@ -178,5 +178,57 @@ For HTML content that should NOT be escaped:
|
|
|
178
178
|
3. **Always wrap optional fields in {{#if}}** - Check before rendering
|
|
179
179
|
4. **Use {{url}} for links** - Generates correct path based on manifest
|
|
180
180
|
5. **Match field names exactly** - \`{{name}}\` not \`{{title}}\`
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Form Handling
|
|
185
|
+
|
|
186
|
+
Forms are automatically captured and stored in the CMS.
|
|
187
|
+
|
|
188
|
+
### Form Setup
|
|
189
|
+
1. Add \`data-form-name="xxx"\` attribute to the form
|
|
190
|
+
2. Include the form handler script in your JavaScript
|
|
191
|
+
|
|
192
|
+
\`\`\`html
|
|
193
|
+
<form data-form-name="contact">
|
|
194
|
+
<input type="text" name="firstName" required>
|
|
195
|
+
<input type="email" name="email" required>
|
|
196
|
+
<textarea name="message"></textarea>
|
|
197
|
+
<button type="submit">Send</button>
|
|
198
|
+
</form>
|
|
199
|
+
\`\`\`
|
|
200
|
+
|
|
201
|
+
### Form Handler Script (add to /public/js/main.js)
|
|
202
|
+
\`\`\`javascript
|
|
203
|
+
document.querySelectorAll('form[data-form-name]').forEach(form => {
|
|
204
|
+
form.addEventListener('submit', async (e) => {
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
const formName = form.dataset.formName || 'general';
|
|
207
|
+
const formData = new FormData(form);
|
|
208
|
+
const data = Object.fromEntries(formData);
|
|
209
|
+
|
|
210
|
+
const response = await fetch('/_forms/' + formName, {
|
|
211
|
+
method: 'POST',
|
|
212
|
+
headers: { 'Content-Type': 'application/json' },
|
|
213
|
+
body: JSON.stringify(data)
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
if (response.ok) {
|
|
217
|
+
form.reset();
|
|
218
|
+
alert(form.dataset.successMessage || 'Thank you!');
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
\`\`\`
|
|
223
|
+
|
|
224
|
+
**CRITICAL:** Endpoint is \`/_forms/{formName}\` - NOT \`/api/forms/submit\`
|
|
225
|
+
|
|
226
|
+
### Common Form Names
|
|
227
|
+
- \`contact\` - Contact/inquiry forms
|
|
228
|
+
- \`newsletter\` - Email signups
|
|
229
|
+
- \`quote-request\` - Quote/consultation requests
|
|
230
|
+
- \`appointment\` - Scheduling forms
|
|
231
|
+
|
|
232
|
+
Tenant context is handled automatically by the system.
|
|
181
233
|
`;
|
|
182
234
|
}
|
package/package.json
CHANGED