@drawnagency/primitives 0.1.66 → 0.1.68

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 (88) hide show
  1. package/dist/chunk-4YEOTFVU.js +14 -0
  2. package/dist/{chunk-VU3XR362.js → chunk-6UDYJQL6.js} +1 -1
  3. package/dist/{chunk-7IMQVDDJ.js → chunk-EWKCEPMW.js} +1 -1
  4. package/dist/{chunk-XNGG5AGI.js → chunk-KWBM27UR.js} +1 -1
  5. package/dist/{chunk-TEYTLQVH.js → chunk-QKOIEWZ4.js} +33 -1
  6. package/dist/chunk-TYYCKVAW.js +968 -0
  7. package/dist/{chunk-VEIDANEU.js → chunk-VVK6ZRCN.js} +128 -41
  8. package/dist/{chunk-ZYXLNJ5M.js → chunk-WNPMBFD6.js} +4 -4
  9. package/dist/{chunk-DQTKWKSK.js → chunk-WXVKX6PY.js} +12 -3
  10. package/dist/components/chat/ChatPanel.d.ts +31 -0
  11. package/dist/components/chat/ChatPanel.d.ts.map +1 -0
  12. package/dist/components/chat/ChatWidget.d.ts +11 -0
  13. package/dist/components/chat/ChatWidget.d.ts.map +1 -0
  14. package/dist/components/primitives/defineHeadingSection.d.ts +2 -0
  15. package/dist/components/primitives/defineHeadingSection.d.ts.map +1 -1
  16. package/dist/components/primitives/index.js +5 -5
  17. package/dist/components/sections/Button/index.d.ts.map +1 -1
  18. package/dist/components/sections/Colors/index.d.ts.map +1 -1
  19. package/dist/components/sections/Colors/schema.d.ts.map +1 -1
  20. package/dist/components/sections/Container/index.d.ts.map +1 -1
  21. package/dist/components/sections/DoDontMedia/index.d.ts.map +1 -1
  22. package/dist/components/sections/IconList/IconList.d.ts +2 -1
  23. package/dist/components/sections/IconList/IconList.d.ts.map +1 -1
  24. package/dist/components/sections/IconList/IconListSettings.d.ts +2 -1
  25. package/dist/components/sections/IconList/IconListSettings.d.ts.map +1 -1
  26. package/dist/components/sections/IconList/index.d.ts +1 -0
  27. package/dist/components/sections/IconList/index.d.ts.map +1 -1
  28. package/dist/components/sections/LinkHeading/index.d.ts.map +1 -1
  29. package/dist/components/sections/Media/index.d.ts.map +1 -1
  30. package/dist/components/sections/Prose/index.d.ts.map +1 -1
  31. package/dist/components/sections/Spacer/index.d.ts.map +1 -1
  32. package/dist/components/sections/SubHeading/index.d.ts.map +1 -1
  33. package/dist/components/sections/SubSubHeading/index.d.ts.map +1 -1
  34. package/dist/components/sections/all-sections.d.ts +1 -0
  35. package/dist/components/sections/all-sections.d.ts.map +1 -1
  36. package/dist/components/sections/brand-guide.d.ts +1 -0
  37. package/dist/components/sections/brand-guide.d.ts.map +1 -1
  38. package/dist/components/sections/brand-guide.js +5 -5
  39. package/dist/components/sections/register-schemas.js +13 -943
  40. package/dist/components/sections/register.js +36 -0
  41. package/dist/components/shell/ChatbotConfigModal.d.ts +13 -0
  42. package/dist/components/shell/ChatbotConfigModal.d.ts.map +1 -0
  43. package/dist/components/shell/EditorShell.d.ts +2 -1
  44. package/dist/components/shell/EditorShell.d.ts.map +1 -1
  45. package/dist/index.js +31 -24
  46. package/dist/lib/index.d.ts +1 -0
  47. package/dist/lib/index.d.ts.map +1 -1
  48. package/dist/lib/index.js +7 -4
  49. package/dist/lib/insert-menu.d.ts +19 -0
  50. package/dist/lib/insert-menu.d.ts.map +1 -0
  51. package/dist/lib/platform-broker.d.ts +7 -0
  52. package/dist/lib/platform-broker.d.ts.map +1 -1
  53. package/dist/lib/platform-broker.js +27 -1
  54. package/dist/lib/registry.d.ts +23 -0
  55. package/dist/lib/registry.d.ts.map +1 -1
  56. package/dist/media/index.js +3 -3
  57. package/dist/schemas/index.js +6 -2
  58. package/dist/schemas/site-config.d.ts +30 -0
  59. package/dist/schemas/site-config.d.ts.map +1 -1
  60. package/dist/types/database.d.ts +296 -34
  61. package/dist/types/database.d.ts.map +1 -1
  62. package/package.json +5 -1
  63. package/src/components/chat/ChatPanel.tsx +152 -0
  64. package/src/components/chat/ChatWidget.tsx +38 -0
  65. package/src/components/primitives/defineHeadingSection.tsx +18 -2
  66. package/src/components/sections/Button/index.tsx +10 -3
  67. package/src/components/sections/Colors/index.tsx +15 -7
  68. package/src/components/sections/Colors/schema.ts +5 -2
  69. package/src/components/sections/Container/index.tsx +19 -3
  70. package/src/components/sections/DoDontMedia/index.tsx +18 -7
  71. package/src/components/sections/IconList/IconList.tsx +43 -19
  72. package/src/components/sections/IconList/IconListSettings.tsx +58 -11
  73. package/src/components/sections/IconList/index.tsx +51 -7
  74. package/src/components/sections/LinkHeading/index.tsx +2 -0
  75. package/src/components/sections/Media/index.tsx +15 -6
  76. package/src/components/sections/Prose/index.tsx +9 -1
  77. package/src/components/sections/Spacer/index.tsx +2 -0
  78. package/src/components/sections/SubHeading/index.tsx +2 -0
  79. package/src/components/sections/SubSubHeading/index.tsx +2 -0
  80. package/src/components/shell/ChatbotConfigModal.tsx +152 -0
  81. package/src/components/shell/EditorShell.tsx +41 -20
  82. package/src/lib/index.ts +1 -0
  83. package/src/lib/insert-menu.ts +42 -0
  84. package/src/lib/platform-broker.ts +36 -0
  85. package/src/lib/registry.ts +24 -0
  86. package/src/schemas/site-config.ts +36 -0
  87. package/src/types/database.ts +284 -36
  88. package/dist/chunk-ZGFAYZWB.js +0 -8
@@ -0,0 +1,14 @@
1
+ // src/lib/pages.ts
2
+ function slugifyPageSlug(input) {
3
+ return input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
4
+ }
5
+ function audiencePasses(access, audience) {
6
+ if (access.length === 0) return true;
7
+ if (!audience) return true;
8
+ return access.includes(audience);
9
+ }
10
+
11
+ export {
12
+ slugifyPageSlug,
13
+ audiencePasses
14
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  slugifyPageSlug
3
- } from "./chunk-ZGFAYZWB.js";
3
+ } from "./chunk-4YEOTFVU.js";
4
4
 
5
5
  // src/media/utils.ts
6
6
  async function hashFileBuffer(buffer) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HexColorSchema
3
- } from "./chunk-TEYTLQVH.js";
3
+ } from "./chunk-QKOIEWZ4.js";
4
4
 
5
5
  // src/schemas/audience.ts
6
6
  import { z } from "zod";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-I5737FJY.js";
8
8
  import {
9
9
  getMediaProvider
10
- } from "./chunk-VU3XR362.js";
10
+ } from "./chunk-6UDYJQL6.js";
11
11
  import {
12
12
  cn
13
13
  } from "./chunk-7EOSDFS3.js";
@@ -194,6 +194,32 @@ var IndexSchema = RawIndexSchema.transform(normalizeRawIndex).pipe(CanonicalInde
194
194
  function normalizeSiteIndex(raw) {
195
195
  return IndexSchema.parse(raw);
196
196
  }
197
+ var ChatbotTaskIdSchema = z3.string().min(1).max(32).regex(
198
+ /^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$/,
199
+ "Task id must be lowercase letters, numbers, dashes, or underscores"
200
+ );
201
+ var ChatbotTaskSchema = z3.object({
202
+ id: ChatbotTaskIdSchema,
203
+ label: z3.string().min(1).max(60),
204
+ prompt: z3.string().max(4e3),
205
+ // Audience names allowed to see this task; [] = all — same semantics as SectionMeta.access.
206
+ access: z3.array(z3.string()).default([])
207
+ });
208
+ var ChatbotConfigSchema = z3.object({
209
+ enabled: z3.boolean().default(false),
210
+ systemPrompt: z3.string().max(8e3).default(""),
211
+ // Audience names the widget is shown to; [] = all audiences.
212
+ audiences: z3.array(z3.string()).default([]),
213
+ tasks: z3.array(ChatbotTaskSchema).max(20).default([])
214
+ }).superRefine((cfg, ctx) => {
215
+ const seen = /* @__PURE__ */ new Set();
216
+ for (const t of cfg.tasks) {
217
+ if (seen.has(t.id)) {
218
+ ctx.addIssue({ code: z3.ZodIssueCode.custom, message: `Duplicate task id "${t.id}"` });
219
+ }
220
+ seen.add(t.id);
221
+ }
222
+ });
197
223
  var SiteConfigSchema = z3.object({
198
224
  siteName: z3.string().default("Brand Portal"),
199
225
  primaryColor: HexColorSchema.default("#009ca6"),
@@ -208,7 +234,11 @@ var SiteConfigSchema = z3.object({
208
234
  // Favicon stored as a data URL (SVG/PNG, small) so it travels with
209
235
  // site-config.json — no media manifest or CDN round-trip needed.
210
236
  favicon: z3.string().refine((v) => v.startsWith("data:image/"), "Favicon must be an image data URL").nullable().default(null),
211
- media: MediaConfigSchema.default(MediaConfigSchema.parse({}))
237
+ media: MediaConfigSchema.default(MediaConfigSchema.parse({})),
238
+ // Brand chatbot config (editor-owned; the platform kill switch lives in the
239
+ // sites table, not here). Every field defaults so pre-existing
240
+ // site-config.json files keep parsing.
241
+ chatbot: ChatbotConfigSchema.default({ enabled: false, systemPrompt: "", audiences: [], tasks: [] })
212
242
  });
213
243
 
214
244
  export {
@@ -227,5 +257,7 @@ export {
227
257
  PageSchema,
228
258
  IndexSchema,
229
259
  normalizeSiteIndex,
260
+ ChatbotTaskSchema,
261
+ ChatbotConfigSchema,
230
262
  SiteConfigSchema
231
263
  };