mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 08:13:23 +00:00
Critical fixes: - Update dev/app/api/test-email/route.ts to use new sendEmail API instead of deprecated sendEmail/scheduleEmail - Fix dev/test-plugin.mjs imports to remove scheduleEmail reference - Update dev/README.md examples to use new sendEmail pattern - Replace templateId with template.slug throughout dev examples - Add support for direct HTML emails in test route The development routes now work correctly with v0.1.5 API changes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
// Simple test to verify plugin can be imported and initialized
|
|
import { mailingPlugin, sendEmail, renderTemplate } from '@xtr-dev/payload-mailing'
|
|
|
|
console.log('✅ Plugin imports successfully')
|
|
console.log('✅ mailingPlugin:', typeof mailingPlugin)
|
|
console.log('✅ sendEmail:', typeof sendEmail)
|
|
console.log('✅ renderTemplate:', typeof renderTemplate)
|
|
|
|
// Test plugin configuration
|
|
try {
|
|
const testConfig = {
|
|
collections: [],
|
|
db: null,
|
|
secret: 'test'
|
|
}
|
|
|
|
const pluginFn = mailingPlugin({
|
|
defaultFrom: 'test@example.com',
|
|
transport: {
|
|
host: 'localhost',
|
|
port: 1025,
|
|
secure: false,
|
|
auth: { user: 'test', pass: 'test' }
|
|
}
|
|
})
|
|
|
|
const configWithPlugin = pluginFn(testConfig)
|
|
console.log('✅ Plugin configuration works')
|
|
console.log('✅ Collections added:', configWithPlugin.collections?.length > testConfig.collections.length)
|
|
console.log('✅ Jobs configured:', !!configWithPlugin.jobs)
|
|
|
|
} catch (error) {
|
|
console.error('❌ Plugin configuration error:', error.message)
|
|
}
|
|
|
|
console.log('\n🎉 PayloadCMS Mailing Plugin is ready for development!')
|
|
console.log('\nNext steps:')
|
|
console.log('1. Run: npm run dev (in dev directory)')
|
|
console.log('2. Open: http://localhost:3000/admin')
|
|
console.log('3. Test: http://localhost:3000/mailing-test') |