@fonderie/vue-courier-admin-screens 0.3.0 → 0.4.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.
package/dist/index.cjs CHANGED
@@ -44,25 +44,25 @@ var styles = {
44
44
  previewFrame: {
45
45
  width: "100%",
46
46
  height: "520px",
47
- border: "1px solid #ddd",
47
+ border: "1px solid var(--fonderie-border,#e0e0e0)",
48
48
  borderRadius: "8px",
49
- background: "#fff"
49
+ background: "var(--fonderie-surface,#fff)"
50
50
  },
51
51
  previewText: {
52
52
  whiteSpace: "pre-wrap",
53
- border: "1px solid #ddd",
53
+ border: "1px solid var(--fonderie-border,#e0e0e0)",
54
54
  borderRadius: "8px",
55
55
  padding: "12px",
56
56
  fontSize: "13px",
57
- fontFamily: "monospace"
57
+ fontFamily: 'var(--fonderie-mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace)'
58
58
  },
59
59
  title: { fontSize: "24px", fontWeight: 700 },
60
60
  subtitle: { fontSize: "16px", fontWeight: 600, marginBottom: "8px" },
61
- meta: { fontSize: "13px", color: "#666", marginBottom: "16px" },
62
- status: { padding: "24px", textAlign: "center", color: "#666" },
63
- error: { color: "#e11d48", marginBottom: "12px", fontSize: "14px" },
61
+ meta: { fontSize: "13px", color: "var(--fonderie-text-muted,#5c5c5c)", marginBottom: "16px" },
62
+ status: { padding: "24px", textAlign: "center", color: "var(--fonderie-text-muted,#5c5c5c)" },
63
+ error: { color: "var(--fonderie-danger,#e00)", marginBottom: "12px", fontSize: "14px" },
64
64
  list: { listStyle: "none", padding: "0", margin: "0" },
65
- row: { borderBottom: "1px solid #eee" },
65
+ row: { borderBottom: "1px solid var(--fonderie-border-light,#f5f5f5)" },
66
66
  rowButton: {
67
67
  width: "100%",
68
68
  display: "flex",
@@ -75,18 +75,18 @@ var styles = {
75
75
  textAlign: "left"
76
76
  },
77
77
  type: { fontSize: "14px", fontWeight: 600, flex: "1" },
78
- locale: { fontSize: "13px", color: "#666", marginRight: "16px" },
79
- active: { fontSize: "12px", color: "#16a34a" },
80
- inactive: { fontSize: "12px", color: "#999" },
78
+ locale: { fontSize: "13px", color: "var(--fonderie-text-muted,#5c5c5c)", marginRight: "16px" },
79
+ active: { fontSize: "12px", color: "var(--fonderie-accent-strong,#009767)" },
80
+ inactive: { fontSize: "12px", color: "var(--fonderie-text-muted,#5c5c5c)" },
81
81
  form: { display: "flex", flexDirection: "column", gap: "4px" },
82
82
  label: { fontSize: "13px", fontWeight: 600, marginTop: "12px" },
83
- input: { border: "1px solid #ddd", borderRadius: "8px", padding: "10px", fontSize: "14px" },
83
+ input: { border: "1px solid var(--fonderie-border,#e0e0e0)", borderRadius: "8px", padding: "10px", fontSize: "14px" },
84
84
  textarea: {
85
- border: "1px solid #ddd",
85
+ border: "1px solid var(--fonderie-border,#e0e0e0)",
86
86
  borderRadius: "8px",
87
87
  padding: "10px",
88
88
  fontSize: "14px",
89
- fontFamily: "monospace"
89
+ fontFamily: 'var(--fonderie-mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace)'
90
90
  },
91
91
  checkboxLabel: {
92
92
  display: "flex",
@@ -97,8 +97,8 @@ var styles = {
97
97
  },
98
98
  button: {
99
99
  marginTop: "16px",
100
- backgroundColor: "#000",
101
- color: "#fff",
100
+ backgroundColor: "var(--fonderie-text,#171717)",
101
+ color: "var(--fonderie-surface,#fff)",
102
102
  padding: "10px 20px",
103
103
  borderRadius: "8px",
104
104
  border: "none",
@@ -113,12 +113,12 @@ var styles = {
113
113
  justifyContent: "space-between",
114
114
  alignItems: "center",
115
115
  padding: "8px 0",
116
- borderBottom: "1px solid #eee",
116
+ borderBottom: "1px solid var(--fonderie-border-light,#f5f5f5)",
117
117
  fontSize: "13px"
118
118
  },
119
119
  rollbackButton: {
120
120
  background: "none",
121
- border: "1px solid #ddd",
121
+ border: "1px solid var(--fonderie-border,#e0e0e0)",
122
122
  borderRadius: "8px",
123
123
  padding: "4px 10px",
124
124
  fontSize: "12px",
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/screens/TemplateEditorScreen.ts","../src/styles.ts","../src/screens/TemplateListScreen.ts"],"sourcesContent":["export { TemplateEditorScreen, TemplateListScreen } from './screens';\n","import type {\n\tCourierAdminClient,\n\tFonderieApiError,\n\tISetTemplateInput,\n\tITemplateRevision,\n} from '@fonderie/client';\nimport {\n\tuseTemplate,\n\tuseTemplatePreview,\n\tuseTemplateRevisions,\n\tuseTemplates,\n} from '@fonderie/vue-courier-admin';\nimport type { PropType } from 'vue';\nimport { defineComponent, h, ref, watch } from 'vue';\nimport { styles } from '../styles';\n\n// Implicit variables the layout injects — an operator never supplies these, so\n// offering them as fields would just be noise.\nconst IMPLICIT = new Set(['subject', 'preheader', 'brandName']);\n\nexport const TemplateEditorScreen = defineComponent({\n\tname: 'FonderieTemplateEditorScreen',\n\tprops: {\n\t\tclient: { type: Object as PropType<CourierAdminClient>, required: true },\n\t\ttype: { type: String, required: true },\n\t\tlocale: { type: String as PropType<string | null>, default: null },\n\t},\n\temits: {\n\t\tsaved: () => true,\n\t},\n\tsetup(props, { emit }) {\n\t\tconst { template, isLoading, error, refresh } = useTemplate(\n\t\t\tprops.client,\n\t\t\tprops.type,\n\t\t\tprops.locale,\n\t\t);\n\t\t// Saves go through the list composable (which re-fetches the template list\n\t\t// after each write); mounting it adds a template-list fetch to this\n\t\t// single-template editor — acceptable for an admin dashboard. Its\n\t\t// isLoading/error track that list fetch, so the save action keeps local state.\n\t\tconst { saveTemplate } = useTemplates(props.client);\n\t\tconst { revisions, rollback } = useTemplateRevisions(props.client, props.type, props.locale);\n\t\tconst isSaving = ref(false);\n\t\tconst saveError = ref<FonderieApiError | null>(null);\n\n\t\tconst subject = ref('');\n\t\tconst html = ref('');\n\t\tconst text = ref('');\n\t\tconst active = ref(true);\n\n\t\twatch(template, (tpl) => {\n\t\t\tif (!tpl) return;\n\t\t\tsubject.value = tpl.subject ?? '';\n\t\t\thtml.value = tpl.html ?? '';\n\t\t\ttext.value = tpl.text;\n\t\t\tactive.value = tpl.active;\n\t\t});\n\n\t\tconst {\n\t\t\tpreview,\n\t\t\tisPreviewing,\n\t\t\terror: previewError,\n\t\t\trenderPreview,\n\t\t} = useTemplatePreview(props.client);\n\t\t// Sample values as JSON text rather than an object, so a half-typed value\n\t\t// does not have to parse on every keystroke.\n\t\tconst sampleJson = ref('{}');\n\t\tconst sampleError = ref<string | null>(null);\n\n\t\tasync function run() {\n\t\t\tlet data: Record<string, unknown> = {};\n\t\t\ttry {\n\t\t\t\tconst parsed: unknown = JSON.parse(sampleJson.value || '{}');\n\t\t\t\tif (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n\t\t\t\t\tsampleError.value = 'Sample data must be a JSON object.';\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tdata = parsed as Record<string, unknown>;\n\t\t\t\tsampleError.value = null;\n\t\t\t} catch {\n\t\t\t\tsampleError.value = 'Sample data is not valid JSON.';\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst result = await renderPreview(\n\t\t\t\tprops.type,\n\t\t\t\t{\n\t\t\t\t\ttext: text.value,\n\t\t\t\t\tdata,\n\t\t\t\t\t...(subject.value ? { subject: subject.value } : {}),\n\t\t\t\t\t...(html.value ? { html: html.value } : {}),\n\t\t\t\t},\n\t\t\t\tprops.locale,\n\t\t\t);\n\t\t\t// The server reports which variables this content uses; seed the ones\n\t\t\t// with no value yet with their own name so the render shows where each\n\t\t\t// lands. Never overwrite something already typed.\n\t\t\tconst missing = result.variables.filter((v) => !IMPLICIT.has(v) && !(v in data));\n\t\t\tif (missing.length > 0) {\n\t\t\t\tsampleJson.value = JSON.stringify(\n\t\t\t\t\t{ ...data, ...Object.fromEntries(missing.map((v) => [v, v])) },\n\t\t\t\t\tnull,\n\t\t\t\t\t2,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// One render once the template has loaded, so the pane is never empty on\n\t\t// arrival. After that it is explicit — a request per keystroke is not a\n\t\t// preview, it is a load test.\n\t\twatch(template, (tpl) => {\n\t\t\tif (tpl) void run();\n\t\t});\n\n\t\tasync function handleSubmit(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tisSaving.value = true;\n\t\t\tsaveError.value = null;\n\t\t\ttry {\n\t\t\t\tconst input: ISetTemplateInput = { text: text.value, active: active.value };\n\t\t\t\tif (subject.value) input.subject = subject.value;\n\t\t\t\tif (html.value) input.html = html.value;\n\t\t\t\tif (template.value?.version !== undefined) input.ifVersion = template.value.version;\n\t\t\t\tawait saveTemplate(props.type, input, props.locale);\n\t\t\t\t// The list composable refreshes its own list; this screen renders the\n\t\t\t\t// single template, so re-read it too.\n\t\t\t\tawait refresh();\n\t\t\t\temit('saved');\n\t\t\t} catch (err) {\n\t\t\t\t// useTemplates normalizes every failure to FonderieApiError before throwing.\n\t\t\t\tsaveError.value = err as FonderieApiError;\n\t\t\t} finally {\n\t\t\t\tisSaving.value = false;\n\t\t\t}\n\t\t}\n\n\t\tfunction renderRevision(rev: ITemplateRevision) {\n\t\t\treturn h('li', { key: rev.version, style: styles.revisionRow }, [\n\t\t\t\th(\n\t\t\t\t\t'span',\n\t\t\t\t\t`v${rev.version} — ${rev.actor ?? 'unknown'} — ${new Date(rev.createdAt).toLocaleString()}`,\n\t\t\t\t),\n\t\t\t\th(\n\t\t\t\t\t'button',\n\t\t\t\t\t{ type: 'button', style: styles.rollbackButton, onClick: () => rollback(rev.version) },\n\t\t\t\t\t'Roll back',\n\t\t\t\t),\n\t\t\t]);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (isLoading.value) return h('p', { style: styles.status }, 'Loading template…');\n\t\t\tif (error.value)\n\t\t\t\treturn h('p', { style: styles.error, role: 'alert' }, error.value.explanation);\n\n\t\t\treturn h('div', { style: styles.container }, [\n\t\t\t\th('h1', { style: styles.title }, props.type),\n\t\t\t\th(\n\t\t\t\t\t'p',\n\t\t\t\t\t{ style: styles.meta },\n\t\t\t\t\t`${props.locale ?? 'base'} · v${template.value?.version ?? 1}`,\n\t\t\t\t),\n\t\t\t\th('div', { style: styles.split }, [\n\t\t\t\th('div', { style: styles.column }, [\n\t\t\t\th('form', { style: styles.form, onSubmit: handleSubmit }, [\n\t\t\t\t\th('label', { style: styles.label, for: 'template-subject' }, 'Subject'),\n\t\t\t\t\th('input', {\n\t\t\t\t\t\tid: 'template-subject',\n\t\t\t\t\t\tstyle: styles.input,\n\t\t\t\t\t\tvalue: subject.value,\n\t\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\t\tsubject.value = (e.target as HTMLInputElement).value;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\th('label', { style: styles.label, for: 'template-html' }, 'HTML body'),\n\t\t\t\t\th('textarea', {\n\t\t\t\t\t\tid: 'template-html',\n\t\t\t\t\t\tstyle: styles.textarea,\n\t\t\t\t\t\trows: 8,\n\t\t\t\t\t\tvalue: html.value,\n\t\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\t\thtml.value = (e.target as HTMLTextAreaElement).value;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\th('label', { style: styles.label, for: 'template-text' }, 'Plain-text body'),\n\t\t\t\t\th('textarea', {\n\t\t\t\t\t\tid: 'template-text',\n\t\t\t\t\t\tstyle: styles.textarea,\n\t\t\t\t\t\trows: 4,\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tvalue: text.value,\n\t\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\t\ttext.value = (e.target as HTMLTextAreaElement).value;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\th('label', { style: styles.checkboxLabel }, [\n\t\t\t\t\t\th('input', {\n\t\t\t\t\t\t\ttype: 'checkbox',\n\t\t\t\t\t\t\tchecked: active.value,\n\t\t\t\t\t\t\tonChange: (e: Event) => {\n\t\t\t\t\t\t\t\tactive.value = (e.target as HTMLInputElement).checked;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t'Active',\n\t\t\t\t\t]),\n\t\t\t\t\tsaveError.value\n\t\t\t\t\t\t? h('p', { style: styles.error, role: 'alert' }, saveError.value.explanation)\n\t\t\t\t\t\t: null,\n\t\t\t\t\th(\n\t\t\t\t\t\t'button',\n\t\t\t\t\t\t{ type: 'submit', disabled: isSaving.value, style: styles.button },\n\t\t\t\t\t\tisSaving.value ? 'Saving…' : 'Save',\n\t\t\t\t\t),\n\t\t\t\t]),\n\t\t\t\th('label', { style: styles.label, for: 'template-sample' }, 'Sample data'),\n\t\t\t\th('textarea', {\n\t\t\t\t\tid: 'template-sample',\n\t\t\t\t\tstyle: styles.textarea,\n\t\t\t\t\trows: 6,\n\t\t\t\t\tspellcheck: false,\n\t\t\t\t\tvalue: sampleJson.value,\n\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\tsampleJson.value = (e.target as HTMLTextAreaElement).value;\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\tsampleError.value\n\t\t\t\t\t? h('p', { style: styles.error, role: 'alert' }, sampleError.value)\n\t\t\t\t\t: null,\n\t\t\t\t]),\n\t\t\t\th('div', { style: styles.column }, [\n\t\t\t\t\th('div', { style: styles.previewHeader }, [\n\t\t\t\t\t\th('span', { style: styles.label }, 'Preview'),\n\t\t\t\t\t\th(\n\t\t\t\t\t\t\t'button',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'button',\n\t\t\t\t\t\t\t\tstyle: styles.rollbackButton,\n\t\t\t\t\t\t\t\tdisabled: isPreviewing.value,\n\t\t\t\t\t\t\t\tonClick: () => void run(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisPreviewing.value ? 'Rendering…' : 'Render',\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t\tpreviewError.value\n\t\t\t\t\t\t? h('p', { style: styles.error, role: 'alert' }, previewError.value.explanation)\n\t\t\t\t\t\t: null,\n\t\t\t\t\tpreview.value?.subject\n\t\t\t\t\t\t? h('p', { style: styles.previewSubject }, preview.value.subject)\n\t\t\t\t\t\t: null,\n\t\t\t\t\tpreview.value?.html\n\t\t\t\t\t\t? // sandbox= — no scripts, no same-origin. Operator-authored HTML\n\t\t\t\t\t\t\t// must never execute in the dashboard's origin, where the admin\n\t\t\t\t\t\t\t// token lives.\n\t\t\t\t\t\t\th('iframe', {\n\t\t\t\t\t\t\t\ttitle: 'Template preview',\n\t\t\t\t\t\t\t\tstyle: styles.previewFrame,\n\t\t\t\t\t\t\t\tsandbox: '',\n\t\t\t\t\t\t\t\tsrcdoc: preview.value.html,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: preview.value\n\t\t\t\t\t\t\t? h('pre', { style: styles.previewText }, preview.value.text)\n\t\t\t\t\t\t\t: h('p', { style: styles.meta }, 'Nothing rendered yet.'),\n\t\t\t\t]),\n\t\t\t\t]),\n\t\t\t\trevisions.value.length > 0\n\t\t\t\t\t? h('div', { style: styles.revisions }, [\n\t\t\t\t\t\t\th('h2', { style: styles.subtitle }, 'History'),\n\t\t\t\t\t\t\th('ul', { style: styles.list }, revisions.value.map(renderRevision)),\n\t\t\t\t\t\t])\n\t\t\t\t\t: null,\n\t\t\t]);\n\t\t};\n\t},\n});\n","import type { CSSProperties } from 'vue';\n\nexport const styles: Record<string, CSSProperties> = {\n\tcontainer: { padding: '24px', maxWidth: '1180px' },\n\tsplit: { display: 'flex', gap: '24px', alignItems: 'flex-start', flexWrap: 'wrap' },\n\tcolumn: { flex: '1 1 460px', minWidth: '320px', display: 'flex', flexDirection: 'column' },\n\tpreviewHeader: {\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'space-between',\n\t\talignItems: 'center',\n\t\tmarginTop: '12px',\n\t},\n\tpreviewSubject: { fontSize: '14px', fontWeight: '600', margin: '8px 0' },\n\tpreviewFrame: {\n\t\twidth: '100%',\n\t\theight: '520px',\n\t\tborder: '1px solid #ddd',\n\t\tborderRadius: '8px',\n\t\tbackground: '#fff',\n\t},\n\tpreviewText: {\n\t\twhiteSpace: 'pre-wrap',\n\t\tborder: '1px solid #ddd',\n\t\tborderRadius: '8px',\n\t\tpadding: '12px',\n\t\tfontSize: '13px',\n\t\tfontFamily: 'monospace',\n\t},\n\ttitle: { fontSize: '24px', fontWeight: 700 },\n\tsubtitle: { fontSize: '16px', fontWeight: 600, marginBottom: '8px' },\n\tmeta: { fontSize: '13px', color: '#666', marginBottom: '16px' },\n\tstatus: { padding: '24px', textAlign: 'center', color: '#666' },\n\terror: { color: '#e11d48', marginBottom: '12px', fontSize: '14px' },\n\tlist: { listStyle: 'none', padding: '0', margin: '0' },\n\trow: { borderBottom: '1px solid #eee' },\n\trowButton: {\n\t\twidth: '100%',\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'space-between',\n\t\talignItems: 'center',\n\t\tpadding: '12px 0',\n\t\tbackground: 'none',\n\t\tborder: 'none',\n\t\tcursor: 'pointer',\n\t\ttextAlign: 'left',\n\t},\n\ttype: { fontSize: '14px', fontWeight: 600, flex: '1' },\n\tlocale: { fontSize: '13px', color: '#666', marginRight: '16px' },\n\tactive: { fontSize: '12px', color: '#16a34a' },\n\tinactive: { fontSize: '12px', color: '#999' },\n\tform: { display: 'flex', flexDirection: 'column', gap: '4px' },\n\tlabel: { fontSize: '13px', fontWeight: 600, marginTop: '12px' },\n\tinput: { border: '1px solid #ddd', borderRadius: '8px', padding: '10px', fontSize: '14px' },\n\ttextarea: {\n\t\tborder: '1px solid #ddd',\n\t\tborderRadius: '8px',\n\t\tpadding: '10px',\n\t\tfontSize: '14px',\n\t\tfontFamily: 'monospace',\n\t},\n\tcheckboxLabel: {\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tgap: '8px',\n\t\tmarginTop: '12px',\n\t\tfontSize: '14px',\n\t},\n\tbutton: {\n\t\tmarginTop: '16px',\n\t\tbackgroundColor: '#000',\n\t\tcolor: '#fff',\n\t\tpadding: '10px 20px',\n\t\tborderRadius: '8px',\n\t\tborder: 'none',\n\t\tfontSize: '14px',\n\t\tfontWeight: 600,\n\t\tcursor: 'pointer',\n\t\talignSelf: 'flex-start',\n\t},\n\trevisions: { marginTop: '32px' },\n\trevisionRow: {\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'space-between',\n\t\talignItems: 'center',\n\t\tpadding: '8px 0',\n\t\tborderBottom: '1px solid #eee',\n\t\tfontSize: '13px',\n\t},\n\trollbackButton: {\n\t\tbackground: 'none',\n\t\tborder: '1px solid #ddd',\n\t\tborderRadius: '8px',\n\t\tpadding: '4px 10px',\n\t\tfontSize: '12px',\n\t\tcursor: 'pointer',\n\t},\n};\n","import type { CourierAdminClient, ITemplateEntry } from '@fonderie/client';\nimport { useTemplates } from '@fonderie/vue-courier-admin';\nimport type { PropType } from 'vue';\nimport { defineComponent, h } from 'vue';\nimport { styles } from '../styles';\n\nexport const TemplateListScreen = defineComponent({\n\tname: 'FonderieTemplateListScreen',\n\tprops: {\n\t\tclient: { type: Object as PropType<CourierAdminClient>, required: true },\n\t},\n\temits: {\n\t\t'select-template': (_template: ITemplateEntry) => true,\n\t},\n\tsetup(props, { emit }) {\n\t\tconst { templates, isLoading, error } = useTemplates(props.client);\n\n\t\tfunction renderRow(template: ITemplateEntry) {\n\t\t\treturn h('li', { key: `${template.type}:${template.locale ?? 'base'}`, style: styles.row }, [\n\t\t\t\th(\n\t\t\t\t\t'button',\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'button',\n\t\t\t\t\t\tstyle: styles.rowButton,\n\t\t\t\t\t\tonClick: () => emit('select-template', template),\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\th('span', { style: styles.type }, template.type),\n\t\t\t\t\t\th('span', { style: styles.locale }, template.locale ?? 'base'),\n\t\t\t\t\t\th(\n\t\t\t\t\t\t\t'span',\n\t\t\t\t\t\t\t{ style: template.active ? styles.active : styles.inactive },\n\t\t\t\t\t\t\ttemplate.active ? 'Active' : 'Inactive',\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t),\n\t\t\t]);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (isLoading.value) return h('p', { style: styles.status }, 'Loading templates…');\n\t\t\tif (error.value)\n\t\t\t\treturn h('p', { style: styles.error, role: 'alert' }, error.value.explanation);\n\n\t\t\treturn h('div', { style: styles.container }, [\n\t\t\t\th('h1', { style: styles.title }, 'Templates'),\n\t\t\t\th('ul', { style: styles.list }, templates.value.map(renderRow)),\n\t\t\t]);\n\t\t};\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,+BAKO;AAEP,iBAA+C;;;ACXxC,IAAM,SAAwC;AAAA,EACpD,WAAW,EAAE,SAAS,QAAQ,UAAU,SAAS;AAAA,EACjD,OAAO,EAAE,SAAS,QAAQ,KAAK,QAAQ,YAAY,cAAc,UAAU,OAAO;AAAA,EAClF,QAAQ,EAAE,MAAM,aAAa,UAAU,SAAS,SAAS,QAAQ,eAAe,SAAS;AAAA,EACzF,eAAe;AAAA,IACd,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,WAAW;AAAA,EACZ;AAAA,EACA,gBAAgB,EAAE,UAAU,QAAQ,YAAY,OAAO,QAAQ,QAAQ;AAAA,EACvE,cAAc;AAAA,IACb,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,YAAY;AAAA,EACb;AAAA,EACA,aAAa;AAAA,IACZ,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,EACb;AAAA,EACA,OAAO,EAAE,UAAU,QAAQ,YAAY,IAAI;AAAA,EAC3C,UAAU,EAAE,UAAU,QAAQ,YAAY,KAAK,cAAc,MAAM;AAAA,EACnE,MAAM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MAAM,MAAM;AAEjE,aAAS,UAAU,UAA0B;AAC5C,iBAAO,eAAE,MAAM,EAAE,KAAK,GAAG,SAAS,IAAI,IAAI,SAAS,UAAU,MAAM,IAAI,OAAO,OAAO,IAAI,GAAG;AAAA,YAC3F;AAAA,UACC;AAAA,UACA;AAAA,YACC,MAAM;AAAA,YACN,OAAO,OAAO;AAAA,YACd,SAAS,MAAM,KAAK,mBAAmB,QAAQ;AAAA,UAChD;AAAA,UACA;AAAA,gBACC,eAAE,QAAQ,EAAE,OAAO,OAAO,KAAK,GAAG,SAAS,IAAI;AAAA,gBAC/C,eAAE,QAAQ,EAAE,OAAO,OAAO,OAAO,GAAG,SAAS,UAAU,MAAM;AAAA,gBAC7D;AAAA,cACC;AAAA,cACA,EAAE,OAAO,SAAS,SAAS,OAAO,SAAS,OAAO,SAAS;AAAA,cAC3D,SAAS,SAAS,WAAW;AAAA,YAC9B;AAAA,UACD;AAAA,QACD;AAAA,MACD,CAAC;AAAA,IACF;AAEA,WAAO,MAAM;AACZ,UAAI,UAAU,MAAO,YAAO,eAAE,KAAK,EAAE,OAAO,OAAO,OAAO,GAAG,yBAAoB;AACjF,UAAI,MAAM;AACT,mBAAO,eAAE,KAAK,EAAE,OAAO,OAAO,OAAO,MAAM,QAAQ,GAAG,MAAM,MAAM,WAAW;AAE9E,iBAAO,eAAE,OAAO,EAAE,OAAO,OAAO,UAAU,GAAG;AAAA,YAC5C,eAAE,MAAM,EAAE,OAAO,OAAO,MAAM,GAAG,WAAW;AAAA,YAC5C,eAAE,MAAM,EAAE,OAAO,OAAO,KAAK,GAAG,UAAU,MAAM,IAAI,SAAS,CAAC;AAAA,MAC/D,CAAC;AAAA,IACF;AAAA,EACD;AACD,CAAC;","names":["import_vue_courier_admin","import_vue"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/screens/TemplateEditorScreen.ts","../src/styles.ts","../src/screens/TemplateListScreen.ts"],"sourcesContent":["export { TemplateEditorScreen, TemplateListScreen } from './screens';\n","import type {\n\tCourierAdminClient,\n\tFonderieApiError,\n\tISetTemplateInput,\n\tITemplateRevision,\n} from '@fonderie/client';\nimport {\n\tuseTemplate,\n\tuseTemplatePreview,\n\tuseTemplateRevisions,\n\tuseTemplates,\n} from '@fonderie/vue-courier-admin';\nimport type { PropType } from 'vue';\nimport { defineComponent, h, ref, watch } from 'vue';\nimport { styles } from '../styles';\n\n// Implicit variables the layout injects — an operator never supplies these, so\n// offering them as fields would just be noise.\nconst IMPLICIT = new Set(['subject', 'preheader', 'brandName']);\n\nexport const TemplateEditorScreen = defineComponent({\n\tname: 'FonderieTemplateEditorScreen',\n\tprops: {\n\t\tclient: { type: Object as PropType<CourierAdminClient>, required: true },\n\t\ttype: { type: String, required: true },\n\t\tlocale: { type: String as PropType<string | null>, default: null },\n\t},\n\temits: {\n\t\tsaved: () => true,\n\t},\n\tsetup(props, { emit }) {\n\t\tconst { template, isLoading, error, refresh } = useTemplate(\n\t\t\tprops.client,\n\t\t\tprops.type,\n\t\t\tprops.locale,\n\t\t);\n\t\t// Saves go through the list composable (which re-fetches the template list\n\t\t// after each write); mounting it adds a template-list fetch to this\n\t\t// single-template editor — acceptable for an admin dashboard. Its\n\t\t// isLoading/error track that list fetch, so the save action keeps local state.\n\t\tconst { saveTemplate } = useTemplates(props.client);\n\t\tconst { revisions, rollback } = useTemplateRevisions(props.client, props.type, props.locale);\n\t\tconst isSaving = ref(false);\n\t\tconst saveError = ref<FonderieApiError | null>(null);\n\n\t\tconst subject = ref('');\n\t\tconst html = ref('');\n\t\tconst text = ref('');\n\t\tconst active = ref(true);\n\n\t\twatch(template, (tpl) => {\n\t\t\tif (!tpl) return;\n\t\t\tsubject.value = tpl.subject ?? '';\n\t\t\thtml.value = tpl.html ?? '';\n\t\t\ttext.value = tpl.text;\n\t\t\tactive.value = tpl.active;\n\t\t});\n\n\t\tconst {\n\t\t\tpreview,\n\t\t\tisPreviewing,\n\t\t\terror: previewError,\n\t\t\trenderPreview,\n\t\t} = useTemplatePreview(props.client);\n\t\t// Sample values as JSON text rather than an object, so a half-typed value\n\t\t// does not have to parse on every keystroke.\n\t\tconst sampleJson = ref('{}');\n\t\tconst sampleError = ref<string | null>(null);\n\n\t\tasync function run() {\n\t\t\tlet data: Record<string, unknown> = {};\n\t\t\ttry {\n\t\t\t\tconst parsed: unknown = JSON.parse(sampleJson.value || '{}');\n\t\t\t\tif (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n\t\t\t\t\tsampleError.value = 'Sample data must be a JSON object.';\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tdata = parsed as Record<string, unknown>;\n\t\t\t\tsampleError.value = null;\n\t\t\t} catch {\n\t\t\t\tsampleError.value = 'Sample data is not valid JSON.';\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst result = await renderPreview(\n\t\t\t\tprops.type,\n\t\t\t\t{\n\t\t\t\t\ttext: text.value,\n\t\t\t\t\tdata,\n\t\t\t\t\t...(subject.value ? { subject: subject.value } : {}),\n\t\t\t\t\t...(html.value ? { html: html.value } : {}),\n\t\t\t\t},\n\t\t\t\tprops.locale,\n\t\t\t);\n\t\t\t// The server reports which variables this content uses; seed the ones\n\t\t\t// with no value yet with their own name so the render shows where each\n\t\t\t// lands. Never overwrite something already typed.\n\t\t\tconst missing = result.variables.filter((v) => !IMPLICIT.has(v) && !(v in data));\n\t\t\tif (missing.length > 0) {\n\t\t\t\tsampleJson.value = JSON.stringify(\n\t\t\t\t\t{ ...data, ...Object.fromEntries(missing.map((v) => [v, v])) },\n\t\t\t\t\tnull,\n\t\t\t\t\t2,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// One render once the template has loaded, so the pane is never empty on\n\t\t// arrival. After that it is explicit — a request per keystroke is not a\n\t\t// preview, it is a load test.\n\t\twatch(template, (tpl) => {\n\t\t\tif (tpl) void run();\n\t\t});\n\n\t\tasync function handleSubmit(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tisSaving.value = true;\n\t\t\tsaveError.value = null;\n\t\t\ttry {\n\t\t\t\tconst input: ISetTemplateInput = { text: text.value, active: active.value };\n\t\t\t\tif (subject.value) input.subject = subject.value;\n\t\t\t\tif (html.value) input.html = html.value;\n\t\t\t\tif (template.value?.version !== undefined) input.ifVersion = template.value.version;\n\t\t\t\tawait saveTemplate(props.type, input, props.locale);\n\t\t\t\t// The list composable refreshes its own list; this screen renders the\n\t\t\t\t// single template, so re-read it too.\n\t\t\t\tawait refresh();\n\t\t\t\temit('saved');\n\t\t\t} catch (err) {\n\t\t\t\t// useTemplates normalizes every failure to FonderieApiError before throwing.\n\t\t\t\tsaveError.value = err as FonderieApiError;\n\t\t\t} finally {\n\t\t\t\tisSaving.value = false;\n\t\t\t}\n\t\t}\n\n\t\tfunction renderRevision(rev: ITemplateRevision) {\n\t\t\treturn h('li', { key: rev.version, style: styles.revisionRow }, [\n\t\t\t\th(\n\t\t\t\t\t'span',\n\t\t\t\t\t`v${rev.version} — ${rev.actor ?? 'unknown'} — ${new Date(rev.createdAt).toLocaleString()}`,\n\t\t\t\t),\n\t\t\t\th(\n\t\t\t\t\t'button',\n\t\t\t\t\t{ type: 'button', style: styles.rollbackButton, onClick: () => rollback(rev.version) },\n\t\t\t\t\t'Roll back',\n\t\t\t\t),\n\t\t\t]);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (isLoading.value) return h('p', { style: styles.status }, 'Loading template…');\n\t\t\tif (error.value)\n\t\t\t\treturn h('p', { style: styles.error, role: 'alert' }, error.value.explanation);\n\n\t\t\treturn h('div', { style: styles.container }, [\n\t\t\t\th('h1', { style: styles.title }, props.type),\n\t\t\t\th(\n\t\t\t\t\t'p',\n\t\t\t\t\t{ style: styles.meta },\n\t\t\t\t\t`${props.locale ?? 'base'} · v${template.value?.version ?? 1}`,\n\t\t\t\t),\n\t\t\t\th('div', { style: styles.split }, [\n\t\t\t\th('div', { style: styles.column }, [\n\t\t\t\th('form', { style: styles.form, onSubmit: handleSubmit }, [\n\t\t\t\t\th('label', { style: styles.label, for: 'template-subject' }, 'Subject'),\n\t\t\t\t\th('input', {\n\t\t\t\t\t\tid: 'template-subject',\n\t\t\t\t\t\tstyle: styles.input,\n\t\t\t\t\t\tvalue: subject.value,\n\t\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\t\tsubject.value = (e.target as HTMLInputElement).value;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\th('label', { style: styles.label, for: 'template-html' }, 'HTML body'),\n\t\t\t\t\th('textarea', {\n\t\t\t\t\t\tid: 'template-html',\n\t\t\t\t\t\tstyle: styles.textarea,\n\t\t\t\t\t\trows: 8,\n\t\t\t\t\t\tvalue: html.value,\n\t\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\t\thtml.value = (e.target as HTMLTextAreaElement).value;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\th('label', { style: styles.label, for: 'template-text' }, 'Plain-text body'),\n\t\t\t\t\th('textarea', {\n\t\t\t\t\t\tid: 'template-text',\n\t\t\t\t\t\tstyle: styles.textarea,\n\t\t\t\t\t\trows: 4,\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tvalue: text.value,\n\t\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\t\ttext.value = (e.target as HTMLTextAreaElement).value;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\th('label', { style: styles.checkboxLabel }, [\n\t\t\t\t\t\th('input', {\n\t\t\t\t\t\t\ttype: 'checkbox',\n\t\t\t\t\t\t\tchecked: active.value,\n\t\t\t\t\t\t\tonChange: (e: Event) => {\n\t\t\t\t\t\t\t\tactive.value = (e.target as HTMLInputElement).checked;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t'Active',\n\t\t\t\t\t]),\n\t\t\t\t\tsaveError.value\n\t\t\t\t\t\t? h('p', { style: styles.error, role: 'alert' }, saveError.value.explanation)\n\t\t\t\t\t\t: null,\n\t\t\t\t\th(\n\t\t\t\t\t\t'button',\n\t\t\t\t\t\t{ type: 'submit', disabled: isSaving.value, style: styles.button },\n\t\t\t\t\t\tisSaving.value ? 'Saving…' : 'Save',\n\t\t\t\t\t),\n\t\t\t\t]),\n\t\t\t\th('label', { style: styles.label, for: 'template-sample' }, 'Sample data'),\n\t\t\t\th('textarea', {\n\t\t\t\t\tid: 'template-sample',\n\t\t\t\t\tstyle: styles.textarea,\n\t\t\t\t\trows: 6,\n\t\t\t\t\tspellcheck: false,\n\t\t\t\t\tvalue: sampleJson.value,\n\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\tsampleJson.value = (e.target as HTMLTextAreaElement).value;\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\tsampleError.value\n\t\t\t\t\t? h('p', { style: styles.error, role: 'alert' }, sampleError.value)\n\t\t\t\t\t: null,\n\t\t\t\t]),\n\t\t\t\th('div', { style: styles.column }, [\n\t\t\t\t\th('div', { style: styles.previewHeader }, [\n\t\t\t\t\t\th('span', { style: styles.label }, 'Preview'),\n\t\t\t\t\t\th(\n\t\t\t\t\t\t\t'button',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'button',\n\t\t\t\t\t\t\t\tstyle: styles.rollbackButton,\n\t\t\t\t\t\t\t\tdisabled: isPreviewing.value,\n\t\t\t\t\t\t\t\tonClick: () => void run(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisPreviewing.value ? 'Rendering…' : 'Render',\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t\tpreviewError.value\n\t\t\t\t\t\t? h('p', { style: styles.error, role: 'alert' }, previewError.value.explanation)\n\t\t\t\t\t\t: null,\n\t\t\t\t\tpreview.value?.subject\n\t\t\t\t\t\t? h('p', { style: styles.previewSubject }, preview.value.subject)\n\t\t\t\t\t\t: null,\n\t\t\t\t\tpreview.value?.html\n\t\t\t\t\t\t? // sandbox= — no scripts, no same-origin. Operator-authored HTML\n\t\t\t\t\t\t\t// must never execute in the dashboard's origin, where the admin\n\t\t\t\t\t\t\t// token lives.\n\t\t\t\t\t\t\th('iframe', {\n\t\t\t\t\t\t\t\ttitle: 'Template preview',\n\t\t\t\t\t\t\t\tstyle: styles.previewFrame,\n\t\t\t\t\t\t\t\tsandbox: '',\n\t\t\t\t\t\t\t\tsrcdoc: preview.value.html,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: preview.value\n\t\t\t\t\t\t\t? h('pre', { style: styles.previewText }, preview.value.text)\n\t\t\t\t\t\t\t: h('p', { style: styles.meta }, 'Nothing rendered yet.'),\n\t\t\t\t]),\n\t\t\t\t]),\n\t\t\t\trevisions.value.length > 0\n\t\t\t\t\t? h('div', { style: styles.revisions }, [\n\t\t\t\t\t\t\th('h2', { style: styles.subtitle }, 'History'),\n\t\t\t\t\t\t\th('ul', { style: styles.list }, revisions.value.map(renderRevision)),\n\t\t\t\t\t\t])\n\t\t\t\t\t: null,\n\t\t\t]);\n\t\t};\n\t},\n});\n","import type { CSSProperties } from 'vue';\n\nexport const styles: Record<string, CSSProperties> = {\n\tcontainer: { padding: '24px', maxWidth: '1180px' },\n\tsplit: { display: 'flex', gap: '24px', alignItems: 'flex-start', flexWrap: 'wrap' },\n\tcolumn: { flex: '1 1 460px', minWidth: '320px', display: 'flex', flexDirection: 'column' },\n\tpreviewHeader: {\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'space-between',\n\t\talignItems: 'center',\n\t\tmarginTop: '12px',\n\t},\n\tpreviewSubject: { fontSize: '14px', fontWeight: '600', margin: '8px 0' },\n\tpreviewFrame: {\n\t\twidth: '100%',\n\t\theight: '520px',\n\t\tborder: '1px solid var(--fonderie-border,#e0e0e0)',\n\t\tborderRadius: '8px',\n\t\tbackground: 'var(--fonderie-surface,#fff)',\n\t},\n\tpreviewText: {\n\t\twhiteSpace: 'pre-wrap',\n\t\tborder: '1px solid var(--fonderie-border,#e0e0e0)',\n\t\tborderRadius: '8px',\n\t\tpadding: '12px',\n\t\tfontSize: '13px',\n\t\tfontFamily: 'var(--fonderie-mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace)',\n\t},\n\ttitle: { fontSize: '24px', fontWeight: 700 },\n\tsubtitle: { fontSize: '16px', fontWeight: 600, marginBottom: '8px' },\n\tmeta: { fontSize: '13px', color: 'var(--fonderie-text-muted,#5c5c5c)', marginBottom: '16px' },\n\tstatus: { padding: '24px', textAlign: 'center', color: 'var(--fonderie-text-muted,#5c5c5c)' },\n\terror: { color: 'var(--fonderie-danger,#e00)', marginBottom: '12px', fontSize: '14px' },\n\tlist: { listStyle: 'none', padding: '0', margin: '0' },\n\trow: { borderBottom: '1px solid var(--fonderie-border-light,#f5f5f5)' },\n\trowButton: {\n\t\twidth: '100%',\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'space-between',\n\t\talignItems: 'center',\n\t\tpadding: '12px 0',\n\t\tbackground: 'none',\n\t\tborder: 'none',\n\t\tcursor: 'pointer',\n\t\ttextAlign: 'left',\n\t},\n\ttype: { fontSize: '14px', fontWeight: 600, flex: '1' },\n\tlocale: { fontSize: '13px', color: 'var(--fonderie-text-muted,#5c5c5c)', marginRight: '16px' },\n\tactive: { fontSize: '12px', color: 'var(--fonderie-accent-strong,#009767)' },\n\tinactive: { fontSize: '12px', color: 'var(--fonderie-text-muted,#5c5c5c)' },\n\tform: { display: 'flex', flexDirection: 'column', gap: '4px' },\n\tlabel: { fontSize: '13px', fontWeight: 600, marginTop: '12px' },\n\tinput: { border: '1px solid var(--fonderie-border,#e0e0e0)', borderRadius: '8px', padding: '10px', fontSize: '14px' },\n\ttextarea: {\n\t\tborder: '1px solid var(--fonderie-border,#e0e0e0)',\n\t\tborderRadius: '8px',\n\t\tpadding: '10px',\n\t\tfontSize: '14px',\n\t\tfontFamily: 'var(--fonderie-mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace)',\n\t},\n\tcheckboxLabel: {\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tgap: '8px',\n\t\tmarginTop: '12px',\n\t\tfontSize: '14px',\n\t},\n\tbutton: {\n\t\tmarginTop: '16px',\n\t\tbackgroundColor: 'var(--fonderie-text,#171717)',\n\t\tcolor: 'var(--fonderie-surface,#fff)',\n\t\tpadding: '10px 20px',\n\t\tborderRadius: '8px',\n\t\tborder: 'none',\n\t\tfontSize: '14px',\n\t\tfontWeight: 600,\n\t\tcursor: 'pointer',\n\t\talignSelf: 'flex-start',\n\t},\n\trevisions: { marginTop: '32px' },\n\trevisionRow: {\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'space-between',\n\t\talignItems: 'center',\n\t\tpadding: '8px 0',\n\t\tborderBottom: '1px solid var(--fonderie-border-light,#f5f5f5)',\n\t\tfontSize: '13px',\n\t},\n\trollbackButton: {\n\t\tbackground: 'none',\n\t\tborder: '1px solid var(--fonderie-border,#e0e0e0)',\n\t\tborderRadius: '8px',\n\t\tpadding: '4px 10px',\n\t\tfontSize: '12px',\n\t\tcursor: 'pointer',\n\t},\n};\n","import type { CourierAdminClient, ITemplateEntry } from '@fonderie/client';\nimport { useTemplates } from '@fonderie/vue-courier-admin';\nimport type { PropType } from 'vue';\nimport { defineComponent, h } from 'vue';\nimport { styles } from '../styles';\n\nexport const TemplateListScreen = defineComponent({\n\tname: 'FonderieTemplateListScreen',\n\tprops: {\n\t\tclient: { type: Object as PropType<CourierAdminClient>, required: true },\n\t},\n\temits: {\n\t\t'select-template': (_template: ITemplateEntry) => true,\n\t},\n\tsetup(props, { emit }) {\n\t\tconst { templates, isLoading, error } = useTemplates(props.client);\n\n\t\tfunction renderRow(template: ITemplateEntry) {\n\t\t\treturn h('li', { key: `${template.type}:${template.locale ?? 'base'}`, style: styles.row }, [\n\t\t\t\th(\n\t\t\t\t\t'button',\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'button',\n\t\t\t\t\t\tstyle: styles.rowButton,\n\t\t\t\t\t\tonClick: () => emit('select-template', template),\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\th('span', { style: styles.type }, template.type),\n\t\t\t\t\t\th('span', { style: styles.locale }, template.locale ?? 'base'),\n\t\t\t\t\t\th(\n\t\t\t\t\t\t\t'span',\n\t\t\t\t\t\t\t{ style: template.active ? styles.active : styles.inactive },\n\t\t\t\t\t\t\ttemplate.active ? 'Active' : 'Inactive',\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t),\n\t\t\t]);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (isLoading.value) return h('p', { style: styles.status }, 'Loading templates…');\n\t\t\tif (error.value)\n\t\t\t\treturn h('p', { style: styles.error, role: 'alert' }, error.value.explanation);\n\n\t\t\treturn h('div', { style: styles.container }, [\n\t\t\t\th('h1', { style: styles.title }, 'Templates'),\n\t\t\t\th('ul', { style: styles.list }, templates.value.map(renderRow)),\n\t\t\t]);\n\t\t};\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,+BAKO;AAEP,iBAA+C;;;ACXxC,IAAM,SAAwC;AAAA,EACpD,WAAW,EAAE,SAAS,QAAQ,UAAU,SAAS;AAAA,EACjD,OAAO,EAAE,SAAS,QAAQ,KAAK,QAAQ,YAAY,cAAc,UAAU,OAAO;AAAA,EAClF,QAAQ,EAAE,MAAM,aAAa,UAAU,SAAS,SAAS,QAAQ,eAAe,SAAS;AAAA,EACzF,eAAe;AAAA,IACd,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,WAAW;AAAA,EACZ;AAAA,EACA,gBAAgB,EAAE,UAAU,QAAQ,YAAY,OAAO,QAAQ,QAAQ;AAAA,EACvE,cAAc;AAAA,IACb,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,YAAY;AAAA,EACb;AAAA,E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,OAAO,KAAK,GAAG,UAAU,MAAM,IAAI,SAAS,CAAC;AAAA,MAC/D,CAAC;AAAA,IACF;AAAA,EACD;AACD,CAAC;","names":["import_vue_courier_admin","import_vue"]}
package/dist/index.js CHANGED
@@ -22,25 +22,25 @@ var styles = {
22
22
  previewFrame: {
23
23
  width: "100%",
24
24
  height: "520px",
25
- border: "1px solid #ddd",
25
+ border: "1px solid var(--fonderie-border,#e0e0e0)",
26
26
  borderRadius: "8px",
27
- background: "#fff"
27
+ background: "var(--fonderie-surface,#fff)"
28
28
  },
29
29
  previewText: {
30
30
  whiteSpace: "pre-wrap",
31
- border: "1px solid #ddd",
31
+ border: "1px solid var(--fonderie-border,#e0e0e0)",
32
32
  borderRadius: "8px",
33
33
  padding: "12px",
34
34
  fontSize: "13px",
35
- fontFamily: "monospace"
35
+ fontFamily: 'var(--fonderie-mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace)'
36
36
  },
37
37
  title: { fontSize: "24px", fontWeight: 700 },
38
38
  subtitle: { fontSize: "16px", fontWeight: 600, marginBottom: "8px" },
39
- meta: { fontSize: "13px", color: "#666", marginBottom: "16px" },
40
- status: { padding: "24px", textAlign: "center", color: "#666" },
41
- error: { color: "#e11d48", marginBottom: "12px", fontSize: "14px" },
39
+ meta: { fontSize: "13px", color: "var(--fonderie-text-muted,#5c5c5c)", marginBottom: "16px" },
40
+ status: { padding: "24px", textAlign: "center", color: "var(--fonderie-text-muted,#5c5c5c)" },
41
+ error: { color: "var(--fonderie-danger,#e00)", marginBottom: "12px", fontSize: "14px" },
42
42
  list: { listStyle: "none", padding: "0", margin: "0" },
43
- row: { borderBottom: "1px solid #eee" },
43
+ row: { borderBottom: "1px solid var(--fonderie-border-light,#f5f5f5)" },
44
44
  rowButton: {
45
45
  width: "100%",
46
46
  display: "flex",
@@ -53,18 +53,18 @@ var styles = {
53
53
  textAlign: "left"
54
54
  },
55
55
  type: { fontSize: "14px", fontWeight: 600, flex: "1" },
56
- locale: { fontSize: "13px", color: "#666", marginRight: "16px" },
57
- active: { fontSize: "12px", color: "#16a34a" },
58
- inactive: { fontSize: "12px", color: "#999" },
56
+ locale: { fontSize: "13px", color: "var(--fonderie-text-muted,#5c5c5c)", marginRight: "16px" },
57
+ active: { fontSize: "12px", color: "var(--fonderie-accent-strong,#009767)" },
58
+ inactive: { fontSize: "12px", color: "var(--fonderie-text-muted,#5c5c5c)" },
59
59
  form: { display: "flex", flexDirection: "column", gap: "4px" },
60
60
  label: { fontSize: "13px", fontWeight: 600, marginTop: "12px" },
61
- input: { border: "1px solid #ddd", borderRadius: "8px", padding: "10px", fontSize: "14px" },
61
+ input: { border: "1px solid var(--fonderie-border,#e0e0e0)", borderRadius: "8px", padding: "10px", fontSize: "14px" },
62
62
  textarea: {
63
- border: "1px solid #ddd",
63
+ border: "1px solid var(--fonderie-border,#e0e0e0)",
64
64
  borderRadius: "8px",
65
65
  padding: "10px",
66
66
  fontSize: "14px",
67
- fontFamily: "monospace"
67
+ fontFamily: 'var(--fonderie-mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace)'
68
68
  },
69
69
  checkboxLabel: {
70
70
  display: "flex",
@@ -75,8 +75,8 @@ var styles = {
75
75
  },
76
76
  button: {
77
77
  marginTop: "16px",
78
- backgroundColor: "#000",
79
- color: "#fff",
78
+ backgroundColor: "var(--fonderie-text,#171717)",
79
+ color: "var(--fonderie-surface,#fff)",
80
80
  padding: "10px 20px",
81
81
  borderRadius: "8px",
82
82
  border: "none",
@@ -91,12 +91,12 @@ var styles = {
91
91
  justifyContent: "space-between",
92
92
  alignItems: "center",
93
93
  padding: "8px 0",
94
- borderBottom: "1px solid #eee",
94
+ borderBottom: "1px solid var(--fonderie-border-light,#f5f5f5)",
95
95
  fontSize: "13px"
96
96
  },
97
97
  rollbackButton: {
98
98
  background: "none",
99
- border: "1px solid #ddd",
99
+ border: "1px solid var(--fonderie-border,#e0e0e0)",
100
100
  borderRadius: "8px",
101
101
  padding: "4px 10px",
102
102
  fontSize: "12px",
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/screens/TemplateEditorScreen.ts","../src/styles.ts","../src/screens/TemplateListScreen.ts"],"sourcesContent":["import type {\n\tCourierAdminClient,\n\tFonderieApiError,\n\tISetTemplateInput,\n\tITemplateRevision,\n} from '@fonderie/client';\nimport {\n\tuseTemplate,\n\tuseTemplatePreview,\n\tuseTemplateRevisions,\n\tuseTemplates,\n} from '@fonderie/vue-courier-admin';\nimport type { PropType } from 'vue';\nimport { defineComponent, h, ref, watch } from 'vue';\nimport { styles } from '../styles';\n\n// Implicit variables the layout injects — an operator never supplies these, so\n// offering them as fields would just be noise.\nconst IMPLICIT = new Set(['subject', 'preheader', 'brandName']);\n\nexport const TemplateEditorScreen = defineComponent({\n\tname: 'FonderieTemplateEditorScreen',\n\tprops: {\n\t\tclient: { type: Object as PropType<CourierAdminClient>, required: true },\n\t\ttype: { type: String, required: true },\n\t\tlocale: { type: String as PropType<string | null>, default: null },\n\t},\n\temits: {\n\t\tsaved: () => true,\n\t},\n\tsetup(props, { emit }) {\n\t\tconst { template, isLoading, error, refresh } = useTemplate(\n\t\t\tprops.client,\n\t\t\tprops.type,\n\t\t\tprops.locale,\n\t\t);\n\t\t// Saves go through the list composable (which re-fetches the template list\n\t\t// after each write); mounting it adds a template-list fetch to this\n\t\t// single-template editor — acceptable for an admin dashboard. Its\n\t\t// isLoading/error track that list fetch, so the save action keeps local state.\n\t\tconst { saveTemplate } = useTemplates(props.client);\n\t\tconst { revisions, rollback } = useTemplateRevisions(props.client, props.type, props.locale);\n\t\tconst isSaving = ref(false);\n\t\tconst saveError = ref<FonderieApiError | null>(null);\n\n\t\tconst subject = ref('');\n\t\tconst html = ref('');\n\t\tconst text = ref('');\n\t\tconst active = ref(true);\n\n\t\twatch(template, (tpl) => {\n\t\t\tif (!tpl) return;\n\t\t\tsubject.value = tpl.subject ?? '';\n\t\t\thtml.value = tpl.html ?? '';\n\t\t\ttext.value = tpl.text;\n\t\t\tactive.value = tpl.active;\n\t\t});\n\n\t\tconst {\n\t\t\tpreview,\n\t\t\tisPreviewing,\n\t\t\terror: previewError,\n\t\t\trenderPreview,\n\t\t} = useTemplatePreview(props.client);\n\t\t// Sample values as JSON text rather than an object, so a half-typed value\n\t\t// does not have to parse on every keystroke.\n\t\tconst sampleJson = ref('{}');\n\t\tconst sampleError = ref<string | null>(null);\n\n\t\tasync function run() {\n\t\t\tlet data: Record<string, unknown> = {};\n\t\t\ttry {\n\t\t\t\tconst parsed: unknown = JSON.parse(sampleJson.value || '{}');\n\t\t\t\tif (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n\t\t\t\t\tsampleError.value = 'Sample data must be a JSON object.';\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tdata = parsed as Record<string, unknown>;\n\t\t\t\tsampleError.value = null;\n\t\t\t} catch {\n\t\t\t\tsampleError.value = 'Sample data is not valid JSON.';\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst result = await renderPreview(\n\t\t\t\tprops.type,\n\t\t\t\t{\n\t\t\t\t\ttext: text.value,\n\t\t\t\t\tdata,\n\t\t\t\t\t...(subject.value ? { subject: subject.value } : {}),\n\t\t\t\t\t...(html.value ? { html: html.value } : {}),\n\t\t\t\t},\n\t\t\t\tprops.locale,\n\t\t\t);\n\t\t\t// The server reports which variables this content uses; seed the ones\n\t\t\t// with no value yet with their own name so the render shows where each\n\t\t\t// lands. Never overwrite something already typed.\n\t\t\tconst missing = result.variables.filter((v) => !IMPLICIT.has(v) && !(v in data));\n\t\t\tif (missing.length > 0) {\n\t\t\t\tsampleJson.value = JSON.stringify(\n\t\t\t\t\t{ ...data, ...Object.fromEntries(missing.map((v) => [v, v])) },\n\t\t\t\t\tnull,\n\t\t\t\t\t2,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// One render once the template has loaded, so the pane is never empty on\n\t\t// arrival. After that it is explicit — a request per keystroke is not a\n\t\t// preview, it is a load test.\n\t\twatch(template, (tpl) => {\n\t\t\tif (tpl) void run();\n\t\t});\n\n\t\tasync function handleSubmit(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tisSaving.value = true;\n\t\t\tsaveError.value = null;\n\t\t\ttry {\n\t\t\t\tconst input: ISetTemplateInput = { text: text.value, active: active.value };\n\t\t\t\tif (subject.value) input.subject = subject.value;\n\t\t\t\tif (html.value) input.html = html.value;\n\t\t\t\tif (template.value?.version !== undefined) input.ifVersion = template.value.version;\n\t\t\t\tawait saveTemplate(props.type, input, props.locale);\n\t\t\t\t// The list composable refreshes its own list; this screen renders the\n\t\t\t\t// single template, so re-read it too.\n\t\t\t\tawait refresh();\n\t\t\t\temit('saved');\n\t\t\t} catch (err) {\n\t\t\t\t// useTemplates normalizes every failure to FonderieApiError before throwing.\n\t\t\t\tsaveError.value = err as FonderieApiError;\n\t\t\t} finally {\n\t\t\t\tisSaving.value = false;\n\t\t\t}\n\t\t}\n\n\t\tfunction renderRevision(rev: ITemplateRevision) {\n\t\t\treturn h('li', { key: rev.version, style: styles.revisionRow }, [\n\t\t\t\th(\n\t\t\t\t\t'span',\n\t\t\t\t\t`v${rev.version} — ${rev.actor ?? 'unknown'} — ${new Date(rev.createdAt).toLocaleString()}`,\n\t\t\t\t),\n\t\t\t\th(\n\t\t\t\t\t'button',\n\t\t\t\t\t{ type: 'button', style: styles.rollbackButton, onClick: () => rollback(rev.version) },\n\t\t\t\t\t'Roll back',\n\t\t\t\t),\n\t\t\t]);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (isLoading.value) return h('p', { style: styles.status }, 'Loading template…');\n\t\t\tif (error.value)\n\t\t\t\treturn h('p', { style: styles.error, role: 'alert' }, error.value.explanation);\n\n\t\t\treturn h('div', { style: styles.container }, [\n\t\t\t\th('h1', { style: styles.title }, props.type),\n\t\t\t\th(\n\t\t\t\t\t'p',\n\t\t\t\t\t{ style: styles.meta },\n\t\t\t\t\t`${props.locale ?? 'base'} · v${template.value?.version ?? 1}`,\n\t\t\t\t),\n\t\t\t\th('div', { style: styles.split }, [\n\t\t\t\th('div', { style: styles.column }, [\n\t\t\t\th('form', { style: styles.form, onSubmit: handleSubmit }, [\n\t\t\t\t\th('label', { style: styles.label, for: 'template-subject' }, 'Subject'),\n\t\t\t\t\th('input', {\n\t\t\t\t\t\tid: 'template-subject',\n\t\t\t\t\t\tstyle: styles.input,\n\t\t\t\t\t\tvalue: subject.value,\n\t\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\t\tsubject.value = (e.target as HTMLInputElement).value;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\th('label', { style: styles.label, for: 'template-html' }, 'HTML body'),\n\t\t\t\t\th('textarea', {\n\t\t\t\t\t\tid: 'template-html',\n\t\t\t\t\t\tstyle: styles.textarea,\n\t\t\t\t\t\trows: 8,\n\t\t\t\t\t\tvalue: html.value,\n\t\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\t\thtml.value = (e.target as HTMLTextAreaElement).value;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\th('label', { style: styles.label, for: 'template-text' }, 'Plain-text body'),\n\t\t\t\t\th('textarea', {\n\t\t\t\t\t\tid: 'template-text',\n\t\t\t\t\t\tstyle: styles.textarea,\n\t\t\t\t\t\trows: 4,\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tvalue: text.value,\n\t\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\t\ttext.value = (e.target as HTMLTextAreaElement).value;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\th('label', { style: styles.checkboxLabel }, [\n\t\t\t\t\t\th('input', {\n\t\t\t\t\t\t\ttype: 'checkbox',\n\t\t\t\t\t\t\tchecked: active.value,\n\t\t\t\t\t\t\tonChange: (e: Event) => {\n\t\t\t\t\t\t\t\tactive.value = (e.target as HTMLInputElement).checked;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t'Active',\n\t\t\t\t\t]),\n\t\t\t\t\tsaveError.value\n\t\t\t\t\t\t? h('p', { style: styles.error, role: 'alert' }, saveError.value.explanation)\n\t\t\t\t\t\t: null,\n\t\t\t\t\th(\n\t\t\t\t\t\t'button',\n\t\t\t\t\t\t{ type: 'submit', disabled: isSaving.value, style: styles.button },\n\t\t\t\t\t\tisSaving.value ? 'Saving…' : 'Save',\n\t\t\t\t\t),\n\t\t\t\t]),\n\t\t\t\th('label', { style: styles.label, for: 'template-sample' }, 'Sample data'),\n\t\t\t\th('textarea', {\n\t\t\t\t\tid: 'template-sample',\n\t\t\t\t\tstyle: styles.textarea,\n\t\t\t\t\trows: 6,\n\t\t\t\t\tspellcheck: false,\n\t\t\t\t\tvalue: sampleJson.value,\n\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\tsampleJson.value = (e.target as HTMLTextAreaElement).value;\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\tsampleError.value\n\t\t\t\t\t? h('p', { style: styles.error, role: 'alert' }, sampleError.value)\n\t\t\t\t\t: null,\n\t\t\t\t]),\n\t\t\t\th('div', { style: styles.column }, [\n\t\t\t\t\th('div', { style: styles.previewHeader }, [\n\t\t\t\t\t\th('span', { style: styles.label }, 'Preview'),\n\t\t\t\t\t\th(\n\t\t\t\t\t\t\t'button',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'button',\n\t\t\t\t\t\t\t\tstyle: styles.rollbackButton,\n\t\t\t\t\t\t\t\tdisabled: isPreviewing.value,\n\t\t\t\t\t\t\t\tonClick: () => void run(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisPreviewing.value ? 'Rendering…' : 'Render',\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t\tpreviewError.value\n\t\t\t\t\t\t? h('p', { style: styles.error, role: 'alert' }, previewError.value.explanation)\n\t\t\t\t\t\t: null,\n\t\t\t\t\tpreview.value?.subject\n\t\t\t\t\t\t? h('p', { style: styles.previewSubject }, preview.value.subject)\n\t\t\t\t\t\t: null,\n\t\t\t\t\tpreview.value?.html\n\t\t\t\t\t\t? // sandbox= — no scripts, no same-origin. Operator-authored HTML\n\t\t\t\t\t\t\t// must never execute in the dashboard's origin, where the admin\n\t\t\t\t\t\t\t// token lives.\n\t\t\t\t\t\t\th('iframe', {\n\t\t\t\t\t\t\t\ttitle: 'Template preview',\n\t\t\t\t\t\t\t\tstyle: styles.previewFrame,\n\t\t\t\t\t\t\t\tsandbox: '',\n\t\t\t\t\t\t\t\tsrcdoc: preview.value.html,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: preview.value\n\t\t\t\t\t\t\t? h('pre', { style: styles.previewText }, preview.value.text)\n\t\t\t\t\t\t\t: h('p', { style: styles.meta }, 'Nothing rendered yet.'),\n\t\t\t\t]),\n\t\t\t\t]),\n\t\t\t\trevisions.value.length > 0\n\t\t\t\t\t? h('div', { style: styles.revisions }, [\n\t\t\t\t\t\t\th('h2', { style: styles.subtitle }, 'History'),\n\t\t\t\t\t\t\th('ul', { style: styles.list }, revisions.value.map(renderRevision)),\n\t\t\t\t\t\t])\n\t\t\t\t\t: null,\n\t\t\t]);\n\t\t};\n\t},\n});\n","import type { CSSProperties } from 'vue';\n\nexport const styles: Record<string, CSSProperties> = {\n\tcontainer: { padding: '24px', maxWidth: '1180px' },\n\tsplit: { display: 'flex', gap: '24px', alignItems: 'flex-start', flexWrap: 'wrap' },\n\tcolumn: { flex: '1 1 460px', minWidth: '320px', display: 'flex', flexDirection: 'column' },\n\tpreviewHeader: {\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'space-between',\n\t\talignItems: 'center',\n\t\tmarginTop: '12px',\n\t},\n\tpreviewSubject: { fontSize: '14px', fontWeight: '600', margin: '8px 0' },\n\tpreviewFrame: {\n\t\twidth: '100%',\n\t\theight: '520px',\n\t\tborder: '1px solid #ddd',\n\t\tborderRadius: '8px',\n\t\tbackground: '#fff',\n\t},\n\tpreviewText: {\n\t\twhiteSpace: 'pre-wrap',\n\t\tborder: '1px solid #ddd',\n\t\tborderRadius: '8px',\n\t\tpadding: '12px',\n\t\tfontSize: '13px',\n\t\tfontFamily: 'monospace',\n\t},\n\ttitle: { fontSize: '24px', fontWeight: 700 },\n\tsubtitle: { fontSize: '16px', fontWeight: 600, marginBottom: '8px' },\n\tmeta: { fontSize: '13px', color: '#666', marginBottom: '16px' },\n\tstatus: { padding: '24px', textAlign: 'center', color: '#666' },\n\terror: { color: '#e11d48', marginBottom: '12px', fontSize: '14px' },\n\tlist: { listStyle: 'none', padding: '0', margin: '0' },\n\trow: { borderBottom: '1px solid #eee' },\n\trowButton: {\n\t\twidth: '100%',\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'space-between',\n\t\talignItems: 'center',\n\t\tpadding: '12px 0',\n\t\tbackground: 'none',\n\t\tborder: 'none',\n\t\tcursor: 'pointer',\n\t\ttextAlign: 'left',\n\t},\n\ttype: { fontSize: '14px', fontWeight: 600, flex: '1' },\n\tlocale: { fontSize: '13px', color: '#666', marginRight: '16px' },\n\tactive: { fontSize: '12px', color: '#16a34a' },\n\tinactive: { fontSize: '12px', color: '#999' },\n\tform: { display: 'flex', flexDirection: 'column', gap: '4px' },\n\tlabel: { fontSize: '13px', fontWeight: 600, marginTop: '12px' },\n\tinput: { border: '1px solid #ddd', borderRadius: '8px', padding: '10px', fontSize: '14px' },\n\ttextarea: {\n\t\tborder: '1px solid #ddd',\n\t\tborderRadius: '8px',\n\t\tpadding: '10px',\n\t\tfontSize: '14px',\n\t\tfontFamily: 'monospace',\n\t},\n\tcheckboxLabel: {\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tgap: '8px',\n\t\tmarginTop: '12px',\n\t\tfontSize: '14px',\n\t},\n\tbutton: {\n\t\tmarginTop: '16px',\n\t\tbackgroundColor: '#000',\n\t\tcolor: '#fff',\n\t\tpadding: '10px 20px',\n\t\tborderRadius: '8px',\n\t\tborder: 'none',\n\t\tfontSize: '14px',\n\t\tfontWeight: 600,\n\t\tcursor: 'pointer',\n\t\talignSelf: 'flex-start',\n\t},\n\trevisions: { marginTop: '32px' },\n\trevisionRow: {\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'space-between',\n\t\talignItems: 'center',\n\t\tpadding: '8px 0',\n\t\tborderBottom: '1px solid #eee',\n\t\tfontSize: '13px',\n\t},\n\trollbackButton: {\n\t\tbackground: 'none',\n\t\tborder: '1px solid #ddd',\n\t\tborderRadius: '8px',\n\t\tpadding: '4px 10px',\n\t\tfontSize: '12px',\n\t\tcursor: 'pointer',\n\t},\n};\n","import type { CourierAdminClient, ITemplateEntry } from '@fonderie/client';\nimport { useTemplates } from '@fonderie/vue-courier-admin';\nimport type { PropType } from 'vue';\nimport { defineComponent, h } from 'vue';\nimport { styles } from '../styles';\n\nexport const TemplateListScreen = defineComponent({\n\tname: 'FonderieTemplateListScreen',\n\tprops: {\n\t\tclient: { type: Object as PropType<CourierAdminClient>, required: true },\n\t},\n\temits: {\n\t\t'select-template': (_template: ITemplateEntry) => true,\n\t},\n\tsetup(props, { emit }) {\n\t\tconst { templates, isLoading, error } = useTemplates(props.client);\n\n\t\tfunction renderRow(template: ITemplateEntry) {\n\t\t\treturn h('li', { key: `${template.type}:${template.locale ?? 'base'}`, style: styles.row }, [\n\t\t\t\th(\n\t\t\t\t\t'button',\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'button',\n\t\t\t\t\t\tstyle: styles.rowButton,\n\t\t\t\t\t\tonClick: () => emit('select-template', template),\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\th('span', { style: styles.type }, template.type),\n\t\t\t\t\t\th('span', { style: styles.locale }, template.locale ?? 'base'),\n\t\t\t\t\t\th(\n\t\t\t\t\t\t\t'span',\n\t\t\t\t\t\t\t{ style: template.active ? styles.active : styles.inactive },\n\t\t\t\t\t\t\ttemplate.active ? 'Active' : 'Inactive',\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t),\n\t\t\t]);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (isLoading.value) return h('p', { style: styles.status }, 'Loading templates…');\n\t\t\tif (error.value)\n\t\t\t\treturn h('p', { style: styles.error, role: 'alert' }, error.value.explanation);\n\n\t\t\treturn h('div', { style: styles.container }, [\n\t\t\t\th('h1', { style: styles.title }, 'Templates'),\n\t\t\t\th('ul', { style: styles.list }, templates.value.map(renderRow)),\n\t\t\t]);\n\t\t};\n\t},\n});\n"],"mappings":";AAMA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,SAAS,iBAAiB,GAAG,KAAK,aAAa;;;ACXxC,IAAM,SAAwC;AAAA,EACpD,WAAW,EAAE,SAAS,QAAQ,UAAU,SAAS;AAAA,EACjD,OAAO,EAAE,SAAS,QAAQ,KAAK,QAAQ,YAAY,cAAc,UAAU,OAAO;AAAA,EAClF,QAAQ,EAAE,MAAM,aAAa,UAAU,SAAS,SAAS,QAAQ,eAAe,SAAS;AAAA,EACzF,eAAe;AAAA,IACd,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,WAAW;AAAA,EACZ;AAAA,EACA,gBAAgB,EAAE,UAAU,QAAQ,YAAY,OAAO,QAAQ,QAAQ;AAAA,EACvE,cAAc;AAAA,IACb,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,YAAY;AAAA,EACb;AAAA,EACA,aAAa;AAAA,IACZ,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,EACb;AAAA,EACA,OAAO,EAAE,UAAU,QAAQ,YAAY,IAAI;AAAA,EAC3C,UAAU,EAAE,UAAU,QAAQ,YAAY,KAAK,cAAc,MAAM;AAAA,EACnE,MAAM,EAAE,UAAU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AAS,UAAU,UAA0B;AAC5C,aAAOC,GAAE,MAAM,EAAE,KAAK,GAAG,SAAS,IAAI,IAAI,SAAS,UAAU,MAAM,IAAI,OAAO,OAAO,IAAI,GAAG;AAAA,QAC3FA;AAAA,UACC;AAAA,UACA;AAAA,YACC,MAAM;AAAA,YACN,OAAO,OAAO;AAAA,YACd,SAAS,MAAM,KAAK,mBAAmB,QAAQ;AAAA,UAChD;AAAA,UACA;AAAA,YACCA,GAAE,QAAQ,EAAE,OAAO,OAAO,KAAK,GAAG,SAAS,IAAI;AAAA,YAC/CA,GAAE,QAAQ,EAAE,OAAO,OAAO,OAAO,GAAG,SAAS,UAAU,MAAM;AAAA,YAC7DA;AAAA,cACC;AAAA,cACA,EAAE,OAAO,SAAS,SAAS,OAAO,SAAS,OAAO,SAAS;AAAA,cAC3D,SAAS,SAAS,WAAW;AAAA,YAC9B;AAAA,UACD;AAAA,QACD;AAAA,MACD,CAAC;AAAA,IACF;AAEA,WAAO,MAAM;AACZ,UAAI,UAAU,MAAO,QAAOA,GAAE,KAAK,EAAE,OAAO,OAAO,OAAO,GAAG,yBAAoB;AACjF,UAAI,MAAM;AACT,eAAOA,GAAE,KAAK,EAAE,OAAO,OAAO,OAAO,MAAM,QAAQ,GAAG,MAAM,MAAM,WAAW;AAE9E,aAAOA,GAAE,OAAO,EAAE,OAAO,OAAO,UAAU,GAAG;AAAA,QAC5CA,GAAE,MAAM,EAAE,OAAO,OAAO,MAAM,GAAG,WAAW;AAAA,QAC5CA,GAAE,MAAM,EAAE,OAAO,OAAO,KAAK,GAAG,UAAU,MAAM,IAAI,SAAS,CAAC;AAAA,MAC/D,CAAC;AAAA,IACF;AAAA,EACD;AACD,CAAC;","names":["useTemplates","defineComponent","h","defineComponent","useTemplates","h"]}
1
+ {"version":3,"sources":["../src/screens/TemplateEditorScreen.ts","../src/styles.ts","../src/screens/TemplateListScreen.ts"],"sourcesContent":["import type {\n\tCourierAdminClient,\n\tFonderieApiError,\n\tISetTemplateInput,\n\tITemplateRevision,\n} from '@fonderie/client';\nimport {\n\tuseTemplate,\n\tuseTemplatePreview,\n\tuseTemplateRevisions,\n\tuseTemplates,\n} from '@fonderie/vue-courier-admin';\nimport type { PropType } from 'vue';\nimport { defineComponent, h, ref, watch } from 'vue';\nimport { styles } from '../styles';\n\n// Implicit variables the layout injects — an operator never supplies these, so\n// offering them as fields would just be noise.\nconst IMPLICIT = new Set(['subject', 'preheader', 'brandName']);\n\nexport const TemplateEditorScreen = defineComponent({\n\tname: 'FonderieTemplateEditorScreen',\n\tprops: {\n\t\tclient: { type: Object as PropType<CourierAdminClient>, required: true },\n\t\ttype: { type: String, required: true },\n\t\tlocale: { type: String as PropType<string | null>, default: null },\n\t},\n\temits: {\n\t\tsaved: () => true,\n\t},\n\tsetup(props, { emit }) {\n\t\tconst { template, isLoading, error, refresh } = useTemplate(\n\t\t\tprops.client,\n\t\t\tprops.type,\n\t\t\tprops.locale,\n\t\t);\n\t\t// Saves go through the list composable (which re-fetches the template list\n\t\t// after each write); mounting it adds a template-list fetch to this\n\t\t// single-template editor — acceptable for an admin dashboard. Its\n\t\t// isLoading/error track that list fetch, so the save action keeps local state.\n\t\tconst { saveTemplate } = useTemplates(props.client);\n\t\tconst { revisions, rollback } = useTemplateRevisions(props.client, props.type, props.locale);\n\t\tconst isSaving = ref(false);\n\t\tconst saveError = ref<FonderieApiError | null>(null);\n\n\t\tconst subject = ref('');\n\t\tconst html = ref('');\n\t\tconst text = ref('');\n\t\tconst active = ref(true);\n\n\t\twatch(template, (tpl) => {\n\t\t\tif (!tpl) return;\n\t\t\tsubject.value = tpl.subject ?? '';\n\t\t\thtml.value = tpl.html ?? '';\n\t\t\ttext.value = tpl.text;\n\t\t\tactive.value = tpl.active;\n\t\t});\n\n\t\tconst {\n\t\t\tpreview,\n\t\t\tisPreviewing,\n\t\t\terror: previewError,\n\t\t\trenderPreview,\n\t\t} = useTemplatePreview(props.client);\n\t\t// Sample values as JSON text rather than an object, so a half-typed value\n\t\t// does not have to parse on every keystroke.\n\t\tconst sampleJson = ref('{}');\n\t\tconst sampleError = ref<string | null>(null);\n\n\t\tasync function run() {\n\t\t\tlet data: Record<string, unknown> = {};\n\t\t\ttry {\n\t\t\t\tconst parsed: unknown = JSON.parse(sampleJson.value || '{}');\n\t\t\t\tif (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n\t\t\t\t\tsampleError.value = 'Sample data must be a JSON object.';\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tdata = parsed as Record<string, unknown>;\n\t\t\t\tsampleError.value = null;\n\t\t\t} catch {\n\t\t\t\tsampleError.value = 'Sample data is not valid JSON.';\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst result = await renderPreview(\n\t\t\t\tprops.type,\n\t\t\t\t{\n\t\t\t\t\ttext: text.value,\n\t\t\t\t\tdata,\n\t\t\t\t\t...(subject.value ? { subject: subject.value } : {}),\n\t\t\t\t\t...(html.value ? { html: html.value } : {}),\n\t\t\t\t},\n\t\t\t\tprops.locale,\n\t\t\t);\n\t\t\t// The server reports which variables this content uses; seed the ones\n\t\t\t// with no value yet with their own name so the render shows where each\n\t\t\t// lands. Never overwrite something already typed.\n\t\t\tconst missing = result.variables.filter((v) => !IMPLICIT.has(v) && !(v in data));\n\t\t\tif (missing.length > 0) {\n\t\t\t\tsampleJson.value = JSON.stringify(\n\t\t\t\t\t{ ...data, ...Object.fromEntries(missing.map((v) => [v, v])) },\n\t\t\t\t\tnull,\n\t\t\t\t\t2,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// One render once the template has loaded, so the pane is never empty on\n\t\t// arrival. After that it is explicit — a request per keystroke is not a\n\t\t// preview, it is a load test.\n\t\twatch(template, (tpl) => {\n\t\t\tif (tpl) void run();\n\t\t});\n\n\t\tasync function handleSubmit(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tisSaving.value = true;\n\t\t\tsaveError.value = null;\n\t\t\ttry {\n\t\t\t\tconst input: ISetTemplateInput = { text: text.value, active: active.value };\n\t\t\t\tif (subject.value) input.subject = subject.value;\n\t\t\t\tif (html.value) input.html = html.value;\n\t\t\t\tif (template.value?.version !== undefined) input.ifVersion = template.value.version;\n\t\t\t\tawait saveTemplate(props.type, input, props.locale);\n\t\t\t\t// The list composable refreshes its own list; this screen renders the\n\t\t\t\t// single template, so re-read it too.\n\t\t\t\tawait refresh();\n\t\t\t\temit('saved');\n\t\t\t} catch (err) {\n\t\t\t\t// useTemplates normalizes every failure to FonderieApiError before throwing.\n\t\t\t\tsaveError.value = err as FonderieApiError;\n\t\t\t} finally {\n\t\t\t\tisSaving.value = false;\n\t\t\t}\n\t\t}\n\n\t\tfunction renderRevision(rev: ITemplateRevision) {\n\t\t\treturn h('li', { key: rev.version, style: styles.revisionRow }, [\n\t\t\t\th(\n\t\t\t\t\t'span',\n\t\t\t\t\t`v${rev.version} — ${rev.actor ?? 'unknown'} — ${new Date(rev.createdAt).toLocaleString()}`,\n\t\t\t\t),\n\t\t\t\th(\n\t\t\t\t\t'button',\n\t\t\t\t\t{ type: 'button', style: styles.rollbackButton, onClick: () => rollback(rev.version) },\n\t\t\t\t\t'Roll back',\n\t\t\t\t),\n\t\t\t]);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (isLoading.value) return h('p', { style: styles.status }, 'Loading template…');\n\t\t\tif (error.value)\n\t\t\t\treturn h('p', { style: styles.error, role: 'alert' }, error.value.explanation);\n\n\t\t\treturn h('div', { style: styles.container }, [\n\t\t\t\th('h1', { style: styles.title }, props.type),\n\t\t\t\th(\n\t\t\t\t\t'p',\n\t\t\t\t\t{ style: styles.meta },\n\t\t\t\t\t`${props.locale ?? 'base'} · v${template.value?.version ?? 1}`,\n\t\t\t\t),\n\t\t\t\th('div', { style: styles.split }, [\n\t\t\t\th('div', { style: styles.column }, [\n\t\t\t\th('form', { style: styles.form, onSubmit: handleSubmit }, [\n\t\t\t\t\th('label', { style: styles.label, for: 'template-subject' }, 'Subject'),\n\t\t\t\t\th('input', {\n\t\t\t\t\t\tid: 'template-subject',\n\t\t\t\t\t\tstyle: styles.input,\n\t\t\t\t\t\tvalue: subject.value,\n\t\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\t\tsubject.value = (e.target as HTMLInputElement).value;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\th('label', { style: styles.label, for: 'template-html' }, 'HTML body'),\n\t\t\t\t\th('textarea', {\n\t\t\t\t\t\tid: 'template-html',\n\t\t\t\t\t\tstyle: styles.textarea,\n\t\t\t\t\t\trows: 8,\n\t\t\t\t\t\tvalue: html.value,\n\t\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\t\thtml.value = (e.target as HTMLTextAreaElement).value;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\th('label', { style: styles.label, for: 'template-text' }, 'Plain-text body'),\n\t\t\t\t\th('textarea', {\n\t\t\t\t\t\tid: 'template-text',\n\t\t\t\t\t\tstyle: styles.textarea,\n\t\t\t\t\t\trows: 4,\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tvalue: text.value,\n\t\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\t\ttext.value = (e.target as HTMLTextAreaElement).value;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\th('label', { style: styles.checkboxLabel }, [\n\t\t\t\t\t\th('input', {\n\t\t\t\t\t\t\ttype: 'checkbox',\n\t\t\t\t\t\t\tchecked: active.value,\n\t\t\t\t\t\t\tonChange: (e: Event) => {\n\t\t\t\t\t\t\t\tactive.value = (e.target as HTMLInputElement).checked;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t'Active',\n\t\t\t\t\t]),\n\t\t\t\t\tsaveError.value\n\t\t\t\t\t\t? h('p', { style: styles.error, role: 'alert' }, saveError.value.explanation)\n\t\t\t\t\t\t: null,\n\t\t\t\t\th(\n\t\t\t\t\t\t'button',\n\t\t\t\t\t\t{ type: 'submit', disabled: isSaving.value, style: styles.button },\n\t\t\t\t\t\tisSaving.value ? 'Saving…' : 'Save',\n\t\t\t\t\t),\n\t\t\t\t]),\n\t\t\t\th('label', { style: styles.label, for: 'template-sample' }, 'Sample data'),\n\t\t\t\th('textarea', {\n\t\t\t\t\tid: 'template-sample',\n\t\t\t\t\tstyle: styles.textarea,\n\t\t\t\t\trows: 6,\n\t\t\t\t\tspellcheck: false,\n\t\t\t\t\tvalue: sampleJson.value,\n\t\t\t\t\tonInput: (e: Event) => {\n\t\t\t\t\t\tsampleJson.value = (e.target as HTMLTextAreaElement).value;\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\tsampleError.value\n\t\t\t\t\t? h('p', { style: styles.error, role: 'alert' }, sampleError.value)\n\t\t\t\t\t: null,\n\t\t\t\t]),\n\t\t\t\th('div', { style: styles.column }, [\n\t\t\t\t\th('div', { style: styles.previewHeader }, [\n\t\t\t\t\t\th('span', { style: styles.label }, 'Preview'),\n\t\t\t\t\t\th(\n\t\t\t\t\t\t\t'button',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'button',\n\t\t\t\t\t\t\t\tstyle: styles.rollbackButton,\n\t\t\t\t\t\t\t\tdisabled: isPreviewing.value,\n\t\t\t\t\t\t\t\tonClick: () => void run(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisPreviewing.value ? 'Rendering…' : 'Render',\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t\tpreviewError.value\n\t\t\t\t\t\t? h('p', { style: styles.error, role: 'alert' }, previewError.value.explanation)\n\t\t\t\t\t\t: null,\n\t\t\t\t\tpreview.value?.subject\n\t\t\t\t\t\t? h('p', { style: styles.previewSubject }, preview.value.subject)\n\t\t\t\t\t\t: null,\n\t\t\t\t\tpreview.value?.html\n\t\t\t\t\t\t? // sandbox= — no scripts, no same-origin. Operator-authored HTML\n\t\t\t\t\t\t\t// must never execute in the dashboard's origin, where the admin\n\t\t\t\t\t\t\t// token lives.\n\t\t\t\t\t\t\th('iframe', {\n\t\t\t\t\t\t\t\ttitle: 'Template preview',\n\t\t\t\t\t\t\t\tstyle: styles.previewFrame,\n\t\t\t\t\t\t\t\tsandbox: '',\n\t\t\t\t\t\t\t\tsrcdoc: preview.value.html,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: preview.value\n\t\t\t\t\t\t\t? h('pre', { style: styles.previewText }, preview.value.text)\n\t\t\t\t\t\t\t: h('p', { style: styles.meta }, 'Nothing rendered yet.'),\n\t\t\t\t]),\n\t\t\t\t]),\n\t\t\t\trevisions.value.length > 0\n\t\t\t\t\t? h('div', { style: styles.revisions }, [\n\t\t\t\t\t\t\th('h2', { style: styles.subtitle }, 'History'),\n\t\t\t\t\t\t\th('ul', { style: styles.list }, revisions.value.map(renderRevision)),\n\t\t\t\t\t\t])\n\t\t\t\t\t: null,\n\t\t\t]);\n\t\t};\n\t},\n});\n","import type { CSSProperties } from 'vue';\n\nexport const styles: Record<string, CSSProperties> = {\n\tcontainer: { padding: '24px', maxWidth: '1180px' },\n\tsplit: { display: 'flex', gap: '24px', alignItems: 'flex-start', flexWrap: 'wrap' },\n\tcolumn: { flex: '1 1 460px', minWidth: '320px', display: 'flex', flexDirection: 'column' },\n\tpreviewHeader: {\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'space-between',\n\t\talignItems: 'center',\n\t\tmarginTop: '12px',\n\t},\n\tpreviewSubject: { fontSize: '14px', fontWeight: '600', margin: '8px 0' },\n\tpreviewFrame: {\n\t\twidth: '100%',\n\t\theight: '520px',\n\t\tborder: '1px solid var(--fonderie-border,#e0e0e0)',\n\t\tborderRadius: '8px',\n\t\tbackground: 'var(--fonderie-surface,#fff)',\n\t},\n\tpreviewText: {\n\t\twhiteSpace: 'pre-wrap',\n\t\tborder: '1px solid var(--fonderie-border,#e0e0e0)',\n\t\tborderRadius: '8px',\n\t\tpadding: '12px',\n\t\tfontSize: '13px',\n\t\tfontFamily: 'var(--fonderie-mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace)',\n\t},\n\ttitle: { fontSize: '24px', fontWeight: 700 },\n\tsubtitle: { fontSize: '16px', fontWeight: 600, marginBottom: '8px' },\n\tmeta: { fontSize: '13px', color: 'var(--fonderie-text-muted,#5c5c5c)', marginBottom: '16px' },\n\tstatus: { padding: '24px', textAlign: 'center', color: 'var(--fonderie-text-muted,#5c5c5c)' },\n\terror: { color: 'var(--fonderie-danger,#e00)', marginBottom: '12px', fontSize: '14px' },\n\tlist: { listStyle: 'none', padding: '0', margin: '0' },\n\trow: { borderBottom: '1px solid var(--fonderie-border-light,#f5f5f5)' },\n\trowButton: {\n\t\twidth: '100%',\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'space-between',\n\t\talignItems: 'center',\n\t\tpadding: '12px 0',\n\t\tbackground: 'none',\n\t\tborder: 'none',\n\t\tcursor: 'pointer',\n\t\ttextAlign: 'left',\n\t},\n\ttype: { fontSize: '14px', fontWeight: 600, flex: '1' },\n\tlocale: { fontSize: '13px', color: 'var(--fonderie-text-muted,#5c5c5c)', marginRight: '16px' },\n\tactive: { fontSize: '12px', color: 'var(--fonderie-accent-strong,#009767)' },\n\tinactive: { fontSize: '12px', color: 'var(--fonderie-text-muted,#5c5c5c)' },\n\tform: { display: 'flex', flexDirection: 'column', gap: '4px' },\n\tlabel: { fontSize: '13px', fontWeight: 600, marginTop: '12px' },\n\tinput: { border: '1px solid var(--fonderie-border,#e0e0e0)', borderRadius: '8px', padding: '10px', fontSize: '14px' },\n\ttextarea: {\n\t\tborder: '1px solid var(--fonderie-border,#e0e0e0)',\n\t\tborderRadius: '8px',\n\t\tpadding: '10px',\n\t\tfontSize: '14px',\n\t\tfontFamily: 'var(--fonderie-mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace)',\n\t},\n\tcheckboxLabel: {\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tgap: '8px',\n\t\tmarginTop: '12px',\n\t\tfontSize: '14px',\n\t},\n\tbutton: {\n\t\tmarginTop: '16px',\n\t\tbackgroundColor: 'var(--fonderie-text,#171717)',\n\t\tcolor: 'var(--fonderie-surface,#fff)',\n\t\tpadding: '10px 20px',\n\t\tborderRadius: '8px',\n\t\tborder: 'none',\n\t\tfontSize: '14px',\n\t\tfontWeight: 600,\n\t\tcursor: 'pointer',\n\t\talignSelf: 'flex-start',\n\t},\n\trevisions: { marginTop: '32px' },\n\trevisionRow: {\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'space-between',\n\t\talignItems: 'center',\n\t\tpadding: '8px 0',\n\t\tborderBottom: '1px solid var(--fonderie-border-light,#f5f5f5)',\n\t\tfontSize: '13px',\n\t},\n\trollbackButton: {\n\t\tbackground: 'none',\n\t\tborder: '1px solid var(--fonderie-border,#e0e0e0)',\n\t\tborderRadius: '8px',\n\t\tpadding: '4px 10px',\n\t\tfontSize: '12px',\n\t\tcursor: 'pointer',\n\t},\n};\n","import type { CourierAdminClient, ITemplateEntry } from '@fonderie/client';\nimport { useTemplates } from '@fonderie/vue-courier-admin';\nimport type { PropType } from 'vue';\nimport { defineComponent, h } from 'vue';\nimport { styles } from '../styles';\n\nexport const TemplateListScreen = defineComponent({\n\tname: 'FonderieTemplateListScreen',\n\tprops: {\n\t\tclient: { type: Object as PropType<CourierAdminClient>, required: true },\n\t},\n\temits: {\n\t\t'select-template': (_template: ITemplateEntry) => true,\n\t},\n\tsetup(props, { emit }) {\n\t\tconst { templates, isLoading, error } = useTemplates(props.client);\n\n\t\tfunction renderRow(template: ITemplateEntry) {\n\t\t\treturn h('li', { key: `${template.type}:${template.locale ?? 'base'}`, style: styles.row }, [\n\t\t\t\th(\n\t\t\t\t\t'button',\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'button',\n\t\t\t\t\t\tstyle: styles.rowButton,\n\t\t\t\t\t\tonClick: () => emit('select-template', template),\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\th('span', { style: styles.type }, template.type),\n\t\t\t\t\t\th('span', { style: styles.locale }, template.locale ?? 'base'),\n\t\t\t\t\t\th(\n\t\t\t\t\t\t\t'span',\n\t\t\t\t\t\t\t{ style: template.active ? styles.active : styles.inactive },\n\t\t\t\t\t\t\ttemplate.active ? 'Active' : 'Inactive',\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t),\n\t\t\t]);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (isLoading.value) return h('p', { style: styles.status }, 'Loading templates…');\n\t\t\tif (error.value)\n\t\t\t\treturn h('p', { style: styles.error, role: 'alert' }, error.value.explanation);\n\n\t\t\treturn h('div', { style: styles.container }, [\n\t\t\t\th('h1', { style: styles.title }, 'Templates'),\n\t\t\t\th('ul', { style: styles.list }, templates.value.map(renderRow)),\n\t\t\t]);\n\t\t};\n\t},\n});\n"],"mappings":";AAMA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,SAAS,iBAAiB,GAAG,KAAK,aAAa;;;ACXxC,IAAM,SAAwC;AAAA,EACpD,WAAW,EAAE,SAAS,QAAQ,UAAU,SAAS;AAAA,EACjD,OAAO,EAAE,SAAS,QAAQ,KAAK,QAAQ,YAAY,cAAc,UAAU,OAAO;AAAA,EAClF,QAAQ,EAAE,MAAM,aAAa,UAAU,SAAS,SAAS,QAAQ,eAAe,SAAS;AAAA,EACzF,eAAe;AAAA,IACd,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,WAAW;AAAA,EACZ;AAAA,EACA,gBAAgB,EAAE,UAAU,QAAQ,YAAY,OAAO,QAAQ,QAAQ;AAAA,EACvE,cAAc;AAAA,IACb,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,YAAY;AAAA,EACb;AAAA,EACA,aAAa;AAAA,IACZ,YAAY;AAAA,IACZ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S,CAAC;AAAA,MAC/D,CAAC;AAAA,IACF;AAAA,EACD;AACD,CAAC;","names":["useTemplates","defineComponent","h","defineComponent","useTemplates","h"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonderie/vue-courier-admin-screens",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Pre-built Vue screens for the Fonderie courier admin API — template list, template editor with revision history and rollback.",
5
5
  "keywords": [
6
6
  "fonderiejs",