@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.
- package/.medusa/server/src/admin/_chunks/{__admin-extensions__-BgrPyL-G → __admin-extensions__-BNGTajTJ} +193 -115
- package/.medusa/server/src/admin/_chunks/{__admin-extensions__-Cc5RhzDh → __admin-extensions__-DBUaxMhv} +192 -114
- package/.medusa/server/src/admin/_chunks/{base-config-D8uDn9uc → base-config-CGvQmkNR} +1 -1
- package/.medusa/server/src/admin/_chunks/{base-config-zK3z6k14 → base-config-ClmYhVFu} +1 -1
- package/.medusa/server/src/admin/index.js +1 -1
- package/.medusa/server/src/admin/index.mjs +1 -1
- package/.medusa/server/src/api/middlewares.js +1 -1
- package/.medusa/server/src/modules/mpn-automation/migrations/Migration20251222121805.js +14 -0
- package/.medusa/server/src/modules/mpn-automation/models/mpn_automation_trigger.js +2 -2
- package/.medusa/server/src/modules/mpn-automation/services/slack-action-service.js +11 -1
- package/.medusa/server/src/modules/mpn-automation/types/modules/index.js +148 -1
- package/.medusa/server/src/modules/mpn-automation/types/modules/inventory/inventory.js +40 -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 +89 -2
- package/.medusa/server/src/modules/mpn-automation/types/modules/product-category/product-category.js +31 -2
- package/.medusa/server/src/modules/mpn-automation/types/modules/product-tag/product-tag.js +19 -2
- package/.medusa/server/src/modules/mpn-automation/types/modules/product-type/product-type.js +19 -2
- package/.medusa/server/src/modules/mpn-automation/types/modules/product-variant/product-variant.js +51 -2
- package/.medusa/server/src/modules/mpn-automation/types/types.js +1 -1
- package/.medusa/server/src/subscribers/inventory-level-updated.js +2 -2
- package/.medusa/server/src/subscribers/order-updated.js +36 -0
- 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/workflows/index.js +2 -1
- package/.medusa/server/src/workflows/inventory/steps/get-inventory-level-by-id.js +3 -3
- 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/steps/create-automation.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 +1 -1
- 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/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 +3 -3
- package/package.json +2 -2
- 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
|
@@ -4,7 +4,7 @@ import { ListBullet, ArrowUpRightOnBox, XMarkMini, TriangleDownMini, Check, Squa
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import React__default, { createContext, useContext, useReducer, useEffect, Fragment, useState, useMemo, useRef, forwardRef, createElement, isValidElement, cloneElement, Children, Suspense, useId, useInsertionEffect, useCallback, useLayoutEffect, Component, useImperativeHandle } from "react";
|
|
6
6
|
import { Outlet } from "react-router-dom";
|
|
7
|
-
import { Container as Container$1, Heading, Badge, Drawer, IconButton, Kbd, Label, Input, Select, Checkbox, FocusModal, Button, ProgressTabs, toast, clx, usePrompt, createDataTableColumnHelper, Tooltip, useDataTable, DataTable } from "@medusajs/ui";
|
|
7
|
+
import { Container as Container$1, Heading, Badge, Drawer, IconButton, Kbd, Label, Input, Select, Checkbox, Text, FocusModal, Button, ProgressTabs, toast, clx, Hint, usePrompt, createDataTableColumnHelper, Tooltip, useDataTable, DataTable } from "@medusajs/ui";
|
|
8
8
|
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
9
9
|
import Medusa from "@medusajs/js-sdk";
|
|
10
10
|
const NotificationsPage = () => {
|
|
@@ -5319,6 +5319,11 @@ function AutomationsGeneralForm({
|
|
|
5319
5319
|
useMemo(() => {
|
|
5320
5320
|
return (availableActionsData == null ? void 0 : availableActionsData.actions) || [];
|
|
5321
5321
|
}, [availableActionsData]);
|
|
5322
|
+
const triggerType = useWatch({
|
|
5323
|
+
control: form.control,
|
|
5324
|
+
name: "general.trigger_type"
|
|
5325
|
+
});
|
|
5326
|
+
const showIntervalField = triggerType === "event" || triggerType === "schedule";
|
|
5322
5327
|
return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsx("div", { className: "p-6 max-w-2xl mx-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
5323
5328
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
5324
5329
|
/* @__PURE__ */ jsx(Label, { htmlFor: "name", className: "block", children: "Name" }),
|
|
@@ -5463,6 +5468,50 @@ function AutomationsGeneralForm({
|
|
|
5463
5468
|
] })
|
|
5464
5469
|
}
|
|
5465
5470
|
)
|
|
5471
|
+
] }),
|
|
5472
|
+
showIntervalField && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
5473
|
+
/* @__PURE__ */ jsx(
|
|
5474
|
+
Label,
|
|
5475
|
+
{
|
|
5476
|
+
htmlFor: "interval_seconds",
|
|
5477
|
+
className: "block",
|
|
5478
|
+
children: triggerType === "schedule" ? "Interval (seconds)" : "Throttle (seconds)"
|
|
5479
|
+
}
|
|
5480
|
+
),
|
|
5481
|
+
/* @__PURE__ */ jsx(
|
|
5482
|
+
Controller,
|
|
5483
|
+
{
|
|
5484
|
+
name: "general.interval_seconds",
|
|
5485
|
+
control: form.control,
|
|
5486
|
+
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
5487
|
+
/* @__PURE__ */ jsx(
|
|
5488
|
+
Input,
|
|
5489
|
+
{
|
|
5490
|
+
...field,
|
|
5491
|
+
type: "number",
|
|
5492
|
+
min: 0,
|
|
5493
|
+
placeholder: triggerType === "schedule" ? "Run every X seconds" : "Minimum seconds between executions",
|
|
5494
|
+
value: field.value ?? "",
|
|
5495
|
+
onChange: (e2) => {
|
|
5496
|
+
const value = e2.target.value;
|
|
5497
|
+
field.onChange(
|
|
5498
|
+
value === "" ? null : Number(value)
|
|
5499
|
+
);
|
|
5500
|
+
}
|
|
5501
|
+
}
|
|
5502
|
+
),
|
|
5503
|
+
/* @__PURE__ */ jsx(
|
|
5504
|
+
Text,
|
|
5505
|
+
{
|
|
5506
|
+
size: "small",
|
|
5507
|
+
className: "text-ui-fg-subtle",
|
|
5508
|
+
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)"
|
|
5509
|
+
}
|
|
5510
|
+
),
|
|
5511
|
+
fieldState.error && /* @__PURE__ */ jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
|
|
5512
|
+
] })
|
|
5513
|
+
}
|
|
5514
|
+
)
|
|
5466
5515
|
] })
|
|
5467
5516
|
] }) }) });
|
|
5468
5517
|
}
|
|
@@ -9108,7 +9157,7 @@ const baseAutomationFormSchema = objectType({
|
|
|
9108
9157
|
description: stringType().min(1, "Description is required").min(3, "Description must be at least 3 characters"),
|
|
9109
9158
|
trigger_type: enumType(["event", "schedule", "manual"]),
|
|
9110
9159
|
event_name: stringType().min(1, "Event name is required"),
|
|
9111
|
-
|
|
9160
|
+
interval_seconds: numberType().nullable(),
|
|
9112
9161
|
active: booleanType()
|
|
9113
9162
|
}),
|
|
9114
9163
|
rules: objectType({
|
|
@@ -9233,7 +9282,7 @@ function AutomationsCreateForm() {
|
|
|
9233
9282
|
description: "",
|
|
9234
9283
|
trigger_type: "event",
|
|
9235
9284
|
event_name: "",
|
|
9236
|
-
|
|
9285
|
+
interval_seconds: null,
|
|
9237
9286
|
active: false
|
|
9238
9287
|
},
|
|
9239
9288
|
rules: {
|
|
@@ -9252,7 +9301,7 @@ function AutomationsCreateForm() {
|
|
|
9252
9301
|
description: "",
|
|
9253
9302
|
trigger_type: "event",
|
|
9254
9303
|
event_name: "",
|
|
9255
|
-
|
|
9304
|
+
interval_seconds: null,
|
|
9256
9305
|
active: false
|
|
9257
9306
|
},
|
|
9258
9307
|
rules: {
|
|
@@ -9271,7 +9320,7 @@ function AutomationsCreateForm() {
|
|
|
9271
9320
|
description: data.general.description,
|
|
9272
9321
|
trigger_type: data.general.trigger_type,
|
|
9273
9322
|
event_name: data.general.event_name,
|
|
9274
|
-
|
|
9323
|
+
interval_seconds: data.general.interval_seconds,
|
|
9275
9324
|
active: data.general.active
|
|
9276
9325
|
};
|
|
9277
9326
|
await createAutomation({
|
|
@@ -17061,6 +17110,133 @@ function RuleValueInput({
|
|
|
17061
17110
|
}
|
|
17062
17111
|
);
|
|
17063
17112
|
}
|
|
17113
|
+
function RuleItem({
|
|
17114
|
+
control,
|
|
17115
|
+
index,
|
|
17116
|
+
eventAttributes,
|
|
17117
|
+
onRemove
|
|
17118
|
+
}) {
|
|
17119
|
+
const selectedAttributeValue = useWatch({
|
|
17120
|
+
control,
|
|
17121
|
+
name: `rules.items.${index}.attribute`
|
|
17122
|
+
});
|
|
17123
|
+
const operatorValue = useWatch({
|
|
17124
|
+
control,
|
|
17125
|
+
name: `rules.items.${index}.operator`
|
|
17126
|
+
});
|
|
17127
|
+
const selectedAttribute = selectedAttributeValue && eventAttributes.length ? eventAttributes.find(
|
|
17128
|
+
(attr) => attr.value === selectedAttributeValue
|
|
17129
|
+
) : null;
|
|
17130
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2 p-4 border rounded-lg", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
|
|
17131
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-2", children: [
|
|
17132
|
+
/* @__PURE__ */ jsx(
|
|
17133
|
+
Controller,
|
|
17134
|
+
{
|
|
17135
|
+
name: `rules.items.${index}.attribute`,
|
|
17136
|
+
control,
|
|
17137
|
+
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
17138
|
+
/* @__PURE__ */ jsx(Label, { children: "Attribute" }),
|
|
17139
|
+
/* @__PURE__ */ jsxs(
|
|
17140
|
+
Select,
|
|
17141
|
+
{
|
|
17142
|
+
value: field.value ?? "",
|
|
17143
|
+
onValueChange: (value) => {
|
|
17144
|
+
field.onChange(value);
|
|
17145
|
+
},
|
|
17146
|
+
children: [
|
|
17147
|
+
/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, { placeholder: "Select the attribute" }) }),
|
|
17148
|
+
/* @__PURE__ */ jsx(Select.Content, { children: eventAttributes.map((attribute, attrIndex) => /* @__PURE__ */ jsxs(
|
|
17149
|
+
Select.Item,
|
|
17150
|
+
{
|
|
17151
|
+
value: attribute.value || "",
|
|
17152
|
+
children: [
|
|
17153
|
+
attribute.label,
|
|
17154
|
+
" ",
|
|
17155
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-500", children: [
|
|
17156
|
+
"(",
|
|
17157
|
+
attribute.value,
|
|
17158
|
+
")"
|
|
17159
|
+
] })
|
|
17160
|
+
]
|
|
17161
|
+
},
|
|
17162
|
+
attribute.value || `attr-${index}-${attrIndex}`
|
|
17163
|
+
)) })
|
|
17164
|
+
]
|
|
17165
|
+
},
|
|
17166
|
+
`attribute-${index}-${eventAttributes.length}`
|
|
17167
|
+
),
|
|
17168
|
+
fieldState.error && /* @__PURE__ */ jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message }),
|
|
17169
|
+
(selectedAttribute == null ? void 0 : selectedAttribute.description) && /* @__PURE__ */ jsx(Hint, { className: "mt-1", children: selectedAttribute.description })
|
|
17170
|
+
] })
|
|
17171
|
+
}
|
|
17172
|
+
),
|
|
17173
|
+
/* @__PURE__ */ jsx(
|
|
17174
|
+
Controller,
|
|
17175
|
+
{
|
|
17176
|
+
name: `rules.items.${index}.operator`,
|
|
17177
|
+
control,
|
|
17178
|
+
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
17179
|
+
/* @__PURE__ */ jsx(Label, { children: "Operator" }),
|
|
17180
|
+
/* @__PURE__ */ jsxs(
|
|
17181
|
+
Select,
|
|
17182
|
+
{
|
|
17183
|
+
value: field.value ?? "",
|
|
17184
|
+
onValueChange: (value) => {
|
|
17185
|
+
field.onChange(value);
|
|
17186
|
+
},
|
|
17187
|
+
children: [
|
|
17188
|
+
/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, { placeholder: "Select the operator" }) }),
|
|
17189
|
+
/* @__PURE__ */ jsx(Select.Content, { children: OPERATOR_TYPES.map((operator, opIndex) => /* @__PURE__ */ jsx(
|
|
17190
|
+
Select.Item,
|
|
17191
|
+
{
|
|
17192
|
+
value: operator.value,
|
|
17193
|
+
children: operator.label
|
|
17194
|
+
},
|
|
17195
|
+
operator.value || `op-${opIndex}`
|
|
17196
|
+
)) })
|
|
17197
|
+
]
|
|
17198
|
+
},
|
|
17199
|
+
`operator-${index}-${eventAttributes.length}-${field.value ?? ""}`
|
|
17200
|
+
),
|
|
17201
|
+
fieldState.error && /* @__PURE__ */ jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
|
|
17202
|
+
] })
|
|
17203
|
+
}
|
|
17204
|
+
),
|
|
17205
|
+
/* @__PURE__ */ jsx(
|
|
17206
|
+
RuleValueInput,
|
|
17207
|
+
{
|
|
17208
|
+
control,
|
|
17209
|
+
name: `rules.items.${index}.rule_values.0.value`,
|
|
17210
|
+
operator: operatorValue
|
|
17211
|
+
}
|
|
17212
|
+
),
|
|
17213
|
+
(selectedAttribute == null ? void 0 : selectedAttribute.examples) && selectedAttribute.examples.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-0", children: [
|
|
17214
|
+
/* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-gray-600 mb-1", children: "Examples:" }),
|
|
17215
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: selectedAttribute.examples.map(
|
|
17216
|
+
(example, exampleIndex) => /* @__PURE__ */ jsx(
|
|
17217
|
+
"span",
|
|
17218
|
+
{
|
|
17219
|
+
className: "inline-flex items-center px-2 py-1 rounded-md bg-gray-100 text-xs text-gray-700",
|
|
17220
|
+
children: example
|
|
17221
|
+
},
|
|
17222
|
+
`example-${index}-${exampleIndex}`
|
|
17223
|
+
)
|
|
17224
|
+
) })
|
|
17225
|
+
] })
|
|
17226
|
+
] }),
|
|
17227
|
+
/* @__PURE__ */ jsx(
|
|
17228
|
+
Button,
|
|
17229
|
+
{
|
|
17230
|
+
type: "button",
|
|
17231
|
+
variant: "secondary",
|
|
17232
|
+
size: "small",
|
|
17233
|
+
onClick: onRemove,
|
|
17234
|
+
className: "mt-2",
|
|
17235
|
+
children: /* @__PURE__ */ jsx(Trash, {})
|
|
17236
|
+
}
|
|
17237
|
+
)
|
|
17238
|
+
] }) });
|
|
17239
|
+
}
|
|
17064
17240
|
function AutomationsRulesForm({
|
|
17065
17241
|
form,
|
|
17066
17242
|
isOpen
|
|
@@ -17111,110 +17287,12 @@ function AutomationsRulesForm({
|
|
|
17111
17287
|
return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsx("div", { className: "p-6 max-w-2xl mx-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
17112
17288
|
fields.length === 0 && /* @__PURE__ */ 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.' }),
|
|
17113
17289
|
fields.map((field, index) => /* @__PURE__ */ jsx(
|
|
17114
|
-
|
|
17290
|
+
RuleItem,
|
|
17115
17291
|
{
|
|
17116
|
-
|
|
17117
|
-
|
|
17118
|
-
|
|
17119
|
-
|
|
17120
|
-
Controller,
|
|
17121
|
-
{
|
|
17122
|
-
name: `rules.items.${index}.attribute`,
|
|
17123
|
-
control: form.control,
|
|
17124
|
-
render: ({ field: field2, fieldState }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
17125
|
-
/* @__PURE__ */ jsx(Label, { children: "Attribute" }),
|
|
17126
|
-
/* @__PURE__ */ jsxs(
|
|
17127
|
-
Select,
|
|
17128
|
-
{
|
|
17129
|
-
value: field2.value ?? "",
|
|
17130
|
-
onValueChange: (value) => {
|
|
17131
|
-
field2.onChange(value);
|
|
17132
|
-
},
|
|
17133
|
-
children: [
|
|
17134
|
-
/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, { placeholder: "Select the attribute" }) }),
|
|
17135
|
-
/* @__PURE__ */ jsx(Select.Content, { children: eventAttributes.map(
|
|
17136
|
-
(attribute, attrIndex) => /* @__PURE__ */ jsxs(
|
|
17137
|
-
Select.Item,
|
|
17138
|
-
{
|
|
17139
|
-
value: attribute.value || "ss",
|
|
17140
|
-
children: [
|
|
17141
|
-
attribute.label,
|
|
17142
|
-
" ",
|
|
17143
|
-
/* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-500", children: [
|
|
17144
|
-
"(",
|
|
17145
|
-
attribute.value,
|
|
17146
|
-
")"
|
|
17147
|
-
] })
|
|
17148
|
-
]
|
|
17149
|
-
},
|
|
17150
|
-
attribute.value || `attr-${index}-${attrIndex}`
|
|
17151
|
-
)
|
|
17152
|
-
) })
|
|
17153
|
-
]
|
|
17154
|
-
},
|
|
17155
|
-
`attribute-${index}-${eventAttributes.length}`
|
|
17156
|
-
),
|
|
17157
|
-
fieldState.error && /* @__PURE__ */ jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
|
|
17158
|
-
] })
|
|
17159
|
-
}
|
|
17160
|
-
),
|
|
17161
|
-
/* @__PURE__ */ jsx(
|
|
17162
|
-
Controller,
|
|
17163
|
-
{
|
|
17164
|
-
name: `rules.items.${index}.operator`,
|
|
17165
|
-
control: form.control,
|
|
17166
|
-
render: ({ field: field2, fieldState }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
17167
|
-
/* @__PURE__ */ jsx(Label, { children: "Operator" }),
|
|
17168
|
-
/* @__PURE__ */ jsxs(
|
|
17169
|
-
Select,
|
|
17170
|
-
{
|
|
17171
|
-
value: field2.value ?? "",
|
|
17172
|
-
onValueChange: (value) => {
|
|
17173
|
-
field2.onChange(value);
|
|
17174
|
-
},
|
|
17175
|
-
children: [
|
|
17176
|
-
/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, { placeholder: "Select the operator" }) }),
|
|
17177
|
-
/* @__PURE__ */ jsx(Select.Content, { children: OPERATOR_TYPES.map(
|
|
17178
|
-
(operator, opIndex) => /* @__PURE__ */ jsx(
|
|
17179
|
-
Select.Item,
|
|
17180
|
-
{
|
|
17181
|
-
value: operator.value,
|
|
17182
|
-
children: operator.label
|
|
17183
|
-
},
|
|
17184
|
-
operator.value || `op-${opIndex}`
|
|
17185
|
-
)
|
|
17186
|
-
) })
|
|
17187
|
-
]
|
|
17188
|
-
},
|
|
17189
|
-
`operator-${index}-${eventAttributes.length}-${field2.value ?? ""}`
|
|
17190
|
-
),
|
|
17191
|
-
fieldState.error && /* @__PURE__ */ jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
|
|
17192
|
-
] })
|
|
17193
|
-
}
|
|
17194
|
-
),
|
|
17195
|
-
/* @__PURE__ */ jsx(
|
|
17196
|
-
RuleValueInput,
|
|
17197
|
-
{
|
|
17198
|
-
control: form.control,
|
|
17199
|
-
name: `rules.items.${index}.rule_values.0.value`,
|
|
17200
|
-
operator: form.watch(
|
|
17201
|
-
`rules.items.${index}.operator`
|
|
17202
|
-
)
|
|
17203
|
-
}
|
|
17204
|
-
)
|
|
17205
|
-
] }),
|
|
17206
|
-
/* @__PURE__ */ jsx(
|
|
17207
|
-
Button,
|
|
17208
|
-
{
|
|
17209
|
-
type: "button",
|
|
17210
|
-
variant: "secondary",
|
|
17211
|
-
size: "small",
|
|
17212
|
-
onClick: () => handleRemoveRule(index),
|
|
17213
|
-
className: "mt-2",
|
|
17214
|
-
children: /* @__PURE__ */ jsx(Trash, {})
|
|
17215
|
-
}
|
|
17216
|
-
)
|
|
17217
|
-
] })
|
|
17292
|
+
control: form.control,
|
|
17293
|
+
index,
|
|
17294
|
+
eventAttributes,
|
|
17295
|
+
onRemove: () => handleRemoveRule(index)
|
|
17218
17296
|
},
|
|
17219
17297
|
(field == null ? void 0 : field.id) ?? `rule-${index}`
|
|
17220
17298
|
)),
|
|
@@ -17234,7 +17312,7 @@ function AutomationsRulesForm({
|
|
|
17234
17312
|
] }) }) });
|
|
17235
17313
|
}
|
|
17236
17314
|
const templateLoaders = {
|
|
17237
|
-
BaseConfigComponent: () => import("./base-config-
|
|
17315
|
+
BaseConfigComponent: () => import("./base-config-ClmYhVFu")
|
|
17238
17316
|
};
|
|
17239
17317
|
async function loadTemplateComponent(key) {
|
|
17240
17318
|
const loader = templateLoaders[key];
|
|
@@ -17545,7 +17623,7 @@ function AutomationsEditForm({
|
|
|
17545
17623
|
description: "",
|
|
17546
17624
|
trigger_type: "event",
|
|
17547
17625
|
event_name: "",
|
|
17548
|
-
|
|
17626
|
+
interval_seconds: null,
|
|
17549
17627
|
active: false
|
|
17550
17628
|
},
|
|
17551
17629
|
rules: {
|
|
@@ -17569,7 +17647,7 @@ function AutomationsEditForm({
|
|
|
17569
17647
|
description: trigger.description || "",
|
|
17570
17648
|
trigger_type: trigger.trigger_type || "event",
|
|
17571
17649
|
event_name: trigger.event_name || "",
|
|
17572
|
-
|
|
17650
|
+
interval_seconds: trigger.interval_seconds || null,
|
|
17573
17651
|
active: trigger.active || false
|
|
17574
17652
|
},
|
|
17575
17653
|
rules: {
|
|
@@ -17613,7 +17691,7 @@ function AutomationsEditForm({
|
|
|
17613
17691
|
description: "",
|
|
17614
17692
|
trigger_type: "event",
|
|
17615
17693
|
event_name: "",
|
|
17616
|
-
|
|
17694
|
+
interval_seconds: null,
|
|
17617
17695
|
active: false
|
|
17618
17696
|
},
|
|
17619
17697
|
rules: {
|
|
@@ -17634,7 +17712,7 @@ function AutomationsEditForm({
|
|
|
17634
17712
|
description: data.general.description,
|
|
17635
17713
|
trigger_type: data.general.trigger_type,
|
|
17636
17714
|
event_name: data.general.event_name,
|
|
17637
|
-
|
|
17715
|
+
interval_seconds: data.general.interval_seconds,
|
|
17638
17716
|
active: data.general.active
|
|
17639
17717
|
};
|
|
17640
17718
|
await editAutomation({
|
|
@@ -17877,7 +17955,7 @@ const AutomationsList = () => {
|
|
|
17877
17955
|
const columns = useMemo(
|
|
17878
17956
|
() => [
|
|
17879
17957
|
columnHelper.accessor("to", {
|
|
17880
|
-
header: "Name and
|
|
17958
|
+
header: "Name and descriptions",
|
|
17881
17959
|
cell: ({ row }) => {
|
|
17882
17960
|
var _a, _b, _c;
|
|
17883
17961
|
const tooltip = `Device (DB) ID:
|
|
@@ -17901,7 +17979,7 @@ const AutomationsList = () => {
|
|
|
17901
17979
|
}
|
|
17902
17980
|
)
|
|
17903
17981
|
] }),
|
|
17904
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
17982
|
+
/* @__PURE__ */ jsx("div", { className: "whitespace-normal text-xs max-w-[180px] min-w-[180px]", children: /* @__PURE__ */ jsx("span", { children: (_c = row == null ? void 0 : row.original) == null ? void 0 : _c.description }) })
|
|
17905
17983
|
] }) });
|
|
17906
17984
|
}
|
|
17907
17985
|
}),
|