Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9ebab13
feat: add mpn-builder module
kriss145 Jan 27, 2026
f5d543b
- add template builder
kriss145 Jan 27, 2026
22807e7
feat: add templates page with edit, add, delete methods
kriss145 Jan 28, 2026
a2a905e
feat: refactor structure of files and add "group" block to build "chi…
kriss145 Jan 28, 2026
e82f719
- refactor blocks component
kriss145 Jan 29, 2026
8e9c8f5
improve: two columns in blocks view
kriss145 Jan 29, 2026
6c2b480
chore: update workflows
kriss145 Jan 31, 2026
1fa2b6d
- update workflows
kriss145 Jan 31, 2026
d155e2e
update page name
kriss145 Jan 31, 2026
f43c9a6
- add prepare-release
kriss145 Jan 31, 2026
2b4d6df
Added full support for system templates (with `system_` prefix) and u…
kriss145 Feb 1, 2026
6ccccbd
Refactor email service workflow and update imports to new structure. …
kriss145 Feb 2, 2026
3db608c
Refactor workflows to use new `mpn-builder` structure, removing depre…
kriss145 Feb 2, 2026
503e011
Update email templates structure by adding new types export and adjus…
kriss145 Feb 2, 2026
a4c490a
Remove unnecessary placeholder text from email template for cleaner r…
kriss145 Feb 2, 2026
149f2bd
Remove deprecated group block from contact form email template for im…
kriss145 Feb 2, 2026
4b83e2b
Add subject field to template forms and update related logic
kriss145 Feb 2, 2026
7e20d09
Cleaned up unused parameters in interfaces and added region to order …
kriss145 Feb 2, 2026
f2f9eff
Refactor template name handling to use `toKebabCase` transformation a…
kriss145 Feb 2, 2026
b1823a0
Update template forms to improve clarity and add descriptive text for…
kriss145 Feb 2, 2026
6aad2eb
Refactor template handling in email subscribers to use consistent tem…
kriss145 Feb 2, 2026
1f6b45f
Refactor email handling in order subscribers to standardize template …
kriss145 Feb 2, 2026
2d1879a
Update template navigation to remove `system_` prefix and clean up un…
kriss145 Feb 2, 2026
b9cc5d5
Add template ID to system templates and log initialization in MpnBuil…
kriss145 Feb 3, 2026
7f2aa81
Refactor email template services to streamline imports and remove unu…
kriss145 Feb 3, 2026
c397df0
Refactor TemplatesList component to conditionally render DataTable ba…
kriss145 Feb 3, 2026
a4233a7
Refactor MpnBuilderService to rename getAvailableTemplates to listTem…
kriss145 Feb 4, 2026
8aca4b4
Remove unused workflows and steps related to template retrieval; refa…
kriss145 Feb 4, 2026
62ed5cf
Add documentation for template workflows and steps
kriss145 Feb 4, 2026
b44853c
Refactor Slack template service and related files; remove unused Slac…
kriss145 Feb 4, 2026
39535bf
Remove unused console logs from BlocksForm, route, and slack-service …
kriss145 Feb 4, 2026
a27d930
Add extended services initialization to MpnBuilderService
kriss145 Feb 4, 2026
0b1a92f
Remove unused email and Slack template paths from package.json to str…
kriss145 Feb 4, 2026
c45d478
Update email template previews to use TEMPLATES_NAMES constants.
kriss145 Feb 4, 2026
a3376a9
Add external template retrieval in getTemplatesByTypeServiceStep
kriss145 Feb 4, 2026
ca36f68
Enhance template service to support external templates
kriss145 Feb 4, 2026
3597f09
Enhance the get-services-types-templates step to include retrieval of…
kriss145 Feb 4, 2026
245d518
Add BlocksRepeater support in BlocksChildren and BlocksForm components.
kriss145 Feb 4, 2026
4dc62d7
Update block rendering to align with Slack Block Kit format, ensuring…
kriss145 Feb 4, 2026
e387601
Revise CONTRIBUTING.md
kriss145 Feb 5, 2026
33b41fe
chore: add changset
kriss145 Feb 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions .changeset/major-release-builder-ui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
---
"@codee-sh/medusa-plugin-notification-emails": major
---

## Breaking Changes

### API Routes Changed
All API endpoints moved from `/api/admin/notification-plugin/` to `/api/admin/mpn/`. Update all API integrations.

**Changed endpoints:**
- `/api/admin/notification-plugin/events` → `/api/admin/mpn/events`
- `/api/admin/notification-plugin/notifications` → `/api/admin/mpn/notifications`
- `/api/admin/notification-plugin/render-template` → `/api/admin/mpn/render-template`

**New endpoints:**
- `/api/admin/mpn/available-templates`
- `/api/admin/mpn/templates`
- `/api/admin/mpn/templates/[id]/blocks`
- `/api/admin/mpn/templates/types`
- `/api/admin/mpn/templates/types/[type]/services`
- `/api/admin/mpn/templates/types/[type]/services/[service]/templates`

### Admin UI Routes Changed
Admin UI routes changed from `/notifications-emails/` to `/mpn/notifications/`. Update all Admin UI links/bookmarks.

**Changed routes:**
- `/notifications-emails/list` → `/mpn/notifications/list`
- `/notifications-emails/render` → `/mpn/notifications/render`

**New routes:**
- `/mpn/templates` - templates list
- `/mpn/templates/[id]/blocks` - template blocks editor

### Module Restructure
Modules moved from `templates/` to `modules/mpn-builder/`. Update all direct imports from `templates/`.

**Removed locations:**
- `src/templates/emails/email-template-service.ts`
- `src/templates/slack/slack-template-service.ts`
- `src/templates/emails/types.ts`
- `src/templates/slack/types.ts`

**New locations:**
- `src/modules/mpn-builder/services-local/email-template-service.ts`
- `src/modules/mpn-builder/services-local/slack-template-service.ts`
- `src/modules/mpn-builder/types/`

### Old Workflows Removed
Removed old workflows (`email-service`, `mpn-templates/*`). Migrate to new `mpn-builder/*` workflows.

### Email and Slack Service Import Changed
Changed import and execution method for `emailService` and `slackService`:

**Before:**
```typescript
import { emailService } from "../templates/emails"
await emailService.render(...)
```

**After:**
```typescript
import { emailServiceWorkflow } from "../workflows/mpn-builder-services/email-service"
await emailServiceWorkflow(container).run({...})
```

## New Features

### MPN Builder Module
Added complete `mpn-builder` module with template management (services, models, 3 migrations).

### UI Builder for Templates
Added full UI builder with drag & drop, inline editing, and template preview. Supports multiple block types (heading, text, row, separator, group, repeater, product-item).

### Slack Block Kit Support
Added full Slack Block Kit format support with block transformation and data interpolation. Supports all Slack block types (header, section, divider, etc.) and nested structures.

### External Templates Support
Added support for external templates with type filtering. Configure via `medusa-config.ts`:

```typescript
{
resolve: "@codee-sh/medusa-plugin-notification-emails",
options: {
extend: {
services: [
{
id: "slack", // Service ID (e.g., "slack", "email")
templates: [
{
name: "external_template-name",
path: path.resolve(require.resolve("@package/templates/slack/template"))
}
]
}
]
}
}
}
```

**Template Types:**
- `system` - Built-in system templates (default)
- `db` - Templates stored in database (created via UI or API)
- `external` - External templates registered programmatically or via configuration

### New Block Types
Added support for new block types (group, repeater, product-item) with recursive rendering, data interpolation, and nested structures.

### New Workflows and Steps
Added 10+ workflows for template management:
- `create-template` - create template
- `edit-template` - edit template
- `delete-template` - delete template
- `edit-template-blocks` - edit template blocks
- `get-template` - get single template
- `get-blocks-by-template-id` - get template blocks
- `get-templates-services` - get template services
- `get-templates-types` - get template types
- `get-templates-by-type-service` - get templates by type
- `get-services-types-templates` - get templates with filtering

All workflows include full JSDoc documentation.

### Helper Components
Added helper components (ManagerFields, TwoColumnPage, form fields: TextField, TextAreaField, SelectField, NumberField, CheckboxField).

### Store and Region Workflows
Added workflows for retrieving Store and Region data (`get-store-by-id`, `get-region-by-id`) for template preview context.

### API Middleware
Added middleware for API routing (error handling, request validation).

## Improvements

- Code refactoring: standardized naming (`settings` → `options`), renamed `renderTemplate` → `renderAction`, removed unused methods, consolidated similar methods
- Template ID handling fixes: unified template ID handling (removed `system_` prefix in UI, kebab-case format, fixed recognition logic)
- Removed unused files (old workflows, types, interfaces, console.logs, placeholder text)
- Fixed block data structure (added `parent_id` support, fixed `children` structure, added `arrayPath` for repeaters)
- Added JSDoc documentation for all workflows and steps
- UI improvements: button sizes, field descriptions, two-column layout, better error messages
- Improved data handling: added `region` to order queries, improved template filtering, fixed Slack Block Kit transformation
- Added new UI dependencies (`@dnd-kit/core`, `@lexical/*`, `@react-email/*`, `react-email`)
8 changes: 8 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ dependencies:
- title: ["deps:", "dependencies:", "bump "]
- head: ["deps/", "dependencies/"]

"type: chore":
- title: ["chore:"]
- head: ["chore/"]

breaking:
- title: ["breaking:", "BREAKING:"]
- head: ["breaking/"]

50 changes: 0 additions & 50 deletions .github/workflows/changeset-version.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/npm-publish.yml

This file was deleted.

124 changes: 0 additions & 124 deletions .github/workflows/release-notes.yml

This file was deleted.

Loading