@codee-sh/medusa-plugin-automations 1.0.6 → 1.0.8
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/.medusa/server/src/admin/_chunks/{__admin-extensions__-BD2AvjDH → __admin-extensions__-BNGTajTJ} +8057 -384
- package/.medusa/server/src/admin/_chunks/{__admin-extensions__-BxUQA9oD → __admin-extensions__-DBUaxMhv} +8097 -408
- package/.medusa/server/src/admin/_chunks/base-config-CGvQmkNR +414 -0
- package/.medusa/server/src/admin/_chunks/base-config-ClmYhVFu +414 -0
- package/.medusa/server/src/admin/index.js +1 -1
- package/.medusa/server/src/admin/index.mjs +1 -1
- package/.medusa/server/src/api/admin/mpn/automations/available-actions/route.js +1 -1
- package/.medusa/server/src/api/admin/mpn/automations/rules/route.js +11 -2
- package/.medusa/server/src/api/middlewares.js +1 -1
- package/.medusa/server/src/modules/mpn-automation/migrations/Migration20251217190839.js +14 -0
- package/.medusa/server/src/modules/mpn-automation/migrations/Migration20251222121805.js +14 -0
- package/.medusa/server/src/modules/mpn-automation/models/mpn_automation_rule_value.js +3 -2
- package/.medusa/server/src/modules/mpn-automation/models/mpn_automation_trigger.js +2 -2
- package/.medusa/server/src/modules/mpn-automation/services/base-action-service.js +1 -1
- package/.medusa/server/src/modules/mpn-automation/services/email-action-service.js +2 -2
- package/.medusa/server/src/modules/mpn-automation/services/service.js +20 -9
- package/.medusa/server/src/modules/mpn-automation/services/slack-action-service.js +12 -2
- package/.medusa/server/src/modules/mpn-automation/types/modules/index.js +182 -5
- package/.medusa/server/src/modules/mpn-automation/types/modules/inventory/inventory.js +54 -2
- package/.medusa/server/src/modules/mpn-automation/types/modules/order/helpers.js +28 -0
- package/.medusa/server/src/modules/mpn-automation/types/modules/order/index.js +18 -0
- package/.medusa/server/src/modules/mpn-automation/types/modules/order/order.js +560 -0
- package/.medusa/server/src/modules/mpn-automation/types/modules/product/helpers.js +9 -0
- package/.medusa/server/src/modules/mpn-automation/types/modules/product/product.js +228 -2
- package/.medusa/server/src/modules/mpn-automation/types/modules/product-category/index.js +18 -0
- package/.medusa/server/src/modules/mpn-automation/types/modules/product-category/product-category.js +75 -0
- package/.medusa/server/src/modules/mpn-automation/types/modules/product-tag/index.js +18 -0
- package/.medusa/server/src/modules/mpn-automation/types/modules/product-tag/product-tag.js +39 -0
- package/.medusa/server/src/modules/mpn-automation/types/modules/product-type/index.js +18 -0
- package/.medusa/server/src/modules/mpn-automation/types/modules/product-type/product-type.js +39 -0
- package/.medusa/server/src/modules/mpn-automation/types/modules/product-variant/product-variant.js +111 -2
- package/.medusa/server/src/modules/mpn-automation/types/types.js +32 -2
- package/.medusa/server/src/providers/slack/service.js +1 -1
- package/.medusa/server/src/subscribers/inventory-level-updated.js +2 -2
- package/.medusa/server/src/subscribers/inventory-reservation-item-updated.js +1 -1
- package/.medusa/server/src/subscribers/mpn.automation.action.email.executed.js +3 -3
- package/.medusa/server/src/subscribers/mpn.automation.action.slack.executed.js +4 -4
- package/.medusa/server/src/subscribers/order-placed.js +1 -1
- package/.medusa/server/src/subscribers/order-updated.js +36 -0
- package/.medusa/server/src/subscribers/product-updated.js +2 -1
- package/.medusa/server/src/templates/slack/inventory-level/inventory-level.js +1 -1
- package/.medusa/server/src/templates/slack/inventory-level/translations/index.js +1 -1
- package/.medusa/server/src/templates/slack/order/base-order.js +57 -0
- package/.medusa/server/src/templates/slack/order/index.js +23 -0
- package/.medusa/server/src/templates/slack/order/order-archived.js +13 -0
- package/.medusa/server/src/templates/slack/order/order-canceled.js +13 -0
- package/.medusa/server/src/templates/slack/order/order-completed.js +13 -0
- package/.medusa/server/src/templates/slack/order/order-placed.js +13 -0
- package/.medusa/server/src/templates/slack/order/order-updated.js +13 -0
- package/.medusa/server/src/templates/slack/order/order.js +52 -0
- package/.medusa/server/src/templates/slack/order/translations/en.json +38 -0
- package/.medusa/server/src/templates/slack/order/translations/index.js +15 -0
- package/.medusa/server/src/templates/slack/order/translations/pl.json +38 -0
- package/.medusa/server/src/templates/slack/product/product.js +2 -3
- package/.medusa/server/src/templates/slack/product/translations/index.js +1 -1
- package/.medusa/server/src/templates/slack/product-variant/product-variant.js +2 -3
- package/.medusa/server/src/templates/slack/product-variant/translations/index.js +1 -1
- package/.medusa/server/src/utils/attribute-helpers.js +17 -0
- package/.medusa/server/src/utils/i18n/i18n.js +13 -8
- package/.medusa/server/src/utils/index.js +2 -1
- package/.medusa/server/src/utils/validate-rules.js +40 -3
- package/.medusa/server/src/workflows/index.js +2 -1
- package/.medusa/server/src/workflows/inventory/steps/get-inventory-level-by-id.js +6 -14
- package/.medusa/server/src/workflows/mpn-automation/index.js +2 -2
- package/.medusa/server/src/workflows/mpn-automation/run-automation.js +53 -10
- package/.medusa/server/src/workflows/mpn-automation/run-email-action.js +6 -2
- package/.medusa/server/src/workflows/mpn-automation/run-slack-action.js +6 -2
- package/.medusa/server/src/workflows/mpn-automation/steps/create-automation.js +1 -1
- package/.medusa/server/src/workflows/mpn-automation/steps/edit-automation-actions.js +3 -2
- package/.medusa/server/src/workflows/mpn-automation/steps/edit-automation-rules.js +1 -1
- package/.medusa/server/src/workflows/mpn-automation/steps/edit-automation.js +1 -1
- package/.medusa/server/src/workflows/mpn-automation/steps/index.js +3 -2
- package/.medusa/server/src/workflows/mpn-automation/steps/retrieve-automation-triggers-by-event.js +2 -2
- package/.medusa/server/src/workflows/mpn-automation/steps/run-automation-actions.js +1 -1
- package/.medusa/server/src/workflows/mpn-automation/steps/validate-trigger-throttle.js +78 -0
- package/.medusa/server/src/workflows/mpn-automation/steps/validate-triggers-rules.js +31 -0
- package/.medusa/server/src/workflows/mpn-automation/validate-triggers-by-event.js +38 -0
- package/.medusa/server/src/workflows/notifications/steps/send-email.js +2 -2
- package/.medusa/server/src/workflows/notifications/steps/send-slack.js +1 -1
- package/.medusa/server/src/workflows/order/get-order-by-id.js +23 -0
- package/.medusa/server/src/workflows/order/index.js +18 -0
- package/.medusa/server/src/workflows/order/steps/get-order-by-id.js +40 -0
- package/.medusa/server/src/workflows/order/steps/index.js +18 -0
- package/.medusa/server/src/workflows/product/steps/get-product-by-id.js +6 -46
- package/.medusa/server/src/workflows/product-variant/steps/get-product-variant-by-id.js +2 -10
- package/README.md +18 -15
- package/package.json +12 -3
- package/.medusa/server/src/admin/_chunks/base-config-ON0ZG0Je +0 -7890
- package/.medusa/server/src/admin/_chunks/base-config-XI6iR6Jp +0 -7907
- package/.medusa/server/src/workflows/mpn-automation/steps/validate-automation-triggers.js +0 -31
- package/.medusa/server/src/workflows/mpn-automation/validate-automation-triggers-by-event.js +0 -38
package/README.md
CHANGED
|
@@ -4,15 +4,13 @@ A comprehensive automation plugin for Medusa v2 that provides a flexible rule-ba
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Automation Triggers**: Create automations triggered by events, schedules, or manual actions
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **Multiple Action Types**: Execute various actions including email notifications, Slack messages, SMS, push notifications, and custom actions
|
|
11
|
-
- **Event Subscribers**: Built-in subscribers for common Medusa events (
|
|
12
|
-
- **Admin Panel**: Manage automations directly from Medusa Admin
|
|
13
|
-
- **
|
|
14
|
-
- **Slack Notifications**: Rich Slack notifications with Block Kit support including headers, action buttons, and dividers
|
|
15
|
-
- **Extensible Actions**: Add custom action handlers to extend automation capabilities
|
|
7
|
+
- **Automation Triggers**: Create automations triggered by events, schedules, or manual actions ([see details](#automation-triggers))
|
|
8
|
+
- **Rule-Based Conditions**: Define complex conditions with support for arrays, relations, and multiple data types ([see details](#rules-and-conditions))
|
|
9
|
+
- **Rich Attribute Support**: Pre-configured attributes for Products, Variants, Tags, Categories, and Inventory ([see available attributes](./docs/configuration.md#available-attributes-reference))
|
|
10
|
+
- **Multiple Action Types**: Execute various actions including email notifications, Slack messages, SMS, push notifications, and custom actions ([see details](#actions))
|
|
11
|
+
- **Event Subscribers**: Built-in subscribers for common Medusa events ([see available events](./docs/configuration.md#available-subscribers))
|
|
12
|
+
- **Admin Panel**: Manage automations directly from Medusa Admin ([see details](#admin-panel))
|
|
13
|
+
- **Extensible**: Add custom action handlers and extend automation capabilities
|
|
16
14
|
- **Type-Safe**: Full TypeScript support with exported types and workflows
|
|
17
15
|
|
|
18
16
|
## Compatibility
|
|
@@ -50,6 +48,8 @@ The plugin includes database migrations for automation models. Run migrations to
|
|
|
50
48
|
medusa migrations run
|
|
51
49
|
```
|
|
52
50
|
|
|
51
|
+
See [Database Migrations](./docs/configuration.md#database-migrations) for more details about the created tables.
|
|
52
|
+
|
|
53
53
|
### 3. Access Admin Panel
|
|
54
54
|
|
|
55
55
|
Navigate to **Notifications > Automations** in your Medusa Admin dashboard, or directly access:
|
|
@@ -63,17 +63,20 @@ Navigate to **Notifications > Automations** in your Medusa Admin dashboard, or d
|
|
|
63
63
|
### Automation Triggers
|
|
64
64
|
|
|
65
65
|
Automations are triggered by:
|
|
66
|
-
- **Events**: Medusa events (e.g., `inventory.inventory-level.updated`, `
|
|
66
|
+
- **Events**: Medusa events (e.g., `inventory.inventory-level.updated`, `product.updated`)
|
|
67
67
|
- **Schedule**: Time-based triggers with configurable intervals (In progress)
|
|
68
68
|
- **Manual**: Triggered manually from the admin panel
|
|
69
69
|
|
|
70
|
+
See [Available Subscribers](./docs/configuration.md#available-subscribers) in the configuration documentation for a complete list of supported events.
|
|
71
|
+
|
|
70
72
|
### Rules and Conditions
|
|
71
73
|
|
|
72
|
-
Each automation can have multiple rules that define when actions should be executed
|
|
74
|
+
Each automation can have multiple rules that define when actions should be executed. Rules support primitive fields, relations (arrays), nested objects, and various operators for complex conditions.
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
76
|
+
For detailed information, see:
|
|
77
|
+
- [Available Attributes Reference](./docs/configuration.md#available-attributes-reference) - Complete list of attributes for each event type
|
|
78
|
+
- [Rule Operators](./docs/configuration.md#rule-operators) - All supported operators with examples
|
|
79
|
+
- [Rule Values](./docs/configuration.md#rule-values) - Supported data types and usage
|
|
77
80
|
|
|
78
81
|
### Actions
|
|
79
82
|
|
|
@@ -83,7 +86,7 @@ When automation rules pass, actions are executed. Supported action types include
|
|
|
83
86
|
- **Slack**: Send Slack messages with Block Kit formatting
|
|
84
87
|
- **Custom**: Extend with custom action handlers
|
|
85
88
|
|
|
86
|
-
See [
|
|
89
|
+
See [Actions](./docs/configuration.md#actions) and [Slack Notification Provider](./docs/configuration.md#slack-notification-provider) in the configuration documentation for details on configuring and extending actions.
|
|
87
90
|
|
|
88
91
|
## Admin Panel
|
|
89
92
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codee-sh/medusa-plugin-automations",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Medusa plugin for automations.",
|
|
5
5
|
"author": "Codee (https://codee.dev)",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/codee-sh/medusa-plugin-automations.git"
|
|
10
|
+
},
|
|
7
11
|
"publishConfig": {
|
|
8
12
|
"access": "public"
|
|
9
13
|
},
|
|
@@ -30,7 +34,9 @@
|
|
|
30
34
|
"plugin",
|
|
31
35
|
"medusa-plugin-automations",
|
|
32
36
|
"medusa-plugin",
|
|
33
|
-
"medusa-v2"
|
|
37
|
+
"medusa-v2",
|
|
38
|
+
"medusa-plugin-integration",
|
|
39
|
+
"medusa-plugin-other"
|
|
34
40
|
],
|
|
35
41
|
"scripts": {
|
|
36
42
|
"build": "medusa plugin:build",
|
|
@@ -47,6 +53,7 @@
|
|
|
47
53
|
},
|
|
48
54
|
"devDependencies": {
|
|
49
55
|
"@changesets/cli": "^2.29.8",
|
|
56
|
+
"@codee-sh/medusa-plugin-notification-emails": "0.1.0",
|
|
50
57
|
"@medusajs/admin-sdk": "2.8.8",
|
|
51
58
|
"@medusajs/cli": "2.8.8",
|
|
52
59
|
"@medusajs/framework": "2.8.8",
|
|
@@ -64,6 +71,7 @@
|
|
|
64
71
|
"@types/react-dom": "^18.2.25",
|
|
65
72
|
"awilix": "^8.0.1",
|
|
66
73
|
"dotenv": "^17.2.3",
|
|
74
|
+
"prettier": "^3.0.0",
|
|
67
75
|
"prop-types": "^15.8.1",
|
|
68
76
|
"react": "^18.2.0",
|
|
69
77
|
"react-dom": "^18.2.0",
|
|
@@ -74,5 +82,6 @@
|
|
|
74
82
|
},
|
|
75
83
|
"engines": {
|
|
76
84
|
"node": ">=20"
|
|
77
|
-
}
|
|
85
|
+
},
|
|
86
|
+
"packageManager": "yarn@3.2.3+sha512.f26f951f67de0c6a33ee381e5ff364709c87e70eb5e65c694e4facde3512f1fa80b8679e6ba31ce7d340fbb46f08dd683af9457e240f25a204be7427940d767e"
|
|
78
87
|
}
|