@bigbinary/neeto-rules-frontend 0.4.2 → 0.4.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.
package/README.md CHANGED
@@ -1,19 +1,582 @@
1
1
  # neeto-rules-nano
2
2
 
3
- This repo acts as the source of truth for the new nano's structure, configs,
4
- data etc.
3
+ The `neeto-rules-nano` facilitates the management of automation rules within neeto applications. The nano exports `@bigbinary/neeto-rules-frontend` NPM package and `neeto-rules-engine` Rails engine.
5
4
 
6
- # Local Development Setup
5
+ ## Contents
7
6
 
8
- 1. Setup
9
- [Instructions](https://github.com/bigbinary/neeto-engineering/tree/main/Local-Development-Setup).
7
+ 1. [Development with Host Application](#development-with-host-application)
8
+ - [Engine](#engine)
9
+ - [Installation](#installation)
10
+ - [Frontend package](#frontend-package)
11
+ - [Installation](#installation-1)
12
+ - [Instructions for development](#instructions-for-development)
13
+ - [Components](#components)
14
+ - [NeetoRulesForm](#1-neetorulesform)
15
+ - [Field components for NeetoRulesForm](#2-field-components-for-neetorulesform)
16
+ - [InputField](#21-inputfield)
17
+ - [TextareaField](#22-textareafield)
18
+ - [SelectField](#23-selectfield)
19
+ - [MultiSelectField](#24-multiselectfield)
20
+ - [RadioField](#25-radiofield)
21
+ - [EventConditions](#26-eventconditions)
22
+ - [Conditions](#27-conditions)
23
+ - [Actions](#28-actions)
24
+ - [Custom action component](#29-custom-action-component)
25
+ - [RulePreview](#3-rulepreview)
26
+ 2. [Instructions for Publishing](#instructions-for-publishing)
10
27
 
11
- 2. Run `yarn build` to bundle the app.
28
+ ## Development with Host Application
12
29
 
13
- 3. Visit http://spinkart.lvh.me:9100 and login with email `oliver@example.com`
14
- and password `welcome`.
30
+ ### Engine
15
31
 
16
- # Publish instructions
32
+ The Engine is used to manage automation rules feature within neeto applications.
17
33
 
18
- 1. [Engine and package installation](./docs/engine-and-package-installation.md)
19
- 2. [Building and releasing](./docs/building-and-releasing.md)
34
+ #### Installation
35
+
36
+ 1. Add this line to your application's Gemfile:
37
+
38
+ ```ruby
39
+ source "NEETO_GEM_SERVER_URL" do
40
+ # ..existing gems
41
+
42
+ gem "neeto-rules-engine"
43
+ end
44
+ ```
45
+
46
+ 2. And then execute:
47
+
48
+ ```ruby
49
+ bundle install
50
+ ```
51
+
52
+ 3. Add this line to your application's `config/routes.rb` file:
53
+
54
+ ```ruby
55
+ mount NeetoRulesEngine::Engine => "/neeto_rules"
56
+ ```
57
+
58
+ 4. Run the following command to copy the migrations from the engine to the host application:
59
+
60
+ ```ruby
61
+ rails g neeto_rules_engine:install
62
+ ```
63
+
64
+ 5. Add the migrations to the database:
65
+
66
+ ```ruby
67
+ bundle exec rails db:migrate
68
+ ```
69
+
70
+ ### Frontend package
71
+
72
+ #### Installation
73
+
74
+ Install the latest `neetoRules nano` package using the below command:
75
+
76
+ ```shell
77
+ yarn add @bigbinary/neeto-rules-frontend
78
+ ```
79
+
80
+ ### Instructions for development
81
+
82
+ Check the [Frontend package development guide](https://neeto-engineering.neetokb.com/p/a-d34cb4b0) for step-by-step instructions to develop the frontend package.
83
+
84
+ ### Components
85
+
86
+ #### 1. `NeetoRulesForm`
87
+
88
+ <div align="center">
89
+ <img src="./docs/images/rules-form.png"/>
90
+ </div>
91
+
92
+ <br>
93
+
94
+ The `NeetoRulesForm` component is used to create and edit automation rules.
95
+
96
+ `NeetoRulesForm` accepts the following field types which is specified in the `initialProps` ([reference](https://github.com/bigbinary/neeto-desk-web/blob/c7ea475e0963cb4fa0831856c9545e1f697ca472/app/javascript/src/components/Automations/Form/constants.js#L43)):
97
+
98
+ 1. text
99
+ 2. long-text
100
+ 3. dropdown
101
+ 4. multi-select
102
+ 5. radio
103
+ 6. events
104
+ 7. condition
105
+ 8. actions
106
+
107
+ #### Props
108
+
109
+ - `data`: The initial props for the form.
110
+ - `children`: The form fields.
111
+ - `className`: To provide external classes to form.
112
+ - `handleSubmit`: The function to handle the form submission.
113
+ - `handleClose`: The function to handle the form close.
114
+
115
+ #### Usage
116
+
117
+ ```jsx
118
+ import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
119
+
120
+ const { InputField, TextareaField, SelectField, Events, Card, Conditions, Actions } = NeetoRulesForm;
121
+
122
+ <NeetoRulesForm data={initialProps}>
123
+ {({ formattedValues, values, ...formikBag }) => (
124
+ <>
125
+ <InputField name="name" data={initialProps} />
126
+ <TextareaField name="description" data={initialProps} />
127
+ <SelectField name="projectId" data={initialProps} />
128
+ <Events name="events" data={initialProps} performerName="performer" />
129
+ <Card title="Conditions">
130
+ <Conditions name="conditions" data={initialProps} />
131
+ </Card>
132
+ <Actions name="actions" data={initialProps} />
133
+ </>
134
+ )}
135
+ </NeetoRulesForm>
136
+ ```
137
+
138
+ #### References
139
+
140
+ 1. [neeto-cal-web](https://github.com/bigbinary/neeto-cal-web/blob/7ef6806ecc47e01d5cdb0252878e4dc442d12dd0/app/javascript/src/components/commons/MeetingsBuilder/Configure/AutomationRules/Form/index.jsx#L11)
141
+ 2. [neeto-desk-web](https://github.com/bigbinary/neeto-desk-web/blob/edc9bad9305d55c18a67de3931cbe2633fe3710f/app/javascript/src/components/Automations/Form/index.jsx#L188)
142
+ 3. [neeto-planner-web](https://github.com/bigbinary/neeto-planner-web/blob/73bb48e1721bb8ae3c71dbabe7b3b99c443a3f6e/app/javascript/src/components/Settings/Automations/Automation/Form/index.jsx#L39)
143
+
144
+ <br>
145
+
146
+ #### 2. Field components for `NeetoRulesForm`
147
+
148
+ NeetoRulesForm provides field components to create the automation rules form.
149
+
150
+ #### References
151
+
152
+ 1. [neeto-cal-web](https://github.com/bigbinary/neeto-cal-web/blob/7ef6806ecc47e01d5cdb0252878e4dc442d12dd0/app/javascript/src/components/commons/MeetingsBuilder/Configure/AutomationRules/Form/index.jsx#L8)
153
+ 2. [neeto-desk-web](https://github.com/bigbinary/neeto-desk-web/blob/edc9bad9305d55c18a67de3931cbe2633fe3710f/app/javascript/src/components/Macros/Form/FormContent.jsx#L8)
154
+ 3. [neeto-planner-web](https://github.com/bigbinary/neeto-planner-web/blob/73bb48e1721bb8ae3c71dbabe7b3b99c443a3f6e/app/javascript/src/components/Settings/Automations/Automation/Form/FormContent.jsx#L24)
155
+
156
+ #### 2.1 `InputField`
157
+
158
+ ```jsx
159
+ import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
160
+
161
+ const { InputField } = NeetoRulesForm;
162
+
163
+ const initialProps = {
164
+ ...otherProps,
165
+ firstName: {
166
+ label: "First Name",
167
+ type: "text",
168
+ value: "", // Default value.
169
+ componentProps: {
170
+ placeholder: "Enter name",
171
+ },
172
+ },
173
+ };
174
+
175
+ <InputField name="firstName" data={initialProps} />;
176
+ ```
177
+
178
+ #### props
179
+
180
+ 1. `name`: Name of the field. The name should be same as that in the `initialProps`.
181
+ 2. `data`: The same `initialProps` that is passed to data prop in `NeetoRulesForm`.
182
+ 3. `label`: Label for the field.
183
+
184
+ #### 2.2 `TextareaField`
185
+
186
+ ```jsx
187
+ import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
188
+
189
+ const { TextareaField } = NeetoRulesForm;
190
+
191
+ const initialProps = {
192
+ ...otherProps,
193
+ description: {
194
+ label: "Description",
195
+ type: "long-text",
196
+ value: "", // Default value.
197
+ },
198
+ };
199
+
200
+ <TextareaField name="description" data={initialProps} />;
201
+ ```
202
+
203
+ #### props
204
+
205
+ 1. `name`: Name of the field. The name should be same as that in the `initialProps`.
206
+ 2. `data`: The same `initialProps` that is passed as `data` prop in `NeetoRulesForm`.
207
+ 3. `label`: Label for the field.
208
+
209
+ #### 2.3 `SelectField`
210
+
211
+ ```jsx
212
+ import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
213
+
214
+ const { SelectField } = NeetoRulesForm;
215
+
216
+ const initialProps = {
217
+ ...otherProps,
218
+ user: {
219
+ label: "Project",
220
+ type: "dropdown",
221
+ options: [{ label: "Oliver", value: "oliver" }],
222
+ value: "oliver", // Default selected option will be Oliver
223
+ },
224
+ };
225
+
226
+ <SelectField name="user" data={initialProps} />;
227
+ ```
228
+
229
+ #### props
230
+
231
+ 1. `name`: Name of the field. The name should be same as that in the `initialProps`.
232
+ 2. `data`: The same `initialProps` that is passed to data prop in `NeetoRulesForm`.
233
+ 3. `label`: Label for the field.
234
+ 4. `options`: Options for the dropdown. The options should be an array of objects with `label` and `value` keys. `[{label, value}]`.
235
+ 5. `onChange`: Callback function that is called when the value of the dropdown changes. `(value, setValue) => void` `setValue` is to set the new value.
236
+
237
+ #### 2.4 `MultiSelectField`
238
+
239
+ ```jsx
240
+ import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
241
+
242
+ const { MultiSelectField } = NeetoRulesForm;
243
+
244
+ const initialProps = {
245
+ ...otherProps,
246
+ users: {
247
+ label: "Projects",
248
+ type: "multi-select",
249
+ options: [
250
+ { label: "Oliver", value: "oliver" },
251
+ { label: "John", value: "john" },
252
+ ],
253
+ value: ["oliver"], // Default selected option will be Oliver
254
+ },
255
+ };
256
+
257
+ <MultiSelectField name="users" data={initialProps} />;
258
+ ```
259
+
260
+ #### props
261
+
262
+ 1. `name`: Name of the field. The name should be same as that in the `initialProps`.
263
+ 2. `data`: The same `initialProps` that is passed to data prop in `NeetoRulesForm`.
264
+ 3. `label`: Label for the field.
265
+ 4. `options`: Options for the dropdown. The options should be an array of objects with `label` and `value` keys. `[{label, value}]`.
266
+ 5. `onChange`: Callback function that is called when the value of the dropdown changes. `(value, setValue) => void` `setValue` is to set the new value.
267
+
268
+ #### 2.5 `RadioField`
269
+
270
+ ```jsx
271
+ import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
272
+
273
+ const { RadioField } = NeetoRulesForm;
274
+
275
+ const initialProps = {
276
+ ...otherProps,
277
+ performer: {
278
+ label: "Performer",
279
+ type: "radio",
280
+ value: "any", // Default selected value will be "any"
281
+ options: [
282
+ { label: "Admin", value: "admin" },
283
+ { label: "Any", value: "any" },
284
+ ],
285
+ },
286
+ };
287
+
288
+ <RadioField name="performer" data={initialProps} />;
289
+ ```
290
+
291
+ #### props
292
+
293
+ 1. `name`: Name of the field. The name should be same as that in the `initialProps`.
294
+ 2. `data`: The same `initialProps` that is passed to data prop in `NeetoRulesForm`.
295
+ 3. `label`: Label for the field.
296
+ 4. `options`: Options for the radio buttons. The options should be an array of objects with `label` and `value` keys. `[{label, value}]`.
297
+
298
+ #### 2.6 `EventConditions`
299
+
300
+ ![event-conditions](./docs/images/event-conditions.png)
301
+
302
+ ```jsx
303
+ import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
304
+
305
+ const { EventConditions } = NeetoRulesForm;
306
+
307
+ const EVENT_OPTIONS = [
308
+ { label: "Ticket is created", value: "created" },
309
+ { label: "Ticket is updated", value: "updated" },
310
+ ...otherOptions,
311
+ ];
312
+
313
+ const PERFORMER_OPTIONS = [
314
+ { label: "Any", value: "any" },
315
+ { label: "Member", value: "agent" },
316
+ ...otherOptions,
317
+ ];
318
+
319
+ const CONDITION_OPTIONS = [
320
+ {
321
+ value: "status",
322
+ label: "Status",
323
+ type: "multi-select",
324
+ allowMatching: ["any_of", "none_of"],
325
+ dropdownOptions: [
326
+ { label: "Open", value: "open" },
327
+ { label: "Closed", value: "closed" },
328
+ { label: "On hold", value: "on_hold" },
329
+ ],
330
+ },
331
+ {
332
+ value: "name",
333
+ label: "Name",
334
+ allowMatching: ["is", "is_not"],
335
+ type: "text",
336
+ },
337
+ ...otherOptions,
338
+ ];
339
+
340
+ const DEFAULT_CONDITION_VALUE = [
341
+ {
342
+ id: "1",
343
+ field: "status",
344
+ verb: "any_of",
345
+ metadata: { values: ["open", "closed"] },
346
+ joinType: "and_operator",
347
+ },
348
+ {
349
+ id: "2",
350
+ field: "name",
351
+ verb: "is",
352
+ metadata: { value: "Test" },
353
+ joinType: "and_operator",
354
+ },
355
+ ...otherConditionValues,
356
+ ];
357
+
358
+ const initialProps = {
359
+ ...otherProps,
360
+ events: {
361
+ label: "Events",
362
+ type: "events",
363
+ value: [{ name: EVENT_OPTIONS[0].value }],
364
+ eventOptions: EVENT_OPTIONS,
365
+ defaultData: { name: "time_based", performer: "system" },
366
+ },
367
+ performer: {
368
+ label: "Performer",
369
+ type: "dropdown",
370
+ value: "any",
371
+ options: PERFORMER_OPTIONS,
372
+ },
373
+ conditions: {
374
+ label: "Conditions",
375
+ type: "condition",
376
+ conditionOptions: CONDITION_OPTIONS,
377
+ value: DEFAULT_CONDITION_VALUE,
378
+ },
379
+ };
380
+
381
+ <EventConditions
382
+ name="events"
383
+ data={initialProps}
384
+ performerName="performer"
385
+ conditionsName="conditions"
386
+ />;
387
+ ```
388
+
389
+ #### props
390
+
391
+ 1. `name`: Name of the field. The name should be same as that in the `initialProps`.
392
+ 2. `data`: The same `initialProps` that is passed to data prop in NeetoRulesForm.
393
+ 3. `label`: Label for the field.
394
+ 4. `performerName`: Name of the performer field. The `performerName` should be same as that in the `initialProps`.
395
+ 5. `conditionsName`: Name of the conditions field. The `conditionsName` should be same as that in the `initialProps`.
396
+ 6. `onSelectEvent`: `(name, selectedOption) => void`. This method will trigger when we select an event option. The name is to refer the event in the formik context.
397
+
398
+ Refer to the [EventCondition section](./docs/event-conditions.md) for more information.
399
+
400
+ #### 2.7 `Conditions`
401
+
402
+ ```jsx
403
+ import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
404
+
405
+ const { Card, Conditions } = NeetoRulesForm;
406
+
407
+ const initialProps = {
408
+ ...otherProps,
409
+ conditions: {
410
+ label: "Conditions",
411
+ type: "condition",
412
+ conditionOptions: [
413
+ {
414
+ value: "status",
415
+ label: "Status",
416
+ type: "dropdown", // Types : text, number, email, decimal, url, dropdown, multi-select, multi-select-create, date.
417
+ allowMatching: ["is", "is_not", "any_of", "none_of"],
418
+ dropdownOptions: [
419
+ { label: "Open", value: "open" },
420
+ { label: "Closed", value: "closed" },
421
+ ],
422
+ additionalData: {
423
+ any_of: "multi-select",
424
+ none_of: "multi-select",
425
+ },
426
+ },
427
+ {
428
+ value: "name",
429
+ label: "Name",
430
+ type: "text",
431
+ allowMatching: ["is", "is_not"],
432
+ },
433
+ {
434
+ value: "tags",
435
+ label: "Tags",
436
+ type: "multi-select-create",
437
+ allowMatching: ["contains_any_of", "contains_none_of"],
438
+ },
439
+ ],
440
+ value: [
441
+ {
442
+ id: "1",
443
+ field: "status",
444
+ verb: "is",
445
+ metadata: { value: "open" },
446
+ joinType: "and_operator",
447
+ },
448
+ {
449
+ id: "2",
450
+ field: "name",
451
+ verb: "is",
452
+ metadata: { value: "Test" },
453
+ joinType: "and_operator",
454
+ },
455
+ {
456
+ id: "3",
457
+ field: "tags",
458
+ verb: "contains_any_of",
459
+ metadata: { values: ["Test", "Open"] },
460
+ joinType: "and_operator",
461
+ },
462
+ ],
463
+ },
464
+ };
465
+
466
+ <Card title="Conditions">
467
+ <Conditions name="conditions" data={initialProps} />
468
+ </Card>;
469
+ ```
470
+
471
+ #### props
472
+
473
+ 1. `name`: Name of the field. The name should be same as that in the `initialProps`.
474
+ 2. `data`: The same `initialProps` that is passed to data prop in `NeetoRulesForm`.
475
+ 3. `label`: Label for the field.
476
+ 4. `onSelectCondition`: `(name, selectedOption) => void`. This method will trigger when we select a condition option. The name is to refer the condition in the formik context.
477
+ 5. `selectedConditionOptions`: `(selectedCondition)=> [{label, value}]`. To provide options for the selected condition if the type of selected condition is `dropdown`, `multi-select`, or `multi-select-create`.
478
+ 6. `isCallback`: To specify if there is a preview callback function for the conditions. (Boolean).
479
+ 7. `previewCallback`: `(conditions) => void`. This method will trigger when we click on the preview button. The conditions are the selected conditions in the formik context.
480
+
481
+ #### 2.8 `Actions`
482
+
483
+ ![actions](./docs/images/action.png)
484
+
485
+ ```jsx
486
+ import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
487
+
488
+ const { Actions } = NeetoRulesForm;
489
+
490
+ const initialProps = {
491
+ ...otherProps,
492
+ actions: {
493
+ label: "Actions",
494
+ type: "actions",
495
+ actionOptions: [
496
+ {
497
+ value: "add_tags",
498
+ label: "Add Tags",
499
+ type: "multiSelect", // Types : emailToIds, emailTo, email, dropdown, list, multiSelect, note, date, text, textarea, decimal, number, regex, longText
500
+ hideSeparator: true,
501
+ placeholder: "Select tags",
502
+ dropdownOptions: [
503
+ { label: "Open", value: "open" },
504
+ { label: "Close", value: "close" },
505
+ { label: "Hold", value: "hold" },
506
+ ],
507
+ },
508
+ {
509
+ value: "email_to",
510
+ label: "Email To",
511
+ type: "emailToIds",
512
+ separator: "as",
513
+ hideSubject: true, // Hide subject field if this prop is true
514
+ },
515
+ {
516
+ value: "send_sms",
517
+ label: "Send sms",
518
+ type: "longText",
519
+ },
520
+ ],
521
+ value: [
522
+ {
523
+ id: "1",
524
+ name: "email_to", // Specify the value of the selected action.
525
+ metadata: { emails: ["a@a.com"], subject: "test", body: "test" },
526
+ },
527
+ {
528
+ id: "2",
529
+ name: "add_tags",
530
+ metadata: { values: ["close"] },
531
+ },
532
+ ],
533
+ },
534
+ };
535
+
536
+ <Actions name="fieldName" data={initialProps} />;
537
+ ```
538
+
539
+ #### props
540
+
541
+ 1. `name`: Name of the field. The name should be same as that in the `initialProps`.
542
+ 2. `data`: The same `initialProps` that is passed to data prop in `NeetoRulesForm`.
543
+ 3. `label`: Label for the field.
544
+ 4. `onSelectAction`: `(name, selectedOption) => void`. This method will trigger when we select an action option. The name is to refer the action in the formik context.
545
+ 5. `selectedActionOptions`: `(selectedAction)=> [{label, value}]`. To provide options for the selected action if the type of selected action is `dropdown` or `multi-select`.
546
+
547
+ Refer to the [Actions section](./docs/actions.md) for more information.
548
+
549
+ #### 2.9 Custom action component
550
+
551
+ neetoRulesFrontend allows to pass custom action components from host application. Below is an example for customize task component which is being sent by neeto-crm in action options.
552
+
553
+ ```jsx
554
+ {
555
+ label: "Add task",
556
+ value: "add_task",
557
+ placeholder: "Task",
558
+ component: TaskComponent,
559
+ validation: TASK_VALIDATION,
560
+ },
561
+ ```
562
+
563
+ #### 3. `RulePreview`
564
+
565
+ The `RulePreview` component is used to preview the automation rule.
566
+
567
+ ![rule-preview](./docs/images/rule-preview.png)
568
+
569
+ #### Props
570
+
571
+ 1. `ruleDetails`: The rule details to be previewed.
572
+ 2. `isLoading`: To specify if the preview is loading. (Boolean).
573
+ 3. `isOpen`: To specify if the preview is open. (Boolean).
574
+ 4. `onClose`: The callback function to call when the preview is closed. `() => void`.
575
+
576
+ reference:
577
+
578
+ 1. [neeto-crm-web](https://github.com/bigbinary/neeto-crm-web/blob/b4c59181aec20d7519dd73b54b0695362ed4466f/app/javascript/src/components/Settings/Automations/index.jsx#L115)
579
+
580
+ ## Instructions for Publishing
581
+
582
+ Consult the [building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages) guide for details on how to publish.
@@ -34,6 +34,7 @@
34
34
  "noEvents": "A rule without events will run hourly.",
35
35
  "addEvent": "Add Event",
36
36
  "noCondition": "No tickets matching specified conditions",
37
+ "noTicketFields": "No more conditions.",
37
38
  "subjectText": "Will be generated from the ticket's subject.",
38
39
  "note": "Note",
39
40
  "thisHappens": "this happens",
package/dist/index.cjs.js CHANGED
@@ -4166,9 +4166,10 @@ var Events$1 = function Events(_ref) {
4166
4166
  }));
4167
4167
  };
4168
4168
 
4169
- var _excluded$5 = ["data", "label", "name", "performerName", "conditionsName", "onSelectEvent"];
4169
+ var _excluded$5 = ["addButtonTooltipProps", "data", "label", "name", "performerName", "conditionsName", "onSelectEvent"];
4170
4170
  var EventConditions = function EventConditions(_ref) {
4171
- var data = _ref.data,
4171
+ var addButtonTooltipProps = _ref.addButtonTooltipProps,
4172
+ data = _ref.data,
4172
4173
  label = _ref.label,
4173
4174
  name = _ref.name,
4174
4175
  performerName = _ref.performerName,
@@ -4178,6 +4179,8 @@ var EventConditions = function EventConditions(_ref) {
4178
4179
  var _useFormikContext = formik.useFormikContext(),
4179
4180
  values = _useFormikContext.values,
4180
4181
  setFieldValue = _useFormikContext.setFieldValue;
4182
+ var _useTranslation = reactI18next.useTranslation(),
4183
+ t = _useTranslation.t;
4181
4184
  var elementProps = data[name] || {};
4182
4185
  var conditionProps = data[conditionsName] || {};
4183
4186
  var conditions = values[conditionsName].value || [];
@@ -4204,18 +4207,21 @@ var EventConditions = function EventConditions(_ref) {
4204
4207
  name: name,
4205
4208
  onSelectEvent: onSelectEvent,
4206
4209
  performerName: performerName
4207
- })), showAddButton && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
4210
+ })), showAddButton && /*#__PURE__*/React__default["default"].createElement(neetoui.Tooltip, _extends({
4211
+ content: t("neetoRules.form.noTicketFields")
4212
+ }, addButtonTooltipProps), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
4208
4213
  "data-cy": "add-condition-button",
4209
4214
  "data-test-id": "automation-rules-add-events-button",
4215
+ disabled: ramda.isEmpty(conditionProps === null || conditionProps === void 0 ? void 0 : conditionProps.conditionOptions),
4210
4216
  icon: neetoIcons.Plus,
4211
4217
  size: 32,
4212
- style: "icon",
4218
+ style: "text",
4213
4219
  tooltipProps: {
4214
- content: i18next.t("neetoRules.form.addCondition"),
4220
+ content: t("neetoRules.form.addCondition"),
4215
4221
  position: "top"
4216
4222
  },
4217
4223
  onClick: handleAddCondition
4218
- })), !showAddButton && /*#__PURE__*/React__default["default"].createElement("div", {
4224
+ })))), !showAddButton && /*#__PURE__*/React__default["default"].createElement("div", {
4219
4225
  className: "mt-3"
4220
4226
  }, /*#__PURE__*/React__default["default"].createElement(Conditions, _extends({
4221
4227
  data: data,