@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.
- package/dist/chunk-4YEOTFVU.js +14 -0
- package/dist/{chunk-VU3XR362.js → chunk-6UDYJQL6.js} +1 -1
- package/dist/{chunk-7IMQVDDJ.js → chunk-EWKCEPMW.js} +1 -1
- package/dist/{chunk-XNGG5AGI.js → chunk-KWBM27UR.js} +1 -1
- package/dist/{chunk-TEYTLQVH.js → chunk-QKOIEWZ4.js} +33 -1
- package/dist/chunk-TYYCKVAW.js +968 -0
- package/dist/{chunk-VEIDANEU.js → chunk-VVK6ZRCN.js} +128 -41
- package/dist/{chunk-ZYXLNJ5M.js → chunk-WNPMBFD6.js} +4 -4
- package/dist/{chunk-DQTKWKSK.js → chunk-WXVKX6PY.js} +12 -3
- package/dist/components/chat/ChatPanel.d.ts +31 -0
- package/dist/components/chat/ChatPanel.d.ts.map +1 -0
- package/dist/components/chat/ChatWidget.d.ts +11 -0
- package/dist/components/chat/ChatWidget.d.ts.map +1 -0
- package/dist/components/primitives/defineHeadingSection.d.ts +2 -0
- package/dist/components/primitives/defineHeadingSection.d.ts.map +1 -1
- package/dist/components/primitives/index.js +5 -5
- package/dist/components/sections/Button/index.d.ts.map +1 -1
- package/dist/components/sections/Colors/index.d.ts.map +1 -1
- package/dist/components/sections/Colors/schema.d.ts.map +1 -1
- package/dist/components/sections/Container/index.d.ts.map +1 -1
- package/dist/components/sections/DoDontMedia/index.d.ts.map +1 -1
- package/dist/components/sections/IconList/IconList.d.ts +2 -1
- package/dist/components/sections/IconList/IconList.d.ts.map +1 -1
- package/dist/components/sections/IconList/IconListSettings.d.ts +2 -1
- package/dist/components/sections/IconList/IconListSettings.d.ts.map +1 -1
- package/dist/components/sections/IconList/index.d.ts +1 -0
- package/dist/components/sections/IconList/index.d.ts.map +1 -1
- package/dist/components/sections/LinkHeading/index.d.ts.map +1 -1
- package/dist/components/sections/Media/index.d.ts.map +1 -1
- package/dist/components/sections/Prose/index.d.ts.map +1 -1
- package/dist/components/sections/Spacer/index.d.ts.map +1 -1
- package/dist/components/sections/SubHeading/index.d.ts.map +1 -1
- package/dist/components/sections/SubSubHeading/index.d.ts.map +1 -1
- package/dist/components/sections/all-sections.d.ts +1 -0
- package/dist/components/sections/all-sections.d.ts.map +1 -1
- package/dist/components/sections/brand-guide.d.ts +1 -0
- package/dist/components/sections/brand-guide.d.ts.map +1 -1
- package/dist/components/sections/brand-guide.js +5 -5
- package/dist/components/sections/register-schemas.js +13 -943
- package/dist/components/sections/register.js +36 -0
- package/dist/components/shell/ChatbotConfigModal.d.ts +13 -0
- package/dist/components/shell/ChatbotConfigModal.d.ts.map +1 -0
- package/dist/components/shell/EditorShell.d.ts +2 -1
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/index.js +31 -24
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +7 -4
- package/dist/lib/insert-menu.d.ts +19 -0
- package/dist/lib/insert-menu.d.ts.map +1 -0
- package/dist/lib/platform-broker.d.ts +7 -0
- package/dist/lib/platform-broker.d.ts.map +1 -1
- package/dist/lib/platform-broker.js +27 -1
- package/dist/lib/registry.d.ts +23 -0
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/media/index.js +3 -3
- package/dist/schemas/index.js +6 -2
- package/dist/schemas/site-config.d.ts +30 -0
- package/dist/schemas/site-config.d.ts.map +1 -1
- package/dist/types/database.d.ts +296 -34
- package/dist/types/database.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/components/chat/ChatPanel.tsx +152 -0
- package/src/components/chat/ChatWidget.tsx +38 -0
- package/src/components/primitives/defineHeadingSection.tsx +18 -2
- package/src/components/sections/Button/index.tsx +10 -3
- package/src/components/sections/Colors/index.tsx +15 -7
- package/src/components/sections/Colors/schema.ts +5 -2
- package/src/components/sections/Container/index.tsx +19 -3
- package/src/components/sections/DoDontMedia/index.tsx +18 -7
- package/src/components/sections/IconList/IconList.tsx +43 -19
- package/src/components/sections/IconList/IconListSettings.tsx +58 -11
- package/src/components/sections/IconList/index.tsx +51 -7
- package/src/components/sections/LinkHeading/index.tsx +2 -0
- package/src/components/sections/Media/index.tsx +15 -6
- package/src/components/sections/Prose/index.tsx +9 -1
- package/src/components/sections/Spacer/index.tsx +2 -0
- package/src/components/sections/SubHeading/index.tsx +2 -0
- package/src/components/sections/SubSubHeading/index.tsx +2 -0
- package/src/components/shell/ChatbotConfigModal.tsx +152 -0
- package/src/components/shell/EditorShell.tsx +41 -20
- package/src/lib/index.ts +1 -0
- package/src/lib/insert-menu.ts +42 -0
- package/src/lib/platform-broker.ts +36 -0
- package/src/lib/registry.ts +24 -0
- package/src/schemas/site-config.ts +36 -0
- package/src/types/database.ts +284 -36
- 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
|
+
};
|
|
@@ -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
|
};
|