@sonordev/site-kit 8.1.0 → 8.3.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.
Files changed (194) hide show
  1. package/AGENTS.md +13 -1
  2. package/CHANGELOG.md +11 -0
  3. package/README.md +9 -5
  4. package/agent-manifest.json +47 -8
  5. package/dist/{AnalyticsProvider-UWTCE5UO.js → AnalyticsProvider-QXO33JUF.js} +6 -6
  6. package/dist/{ArticleFaqSection-3Q26DP7P.js → ArticleFaqSection-DEWE5B4Q.js} +1 -1
  7. package/dist/{ArticleViewTracker-MYD6SGNH.js → ArticleViewTracker-KN6ENIRS.js} +17 -6
  8. package/dist/{BlocksPopup-OY5G3EFH.js → BlocksPopup-3RPN6YVJ.js} +6 -6
  9. package/dist/{ChatWidget-BTR5VERC.js → ChatWidget-D2X445PO.js} +6 -6
  10. package/dist/{FileField-DEHVYXAO.js → FileField-UNGSNGJ5.js} +4 -4
  11. package/dist/{FormSpotlight-VGC4CZL4.js → FormSpotlight-JFH2ENKQ.js} +1 -1
  12. package/dist/{FormStage-CJUSCSAL.js → FormStage-RC3WHHXP.js} +1 -1
  13. package/dist/{ManagedForm-JCI2KPMO.js → ManagedForm-FOQZ2IYG.js} +7 -7
  14. package/dist/{ManagedNewsletterForm-DTE4KKXV.js → ManagedNewsletterForm-NFNF33V3.js} +16 -7
  15. package/dist/{SignalCore-LGCBQDEH.js → SignalCore-5KABGX5C.js} +4 -4
  16. package/dist/SiteChat-JQ46ZIJ4.js +6 -0
  17. package/dist/SiteDesignReporter-N7L6DR4J.js +12 -0
  18. package/dist/{SitePopups-T6YPHAVY.js → SitePopups-WZBKX5Q3.js} +6 -6
  19. package/dist/SitemapSync-GY6UADRI.js +9 -0
  20. package/dist/_client/booking-widget.js +6 -6
  21. package/dist/_client/testimonial-section.js +3 -3
  22. package/dist/affiliates/index.js +4 -4
  23. package/dist/analytics/index.js +6 -6
  24. package/dist/{article-styles-GGZOQG5X.js → article-styles-7QONZJR5.js} +3 -3
  25. package/dist/article-tables-6XHVULPU.js +2 -0
  26. package/dist/articles/Article.d.ts +2 -89
  27. package/dist/articles/ArticleFAQ.d.ts +2 -41
  28. package/dist/articles/ArticleFaqSection.d.ts +2 -2
  29. package/dist/articles/ArticleList.d.ts +2 -79
  30. package/dist/articles/ArticleViewTracker.d.ts +2 -15
  31. package/dist/articles/AuthorCard.d.ts +2 -10
  32. package/dist/articles/AuthorPage.d.ts +2 -8
  33. package/dist/articles/ClusterLandingPage.d.ts +2 -40
  34. package/dist/articles/ClusterNavigation.d.ts +2 -37
  35. package/dist/articles/ManagedNewsletterForm.d.ts +3 -12
  36. package/dist/articles/NewsletterShell.d.ts +2 -17
  37. package/dist/articles/NewsletterWidget.d.ts +2 -30
  38. package/dist/articles/PublicationLayout.d.ts +2 -67
  39. package/dist/articles/PublicationSidebar.d.ts +2 -36
  40. package/dist/articles/RelatedPosts.d.ts +2 -22
  41. package/dist/articles/ServiceCallout.d.ts +2 -56
  42. package/dist/articles/TableOfContents.d.ts +2 -6
  43. package/dist/articles/article-photos.d.ts +2 -9
  44. package/dist/articles/article-styles.d.ts +2 -21
  45. package/dist/articles/article-tables.d.ts +2 -12
  46. package/dist/articles/artwork.d.ts +2 -13
  47. package/dist/articles/author-schema.d.ts +2 -72
  48. package/dist/articles/author-social.d.ts +2 -14
  49. package/dist/articles/excerpt.d.ts +2 -17
  50. package/dist/articles/index.d.ts +2 -79
  51. package/dist/articles/index.js +16 -11
  52. package/dist/articles/news-sitemap.d.ts +2 -46
  53. package/dist/articles/processArticleHtml.d.ts +2 -34
  54. package/dist/articles/public-reads.d.ts +2 -26
  55. package/dist/articles/reading-time.d.ts +2 -9
  56. package/dist/articles/routes.d.ts +2 -52
  57. package/dist/articles/server-core.d.ts +2 -461
  58. package/dist/articles/server-ui.d.ts +2 -30
  59. package/dist/articles/server-ui.js +26 -17
  60. package/dist/articles/server.d.ts +2 -461
  61. package/dist/articles/server.js +14 -5
  62. package/dist/articles/types.d.ts +2 -315
  63. package/dist/articles/widget-styles.d.ts +2 -8
  64. package/dist/chat/index.js +8 -8
  65. package/dist/{chunk-AIDIEVPZ.js → chunk-2JMCBJM5.js} +1 -1
  66. package/dist/chunk-34ZYJTQR.js +1 -0
  67. package/dist/{chunk-ADI6IYFH.js → chunk-3OY52UFM.js} +1 -1
  68. package/dist/{chunk-WMVK77ND.js → chunk-4K735O3J.js} +1 -1
  69. package/dist/{chunk-55GHBRCN.js → chunk-4PVMUPC6.js} +2 -2
  70. package/dist/{chunk-L5UOHS6E.js → chunk-5D7ZISUP.js} +1 -1
  71. package/dist/{chunk-JT52KYHQ.js → chunk-5RYSTKVU.js} +1 -1
  72. package/dist/{chunk-6CJGZFOU.js → chunk-A4MPHIVP.js} +1 -1
  73. package/dist/chunk-B7T2SFUF.js +1 -0
  74. package/dist/{chunk-FV2VD7WM.js → chunk-BC7JMY4Z.js} +3 -3
  75. package/dist/{chunk-255NCCPB.js → chunk-BOCYBDKV.js} +1 -1
  76. package/dist/{chunk-NFRJTOTB.js → chunk-BSQP6PRA.js} +1 -1
  77. package/dist/{chunk-GKGSXUVQ.js → chunk-BVB5FBAA.js} +1 -1
  78. package/dist/{chunk-NWVB75ER.js → chunk-C2UROFGZ.js} +1 -1
  79. package/dist/{chunk-F2VYN3QL.js → chunk-C4AFNZT2.js} +1 -1
  80. package/dist/{chunk-GC2QWXJ3.js → chunk-D6ZIQMHB.js} +3 -3
  81. package/dist/{chunk-GYF2ULVO.js → chunk-DJAYFHVF.js} +1 -1
  82. package/dist/{chunk-XUCU3LX4.js → chunk-DPSNMOMZ.js} +1 -1
  83. package/dist/{chunk-A3EU6HB5.js → chunk-E3UR37RX.js} +2 -2
  84. package/dist/{chunk-Y3INC4QJ.js → chunk-E4PTMORJ.js} +1 -1
  85. package/dist/{chunk-TAO6BVA2.js → chunk-EA6FZMYA.js} +2 -2
  86. package/dist/{chunk-V56RZH7J.js → chunk-FHUTOXS7.js} +1 -1
  87. package/dist/{chunk-LLW5HKEE.js → chunk-GKJVSZ7H.js} +3 -3
  88. package/dist/chunk-H72ZFO3F.js +1 -0
  89. package/dist/{chunk-CSTC6HZO.js → chunk-HND6BDXC.js} +3 -3
  90. package/dist/chunk-IEGDPRQB.js +14 -0
  91. package/dist/{chunk-CAH4Y4PY.js → chunk-JO76F5WP.js} +1 -1
  92. package/dist/{chunk-4Z3DI2EL.js → chunk-KJVUOJMW.js} +58 -58
  93. package/dist/{chunk-SC4MZGWZ.js → chunk-LBDWAXAO.js} +1 -1
  94. package/dist/{chunk-RSBMQFZW.js → chunk-LPKKSYKX.js} +3 -3
  95. package/dist/{chunk-2UO4HPGE.js → chunk-M5SF7NCC.js} +73 -51
  96. package/dist/{chunk-S6IGQYHW.js → chunk-MQ4REMTH.js} +2 -2
  97. package/dist/{chunk-O4DETQJI.js → chunk-NA4Z4CQG.js} +1 -1
  98. package/dist/{chunk-WPOFTCKL.js → chunk-OIWFXUVD.js} +2 -2
  99. package/dist/{chunk-G2HCCWZQ.js → chunk-QBCWVT2S.js} +2 -2
  100. package/dist/{chunk-DZV3KPVF.js → chunk-QCZHYO5M.js} +1 -1
  101. package/dist/{chunk-DOMBP3FW.js → chunk-QDILCQBL.js} +9 -9
  102. package/dist/{chunk-IAYGTQJD.js → chunk-SCTVADDL.js} +2 -2
  103. package/dist/{chunk-QXMIKDOL.js → chunk-SNRE3ZVZ.js} +3 -3
  104. package/dist/{chunk-DSNCU2E3.js → chunk-TT4JZDKM.js} +3 -3
  105. package/dist/{chunk-6VHDCJIZ.js → chunk-U7Y3QG3A.js} +1 -1
  106. package/dist/{chunk-3G7YABRA.js → chunk-W7OPEMGJ.js} +4 -1
  107. package/dist/{chunk-2JEUDTL6.js → chunk-WBUG7XRL.js} +2 -2
  108. package/dist/{chunk-47VB5INH.js → chunk-WSOZ3FQN.js} +1 -1
  109. package/dist/chunk-X4IJS7LV.js +319 -0
  110. package/dist/{chunk-JIH32RH2.js → chunk-XA7Q2VQA.js} +1 -1
  111. package/dist/{chunk-5L467Z5Q.js → chunk-XLAXYPTK.js} +3 -3
  112. package/dist/client/index.js +4 -16
  113. package/dist/contracts/editorial-media.d.ts +39 -0
  114. package/dist/contracts/entries.d.ts +1 -1
  115. package/dist/fleet/index.js +6 -6
  116. package/dist/forms/index.js +9 -325
  117. package/dist/forms/server.js +2 -2
  118. package/dist/images/index.js +4 -4
  119. package/dist/index.js +1 -1
  120. package/dist/layout/client.js +9 -9
  121. package/dist/layout/index.js +10 -10
  122. package/dist/llms/index.js +8 -8
  123. package/dist/maps/index.js +4 -4
  124. package/dist/mcp/sonor.d.ts +42 -3
  125. package/dist/mcp/sonor.js +25 -20
  126. package/dist/mcp/transport.d.ts +1 -1
  127. package/dist/press-kit/articles/Article.d.ts +89 -0
  128. package/dist/press-kit/articles/ArticleFAQ.d.ts +41 -0
  129. package/dist/press-kit/articles/ArticleFaqSection.d.ts +2 -0
  130. package/dist/press-kit/articles/ArticleList.d.ts +79 -0
  131. package/dist/press-kit/articles/ArticleViewTracker.d.ts +15 -0
  132. package/dist/press-kit/articles/AuthorCard.d.ts +10 -0
  133. package/dist/press-kit/articles/AuthorPage.d.ts +8 -0
  134. package/dist/press-kit/articles/ClusterLandingPage.d.ts +40 -0
  135. package/dist/press-kit/articles/ClusterNavigation.d.ts +37 -0
  136. package/dist/press-kit/articles/ManagedNewsletterForm.d.ts +12 -0
  137. package/dist/press-kit/articles/NewsletterShell.d.ts +17 -0
  138. package/dist/press-kit/articles/NewsletterWidget.d.ts +30 -0
  139. package/dist/press-kit/articles/PublicationLayout.d.ts +67 -0
  140. package/dist/press-kit/articles/PublicationSidebar.d.ts +36 -0
  141. package/dist/press-kit/articles/RelatedPosts.d.ts +22 -0
  142. package/dist/press-kit/articles/ServiceCallout.d.ts +56 -0
  143. package/dist/press-kit/articles/TableOfContents.d.ts +6 -0
  144. package/dist/press-kit/articles/article-photos.d.ts +9 -0
  145. package/dist/press-kit/articles/article-styles.d.ts +21 -0
  146. package/dist/press-kit/articles/article-tables.d.ts +12 -0
  147. package/dist/press-kit/articles/artwork.d.ts +13 -0
  148. package/dist/press-kit/articles/author-schema.d.ts +72 -0
  149. package/dist/press-kit/articles/author-social.d.ts +14 -0
  150. package/dist/press-kit/articles/excerpt.d.ts +17 -0
  151. package/dist/press-kit/articles/index.d.ts +79 -0
  152. package/dist/press-kit/articles/news-sitemap.d.ts +46 -0
  153. package/dist/press-kit/articles/processArticleHtml.d.ts +34 -0
  154. package/dist/press-kit/articles/public-reads.d.ts +26 -0
  155. package/dist/press-kit/articles/reading-time.d.ts +9 -0
  156. package/dist/press-kit/articles/routes.d.ts +52 -0
  157. package/dist/press-kit/articles/server-core.d.ts +461 -0
  158. package/dist/press-kit/articles/server-ui.d.ts +31 -0
  159. package/dist/press-kit/articles/types.d.ts +316 -0
  160. package/dist/press-kit/articles/widget-styles.d.ts +8 -0
  161. package/dist/reputation/index.js +3 -3
  162. package/dist/reputation/server.js +2 -2
  163. package/dist/revalidate/index.js +2 -2
  164. package/dist/runtime/index.js +5 -4
  165. package/dist/seo/client.js +6 -6
  166. package/dist/seo/index.js +7 -7
  167. package/dist/seo/llms.js +8 -8
  168. package/dist/seo/register-sitemap-cli.js +1 -1
  169. package/dist/seo/sitemap.js +6 -6
  170. package/dist/server/index.js +3 -2
  171. package/dist/shared/build-entries.d.ts +2 -1
  172. package/dist/shared/clientApiConfig.d.ts +2 -0
  173. package/dist/shared/import-specifiers.d.ts +1 -1
  174. package/dist/shared/index.d.ts +6 -0
  175. package/dist/shared/index.js +8 -0
  176. package/dist/shared/version.d.ts +1 -1
  177. package/dist/signal/index.js +2 -2
  178. package/dist/sitemap/index.js +6 -6
  179. package/dist/sync/index.js +6 -6
  180. package/dist/website/images.js +4 -4
  181. package/dist/website/index.js +7 -7
  182. package/dist/website/popups.js +6 -6
  183. package/dist/{writeLLMsTxt-OS2WBSLM.js → writeLLMsTxt-VKHCM5IS.js} +5 -5
  184. package/docs/MIGRATING-TO-PRESS-KIT.md +83 -0
  185. package/docs.json +145 -29
  186. package/package.json +15 -5
  187. package/src/articles/README.md +5 -360
  188. package/src/mcp/README.md +16 -0
  189. package/src/og/README.md +1 -1
  190. package/src/runtime/README.md +4 -0
  191. package/dist/SiteChat-6SF7PVUT.js +0 -6
  192. package/dist/SiteDesignReporter-VISQZ5NQ.js +0 -12
  193. package/dist/SitemapSync-VKMVRPZL.js +0 -9
  194. package/dist/article-tables-AXSZOGNW.js +0 -2
@@ -1,12 +1,13 @@
1
1
  'use client';
2
- export { FormClient, ManagedForm } from '../chunk-5L467Z5Q.js';
2
+ export { configureFormsApi, defineForm, field, formsApi, initializeForms } from '../chunk-X4IJS7LV.js';
3
+ export { FormClient, ManagedForm } from '../chunk-XLAXYPTK.js';
4
+ import '../chunk-DPSNMOMZ.js';
3
5
  export { DatePicker } from '../chunk-SOD2F6C2.js';
4
6
  export { FormCelebration } from '../chunk-YGGDU6C3.js';
5
- import '../chunk-XUCU3LX4.js';
6
- export { useForm, useFormTracking } from '../chunk-S6IGQYHW.js';
7
+ export { useForm, useFormTracking } from '../chunk-MQ4REMTH.js';
7
8
  import '../chunk-Q6E4OPGG.js';
8
9
  import '../chunk-5ROTTMBL.js';
9
- export { FormEnhancer } from '../chunk-JT52KYHQ.js';
10
+ export { FormEnhancer } from '../chunk-5RYSTKVU.js';
10
11
  import '../chunk-C2FZBUSS.js';
11
12
  import '../chunk-YC7ELZS3.js';
12
13
  import '../chunk-DXO6SBMD.js';
@@ -17,325 +18,8 @@ import '../chunk-NJCTQH2P.js';
17
18
  import '../chunk-L2V5PUFN.js';
18
19
  import '../chunk-5TM3WPCI.js';
19
20
  import '../chunk-GJWI74ZZ.js';
20
- import { readPublishedApiConfig } from '../chunk-3G7YABRA.js';
21
- import { sonorFetch } from '../chunk-WPOFTCKL.js';
22
- import '../chunk-F2VYN3QL.js';
23
- import '../chunk-NWVB75ER.js';
21
+ import '../chunk-OIWFXUVD.js';
22
+ import '../chunk-C4AFNZT2.js';
23
+ import '../chunk-W7OPEMGJ.js';
24
+ import '../chunk-C2UROFGZ.js';
24
25
  import '../chunk-PKBMQBKP.js';
25
-
26
- // src/forms/formsApi.ts
27
- var config = null;
28
- function configureFormsApi(options) {
29
- config = options;
30
- }
31
- function getConfig() {
32
- if (config) return config;
33
- const { apiUrl, apiKey } = readPublishedApiConfig();
34
- if (apiUrl && apiKey) {
35
- return { baseUrl: apiUrl, apiKey };
36
- }
37
- throw new Error(
38
- "Forms API not configured. Use SiteKitLayout in your root layout or call configureFormsApi() first."
39
- );
40
- }
41
- async function apiRequest(method, path, body) {
42
- const { baseUrl, apiKey, getAuthToken } = getConfig();
43
- const headers = {
44
- "Content-Type": "application/json"
45
- };
46
- if (apiKey) {
47
- headers["x-api-key"] = apiKey;
48
- } else if (getAuthToken) {
49
- const token = await getAuthToken();
50
- headers["Authorization"] = `Bearer ${token}`;
51
- }
52
- const response = await sonorFetch(`${baseUrl}${path}`, {
53
- method,
54
- headers,
55
- body: body ? JSON.stringify(body) : void 0
56
- }, { retries: 0 });
57
- if (!response.ok) {
58
- const error = await response.json().catch(() => ({ message: response.statusText }));
59
- throw new Error(error.message || `API error: ${response.status}`);
60
- }
61
- if (response.status === 204) {
62
- return void 0;
63
- }
64
- return response.json();
65
- }
66
- var formsApi = {
67
- /**
68
- * List all forms for a project
69
- */
70
- async list(options = {}) {
71
- const params = new URLSearchParams();
72
- if (options.projectId) params.set("projectId", options.projectId);
73
- if (options.formType) params.set("formType", options.formType);
74
- if (options.isActive !== void 0) params.set("isActive", String(options.isActive));
75
- if (options.search) params.set("search", options.search);
76
- const query = params.toString();
77
- const result = await apiRequest("GET", `/forms${query ? `?${query}` : ""}`);
78
- return result.data;
79
- },
80
- /**
81
- * Get a single form by ID or slug
82
- */
83
- async get(idOrSlug) {
84
- return apiRequest("GET", `/forms/${idOrSlug}`);
85
- },
86
- /**
87
- * Create a new form
88
- */
89
- async create(input) {
90
- return apiRequest("POST", "/forms", input);
91
- },
92
- /**
93
- * Update an existing form
94
- */
95
- async update(id, input) {
96
- return apiRequest("PUT", `/forms/${id}`, input);
97
- },
98
- /**
99
- * Delete a form
100
- */
101
- async delete(id) {
102
- return apiRequest("DELETE", `/forms/${id}`);
103
- },
104
- /**
105
- * Add a field to an existing form
106
- */
107
- async addField(formId, field2) {
108
- const form = await formsApi.get(formId);
109
- const maxSortOrder = Math.max(0, ...(form.fields || []).map((f) => f.sortOrder || 0));
110
- return formsApi.update(formId, {
111
- fields: [
112
- ...form.fields || [],
113
- { ...field2, sortOrder: field2.sortOrder ?? maxSortOrder + 1 }
114
- ]
115
- });
116
- },
117
- /**
118
- * Update a field in an existing form
119
- */
120
- async updateField(formId, fieldSlug, updates) {
121
- const form = await formsApi.get(formId);
122
- return formsApi.update(formId, {
123
- fields: (form.fields || []).map(
124
- (f) => f.slug === fieldSlug ? { ...f, ...updates } : f
125
- )
126
- });
127
- },
128
- /**
129
- * Remove a field from a form
130
- */
131
- async removeField(formId, fieldSlug) {
132
- const form = await formsApi.get(formId);
133
- return formsApi.update(formId, {
134
- fields: (form.fields || []).filter((f) => f.slug !== fieldSlug)
135
- });
136
- },
137
- /**
138
- * Reorder fields in a form
139
- */
140
- async reorderFields(formId, fieldSlugs) {
141
- const form = await formsApi.get(formId);
142
- const fieldsMap = new Map((form.fields || []).map((f) => [f.slug, f]));
143
- const orderedFields = fieldSlugs.map((slug, index) => {
144
- const field2 = fieldsMap.get(slug);
145
- if (!field2) throw new Error(`Field not found: ${slug}`);
146
- return { ...field2, sortOrder: index };
147
- });
148
- return formsApi.update(formId, { fields: orderedFields });
149
- },
150
- /**
151
- * Clone a form
152
- */
153
- async clone(formId, newSlug, newName) {
154
- const form = await formsApi.get(formId);
155
- return formsApi.create({
156
- projectId: form.projectId,
157
- slug: newSlug,
158
- name: newName || `${form.name} (Copy)`,
159
- description: form.description,
160
- formType: form.formType,
161
- successMessage: form.successMessage,
162
- redirectUrl: form.redirectUrl,
163
- notificationEmails: form.notificationEmails,
164
- submitButtonText: form.submitButtonText,
165
- layout: form.layout,
166
- showProgress: form.showProgress,
167
- enableSaveDraft: form.enableSaveDraft,
168
- isActive: false,
169
- // Clone as inactive
170
- fields: (form.fields || []).map(({ id, ...field2 }) => field2),
171
- // Remove IDs
172
- steps: (form.steps || []).map(({ id, ...step }) => step)
173
- // Remove IDs
174
- });
175
- },
176
- /**
177
- * Activate or deactivate a form
178
- */
179
- async setActive(formId, isActive) {
180
- return formsApi.update(formId, { isActive });
181
- },
182
- /**
183
- * Sync a form definition to the backend
184
- * Creates the form if it doesn't exist, updates if it does
185
- * Perfect for defining forms in code during development
186
- *
187
- * @example
188
- * ```tsx
189
- * // In your app initialization or form component
190
- * await formsApi.sync({
191
- * slug: 'contact',
192
- * name: 'Contact Form',
193
- * formType: 'prospect',
194
- * fields: [
195
- * field.text('name', 'Your Name', { isRequired: true }),
196
- * field.email('email', 'Email Address'),
197
- * field.phone('phone', 'Phone Number'),
198
- * field.textarea('message', 'Message'),
199
- * ]
200
- * })
201
- * ```
202
- */
203
- async sync(input) {
204
- return apiRequest(
205
- "POST",
206
- "/api/public/forms/sync",
207
- input
208
- );
209
- },
210
- /**
211
- * Sync multiple forms at once
212
- * Useful for initializing all forms in your app
213
- *
214
- * Runs sequentially to avoid bursting the API (many hosts throttle concurrent POSTs → 429).
215
- */
216
- async syncAll(forms) {
217
- const results = [];
218
- for (const form of forms) {
219
- results.push(await formsApi.sync(form));
220
- }
221
- return results;
222
- }
223
- };
224
- var field = {
225
- text: (slug, label, options) => ({
226
- slug,
227
- label,
228
- fieldType: "text",
229
- ...options
230
- }),
231
- email: (slug, label, options) => ({
232
- slug,
233
- label,
234
- fieldType: "email",
235
- isRequired: true,
236
- ...options
237
- }),
238
- phone: (slug, label, options) => ({
239
- slug,
240
- label,
241
- fieldType: "phone",
242
- ...options
243
- }),
244
- textarea: (slug, label, options) => ({
245
- slug,
246
- label,
247
- fieldType: "textarea",
248
- ...options
249
- }),
250
- select: (slug, label, choices, options) => ({
251
- slug,
252
- label,
253
- fieldType: "select",
254
- options: choices,
255
- ...options
256
- }),
257
- radio: (slug, label, choices, options) => ({
258
- slug,
259
- label,
260
- fieldType: "radio",
261
- options: choices,
262
- ...options
263
- }),
264
- checkbox: (slug, label, options) => ({
265
- slug,
266
- label,
267
- fieldType: "checkbox",
268
- ...options
269
- }),
270
- date: (slug, label, options) => ({
271
- slug,
272
- label,
273
- fieldType: "date",
274
- ...options
275
- }),
276
- number: (slug, label, options) => ({
277
- slug,
278
- label,
279
- fieldType: "number",
280
- ...options
281
- }),
282
- rating: (slug, label, options) => ({
283
- slug,
284
- label,
285
- fieldType: "rating",
286
- ...options
287
- }),
288
- file: (slug, label, options) => ({
289
- slug,
290
- label,
291
- fieldType: "file",
292
- ...options
293
- }),
294
- hidden: (slug, defaultValue) => ({
295
- slug,
296
- label: "",
297
- fieldType: "hidden",
298
- defaultValue
299
- }),
300
- heading: (slug, label) => ({
301
- slug,
302
- label,
303
- fieldType: "heading"
304
- }),
305
- paragraph: (slug, label) => ({
306
- slug,
307
- label,
308
- fieldType: "paragraph"
309
- })
310
- };
311
- function defineForm(definition) {
312
- const fieldsWithOrder = definition.fields.map((f, index) => ({
313
- ...f,
314
- sortOrder: f.sortOrder ?? index
315
- }));
316
- return {
317
- ...definition,
318
- fields: fieldsWithOrder,
319
- formType: definition.formType || "contact",
320
- successMessage: definition.successMessage || "Thank you for your submission!",
321
- submitButtonText: definition.submitButtonText || "Submit",
322
- layout: definition.layout || "stacked",
323
- isActive: definition.isActive ?? true
324
- };
325
- }
326
- async function initializeForms(forms) {
327
- if (typeof window === "undefined") {
328
- console.log(`[Site-Kit] ${forms.length} form(s) ready to sync: ${forms.map((f) => f.slug).join(", ")}`);
329
- return;
330
- }
331
- try {
332
- const results = await formsApi.syncAll(forms);
333
- const created = results.filter((r) => r.created).length;
334
- const updated = results.filter((r) => r.updated).length;
335
- console.log(`[Site-Kit] Forms synced: ${created} created, ${updated} updated`);
336
- } catch (error) {
337
- console.error("[Site-Kit] Failed to sync forms:", error);
338
- }
339
- }
340
-
341
- export { configureFormsApi, defineForm, field, formsApi, initializeForms };
@@ -1,5 +1,5 @@
1
- export { ServerForm, getFormConfig } from '../chunk-O4DETQJI.js';
2
- import '../chunk-JT52KYHQ.js';
1
+ export { ServerForm, getFormConfig } from '../chunk-NA4Z4CQG.js';
2
+ import '../chunk-5RYSTKVU.js';
3
3
  import '../chunk-C2FZBUSS.js';
4
4
  import '../chunk-YC7ELZS3.js';
5
5
  export { StaticForm } from '../chunk-LNSF6BJC.js';
@@ -1,6 +1,6 @@
1
- export { ManagedImage, assignImageToSlot, clearImageSlot, fetchManagedImage, fetchManagedImages, listImageFiles, uploadImage } from '../chunk-ADI6IYFH.js';
1
+ export { ManagedImage, assignImageToSlot, clearImageSlot, fetchManagedImage, fetchManagedImages, listImageFiles, uploadImage } from '../chunk-3OY52UFM.js';
2
2
  export { ManagedFavicon, getManagedFaviconUrl } from '../chunk-GW7GSBO7.js';
3
- import '../chunk-WPOFTCKL.js';
4
- import '../chunk-F2VYN3QL.js';
5
- import '../chunk-NWVB75ER.js';
3
+ import '../chunk-OIWFXUVD.js';
4
+ import '../chunk-C4AFNZT2.js';
5
+ import '../chunk-C2UROFGZ.js';
6
6
  import '../chunk-PKBMQBKP.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { SITE_KIT_VERSION } from './chunk-NWVB75ER.js';
1
+ export { SITE_KIT_VERSION } from './chunk-C2UROFGZ.js';
2
2
  import './chunk-PKBMQBKP.js';
@@ -1,8 +1,8 @@
1
1
  'use client';
2
- export { SiteKitClientProviders } from '../chunk-DOMBP3FW.js';
2
+ export { SiteKitClientProviders } from '../chunk-QDILCQBL.js';
3
3
  import '../chunk-6G43IRWR.js';
4
- import '../chunk-6VHDCJIZ.js';
5
- import '../chunk-RSBMQFZW.js';
4
+ import '../chunk-U7Y3QG3A.js';
5
+ import '../chunk-LPKKSYKX.js';
6
6
  import '../chunk-ZTZQPYP6.js';
7
7
  import '../chunk-YC7ELZS3.js';
8
8
  import '../chunk-FESKKJAS.js';
@@ -10,11 +10,11 @@ import '../chunk-A4CC4ZG3.js';
10
10
  import '../chunk-ZKADJNR2.js';
11
11
  import '../chunk-5TM3WPCI.js';
12
12
  import '../chunk-GJWI74ZZ.js';
13
- import '../chunk-CAH4Y4PY.js';
13
+ import '../chunk-JO76F5WP.js';
14
14
  import '../chunk-EKBEOXTH.js';
15
- import '../chunk-3G7YABRA.js';
16
- import '../chunk-WPOFTCKL.js';
17
- import '../chunk-F2VYN3QL.js';
18
- import '../chunk-NWVB75ER.js';
19
- import '../chunk-DZV3KPVF.js';
15
+ import '../chunk-OIWFXUVD.js';
16
+ import '../chunk-C4AFNZT2.js';
17
+ import '../chunk-W7OPEMGJ.js';
18
+ import '../chunk-C2UROFGZ.js';
19
+ import '../chunk-QCZHYO5M.js';
20
20
  import '../chunk-PKBMQBKP.js';
@@ -1,11 +1,11 @@
1
- import { SiteKitClientProviders } from '../chunk-DOMBP3FW.js';
1
+ import { SiteKitClientProviders } from '../chunk-QDILCQBL.js';
2
2
  import '../chunk-6G43IRWR.js';
3
- import '../chunk-6VHDCJIZ.js';
4
- import '../chunk-RSBMQFZW.js';
3
+ import '../chunk-U7Y3QG3A.js';
4
+ import '../chunk-LPKKSYKX.js';
5
5
  import '../chunk-ZTZQPYP6.js';
6
6
  import { ManagedFavicon } from '../chunk-GW7GSBO7.js';
7
7
  import '../chunk-YC7ELZS3.js';
8
- import { resolveClientCredential } from '../chunk-47VB5INH.js';
8
+ import { resolveClientCredential } from '../chunk-WSOZ3FQN.js';
9
9
  import '../chunk-UAYAJPEP.js';
10
10
  import { ManagedScripts } from '../chunk-MVLMXC44.js';
11
11
  import { resolveApiOrigin } from '../chunk-C7TLGL3R.js';
@@ -15,13 +15,13 @@ import '../chunk-A4CC4ZG3.js';
15
15
  import '../chunk-ZKADJNR2.js';
16
16
  import '../chunk-5TM3WPCI.js';
17
17
  import '../chunk-GJWI74ZZ.js';
18
- import '../chunk-CAH4Y4PY.js';
18
+ import '../chunk-JO76F5WP.js';
19
19
  import '../chunk-EKBEOXTH.js';
20
- import '../chunk-3G7YABRA.js';
21
- import '../chunk-WPOFTCKL.js';
22
- import '../chunk-F2VYN3QL.js';
23
- import '../chunk-NWVB75ER.js';
24
- import '../chunk-DZV3KPVF.js';
20
+ import '../chunk-OIWFXUVD.js';
21
+ import '../chunk-C4AFNZT2.js';
22
+ import '../chunk-W7OPEMGJ.js';
23
+ import '../chunk-C2UROFGZ.js';
24
+ import '../chunk-QCZHYO5M.js';
25
25
  import '../chunk-PKBMQBKP.js';
26
26
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
27
27
 
@@ -1,13 +1,13 @@
1
- export { createLLMsFullTxtHandler, createLLMsTxtHandler, formatSourcedFactsSection, llmsResponseHeaders } from '../chunk-AIDIEVPZ.js';
1
+ export { createLLMsFullTxtHandler, createLLMsTxtHandler, formatSourcedFactsSection, llmsResponseHeaders } from '../chunk-2JMCBJM5.js';
2
2
  export { buildAiDiscoveryHeaders, wantsLlmsDiscoveryLink } from '../chunk-PO2TRJPY.js';
3
3
  export { AI_RETRIEVAL_CRAWLERS, AI_TRAINING_CRAWLERS, buildAiCrawlerRules, createRobotsTxtHandler } from '../chunk-QLTDFUJ7.js';
4
- export { LEGACY_PUBLICATION_PATH, SEO_REVALIDATION_MAX_BODY_BYTES, SEO_REVALIDATION_MAX_ITEMS, createLlmsRevalidateHandler, createSeoRevalidationHandler, parseSeoRevalidationPayload } from '../chunk-V56RZH7J.js';
4
+ export { LEGACY_PUBLICATION_PATH, SEO_REVALIDATION_MAX_BODY_BYTES, SEO_REVALIDATION_MAX_ITEMS, createLlmsRevalidateHandler, createSeoRevalidationHandler, parseSeoRevalidationPayload } from '../chunk-FHUTOXS7.js';
5
5
  export { AEOBlock, AEOCitedContent, AEOClaim, AEOComparison, AEODefinition, AEOEntity, AEOProvenanceList, AEOStep, AEOSteps, AEOSummary, DEFAULT_SPEAKABLE_SELECTORS, SpeakableSchema, createSpeakableSchema, getSpeakableSelectorsForPage } from '../chunk-PSAG45YF.js';
6
6
  import '../chunk-XTRZGXB2.js';
7
- export { AGENT_ACCESS_HEADING, appendAgentAccessSection, describesMcp, detectMcpServer, formatAgentAccessSection, generateLLMsFullTxt, generateLLMsTxt, writeLLMsTxtToPublic } from '../chunk-GC2QWXJ3.js';
8
- export { getBusinessInfo, getFAQItems, getLLMsData, getOptimizedLLMsTxt, getPageSummaries, getServices } from '../chunk-JIH32RH2.js';
9
- import '../chunk-L5UOHS6E.js';
10
- import '../chunk-WMVK77ND.js';
7
+ export { AGENT_ACCESS_HEADING, appendAgentAccessSection, describesMcp, detectMcpServer, formatAgentAccessSection, generateLLMsFullTxt, generateLLMsTxt, writeLLMsTxtToPublic } from '../chunk-D6ZIQMHB.js';
8
+ export { getBusinessInfo, getFAQItems, getLLMsData, getOptimizedLLMsTxt, getPageSummaries, getServices } from '../chunk-XA7Q2VQA.js';
9
+ import '../chunk-5D7ZISUP.js';
10
+ import '../chunk-4K735O3J.js';
11
11
  import '../chunk-UAYAJPEP.js';
12
12
  export { LLMS_DISCLAIMER_MAX_LENGTH, LLMS_PUBLIC_SUMMARY_MAX_LENGTH, LLM_GEO_CONTRACT_VERSION, MANAGED_LLM_SCHEMA_KNOWN_KEYS, pickManagedLlmSchemaForJsonLd, sanitizeLlmsDisclaimerLine, sanitizeLlmsPublicSummary, sanitizePrimaryLanguageTag } from '../chunk-NZ4RXN3G.js';
13
13
  import '../chunk-4KZ6W3ZH.js';
@@ -15,6 +15,6 @@ import '../chunk-MJP63SSS.js';
15
15
  import '../chunk-YVKRYQRG.js';
16
16
  import '../chunk-FESKKJAS.js';
17
17
  import '../chunk-A4CC4ZG3.js';
18
- import '../chunk-3G7YABRA.js';
19
- import '../chunk-NWVB75ER.js';
18
+ import '../chunk-W7OPEMGJ.js';
19
+ import '../chunk-C2UROFGZ.js';
20
20
  import '../chunk-PKBMQBKP.js';
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { monotonicMs } from '../chunk-MH2DSGC6.js';
3
- import { getClientApiConfig } from '../chunk-3G7YABRA.js';
4
- import { sonorFetch } from '../chunk-WPOFTCKL.js';
5
- import '../chunk-F2VYN3QL.js';
6
- import '../chunk-NWVB75ER.js';
3
+ import { sonorFetch } from '../chunk-OIWFXUVD.js';
4
+ import '../chunk-C4AFNZT2.js';
5
+ import { getClientApiConfig } from '../chunk-W7OPEMGJ.js';
6
+ import '../chunk-C2UROFGZ.js';
7
7
  import '../chunk-PKBMQBKP.js';
8
8
  import { useState, useCallback, useEffect } from 'react';
9
9
  import { APIProvider, Map as Map$1, AdvancedMarker, Pin, InfoWindow } from '@vis.gl/react-google-maps';
@@ -43,6 +43,44 @@ import { type McpServerDefinition } from './protocol';
43
43
  import type { McpServerInfo, SiteKitMcpTool } from './types';
44
44
  export { reportToolCallsToSonor } from './report';
45
45
  export type { ReportToolCallsOptions } from './report';
46
+ /** The public fields article tools read. Readers can come from Press Kit or a site's own CMS. */
47
+ export interface McpArticle {
48
+ slug: string;
49
+ title: string;
50
+ excerpt?: string;
51
+ content?: string;
52
+ author?: unknown;
53
+ category?: unknown;
54
+ published_at?: string;
55
+ faq_items?: {
56
+ question: string;
57
+ answer: string;
58
+ }[];
59
+ editorial_photos?: {
60
+ url: string;
61
+ alt: string;
62
+ caption?: string;
63
+ width: number;
64
+ height: number;
65
+ placement: {
66
+ kind: 'after_intro';
67
+ } | {
68
+ kind: 'after_heading';
69
+ heading: string;
70
+ headingId?: string;
71
+ };
72
+ }[];
73
+ }
74
+ /** Pass getAllArticles and getArticle from @sonordev/press-kit/articles/server. */
75
+ export interface McpArticleReaders {
76
+ readMany: (options: {
77
+ maxPosts: number;
78
+ site?: string;
79
+ }) => Promise<McpArticle[]>;
80
+ readOne: (slug: string, options: {
81
+ site?: string;
82
+ }) => Promise<McpArticle | null>;
83
+ }
46
84
  /**
47
85
  * One priced thing a business sells, as `list_offerings` reads it. Only the
48
86
  * fields the tool uses, so any source of offerings can supply them; the
@@ -89,10 +127,11 @@ export interface SonorMcpOptions {
89
127
  siteUrl?: string;
90
128
  /** Sub-site host on a multi-site project. Default: resolved from NEXT_PUBLIC_SITE_URL. */
91
129
  site?: string;
92
- /** Articles live under this path (`/blog/<slug>`). `false` drops the article tools. Default '/blog'. */
93
- articles?: {
130
+ /** Articles live under this path. Pass Press Kit's getAllArticles/getArticle as readMany/readOne.
131
+ * Omitting both readers retains the 8.x legacy adapter. false drops article tools. Default '/blog'. */
132
+ articles?: ({
94
133
  path?: string;
95
- } | false;
134
+ } & Partial<McpArticleReaders>) | false;
96
135
  /** `false` drops get_reviews (a site with no reviews in Sonor). */
97
136
  reviews?: boolean;
98
137
  /**
package/dist/mcp/sonor.js CHANGED
@@ -1,9 +1,9 @@
1
- import { fetchReviews, fetchReviewStats } from '../chunk-NFRJTOTB.js';
1
+ import { fetchReviews, fetchReviewStats } from '../chunk-BSQP6PRA.js';
2
2
  import { toolErrorResult } from '../chunk-FYAB6CXS.js';
3
- import { fetchBookingTypes, fetchAvailability } from '../chunk-2JEUDTL6.js';
4
- import { getLLMsData, getServices, getFAQItems, getPageSummaries } from '../chunk-JIH32RH2.js';
5
- import { getFormConfig } from '../chunk-O4DETQJI.js';
6
- import '../chunk-JT52KYHQ.js';
3
+ import { fetchBookingTypes, fetchAvailability } from '../chunk-WBUG7XRL.js';
4
+ import { getLLMsData, getServices, getFAQItems, getPageSummaries } from '../chunk-XA7Q2VQA.js';
5
+ import { getFormConfig } from '../chunk-NA4Z4CQG.js';
6
+ import '../chunk-5RYSTKVU.js';
7
7
  import '../chunk-C2FZBUSS.js';
8
8
  import '../chunk-YC7ELZS3.js';
9
9
  import '../chunk-LNSF6BJC.js';
@@ -12,23 +12,17 @@ import '../chunk-TYAVHRWH.js';
12
12
  import '../chunk-5SQK3D53.js';
13
13
  import '../chunk-HW7B43E5.js';
14
14
  import '../chunk-NJCTQH2P.js';
15
- import { getAllArticles, getArticle } from '../chunk-4Z3DI2EL.js';
16
- import '../chunk-2UO4HPGE.js';
17
- import '../chunk-Y3INC4QJ.js';
18
- import '../chunk-QXMIKDOL.js';
19
- import '../chunk-WMVK77ND.js';
20
15
  import { resolveFetch } from '../chunk-UAYAJPEP.js';
21
16
  import '../chunk-NZ4RXN3G.js';
22
- import '../chunk-VWWITFWM.js';
23
17
  import '../chunk-MJP63SSS.js';
24
18
  import { resolveServerApiConfig } from '../chunk-C7TLGL3R.js';
25
19
  import '../chunk-MH2DSGC6.js';
26
20
  import { resolveSiteHost } from '../chunk-FESKKJAS.js';
27
21
  import '../chunk-A4CC4ZG3.js';
28
- import '../chunk-3G7YABRA.js';
29
- import '../chunk-WPOFTCKL.js';
30
- import '../chunk-F2VYN3QL.js';
31
- import { SITE_KIT_VERSION } from '../chunk-NWVB75ER.js';
22
+ import '../chunk-OIWFXUVD.js';
23
+ import '../chunk-C4AFNZT2.js';
24
+ import '../chunk-W7OPEMGJ.js';
25
+ import { SITE_KIT_VERSION } from '../chunk-C2UROFGZ.js';
32
26
  import '../chunk-PKBMQBKP.js';
33
27
  import 'server-only';
34
28
  import { after } from 'next/server.js';
@@ -74,6 +68,10 @@ function reportToolCallsToSonor(options = {}) {
74
68
  }
75
69
 
76
70
  // src/mcp/sonor.ts
71
+ var legacyArticleReaders = {
72
+ readMany: async (options) => (await import('../articles/server.js')).getAllArticles(options),
73
+ readOne: async (slug, options) => (await import('../articles/server.js')).getArticle(slug, options)
74
+ };
77
75
  var SEARCH_LIMIT_MAX = 20;
78
76
  var ARTICLE_CONTENT_MAX = 12e3;
79
77
  var REPORTED_BY = "from the business\u2019s Sonor workspace";
@@ -199,7 +197,7 @@ function findPages(ctx) {
199
197
  }
200
198
  };
201
199
  }
202
- function listArticles(ctx, basePath) {
200
+ function listArticles(ctx, basePath, readers) {
203
201
  return {
204
202
  name: "list_articles",
205
203
  title: "List articles",
@@ -207,7 +205,7 @@ function listArticles(ctx, basePath) {
207
205
  inputSchema: { type: "object", properties: { query: QUERY, limit: LIMIT }, additionalProperties: false },
208
206
  annotations: READ,
209
207
  handler: async (args) => {
210
- const posts = await getAllArticles({ maxPosts: 100, site: ctx.site });
208
+ const posts = await readers.readMany({ maxPosts: 100, site: ctx.site });
211
209
  const picked = rankByQuery(posts, text(args.query, 200), (p) => [p.title, [p.excerpt, nameOf(p.category)].filter(Boolean).join(" ")], limitOf(args.limit, 5));
212
210
  return {
213
211
  articles: picked.map((p) => ({
@@ -222,7 +220,7 @@ function listArticles(ctx, basePath) {
222
220
  }
223
221
  };
224
222
  }
225
- function getArticleTool(ctx, basePath) {
223
+ function getArticleTool(ctx, basePath, readers) {
226
224
  return {
227
225
  name: "get_article",
228
226
  title: "Read an article",
@@ -236,7 +234,7 @@ function getArticleTool(ctx, basePath) {
236
234
  annotations: READ,
237
235
  handler: async (args) => {
238
236
  const slug = text(args.slug, 200).replace(/^\/+|\/+$/g, "").split("/").pop() ?? "";
239
- const post = slug ? await getArticle(slug, { site: ctx.site }) : null;
237
+ const post = slug ? await readers.readOne(slug, { site: ctx.site }) : null;
240
238
  if (!post) return { found: false, note: `No published article with the slug "${slug}". Call list_articles for the slugs that exist.` };
241
239
  const content = post.content ?? "";
242
240
  return {
@@ -445,6 +443,13 @@ function sendInquiry(ctx, form, purpose) {
445
443
  }
446
444
  };
447
445
  }
446
+ function articleReaders(articles) {
447
+ if (!articles || articles.readMany === void 0 && articles.readOne === void 0) return legacyArticleReaders;
448
+ if (typeof articles.readMany !== "function" || typeof articles.readOne !== "function") {
449
+ throw new Error("sonorMcpServer: pass both articles.readMany and articles.readOne: getAllArticles and getArticle from '@sonordev/press-kit/articles/server'.");
450
+ }
451
+ return { readMany: articles.readMany, readOne: articles.readOne };
452
+ }
448
453
  function offeringsReader(offerings) {
449
454
  if (typeof offerings.read !== "function") {
450
455
  throw new Error(
@@ -462,7 +467,7 @@ function sonorMcpTools(options) {
462
467
  listServices(ctx),
463
468
  searchFaq(ctx),
464
469
  findPages(ctx),
465
- ...articlesPath !== null ? [listArticles(ctx, articlesPath), getArticleTool(ctx, articlesPath)] : [],
470
+ ...articlesPath !== null ? [listArticles(ctx, articlesPath, articleReaders(options.articles || void 0)), getArticleTool(ctx, articlesPath, articleReaders(options.articles || void 0))] : [],
466
471
  ...options.reviews === false ? [] : [getReviews(ctx)],
467
472
  ...options.offerings ? [listOfferings(ctx, (options.offerings.path ?? "/shop").replace(/\/+$/, ""), offeringsReader(options.offerings))] : [],
468
473
  ...options.booking ? [checkAvailability(ctx, options.booking.path)] : [],
@@ -126,7 +126,7 @@ export declare function protectMcpHandlers(handlers: McpRouteHandlerSet, options
126
126
  * @example
127
127
  * ```ts
128
128
  * // app/api/mcp-internal/route.ts
129
- * import * as mcp from '../mcp/route'
129
+ * import * as mcp from './route'
130
130
  * export const { POST, GET, DELETE, OPTIONS } = createMcpInternalRoute(mcp)
131
131
  * ```
132
132
  */