From b9f5443be9cc38d02c7cf60169456ef1c4f67933 Mon Sep 17 00:00:00 2001 From: Krzysztof Polak Date: Thu, 18 Dec 2025 10:57:37 +0100 Subject: [PATCH 01/16] chore: Disable release notes --- .github/workflows/release-notes.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index e79049d..1d15336 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -5,9 +5,17 @@ name: Generate Release Notes (Backup) +# DISABLED - Using GitHub's built-in "Generate release notes" instead +# This workflow is kept for reference but will NOT run automatically. +# To enable: uncomment the "on:" section below and remove workflow_dispatch + +# on: +# release: +# types: [created] + +# Only allows manual trigger, prevents automatic execution on: - release: - types: [created] + workflow_dispatch: jobs: generate-release-notes: From 5eb910cd4a822da421be0d6e80fd682633d85625 Mon Sep 17 00:00:00 2001 From: Krzysztof Polak Date: Thu, 18 Dec 2025 20:19:30 +0100 Subject: [PATCH 02/16] chore: Add contributing file --- .changeset/fresh-lamps-stand.md | 5 + CONTRIBUTING.md | 437 ++++++++++++++++++++++++++++++++ 2 files changed, 442 insertions(+) create mode 100644 .changeset/fresh-lamps-stand.md create mode 100644 CONTRIBUTING.md diff --git a/.changeset/fresh-lamps-stand.md b/.changeset/fresh-lamps-stand.md new file mode 100644 index 0000000..18e9d62 --- /dev/null +++ b/.changeset/fresh-lamps-stand.md @@ -0,0 +1,5 @@ +--- +"@codee-sh/medusa-plugin-automations": patch +--- + +Update contributing diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..0a589cf --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,437 @@ +# Contributing + +Thank you for your interest in contributing to this project! This document describes the workflow for working on the repository and the conventions we should follow. If you have any questions, we encourage you to reach out via issues or directly with the team. + +## Important Information + +- All changes should be made through Pull Requests (PR) +- Before starting work on larger changes, consult with the team +- All PRs should include appropriate tests +- Code should follow the accepted style conventions +- **The project uses Changesets** for version management - every PR with code changes requires a changeset + +## Prerequisites + +- Knowledge of Git and GitHub (Issues, Pull Requests) +- Local development environment configured +- Node.js >= 20 +- Yarn 3.2.3+ +- Knowledge of technologies used in the project (Medusa, TypeScript, React) + +## Workflow + +### 1. Issues before PR + +1. **Check existing issues** - before starting work, make sure there isn't already an issue for what you want to work on +2. **Create an issue** - if there's no appropriate issue, create a new one, describing: + - What you want to implement/change + - Why this change is needed + - What are the expected results +3. **Wait for approval** - for larger changes, wait for team approval before starting work + +### 2. Branches + +All changes should be made in separate branches and submitted as Pull Requests. + +**Branch naming:** +- `fix/` - for bug fixes (e.g., `fix/login-error`) +- `feat/` - for new features (e.g., `feat/user-profile`) +- `docs/` - for documentation changes (e.g., `docs/api-update`) +- `refactor/` - for code refactoring (e.g., `refactor/auth-module`) +- `test/` - for adding or improving tests (e.g., `test/integration-tests`) +- `chore/` - for maintenance tasks (e.g., `chore/dependencies-update`) + +**Base branch:** +- Use `develop` as the base branch for your PRs by default +- `master` is only used by admins for releases + +### 3. Commits + +- Try to create small, isolated commits - this makes review and understanding changes easier +- Use conventional commit messages: + - `fix: fixed login error` + - `feat: added password reset functionality` + - `docs: updated API documentation` + - `refactor: improved authorization module structure` + - `test: added unit tests for payment module` + - `chore: updated dependencies` + +### 4. Pull Requests + +**Process (for developers):** +1. Make sure your branch is up to date with `develop` +2. **Add a changeset** (if you're making code changes) - see the [Changesets](#changesets) section +3. Create a Pull Request with a clear description of changes **to the `develop` branch** +4. Add appropriate labels and assign reviewers +5. Respond to comments and make corrections +6. After approval, the PR will be merged into `develop` + +**Release process (admins only):** + +1. After merging changes to `develop`, admin creates a PR from `develop` to `master` +2. This PR contains all changes ready for release +3. After merging to `master`, admin performs release locally (see the [Release Process](#release-process-locally-by-admin) section) + +**How to create a PR from `develop` to `master`:** + +1. **Make sure `develop` is up to date:** +```bash +git checkout develop +git pull origin develop +``` + +2. **Create PR on GitHub:** + - Base branch: `master` + - Compare branch: `develop` + - PR title: `chore: release [date]` or `chore: prepare release` (e.g., `chore: release 2024-01-15`) + +3. **In the PR description you can:** + - List the main changes in this release + - Add links to merged PRs from `develop` + - Optionally: add a list of changesets that will be processed + +4. **After creating the PR:** + - Merge the PR to `master` (squash merge or merge commit) + - After merge, perform the release process locally (see the [Release Process](#release-process-locally-by-admin) section) + +**PR description structure:** +- **What** - what was changed in this PR +- **Why** - why these changes are needed +- **How** - how the changes were implemented +- **Testing** - how the changes were tested or how the reviewer can test them +- **Related issue** - link to the related issue (use keywords: `closes #123`, `fixes #456`) + +**Self-review:** +We encourage self-review of code before requesting review. Check: +- Is the code readable and follows conventions +- Do all tests pass +- Are there no unused imports or comments +- Has documentation been updated (if applicable) +- Has a changeset been added (if applicable) + +**Merge Style:** +- Pull Requests are merged via squash and merge +- Make sure the commit message is clear and descriptive + +## Local Development + +### Environment Setup + +1. **Clone the repository:** +```bash +git clone +cd +``` + +2. **Install dependencies:** +```bash +yarn install +``` + +3. **Start the development server:** +```bash +yarn dev +``` + +This will start the plugin in watch mode, automatically rebuilding on changes. + +### Project Structure + +``` +medusa-plugin-automations/ +├── src/ +│ ├── admin/ # Admin UI (React components) +│ ├── api/ # API routes (admin/store) +│ ├── modules/ # Medusa modules +│ ├── workflows/ # Medusa workflows +│ ├── subscribers/ # Event subscribers +│ ├── providers/ # Action providers (Slack, etc.) +│ └── utils/ # Utility functions +├── docs/ # Documentation +├── .changeset/ # Changesets for versioning +├── .github/ # GitHub workflows +└── package.json +``` + +### Working with the plugin locally (yalc) + +If you're working on the plugin and want to test it in a Medusa application: + +1. **In the plugin directory, build and publish locally:** +```bash +yarn build +yalc publish +``` + +2. **In the Medusa application, link the local plugin:** +```bash +cd /path/to/medusa-app +yalc link @codee-sh/medusa-plugin-automations +yarn install +``` + +3. **While working on the plugin:** +```bash +# In the plugin directory (watch mode) +yarn dev + +# In the Medusa application (in a separate terminal) +yarn dev +``` + +4. **After finishing work, remove local links:** +```bash +cd /path/to/medusa-app +yalc remove @codee-sh/medusa-plugin-automations +yarn install +``` + +**Note:** `.yalc` and `yalc.lock` files are ignored by git - don't commit them. + +## Testing + +### Types of Tests + +- **Unit tests** - unit tests for individual functions/modules +- **Integration tests** - integration tests for larger components +- **E2E tests** - end-to-end tests for entire flows + +### Running Tests + +```bash +# All tests +yarn test + +# Tests in watch mode +yarn test:watch + +# Tests with coverage +yarn test:coverage + +# Integration tests +yarn test:integration +``` + +### Test Requirements + +- All PRs should include appropriate tests for the changes made +- New features require new tests +- Bug fixes should include tests that reproduce and verify the fix +- Aim for code coverage >= 80% + +## Documentation + +### Updating Documentation + +- If you change user-facing API, update documentation in `docs/` +- Add usage examples for new features +- Update README.md if you change the setup or installation process +- Document breaking changes through changesets (CHANGELOG.md is generated automatically) + +### Documentation Conventions + +- Use [TSDoc](https://tsdoc.org/) for TypeScript documentation +- Use JSDoc for JavaScript documentation +- Write documentation in English (or according to project convention) +- Add code examples where possible + +## Code Style + +### Formatting + +- We use Prettier for code formatting +- Run `yarn format` before committing (formats files) +- Check formatting before PR: `yarn format:check` (checks without formatting) + +### Linting + +- All files should pass linting without errors +- Run `yarn format:check` before committing (checks formatting) +- Fix all warnings before PR + +### TypeScript + +- Use TypeScript for all new files +- Avoid `any` - use appropriate types +- Add types for all public APIs +- Use interfaces for objects, type for union types +- Export types from `src/utils/types/` for public API + +## Changesets + +The project uses [Changesets](https://github.com/changesets/changesets) for version and changelog management. + +### Changesets Workflow + +The release process consists of **three stages**: + +1. **Feature PR** (you create) - contains code changes + changeset file → merge to `develop` +2. **Release PR** (admin creates) - PR from `develop` to `master` with ready changes +3. **Manual release** (admin executes locally) - after merge to `master`, admin locally runs `yarn version` and `yarn release` + +**Flow diagram:** +``` +Developer: + feature-branch → PR → develop (with changeset) + +Admin: + develop → PR "chore: release [date]" → master + +Admin (locally, after merge to master): + 1. git checkout master && git pull + 2. yarn version (updates version and CHANGELOG) + 3. git commit && git push + 4. yarn release (builds and publishes to npm) +``` + +### How to Add a Changeset + +1. **After making code changes, before creating PR:** +```bash +yarn changeset +``` + +2. **Select the type of change:** + - `major` - breaking changes + - `minor` - new features (backward compatible) + - `patch` - bug fixes (backward compatible) + +3. **Describe the changes** - write a brief description of what was changed + +4. **Commit the changeset file:** +```bash +git add .changeset/ +git commit -m "feat: add changeset for my feature" +``` + +5. **Create PR to `develop`** - make sure the changeset file is included in the PR + +### Release Process (locally by admin) + +After merging PR from `develop` to `master`: + +```bash +# 1. Switch to master and pull changes +git checkout master && git pull origin master + +# 2. Update version and CHANGELOG +yarn version + +# 3. Commit and push changes +git add package.json CHANGELOG.md .changeset/ +git commit -m "chore: version packages" +git push origin master + +# 4. Build and publish to npm +yarn release + +# 5. Push tag +git push origin --tags +``` + +**Important:** +- Changesets must be in PR to `develop` - without them `yarn version` won't find changes +- Make sure you're logged in to npm (`npm login`) before `yarn release` + +### Changesets Commands + +#### `yarn changeset` + +**What it does:** Creates a new changeset file describing code changes. + +**When to use:** +- After making code changes, **before creating PR** +- For every code change that should be included in the release +- **Don't use** for documentation-only changes (unless it's a breaking change in documentation) + +**How to use:** +```bash +yarn changeset +``` + +**Process:** Select the type of change (major/minor/patch) and describe the changes. A file will be created in `.changeset/`. + +--- + +#### `yarn version` + +**What it does:** +- Reads all changesets in `.changeset/` +- Updates version in `package.json` according to changeset types +- Updates `CHANGELOG.md` with change descriptions +- Removes processed changeset files + +**When to use:** +- **Admins only** after merging PR `develop` → `master`, on `master` branch +- Before `yarn release` + +**How to use:** +```bash +yarn version +``` + +**Process:** Checks changesets, updates version in `package.json` and `CHANGELOG.md`, removes processed changeset files. + +**After running:** Commit the changes (`package.json`, `CHANGELOG.md`, `.changeset/`). + +--- + +#### `yarn release` + +**What it does:** +- Builds the package (`yarn build`) +- Publishes the package to npm (`npm publish`) +- Creates a git tag with the version + +**When to use:** +- **Admins only** after `yarn version` and committing changes +- On `master` branch with updated version + +**How to use:** +```bash +yarn release +``` + +**Process:** Builds the package (`yarn build`), publishes to npm (`yarn publish-package`), creates a git tag. + +**Requirements:** Log in to npm (`npm login`), changes must be committed and pushed. + +--- + +**Versioning:** The project uses [Semantic Versioning](https://semver.org/): +- `major` - breaking changes +- `minor` - new features (backward compatible) +- `patch` - bug fixes (backward compatible) + +CHANGELOG.md is automatically generated by Changesets. + +## Code Review + +### For PR Authors + +- Be open to feedback +- Respond to all comments +- Make corrections according to suggestions +- If you disagree with a suggestion, explain why + +### For Reviewers + +- Be constructive and polite +- Explain your suggestions +- Check not only code, but also tests and documentation +- Check if a changeset has been added (if applicable) +- Approve PR only if you're sure it's ready + +## Questions and Help + +- **Issues** - for bugs and feature requests +- **Discussions** - for questions and discussions +- **Team** - direct contact with team members + +## License + +By contributing to this project, you agree that your changes will be licensed under the same terms as the project. + +--- + +Thank you for your contribution! 🎉 From 0b887d2645377990dfac2a89177fde67a7dd05f0 Mon Sep 17 00:00:00 2001 From: Krzysztof Polak Date: Mon, 22 Dec 2025 10:30:35 +0100 Subject: [PATCH 03/16] feat: fix name --- src/admin/automations/automations-list/automations-list.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/admin/automations/automations-list/automations-list.tsx b/src/admin/automations/automations-list/automations-list.tsx index c71cccc..3280ab7 100644 --- a/src/admin/automations/automations-list/automations-list.tsx +++ b/src/admin/automations/automations-list/automations-list.tsx @@ -50,7 +50,7 @@ export const AutomationsList = () => { const columns = useMemo( () => [ columnHelper.accessor("to", { - header: "Name and description", + header: "Name and descriptions", cell: ({ row }) => { const tooltip = `Device (DB) ID: \n ${row?.original?.id}` return ( @@ -71,7 +71,7 @@ export const AutomationsList = () => { -
+
{row?.original?.description}
From 9d7690f1f6897c1b05029735bd3c4890fb853aef Mon Sep 17 00:00:00 2001 From: Krzysztof Polak Date: Mon, 22 Dec 2025 10:31:28 +0100 Subject: [PATCH 04/16] - add changeset --- .changeset/fuzzy-coins-invent.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fuzzy-coins-invent.md diff --git a/.changeset/fuzzy-coins-invent.md b/.changeset/fuzzy-coins-invent.md new file mode 100644 index 0000000..a30020a --- /dev/null +++ b/.changeset/fuzzy-coins-invent.md @@ -0,0 +1,5 @@ +--- +"@codee-sh/medusa-plugin-automations": patch +--- + +Update name in the column name From 03d5b900509a75b7d9485dea9c2a86cb92c57c40 Mon Sep 17 00:00:00 2001 From: Krzysztof Polak Date: Mon, 22 Dec 2025 13:23:23 +0100 Subject: [PATCH 05/16] chore: docs temp --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 0839fea..8e2db68 100755 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,6 @@ yarn-error.log* .env .env.local +# Temporary docs (internal) +docs-temp/ + From 4577222608583f09a3d1e2b15863d6b87171b9f1 Mon Sep 17 00:00:00 2001 From: Krzysztof Polak Date: Mon, 22 Dec 2025 13:23:33 +0100 Subject: [PATCH 06/16] refactor: rename interval_minutes to interval_seconds across automation forms and related schemas --- .../automations-create-form/index.tsx | 10 ++-- .../automations-edit-form/index.tsx | 10 ++-- .../automations-general-form/index.tsx | 60 ++++++++++++++++++- .../automations-form/types/schema.ts | 2 +- src/api/middlewares.ts | 2 +- .../.snapshot-medusa-mpn-automation.json | 4 +- .../migrations/Migration20251222121805.ts | 13 ++++ .../models/mpn_automation_trigger.ts | 4 +- .../mpn-automation/types/interfaces.ts | 2 +- .../mpn-automation/steps/create-automation.ts | 2 +- .../mpn-automation/steps/edit-automation.ts | 2 +- .../retrieve-automation-triggers-by-event.ts | 2 +- 12 files changed, 92 insertions(+), 21 deletions(-) create mode 100644 src/modules/mpn-automation/migrations/Migration20251222121805.ts diff --git a/src/admin/automations/automations-form/automations-create-form/index.tsx b/src/admin/automations/automations-form/automations-create-form/index.tsx index 7f25536..ed1f1a7 100644 --- a/src/admin/automations/automations-form/automations-create-form/index.tsx +++ b/src/admin/automations/automations-form/automations-create-form/index.tsx @@ -78,7 +78,7 @@ export function AutomationsCreateForm() { description: "", trigger_type: "event", event_name: "", - interval_minutes: null, + interval_seconds: null, active: false, }, rules: { @@ -104,8 +104,8 @@ export function AutomationsCreateForm() { // description: trigger.description || "", // trigger_type: trigger.trigger_type || "event", // event_name: trigger.event_name || "", - // interval_minutes: - // trigger.interval_minutes || null, + // interval_seconds: + // trigger.interval_seconds || null, // active: trigger.active || false, // }, // rules: { @@ -126,7 +126,7 @@ export function AutomationsCreateForm() { description: "", trigger_type: "event", event_name: "", - interval_minutes: null, + interval_seconds: null, active: false, }, rules: { @@ -146,7 +146,7 @@ export function AutomationsCreateForm() { description: data.general.description, trigger_type: data.general.trigger_type, event_name: data.general.event_name, - interval_minutes: data.general.interval_minutes, + interval_seconds: data.general.interval_seconds, active: data.general.active, } diff --git a/src/admin/automations/automations-form/automations-edit-form/index.tsx b/src/admin/automations/automations-form/automations-edit-form/index.tsx index 6865928..827ac80 100644 --- a/src/admin/automations/automations-form/automations-edit-form/index.tsx +++ b/src/admin/automations/automations-form/automations-edit-form/index.tsx @@ -124,7 +124,7 @@ export function AutomationsEditForm({ description: "", trigger_type: "event", event_name: "", - interval_minutes: null, + interval_seconds: null, active: false, }, rules: { @@ -154,8 +154,8 @@ export function AutomationsEditForm({ description: trigger.description || "", trigger_type: trigger.trigger_type || "event", event_name: trigger.event_name || "", - interval_minutes: - trigger.interval_minutes || null, + interval_seconds: + trigger.interval_seconds || null, active: trigger.active || false, }, rules: { @@ -202,7 +202,7 @@ export function AutomationsEditForm({ description: "", trigger_type: "event", event_name: "", - interval_minutes: null, + interval_seconds: null, active: false, }, rules: { @@ -223,7 +223,7 @@ export function AutomationsEditForm({ description: data.general.description, trigger_type: data.general.trigger_type, event_name: data.general.event_name, - interval_minutes: data.general.interval_minutes, + interval_seconds: data.general.interval_seconds, active: data.general.active, } diff --git a/src/admin/automations/automations-form/automations-general-form/index.tsx b/src/admin/automations/automations-form/automations-general-form/index.tsx index a6351b3..b2e2cbd 100644 --- a/src/admin/automations/automations-form/automations-general-form/index.tsx +++ b/src/admin/automations/automations-form/automations-general-form/index.tsx @@ -3,11 +3,12 @@ import { Label, Select, Checkbox, + Text, } from "@medusajs/ui" import { useAvailableEvents } from "../../../../hooks/api/available-events" import { useAvailableTriggers } from "../../../../hooks/api/available-triggers" import { useAvailableActions } from "../../../../hooks/api/available-actions" -import { Controller } from "react-hook-form" +import { Controller, useWatch } from "react-hook-form" import { useMemo } from "react" export function AutomationsGeneralForm({ @@ -52,6 +53,16 @@ export function AutomationsGeneralForm({ return availableActionsData?.actions || [] }, [availableActionsData]) + // Watch trigger_type to show/hide interval_seconds field + const triggerType = useWatch({ + control: form.control, + name: "general.trigger_type", + }) + + // Show interval field for event and schedule types + const showIntervalField = + triggerType === "event" || triggerType === "schedule" + return (
@@ -223,6 +234,53 @@ export function AutomationsGeneralForm({ )} />
+ {showIntervalField && ( +
+ + ( + <> + { + const value = e.target.value + field.onChange( + value === "" ? null : Number(value) + ) + }} + /> + + {triggerType === "schedule" + ? "How often to run this automation" + : "Optional: Limit how often this automation can run for the same target (e.g., 3600 = max once per hour)"} + + {fieldState.error && ( + + {fieldState.error.message} + + )} + + )} + /> +
+ )}
diff --git a/src/admin/automations/automations-form/types/schema.ts b/src/admin/automations/automations-form/types/schema.ts index 2e6dc6a..cdba324 100644 --- a/src/admin/automations/automations-form/types/schema.ts +++ b/src/admin/automations/automations-form/types/schema.ts @@ -13,7 +13,7 @@ export const baseAutomationFormSchema = z.object({ .min(3, "Description must be at least 3 characters"), trigger_type: z.enum(["event", "schedule", "manual"]), event_name: z.string().min(1, "Event name is required"), - interval_minutes: z.number().nullable(), + interval_seconds: z.number().nullable(), active: z.boolean(), }), rules: z diff --git a/src/api/middlewares.ts b/src/api/middlewares.ts index 6393186..367d303 100644 --- a/src/api/middlewares.ts +++ b/src/api/middlewares.ts @@ -128,7 +128,7 @@ export default defineMiddlewares({ "trigger_id", "trigger_type", "event_name", - "interval_minutes", + "interval_seconds", "channels", "metadata", "active", diff --git a/src/modules/mpn-automation/migrations/.snapshot-medusa-mpn-automation.json b/src/modules/mpn-automation/migrations/.snapshot-medusa-mpn-automation.json index b90e4a3..4bf5b2c 100644 --- a/src/modules/mpn-automation/migrations/.snapshot-medusa-mpn-automation.json +++ b/src/modules/mpn-automation/migrations/.snapshot-medusa-mpn-automation.json @@ -56,8 +56,8 @@ "nullable": true, "mappedType": "text" }, - "interval_minutes": { - "name": "interval_minutes", + "interval_seconds": { + "name": "interval_seconds", "type": "integer", "unsigned": false, "autoincrement": false, diff --git a/src/modules/mpn-automation/migrations/Migration20251222121805.ts b/src/modules/mpn-automation/migrations/Migration20251222121805.ts new file mode 100644 index 0000000..1f685db --- /dev/null +++ b/src/modules/mpn-automation/migrations/Migration20251222121805.ts @@ -0,0 +1,13 @@ +import { Migration } from '@mikro-orm/migrations'; + +export class Migration20251222121805 extends Migration { + + override async up(): Promise { + this.addSql(`alter table if exists "mpn_automation_trigger" rename column "interval_minutes" to "interval_seconds";`); + } + + override async down(): Promise { + this.addSql(`alter table if exists "mpn_automation_trigger" rename column "interval_seconds" to "interval_minutes";`); + } + +} diff --git a/src/modules/mpn-automation/models/mpn_automation_trigger.ts b/src/modules/mpn-automation/models/mpn_automation_trigger.ts index 9f59ee4..e8339ac 100644 --- a/src/modules/mpn-automation/models/mpn_automation_trigger.ts +++ b/src/modules/mpn-automation/models/mpn_automation_trigger.ts @@ -23,8 +23,8 @@ export const MpnAutomationTrigger = model // Event name — only when trigger_type = "event" event_name: model.text().nullable(), - // Interval in minutes — only when trigger_type = "schedule" - interval_minutes: model.number().nullable(), + // Interval in seconds — only when trigger_type = "schedule" + interval_seconds: model.number().nullable(), // Whether the trigger is enabled active: model.boolean().default(true), diff --git a/src/modules/mpn-automation/types/interfaces.ts b/src/modules/mpn-automation/types/interfaces.ts index bd97c67..6cda1cd 100644 --- a/src/modules/mpn-automation/types/interfaces.ts +++ b/src/modules/mpn-automation/types/interfaces.ts @@ -29,7 +29,7 @@ export interface AutomationTrigger { description: string | null trigger_type: TriggerType event_name: string | null - interval_minutes: number | null + interval_seconds: number | null active: boolean channels: Record | null metadata: Record | null diff --git a/src/workflows/mpn-automation/steps/create-automation.ts b/src/workflows/mpn-automation/steps/create-automation.ts index 96ad1d2..4e2c990 100644 --- a/src/workflows/mpn-automation/steps/create-automation.ts +++ b/src/workflows/mpn-automation/steps/create-automation.ts @@ -26,7 +26,7 @@ export const createAutomationStep = createStep( description: item.description, trigger_type: item.trigger_type, event_name: item.event_name, - interval_minutes: item.interval_minutes, + interval_seconds: item.interval_seconds, active: item.active, channels: item.channels, })) diff --git a/src/workflows/mpn-automation/steps/edit-automation.ts b/src/workflows/mpn-automation/steps/edit-automation.ts index 969d10b..580755e 100644 --- a/src/workflows/mpn-automation/steps/edit-automation.ts +++ b/src/workflows/mpn-automation/steps/edit-automation.ts @@ -27,7 +27,7 @@ export const editAutomationStep = createStep( description: item.description, trigger_type: item.trigger_type, event_name: item.event_name, - interval_minutes: item.interval_minutes, + interval_seconds: item.interval_seconds, active: item.active, channels: item.channels, })) diff --git a/src/workflows/mpn-automation/steps/retrieve-automation-triggers-by-event.ts b/src/workflows/mpn-automation/steps/retrieve-automation-triggers-by-event.ts index 48df6b7..957ab36 100644 --- a/src/workflows/mpn-automation/steps/retrieve-automation-triggers-by-event.ts +++ b/src/workflows/mpn-automation/steps/retrieve-automation-triggers-by-event.ts @@ -60,7 +60,7 @@ export const getAutomationTriggersByEventStep = createStep( description: trigger.description, trigger_type: trigger.trigger_type, event_name: trigger.event_name, - interval_minutes: trigger.interval_minutes, + interval_seconds: trigger.interval_seconds, active: trigger.active, channels: trigger.channels, metadata: trigger.metadata, From 440c6179a6c978ac21768dcf3d1547892b9c9e59 Mon Sep 17 00:00:00 2001 From: Krzysztof Polak Date: Mon, 22 Dec 2025 13:59:36 +0100 Subject: [PATCH 07/16] refactor: add automation workflow with throttle validation and update related interfaces --- .../automations-general-form/index.tsx | 9 +- .../migrations/Migration20251222121805.ts | 12 +- .../mpn-automation/run-automation.ts | 91 +++++++---- src/workflows/mpn-automation/steps/index.ts | 1 + .../steps/validate-trigger-throttle.ts | 143 ++++++++++++++++++ 5 files changed, 223 insertions(+), 33 deletions(-) create mode 100644 src/workflows/mpn-automation/steps/validate-trigger-throttle.ts diff --git a/src/admin/automations/automations-form/automations-general-form/index.tsx b/src/admin/automations/automations-form/automations-general-form/index.tsx index b2e2cbd..b8685a0 100644 --- a/src/admin/automations/automations-form/automations-general-form/index.tsx +++ b/src/admin/automations/automations-form/automations-general-form/index.tsx @@ -236,7 +236,10 @@ export function AutomationsGeneralForm({ {showIntervalField && (
-
)} {fields.map((field, index) => ( -
-
-
- ( - <> - - - {fieldState.error && ( - - {fieldState.error.message} - - )} - - )} - /> - ( - <> - - - {fieldState.error && ( - - {fieldState.error.message} - - )} - - )} - /> - -
- -
-
+ control={form.control} + index={index} + eventAttributes={eventAttributes} + onRemove={() => handleRemoveRule(index)} + /> ))} + + + ) +} + From 78eea718eee0501821dfa4b57f8dd902aacc6d5e Mon Sep 17 00:00:00 2001 From: Krzysztof Polak Date: Sat, 27 Dec 2025 18:14:13 +0100 Subject: [PATCH 16/16] chore: update the medusa-plugin-notification-emails to 0.1.0 version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ecac960..da3ea1f 100755 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ }, "devDependencies": { "@changesets/cli": "^2.29.8", - "@codee-sh/medusa-plugin-notification-emails": "0.0.2", + "@codee-sh/medusa-plugin-notification-emails": "0.1.0", "@medusajs/admin-sdk": "2.8.8", "@medusajs/cli": "2.8.8", "@medusajs/framework": "2.8.8",