@actuate-media/plugin-ai 0.0.1
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/admin/AIScorePanel.d.ts +19 -0
- package/dist/admin/AIScorePanel.d.ts.map +1 -0
- package/dist/admin/AIScorePanel.js +35 -0
- package/dist/admin/AIScorePanel.js.map +1 -0
- package/dist/admin/BrandVoiceSettings.d.ts +11 -0
- package/dist/admin/BrandVoiceSettings.d.ts.map +1 -0
- package/dist/admin/BrandVoiceSettings.js +73 -0
- package/dist/admin/BrandVoiceSettings.js.map +1 -0
- package/dist/admin/ContentScoreDashboard.d.ts +15 -0
- package/dist/admin/ContentScoreDashboard.d.ts.map +1 -0
- package/dist/admin/ContentScoreDashboard.js +30 -0
- package/dist/admin/ContentScoreDashboard.js.map +1 -0
- package/dist/admin/WritingAssistantToolbar.d.ts +13 -0
- package/dist/admin/WritingAssistantToolbar.d.ts.map +1 -0
- package/dist/admin/WritingAssistantToolbar.js +49 -0
- package/dist/admin/WritingAssistantToolbar.js.map +1 -0
- package/dist/brand/consistency-checker.d.ts +17 -0
- package/dist/brand/consistency-checker.d.ts.map +1 -0
- package/dist/brand/consistency-checker.js +47 -0
- package/dist/brand/consistency-checker.js.map +1 -0
- package/dist/brand/profile-builder.d.ts +10 -0
- package/dist/brand/profile-builder.d.ts.map +1 -0
- package/dist/brand/profile-builder.js +93 -0
- package/dist/brand/profile-builder.js.map +1 -0
- package/dist/brand/voice-profile.d.ts +30 -0
- package/dist/brand/voice-profile.d.ts.map +1 -0
- package/dist/brand/voice-profile.js +2 -0
- package/dist/brand/voice-profile.js.map +1 -0
- package/dist/collections.d.ts +3 -0
- package/dist/collections.d.ts.map +1 -0
- package/dist/collections.js +2 -0
- package/dist/collections.js.map +1 -0
- package/dist/fields.d.ts +3 -0
- package/dist/fields.d.ts.map +1 -0
- package/dist/fields.js +2 -0
- package/dist/fields.js.map +1 -0
- package/dist/hooks.d.ts +5 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +75 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/links/smart-links.d.ts +18 -0
- package/dist/links/smart-links.d.ts.map +1 -0
- package/dist/links/smart-links.js +44 -0
- package/dist/links/smart-links.js.map +1 -0
- package/dist/media/alt-text-generator.d.ts +16 -0
- package/dist/media/alt-text-generator.d.ts.map +1 -0
- package/dist/media/alt-text-generator.js +50 -0
- package/dist/media/alt-text-generator.js.map +1 -0
- package/dist/media/auto-tagger.d.ts +21 -0
- package/dist/media/auto-tagger.d.ts.map +1 -0
- package/dist/media/auto-tagger.js +43 -0
- package/dist/media/auto-tagger.js.map +1 -0
- package/dist/providers/anthropic.d.ts +8 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +119 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/index.d.ts +34 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +35 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/openai.d.ts +7 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +110 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/scoring/accessibility.d.ts +24 -0
- package/dist/scoring/accessibility.d.ts.map +1 -0
- package/dist/scoring/accessibility.js +87 -0
- package/dist/scoring/accessibility.js.map +1 -0
- package/dist/scoring/brand-alignment.d.ts +12 -0
- package/dist/scoring/brand-alignment.d.ts.map +1 -0
- package/dist/scoring/brand-alignment.js +46 -0
- package/dist/scoring/brand-alignment.js.map +1 -0
- package/dist/scoring/composite.d.ts +19 -0
- package/dist/scoring/composite.d.ts.map +1 -0
- package/dist/scoring/composite.js +38 -0
- package/dist/scoring/composite.js.map +1 -0
- package/dist/scoring/freshness.d.ts +15 -0
- package/dist/scoring/freshness.d.ts.map +1 -0
- package/dist/scoring/freshness.js +37 -0
- package/dist/scoring/freshness.js.map +1 -0
- package/dist/scoring/readability.d.ts +16 -0
- package/dist/scoring/readability.d.ts.map +1 -0
- package/dist/scoring/readability.js +77 -0
- package/dist/scoring/readability.js.map +1 -0
- package/dist/scoring/seo-score.d.ts +26 -0
- package/dist/scoring/seo-score.d.ts.map +1 -0
- package/dist/scoring/seo-score.js +53 -0
- package/dist/scoring/seo-score.js.map +1 -0
- package/dist/search/clustering.d.ts +20 -0
- package/dist/search/clustering.d.ts.map +1 -0
- package/dist/search/clustering.js +91 -0
- package/dist/search/clustering.js.map +1 -0
- package/dist/search/embeddings.d.ts +14 -0
- package/dist/search/embeddings.d.ts.map +1 -0
- package/dist/search/embeddings.js +42 -0
- package/dist/search/embeddings.js.map +1 -0
- package/dist/search/semantic-search.d.ts +31 -0
- package/dist/search/semantic-search.d.ts.map +1 -0
- package/dist/search/semantic-search.js +59 -0
- package/dist/search/semantic-search.js.map +1 -0
- package/dist/translation/translator.d.ts +24 -0
- package/dist/translation/translator.d.ts.map +1 -0
- package/dist/translation/translator.js +42 -0
- package/dist/translation/translator.js.map +1 -0
- package/dist/writing/assistant.d.ts +28 -0
- package/dist/writing/assistant.d.ts.map +1 -0
- package/dist/writing/assistant.js +110 -0
- package/dist/writing/assistant.js.map +1 -0
- package/dist/writing/inline-suggestions.d.ts +18 -0
- package/dist/writing/inline-suggestions.d.ts.map +1 -0
- package/dist/writing/inline-suggestions.js +38 -0
- package/dist/writing/inline-suggestions.js.map +1 -0
- package/dist/writing/meta-generator.d.ts +13 -0
- package/dist/writing/meta-generator.d.ts.map +1 -0
- package/dist/writing/meta-generator.js +41 -0
- package/dist/writing/meta-generator.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface AIScorePanelProps {
|
|
2
|
+
scores: {
|
|
3
|
+
readability: number;
|
|
4
|
+
seo: number;
|
|
5
|
+
brandAlignment: number;
|
|
6
|
+
accessibility: number;
|
|
7
|
+
freshness: number;
|
|
8
|
+
overall: number;
|
|
9
|
+
};
|
|
10
|
+
grade: string;
|
|
11
|
+
suggestions: Array<{
|
|
12
|
+
text: string;
|
|
13
|
+
priority: "high" | "medium" | "low";
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
/** Sidebar panel displaying content quality scores and actionable suggestions. */
|
|
17
|
+
export declare function AIScorePanel({ scores, grade, suggestions }: AIScorePanelProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=AIScorePanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AIScorePanel.d.ts","sourceRoot":"","sources":["../../src/admin/AIScorePanel.tsx"],"names":[],"mappings":"AAIA,UAAU,iBAAiB;IACzB,MAAM,EAAE;QACN,WAAW,EAAE,MAAM,CAAC;QACpB,GAAG,EAAE,MAAM,CAAC;QACZ,cAAc,EAAE,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAA;KAAE,CAAC,CAAC;CAC3E;AAgBD,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,iBAAiB,2CAoE7E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
const PRIORITY_COLORS = {
|
|
4
|
+
high: "#ef4444",
|
|
5
|
+
medium: "#f59e0b",
|
|
6
|
+
low: "#3b82f6",
|
|
7
|
+
};
|
|
8
|
+
const SCORE_LABELS = [
|
|
9
|
+
{ key: "readability", label: "Readability" },
|
|
10
|
+
{ key: "seo", label: "SEO" },
|
|
11
|
+
{ key: "brandAlignment", label: "Brand Alignment" },
|
|
12
|
+
{ key: "accessibility", label: "Accessibility" },
|
|
13
|
+
{ key: "freshness", label: "Freshness" },
|
|
14
|
+
];
|
|
15
|
+
/** Sidebar panel displaying content quality scores and actionable suggestions. */
|
|
16
|
+
export function AIScorePanel({ scores, grade, suggestions }) {
|
|
17
|
+
return (_jsxs("div", { style: { padding: "16px", borderLeft: "1px solid #e5e7eb", minWidth: 280 }, children: [_jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 16 }, children: [_jsx("h3", { style: { margin: 0, fontSize: 16, fontWeight: 600 }, children: "Content Score" }), _jsx("span", { style: {
|
|
18
|
+
fontSize: 24,
|
|
19
|
+
fontWeight: 700,
|
|
20
|
+
color: scores.overall >= 80 ? "#22c55e" : scores.overall >= 60 ? "#f59e0b" : "#ef4444",
|
|
21
|
+
}, children: grade })] }), _jsxs("div", { style: { marginBottom: 16 }, children: [_jsx("div", { style: { fontSize: 32, fontWeight: 700, textAlign: "center", marginBottom: 4 }, children: scores.overall }), _jsx("div", { style: { fontSize: 12, color: "#6b7280", textAlign: "center" }, children: "Overall Score" })] }), _jsx("div", { style: { display: "flex", flexDirection: "column", gap: 12, marginBottom: 24 }, children: SCORE_LABELS.map(({ key, label }) => (_jsxs("div", { children: [_jsxs("div", { style: { display: "flex", justifyContent: "space-between", fontSize: 13, marginBottom: 4 }, children: [_jsx("span", { children: label }), _jsx("span", { style: { fontWeight: 500 }, children: scores[key] })] }), _jsx("div", { style: { height: 6, borderRadius: 3, backgroundColor: "#f3f4f6", overflow: "hidden" }, children: _jsx("div", { style: {
|
|
22
|
+
height: "100%",
|
|
23
|
+
width: `${scores[key]}%`,
|
|
24
|
+
borderRadius: 3,
|
|
25
|
+
backgroundColor: scores[key] >= 80 ? "#22c55e" : scores[key] >= 60 ? "#f59e0b" : "#ef4444",
|
|
26
|
+
transition: "width 0.3s ease",
|
|
27
|
+
} }) })] }, key))) }), suggestions.length > 0 && (_jsxs("div", { children: [_jsx("h4", { style: { fontSize: 14, fontWeight: 600, marginBottom: 8 }, children: "Suggestions" }), _jsx("ul", { style: { listStyle: "none", padding: 0, margin: 0, display: "flex", flexDirection: "column", gap: 8 }, children: suggestions.map((suggestion, idx) => (_jsx("li", { style: {
|
|
28
|
+
fontSize: 13,
|
|
29
|
+
padding: "8px 10px",
|
|
30
|
+
borderRadius: 6,
|
|
31
|
+
backgroundColor: "#f9fafb",
|
|
32
|
+
borderLeft: `3px solid ${PRIORITY_COLORS[suggestion.priority]}`,
|
|
33
|
+
}, children: suggestion.text }, idx))) })] }))] }));
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=AIScorePanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AIScorePanel.js","sourceRoot":"","sources":["../../src/admin/AIScorePanel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAiBb,MAAM,eAAe,GAA2B;IAC9C,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;IACjB,GAAG,EAAE,SAAS;CACf,CAAC;AAEF,MAAM,YAAY,GAAqE;IACrF,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;IAC5C,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;IAC5B,EAAE,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACnD,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE;IAChD,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;CACzC,CAAC;AAEF,kFAAkF;AAClF,MAAM,UAAU,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAqB;IAC5E,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE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C,UAAU,CAAC,QAAQ,CAAC,EAAE;6BAChE,YAEA,UAAU,CAAC,IAAI,IATX,GAAG,CAUL,CACN,CAAC,GACC,IACD,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BrandVoiceProfile } from "../brand/voice-profile.js";
|
|
2
|
+
interface BrandVoiceSettingsProps {
|
|
3
|
+
profile?: BrandVoiceProfile;
|
|
4
|
+
onSave: (profile: BrandVoiceProfile) => void;
|
|
5
|
+
onAnalyze: () => void;
|
|
6
|
+
isAnalyzing?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Editor for configuring brand voice profiles with tone sliders, vocabulary, and style settings. */
|
|
9
|
+
export declare function BrandVoiceSettings({ profile, onSave, onAnalyze, isAnalyzing }: BrandVoiceSettingsProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=BrandVoiceSettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrandVoiceSettings.d.ts","sourceRoot":"","sources":["../../src/admin/BrandVoiceSettings.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,UAAU,uBAAuB;IAC/B,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7C,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAiBD,qGAAqG;AACrG,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,uBAAuB,2CA0OtG"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
const EMPTY_PROFILE = {
|
|
5
|
+
id: "",
|
|
6
|
+
name: "",
|
|
7
|
+
tone: [
|
|
8
|
+
{ dimension: "professional", value: 0.5 },
|
|
9
|
+
{ dimension: "friendly", value: 0.5 },
|
|
10
|
+
{ dimension: "authoritative", value: 0.5 },
|
|
11
|
+
{ dimension: "playful", value: 0.5 },
|
|
12
|
+
],
|
|
13
|
+
vocabulary: { preferred: [], avoided: [], jargonLevel: "minimal" },
|
|
14
|
+
style: { sentenceLength: "medium", paragraphLength: "medium", formality: 0.5, activeVoiceRatio: 0.7 },
|
|
15
|
+
audience: { expertise: "intermediate" },
|
|
16
|
+
examples: [],
|
|
17
|
+
};
|
|
18
|
+
/** Editor for configuring brand voice profiles with tone sliders, vocabulary, and style settings. */
|
|
19
|
+
export function BrandVoiceSettings({ profile, onSave, onAnalyze, isAnalyzing }) {
|
|
20
|
+
const [draft, setDraft] = useState(profile ?? EMPTY_PROFILE);
|
|
21
|
+
const [preferredInput, setPreferredInput] = useState("");
|
|
22
|
+
const [avoidedInput, setAvoidedInput] = useState("");
|
|
23
|
+
const updateTone = (dimension, value) => {
|
|
24
|
+
setDraft((prev) => ({
|
|
25
|
+
...prev,
|
|
26
|
+
tone: prev.tone.map((t) => (t.dimension === dimension ? { ...t, value } : t)),
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
const addPreferred = () => {
|
|
30
|
+
if (!preferredInput.trim())
|
|
31
|
+
return;
|
|
32
|
+
setDraft((prev) => ({
|
|
33
|
+
...prev,
|
|
34
|
+
vocabulary: { ...prev.vocabulary, preferred: [...prev.vocabulary.preferred, preferredInput.trim()] },
|
|
35
|
+
}));
|
|
36
|
+
setPreferredInput("");
|
|
37
|
+
};
|
|
38
|
+
const addAvoided = () => {
|
|
39
|
+
if (!avoidedInput.trim())
|
|
40
|
+
return;
|
|
41
|
+
setDraft((prev) => ({
|
|
42
|
+
...prev,
|
|
43
|
+
vocabulary: { ...prev.vocabulary, avoided: [...prev.vocabulary.avoided, avoidedInput.trim()] },
|
|
44
|
+
}));
|
|
45
|
+
setAvoidedInput("");
|
|
46
|
+
};
|
|
47
|
+
return (_jsxs("div", { style: { padding: 24, maxWidth: 640 }, children: [_jsx("h2", { style: { fontSize: 20, fontWeight: 600, marginBottom: 24 }, children: "Brand Voice Profile" }), _jsxs("div", { style: { marginBottom: 24 }, children: [_jsx("label", { style: { display: "block", fontSize: 14, fontWeight: 500, marginBottom: 6 }, children: "Profile Name" }), _jsx("input", { type: "text", value: draft.name, onChange: (e) => setDraft((prev) => ({ ...prev, name: e.target.value })), style: { width: "100%", padding: "8px 12px", border: "1px solid #d1d5db", borderRadius: 6 } })] }), _jsxs("div", { style: { marginBottom: 24 }, children: [_jsx("h3", { style: { fontSize: 16, fontWeight: 500, marginBottom: 12 }, children: "Tone" }), draft.tone.map((t) => (_jsxs("div", { style: { marginBottom: 12 }, children: [_jsxs("div", { style: { display: "flex", justifyContent: "space-between", fontSize: 13, marginBottom: 4 }, children: [_jsx("span", { style: { textTransform: "capitalize" }, children: t.dimension }), _jsxs("span", { children: [Math.round(t.value * 100), "%"] })] }), _jsx("input", { type: "range", min: "0", max: "1", step: "0.05", value: t.value, onChange: (e) => updateTone(t.dimension, parseFloat(e.target.value)), style: { width: "100%" } })] }, t.dimension)))] }), _jsxs("div", { style: { marginBottom: 24 }, children: [_jsx("h3", { style: { fontSize: 16, fontWeight: 500, marginBottom: 12 }, children: "Vocabulary" }), _jsxs("div", { style: { marginBottom: 12 }, children: [_jsx("label", { style: { fontSize: 13, fontWeight: 500 }, children: "Preferred Terms" }), _jsxs("div", { style: { display: "flex", gap: 8, marginTop: 4 }, children: [_jsx("input", { type: "text", value: preferredInput, onChange: (e) => setPreferredInput(e.target.value), onKeyDown: (e) => e.key === "Enter" && addPreferred(), style: { flex: 1, padding: "6px 10px", border: "1px solid #d1d5db", borderRadius: 6 } }), _jsx("button", { onClick: addPreferred, style: { padding: "6px 16px", borderRadius: 6, border: "1px solid #d1d5db", cursor: "pointer" }, children: "Add" })] }), _jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 4, marginTop: 8 }, children: draft.vocabulary.preferred.map((term, i) => (_jsx("span", { style: { fontSize: 12, padding: "2px 8px", borderRadius: 12, backgroundColor: "#dcfce7", color: "#166534" }, children: term }, i))) })] }), _jsxs("div", { style: { marginBottom: 12 }, children: [_jsx("label", { style: { fontSize: 13, fontWeight: 500 }, children: "Avoided Terms" }), _jsxs("div", { style: { display: "flex", gap: 8, marginTop: 4 }, children: [_jsx("input", { type: "text", value: avoidedInput, onChange: (e) => setAvoidedInput(e.target.value), onKeyDown: (e) => e.key === "Enter" && addAvoided(), style: { flex: 1, padding: "6px 10px", border: "1px solid #d1d5db", borderRadius: 6 } }), _jsx("button", { onClick: addAvoided, style: { padding: "6px 16px", borderRadius: 6, border: "1px solid #d1d5db", cursor: "pointer" }, children: "Add" })] }), _jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 4, marginTop: 8 }, children: draft.vocabulary.avoided.map((term, i) => (_jsx("span", { style: { fontSize: 12, padding: "2px 8px", borderRadius: 12, backgroundColor: "#fee2e2", color: "#991b1b" }, children: term }, i))) })] }), _jsxs("div", { children: [_jsx("label", { style: { fontSize: 13, fontWeight: 500 }, children: "Jargon Level" }), _jsxs("select", { value: draft.vocabulary.jargonLevel, onChange: (e) => setDraft((prev) => ({
|
|
48
|
+
...prev,
|
|
49
|
+
vocabulary: { ...prev.vocabulary, jargonLevel: e.target.value },
|
|
50
|
+
})), style: { display: "block", marginTop: 4, padding: "6px 10px", border: "1px solid #d1d5db", borderRadius: 6 }, children: [_jsx("option", { value: "none", children: "None" }), _jsx("option", { value: "minimal", children: "Minimal" }), _jsx("option", { value: "moderate", children: "Moderate" }), _jsx("option", { value: "technical", children: "Technical" })] })] })] }), _jsxs("div", { style: { marginBottom: 24 }, children: [_jsx("h3", { style: { fontSize: 16, fontWeight: 500, marginBottom: 12 }, children: "Style" }), _jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 12 }, children: [_jsxs("div", { children: [_jsx("label", { style: { fontSize: 13, fontWeight: 500 }, children: "Sentence Length" }), _jsxs("select", { value: draft.style.sentenceLength, onChange: (e) => setDraft((prev) => ({
|
|
51
|
+
...prev,
|
|
52
|
+
style: { ...prev.style, sentenceLength: e.target.value },
|
|
53
|
+
})), style: { display: "block", marginTop: 4, width: "100%", padding: "6px 10px", border: "1px solid #d1d5db", borderRadius: 6 }, children: [_jsx("option", { value: "short", children: "Short" }), _jsx("option", { value: "medium", children: "Medium" }), _jsx("option", { value: "long", children: "Long" }), _jsx("option", { value: "varied", children: "Varied" })] })] }), _jsxs("div", { children: [_jsx("label", { style: { fontSize: 13, fontWeight: 500 }, children: "Paragraph Length" }), _jsxs("select", { value: draft.style.paragraphLength, onChange: (e) => setDraft((prev) => ({
|
|
54
|
+
...prev,
|
|
55
|
+
style: { ...prev.style, paragraphLength: e.target.value },
|
|
56
|
+
})), style: { display: "block", marginTop: 4, width: "100%", padding: "6px 10px", border: "1px solid #d1d5db", borderRadius: 6 }, children: [_jsx("option", { value: "short", children: "Short" }), _jsx("option", { value: "medium", children: "Medium" }), _jsx("option", { value: "long", children: "Long" })] })] })] }), _jsxs("div", { style: { marginTop: 12 }, children: [_jsxs("div", { style: { display: "flex", justifyContent: "space-between", fontSize: 13, marginBottom: 4 }, children: [_jsx("span", { children: "Formality" }), _jsxs("span", { children: [Math.round(draft.style.formality * 100), "%"] })] }), _jsx("input", { type: "range", min: "0", max: "1", step: "0.05", value: draft.style.formality, onChange: (e) => setDraft((prev) => ({ ...prev, style: { ...prev.style, formality: parseFloat(e.target.value) } })), style: { width: "100%" } })] }), _jsxs("div", { style: { marginTop: 12 }, children: [_jsxs("div", { style: { display: "flex", justifyContent: "space-between", fontSize: 13, marginBottom: 4 }, children: [_jsx("span", { children: "Active Voice Ratio" }), _jsxs("span", { children: [Math.round(draft.style.activeVoiceRatio * 100), "%"] })] }), _jsx("input", { type: "range", min: "0", max: "1", step: "0.05", value: draft.style.activeVoiceRatio, onChange: (e) => setDraft((prev) => ({ ...prev, style: { ...prev.style, activeVoiceRatio: parseFloat(e.target.value) } })), style: { width: "100%" } })] })] }), _jsxs("div", { style: { display: "flex", gap: 12 }, children: [_jsx("button", { onClick: () => onSave(draft), style: {
|
|
57
|
+
padding: "10px 24px",
|
|
58
|
+
borderRadius: 6,
|
|
59
|
+
border: "none",
|
|
60
|
+
backgroundColor: "#2563eb",
|
|
61
|
+
color: "#fff",
|
|
62
|
+
fontWeight: 500,
|
|
63
|
+
cursor: "pointer",
|
|
64
|
+
}, children: "Save Profile" }), _jsx("button", { onClick: onAnalyze, disabled: isAnalyzing, style: {
|
|
65
|
+
padding: "10px 24px",
|
|
66
|
+
borderRadius: 6,
|
|
67
|
+
border: "1px solid #d1d5db",
|
|
68
|
+
backgroundColor: "#fff",
|
|
69
|
+
cursor: isAnalyzing ? "not-allowed" : "pointer",
|
|
70
|
+
opacity: isAnalyzing ? 0.6 : 1,
|
|
71
|
+
}, children: isAnalyzing ? "Analyzing..." : "Analyze Content" })] })] }));
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=BrandVoiceSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrandVoiceSettings.js","sourceRoot":"","sources":["../../src/admin/BrandVoiceSettings.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAUxC,MAAM,aAAa,GAAsB;IACvC,EAAE,EAAE,EAAE;IACN,IAAI,EAAE,EAAE;IACR,IAAI,EAAE;QACJ,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,EAAE;QACzC,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE;QACrC,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,EAAE;QAC1C,EAAE,SAAS,EAAE,SAAS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+
grade: string;
|
|
7
|
+
lastUpdated: string;
|
|
8
|
+
}>;
|
|
9
|
+
averageScore: number;
|
|
10
|
+
distribution: Record<string, number>;
|
|
11
|
+
}
|
|
12
|
+
/** Dashboard showing content score distribution, averages, and per-document scores. */
|
|
13
|
+
export declare function ContentScoreDashboard({ scores, averageScore, distribution }: ContentScoreDashboardProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=ContentScoreDashboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentScoreDashboard.d.ts","sourceRoot":"","sources":["../../src/admin/ContentScoreDashboard.tsx"],"names":[],"mappings":"AAIA,UAAU,0BAA0B;IAClC,MAAM,EAAE,KAAK,CAAC;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAUD,uFAAuF;AACvF,wBAAgB,qBAAqB,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,0BAA0B,2CAyFvG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
const GRADE_COLORS = {
|
|
4
|
+
A: "#22c55e",
|
|
5
|
+
B: "#84cc16",
|
|
6
|
+
C: "#f59e0b",
|
|
7
|
+
D: "#f97316",
|
|
8
|
+
F: "#ef4444",
|
|
9
|
+
};
|
|
10
|
+
/** Dashboard showing content score distribution, averages, and per-document scores. */
|
|
11
|
+
export function ContentScoreDashboard({ scores, averageScore, distribution }) {
|
|
12
|
+
const maxDistCount = Math.max(...Object.values(distribution), 1);
|
|
13
|
+
return (_jsxs("div", { style: { padding: 24 }, children: [_jsx("h2", { style: { fontSize: 22, fontWeight: 600, marginBottom: 24 }, children: "Content Quality Dashboard" }), _jsxs("div", { style: { display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 16, marginBottom: 32 }, children: [_jsxs("div", { style: { padding: 20, borderRadius: 8, border: "1px solid #e5e7eb", textAlign: "center" }, children: [_jsx("div", { style: { fontSize: 36, fontWeight: 700, color: averageScore >= 80 ? "#22c55e" : averageScore >= 60 ? "#f59e0b" : "#ef4444" }, children: averageScore }), _jsx("div", { style: { fontSize: 13, color: "#6b7280", marginTop: 4 }, children: "Average Score" })] }), _jsxs("div", { style: { padding: 20, borderRadius: 8, border: "1px solid #e5e7eb", textAlign: "center" }, children: [_jsx("div", { style: { fontSize: 36, fontWeight: 700 }, children: scores.length }), _jsx("div", { style: { fontSize: 13, color: "#6b7280", marginTop: 4 }, children: "Documents Scored" })] }), _jsxs("div", { style: { padding: 20, borderRadius: 8, border: "1px solid #e5e7eb", textAlign: "center" }, children: [_jsx("div", { style: { fontSize: 36, fontWeight: 700, color: "#22c55e" }, children: scores.filter((s) => s.score >= 80).length }), _jsx("div", { style: { fontSize: 13, color: "#6b7280", marginTop: 4 }, children: "High Quality" })] })] }), _jsxs("div", { style: { marginBottom: 32 }, children: [_jsx("h3", { style: { fontSize: 16, fontWeight: 500, marginBottom: 16 }, children: "Grade Distribution" }), _jsx("div", { style: { display: "flex", gap: 12, alignItems: "flex-end", height: 120 }, children: Object.entries(distribution).map(([grade, count]) => (_jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", flex: 1 }, children: [_jsx("span", { style: { fontSize: 12, fontWeight: 500, marginBottom: 4 }, children: count }), _jsx("div", { style: {
|
|
14
|
+
width: "100%",
|
|
15
|
+
maxWidth: 48,
|
|
16
|
+
height: `${(count / maxDistCount) * 100}%`,
|
|
17
|
+
minHeight: 4,
|
|
18
|
+
backgroundColor: GRADE_COLORS[grade] ?? "#d1d5db",
|
|
19
|
+
borderRadius: "4px 4px 0 0",
|
|
20
|
+
} }), _jsx("span", { style: { fontSize: 14, fontWeight: 600, marginTop: 6, color: GRADE_COLORS[grade] ?? "#374151" }, children: grade })] }, grade))) })] }), _jsxs("div", { children: [_jsx("h3", { style: { fontSize: 16, fontWeight: 500, marginBottom: 12 }, children: "Document Scores" }), _jsxs("table", { style: { width: "100%", borderCollapse: "collapse", fontSize: 14 }, children: [_jsx("thead", { children: _jsxs("tr", { style: { borderBottom: "2px solid #e5e7eb" }, children: [_jsx("th", { style: { textAlign: "left", padding: "8px 12px", fontWeight: 500, color: "#6b7280" }, children: "Title" }), _jsx("th", { style: { textAlign: "center", padding: "8px 12px", fontWeight: 500, color: "#6b7280" }, children: "Score" }), _jsx("th", { style: { textAlign: "center", padding: "8px 12px", fontWeight: 500, color: "#6b7280" }, children: "Grade" }), _jsx("th", { style: { textAlign: "right", padding: "8px 12px", fontWeight: 500, color: "#6b7280" }, children: "Last Updated" })] }) }), _jsx("tbody", { children: scores.map((doc) => (_jsxs("tr", { style: { borderBottom: "1px solid #f3f4f6" }, children: [_jsx("td", { style: { padding: "10px 12px" }, children: doc.title }), _jsx("td", { style: { padding: "10px 12px", textAlign: "center", fontWeight: 500 }, children: doc.score }), _jsx("td", { style: { padding: "10px 12px", textAlign: "center" }, children: _jsx("span", { style: {
|
|
21
|
+
display: "inline-block",
|
|
22
|
+
padding: "2px 10px",
|
|
23
|
+
borderRadius: 12,
|
|
24
|
+
fontSize: 12,
|
|
25
|
+
fontWeight: 600,
|
|
26
|
+
color: "#fff",
|
|
27
|
+
backgroundColor: GRADE_COLORS[doc.grade] ?? "#6b7280",
|
|
28
|
+
}, children: doc.grade }) }), _jsx("td", { style: { padding: "10px 12px", textAlign: "right", color: "#6b7280" }, children: doc.lastUpdated })] }, doc.documentId))) })] })] })] }));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ContentScoreDashboard.js.map
|
|
@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AW,GAAM,KAlB1F,GAAG,CAAC,UAAU,CAmBlB,CACN,CAAC,GACI,IACF,IACJ,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface WritingAssistantToolbarProps {
|
|
2
|
+
onGenerate: () => void;
|
|
3
|
+
onExpand: () => void;
|
|
4
|
+
onCompress: () => void;
|
|
5
|
+
onRewrite: () => void;
|
|
6
|
+
onProofread: () => void;
|
|
7
|
+
isProcessing?: boolean;
|
|
8
|
+
selectedText?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Toolbar with AI writing actions for use alongside a rich text editor. */
|
|
11
|
+
export declare function WritingAssistantToolbar({ onGenerate, onExpand, onCompress, onRewrite, onProofread, isProcessing, selectedText, }: WritingAssistantToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=WritingAssistantToolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WritingAssistantToolbar.d.ts","sourceRoot":"","sources":["../../src/admin/WritingAssistantToolbar.tsx"],"names":[],"mappings":"AAIA,UAAU,4BAA4B;IACpC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAiBD,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,EACtC,UAAU,EACV,QAAQ,EACR,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,YAAY,GACb,EAAE,4BAA4B,2CA4D9B"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
const ACTIONS = [
|
|
4
|
+
{ label: "Generate", icon: "✦", action: "onGenerate" },
|
|
5
|
+
{ label: "Expand", icon: "↔", action: "onExpand", requiresSelection: true },
|
|
6
|
+
{ label: "Compress", icon: "⊘", action: "onCompress", requiresSelection: true },
|
|
7
|
+
{ label: "Rewrite", icon: "⟳", action: "onRewrite", requiresSelection: true },
|
|
8
|
+
{ label: "Proofread", icon: "✓", action: "onProofread", requiresSelection: true },
|
|
9
|
+
];
|
|
10
|
+
/** Toolbar with AI writing actions for use alongside a rich text editor. */
|
|
11
|
+
export function WritingAssistantToolbar({ onGenerate, onExpand, onCompress, onRewrite, onProofread, isProcessing, selectedText, }) {
|
|
12
|
+
const handlers = {
|
|
13
|
+
onGenerate,
|
|
14
|
+
onExpand,
|
|
15
|
+
onCompress,
|
|
16
|
+
onRewrite,
|
|
17
|
+
onProofread,
|
|
18
|
+
};
|
|
19
|
+
return (_jsxs("div", { style: {
|
|
20
|
+
display: "flex",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
gap: 4,
|
|
23
|
+
padding: "6px 8px",
|
|
24
|
+
borderRadius: 8,
|
|
25
|
+
border: "1px solid #e5e7eb",
|
|
26
|
+
backgroundColor: "#fafafa",
|
|
27
|
+
}, children: [_jsx("span", { style: { fontSize: 12, color: "#6b7280", marginRight: 8, fontWeight: 500 }, children: "AI" }), ACTIONS.map((action) => {
|
|
28
|
+
const disabled = isProcessing || (action.requiresSelection && !selectedText);
|
|
29
|
+
return (_jsxs("button", { onClick: () => handlers[action.action]?.(), disabled: disabled, title: action.label, style: {
|
|
30
|
+
display: "flex",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
gap: 4,
|
|
33
|
+
padding: "4px 10px",
|
|
34
|
+
fontSize: 13,
|
|
35
|
+
border: "1px solid transparent",
|
|
36
|
+
borderRadius: 6,
|
|
37
|
+
backgroundColor: "transparent",
|
|
38
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
39
|
+
opacity: disabled ? 0.4 : 1,
|
|
40
|
+
transition: "background-color 0.15s",
|
|
41
|
+
}, onMouseEnter: (e) => {
|
|
42
|
+
if (!disabled)
|
|
43
|
+
(e.currentTarget.style.backgroundColor = "#f3f4f6");
|
|
44
|
+
}, onMouseLeave: (e) => {
|
|
45
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
46
|
+
}, children: [_jsx("span", { children: action.icon }), _jsx("span", { children: action.label })] }, action.action));
|
|
47
|
+
}), isProcessing && (_jsx("span", { style: { fontSize: 12, color: "#6b7280", marginLeft: 8 }, children: "Processing..." }))] }));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=WritingAssistantToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WritingAssistantToolbar.js","sourceRoot":"","sources":["../../src/admin/WritingAssistantToolbar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAqBb,MAAM,OAAO,GAAoB;IAC/B,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE;IACtD,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,IAAI,EAAE;IAC3E,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,IAAI,EAAE;IAC/E,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,IAAI,EAAE;IAC7E,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,IAAI,EAAE;CAClF,CAAC;AAEF,4EAA4E;AAC5E,MAAM,UAAU,uBAAuB,CAAC,EACtC,UAAU,EACV,QAAQ,EACR,UAAU,EACV,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CAAC,CAAC,EAAE,EAAE;wBAClB,IAAI,CAAC,QAAQ;4BAAE,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;oBACrE,CAAC,EACD,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE;wBAClB,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,eAAe,GAAG,aAAa,CAAC;oBACxD,CAAC,aAED,yBAAO,MAAM,CAAC,IAAI,GAAQ,EAC1B,yBAAO,MAAM,CAAC,KAAK,GAAQ,KAzBtB,MAAM,CAAC,MAAM,CA0BX,CACV,CAAC;YACJ,CAAC,CAAC,EACD,YAAY,IAAI,CACf,eAAM,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,EAAE,8BAAsB,CACrF,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BrandVoiceProfile } from "./voice-profile.js";
|
|
2
|
+
export interface ConsistencyResult {
|
|
3
|
+
score: number;
|
|
4
|
+
issues: Array<{
|
|
5
|
+
type: string;
|
|
6
|
+
location: string;
|
|
7
|
+
suggestion: string;
|
|
8
|
+
severity: "low" | "medium" | "high";
|
|
9
|
+
}>;
|
|
10
|
+
highlights: Array<{
|
|
11
|
+
text: string;
|
|
12
|
+
type: "good" | "off-brand";
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
/** Checks content for consistency against a brand voice profile. */
|
|
16
|
+
export declare function checkConsistency(content: string, profile: BrandVoiceProfile): Promise<ConsistencyResult>;
|
|
17
|
+
//# sourceMappingURL=consistency-checker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consistency-checker.d.ts","sourceRoot":"","sources":["../../src/brand/consistency-checker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;KACrC,CAAC,CAAC;IACH,UAAU,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAC,CAAC;CACjE;AAED,oEAAoE;AACpE,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,iBAAiB,CAAC,CAkD5B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Checks content for consistency against a brand voice profile. */
|
|
2
|
+
export async function checkConsistency(content, profile) {
|
|
3
|
+
const issues = [];
|
|
4
|
+
const highlights = [];
|
|
5
|
+
for (const avoided of profile.vocabulary.avoided) {
|
|
6
|
+
const regex = new RegExp(`\\b${avoided}\\b`, "gi");
|
|
7
|
+
let match;
|
|
8
|
+
while ((match = regex.exec(content)) !== null) {
|
|
9
|
+
issues.push({
|
|
10
|
+
type: "vocabulary",
|
|
11
|
+
location: `character ${match.index}`,
|
|
12
|
+
suggestion: `Replace "${avoided}" with a brand-appropriate alternative`,
|
|
13
|
+
severity: "medium",
|
|
14
|
+
});
|
|
15
|
+
highlights.push({ text: match[0], type: "off-brand" });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
for (const preferred of profile.vocabulary.preferred) {
|
|
19
|
+
if (content.toLowerCase().includes(preferred.toLowerCase())) {
|
|
20
|
+
highlights.push({ text: preferred, type: "good" });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const sentences = content.split(/[.!?]+/).filter(Boolean);
|
|
24
|
+
const targetLengths = {
|
|
25
|
+
short: [5, 15],
|
|
26
|
+
medium: [10, 25],
|
|
27
|
+
long: [20, 40],
|
|
28
|
+
varied: [5, 40],
|
|
29
|
+
};
|
|
30
|
+
const [minLen, maxLen] = targetLengths[profile.style.sentenceLength] ?? [5, 40];
|
|
31
|
+
for (let i = 0; i < sentences.length; i++) {
|
|
32
|
+
const wordCount = sentences[i].trim().split(/\s+/).filter(Boolean).length;
|
|
33
|
+
if (wordCount < minLen || wordCount > maxLen) {
|
|
34
|
+
issues.push({
|
|
35
|
+
type: "sentence-length",
|
|
36
|
+
location: `sentence ${i + 1}`,
|
|
37
|
+
suggestion: `Sentence has ${wordCount} words — target is ${minLen}-${maxLen}`,
|
|
38
|
+
severity: "low",
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const totalPossibleIssues = sentences.length + profile.vocabulary.avoided.length;
|
|
43
|
+
const issueRatio = totalPossibleIssues > 0 ? issues.length / totalPossibleIssues : 0;
|
|
44
|
+
const score = Math.round(Math.max(0, Math.min(100, 100 - issueRatio * 100)));
|
|
45
|
+
return { score, issues, highlights };
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=consistency-checker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consistency-checker.js","sourceRoot":"","sources":["../../src/brand/consistency-checker.ts"],"names":[],"mappings":"AAaA,oEAAoE;AACpE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAe,EACf,OAA0B;IAE1B,MAAM,MAAM,GAAgC,EAAE,CAAC;IAC/C,MAAM,UAAU,GAAoC,EAAE,CAAC;IAEvD,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QACjD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,MAAM,OAAO,KAAK,EAAE,IAAI,CAAC,CAAC;QACnD,IAAI,KAA6B,CAAC;QAClC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,O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AM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;QAC3E,IAAI,SAAS,GAAG,MAAM,IAAI,SAAS,GAAG,MAAM,EAAE,CAAC;YAC7C,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,iBAAiB;gBACvB,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE;gBAC7B,UAAU,EAAE,gBAAgB,SAAS,sBAAsB,MAAM,IAAI,MAAM,EAAE;gBAC7E,QAAQ,EAAE,KAAK;aAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,MAAM,mBAAmB,GAAG,SAAS,CAAC,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC;IACjF,MAAM,UAAU,GAAG,mBAAmB,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IACrF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAE7E,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AIProvider } from "../providers/index";
|
|
2
|
+
import type { BrandVoiceProfile } from "./voice-profile";
|
|
3
|
+
export interface ProfileBuilderOptions {
|
|
4
|
+
name: string;
|
|
5
|
+
sampleSize?: number;
|
|
6
|
+
provider?: AIProvider;
|
|
7
|
+
}
|
|
8
|
+
/** Analyzes content samples to build a brand voice profile. */
|
|
9
|
+
export declare function buildBrandProfile(content: string[], options?: ProfileBuilderOptions): Promise<BrandVoiceProfile>;
|
|
10
|
+
//# sourceMappingURL=profile-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-builder.d.ts","sourceRoot":"","sources":["../../src/brand/profile-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB;AAED,+DAA+D;AAC/D,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CA8G5B"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/** Analyzes content samples to build a brand voice profile. */
|
|
2
|
+
export async function buildBrandProfile(content, options) {
|
|
3
|
+
const samples = options?.sampleSize
|
|
4
|
+
? content.slice(0, options.sampleSize)
|
|
5
|
+
: content;
|
|
6
|
+
const totalWords = samples.reduce((sum, s) => sum + s.split(/\s+/).filter(Boolean).length, 0);
|
|
7
|
+
const totalSentences = samples.reduce((sum, s) => sum + (s.match(/[.!?]+/g)?.length ?? 1), 0);
|
|
8
|
+
const avgSentenceLength = totalSentences > 0 ? totalWords / totalSentences : 15;
|
|
9
|
+
let sentenceLength;
|
|
10
|
+
if (avgSentenceLength < 12)
|
|
11
|
+
sentenceLength = "short";
|
|
12
|
+
else if (avgSentenceLength < 22)
|
|
13
|
+
sentenceLength = "medium";
|
|
14
|
+
else if (avgSentenceLength < 30)
|
|
15
|
+
sentenceLength = "long";
|
|
16
|
+
else
|
|
17
|
+
sentenceLength = "varied";
|
|
18
|
+
const baseProfile = {
|
|
19
|
+
id: crypto.randomUUID(),
|
|
20
|
+
name: options?.name ?? "Untitled Profile",
|
|
21
|
+
tone: [
|
|
22
|
+
{ dimension: "professional", value: 0.7 },
|
|
23
|
+
{ dimension: "friendly", value: 0.5 },
|
|
24
|
+
{ dimension: "authoritative", value: 0.6 },
|
|
25
|
+
],
|
|
26
|
+
vocabulary: {
|
|
27
|
+
preferred: [],
|
|
28
|
+
avoided: [],
|
|
29
|
+
jargonLevel: "minimal",
|
|
30
|
+
},
|
|
31
|
+
style: {
|
|
32
|
+
sentenceLength,
|
|
33
|
+
paragraphLength: "medium",
|
|
34
|
+
formality: 0.6,
|
|
35
|
+
activeVoiceRatio: 0.7,
|
|
36
|
+
},
|
|
37
|
+
audience: {
|
|
38
|
+
expertise: "intermediate",
|
|
39
|
+
},
|
|
40
|
+
examples: samples.slice(0, 3).map((text) => ({
|
|
41
|
+
text: text.slice(0, 200),
|
|
42
|
+
score: 0.8,
|
|
43
|
+
})),
|
|
44
|
+
};
|
|
45
|
+
if (!options?.provider) {
|
|
46
|
+
return baseProfile;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const analysis = await options.provider.generateText(`Analyze the tone, style, and voice of the following content samples. Return a JSON object with:
|
|
50
|
+
- "tone": array of { "dimension": string, "value": number (0-1) } for dimensions like professional, friendly, authoritative, casual, technical, empathetic
|
|
51
|
+
- "preferred": array of commonly used words/phrases to keep
|
|
52
|
+
- "avoided": array of words/phrases that don't fit the voice
|
|
53
|
+
- "jargonLevel": "none" | "minimal" | "moderate" | "heavy"
|
|
54
|
+
- "formality": number 0-1 (0 = very casual, 1 = very formal)
|
|
55
|
+
- "activeVoiceRatio": estimated ratio 0-1 of active vs passive voice
|
|
56
|
+
- "expertise": "beginner" | "intermediate" | "expert"
|
|
57
|
+
|
|
58
|
+
Content samples:
|
|
59
|
+
${samples.slice(0, 5).join("\n---\n")}`, {
|
|
60
|
+
systemPrompt: "You are a brand voice analyst. Analyze writing patterns and return valid JSON only.",
|
|
61
|
+
maxTokens: 1024,
|
|
62
|
+
temperature: 0.3,
|
|
63
|
+
});
|
|
64
|
+
const cleaned = analysis.text.replace(/```json?\n?/g, "").replace(/```/g, "").trim();
|
|
65
|
+
const parsed = JSON.parse(cleaned);
|
|
66
|
+
if (parsed.tone?.length) {
|
|
67
|
+
baseProfile.tone = parsed.tone;
|
|
68
|
+
}
|
|
69
|
+
if (parsed.preferred?.length) {
|
|
70
|
+
baseProfile.vocabulary.preferred = parsed.preferred;
|
|
71
|
+
}
|
|
72
|
+
if (parsed.avoided?.length) {
|
|
73
|
+
baseProfile.vocabulary.avoided = parsed.avoided;
|
|
74
|
+
}
|
|
75
|
+
if (parsed.jargonLevel) {
|
|
76
|
+
baseProfile.vocabulary.jargonLevel = parsed.jargonLevel;
|
|
77
|
+
}
|
|
78
|
+
if (typeof parsed.formality === "number") {
|
|
79
|
+
baseProfile.style.formality = parsed.formality;
|
|
80
|
+
}
|
|
81
|
+
if (typeof parsed.activeVoiceRatio === "number") {
|
|
82
|
+
baseProfile.style.activeVoiceRatio = parsed.activeVoiceRatio;
|
|
83
|
+
}
|
|
84
|
+
if (parsed.expertise) {
|
|
85
|
+
baseProfile.audience.expertise = parsed.expertise;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
// Fall back to heuristic profile if LLM analysis fails
|
|
90
|
+
}
|
|
91
|
+
return baseProfile;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=profile-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-builder.js","sourceRoot":"","sources":["../../src/brand/profile-builder.ts"],"names":[],"mappings":"AASA,+DAA+D;AAC/D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAAiB,EACjB,OAA+B;IAE/B,MAAM,OAAO,GAAG,OAAO,EAAE,UAAU;QACjC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC;QACtC,CAAC,CAAC,OAAO,CAAC;IAEZ,M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AW,CAAC,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAClD,CAAC;QACD,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACvB,WAAW,CAAC,UAAU,CAAC,WAAW,GAAG,MAAM,CAAC,WAAkB,CAAC;QACjE,CAAC;QACD,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YACzC,WAAW,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QACjD,CAAC;QACD,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAAK,QAAQ,EAAE,CAAC;YAChD,WAAW,CAAC,KAAK,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QAC/D,CAAC;QACD,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,WAAW,CAAC,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,SAAgB,CAAC;QAC3D,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,uDAAuD;IACzD,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface BrandVoiceProfile {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
tone: Array<{
|
|
5
|
+
dimension: string;
|
|
6
|
+
value: number;
|
|
7
|
+
}>;
|
|
8
|
+
vocabulary: {
|
|
9
|
+
preferred: string[];
|
|
10
|
+
avoided: string[];
|
|
11
|
+
jargonLevel: "none" | "minimal" | "moderate" | "technical";
|
|
12
|
+
};
|
|
13
|
+
style: {
|
|
14
|
+
sentenceLength: "short" | "medium" | "long" | "varied";
|
|
15
|
+
paragraphLength: "short" | "medium" | "long";
|
|
16
|
+
formality: number;
|
|
17
|
+
activeVoiceRatio: number;
|
|
18
|
+
};
|
|
19
|
+
audience: {
|
|
20
|
+
expertise: "beginner" | "intermediate" | "expert";
|
|
21
|
+
ageRange?: string;
|
|
22
|
+
persona?: string;
|
|
23
|
+
};
|
|
24
|
+
examples: Array<{
|
|
25
|
+
text: string;
|
|
26
|
+
score: number;
|
|
27
|
+
notes?: string;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=voice-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice-profile.d.ts","sourceRoot":"","sources":["../../src/brand/voice-profile.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,UAAU,EAAE;QACV,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;KAC5D,CAAC;IACF,KAAK,EAAE;QACL,cAAc,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;QACvD,eAAe,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;QAC7C,SAAS,EAAE,MAAM,CAAC;QAClB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,QAAQ,EAAE;QACR,SAAS,EAAE,UAAU,GAAG,cAAc,GAAG,QAAQ,CAAC;QAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice-profile.js","sourceRoot":"","sources":["../../src/brand/voice-profile.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAyC,EAAE,CAAC"}
|
package/dist/fields.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAM,CAAC"}
|
package/dist/fields.js
ADDED