npm.io
0.12.0 • Published 2h ago

@templatical/import-beefree

Licence
MIT
Version
0.12.0
Deps
1
Size
68 kB
Vulns
0
Weekly
439

@templatical/import-beefree

Convert BeeFree email templates to Templatical's JSON format.

npm version License

Migrate from BeeFree to Templatical without rebuilding your templates by hand. Maps BeeFree modules to Templatical block types and reports any modules that need manual conversion.

Install

npm install @templatical/import-beefree

Usage

import { convertBeeFreeTemplate } from '@templatical/import-beefree';

const beefreeJson = await fetch('/path/to/beefree-template.json').then(r => r.json());

const result = convertBeeFreeTemplate(beefreeJson);

console.log(result.content);   // → Templatical TemplateContent
console.log(result.report);    // → conversion report (per-module status, warnings, summary)

// Inspect modules that didn't convert cleanly
for (const entry of result.report.entries) {
  if (entry.status !== 'converted') {
    console.warn(
      `${entry.beeFreeModuleType}${entry.templaticalBlockType ?? 'n/a'} ` +
      `(${entry.status})${entry.note ? `: ${entry.note}` : ''}`,
    );
  }
}

console.log(result.report.summary);
// { total, converted, approximated, htmlFallback, skipped }

What's converted

BeeFree module Templatical block
heading / title TitleBlock
paragraph / text ParagraphBlock
image ImageBlock
button ButtonBlock
divider DividerBlock
spacer SpacerBlock
social SocialIconsBlock
menu MenuBlock
html HtmlBlock
video VideoBlock
Unknown modules Fallback to HtmlBlock

Unknown or partially-supported modules are flagged in result.report so you can review them.

API

  • convertBeeFreeTemplate(template) — converts a BeeFree JSON template, returns { content, report }

Types:

  • BeeFreeTemplate — input shape (see source for full structure)
  • ImportResult{ content: TemplateContent, report: ImportReport }
  • ImportReport{ entries: ImportReportEntry[], warnings: string[], summary: { total, converted, approximated, htmlFallback, skipped } }
  • ImportReportEntry{ beeFreeModuleType, templaticalBlockType, status, note? }
  • ConversionStatus'converted' | 'approximated' | 'html-fallback' | 'skipped'

Documentation

Full reference at docs.templatical.com.

License

MIT

Keywords