@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.
Files changed (91) hide show
  1. package/.medusa/server/src/admin/_chunks/{__admin-extensions__-BD2AvjDH → __admin-extensions__-BNGTajTJ} +8057 -384
  2. package/.medusa/server/src/admin/_chunks/{__admin-extensions__-BxUQA9oD → __admin-extensions__-DBUaxMhv} +8097 -408
  3. package/.medusa/server/src/admin/_chunks/base-config-CGvQmkNR +414 -0
  4. package/.medusa/server/src/admin/_chunks/base-config-ClmYhVFu +414 -0
  5. package/.medusa/server/src/admin/index.js +1 -1
  6. package/.medusa/server/src/admin/index.mjs +1 -1
  7. package/.medusa/server/src/api/admin/mpn/automations/available-actions/route.js +1 -1
  8. package/.medusa/server/src/api/admin/mpn/automations/rules/route.js +11 -2
  9. package/.medusa/server/src/api/middlewares.js +1 -1
  10. package/.medusa/server/src/modules/mpn-automation/migrations/Migration20251217190839.js +14 -0
  11. package/.medusa/server/src/modules/mpn-automation/migrations/Migration20251222121805.js +14 -0
  12. package/.medusa/server/src/modules/mpn-automation/models/mpn_automation_rule_value.js +3 -2
  13. package/.medusa/server/src/modules/mpn-automation/models/mpn_automation_trigger.js +2 -2
  14. package/.medusa/server/src/modules/mpn-automation/services/base-action-service.js +1 -1
  15. package/.medusa/server/src/modules/mpn-automation/services/email-action-service.js +2 -2
  16. package/.medusa/server/src/modules/mpn-automation/services/service.js +20 -9
  17. package/.medusa/server/src/modules/mpn-automation/services/slack-action-service.js +12 -2
  18. package/.medusa/server/src/modules/mpn-automation/types/modules/index.js +182 -5
  19. package/.medusa/server/src/modules/mpn-automation/types/modules/inventory/inventory.js +54 -2
  20. package/.medusa/server/src/modules/mpn-automation/types/modules/order/helpers.js +28 -0
  21. package/.medusa/server/src/modules/mpn-automation/types/modules/order/index.js +18 -0
  22. package/.medusa/server/src/modules/mpn-automation/types/modules/order/order.js +560 -0
  23. package/.medusa/server/src/modules/mpn-automation/types/modules/product/helpers.js +9 -0
  24. package/.medusa/server/src/modules/mpn-automation/types/modules/product/product.js +228 -2
  25. package/.medusa/server/src/modules/mpn-automation/types/modules/product-category/index.js +18 -0
  26. package/.medusa/server/src/modules/mpn-automation/types/modules/product-category/product-category.js +75 -0
  27. package/.medusa/server/src/modules/mpn-automation/types/modules/product-tag/index.js +18 -0
  28. package/.medusa/server/src/modules/mpn-automation/types/modules/product-tag/product-tag.js +39 -0
  29. package/.medusa/server/src/modules/mpn-automation/types/modules/product-type/index.js +18 -0
  30. package/.medusa/server/src/modules/mpn-automation/types/modules/product-type/product-type.js +39 -0
  31. package/.medusa/server/src/modules/mpn-automation/types/modules/product-variant/product-variant.js +111 -2
  32. package/.medusa/server/src/modules/mpn-automation/types/types.js +32 -2
  33. package/.medusa/server/src/providers/slack/service.js +1 -1
  34. package/.medusa/server/src/subscribers/inventory-level-updated.js +2 -2
  35. package/.medusa/server/src/subscribers/inventory-reservation-item-updated.js +1 -1
  36. package/.medusa/server/src/subscribers/mpn.automation.action.email.executed.js +3 -3
  37. package/.medusa/server/src/subscribers/mpn.automation.action.slack.executed.js +4 -4
  38. package/.medusa/server/src/subscribers/order-placed.js +1 -1
  39. package/.medusa/server/src/subscribers/order-updated.js +36 -0
  40. package/.medusa/server/src/subscribers/product-updated.js +2 -1
  41. package/.medusa/server/src/templates/slack/inventory-level/inventory-level.js +1 -1
  42. package/.medusa/server/src/templates/slack/inventory-level/translations/index.js +1 -1
  43. package/.medusa/server/src/templates/slack/order/base-order.js +57 -0
  44. package/.medusa/server/src/templates/slack/order/index.js +23 -0
  45. package/.medusa/server/src/templates/slack/order/order-archived.js +13 -0
  46. package/.medusa/server/src/templates/slack/order/order-canceled.js +13 -0
  47. package/.medusa/server/src/templates/slack/order/order-completed.js +13 -0
  48. package/.medusa/server/src/templates/slack/order/order-placed.js +13 -0
  49. package/.medusa/server/src/templates/slack/order/order-updated.js +13 -0
  50. package/.medusa/server/src/templates/slack/order/order.js +52 -0
  51. package/.medusa/server/src/templates/slack/order/translations/en.json +38 -0
  52. package/.medusa/server/src/templates/slack/order/translations/index.js +15 -0
  53. package/.medusa/server/src/templates/slack/order/translations/pl.json +38 -0
  54. package/.medusa/server/src/templates/slack/product/product.js +2 -3
  55. package/.medusa/server/src/templates/slack/product/translations/index.js +1 -1
  56. package/.medusa/server/src/templates/slack/product-variant/product-variant.js +2 -3
  57. package/.medusa/server/src/templates/slack/product-variant/translations/index.js +1 -1
  58. package/.medusa/server/src/utils/attribute-helpers.js +17 -0
  59. package/.medusa/server/src/utils/i18n/i18n.js +13 -8
  60. package/.medusa/server/src/utils/index.js +2 -1
  61. package/.medusa/server/src/utils/validate-rules.js +40 -3
  62. package/.medusa/server/src/workflows/index.js +2 -1
  63. package/.medusa/server/src/workflows/inventory/steps/get-inventory-level-by-id.js +6 -14
  64. package/.medusa/server/src/workflows/mpn-automation/index.js +2 -2
  65. package/.medusa/server/src/workflows/mpn-automation/run-automation.js +53 -10
  66. package/.medusa/server/src/workflows/mpn-automation/run-email-action.js +6 -2
  67. package/.medusa/server/src/workflows/mpn-automation/run-slack-action.js +6 -2
  68. package/.medusa/server/src/workflows/mpn-automation/steps/create-automation.js +1 -1
  69. package/.medusa/server/src/workflows/mpn-automation/steps/edit-automation-actions.js +3 -2
  70. package/.medusa/server/src/workflows/mpn-automation/steps/edit-automation-rules.js +1 -1
  71. package/.medusa/server/src/workflows/mpn-automation/steps/edit-automation.js +1 -1
  72. package/.medusa/server/src/workflows/mpn-automation/steps/index.js +3 -2
  73. package/.medusa/server/src/workflows/mpn-automation/steps/retrieve-automation-triggers-by-event.js +2 -2
  74. package/.medusa/server/src/workflows/mpn-automation/steps/run-automation-actions.js +1 -1
  75. package/.medusa/server/src/workflows/mpn-automation/steps/validate-trigger-throttle.js +78 -0
  76. package/.medusa/server/src/workflows/mpn-automation/steps/validate-triggers-rules.js +31 -0
  77. package/.medusa/server/src/workflows/mpn-automation/validate-triggers-by-event.js +38 -0
  78. package/.medusa/server/src/workflows/notifications/steps/send-email.js +2 -2
  79. package/.medusa/server/src/workflows/notifications/steps/send-slack.js +1 -1
  80. package/.medusa/server/src/workflows/order/get-order-by-id.js +23 -0
  81. package/.medusa/server/src/workflows/order/index.js +18 -0
  82. package/.medusa/server/src/workflows/order/steps/get-order-by-id.js +40 -0
  83. package/.medusa/server/src/workflows/order/steps/index.js +18 -0
  84. package/.medusa/server/src/workflows/product/steps/get-product-by-id.js +6 -46
  85. package/.medusa/server/src/workflows/product-variant/steps/get-product-variant-by-id.js +2 -10
  86. package/README.md +18 -15
  87. package/package.json +12 -3
  88. package/.medusa/server/src/admin/_chunks/base-config-ON0ZG0Je +0 -7890
  89. package/.medusa/server/src/admin/_chunks/base-config-XI6iR6Jp +0 -7907
  90. package/.medusa/server/src/workflows/mpn-automation/steps/validate-automation-triggers.js +0 -31
  91. 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
- - **Automation Management**: Create, edit, and delete automation triggers with automatic cleanup of related data
9
- - **Rule-Based Conditions**: Define complex conditions using rule attributes (e.g., inventory levels, order status)
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 (inventory updates, order events, payment events)
12
- - **Admin Panel**: Manage automations directly from Medusa Admin
13
- - **Flexible Rules**: Support for multiple rule types and operators (equals, greater than, less than, contains, etc.)
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`, `order.placed`)
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
- - **Rule Attributes**: Available attributes for conditions
75
- - **Operators**: Comparison operators (equals, greater than, less than, contains, in, etc.)
76
- - **Rule Values**: Values to compare against
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 [Configuration Documentation](./docs/configuration.md) for details on built-in subscribers, available actions, and extending functionality.
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.6",
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
  }