@codee-sh/medusa-plugin-automations 1.0.7 → 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 (55) hide show
  1. package/.medusa/server/src/admin/_chunks/{__admin-extensions__-BgrPyL-G → __admin-extensions__-BNGTajTJ} +193 -115
  2. package/.medusa/server/src/admin/_chunks/{__admin-extensions__-Cc5RhzDh → __admin-extensions__-DBUaxMhv} +192 -114
  3. package/.medusa/server/src/admin/_chunks/{base-config-D8uDn9uc → base-config-CGvQmkNR} +1 -1
  4. package/.medusa/server/src/admin/_chunks/{base-config-zK3z6k14 → base-config-ClmYhVFu} +1 -1
  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/middlewares.js +1 -1
  8. package/.medusa/server/src/modules/mpn-automation/migrations/Migration20251222121805.js +14 -0
  9. package/.medusa/server/src/modules/mpn-automation/models/mpn_automation_trigger.js +2 -2
  10. package/.medusa/server/src/modules/mpn-automation/services/slack-action-service.js +11 -1
  11. package/.medusa/server/src/modules/mpn-automation/types/modules/index.js +148 -1
  12. package/.medusa/server/src/modules/mpn-automation/types/modules/inventory/inventory.js +40 -2
  13. package/.medusa/server/src/modules/mpn-automation/types/modules/order/helpers.js +28 -0
  14. package/.medusa/server/src/modules/mpn-automation/types/modules/order/index.js +18 -0
  15. package/.medusa/server/src/modules/mpn-automation/types/modules/order/order.js +560 -0
  16. package/.medusa/server/src/modules/mpn-automation/types/modules/product/helpers.js +9 -0
  17. package/.medusa/server/src/modules/mpn-automation/types/modules/product/product.js +89 -2
  18. package/.medusa/server/src/modules/mpn-automation/types/modules/product-category/product-category.js +31 -2
  19. package/.medusa/server/src/modules/mpn-automation/types/modules/product-tag/product-tag.js +19 -2
  20. package/.medusa/server/src/modules/mpn-automation/types/modules/product-type/product-type.js +19 -2
  21. package/.medusa/server/src/modules/mpn-automation/types/modules/product-variant/product-variant.js +51 -2
  22. package/.medusa/server/src/modules/mpn-automation/types/types.js +1 -1
  23. package/.medusa/server/src/subscribers/inventory-level-updated.js +2 -2
  24. package/.medusa/server/src/subscribers/order-updated.js +36 -0
  25. package/.medusa/server/src/templates/slack/order/base-order.js +57 -0
  26. package/.medusa/server/src/templates/slack/order/index.js +23 -0
  27. package/.medusa/server/src/templates/slack/order/order-archived.js +13 -0
  28. package/.medusa/server/src/templates/slack/order/order-canceled.js +13 -0
  29. package/.medusa/server/src/templates/slack/order/order-completed.js +13 -0
  30. package/.medusa/server/src/templates/slack/order/order-placed.js +13 -0
  31. package/.medusa/server/src/templates/slack/order/order-updated.js +13 -0
  32. package/.medusa/server/src/templates/slack/order/order.js +52 -0
  33. package/.medusa/server/src/templates/slack/order/translations/en.json +38 -0
  34. package/.medusa/server/src/templates/slack/order/translations/index.js +15 -0
  35. package/.medusa/server/src/templates/slack/order/translations/pl.json +38 -0
  36. package/.medusa/server/src/workflows/index.js +2 -1
  37. package/.medusa/server/src/workflows/inventory/steps/get-inventory-level-by-id.js +3 -3
  38. package/.medusa/server/src/workflows/mpn-automation/index.js +2 -2
  39. package/.medusa/server/src/workflows/mpn-automation/run-automation.js +53 -10
  40. package/.medusa/server/src/workflows/mpn-automation/steps/create-automation.js +1 -1
  41. package/.medusa/server/src/workflows/mpn-automation/steps/edit-automation.js +1 -1
  42. package/.medusa/server/src/workflows/mpn-automation/steps/index.js +3 -2
  43. package/.medusa/server/src/workflows/mpn-automation/steps/retrieve-automation-triggers-by-event.js +1 -1
  44. package/.medusa/server/src/workflows/mpn-automation/steps/run-automation-actions.js +1 -1
  45. package/.medusa/server/src/workflows/mpn-automation/steps/validate-trigger-throttle.js +78 -0
  46. package/.medusa/server/src/workflows/mpn-automation/steps/validate-triggers-rules.js +31 -0
  47. package/.medusa/server/src/workflows/mpn-automation/validate-triggers-by-event.js +38 -0
  48. package/.medusa/server/src/workflows/order/get-order-by-id.js +23 -0
  49. package/.medusa/server/src/workflows/order/index.js +18 -0
  50. package/.medusa/server/src/workflows/order/steps/get-order-by-id.js +40 -0
  51. package/.medusa/server/src/workflows/order/steps/index.js +18 -0
  52. package/.medusa/server/src/workflows/product/steps/get-product-by-id.js +3 -3
  53. package/package.json +2 -2
  54. package/.medusa/server/src/workflows/mpn-automation/steps/validate-automation-triggers.js +0 -31
  55. package/.medusa/server/src/workflows/mpn-automation/validate-automation-triggers-by-event.js +0 -38
@@ -5339,6 +5339,11 @@ function AutomationsGeneralForm({
5339
5339
  React.useMemo(() => {
5340
5340
  return (availableActionsData == null ? void 0 : availableActionsData.actions) || [];
5341
5341
  }, [availableActionsData]);
5342
+ const triggerType = useWatch({
5343
+ control: form.control,
5344
+ name: "general.trigger_type"
5345
+ });
5346
+ const showIntervalField = triggerType === "event" || triggerType === "schedule";
5342
5347
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6 max-w-2xl mx-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
5343
5348
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
5344
5349
  /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "name", className: "block", children: "Name" }),
@@ -5483,6 +5488,50 @@ function AutomationsGeneralForm({
5483
5488
  ] })
5484
5489
  }
5485
5490
  )
5491
+ ] }),
5492
+ showIntervalField && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
5493
+ /* @__PURE__ */ jsxRuntime.jsx(
5494
+ ui.Label,
5495
+ {
5496
+ htmlFor: "interval_seconds",
5497
+ className: "block",
5498
+ children: triggerType === "schedule" ? "Interval (seconds)" : "Throttle (seconds)"
5499
+ }
5500
+ ),
5501
+ /* @__PURE__ */ jsxRuntime.jsx(
5502
+ Controller,
5503
+ {
5504
+ name: "general.interval_seconds",
5505
+ control: form.control,
5506
+ render: ({ field, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5507
+ /* @__PURE__ */ jsxRuntime.jsx(
5508
+ ui.Input,
5509
+ {
5510
+ ...field,
5511
+ type: "number",
5512
+ min: 0,
5513
+ placeholder: triggerType === "schedule" ? "Run every X seconds" : "Minimum seconds between executions",
5514
+ value: field.value ?? "",
5515
+ onChange: (e2) => {
5516
+ const value = e2.target.value;
5517
+ field.onChange(
5518
+ value === "" ? null : Number(value)
5519
+ );
5520
+ }
5521
+ }
5522
+ ),
5523
+ /* @__PURE__ */ jsxRuntime.jsx(
5524
+ ui.Text,
5525
+ {
5526
+ size: "small",
5527
+ className: "text-ui-fg-subtle",
5528
+ children: 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)"
5529
+ }
5530
+ ),
5531
+ fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
5532
+ ] })
5533
+ }
5534
+ )
5486
5535
  ] })
5487
5536
  ] }) }) });
5488
5537
  }
@@ -9128,7 +9177,7 @@ const baseAutomationFormSchema = objectType({
9128
9177
  description: stringType().min(1, "Description is required").min(3, "Description must be at least 3 characters"),
9129
9178
  trigger_type: enumType(["event", "schedule", "manual"]),
9130
9179
  event_name: stringType().min(1, "Event name is required"),
9131
- interval_minutes: numberType().nullable(),
9180
+ interval_seconds: numberType().nullable(),
9132
9181
  active: booleanType()
9133
9182
  }),
9134
9183
  rules: objectType({
@@ -9253,7 +9302,7 @@ function AutomationsCreateForm() {
9253
9302
  description: "",
9254
9303
  trigger_type: "event",
9255
9304
  event_name: "",
9256
- interval_minutes: null,
9305
+ interval_seconds: null,
9257
9306
  active: false
9258
9307
  },
9259
9308
  rules: {
@@ -9272,7 +9321,7 @@ function AutomationsCreateForm() {
9272
9321
  description: "",
9273
9322
  trigger_type: "event",
9274
9323
  event_name: "",
9275
- interval_minutes: null,
9324
+ interval_seconds: null,
9276
9325
  active: false
9277
9326
  },
9278
9327
  rules: {
@@ -9291,7 +9340,7 @@ function AutomationsCreateForm() {
9291
9340
  description: data.general.description,
9292
9341
  trigger_type: data.general.trigger_type,
9293
9342
  event_name: data.general.event_name,
9294
- interval_minutes: data.general.interval_minutes,
9343
+ interval_seconds: data.general.interval_seconds,
9295
9344
  active: data.general.active
9296
9345
  };
9297
9346
  await createAutomation({
@@ -17081,6 +17130,133 @@ function RuleValueInput({
17081
17130
  }
17082
17131
  );
17083
17132
  }
17133
+ function RuleItem({
17134
+ control,
17135
+ index,
17136
+ eventAttributes,
17137
+ onRemove
17138
+ }) {
17139
+ const selectedAttributeValue = useWatch({
17140
+ control,
17141
+ name: `rules.items.${index}.attribute`
17142
+ });
17143
+ const operatorValue = useWatch({
17144
+ control,
17145
+ name: `rules.items.${index}.operator`
17146
+ });
17147
+ const selectedAttribute = selectedAttributeValue && eventAttributes.length ? eventAttributes.find(
17148
+ (attr) => attr.value === selectedAttributeValue
17149
+ ) : null;
17150
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2 p-4 border rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4", children: [
17151
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col gap-2", children: [
17152
+ /* @__PURE__ */ jsxRuntime.jsx(
17153
+ Controller,
17154
+ {
17155
+ name: `rules.items.${index}.attribute`,
17156
+ control,
17157
+ render: ({ field, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17158
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Attribute" }),
17159
+ /* @__PURE__ */ jsxRuntime.jsxs(
17160
+ ui.Select,
17161
+ {
17162
+ value: field.value ?? "",
17163
+ onValueChange: (value) => {
17164
+ field.onChange(value);
17165
+ },
17166
+ children: [
17167
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select the attribute" }) }),
17168
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: eventAttributes.map((attribute, attrIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
17169
+ ui.Select.Item,
17170
+ {
17171
+ value: attribute.value || "",
17172
+ children: [
17173
+ attribute.label,
17174
+ " ",
17175
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-gray-500", children: [
17176
+ "(",
17177
+ attribute.value,
17178
+ ")"
17179
+ ] })
17180
+ ]
17181
+ },
17182
+ attribute.value || `attr-${index}-${attrIndex}`
17183
+ )) })
17184
+ ]
17185
+ },
17186
+ `attribute-${index}-${eventAttributes.length}`
17187
+ ),
17188
+ fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message }),
17189
+ (selectedAttribute == null ? void 0 : selectedAttribute.description) && /* @__PURE__ */ jsxRuntime.jsx(ui.Hint, { className: "mt-1", children: selectedAttribute.description })
17190
+ ] })
17191
+ }
17192
+ ),
17193
+ /* @__PURE__ */ jsxRuntime.jsx(
17194
+ Controller,
17195
+ {
17196
+ name: `rules.items.${index}.operator`,
17197
+ control,
17198
+ render: ({ field, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17199
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Operator" }),
17200
+ /* @__PURE__ */ jsxRuntime.jsxs(
17201
+ ui.Select,
17202
+ {
17203
+ value: field.value ?? "",
17204
+ onValueChange: (value) => {
17205
+ field.onChange(value);
17206
+ },
17207
+ children: [
17208
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select the operator" }) }),
17209
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: OPERATOR_TYPES.map((operator, opIndex) => /* @__PURE__ */ jsxRuntime.jsx(
17210
+ ui.Select.Item,
17211
+ {
17212
+ value: operator.value,
17213
+ children: operator.label
17214
+ },
17215
+ operator.value || `op-${opIndex}`
17216
+ )) })
17217
+ ]
17218
+ },
17219
+ `operator-${index}-${eventAttributes.length}-${field.value ?? ""}`
17220
+ ),
17221
+ fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
17222
+ ] })
17223
+ }
17224
+ ),
17225
+ /* @__PURE__ */ jsxRuntime.jsx(
17226
+ RuleValueInput,
17227
+ {
17228
+ control,
17229
+ name: `rules.items.${index}.rule_values.0.value`,
17230
+ operator: operatorValue
17231
+ }
17232
+ ),
17233
+ (selectedAttribute == null ? void 0 : selectedAttribute.examples) && selectedAttribute.examples.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-0", children: [
17234
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", className: "text-gray-600 mb-1", children: "Examples:" }),
17235
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: selectedAttribute.examples.map(
17236
+ (example, exampleIndex) => /* @__PURE__ */ jsxRuntime.jsx(
17237
+ "span",
17238
+ {
17239
+ className: "inline-flex items-center px-2 py-1 rounded-md bg-gray-100 text-xs text-gray-700",
17240
+ children: example
17241
+ },
17242
+ `example-${index}-${exampleIndex}`
17243
+ )
17244
+ ) })
17245
+ ] })
17246
+ ] }),
17247
+ /* @__PURE__ */ jsxRuntime.jsx(
17248
+ ui.Button,
17249
+ {
17250
+ type: "button",
17251
+ variant: "secondary",
17252
+ size: "small",
17253
+ onClick: onRemove,
17254
+ className: "mt-2",
17255
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
17256
+ }
17257
+ )
17258
+ ] }) });
17259
+ }
17084
17260
  function AutomationsRulesForm({
17085
17261
  form,
17086
17262
  isOpen
@@ -17131,110 +17307,12 @@ function AutomationsRulesForm({
17131
17307
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6 max-w-2xl mx-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
17132
17308
  fields.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-500 text-center py-4", children: 'No rules added yet. Click "Add Item" to create a new rule.' }),
17133
17309
  fields.map((field, index) => /* @__PURE__ */ jsxRuntime.jsx(
17134
- "div",
17310
+ RuleItem,
17135
17311
  {
17136
- className: "flex flex-col gap-2 p-4 border rounded-lg",
17137
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4", children: [
17138
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col gap-2", children: [
17139
- /* @__PURE__ */ jsxRuntime.jsx(
17140
- Controller,
17141
- {
17142
- name: `rules.items.${index}.attribute`,
17143
- control: form.control,
17144
- render: ({ field: field2, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17145
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Attribute" }),
17146
- /* @__PURE__ */ jsxRuntime.jsxs(
17147
- ui.Select,
17148
- {
17149
- value: field2.value ?? "",
17150
- onValueChange: (value) => {
17151
- field2.onChange(value);
17152
- },
17153
- children: [
17154
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select the attribute" }) }),
17155
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: eventAttributes.map(
17156
- (attribute, attrIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
17157
- ui.Select.Item,
17158
- {
17159
- value: attribute.value || "ss",
17160
- children: [
17161
- attribute.label,
17162
- " ",
17163
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-gray-500", children: [
17164
- "(",
17165
- attribute.value,
17166
- ")"
17167
- ] })
17168
- ]
17169
- },
17170
- attribute.value || `attr-${index}-${attrIndex}`
17171
- )
17172
- ) })
17173
- ]
17174
- },
17175
- `attribute-${index}-${eventAttributes.length}`
17176
- ),
17177
- fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
17178
- ] })
17179
- }
17180
- ),
17181
- /* @__PURE__ */ jsxRuntime.jsx(
17182
- Controller,
17183
- {
17184
- name: `rules.items.${index}.operator`,
17185
- control: form.control,
17186
- render: ({ field: field2, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17187
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Operator" }),
17188
- /* @__PURE__ */ jsxRuntime.jsxs(
17189
- ui.Select,
17190
- {
17191
- value: field2.value ?? "",
17192
- onValueChange: (value) => {
17193
- field2.onChange(value);
17194
- },
17195
- children: [
17196
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select the operator" }) }),
17197
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: OPERATOR_TYPES.map(
17198
- (operator, opIndex) => /* @__PURE__ */ jsxRuntime.jsx(
17199
- ui.Select.Item,
17200
- {
17201
- value: operator.value,
17202
- children: operator.label
17203
- },
17204
- operator.value || `op-${opIndex}`
17205
- )
17206
- ) })
17207
- ]
17208
- },
17209
- `operator-${index}-${eventAttributes.length}-${field2.value ?? ""}`
17210
- ),
17211
- fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
17212
- ] })
17213
- }
17214
- ),
17215
- /* @__PURE__ */ jsxRuntime.jsx(
17216
- RuleValueInput,
17217
- {
17218
- control: form.control,
17219
- name: `rules.items.${index}.rule_values.0.value`,
17220
- operator: form.watch(
17221
- `rules.items.${index}.operator`
17222
- )
17223
- }
17224
- )
17225
- ] }),
17226
- /* @__PURE__ */ jsxRuntime.jsx(
17227
- ui.Button,
17228
- {
17229
- type: "button",
17230
- variant: "secondary",
17231
- size: "small",
17232
- onClick: () => handleRemoveRule(index),
17233
- className: "mt-2",
17234
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
17235
- }
17236
- )
17237
- ] })
17312
+ control: form.control,
17313
+ index,
17314
+ eventAttributes,
17315
+ onRemove: () => handleRemoveRule(index)
17238
17316
  },
17239
17317
  (field == null ? void 0 : field.id) ?? `rule-${index}`
17240
17318
  )),
@@ -17254,7 +17332,7 @@ function AutomationsRulesForm({
17254
17332
  ] }) }) });
17255
17333
  }
17256
17334
  const templateLoaders = {
17257
- BaseConfigComponent: () => Promise.resolve().then(() => require("./base-config-D8uDn9uc"))
17335
+ BaseConfigComponent: () => Promise.resolve().then(() => require("./base-config-CGvQmkNR"))
17258
17336
  };
17259
17337
  async function loadTemplateComponent(key) {
17260
17338
  const loader = templateLoaders[key];
@@ -17565,7 +17643,7 @@ function AutomationsEditForm({
17565
17643
  description: "",
17566
17644
  trigger_type: "event",
17567
17645
  event_name: "",
17568
- interval_minutes: null,
17646
+ interval_seconds: null,
17569
17647
  active: false
17570
17648
  },
17571
17649
  rules: {
@@ -17589,7 +17667,7 @@ function AutomationsEditForm({
17589
17667
  description: trigger.description || "",
17590
17668
  trigger_type: trigger.trigger_type || "event",
17591
17669
  event_name: trigger.event_name || "",
17592
- interval_minutes: trigger.interval_minutes || null,
17670
+ interval_seconds: trigger.interval_seconds || null,
17593
17671
  active: trigger.active || false
17594
17672
  },
17595
17673
  rules: {
@@ -17633,7 +17711,7 @@ function AutomationsEditForm({
17633
17711
  description: "",
17634
17712
  trigger_type: "event",
17635
17713
  event_name: "",
17636
- interval_minutes: null,
17714
+ interval_seconds: null,
17637
17715
  active: false
17638
17716
  },
17639
17717
  rules: {
@@ -17654,7 +17732,7 @@ function AutomationsEditForm({
17654
17732
  description: data.general.description,
17655
17733
  trigger_type: data.general.trigger_type,
17656
17734
  event_name: data.general.event_name,
17657
- interval_minutes: data.general.interval_minutes,
17735
+ interval_seconds: data.general.interval_seconds,
17658
17736
  active: data.general.active
17659
17737
  };
17660
17738
  await editAutomation({
@@ -17897,7 +17975,7 @@ const AutomationsList = () => {
17897
17975
  const columns = React.useMemo(
17898
17976
  () => [
17899
17977
  columnHelper.accessor("to", {
17900
- header: "Name and description",
17978
+ header: "Name and descriptions",
17901
17979
  cell: ({ row }) => {
17902
17980
  var _a, _b, _c;
17903
17981
  const tooltip = `Device (DB) ID:
@@ -17921,7 +17999,7 @@ const AutomationsList = () => {
17921
17999
  }
17922
18000
  )
17923
18001
  ] }),
17924
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-[180px] whitespace-normal text-xs", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: (_c = row == null ? void 0 : row.original) == null ? void 0 : _c.description }) })
18002
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-normal text-xs max-w-[180px] min-w-[180px]", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: (_c = row == null ? void 0 : row.original) == null ? void 0 : _c.description }) })
17925
18003
  ] }) });
17926
18004
  }
17927
18005
  }),
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const __adminExtensions__ = require("./__admin-extensions__-Cc5RhzDh");
4
+ const __adminExtensions__ = require("./__admin-extensions__-DBUaxMhv");
5
5
  const ui = require("@medusajs/ui");
6
6
  const TextField = ({
7
7
  label,
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { C as Controller, a as ChipInput } from "./__admin-extensions__-BgrPyL-G";
2
+ import { C as Controller, a as ChipInput } from "./__admin-extensions__-BNGTajTJ";
3
3
  import { Input, Textarea, Select, Checkbox, Label } from "@medusajs/ui";
4
4
  const TextField = ({
5
5
  label,
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const __adminExtensions__ = require("./_chunks/__admin-extensions__-Cc5RhzDh");
2
+ const __adminExtensions__ = require("./_chunks/__admin-extensions__-DBUaxMhv");
3
3
  module.exports = __adminExtensions__.plugin;
@@ -1,4 +1,4 @@
1
- import { p } from "./_chunks/__admin-extensions__-BgrPyL-G";
1
+ import { p } from "./_chunks/__admin-extensions__-BNGTajTJ";
2
2
  export {
3
3
  p as default
4
4
  };
@@ -106,7 +106,7 @@ exports.default = (0, http_1.defineMiddlewares)({
106
106
  "trigger_id",
107
107
  "trigger_type",
108
108
  "event_name",
109
- "interval_minutes",
109
+ "interval_seconds",
110
110
  "channels",
111
111
  "metadata",
112
112
  "active",
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migration20251222121805 = void 0;
4
+ const migrations_1 = require("@mikro-orm/migrations");
5
+ class Migration20251222121805 extends migrations_1.Migration {
6
+ async up() {
7
+ this.addSql(`alter table if exists "mpn_automation_trigger" rename column "interval_minutes" to "interval_seconds";`);
8
+ }
9
+ async down() {
10
+ this.addSql(`alter table if exists "mpn_automation_trigger" rename column "interval_seconds" to "interval_minutes";`);
11
+ }
12
+ }
13
+ exports.Migration20251222121805 = Migration20251222121805;
14
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTEyMjIxMjE4MDUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9tcG4tYXV0b21hdGlvbi9taWdyYXRpb25zL01pZ3JhdGlvbjIwMjUxMjIyMTIxODA1LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHNEQUFpRDtBQUVqRCxNQUFhLHVCQUF3QixTQUFRLHNCQUFTO0lBQzNDLEtBQUssQ0FBQyxFQUFFO1FBQ2YsSUFBSSxDQUFDLE1BQU0sQ0FDVCx3R0FBd0csQ0FDekcsQ0FBQTtJQUNILENBQUM7SUFFUSxLQUFLLENBQUMsSUFBSTtRQUNqQixJQUFJLENBQUMsTUFBTSxDQUNULHdHQUF3RyxDQUN6RyxDQUFBO0lBQ0gsQ0FBQztDQUNGO0FBWkQsMERBWUMifQ==
@@ -20,8 +20,8 @@ exports.MpnAutomationTrigger = utils_1.model
20
20
  ]),
21
21
  // Event name — only when trigger_type = "event"
22
22
  event_name: utils_1.model.text().nullable(),
23
- // Interval in minutes — only when trigger_type = "schedule"
24
- interval_minutes: utils_1.model.number().nullable(),
23
+ // Interval in seconds — only when trigger_type = "schedule"
24
+ interval_seconds: utils_1.model.number().nullable(),
25
25
  // Whether the trigger is enabled
26
26
  active: utils_1.model.boolean().default(true),
27
27
  // Delivery channels — JSON
@@ -5,6 +5,11 @@ const base_action_service_1 = require("./base-action-service");
5
5
  const inventory_level_1 = require("../../../templates/slack/inventory-level");
6
6
  const product_variant_1 = require("../../../templates/slack/product-variant/product-variant");
7
7
  const product_1 = require("../../../templates/slack/product/product");
8
+ const order_placed_1 = require("../../../templates/slack/order/order-placed");
9
+ const order_completed_1 = require("../../../templates/slack/order/order-completed");
10
+ const order_updated_1 = require("../../../templates/slack/order/order-updated");
11
+ const order_canceled_1 = require("../../../templates/slack/order/order-canceled");
12
+ const order_archived_1 = require("../../../templates/slack/order/order-archived");
8
13
  class SlackActionService extends base_action_service_1.BaseActionService {
9
14
  constructor() {
10
15
  super();
@@ -24,6 +29,11 @@ class SlackActionService extends base_action_service_1.BaseActionService {
24
29
  this.registerTemplate("inventory-level", inventory_level_1.renderInventoryLevel);
25
30
  this.registerTemplate("product-variant", product_variant_1.renderProductVariant);
26
31
  this.registerTemplate("product", product_1.renderProduct);
32
+ this.registerTemplate("order-placed", order_placed_1.renderOrderPlaced);
33
+ this.registerTemplate("order-completed", order_completed_1.renderOrderCompleted);
34
+ this.registerTemplate("order-updated", order_updated_1.renderOrderUpdated);
35
+ this.registerTemplate("order-canceled", order_canceled_1.renderOrderCanceled);
36
+ this.registerTemplate("order-archived", order_archived_1.renderOrderArchived);
27
37
  }
28
38
  /**
29
39
  * Render Slack template
@@ -45,4 +55,4 @@ class SlackActionService extends base_action_service_1.BaseActionService {
45
55
  }
46
56
  }
47
57
  exports.SlackActionService = SlackActionService;
48
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xhY2stYWN0aW9uLXNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9tcG4tYXV0b21hdGlvbi9zZXJ2aWNlcy9zbGFjay1hY3Rpb24tc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrREFBeUQ7QUFLekQsOEVBQStFO0FBQy9FLDhGQUErRjtBQUMvRixzRUFBd0U7QUFFeEUsTUFBYSxrQkFBbUIsU0FBUSx1Q0FBaUI7SUFJdkQ7UUFDRSxLQUFLLEVBQUUsQ0FBQTtRQUpULE9BQUUsR0FBRyxPQUFPLENBQUE7UUFDWixVQUFLLEdBQUcsT0FBTyxDQUFBO1FBT2YsV0FBTSxHQUFHO1lBQ1AsK0ZBQStGO1lBQy9GLElBQUksQ0FBQyxvQkFBb0IsRUFBRTtTQUM1QixDQUFBO1FBTkMsSUFBSSxDQUFDLG1CQUFtQixFQUFFLENBQUE7SUFDNUIsQ0FBQztJQU9EOztPQUVHO0lBQ08sbUJBQW1CO1FBQzNCLDZCQUE2QjtRQUM3QixJQUFJLENBQUMsZ0JBQWdCLENBQ25CLGlCQUFpQixFQUNqQixzQ0FBMkIsQ0FDNUIsQ0FBQTtRQUNELElBQUksQ0FBQyxnQkFBZ0IsQ0FDbkIsaUJBQWlCLEVBQ2pCLHNDQUEyQixDQUM1QixDQUFBO1FBQ0QsSUFBSSxDQUFDLGdCQUFnQixDQUFDLFNBQ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