@codee-sh/medusa-plugin-automations 1.0.1 → 1.0.3

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 (77) hide show
  1. package/.medusa/server/src/admin/_chunks/{__admin-extensions__-CQZdTnuf → __admin-extensions__-DIB2k6nJ} +665 -304
  2. package/.medusa/server/src/admin/_chunks/{__admin-extensions__-DIUFmida → __admin-extensions__-rqdPN7M1} +665 -304
  3. package/.medusa/server/src/admin/_chunks/{base-config-0lbnQWYz → base-config-DbRWuXsL} +25 -9
  4. package/.medusa/server/src/admin/_chunks/{base-config-DsBoNoxD → base-config-ro-vFPBg} +25 -9
  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/actions/route.js +4 -4
  8. package/.medusa/server/src/api/admin/mpn/automations/available-actions/route.js +1 -1
  9. package/.medusa/server/src/api/admin/mpn/automations/available-events/route.js +1 -1
  10. package/.medusa/server/src/api/admin/mpn/automations/available-triggers/route.js +1 -1
  11. package/.medusa/server/src/api/admin/mpn/automations/route.js +6 -6
  12. package/.medusa/server/src/api/admin/mpn/automations/rules/route.js +12 -7
  13. package/.medusa/server/src/api/middlewares.js +4 -4
  14. package/.medusa/server/src/hooks/api/automations/automations.js +3 -3
  15. package/.medusa/server/src/hooks/api/automations-actions/automations-actions.js +3 -3
  16. package/.medusa/server/src/hooks/api/automations-rules/automations-rules.js +3 -3
  17. package/.medusa/server/src/hooks/api/available-actions/actions.js +3 -3
  18. package/.medusa/server/src/hooks/api/available-events/events.js +3 -3
  19. package/.medusa/server/src/hooks/api/available-triggers/triggers.js +3 -3
  20. package/.medusa/server/src/modules/mpn-automation/actions-handlers/base-action-handler.js +3 -3
  21. package/.medusa/server/src/modules/mpn-automation/actions-handlers/email-action-handler.js +1 -1
  22. package/.medusa/server/src/modules/mpn-automation/actions-handlers/slack-action-handler.js +1 -1
  23. package/.medusa/server/src/modules/mpn-automation/migrations/Migration20251127115228.js +1 -1
  24. package/.medusa/server/src/modules/mpn-automation/migrations/Migration20251127193345.js +1 -1
  25. package/.medusa/server/src/modules/mpn-automation/migrations/Migration20251127195615.js +1 -1
  26. package/.medusa/server/src/modules/mpn-automation/migrations/Migration20251130144047.js +1 -1
  27. package/.medusa/server/src/modules/mpn-automation/migrations/Migration20251207172856.js +1 -1
  28. package/.medusa/server/src/modules/mpn-automation/migrations/Migration20251208090654.js +14 -0
  29. package/.medusa/server/src/modules/mpn-automation/models/mpn_automation_rule.js +3 -2
  30. package/.medusa/server/src/modules/mpn-automation/models/mpn_automation_rule_value.js +3 -4
  31. package/.medusa/server/src/modules/mpn-automation/models/mpn_automation_state.js +2 -3
  32. package/.medusa/server/src/modules/mpn-automation/models/mpn_automation_trigger.js +9 -6
  33. package/.medusa/server/src/modules/mpn-automation/models/npm_automation_action.js +1 -1
  34. package/.medusa/server/src/modules/mpn-automation/services/service.js +9 -4
  35. package/.medusa/server/src/modules/mpn-automation/types/types.js +42 -48
  36. package/.medusa/server/src/providers/slack/service.js +14 -14
  37. package/.medusa/server/src/subscribers/inventory-item-updated.js +1 -1
  38. package/.medusa/server/src/subscribers/inventory-level-updated.js +6 -5
  39. package/.medusa/server/src/subscribers/inventory-reservation-item-updated.js +1 -1
  40. package/.medusa/server/src/subscribers/mpn.automation.action.email.executed.js +4 -4
  41. package/.medusa/server/src/subscribers/mpn.automation.action.slack.executed.js +2 -15
  42. package/.medusa/server/src/subscribers/order-completed.js +2 -2
  43. package/.medusa/server/src/subscribers/order-placed.js +2 -2
  44. package/.medusa/server/src/subscribers/payment-captured.js +2 -2
  45. package/.medusa/server/src/utils/index.js +1 -1
  46. package/.medusa/server/src/utils/plugins.js +4 -2
  47. package/.medusa/server/src/utils/validate-rules.js +1 -1
  48. package/.medusa/server/src/workflows/inventory/get-inventory-level-by-id.js +1 -1
  49. package/.medusa/server/src/workflows/inventory/steps/get-inventory-level-by-id.js +1 -1
  50. package/.medusa/server/src/workflows/mpn-automation/create-automation.js +1 -1
  51. package/.medusa/server/src/workflows/mpn-automation/delete-automation.js +1 -1
  52. package/.medusa/server/src/workflows/mpn-automation/edit-automation-actions.js +2 -2
  53. package/.medusa/server/src/workflows/mpn-automation/edit-automation-rules.js +2 -2
  54. package/.medusa/server/src/workflows/mpn-automation/edit-automation.js +1 -1
  55. package/.medusa/server/src/workflows/mpn-automation/index.js +2 -1
  56. package/.medusa/server/src/workflows/mpn-automation/run-automation.js +32 -25
  57. package/.medusa/server/src/workflows/mpn-automation/save-automation-state.js +16 -0
  58. package/.medusa/server/src/workflows/mpn-automation/send-email-action.js +1 -1
  59. package/.medusa/server/src/workflows/mpn-automation/send-slack-action.js +1 -1
  60. package/.medusa/server/src/workflows/mpn-automation/steps/create-automation.js +2 -2
  61. package/.medusa/server/src/workflows/mpn-automation/steps/delete-automation.js +4 -2
  62. package/.medusa/server/src/workflows/mpn-automation/steps/edit-automation-actions.js +4 -2
  63. package/.medusa/server/src/workflows/mpn-automation/steps/edit-automation-rules.js +11 -7
  64. package/.medusa/server/src/workflows/mpn-automation/steps/edit-automation.js +2 -2
  65. package/.medusa/server/src/workflows/mpn-automation/steps/index.js +2 -1
  66. package/.medusa/server/src/workflows/mpn-automation/steps/retrieve-automation-triggers-by-event.js +2 -4
  67. package/.medusa/server/src/workflows/mpn-automation/steps/run-automation-actions.js +23 -27
  68. package/.medusa/server/src/workflows/mpn-automation/steps/save-automation-state.js +40 -0
  69. package/.medusa/server/src/workflows/mpn-automation/steps/validate-automation-triggers.js +8 -6
  70. package/.medusa/server/src/workflows/mpn-automation/validate-automation-triggers-by-event.js +6 -6
  71. package/.medusa/server/src/workflows/notifications/send-email.js +1 -1
  72. package/.medusa/server/src/workflows/notifications/send-slack.js +1 -1
  73. package/.medusa/server/src/workflows/notifications/steps/send-email.js +6 -3
  74. package/.medusa/server/src/workflows/notifications/steps/send-slack.js +1 -1
  75. package/.medusa/server/src/workflows/steps/log-step.js +1 -1
  76. package/README.md +18 -7
  77. package/package.json +4 -2
@@ -2962,7 +2962,9 @@ function useTranslation(ns) {
2962
2962
  }
2963
2963
  });
2964
2964
  }
2965
- const JsonViewSection = ({ data }) => {
2965
+ const JsonViewSection = ({
2966
+ data
2967
+ }) => {
2966
2968
  const { t: t2 } = useTranslation();
2967
2969
  const numberOfKeys = Object.keys(data).length;
2968
2970
  return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "flex items-center justify-between px-6 py-4", children: [
@@ -2991,7 +2993,13 @@ const JsonViewSection = ({ data }) => {
2991
2993
  i18nKey: "json.drawer.header",
2992
2994
  count: numberOfKeys,
2993
2995
  components: [
2994
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-fg-subtle" }, "count-span")
2996
+ /* @__PURE__ */ jsxRuntime.jsx(
2997
+ "span",
2998
+ {
2999
+ className: "text-ui-fg-subtle"
3000
+ },
3001
+ "count-span"
3002
+ )
2995
3003
  ]
2996
3004
  }
2997
3005
  ) }) }),
@@ -3041,7 +3049,12 @@ const JsonViewSection = ({ data }) => {
3041
3049
  },
3042
3050
  collapsed: 1,
3043
3051
  children: [
3044
- /* @__PURE__ */ jsxRuntime.jsx(JsonView.Quote, { render: () => /* @__PURE__ */ jsxRuntime.jsx("span", {}) }),
3052
+ /* @__PURE__ */ jsxRuntime.jsx(
3053
+ JsonView.Quote,
3054
+ {
3055
+ render: () => /* @__PURE__ */ jsxRuntime.jsx("span", {})
3056
+ }
3057
+ ),
3045
3058
  /* @__PURE__ */ jsxRuntime.jsx(
3046
3059
  JsonView.Null,
3047
3060
  {
@@ -3059,7 +3072,9 @@ const JsonViewSection = ({ data }) => {
3059
3072
  {
3060
3073
  render: (_props, { value }) => {
3061
3074
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-contrast-fg-secondary ml-2", children: t2("general.items", {
3062
- count: Object.keys(value).length
3075
+ count: Object.keys(
3076
+ value
3077
+ ).length
3063
3078
  }) });
3064
3079
  }
3065
3080
  }
@@ -3070,7 +3085,13 @@ const JsonViewSection = ({ data }) => {
3070
3085
  JsonView.Copied,
3071
3086
  {
3072
3087
  render: ({ style }, { value }) => {
3073
- return /* @__PURE__ */ jsxRuntime.jsx(Copied, { style, value });
3088
+ return /* @__PURE__ */ jsxRuntime.jsx(
3089
+ Copied,
3090
+ {
3091
+ style,
3092
+ value
3093
+ }
3094
+ );
3074
3095
  }
3075
3096
  }
3076
3097
  )
@@ -3194,24 +3215,28 @@ const sdk = new Medusa__default.default({
3194
3215
  }
3195
3216
  });
3196
3217
  const useCreateAutomation = (options) => {
3197
- return reactQuery.useMutation({
3198
- mutationFn: async (data) => {
3199
- await sdk.client.fetch("/admin/mpn/automations", {
3200
- method: "POST",
3201
- body: data
3202
- });
3218
+ return reactQuery.useMutation(
3219
+ {
3220
+ mutationFn: async (data) => {
3221
+ await sdk.client.fetch("/admin/mpn/automations", {
3222
+ method: "POST",
3223
+ body: data
3224
+ });
3225
+ }
3203
3226
  }
3204
- });
3227
+ );
3205
3228
  };
3206
3229
  const useEditAutomation = (options) => {
3207
- return reactQuery.useMutation({
3208
- mutationFn: async (data) => {
3209
- await sdk.client.fetch("/admin/mpn/automations", {
3210
- method: "POST",
3211
- body: data
3212
- });
3230
+ return reactQuery.useMutation(
3231
+ {
3232
+ mutationFn: async (data) => {
3233
+ await sdk.client.fetch("/admin/mpn/automations", {
3234
+ method: "POST",
3235
+ body: data
3236
+ });
3237
+ }
3213
3238
  }
3214
- });
3239
+ );
3215
3240
  };
3216
3241
  const useDeleteAutomation = (options) => {
3217
3242
  return reactQuery.useMutation({
@@ -3227,7 +3252,15 @@ const useDeleteAutomation = (options) => {
3227
3252
  });
3228
3253
  };
3229
3254
  const useListAutomations = (params, options) => {
3230
- const { limit = 100, offset = 0, extraKey = [], enabled, fields, order = "created_at", id } = params;
3255
+ const {
3256
+ limit = 100,
3257
+ offset = 0,
3258
+ extraKey = [],
3259
+ enabled,
3260
+ fields,
3261
+ order = "created_at",
3262
+ id
3263
+ } = params;
3231
3264
  const queryKey = [
3232
3265
  "automations",
3233
3266
  id,
@@ -3247,10 +3280,13 @@ const useListAutomations = (params, options) => {
3247
3280
  const { data, ...rest } = reactQuery.useQuery({
3248
3281
  queryKey,
3249
3282
  queryFn: async () => {
3250
- return await sdk.client.fetch("/admin/mpn/automations", {
3251
- method: "GET",
3252
- query
3253
- });
3283
+ return await sdk.client.fetch(
3284
+ "/admin/mpn/automations",
3285
+ {
3286
+ method: "GET",
3287
+ query
3288
+ }
3289
+ );
3254
3290
  },
3255
3291
  enabled,
3256
3292
  ...options
@@ -5139,7 +5175,15 @@ var n = function(e2, o2) {
5139
5175
  };
5140
5176
  };
5141
5177
  const useAvailableActions = (params, options) => {
5142
- const { limit = 100, offset = 0, extraKey = [], enabled, fields, order = "created_at", id } = params;
5178
+ const {
5179
+ limit = 100,
5180
+ offset = 0,
5181
+ extraKey = [],
5182
+ enabled,
5183
+ fields,
5184
+ order = "created_at",
5185
+ id
5186
+ } = params;
5143
5187
  const queryKey = [
5144
5188
  "available-actions",
5145
5189
  limit,
@@ -5155,10 +5199,13 @@ const useAvailableActions = (params, options) => {
5155
5199
  const { data, ...rest } = reactQuery.useQuery({
5156
5200
  queryKey,
5157
5201
  queryFn: async () => {
5158
- return await sdk.client.fetch("/admin/mpn/automations/available-actions", {
5159
- method: "GET",
5160
- query
5161
- });
5202
+ return await sdk.client.fetch(
5203
+ "/admin/mpn/automations/available-actions",
5204
+ {
5205
+ method: "GET",
5206
+ query
5207
+ }
5208
+ );
5162
5209
  },
5163
5210
  enabled,
5164
5211
  ...options
@@ -5166,7 +5213,15 @@ const useAvailableActions = (params, options) => {
5166
5213
  return { data, ...rest };
5167
5214
  };
5168
5215
  const useAvailableEvents = (params, options) => {
5169
- const { limit = 100, offset = 0, extraKey = [], enabled, fields, order = "created_at", id } = params;
5216
+ const {
5217
+ limit = 100,
5218
+ offset = 0,
5219
+ extraKey = [],
5220
+ enabled,
5221
+ fields,
5222
+ order = "created_at",
5223
+ id
5224
+ } = params;
5170
5225
  const queryKey = [
5171
5226
  "available-events",
5172
5227
  limit,
@@ -5182,10 +5237,13 @@ const useAvailableEvents = (params, options) => {
5182
5237
  const { data, ...rest } = reactQuery.useQuery({
5183
5238
  queryKey,
5184
5239
  queryFn: async () => {
5185
- return await sdk.client.fetch("/admin/mpn/automations/available-events", {
5186
- method: "GET",
5187
- query
5188
- });
5240
+ return await sdk.client.fetch(
5241
+ "/admin/mpn/automations/available-events",
5242
+ {
5243
+ method: "GET",
5244
+ query
5245
+ }
5246
+ );
5189
5247
  },
5190
5248
  enabled,
5191
5249
  ...options
@@ -5193,7 +5251,14 @@ const useAvailableEvents = (params, options) => {
5193
5251
  return { data, ...rest };
5194
5252
  };
5195
5253
  const useAvailableTriggers = (params, options) => {
5196
- const { limit = 100, offset = 0, extraKey = [], enabled, fields, order = "created_at" } = params;
5254
+ const {
5255
+ limit = 100,
5256
+ offset = 0,
5257
+ extraKey = [],
5258
+ enabled,
5259
+ fields,
5260
+ order = "created_at"
5261
+ } = params;
5197
5262
  const queryKey = [
5198
5263
  "available-triggers",
5199
5264
  limit,
@@ -5209,24 +5274,36 @@ const useAvailableTriggers = (params, options) => {
5209
5274
  const { data, ...rest } = reactQuery.useQuery({
5210
5275
  queryKey,
5211
5276
  queryFn: async () => {
5212
- return await sdk.client.fetch("/admin/mpn/automations/available-triggers", {
5213
- method: "GET",
5214
- query
5215
- });
5277
+ return await sdk.client.fetch(
5278
+ "/admin/mpn/automations/available-triggers",
5279
+ {
5280
+ method: "GET",
5281
+ query
5282
+ }
5283
+ );
5216
5284
  },
5217
5285
  enabled,
5218
5286
  ...options
5219
5287
  });
5220
5288
  return { data, ...rest };
5221
5289
  };
5222
- function AutomationsGeneralForm({ form, isOpen }) {
5223
- const { data: availableEventsData } = useAvailableEvents({
5290
+ function AutomationsGeneralForm({
5291
+ form,
5292
+ isOpen
5293
+ }) {
5294
+ const {
5295
+ data: availableEventsData
5296
+ } = useAvailableEvents({
5224
5297
  enabled: isOpen !== false
5225
5298
  });
5226
- const { data: availableTriggersData } = useAvailableTriggers({
5299
+ const {
5300
+ data: availableTriggersData
5301
+ } = useAvailableTriggers({
5227
5302
  enabled: isOpen !== false
5228
5303
  });
5229
- const { data: availableActionsData } = useAvailableActions({
5304
+ const {
5305
+ data: availableActionsData
5306
+ } = useAvailableActions({
5230
5307
  enabled: isOpen !== false
5231
5308
  });
5232
5309
  const availableEvents = React.useMemo(() => {
@@ -5247,7 +5324,13 @@ function AutomationsGeneralForm({ form, isOpen }) {
5247
5324
  name: "general.name",
5248
5325
  control: form.control,
5249
5326
  render: ({ field, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5250
- /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field, placeholder: "Enter the name of the automation" }),
5327
+ /* @__PURE__ */ jsxRuntime.jsx(
5328
+ ui.Input,
5329
+ {
5330
+ ...field,
5331
+ placeholder: "Enter the name of the automation"
5332
+ }
5333
+ ),
5251
5334
  fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
5252
5335
  ] })
5253
5336
  }
@@ -5261,7 +5344,13 @@ function AutomationsGeneralForm({ form, isOpen }) {
5261
5344
  name: "general.description",
5262
5345
  control: form.control,
5263
5346
  render: ({ field, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5264
- /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field, placeholder: "Enter the description of the automation" }),
5347
+ /* @__PURE__ */ jsxRuntime.jsx(
5348
+ ui.Input,
5349
+ {
5350
+ ...field,
5351
+ placeholder: "Enter the description of the automation"
5352
+ }
5353
+ ),
5265
5354
  fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
5266
5355
  ] })
5267
5356
  }
@@ -5284,7 +5373,14 @@ function AutomationsGeneralForm({ form, isOpen }) {
5284
5373
  },
5285
5374
  children: [
5286
5375
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select the trigger type" }) }),
5287
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: availableTriggers.map((type) => /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: type.value, children: type.label }, type.value)) })
5376
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: availableTriggers.map((type) => /* @__PURE__ */ jsxRuntime.jsx(
5377
+ ui.Select.Item,
5378
+ {
5379
+ value: type.value,
5380
+ children: type.label
5381
+ },
5382
+ type.value
5383
+ )) })
5288
5384
  ]
5289
5385
  },
5290
5386
  `trigger-type-${availableTriggers.length}-${field.value}`
@@ -5342,7 +5438,14 @@ function AutomationsGeneralForm({ form, isOpen }) {
5342
5438
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select the event name" }) }),
5343
5439
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: availableEvents == null ? void 0 : availableEvents.map((event) => /* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Group, { children: [
5344
5440
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Label, { children: event.name }),
5345
- event.events.map((eventItem) => /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: eventItem.value, children: eventItem.label }, eventItem.value))
5441
+ event.events.map((eventItem) => /* @__PURE__ */ jsxRuntime.jsx(
5442
+ ui.Select.Item,
5443
+ {
5444
+ value: eventItem.value,
5445
+ children: eventItem.label
5446
+ },
5447
+ eventItem.value
5448
+ ))
5346
5449
  ] }, event.name)) })
5347
5450
  ]
5348
5451
  },
@@ -9026,37 +9129,47 @@ const baseAutomationFormSchema = objectType({
9026
9129
  }).optional()
9027
9130
  });
9028
9131
  function createAutomationFormSchema(availableActions) {
9029
- return baseAutomationFormSchema.superRefine((data, ctx) => {
9030
- var _a;
9031
- if (((_a = data.actions) == null ? void 0 : _a.items) && availableActions) {
9032
- data.actions.items.forEach((action, index) => {
9033
- if (!action.action_type) {
9034
- return;
9035
- }
9036
- const actionDef = availableActions.find(
9037
- (a2) => a2.value === action.action_type
9038
- );
9039
- if (!actionDef || !actionDef.fields) {
9040
- return;
9041
- }
9042
- actionDef.fields.forEach((field) => {
9043
- var _a2;
9044
- if (field.required) {
9045
- const fieldValue = (_a2 = action.config) == null ? void 0 : _a2[field.name || field.key];
9046
- if (!fieldValue || !String(fieldValue).trim()) {
9047
- ctx.addIssue({
9048
- code: ZodIssueCode.custom,
9049
- message: `${field.label} is required`,
9050
- path: ["actions", "items", index, "config", field.name || field.key]
9051
- });
9052
- }
9132
+ return baseAutomationFormSchema.superRefine(
9133
+ (data, ctx) => {
9134
+ var _a;
9135
+ if (((_a = data.actions) == null ? void 0 : _a.items) && availableActions) {
9136
+ data.actions.items.forEach((action, index) => {
9137
+ if (!action.action_type) {
9138
+ return;
9053
9139
  }
9140
+ const actionDef = availableActions.find(
9141
+ (a2) => a2.value === action.action_type
9142
+ );
9143
+ if (!actionDef || !actionDef.fields) {
9144
+ return;
9145
+ }
9146
+ actionDef.fields.forEach((field) => {
9147
+ var _a2;
9148
+ if (field.required) {
9149
+ const fieldValue = (_a2 = action.config) == null ? void 0 : _a2[field.name || field.key];
9150
+ if (!fieldValue || !String(fieldValue).trim()) {
9151
+ ctx.addIssue({
9152
+ code: ZodIssueCode.custom,
9153
+ message: `${field.label} is required`,
9154
+ path: [
9155
+ "actions",
9156
+ "items",
9157
+ index,
9158
+ "config",
9159
+ field.name || field.key
9160
+ ]
9161
+ });
9162
+ }
9163
+ }
9164
+ });
9054
9165
  });
9055
- });
9166
+ }
9056
9167
  }
9057
- });
9168
+ );
9058
9169
  }
9059
- function AutomationsCreateForm({ id }) {
9170
+ function AutomationsCreateForm({
9171
+ id
9172
+ }) {
9060
9173
  const [open, setOpen] = React.useState(false);
9061
9174
  const [tab, setTab] = React.useState(Tab.GENERAL);
9062
9175
  const [tabState, setTabState] = React.useState({
@@ -9075,7 +9188,10 @@ function AutomationsCreateForm({ id }) {
9075
9188
  }
9076
9189
  }, [tab]);
9077
9190
  const queryClient = reactQuery.useQueryClient();
9078
- const { data: automationsTriggerData, isLoading: isAutomationsTriggerLoading } = useListAutomations({
9191
+ const {
9192
+ data: automationsTriggerData,
9193
+ isLoading: isAutomationsTriggerLoading
9194
+ } = useListAutomations({
9079
9195
  id,
9080
9196
  extraKey: [],
9081
9197
  enabled: open && !!id
@@ -9083,9 +9199,14 @@ function AutomationsCreateForm({ id }) {
9083
9199
  const { data: availableActionsData } = useAvailableActions({
9084
9200
  enabled: open
9085
9201
  });
9086
- const { mutateAsync: createAutomation, isPending: isCreateAutomationPending } = useCreateAutomation();
9202
+ const {
9203
+ mutateAsync: createAutomation,
9204
+ isPending: isCreateAutomationPending
9205
+ } = useCreateAutomation();
9087
9206
  const automationFormSchema = React.useMemo(() => {
9088
- return createAutomationFormSchema(availableActionsData == null ? void 0 : availableActionsData.actions);
9207
+ return createAutomationFormSchema(
9208
+ availableActionsData == null ? void 0 : availableActionsData.actions
9209
+ );
9089
9210
  }, [availableActionsData == null ? void 0 : availableActionsData.actions]);
9090
9211
  const form = useForm({
9091
9212
  resolver: t(automationFormSchema),
@@ -9161,7 +9282,9 @@ function AutomationsCreateForm({ id }) {
9161
9282
  await createAutomation({
9162
9283
  items: [items]
9163
9284
  }).then(() => {
9164
- queryClient.invalidateQueries({ queryKey: ["automations"] });
9285
+ queryClient.invalidateQueries({
9286
+ queryKey: ["automations"]
9287
+ });
9165
9288
  ui.toast.success("Automation created successfully", {
9166
9289
  position: "top-right",
9167
9290
  duration: 3e3
@@ -9183,11 +9306,30 @@ function AutomationsCreateForm({ id }) {
9183
9306
  dir: "ltr",
9184
9307
  value: tab,
9185
9308
  className: "flex h-full flex-col overflow-hidden",
9186
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.ProgressTabs.List, { className: "justify-start-start flex w-full items-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.ProgressTabs.Trigger, { value: Tab.GENERAL, status: tabState[Tab.GENERAL], children: "General" }) })
9309
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.ProgressTabs.List, { className: "justify-start-start flex w-full items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
9310
+ ui.ProgressTabs.Trigger,
9311
+ {
9312
+ value: Tab.GENERAL,
9313
+ status: tabState[Tab.GENERAL],
9314
+ children: "General"
9315
+ }
9316
+ ) })
9187
9317
  }
9188
9318
  ) })
9189
9319
  ] }),
9190
- /* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal.Body, { className: "w-full overflow-y-auto", children: isAutomationsTriggerLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: "Loading..." }) : /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: form.handleSubmit(handleSubmit), children: tab === Tab.GENERAL && /* @__PURE__ */ jsxRuntime.jsx(AutomationsGeneralForm, { form, isOpen: open }) }) }),
9320
+ /* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal.Body, { className: "w-full overflow-y-auto", children: isAutomationsTriggerLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: "Loading..." }) : /* @__PURE__ */ jsxRuntime.jsx(
9321
+ "form",
9322
+ {
9323
+ onSubmit: form.handleSubmit(handleSubmit),
9324
+ children: tab === Tab.GENERAL && /* @__PURE__ */ jsxRuntime.jsx(
9325
+ AutomationsGeneralForm,
9326
+ {
9327
+ form,
9328
+ isOpen: open
9329
+ }
9330
+ )
9331
+ }
9332
+ ) }),
9191
9333
  /* @__PURE__ */ jsxRuntime.jsxs(ui.FocusModal.Footer, { children: [
9192
9334
  /* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9193
9335
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -9205,17 +9347,31 @@ function AutomationsCreateForm({ id }) {
9205
9347
  ] });
9206
9348
  }
9207
9349
  const useEditAutomationRule = () => {
9208
- return reactQuery.useMutation({
9209
- mutationFn: async (data) => {
9210
- await sdk.client.fetch("/admin/mpn/automations/rules", {
9211
- method: "POST",
9212
- body: data
9213
- });
9350
+ return reactQuery.useMutation(
9351
+ {
9352
+ mutationFn: async (data) => {
9353
+ await sdk.client.fetch(
9354
+ "/admin/mpn/automations/rules",
9355
+ {
9356
+ method: "POST",
9357
+ body: data
9358
+ }
9359
+ );
9360
+ }
9214
9361
  }
9215
- });
9362
+ );
9216
9363
  };
9217
9364
  const useListAutomationsRules = (params, options) => {
9218
- const { limit = 100, offset = 0, extraKey = [], enabled, fields, order = "created_at", id, trigger_id } = params;
9365
+ const {
9366
+ limit = 100,
9367
+ offset = 0,
9368
+ extraKey = [],
9369
+ enabled,
9370
+ fields,
9371
+ order = "created_at",
9372
+ id,
9373
+ trigger_id
9374
+ } = params;
9219
9375
  const queryKey = [
9220
9376
  "automations-rules",
9221
9377
  limit,
@@ -9237,10 +9393,13 @@ const useListAutomationsRules = (params, options) => {
9237
9393
  const { data, ...rest } = reactQuery.useQuery({
9238
9394
  queryKey,
9239
9395
  queryFn: async () => {
9240
- return await sdk.client.fetch("/admin/mpn/automations/rules", {
9241
- method: "GET",
9242
- query
9243
- });
9396
+ return await sdk.client.fetch(
9397
+ "/admin/mpn/automations/rules",
9398
+ {
9399
+ method: "GET",
9400
+ query
9401
+ }
9402
+ );
9244
9403
  },
9245
9404
  enabled,
9246
9405
  ...options
@@ -9248,17 +9407,31 @@ const useListAutomationsRules = (params, options) => {
9248
9407
  return { data, ...rest };
9249
9408
  };
9250
9409
  const useEditAutomationAction = () => {
9251
- return reactQuery.useMutation({
9252
- mutationFn: async (data) => {
9253
- await sdk.client.fetch("/admin/mpn/automations/actions", {
9254
- method: "POST",
9255
- body: data
9256
- });
9410
+ return reactQuery.useMutation(
9411
+ {
9412
+ mutationFn: async (data) => {
9413
+ await sdk.client.fetch(
9414
+ "/admin/mpn/automations/actions",
9415
+ {
9416
+ method: "POST",
9417
+ body: data
9418
+ }
9419
+ );
9420
+ }
9257
9421
  }
9258
- });
9422
+ );
9259
9423
  };
9260
9424
  const useListAutomationsActions = (params, options) => {
9261
- const { limit = 100, offset = 0, extraKey = [], enabled, fields, order = "created_at", id, trigger_id } = params;
9425
+ const {
9426
+ limit = 100,
9427
+ offset = 0,
9428
+ extraKey = [],
9429
+ enabled,
9430
+ fields,
9431
+ order = "created_at",
9432
+ id,
9433
+ trigger_id
9434
+ } = params;
9262
9435
  const queryKey = [
9263
9436
  "automations-actions",
9264
9437
  limit,
@@ -9280,10 +9453,13 @@ const useListAutomationsActions = (params, options) => {
9280
9453
  const { data, ...rest } = reactQuery.useQuery({
9281
9454
  queryKey,
9282
9455
  queryFn: async () => {
9283
- return await sdk.client.fetch("/admin/mpn/automations/actions", {
9284
- method: "GET",
9285
- query
9286
- });
9456
+ return await sdk.client.fetch(
9457
+ "/admin/mpn/automations/actions",
9458
+ {
9459
+ method: "GET",
9460
+ query
9461
+ }
9462
+ );
9287
9463
  },
9288
9464
  enabled,
9289
9465
  ...options
@@ -9316,8 +9492,13 @@ const OPERATOR_TYPES = [
9316
9492
  label: "Less Than or Equal"
9317
9493
  }
9318
9494
  ];
9319
- function AutomationsRulesForm({ form, isOpen }) {
9320
- const { data: availableEventsData } = useAvailableEvents({
9495
+ function AutomationsRulesForm({
9496
+ form,
9497
+ isOpen
9498
+ }) {
9499
+ const {
9500
+ data: availableEventsData
9501
+ } = useAvailableEvents({
9321
9502
  enabled: isOpen !== false
9322
9503
  });
9323
9504
  const eventName = form.watch("general.event_name");
@@ -9336,7 +9517,11 @@ function AutomationsRulesForm({ form, isOpen }) {
9336
9517
  }
9337
9518
  return [];
9338
9519
  }, [availableEventsData, eventName]);
9339
- const { fields = [], append, remove } = useFieldArray({
9520
+ const {
9521
+ fields = [],
9522
+ append,
9523
+ remove
9524
+ } = useFieldArray({
9340
9525
  control: form.control,
9341
9526
  name: "rules.items"
9342
9527
  });
@@ -9356,93 +9541,118 @@ function AutomationsRulesForm({ form, isOpen }) {
9356
9541
  };
9357
9542
  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: [
9358
9543
  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.' }),
9359
- fields.map((field, index) => /* @__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: [
9360
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col gap-2", children: [
9361
- /* @__PURE__ */ jsxRuntime.jsx(
9362
- Controller,
9363
- {
9364
- name: `rules.items.${index}.attribute`,
9365
- control: form.control,
9366
- render: ({ field: field2, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9367
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Attribute" }),
9368
- /* @__PURE__ */ jsxRuntime.jsxs(
9369
- ui.Select,
9370
- {
9371
- value: field2.value ?? "",
9372
- onValueChange: (value) => {
9373
- field2.onChange(value);
9374
- },
9375
- children: [
9376
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select the attribute" }) }),
9377
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: eventAttributes.map((attribute, attrIndex) => /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: attribute.value || "ss", children: attribute.label }, attribute.value || `attr-${index}-${attrIndex}`)) })
9378
- ]
9379
- },
9380
- `attribute-${index}-${eventAttributes.length}`
9381
- ),
9382
- fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
9383
- ] })
9384
- }
9385
- ),
9386
- /* @__PURE__ */ jsxRuntime.jsx(
9387
- Controller,
9388
- {
9389
- name: `rules.items.${index}.operator`,
9390
- control: form.control,
9391
- render: ({ field: field2, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9392
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Operator" }),
9393
- /* @__PURE__ */ jsxRuntime.jsxs(
9394
- ui.Select,
9395
- {
9396
- value: field2.value ?? "",
9397
- onValueChange: (value) => {
9398
- field2.onChange(value);
9399
- },
9400
- children: [
9401
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select the operator" }) }),
9402
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: OPERATOR_TYPES.map((operator, opIndex) => /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: operator.value, children: operator.label }, operator.value || `op-${opIndex}`)) })
9403
- ]
9404
- },
9405
- `operator-${index}-${eventAttributes.length}-${field2.value ?? ""}`
9406
- ),
9407
- fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
9408
- ] })
9409
- }
9410
- ),
9411
- /* @__PURE__ */ jsxRuntime.jsx(
9412
- Controller,
9413
- {
9414
- name: `rules.items.${index}.rule_values.0.value`,
9415
- control: form.control,
9416
- render: ({ field: field2, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9417
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Value" }),
9418
- /* @__PURE__ */ jsxRuntime.jsx(
9419
- ui.Input,
9420
- {
9421
- value: field2.value ?? "",
9422
- onChange: (e2) => {
9423
- field2.onChange(e2.target.value);
9424
- },
9425
- onBlur: field2.onBlur,
9426
- ref: field2.ref
9427
- }
9428
- ),
9429
- fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
9430
- ] })
9431
- }
9432
- )
9433
- ] }),
9434
- /* @__PURE__ */ jsxRuntime.jsx(
9435
- ui.Button,
9436
- {
9437
- type: "button",
9438
- variant: "secondary",
9439
- size: "small",
9440
- onClick: () => handleRemoveRule(index),
9441
- className: "mt-2",
9442
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
9443
- }
9444
- )
9445
- ] }) }, (field == null ? void 0 : field.id) ?? `rule-${index}`)),
9544
+ fields.map((field, index) => /* @__PURE__ */ jsxRuntime.jsx(
9545
+ "div",
9546
+ {
9547
+ className: "flex flex-col gap-2 p-4 border rounded-lg",
9548
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4", children: [
9549
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col gap-2", children: [
9550
+ /* @__PURE__ */ jsxRuntime.jsx(
9551
+ Controller,
9552
+ {
9553
+ name: `rules.items.${index}.attribute`,
9554
+ control: form.control,
9555
+ render: ({ field: field2, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9556
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Attribute" }),
9557
+ /* @__PURE__ */ jsxRuntime.jsxs(
9558
+ ui.Select,
9559
+ {
9560
+ value: field2.value ?? "",
9561
+ onValueChange: (value) => {
9562
+ field2.onChange(value);
9563
+ },
9564
+ children: [
9565
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select the attribute" }) }),
9566
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: eventAttributes.map(
9567
+ (attribute, attrIndex) => /* @__PURE__ */ jsxRuntime.jsx(
9568
+ ui.Select.Item,
9569
+ {
9570
+ value: attribute.value || "ss",
9571
+ children: attribute.label
9572
+ },
9573
+ attribute.value || `attr-${index}-${attrIndex}`
9574
+ )
9575
+ ) })
9576
+ ]
9577
+ },
9578
+ `attribute-${index}-${eventAttributes.length}`
9579
+ ),
9580
+ fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
9581
+ ] })
9582
+ }
9583
+ ),
9584
+ /* @__PURE__ */ jsxRuntime.jsx(
9585
+ Controller,
9586
+ {
9587
+ name: `rules.items.${index}.operator`,
9588
+ control: form.control,
9589
+ render: ({ field: field2, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9590
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Operator" }),
9591
+ /* @__PURE__ */ jsxRuntime.jsxs(
9592
+ ui.Select,
9593
+ {
9594
+ value: field2.value ?? "",
9595
+ onValueChange: (value) => {
9596
+ field2.onChange(value);
9597
+ },
9598
+ children: [
9599
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select the operator" }) }),
9600
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: OPERATOR_TYPES.map(
9601
+ (operator, opIndex) => /* @__PURE__ */ jsxRuntime.jsx(
9602
+ ui.Select.Item,
9603
+ {
9604
+ value: operator.value,
9605
+ children: operator.label
9606
+ },
9607
+ operator.value || `op-${opIndex}`
9608
+ )
9609
+ ) })
9610
+ ]
9611
+ },
9612
+ `operator-${index}-${eventAttributes.length}-${field2.value ?? ""}`
9613
+ ),
9614
+ fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
9615
+ ] })
9616
+ }
9617
+ ),
9618
+ /* @__PURE__ */ jsxRuntime.jsx(
9619
+ Controller,
9620
+ {
9621
+ name: `rules.items.${index}.rule_values.0.value`,
9622
+ control: form.control,
9623
+ render: ({ field: field2, fieldState }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9624
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Value" }),
9625
+ /* @__PURE__ */ jsxRuntime.jsx(
9626
+ ui.Input,
9627
+ {
9628
+ value: field2.value ?? "",
9629
+ onChange: (e2) => {
9630
+ field2.onChange(e2.target.value);
9631
+ },
9632
+ onBlur: field2.onBlur,
9633
+ ref: field2.ref
9634
+ }
9635
+ ),
9636
+ fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
9637
+ ] })
9638
+ }
9639
+ )
9640
+ ] }),
9641
+ /* @__PURE__ */ jsxRuntime.jsx(
9642
+ ui.Button,
9643
+ {
9644
+ type: "button",
9645
+ variant: "secondary",
9646
+ size: "small",
9647
+ onClick: () => handleRemoveRule(index),
9648
+ className: "mt-2",
9649
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
9650
+ }
9651
+ )
9652
+ ] })
9653
+ },
9654
+ (field == null ? void 0 : field.id) ?? `rule-${index}`
9655
+ )),
9446
9656
  /* @__PURE__ */ jsxRuntime.jsxs(
9447
9657
  ui.Button,
9448
9658
  {
@@ -9459,7 +9669,7 @@ function AutomationsRulesForm({ form, isOpen }) {
9459
9669
  ] }) }) });
9460
9670
  }
9461
9671
  const templateLoaders = {
9462
- "BaseConfigComponent": () => Promise.resolve().then(() => require("./base-config-DsBoNoxD"))
9672
+ BaseConfigComponent: () => Promise.resolve().then(() => require("./base-config-ro-vFPBg"))
9463
9673
  };
9464
9674
  async function loadTemplateComponent(key) {
9465
9675
  const loader = templateLoaders[key];
@@ -9477,7 +9687,9 @@ function LoadActionComponent({
9477
9687
  errors,
9478
9688
  fields
9479
9689
  }) {
9480
- const [Component, setComponent] = React.useState(null);
9690
+ const [Component, setComponent] = React.useState(
9691
+ null
9692
+ );
9481
9693
  const [loading, setLoading] = React.useState(false);
9482
9694
  const [error, setError] = React.useState(null);
9483
9695
  React.useEffect(() => {
@@ -9493,7 +9705,9 @@ function LoadActionComponent({
9493
9705
  if (Component2) {
9494
9706
  setComponent(() => Component2);
9495
9707
  } else {
9496
- setError(`Component not found in ${configComponentKey}`);
9708
+ setError(
9709
+ `Component not found in ${configComponentKey}`
9710
+ );
9497
9711
  }
9498
9712
  }).catch((err) => {
9499
9713
  console.error(
@@ -9517,16 +9731,30 @@ function LoadActionComponent({
9517
9731
  if (!Component) {
9518
9732
  return null;
9519
9733
  }
9520
- return /* @__PURE__ */ jsxRuntime.jsx(Component, { form, name, errors, fields });
9734
+ return /* @__PURE__ */ jsxRuntime.jsx(
9735
+ Component,
9736
+ {
9737
+ form,
9738
+ name,
9739
+ errors,
9740
+ fields
9741
+ }
9742
+ );
9521
9743
  }
9522
9744
  function AutomationsActionsForm({
9523
9745
  form,
9524
9746
  isOpen
9525
9747
  }) {
9526
- const { data: availableActionsData } = useAvailableActions({
9748
+ const {
9749
+ data: availableActionsData
9750
+ } = useAvailableActions({
9527
9751
  enabled: isOpen !== false
9528
9752
  });
9529
- const { fields = [], append, remove } = useFieldArray({
9753
+ const {
9754
+ fields = [],
9755
+ append,
9756
+ remove
9757
+ } = useFieldArray({
9530
9758
  control: form.control,
9531
9759
  name: "actions.items"
9532
9760
  });
@@ -9551,7 +9779,10 @@ function AutomationsActionsForm({
9551
9779
  {
9552
9780
  name: `actions.items.${index}.action_type`,
9553
9781
  control: form.control,
9554
- render: ({ field: actionTypeField, fieldState }) => {
9782
+ render: ({
9783
+ field: actionTypeField,
9784
+ fieldState
9785
+ }) => {
9555
9786
  var _a, _b, _c, _d, _e, _f, _g;
9556
9787
  const actionType = actionTypeField.value;
9557
9788
  const actionData = (_a = availableActionsData == null ? void 0 : availableActionsData.actions) == null ? void 0 : _a.find(
@@ -9560,69 +9791,80 @@ function AutomationsActionsForm({
9560
9791
  const configComponentKey = actionData == null ? void 0 : actionData.configComponentKey;
9561
9792
  const fields2 = actionData == null ? void 0 : actionData.fields;
9562
9793
  const isEnabled = actionType ? actionData == null ? void 0 : actionData.enabled : true;
9563
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex flex-col gap-4 p-4 border rounded-lg ${isEnabled ? "opacity-100" : "opacity-50"}`, children: [
9564
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4", children: [
9565
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col gap-2", children: [
9566
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Action Type" }),
9567
- /* @__PURE__ */ jsxRuntime.jsxs(
9568
- ui.Select,
9794
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9795
+ "div",
9796
+ {
9797
+ className: `flex flex-col gap-4 p-4 border rounded-lg ${isEnabled ? "opacity-100" : "opacity-50"}`,
9798
+ children: [
9799
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4", children: [
9800
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col gap-2", children: [
9801
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Action Type" }),
9802
+ /* @__PURE__ */ jsxRuntime.jsxs(
9803
+ ui.Select,
9804
+ {
9805
+ value: actionTypeField.value ?? "",
9806
+ onValueChange: (value) => {
9807
+ actionTypeField.onChange(
9808
+ value
9809
+ );
9810
+ form.setValue(
9811
+ `actions.items.${index}.config`,
9812
+ {},
9813
+ {
9814
+ shouldValidate: false,
9815
+ shouldDirty: true
9816
+ }
9817
+ );
9818
+ },
9819
+ children: [
9820
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select the action type" }) }),
9821
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: (_b = availableActionsData == null ? void 0 : availableActionsData.actions) == null ? void 0 : _b.map(
9822
+ (action, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
9823
+ ui.Select.Item,
9824
+ {
9825
+ value: action.value || "",
9826
+ children: [
9827
+ action.label,
9828
+ " ",
9829
+ action.enabled ? "" : "(Disabled)"
9830
+ ]
9831
+ },
9832
+ action.value || `action-${index}-${actionIndex}`
9833
+ )
9834
+ ) })
9835
+ ]
9836
+ },
9837
+ `action-type-${index}-${((_c = availableActionsData == null ? void 0 : availableActionsData.actions) == null ? void 0 : _c.length) || 0}`
9838
+ ),
9839
+ fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
9840
+ ] }),
9841
+ /* @__PURE__ */ jsxRuntime.jsx(
9842
+ ui.Button,
9843
+ {
9844
+ type: "button",
9845
+ variant: "secondary",
9846
+ size: "small",
9847
+ onClick: () => handleRemoveRule(index),
9848
+ className: "mt-2",
9849
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
9850
+ }
9851
+ )
9852
+ ] }),
9853
+ actionType && configComponentKey && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 pt-4 border-t", children: /* @__PURE__ */ jsxRuntime.jsx(
9854
+ LoadActionComponent,
9569
9855
  {
9570
- value: actionTypeField.value ?? "",
9571
- onValueChange: (value) => {
9572
- actionTypeField.onChange(value);
9573
- form.setValue(
9574
- `actions.items.${index}.config`,
9575
- {},
9576
- { shouldValidate: false, shouldDirty: true }
9577
- );
9578
- },
9579
- children: [
9580
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select the action type" }) }),
9581
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: (_b = availableActionsData == null ? void 0 : availableActionsData.actions) == null ? void 0 : _b.map(
9582
- (action, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
9583
- ui.Select.Item,
9584
- {
9585
- value: action.value || "",
9586
- children: [
9587
- action.label,
9588
- " ",
9589
- action.enabled ? "" : "(Disabled)"
9590
- ]
9591
- },
9592
- action.value || `action-${index}-${actionIndex}`
9593
- )
9594
- ) })
9595
- ]
9596
- },
9597
- `action-type-${index}-${((_c = availableActionsData == null ? void 0 : availableActionsData.actions) == null ? void 0 : _c.length) || 0}`
9598
- ),
9599
- fieldState.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 text-sm", children: fieldState.error.message })
9600
- ] }),
9601
- /* @__PURE__ */ jsxRuntime.jsx(
9602
- ui.Button,
9603
- {
9604
- type: "button",
9605
- variant: "secondary",
9606
- size: "small",
9607
- onClick: () => handleRemoveRule(index),
9608
- className: "mt-2",
9609
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
9610
- }
9611
- )
9612
- ] }),
9613
- actionType && configComponentKey && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 pt-4 border-t", children: /* @__PURE__ */ jsxRuntime.jsx(
9614
- LoadActionComponent,
9615
- {
9616
- actionType,
9617
- configComponentKey,
9618
- form,
9619
- name: `actions.items.${index}.config`,
9620
- errors: (_g = (_f = (_e = (_d = form.formState.errors) == null ? void 0 : _d.actions) == null ? void 0 : _e.items) == null ? void 0 : _f[index]) == null ? void 0 : _g.config,
9621
- fields: fields2
9622
- }
9623
- ) }),
9624
- !isEnabled && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-red-500", children: "The action is disabled by the configuration" })
9625
- ] });
9856
+ actionType,
9857
+ configComponentKey,
9858
+ form,
9859
+ name: `actions.items.${index}.config`,
9860
+ errors: (_g = (_f = (_e = (_d = form.formState.errors) == null ? void 0 : _d.actions) == null ? void 0 : _e.items) == null ? void 0 : _f[index]) == null ? void 0 : _g.config,
9861
+ fields: fields2
9862
+ }
9863
+ ) }),
9864
+ !isEnabled && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-red-500", children: "The action is disabled by the configuration" })
9865
+ ]
9866
+ }
9867
+ );
9626
9868
  }
9627
9869
  },
9628
9870
  (field == null ? void 0 : field.id) ?? `action-${index}`
@@ -9643,7 +9885,9 @@ function AutomationsActionsForm({
9643
9885
  )
9644
9886
  ] }) }) });
9645
9887
  }
9646
- function AutomationsEditForm({ id }) {
9888
+ function AutomationsEditForm({
9889
+ id
9890
+ }) {
9647
9891
  const [open, setOpen] = React.useState(false);
9648
9892
  const [tab, setTab] = React.useState(Tab.GENERAL);
9649
9893
  const [tabState, setTabState] = React.useState({
@@ -9662,17 +9906,26 @@ function AutomationsEditForm({ id }) {
9662
9906
  }
9663
9907
  }, [tab]);
9664
9908
  const queryClient = reactQuery.useQueryClient();
9665
- const { data: automationsTriggerData, isLoading: isAutomationsTriggerLoading } = useListAutomations({
9909
+ const {
9910
+ data: automationsTriggerData,
9911
+ isLoading: isAutomationsTriggerLoading
9912
+ } = useListAutomations({
9666
9913
  id,
9667
9914
  extraKey: [],
9668
9915
  enabled: open && !!id
9669
9916
  });
9670
- const { data: automationsRulesData, isLoading: isAutomationsRulesLoading } = useListAutomationsRules({
9917
+ const {
9918
+ data: automationsRulesData,
9919
+ isLoading: isAutomationsRulesLoading
9920
+ } = useListAutomationsRules({
9671
9921
  trigger_id: id,
9672
9922
  extraKey: [id],
9673
9923
  enabled: open && !!id
9674
9924
  });
9675
- const { data: automationsActionsData, isLoading: isAutomationsActionsLoading } = useListAutomationsActions({
9925
+ const {
9926
+ data: automationsActionsData,
9927
+ isLoading: isAutomationsActionsLoading
9928
+ } = useListAutomationsActions({
9676
9929
  trigger_id: id,
9677
9930
  extraKey: [id],
9678
9931
  enabled: open && !!id
@@ -9680,11 +9933,22 @@ function AutomationsEditForm({ id }) {
9680
9933
  const { data: availableActionsData } = useAvailableActions({
9681
9934
  enabled: open
9682
9935
  });
9683
- const { mutateAsync: editAutomation, isPending: isEditAutomationPending } = useEditAutomation();
9684
- const { mutateAsync: editAutomationRule, isPending: isEditAutomationRulePending } = useEditAutomationRule();
9685
- const { mutateAsync: editAutomationAction, isPending: isEditAutomationActionPending } = useEditAutomationAction();
9936
+ const {
9937
+ mutateAsync: editAutomation,
9938
+ isPending: isEditAutomationPending
9939
+ } = useEditAutomation();
9940
+ const {
9941
+ mutateAsync: editAutomationRule,
9942
+ isPending: isEditAutomationRulePending
9943
+ } = useEditAutomationRule();
9944
+ const {
9945
+ mutateAsync: editAutomationAction,
9946
+ isPending: isEditAutomationActionPending
9947
+ } = useEditAutomationAction();
9686
9948
  const automationFormSchema = React.useMemo(() => {
9687
- return createAutomationFormSchema(availableActionsData == null ? void 0 : availableActionsData.actions);
9949
+ return createAutomationFormSchema(
9950
+ availableActionsData == null ? void 0 : availableActionsData.actions
9951
+ );
9688
9952
  }, [availableActionsData == null ? void 0 : availableActionsData.actions]);
9689
9953
  const form = useForm({
9690
9954
  resolver: t(automationFormSchema),
@@ -9727,11 +9991,13 @@ function AutomationsEditForm({ id }) {
9727
9991
  operator: rule.operator,
9728
9992
  description: rule.description,
9729
9993
  metadata: rule.metadata,
9730
- rule_values: rule.rule_values.map((value) => ({
9731
- id: value.id,
9732
- value: value.value,
9733
- metadata: value.metadata
9734
- }))
9994
+ rule_values: rule.rule_values.map(
9995
+ (value) => ({
9996
+ id: value.id,
9997
+ value: value.value,
9998
+ metadata: value.metadata
9999
+ })
10000
+ )
9735
10001
  }))
9736
10002
  },
9737
10003
  actions: {
@@ -9780,7 +10046,9 @@ function AutomationsEditForm({ id }) {
9780
10046
  id,
9781
10047
  items: [items]
9782
10048
  });
9783
- queryClient.invalidateQueries({ queryKey: ["automations"] });
10049
+ queryClient.invalidateQueries({
10050
+ queryKey: ["automations"]
10051
+ });
9784
10052
  ui.toast.success("Automation updated successfully", {
9785
10053
  position: "top-right",
9786
10054
  duration: 3e3
@@ -9792,16 +10060,23 @@ function AutomationsEditForm({ id }) {
9792
10060
  rules: ((_a = data.rules) == null ? void 0 : _a.items) || []
9793
10061
  };
9794
10062
  const fieldsToValidate = getFieldsForTab(tab);
9795
- const valid = await form.trigger(fieldsToValidate);
10063
+ const valid = await form.trigger(
10064
+ fieldsToValidate
10065
+ );
9796
10066
  if (!valid) {
9797
10067
  return;
9798
10068
  }
9799
10069
  await editAutomationRule(items);
9800
- queryClient.invalidateQueries({ queryKey: ["automations-rules", id] });
9801
- ui.toast.success("Automation rules added/updated successfully", {
9802
- position: "top-right",
9803
- duration: 3e3
10070
+ queryClient.invalidateQueries({
10071
+ queryKey: ["automations-rules", id]
9804
10072
  });
10073
+ ui.toast.success(
10074
+ "Automation rules added/updated successfully",
10075
+ {
10076
+ position: "top-right",
10077
+ duration: 3e3
10078
+ }
10079
+ );
9805
10080
  }
9806
10081
  if (Tab.ACTIONS === tab) {
9807
10082
  const items = {
@@ -9809,11 +10084,16 @@ function AutomationsEditForm({ id }) {
9809
10084
  actions: ((_b = data.actions) == null ? void 0 : _b.items) || []
9810
10085
  };
9811
10086
  await editAutomationAction(items);
9812
- queryClient.invalidateQueries({ queryKey: ["automations-actions", id] });
9813
- ui.toast.success("Automation actions added/updated successfully", {
9814
- position: "top-right",
9815
- duration: 3e3
10087
+ queryClient.invalidateQueries({
10088
+ queryKey: ["automations-actions", id]
9816
10089
  });
10090
+ ui.toast.success(
10091
+ "Automation actions added/updated successfully",
10092
+ {
10093
+ position: "top-right",
10094
+ duration: 3e3
10095
+ }
10096
+ );
9817
10097
  }
9818
10098
  }
9819
10099
  const getFieldsForTab = (tab2) => {
@@ -9834,7 +10114,9 @@ function AutomationsEditForm({ id }) {
9834
10114
  };
9835
10115
  const handleTabChange = async (newTab) => {
9836
10116
  const fieldsToValidate = getFieldsForTab(tab);
9837
- const valid = await form.trigger(fieldsToValidate);
10117
+ const valid = await form.trigger(
10118
+ fieldsToValidate
10119
+ );
9838
10120
  if (!valid) {
9839
10121
  return;
9840
10122
  }
@@ -9857,18 +10139,66 @@ function AutomationsEditForm({ id }) {
9857
10139
  value: tab,
9858
10140
  className: "flex h-full flex-col overflow-hidden",
9859
10141
  children: /* @__PURE__ */ jsxRuntime.jsxs(ui.ProgressTabs.List, { className: "justify-start-start flex w-full items-center", children: [
9860
- /* @__PURE__ */ jsxRuntime.jsx(ui.ProgressTabs.Trigger, { value: Tab.GENERAL, status: tabState[Tab.GENERAL], onClick: () => handleTabChange(Tab.GENERAL), children: "General" }),
9861
- /* @__PURE__ */ jsxRuntime.jsx(ui.ProgressTabs.Trigger, { value: Tab.RULES, status: tabState[Tab.RULES], onClick: () => handleTabChange(Tab.RULES), children: "Rules" }),
9862
- /* @__PURE__ */ jsxRuntime.jsx(ui.ProgressTabs.Trigger, { value: Tab.ACTIONS, status: tabState[Tab.ACTIONS], onClick: () => handleTabChange(Tab.ACTIONS), children: "Actions" })
10142
+ /* @__PURE__ */ jsxRuntime.jsx(
10143
+ ui.ProgressTabs.Trigger,
10144
+ {
10145
+ value: Tab.GENERAL,
10146
+ status: tabState[Tab.GENERAL],
10147
+ onClick: () => handleTabChange(Tab.GENERAL),
10148
+ children: "General"
10149
+ }
10150
+ ),
10151
+ /* @__PURE__ */ jsxRuntime.jsx(
10152
+ ui.ProgressTabs.Trigger,
10153
+ {
10154
+ value: Tab.RULES,
10155
+ status: tabState[Tab.RULES],
10156
+ onClick: () => handleTabChange(Tab.RULES),
10157
+ children: "Rules"
10158
+ }
10159
+ ),
10160
+ /* @__PURE__ */ jsxRuntime.jsx(
10161
+ ui.ProgressTabs.Trigger,
10162
+ {
10163
+ value: Tab.ACTIONS,
10164
+ status: tabState[Tab.ACTIONS],
10165
+ onClick: () => handleTabChange(Tab.ACTIONS),
10166
+ children: "Actions"
10167
+ }
10168
+ )
9863
10169
  ] })
9864
10170
  }
9865
10171
  ) })
9866
10172
  ] }),
9867
- /* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal.Body, { className: "w-full overflow-y-auto", children: isAutomationsTriggerLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: "Loading..." }) : /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: form.handleSubmit(handleSubmit), children: [
9868
- tab === Tab.GENERAL && /* @__PURE__ */ jsxRuntime.jsx(AutomationsGeneralForm, { form, isOpen: open }),
9869
- tab === Tab.RULES && /* @__PURE__ */ jsxRuntime.jsx(AutomationsRulesForm, { form, isOpen: open }),
9870
- tab === Tab.ACTIONS && /* @__PURE__ */ jsxRuntime.jsx(AutomationsActionsForm, { form, isOpen: open })
9871
- ] }) }),
10173
+ /* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal.Body, { className: "w-full overflow-y-auto", children: isAutomationsTriggerLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: "Loading..." }) : /* @__PURE__ */ jsxRuntime.jsxs(
10174
+ "form",
10175
+ {
10176
+ onSubmit: form.handleSubmit(handleSubmit),
10177
+ children: [
10178
+ tab === Tab.GENERAL && /* @__PURE__ */ jsxRuntime.jsx(
10179
+ AutomationsGeneralForm,
10180
+ {
10181
+ form,
10182
+ isOpen: open
10183
+ }
10184
+ ),
10185
+ tab === Tab.RULES && /* @__PURE__ */ jsxRuntime.jsx(
10186
+ AutomationsRulesForm,
10187
+ {
10188
+ form,
10189
+ isOpen: open
10190
+ }
10191
+ ),
10192
+ tab === Tab.ACTIONS && /* @__PURE__ */ jsxRuntime.jsx(
10193
+ AutomationsActionsForm,
10194
+ {
10195
+ form,
10196
+ isOpen: open
10197
+ }
10198
+ )
10199
+ ]
10200
+ }
10201
+ ) }),
9872
10202
  /* @__PURE__ */ jsxRuntime.jsxs(ui.FocusModal.Footer, { children: [
9873
10203
  /* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9874
10204
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -9885,7 +10215,9 @@ function AutomationsEditForm({ id }) {
9885
10215
  ] })
9886
10216
  ] });
9887
10217
  }
9888
- const AutomationDeleteButton = ({ id }) => {
10218
+ const AutomationDeleteButton = ({
10219
+ id
10220
+ }) => {
9889
10221
  const queryClient = reactQuery.useQueryClient();
9890
10222
  const prompt = ui.usePrompt();
9891
10223
  const { mutate: deleteAutomation } = useDeleteAutomation();
@@ -9894,7 +10226,9 @@ const AutomationDeleteButton = ({ id }) => {
9894
10226
  { id },
9895
10227
  {
9896
10228
  onSuccess: () => {
9897
- queryClient.invalidateQueries({ queryKey: ["automations"] });
10229
+ queryClient.invalidateQueries({
10230
+ queryKey: ["automations"]
10231
+ });
9898
10232
  },
9899
10233
  onError: (error) => {
9900
10234
  ui.toast.error(error.message);
@@ -9913,7 +10247,15 @@ const AutomationDeleteButton = ({ id }) => {
9913
10247
  handleDelete();
9914
10248
  }
9915
10249
  };
9916
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "primary", onClick: handleDeleteConfirmation, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "w-4 h-4" }) });
10250
+ return /* @__PURE__ */ jsxRuntime.jsx(
10251
+ ui.Button,
10252
+ {
10253
+ size: "small",
10254
+ variant: "primary",
10255
+ onClick: handleDeleteConfirmation,
10256
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "w-4 h-4" })
10257
+ }
10258
+ );
9917
10259
  };
9918
10260
  const AutomationsList = () => {
9919
10261
  const [pagination, setPagination] = React.useState({
@@ -9948,7 +10290,14 @@ const AutomationsList = () => {
9948
10290
  /* @__PURE__ */ jsxRuntime.jsx(
9949
10291
  ui.Tooltip,
9950
10292
  {
9951
- content: /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: tooltip } }),
10293
+ content: /* @__PURE__ */ jsxRuntime.jsx(
10294
+ "div",
10295
+ {
10296
+ dangerouslySetInnerHTML: {
10297
+ __html: tooltip
10298
+ }
10299
+ }
10300
+ ),
9952
10301
  maxWidth: 400,
9953
10302
  children: /* @__PURE__ */ jsxRuntime.jsx(icons.InformationCircleSolid, {})
9954
10303
  }
@@ -9975,8 +10324,11 @@ const AutomationsList = () => {
9975
10324
  columnHelper.accessor("last_run_at", {
9976
10325
  header: "Last Run At",
9977
10326
  cell: ({ row }) => {
9978
- var _a;
9979
- return /* @__PURE__ */ jsxRuntime.jsx("span", { children: ((_a = row == null ? void 0 : row.original) == null ? void 0 : _a.last_run_at) ? new Date(row.original.last_run_at).toLocaleString() : "-" });
10327
+ var _a, _b;
10328
+ const lastRunAtAll = (_b = (_a = row == null ? void 0 : row.original) == null ? void 0 : _a.states) == null ? void 0 : _b.map((state) => state.last_triggered_at).sort(
10329
+ (a2, b) => new Date(b).getTime() - new Date(a2).getTime()
10330
+ );
10331
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { children: lastRunAtAll.length > 0 ? new Date(lastRunAtAll[0]).toLocaleString() : "-" });
9980
10332
  }
9981
10333
  }),
9982
10334
  columnHelper.accessor("active", {
@@ -9992,14 +10344,18 @@ const AutomationsList = () => {
9992
10344
  header: "Created At",
9993
10345
  cell: ({ row }) => {
9994
10346
  var _a;
9995
- return /* @__PURE__ */ jsxRuntime.jsx("span", { children: ((_a = row == null ? void 0 : row.original) == null ? void 0 : _a.created_at) ? new Date(row.original.created_at).toLocaleString() : "-" });
10347
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { children: ((_a = row == null ? void 0 : row.original) == null ? void 0 : _a.created_at) ? new Date(
10348
+ row.original.created_at
10349
+ ).toLocaleString() : "-" });
9996
10350
  }
9997
10351
  }),
9998
10352
  columnHelper.accessor("updated_at", {
9999
10353
  header: "Updated At",
10000
10354
  cell: ({ row }) => {
10001
10355
  var _a;
10002
- return /* @__PURE__ */ jsxRuntime.jsx("span", { children: ((_a = row == null ? void 0 : row.original) == null ? void 0 : _a.updated_at) ? new Date(row.original.updated_at).toLocaleString() : "-" });
10356
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { children: ((_a = row == null ? void 0 : row.original) == null ? void 0 : _a.updated_at) ? new Date(
10357
+ row.original.updated_at
10358
+ ).toLocaleString() : "-" });
10003
10359
  }
10004
10360
  }),
10005
10361
  columnHelper.accessor("actions", {
@@ -10008,7 +10364,12 @@ const AutomationsList = () => {
10008
10364
  var _a, _b;
10009
10365
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
10010
10366
  /* @__PURE__ */ jsxRuntime.jsx(AutomationsEditForm, { id: (_a = row == null ? void 0 : row.original) == null ? void 0 : _a.id }),
10011
- /* @__PURE__ */ jsxRuntime.jsx(AutomationDeleteButton, { id: (_b = row == null ? void 0 : row.original) == null ? void 0 : _b.id })
10367
+ /* @__PURE__ */ jsxRuntime.jsx(
10368
+ AutomationDeleteButton,
10369
+ {
10370
+ id: (_b = row == null ? void 0 : row.original) == null ? void 0 : _b.id
10371
+ }
10372
+ )
10012
10373
  ] });
10013
10374
  }
10014
10375
  })