@isettingkit/business-rules 0.2.2 → 1.0.1

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/dist/index.es.js CHANGED
@@ -1,192 +1,78 @@
1
- import { jsxs as u, Fragment as D, jsx as a } from "react/jsx-runtime";
2
- import { useFormik as le } from "formik";
3
- import { string as j, mixed as X, object as L, number as z, lazy as P, date as G } from "yup";
4
- import { ValueDataType as N, DecisionConditionRender as Q, ValueHowToSetUp as R } from "@isettingkit/input";
5
- import { inube as E, Stack as h, Toggle as Z, Text as v, useMediaQuery as M, Checkbox as se, Date as Y, Divider as S, Button as $, SkeletonLine as A, Icon as ee, Blanket as de, Grid as ce } from "@inubekit/inubekit";
6
- import y, { keyframes as he } from "styled-components";
7
- import { useState as V, useEffect as ue } from "react";
8
- import { DecisionViewConditionRenderer as O } from "@isettingkit/view";
9
- import { MdOutlineDelete as pe, MdClear as ge, MdAdd as te } from "react-icons/md";
10
- import { createPortal as me } from "react-dom";
11
- const be = (t) => ({
12
- schema: j().required("Required").test(
13
- "non-empty",
14
- "Value cannot be empty",
15
- (e) => e != null && e.trim() !== ""
16
- ),
17
- value: t
18
- }), Te = (t) => ({
19
- schema: X().test(
20
- "isArrayOrString",
21
- "Must be an array of strings/numbers or a single string",
22
- (e) => Array.isArray(e) ? e.every(
23
- (n) => typeof n == "string" || typeof n == "number"
24
- ) : typeof e == "string"
25
- ),
26
- value: t
27
- }), fe = (t) => ({
28
- schema: X().test(
29
- "isArrayOrString",
30
- "Must be an array of strings/numbers or a single string",
31
- (e) => Array.isArray(e) ? e.every(
32
- (n) => typeof n == "string" || typeof n == "number"
33
- ) : typeof e == "string"
34
- ),
35
- value: t
36
- }), ye = (t) => {
37
- const e = (t == null ? void 0 : t.from) ?? 0, n = (t == null ? void 0 : t.to) ?? 0;
38
- return {
39
- schema: L({
40
- from: z().required("Range From is required").max(n, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
41
- to: z().min(0, "To value must be greater than or equal to 0").required("To value is required").test(
42
- "is-greater",
43
- "To value must be greater than From value",
44
- function(i) {
45
- const { from: o } = this.parent;
46
- return i > o;
47
- }
48
- )
49
- }),
50
- value: { from: e, to: n }
51
- };
52
- }, _ = (t, e) => e === N.PERCENTAGE ? {
53
- schema: z().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
54
- value: t
55
- } : {
56
- schema: j().required("Required"),
57
- value: t
58
- };
59
- var f = /* @__PURE__ */ ((t) => (t.EQUAL = "EqualTo", t.GREATER_THAN = "GreaterThan", t.LESS_THAN = "LessThan", t.LIST_OF_VALUES = "ListOfValues", t.LIST_OF_VALUES_MULTI = "ListOfValuesMulti", t.RANGE = "Range", t))(f || {});
60
- const ve = {
61
- [f.LIST_OF_VALUES]: Te,
62
- [f.LIST_OF_VALUES_MULTI]: fe,
63
- [f.RANGE]: ye,
64
- [f.GREATER_THAN]: _,
65
- [f.LESS_THAN]: _,
66
- [f.EQUAL]: _
67
- }, W = (t) => ve[t] || be;
68
- function xe({
69
- decision: t,
70
- onSubmitEvent: e,
71
- textValues: n
72
- }) {
73
- const i = {
74
- ruleName: t.ruleName || "",
75
- decisionDataType: t.decisionDataType || N.ALPHABETICAL,
76
- howToSetTheDecision: t.howToSetTheDecision || "",
77
- value: t.value || "",
78
- effectiveFrom: t.effectiveFrom || "",
79
- validUntil: t.validUntil || "",
80
- toggleNone: !0,
81
- conditionsThatEstablishesTheDecision: {},
82
- checkClosed: !1,
83
- terms: !0
84
- };
85
- let o;
86
- const r = {
87
- ruleName: j().required("Name is required"),
88
- value: P(() => W(
89
- o.values.howToSetTheDecision
90
- )(
91
- o.values.value,
92
- o.values.decisionDataType
93
- ).schema),
94
- conditionsThatEstablishesTheDecision: P((d, { parent: s }) => {
95
- var b;
96
- if ((s == null ? void 0 : s.toggleNone) && Object.keys(s.conditionsThatEstablishesTheDecision || {}).length > 0) return L().shape({});
97
- const l = (b = t.conditionsThatEstablishesTheDecision) == null ? void 0 : b.reduce(
98
- (T, g) => {
99
- if (o.values.conditionsThatEstablishesTheDecision[g.conditionName] !== void 0) {
100
- const C = W(
101
- g.howToSetTheCondition
102
- );
103
- T[g.conditionName] = C(
104
- g.value,
105
- g.conditionDataType
106
- ).schema;
1
+ import { jsx as a, jsxs as u, Fragment as E } from "react/jsx-runtime";
2
+ import { MdOutlineDelete as he, MdClear as Z, MdAdd as ee, MdOutlineFilterAltOff as ue, MdOutlineFilterAlt as pe } from "react-icons/md";
3
+ import { inube as v, Stack as h, Divider as D, Icon as O, Text as y, SkeletonLine as A, useMediaQuery as I, Blanket as te, Button as N, Grid as ne, Box as ge, Tag as me, Checkpicker as be, Toggle as ie, Checkbox as Te, Date as G } from "@inubekit/inubekit";
4
+ import f, { keyframes as fe } from "styled-components";
5
+ import { ValueDataType as k, ValueHowToSetUp as L, DecisionConditionRender as Q } from "@isettingkit/input";
6
+ import { DecisionViewConditionRenderer as _ } from "@isettingkit/view";
7
+ import { createPortal as ae } from "react-dom";
8
+ import { useFormik as xe } from "formik";
9
+ import { string as B, mixed as oe, object as M, number as q, lazy as Y, date as W } from "yup";
10
+ import { useState as V, useEffect as ye } from "react";
11
+ const ve = f.div`
12
+ border-radius: 8px;
13
+ border: 1px solid ${v.palette.neutral.N30};
14
+ box-sizing: border-box;
15
+ display: flex;
16
+ flex-direction: column;
17
+ // height: 364px;
18
+ // width: 332px;
19
+ width: 100%;
20
+ height: 100%;
21
+ box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
22
+ `;
23
+ f.div`
24
+ width: 100%;
25
+ height: 100%;
26
+ overflow-y: auto;
27
+
28
+ &::-webkit-scrollbar {
29
+ width: 8px;
30
+ }
31
+
32
+ &::-webkit-scrollbar-thumb {
33
+ background-color: #c1c7d0;
34
+ border-radius: 8px;
35
+ }
36
+
37
+ &::-webkit-scrollbar-track {
38
+ background-color: #ebecf0;
39
+ border-radius: 8px;
40
+ }
41
+ `;
42
+ const H = (t) => {
43
+ const { children: e, controls: n = !0, handleDelete: i, id: o } = t;
44
+ return /* @__PURE__ */ a(ve, { children: /* @__PURE__ */ u(h, { direction: "column", gap: "16px", padding: "12px 16px", children: [
45
+ e,
46
+ n && /* @__PURE__ */ u(E, { children: [
47
+ /* @__PURE__ */ a(D, {}),
48
+ /* @__PURE__ */ a(h, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ a(
49
+ O,
50
+ {
51
+ cursorHover: !0,
52
+ appearance: "danger",
53
+ size: "24px",
54
+ icon: /* @__PURE__ */ a(he, {}),
55
+ onClick: () => {
56
+ i(o);
107
57
  }
108
- return T;
109
- },
110
- {}
111
- );
112
- return L(l).test(
113
- "at-least-one-condition",
114
- "It must be at least one condition in order for the decision to be validated correctly.",
115
- (T) => T ? Object.values(T).some(
116
- (g) => g != null && g !== ""
117
- ) : !1
118
- );
119
- })
120
- };
121
- n.terms && (r.effectiveFrom = G().required(
122
- "effective From date is required"
123
- ), r.validUntil = G().when(
124
- "checkClosed",
125
- (d, s, { parent: c }) => (c == null ? void 0 : c.checkClosed) ? s.required("valid Until date is required").test(
126
- "is-after-startDate",
127
- "valid Until date must be greater than or equal to Start date",
128
- function(b) {
129
- const T = this.parent.effectiveFrom;
130
- return !T || !b ? !0 : new Date(b) >= new Date(T);
131
- }
132
- ) : s.notRequired()
133
- ));
134
- const p = L(r);
135
- return o = le({
136
- initialValues: i,
137
- validationSchema: p,
138
- validateOnBlur: !0,
139
- onSubmit: (d) => {
140
- var c;
141
- const s = {
142
- ...t,
143
- ruleName: d.ruleName,
144
- decisionDataType: d.decisionDataType,
145
- howToSetTheDecision: d.howToSetTheDecision,
146
- value: d.value,
147
- effectiveFrom: d.effectiveFrom,
148
- validUntil: d.validUntil,
149
- conditionsThatEstablishesTheDecision: (c = t.conditionsThatEstablishesTheDecision) == null ? void 0 : c.filter((l) => {
150
- const b = d.conditionsThatEstablishesTheDecision[l.conditionName];
151
- return b != null && b !== "";
152
- }).map((l) => ({
153
- ...l,
154
- value: d.conditionsThatEstablishesTheDecision[l.conditionName]
155
- }))
156
- };
157
- e(s);
158
- }
159
- }), { formik: o, handleToggleNoneChange: (d) => {
160
- var s;
161
- o.setFieldValue("toggleNone", d), (s = t.conditionsThatEstablishesTheDecision) == null || s.forEach((c) => {
162
- if (d)
163
- o.setFieldValue(
164
- `conditionsThatEstablishesTheDecision.${c.conditionName}`,
165
- void 0
166
- );
167
- else {
168
- const l = c.howToSetTheCondition === f.LIST_OF_VALUES_MULTI ? [] : "";
169
- o.setFieldValue(
170
- `conditionsThatEstablishesTheDecision.${c.conditionName}`,
171
- l
172
- );
173
- }
174
- });
175
- } };
176
- }
177
- const De = y.div`
58
+ }
59
+ ) })
60
+ ] })
61
+ ] }) });
62
+ }, J = f.div`
178
63
  & > div {
179
64
  border-radius: 8px;
180
65
  border: 1px solid
181
66
  ${({ theme: t }) => {
182
67
  var e, n;
183
- return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || E.palette.neutral.N30;
68
+ return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || v.palette.neutral.N30;
184
69
  }};
185
70
  }
186
- `, we = y.div`
71
+ `, K = f.div`
187
72
  width: 100%;
188
73
  height: 100%;
189
74
  overflow-y: auto;
75
+ padding-right: 4px;
190
76
  &::-webkit-scrollbar {
191
77
  width: 4px;
192
78
  }
@@ -200,373 +86,84 @@ const De = y.div`
200
86
  background-color: #ebecf0;
201
87
  border-radius: 8px;
202
88
  }
203
- `, Ce = (t) => {
89
+ `, Ce = (t) => t.value, we = (t) => t.value, Se = (t) => t.value, De = (t) => ({
90
+ from: t.from ?? "",
91
+ to: t.to ?? ""
92
+ }), Ee = (t) => t.value, Ne = (t) => t.value, ke = (t) => t.value;
93
+ var x = /* @__PURE__ */ ((t) => (t.EQUAL = "EqualTo", t.GREATER_THAN = "GreaterThan", t.LESS_THAN = "LessThan", t.LIST_OF_VALUES = "ListOfValues", t.LIST_OF_VALUES_MULTI = "ListOfValuesMulti", t.RANGE = "Range", t))(x || {});
94
+ const Fe = {
95
+ [x.LIST_OF_VALUES]: we,
96
+ [x.LIST_OF_VALUES_MULTI]: Se,
97
+ [x.RANGE]: De,
98
+ [x.GREATER_THAN]: Ee,
99
+ [x.LESS_THAN]: Ne,
100
+ [x.EQUAL]: ke
101
+ }, $ = (t) => {
102
+ const e = t == null ? void 0 : t.value, n = typeof e == "object" && e !== null && !Array.isArray(e), i = Fe[t == null ? void 0 : t.howToSetTheDecision] || Ce;
103
+ return n && i(e) || e || void 0;
104
+ }, Ae = (t) => {
204
105
  const {
205
- checked: e,
206
- children: n,
207
- handleToggleChange: i,
208
- id: o,
209
- labelToggle: r,
210
- name: p,
211
- valueToggle: m = ""
212
- } = t, [d, s] = V(e), c = (l) => {
213
- s(l.target.checked), i(l);
214
- };
215
- return ue(() => {
216
- s(e);
217
- }, [e]), /* @__PURE__ */ u(D, { children: [
218
- /* @__PURE__ */ a(h, { children: /* @__PURE__ */ a(
219
- Z,
106
+ loading: e,
107
+ textValues: n,
108
+ decision: i,
109
+ decisionMapper: o,
110
+ visibleConditions: r,
111
+ decisionDateElement: p,
112
+ skeleton: g,
113
+ terms: s
114
+ } = t;
115
+ return e ? /* @__PURE__ */ u(h, { direction: "column", gap: "12px", children: [
116
+ /* @__PURE__ */ a(h, { direction: "column", alignItems: "center", children: /* @__PURE__ */ a(
117
+ _,
220
118
  {
221
- checked: d,
222
- id: o,
223
- name: p,
224
- onChange: c,
225
- size: "small",
226
- value: m,
227
- children: /* @__PURE__ */ a(v, { size: "medium", type: "label", weight: "bold", children: r })
119
+ element: o,
120
+ valueData: $(
121
+ o
122
+ ),
123
+ type: "decision"
228
124
  }
229
- ) }),
230
- d && /* @__PURE__ */ a(D, { children: n })
231
- ] });
232
- }, Se = (t) => {
233
- const {
234
- onHandleStartChange: e,
235
- onHandleEndChange: n,
236
- onCheckClosedChange: i,
237
- labelStart: o,
238
- labelEnd: r,
239
- checkedClosed: p = !1,
240
- required: m = !1,
241
- valueStart: d = "",
242
- valueEnd: s = "",
243
- messageStart: c = "",
244
- messageEnd: l = "",
245
- statusStart: b = "pending",
246
- statusEnd: T = "pending"
247
- } = t, [g, w] = V(p), [C, k] = V(d), [U, I] = V(s), B = ({ target: x }) => {
248
- w(x.checked), i && i(x.checked);
249
- }, ae = (x) => {
250
- k(x.target.value), e(x);
251
- }, oe = (x) => {
252
- I(x.target.value), n(x);
253
- }, re = M("(max-width: 400px)");
254
- return /* @__PURE__ */ u(D, { children: [
255
- /* @__PURE__ */ u(h, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
256
- /* @__PURE__ */ a(
257
- v,
258
- {
259
- appearance: "gray",
260
- margin: "10px 0",
261
- size: "medium",
262
- type: "title",
263
- weight: "bold",
264
- children: "Vigencia"
265
- }
266
- ),
267
- /* @__PURE__ */ a(
268
- h,
269
- {
270
- alignContent: "center",
271
- justifyContent: "center",
272
- wrap: "wrap",
273
- gap: "4px",
274
- children: /* @__PURE__ */ a(
275
- se,
276
- {
277
- label: "Cerrada",
278
- onChange: B,
279
- checked: g,
280
- value: ""
281
- }
282
- )
283
- }
284
- )
285
- ] }),
286
- /* @__PURE__ */ u(
125
+ ) }, i.ruleName),
126
+ /* @__PURE__ */ a(D, { dashed: !0 }),
127
+ /* @__PURE__ */ a(K, { children: /* @__PURE__ */ u(
287
128
  h,
288
129
  {
289
- direction: re ? "column" : "row",
130
+ direction: "column",
131
+ gap: "12px",
290
132
  justifyContent: "space-between",
291
- gap: "24px",
133
+ height: "203px",
292
134
  children: [
293
135
  /* @__PURE__ */ a(
294
- Y,
136
+ y,
295
137
  {
296
- id: "dateStart",
297
- label: o,
298
- onChange: ae,
299
- value: C,
300
- required: m,
301
- size: "compact",
302
- status: b,
303
- message: c
138
+ type: "label",
139
+ size: "large",
140
+ appearance: "dark",
141
+ weight: "bold",
142
+ textAlign: "center",
143
+ children: n.factsThatConditionIt
304
144
  }
305
145
  ),
306
- g && /* @__PURE__ */ a(
307
- Y,
146
+ r.map((d) => /* @__PURE__ */ a(J, { children: /* @__PURE__ */ a(h, { direction: "column", padding: "8px", children: /* @__PURE__ */ a(
147
+ _,
308
148
  {
309
- id: "dateEnd",
310
- label: r,
311
- onChange: oe,
312
- value: U,
313
- required: m,
314
- size: "compact",
315
- status: T,
316
- message: l
149
+ element: { ...d, value: d.value },
150
+ valueData: $(
151
+ d
152
+ )
317
153
  }
318
- )
319
- ]
320
- }
321
- )
322
- ] });
323
- }, Ee = (t) => {
324
- const {
325
- formik: e,
326
- textValues: n,
327
- onCancel: i,
328
- visibleConditions: o,
329
- normalizedDecision: r,
330
- handleToggleNoneChange: p,
331
- handleConditionToggleChange: m,
332
- showConditionsError: d,
333
- termStartStatus: s,
334
- termEndStatus: c
335
- } = t;
336
- return /* @__PURE__ */ a("form", { onSubmit: e.handleSubmit, children: /* @__PURE__ */ u(h, { direction: "column", gap: "24px", children: [
337
- Q({
338
- condition: r,
339
- formik: e,
340
- isDecision: !0
341
- }),
342
- /* @__PURE__ */ a(S, { dashed: !0 }),
343
- /* @__PURE__ */ a(De, { children: /* @__PURE__ */ a(we, { children: /* @__PURE__ */ u(
344
- h,
345
- {
346
- direction: "column",
347
- padding: "6px 12px",
348
- gap: "16px",
349
- height: "272px",
350
- children: [
351
- /* @__PURE__ */ u(
352
- h,
353
- {
354
- justifyContent: "space-between",
355
- alignItems: "center",
356
- gap: "64px",
357
- children: [
358
- /* @__PURE__ */ a(v, { type: "title", size: "small", weight: "bold", appearance: "gray", children: n.factsThatConditionIt }),
359
- /* @__PURE__ */ a(
360
- Z,
361
- {
362
- id: "toggleNone",
363
- onChange: () => p(!e.values.toggleNone),
364
- checked: e.values.toggleNone,
365
- size: "small",
366
- children: /* @__PURE__ */ a(v, { as: "span", size: "medium", type: "label", weight: "bold", children: n.none })
367
- }
368
- )
369
- ]
370
- }
371
- ),
372
- /* @__PURE__ */ a(h, { direction: "column", gap: "20px", children: o == null ? void 0 : o.map((l) => /* @__PURE__ */ a(
373
- Ce,
374
- {
375
- id: `toggle-${l.conditionName}`,
376
- name: `toggle.${l.conditionName}`,
377
- labelToggle: l.labelName,
378
- checked: !e.values.toggleNone && e.values.conditionsThatEstablishesTheDecision[l.conditionName] !== void 0,
379
- handleToggleChange: (b) => m(
380
- l.conditionName,
381
- l.howToSetTheCondition === f.LIST_OF_VALUES_MULTI
382
- )(b.target.checked),
383
- children: Q({ condition: l, formik: e })
384
- },
385
- l.conditionName
386
- )) })
387
- ]
388
- }
389
- ) }) }),
390
- n.terms && /* @__PURE__ */ u(D, { children: [
391
- /* @__PURE__ */ a(S, { dashed: !0 }),
392
- /* @__PURE__ */ a(
393
- Se,
394
- {
395
- labelStart: n.termStart,
396
- labelEnd: n.termEnd,
397
- valueStart: e.values.effectiveFrom,
398
- valueEnd: e.values.validUntil,
399
- messageStart: e.errors.effectiveFrom,
400
- messageEnd: e.errors.validUntil,
401
- statusStart: s,
402
- statusEnd: c,
403
- onHandleStartChange: (l) => e.setFieldValue("effectiveFrom", l.target.value),
404
- onHandleEndChange: (l) => e.setFieldValue("validUntil", l.target.value),
405
- onCheckClosedChange: (l) => {
406
- e.setFieldValue("checkClosed", l), l && e.setFieldValue("validUntil", "");
407
- },
408
- checkedClosed: e.values.checkClosed
409
- }
410
- )
411
- ] }),
412
- /* @__PURE__ */ a(S, {}),
413
- d && /* @__PURE__ */ a(v, { type: "label", size: "medium", appearance: "danger", children: String(e.errors.conditionsThatEstablishesTheDecision) }),
414
- /* @__PURE__ */ u(h, { direction: "row", justifyContent: "end", gap: "16px", children: [
415
- /* @__PURE__ */ a($, { appearance: "gray", onClick: i, children: n.cancel }),
416
- /* @__PURE__ */ a($, { type: "submit", children: n.confirm })
417
- ] })
418
- ] }) });
419
- }, Ne = (t) => {
420
- var T;
421
- const { decision: e, onSubmitEvent: n, textValues: i, onCancel: o } = t, { formik: r, handleToggleNoneChange: p } = xe({
422
- decision: e,
423
- onSubmitEvent: n,
424
- textValues: i
425
- }), m = {
426
- ruleName: e.ruleName,
427
- labelName: e.labelName,
428
- howToSetTheCondition: e.howToSetTheDecision,
429
- decisionDataType: e.decisionDataType,
430
- listOfPossibleValues: e.listOfPossibleValues
431
- }, d = ((T = e.conditionsThatEstablishesTheDecision) == null ? void 0 : T.filter(
432
- (g) => !g.hidden
433
- )) || [], s = !!r.errors.conditionsThatEstablishesTheDecision && r.submitCount > 0, c = r.touched.effectiveFrom ? r.errors.effectiveFrom ? "invalid" : "valid" : void 0, l = r.touched.validUntil ? r.errors.validUntil ? "invalid" : "valid" : void 0;
434
- return /* @__PURE__ */ a(
435
- Ee,
436
- {
437
- formik: r,
438
- onCancel: o,
439
- textValues: i,
440
- decision: e,
441
- visibleConditions: d,
442
- normalizedDecision: m,
443
- handleToggleNoneChange: p,
444
- handleConditionToggleChange: (g, w) => (C) => {
445
- if (!C)
446
- r.setFieldValue(
447
- `conditionsThatEstablishesTheDecision.${g}`,
448
- void 0
449
- ), r.setFieldTouched(
450
- `conditionsThatEstablishesTheDecision.${g}`,
451
- !1,
452
- !1
453
- );
454
- else {
455
- const k = w ? [] : "";
456
- r.setFieldValue(
457
- `conditionsThatEstablishesTheDecision.${g}`,
458
- k
459
- );
460
- }
461
- },
462
- showConditionsError: s,
463
- termStartStatus: c,
464
- termEndStatus: l
465
- }
466
- );
467
- }, J = y.div`
468
- & > div {
469
- border-radius: 8px;
470
- border: 1px solid
471
- ${({ theme: t }) => {
472
- var e, n;
473
- return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || E.palette.neutral.N30;
474
- }};
475
- }
476
- `, K = y.div`
477
- width: 100%;
478
- height: 100%;
479
- overflow-y: auto;
480
- padding-right: 4px;
481
- &::-webkit-scrollbar {
482
- width: 4px;
483
- }
484
-
485
- &::-webkit-scrollbar-thumb {
486
- background-color: #c1c7d0;
487
- border-radius: 8px;
488
- }
489
-
490
- &::-webkit-scrollbar-track {
491
- background-color: #ebecf0;
492
- border-radius: 8px;
493
- }
494
- `, ke = (t) => t.value, Ae = (t) => t.value, Fe = (t) => t.value, Ie = (t) => ({
495
- from: t.from ?? "",
496
- to: t.to ?? ""
497
- }), Re = (t) => t.value, Le = (t) => t.value, Ve = (t) => t.value, Me = {
498
- [f.LIST_OF_VALUES]: Ae,
499
- [f.LIST_OF_VALUES_MULTI]: Fe,
500
- [f.RANGE]: Ie,
501
- [f.GREATER_THAN]: Re,
502
- [f.LESS_THAN]: Le,
503
- [f.EQUAL]: Ve
504
- }, F = (t) => {
505
- const e = t == null ? void 0 : t.value, n = typeof e == "object" && e !== null && !Array.isArray(e), i = Me[t == null ? void 0 : t.howToSetTheDecision] || ke;
506
- return n && i(e) || e || void 0;
507
- }, Ue = (t) => {
508
- const {
509
- loading: e,
510
- textValues: n,
511
- decision: i,
512
- decisionMapper: o,
513
- visibleConditions: r,
514
- decisionDateElement: p,
515
- skeleton: m,
516
- terms: d
517
- } = t;
518
- return e ? /* @__PURE__ */ u(h, { direction: "column", gap: "12px", children: [
519
- /* @__PURE__ */ a(h, { direction: "column", alignItems: "center", children: /* @__PURE__ */ a(
520
- O,
521
- {
522
- element: o,
523
- valueData: F(
524
- o
525
- ),
526
- type: "decision"
527
- }
528
- ) }, i.ruleName),
529
- /* @__PURE__ */ a(S, { dashed: !0 }),
530
- /* @__PURE__ */ a(K, { children: /* @__PURE__ */ u(
531
- h,
532
- {
533
- direction: "column",
534
- gap: "12px",
535
- justifyContent: "space-between",
536
- height: "203px",
537
- children: [
538
- /* @__PURE__ */ a(
539
- v,
540
- {
541
- type: "label",
542
- size: "large",
543
- appearance: "dark",
544
- weight: "bold",
545
- textAlign: "center",
546
- children: n.factsThatConditionIt
547
- }
548
- ),
549
- r.map((s) => /* @__PURE__ */ a(J, { children: /* @__PURE__ */ a(h, { direction: "column", padding: "8px", children: /* @__PURE__ */ a(
550
- O,
551
- {
552
- element: { ...s, value: s.value },
553
- valueData: F(
554
- s
555
- )
556
- }
557
- ) }) }, s.conditionName)),
558
- d && /* @__PURE__ */ u(D, { children: [
559
- /* @__PURE__ */ a(S, { dashed: !0 }),
560
- p && /* @__PURE__ */ a(
561
- O,
562
- {
563
- element: p.element,
564
- valueData: p.valueData,
565
- type: "decision"
566
- },
567
- n.terms
568
- )
569
- ] })
154
+ ) }) }, d.conditionName)),
155
+ s && /* @__PURE__ */ u(E, { children: [
156
+ /* @__PURE__ */ a(D, { dashed: !0 }),
157
+ p && /* @__PURE__ */ a(
158
+ _,
159
+ {
160
+ element: p.element,
161
+ valueData: p.valueData,
162
+ type: "decision"
163
+ },
164
+ n.terms
165
+ )
166
+ ] })
570
167
  ]
571
168
  }
572
169
  ) })
@@ -576,7 +173,7 @@ const De = y.div`
576
173
  /* @__PURE__ */ a(A, { animated: !0, width: "85px" })
577
174
  ] }, "loading"),
578
175
  /* @__PURE__ */ u(h, { direction: "column", gap: "12px", alignItems: "center", children: [
579
- /* @__PURE__ */ a(S, { dashed: !0 }),
176
+ /* @__PURE__ */ a(D, { dashed: !0 }),
580
177
  /* @__PURE__ */ a(A, { animated: !0, width: "150px" })
581
178
  ] }),
582
179
  /* @__PURE__ */ a(K, { children: /* @__PURE__ */ a(
@@ -586,7 +183,7 @@ const De = y.div`
586
183
  gap: "12px",
587
184
  justifyContent: "space-between",
588
185
  height: "203px",
589
- children: m.map((s, c) => /* @__PURE__ */ a(J, { children: /* @__PURE__ */ u(
186
+ children: g.map((d, c) => /* @__PURE__ */ a(J, { children: /* @__PURE__ */ u(
590
187
  h,
591
188
  {
592
189
  direction: "column",
@@ -602,118 +199,67 @@ const De = y.div`
602
199
  }
603
200
  ) })
604
201
  ] });
605
- }, ne = (t) => {
202
+ }, re = (t) => {
606
203
  var l;
607
204
  const { decision: e, loading: n = !1, textValues: i } = t, o = !!(e != null && e.effectiveFrom), r = !!(e != null && e.validUntil), p = o && r ? {
608
205
  element: {
609
206
  labelName: i == null ? void 0 : i.terms,
610
207
  value: String(e.effectiveFrom),
611
- howToSetTheDecision: R.RANGE,
612
- decisionDataType: N.DATE
208
+ howToSetTheDecision: L.RANGE,
209
+ decisionDataType: k.DATE
613
210
  },
614
- valueData: F({
211
+ valueData: $({
615
212
  labelName: i == null ? void 0 : i.terms,
616
213
  value: {
617
214
  from: String(e.effectiveFrom),
618
215
  to: String(e.validUntil)
619
216
  },
620
- howToSetTheDecision: R.RANGE,
621
- decisionDataType: N.DATE
217
+ howToSetTheDecision: L.RANGE,
218
+ decisionDataType: k.DATE
622
219
  })
623
220
  } : o && !r ? {
624
221
  element: {
625
222
  labelName: i == null ? void 0 : i.terms,
626
223
  value: String(e.effectiveFrom),
627
- howToSetTheDecision: R.EQUAL,
628
- decisionDataType: N.DATE
224
+ howToSetTheDecision: L.EQUAL,
225
+ decisionDataType: k.DATE
629
226
  },
630
- valueData: F({
227
+ valueData: $({
631
228
  labelName: i == null ? void 0 : i.terms,
632
229
  value: String(e.effectiveFrom),
633
- howToSetTheDecision: R.EQUAL,
634
- decisionDataType: N.DATE
230
+ howToSetTheDecision: L.EQUAL,
231
+ decisionDataType: k.DATE
635
232
  })
636
- } : null, m = e ? {
233
+ } : null, g = e ? {
637
234
  labelName: e.labelName || "",
638
235
  decisionDataType: e.decisionDataType || "alphabetical",
639
- value: F(e),
236
+ value: $(e),
640
237
  howToSetTheDecision: e.howToSetTheDecision || "EqualTo"
641
- } : null, d = ((l = e == null ? void 0 : e.conditionsThatEstablishesTheDecision) == null ? void 0 : l.filter(
238
+ } : null, s = ((l = e == null ? void 0 : e.conditionsThatEstablishesTheDecision) == null ? void 0 : l.filter(
642
239
  (b) => !b.hidden
643
- )) || [], s = Array.from({ length: 5 });
240
+ )) || [], d = Array.from({ length: 5 });
644
241
  return /* @__PURE__ */ a(
645
- Ue,
242
+ Ae,
646
243
  {
647
- loading: !!(!n && e && i && m),
244
+ loading: !!(!n && e && i && g),
648
245
  textValues: i,
649
246
  decision: e,
650
- decisionMapper: m,
651
- visibleConditions: d,
247
+ decisionMapper: g,
248
+ visibleConditions: s,
652
249
  decisionDateElement: p,
653
- skeleton: s,
250
+ skeleton: d,
654
251
  terms: !!(i != null && i.terms)
655
252
  }
656
253
  );
657
- }, Oe = y.div`
658
- border-radius: 8px;
659
- border: 1px solid ${E.palette.neutral.N30};
660
- box-sizing: border-box;
661
- display: flex;
662
- flex-direction: column;
663
- // height: 364px;
664
- // width: 332px;
665
- width: 100%;
666
- height: 100%;
667
- box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
668
- `;
669
- y.div`
670
- width: 100%;
671
- height: 100%;
672
- overflow-y: auto;
673
-
674
- &::-webkit-scrollbar {
675
- width: 8px;
676
- }
677
-
678
- &::-webkit-scrollbar-thumb {
679
- background-color: #c1c7d0;
680
- border-radius: 8px;
681
- }
682
-
683
- &::-webkit-scrollbar-track {
684
- background-color: #ebecf0;
685
- border-radius: 8px;
686
- }
687
- `;
688
- const H = (t) => {
689
- const { children: e, controls: n = !0, handleDelete: i, id: o } = t;
690
- return /* @__PURE__ */ a(Oe, { children: /* @__PURE__ */ u(h, { direction: "column", gap: "16px", padding: "12px 16px", children: [
691
- e,
692
- n && /* @__PURE__ */ u(D, { children: [
693
- /* @__PURE__ */ a(S, {}),
694
- /* @__PURE__ */ a(h, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ a(
695
- ee,
696
- {
697
- cursorHover: !0,
698
- appearance: "danger",
699
- size: "24px",
700
- icon: /* @__PURE__ */ a(pe, {}),
701
- onClick: () => {
702
- i(o);
703
- }
704
- }
705
- ) })
706
- ] })
707
- ] }) });
708
- }, _e = y.div`
254
+ }, $e = f.div`
709
255
  position: relative;
710
256
  & > div {
711
257
  padding: 24px 16px;
712
258
  }
713
- `, ze = y.div`
259
+ `, Ie = f.div`
714
260
  background-color: ${({ theme: t }) => {
715
261
  var e, n;
716
- return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N0) || E.palette.neutral.N0;
262
+ return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N0) || v.palette.neutral.N0;
717
263
  }};
718
264
  max-width: 450px;
719
265
  max-height: 90vh;
@@ -741,24 +287,24 @@ const H = (t) => {
741
287
  background-color: #ebecf0;
742
288
  border-radius: 8px;
743
289
  }
744
- `, $e = (t) => {
290
+ `, Re = (t) => {
745
291
  const { children: e, portalId: n, onCloseModal: i, title: o } = t, r = document.getElementById(n);
746
292
  if (!r)
747
293
  throw new Error(
748
294
  "The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
749
295
  );
750
- const p = M("(max-width: 400px)");
751
- return me(
752
- /* @__PURE__ */ a(_e, { smallScreen: p, children: /* @__PURE__ */ a(de, { children: /* @__PURE__ */ a(ze, { children: /* @__PURE__ */ u(h, { direction: "column", gap: "24px", children: [
296
+ const p = I("(max-width: 400px)");
297
+ return ae(
298
+ /* @__PURE__ */ a($e, { smallScreen: p, children: /* @__PURE__ */ a(te, { children: /* @__PURE__ */ a(Ie, { children: /* @__PURE__ */ u(h, { direction: "column", gap: "24px", children: [
753
299
  /* @__PURE__ */ a(h, { direction: "column", gap: "24px", children: /* @__PURE__ */ u(h, { alignItems: "center", justifyContent: "space-between", children: [
754
- /* @__PURE__ */ a(v, { type: "title", size: "large", appearance: "dark", weight: "bold", children: o }),
755
- /* @__PURE__ */ a(ge, { size: "24px", cursor: "pointer", onClick: i })
300
+ /* @__PURE__ */ a(y, { type: "title", size: "large", appearance: "dark", weight: "bold", children: o }),
301
+ /* @__PURE__ */ a(Z, { size: "24px", cursor: "pointer", onClick: i })
756
302
  ] }) }),
757
303
  e
758
304
  ] }) }) }) }),
759
305
  r
760
306
  );
761
- }, qe = he`
307
+ }, Le = fe`
762
308
  from {
763
309
  opacity: 0;
764
310
  transform: translateY(20px);
@@ -768,12 +314,12 @@ const H = (t) => {
768
314
  transform: translateY(0);
769
315
  }
770
316
  `;
771
- y.div`
317
+ f.div`
772
318
  border-radius: 8px;
773
319
  border: 1px solid
774
320
  ${({ theme: t }) => {
775
321
  var e, n;
776
- return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || E.palette.neutral.N30;
322
+ return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || v.palette.neutral.N30;
777
323
  }};
778
324
  box-sizing: border-box;
779
325
  display: flex;
@@ -782,21 +328,21 @@ y.div`
782
328
  height: 100%;
783
329
  box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
784
330
  `;
785
- y.div`
331
+ f.div`
786
332
  & > div {
787
333
  border-radius: 8px;
788
334
  border: 1px solid
789
335
  ${({ theme: t }) => {
790
336
  var e, n;
791
- return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || E.palette.neutral.N30;
337
+ return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || v.palette.neutral.N30;
792
338
  }};
793
339
  }
794
340
  `;
795
- const je = y.div`
341
+ const Me = f.div`
796
342
  & > div {
797
343
  background-color: ${({ theme: t }) => {
798
344
  var e, n;
799
- return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N10) || E.palette.neutral.N10;
345
+ return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N10) || v.palette.neutral.N10;
800
346
  }};
801
347
  justify-content: center;
802
348
  }
@@ -804,18 +350,18 @@ const je = y.div`
804
350
  width: 100%;
805
351
  height: 100%;
806
352
  padding-bottom: 12px;
807
- `, ie = y.div`
353
+ `, le = f.div`
808
354
  width: 100%;
809
355
  height: 100%;
810
356
  & > div {
811
- animation: ${qe} 600ms ease-out;
357
+ animation: ${Le} 600ms ease-out;
812
358
  }
813
- `, He = y.div`
359
+ `, Ve = f.div`
814
360
  & > div > div {
815
361
  border-radius: 8px;
816
362
  box-sizing: border-box;
817
363
  }
818
- `, Be = y.div`
364
+ `, Oe = f.div`
819
365
  & > div {
820
366
  width: 100%;
821
367
  height: 100%;
@@ -836,7 +382,7 @@ const je = y.div`
836
382
  }
837
383
  }
838
384
  `;
839
- function Pe(t) {
385
+ function Ue(t) {
840
386
  const { index: e, handleOpenModal: n } = t;
841
387
  return /* @__PURE__ */ a(
842
388
  H,
@@ -846,15 +392,15 @@ function Pe(t) {
846
392
  },
847
393
  handleView: () => n ? n() : null,
848
394
  controls: !1,
849
- children: /* @__PURE__ */ a(ne, { loading: !0 })
395
+ children: /* @__PURE__ */ a(re, { loading: !0 })
850
396
  },
851
397
  `loading-card-${e}`
852
398
  );
853
399
  }
854
- function Ge(t) {
400
+ function _e(t) {
855
401
  const { decision: e, controls: n, handleOpenModal: i, handleDelete: o, textValues: r } = t;
856
- return e ? /* @__PURE__ */ a(ie, { children: /* @__PURE__ */ u(h, { direction: "column", gap: "4px", width: "100%", padding: "0 0 12px 0", children: [
857
- /* @__PURE__ */ a(v, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: e.decisionId }),
402
+ return e ? /* @__PURE__ */ a(le, { children: /* @__PURE__ */ u(h, { direction: "column", gap: "4px", width: "100%", padding: "0 0 12px 0", children: [
403
+ /* @__PURE__ */ a(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: e.decisionId }),
858
404
  /* @__PURE__ */ a(
859
405
  H,
860
406
  {
@@ -862,22 +408,22 @@ function Ge(t) {
862
408
  handleDelete: () => o ? o(e.decisionId) : null,
863
409
  handleView: () => i ? i(e) : null,
864
410
  controls: n,
865
- children: /* @__PURE__ */ a(ne, { decision: e, textValues: r })
411
+ children: /* @__PURE__ */ a(re, { decision: e, textValues: r })
866
412
  }
867
413
  )
868
414
  ] }) }, e.decisionId) : null;
869
415
  }
870
- function Qe(t) {
416
+ function ze(t) {
871
417
  const {
872
418
  customTitleContentAddCard: e,
873
419
  index: n,
874
420
  handleOpenModal: i,
875
421
  shouldRenderEmptyMessage: o
876
422
  } = t, r = e || "Agregar decisión";
877
- return /* @__PURE__ */ a(ie, { children: o ? null : /* @__PURE__ */ u(h, { direction: "column", gap: "4px", width: "100%", height: "100%", children: [
878
- /* @__PURE__ */ a(v, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: "Nueva decisión" }),
423
+ return /* @__PURE__ */ a(le, { children: o ? null : /* @__PURE__ */ u(h, { direction: "column", gap: "4px", width: "100%", height: "100%", children: [
424
+ /* @__PURE__ */ a(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: "Nueva decisión" }),
879
425
  /* @__PURE__ */ a(
880
- je,
426
+ Me,
881
427
  {
882
428
  onClick: () => i ? i() : null,
883
429
  children: /* @__PURE__ */ a(
@@ -889,8 +435,8 @@ function Qe(t) {
889
435
  handleView: () => i ? i() : null,
890
436
  controls: !1,
891
437
  children: /* @__PURE__ */ u(h, { direction: "column", gap: "12px", alignItems: "center", children: [
892
- /* @__PURE__ */ a(ee, { appearance: "gray", icon: /* @__PURE__ */ a(te, {}), size: "35px" }),
893
- /* @__PURE__ */ a(v, { appearance: "gray", type: "body", size: "large", children: r })
438
+ /* @__PURE__ */ a(O, { appearance: "gray", icon: /* @__PURE__ */ a(ee, {}), size: "35px" }),
439
+ /* @__PURE__ */ a(y, { appearance: "gray", type: "body", size: "large", children: r })
894
440
  ] })
895
441
  }
896
442
  )
@@ -898,14 +444,14 @@ function Qe(t) {
898
444
  )
899
445
  ] }) }, `add-decision-${n}`);
900
446
  }
901
- const Ye = {
902
- loading: Pe,
903
- decision: Ge,
904
- add: Qe
905
- }, q = (t) => {
906
- const { type: e } = t, n = Ye[e];
447
+ const qe = {
448
+ loading: Ue,
449
+ decision: _e,
450
+ add: ze
451
+ }, j = (t) => {
452
+ const { type: e } = t, n = qe[e];
907
453
  return n ? n(t) : null;
908
- }, We = (t) => {
454
+ }, je = (t) => {
909
455
  const {
910
456
  controls: e,
911
457
  customTitleContentAddCard: n,
@@ -913,9 +459,9 @@ const Ye = {
913
459
  loading: o,
914
460
  handleOpenModal: r,
915
461
  handleDelete: p,
916
- textValues: m
917
- } = t, d = o ? Array.from({ length: 3 }).map(
918
- (c, l) => q({
462
+ textValues: g
463
+ } = t, s = o ? Array.from({ length: 3 }).map(
464
+ (c, l) => j({
919
465
  type: "loading",
920
466
  index: l,
921
467
  controls: e,
@@ -923,10 +469,10 @@ const Ye = {
923
469
  loading: o,
924
470
  handleOpenModal: r,
925
471
  handleDelete: p,
926
- textValues: m
472
+ textValues: g
927
473
  })
928
474
  ) : i == null ? void 0 : i.map(
929
- (c) => q({
475
+ (c) => j({
930
476
  type: "decision",
931
477
  decision: c,
932
478
  controls: e,
@@ -934,11 +480,11 @@ const Ye = {
934
480
  loading: o,
935
481
  handleOpenModal: r,
936
482
  handleDelete: p,
937
- textValues: m
483
+ textValues: g
938
484
  })
939
- ), s = ((i == null ? void 0 : i.length) === 0 || i.length < Math.floor(window.innerWidth / 300)) && !o && e;
940
- return { renderedCards: d, shouldRenderAddCard: s };
941
- }, rt = (t) => {
485
+ ), d = ((i == null ? void 0 : i.length) === 0 || i.length < Math.floor(window.innerWidth / 300)) && !o && e;
486
+ return { renderedCards: s, shouldRenderAddCard: d };
487
+ }, gt = (t) => {
942
488
  const {
943
489
  controls: e = !0,
944
490
  customTitleContentAddCard: n,
@@ -946,113 +492,810 @@ const Ye = {
946
492
  decisions: o,
947
493
  textValues: r,
948
494
  decisionTemplate: p,
949
- isModalOpen: m,
950
- selectedDecision: d,
951
- loading: s,
495
+ isModalOpen: g,
496
+ selectedDecision: s,
497
+ loading: d,
952
498
  handleOpenModal: c,
953
499
  handleCloseModal: l,
954
500
  handleSubmitForm: b,
955
501
  handleDelete: T,
956
- terms: g = !0
957
- } = t, w = M("(max-width: 681px)"), C = M("(max-width: 400px)"), { renderedCards: k, shouldRenderAddCard: U } = We({
502
+ terms: m = !0
503
+ } = t, C = I("(max-width: 681px)"), w = I("(max-width: 400px)"), { renderedCards: F, shouldRenderAddCard: U } = je({
958
504
  controls: e,
959
505
  customTitleContentAddCard: n,
960
506
  decisions: o,
961
- loading: s,
507
+ loading: d,
962
508
  handleOpenModal: c,
963
509
  handleDelete: T,
964
510
  textValues: r
965
- }), I = (o == null ? void 0 : o.length) === 0 && !s;
966
- return /* @__PURE__ */ u(D, { children: [
967
- /* @__PURE__ */ a(He, { children: /* @__PURE__ */ a(Be, { children: /* @__PURE__ */ a(h, { direction: "column", gap: "16px", padding: "6px", children: I ? /* @__PURE__ */ u(
511
+ }), R = (o == null ? void 0 : o.length) === 0 && !d;
512
+ return /* @__PURE__ */ u(E, { children: [
513
+ /* @__PURE__ */ a(Ve, { children: /* @__PURE__ */ a(Oe, { children: /* @__PURE__ */ a(h, { direction: "column", gap: "16px", padding: "6px", children: R ? /* @__PURE__ */ u(
514
+ h,
515
+ {
516
+ direction: "column",
517
+ gap: "28px",
518
+ width: "100%",
519
+ height: C ? "auto" : "435px",
520
+ justifyContent: "center",
521
+ alignItems: "center",
522
+ children: [
523
+ /* @__PURE__ */ a(y, { as: "span", type: "label", size: "large", appearance: "gray", children: i || /* @__PURE__ */ u(E, { children: [
524
+ "Aún NO tienes definidas tasas de interés efectivas . Presiona",
525
+ /* @__PURE__ */ u(
526
+ y,
527
+ {
528
+ as: "span",
529
+ type: "label",
530
+ size: "large",
531
+ appearance: "gray",
532
+ weight: "bold",
533
+ children: [
534
+ "“",
535
+ n || "+ Agregar decisión",
536
+ "”"
537
+ ]
538
+ }
539
+ ),
540
+ "para empezar."
541
+ ] }) }),
542
+ /* @__PURE__ */ a(
543
+ N,
544
+ {
545
+ iconBefore: /* @__PURE__ */ a(ee, {}),
546
+ onClick: () => c ? c() : null,
547
+ children: n || "Agregar decisión"
548
+ }
549
+ )
550
+ ]
551
+ }
552
+ ) : /* @__PURE__ */ u(
553
+ ne,
554
+ {
555
+ templateColumns: w ? "repeat(auto-fill, minmax(200px, 1fr))" : "repeat(auto-fill, minmax(300px, 1fr))",
556
+ autoFlow: "row dense",
557
+ gap: "24px",
558
+ alignItems: "start",
559
+ justifyContent: "center",
560
+ autoRows: "1fr",
561
+ justifyItems: "center",
562
+ padding: "6px",
563
+ height: C ? "auto" : "484px",
564
+ children: [
565
+ F,
566
+ U && j({
567
+ type: "add",
568
+ index: o == null ? void 0 : o.length,
569
+ controls: e,
570
+ customTitleContentAddCard: n,
571
+ customMessageEmptyDecisions: i,
572
+ loading: d,
573
+ handleOpenModal: c,
574
+ handleDelete: T,
575
+ textValues: r,
576
+ shouldRenderEmptyMessage: R,
577
+ terms: m
578
+ })
579
+ ]
580
+ }
581
+ ) }) }) }),
582
+ g && /* @__PURE__ */ a(
583
+ Re,
584
+ {
585
+ portalId: "modal-portal",
586
+ onCloseModal: l,
587
+ title: s ? "Editar Decisión" : "Nueva decisión",
588
+ children: /* @__PURE__ */ a(
589
+ it,
590
+ {
591
+ decision: s || p,
592
+ onSubmitEvent: b,
593
+ textValues: r,
594
+ onCancel: () => l ? l() : () => {
595
+ }
596
+ }
597
+ )
598
+ }
599
+ )
600
+ ] });
601
+ }, Be = f.div`
602
+ display: flex;
603
+ justify-content: ${({ justifyContent: t }) => t};
604
+ align-items: ${({ alignItems: t }) => t};
605
+ align-content: ${({ alignContent: t }) => t};
606
+ flex-direction: ${({ direction: t }) => t};
607
+ flex-wrap: ${({ wrap: t }) => t};
608
+ height: ${({ height: t }) => t};
609
+ width: ${({ width: t }) => t};
610
+ gap: ${({ gap: t }) => t};
611
+ margin: ${({ margin: t }) => t};
612
+ padding: ${({ padding: t }) => t};
613
+ background: ${({ background: t, theme: e }) => {
614
+ var n, i, o, r;
615
+ return t ? `${((i = (n = e == null ? void 0 : e.palette) == null ? void 0 : n.neutral) == null ? void 0 : i.N10) || v.palette.neutral.N10}` : `${((r = (o = e == null ? void 0 : e.palette) == null ? void 0 : o.neutral) == null ? void 0 : r.N0) || v.palette.neutral.N0}`;
616
+ }};
617
+ border: ${({ border: t, theme: e }) => {
618
+ var n, i;
619
+ return t ? `1px solid ${((i = (n = e == null ? void 0 : e.palette) == null ? void 0 : n.neutral) == null ? void 0 : i.N40) || v.palette.neutral.N40}` : "none";
620
+ }};
621
+ border-radius: ${({ borderRadius: t }) => t};
622
+ box-sizing: ${({ boxSizing: t }) => t};
623
+ overflow-y: ${({ scroll: t }) => t ? "scroll" : "none"};
624
+ `, He = (t) => {
625
+ const {
626
+ children: e,
627
+ wrap: n,
628
+ direction: i = "column",
629
+ justifyContent: o,
630
+ alignItems: r,
631
+ alignContent: p,
632
+ height: g,
633
+ width: s,
634
+ gap: d,
635
+ background: c,
636
+ borderRadius: l,
637
+ border: b,
638
+ margin: T = "0px",
639
+ padding: m = "0px",
640
+ boxSizing: C,
641
+ scroll: w = !1
642
+ } = t;
643
+ return /* @__PURE__ */ a(
644
+ Be,
645
+ {
646
+ direction: i,
647
+ justifyContent: o,
648
+ alignItems: r,
649
+ alignContent: p,
650
+ height: g,
651
+ width: s,
652
+ wrap: n,
653
+ gap: d,
654
+ background: c,
655
+ border: b,
656
+ margin: T,
657
+ padding: m,
658
+ borderRadius: l,
659
+ boxSizing: C,
660
+ scroll: w,
661
+ children: e
662
+ }
663
+ );
664
+ }, mt = (t) => {
665
+ const { appliedFilters: e, onClear: n, onClick: i, titleClearFilter: o, titleFilter: r } = t, p = !e || e.length === 0;
666
+ return /* @__PURE__ */ a(ge, { borderRadius: "8px", children: /* @__PURE__ */ u(ne, { gap: "12px", templateColumns: "1fr auto auto", children: [
667
+ /* @__PURE__ */ a(
668
+ He,
669
+ {
670
+ background: !0,
671
+ borderRadius: "8px",
672
+ height: "100%",
673
+ direction: "row",
674
+ gap: "8px",
675
+ alignItems: "center",
676
+ padding: "0px 8px",
677
+ children: e == null ? void 0 : e.map((g) => /* @__PURE__ */ a(
678
+ me,
679
+ {
680
+ appearance: "primary",
681
+ displayIcon: !0,
682
+ icon: g.icon,
683
+ label: g.label
684
+ },
685
+ g.label
686
+ ))
687
+ }
688
+ ),
689
+ /* @__PURE__ */ a(
690
+ N,
691
+ {
692
+ cursorHover: !0,
693
+ disabled: p,
694
+ iconBefore: /* @__PURE__ */ a(ue, {}),
695
+ onClick: n,
696
+ variant: "outlined",
697
+ children: o
698
+ }
699
+ ),
700
+ /* @__PURE__ */ a(
701
+ N,
702
+ {
703
+ cursorHover: !0,
704
+ iconBefore: /* @__PURE__ */ a(pe, {}),
705
+ onClick: i,
706
+ variant: "outlined",
707
+ children: r
708
+ }
709
+ )
710
+ ] }) });
711
+ }, Pe = f.div`
712
+ display: flex;
713
+ flex-direction: column;
714
+ background-color: ${({ theme: t }) => {
715
+ var e, n;
716
+ return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N0) || v.palette.neutral.N0;
717
+ }};
718
+ width: ${({ smallScreen: t }) => t ? "335px" : "450px"};
719
+ height: auto;
720
+ border-radius: 8px;
721
+ padding: 24px;
722
+ gap: 24px;
723
+ box-sizing: border-box;
724
+ `, bt = (t) => {
725
+ const {
726
+ actionButtonLabel: e,
727
+ cancelButtonLabel: n,
728
+ children: i,
729
+ loading: o,
730
+ onClick: r,
731
+ onCloseModal: p,
732
+ portalId: g,
733
+ title: s
734
+ } = t, d = I("(max-width: 768px)"), c = document.getElementById(g);
735
+ if (!c)
736
+ throw new Error(
737
+ "The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
738
+ );
739
+ return ae(
740
+ /* @__PURE__ */ a(te, { children: /* @__PURE__ */ u(Pe, { $smallScreen: d, children: [
741
+ /* @__PURE__ */ u(h, { direction: "column", gap: "16px", children: [
742
+ /* @__PURE__ */ u(h, { alignContent: "center", justifyContent: "space-between", children: [
743
+ /* @__PURE__ */ a(y, { appearance: "dark", size: "small", type: "headline", children: s }),
744
+ /* @__PURE__ */ u(h, { alignItems: "center", children: [
745
+ /* @__PURE__ */ a(y, { children: "Cerrar" }),
746
+ /* @__PURE__ */ a(
747
+ O,
748
+ {
749
+ appearance: "dark",
750
+ icon: /* @__PURE__ */ a(Z, {}),
751
+ onClick: p,
752
+ cursorHover: !0
753
+ }
754
+ )
755
+ ] })
756
+ ] }),
757
+ /* @__PURE__ */ a(D, {})
758
+ ] }),
759
+ i,
760
+ /* @__PURE__ */ u(h, { gap: "20px", justifyContent: "flex-end", children: [
761
+ /* @__PURE__ */ a(
762
+ N,
763
+ {
764
+ appearance: "gray",
765
+ onClick: p,
766
+ spacing: "wide",
767
+ variant: "outlined",
768
+ children: n
769
+ }
770
+ ),
771
+ /* @__PURE__ */ a(
772
+ N,
773
+ {
774
+ appearance: "primary",
775
+ loading: o,
776
+ onClick: r,
777
+ spacing: "wide",
778
+ variant: "filled",
779
+ children: e
780
+ }
781
+ )
782
+ ] })
783
+ ] }) }),
784
+ c
785
+ );
786
+ }, Tt = (t) => {
787
+ const { fields: e, onChange: n } = t;
788
+ return /* @__PURE__ */ a(h, { direction: "column", gap: "16px", children: e.map((i) => /* @__PURE__ */ u(h, { gap: "6px", alignItems: "center", children: [
789
+ /* @__PURE__ */ a(h, { padding: "22px 0 0 0", children: /* @__PURE__ */ a(O, { appearance: "primary", icon: i.icon }) }),
790
+ /* @__PURE__ */ a(
791
+ be,
792
+ {
793
+ disabled: i.disabled,
794
+ invalid: i.invalid,
795
+ label: i.label,
796
+ message: i.message,
797
+ name: i.name,
798
+ onChange: n,
799
+ options: i.options,
800
+ placeholder: i.placeholder,
801
+ required: i.required,
802
+ values: i.values,
803
+ fullwidth: !0
804
+ },
805
+ i.name
806
+ )
807
+ ] }, i.name)) });
808
+ }, ft = (t) => {
809
+ console.log(t);
810
+ const { dataDecision: e, originalDecision: n } = t, i = {
811
+ conditionName: e.ruleName || "",
812
+ labelName: e.labelName || "",
813
+ conditionDataType: e.decisionDataType || "alphabetical",
814
+ value: e.value || "",
815
+ howToSetTheCondition: e.howToSetTheDecision || "EqualTo",
816
+ switchPlaces: !0,
817
+ hidden: !1
818
+ };
819
+ return {
820
+ ...n,
821
+ conditionsThatEstablishesTheDecision: n.conditionsThatEstablishesTheDecision.map(
822
+ (o) => o.hidden ? { ...i } : o
823
+ )
824
+ };
825
+ }, xt = (t) => {
826
+ const { decisions: e } = t;
827
+ return e == null ? void 0 : e.map((n) => {
828
+ var o;
829
+ const i = (o = n.conditionsThatEstablishesTheDecision) == null ? void 0 : o.find(
830
+ (r) => r.hidden
831
+ );
832
+ return i ? {
833
+ ...n,
834
+ ruleName: n.ruleName,
835
+ labelName: n.labelName,
836
+ decisionDataType: n.decisionDataType,
837
+ value: n.value,
838
+ howToSetTheDecision: n.howToSetTheDecision,
839
+ conditionsThatEstablishesTheDecision: n.conditionsThatEstablishesTheDecision.map(
840
+ (r) => r.hidden ? { ...i, hidden: !1 } : r
841
+ )
842
+ } : n;
843
+ });
844
+ }, Ge = (t) => ({
845
+ schema: B().required("Required").test(
846
+ "non-empty",
847
+ "Value cannot be empty",
848
+ (e) => e != null && e.trim() !== ""
849
+ ),
850
+ value: t
851
+ }), Qe = (t) => ({
852
+ schema: oe().test(
853
+ "isArrayOrString",
854
+ "Must be an array of strings/numbers or a single string",
855
+ (e) => Array.isArray(e) ? e.every(
856
+ (n) => typeof n == "string" || typeof n == "number"
857
+ ) : typeof e == "string"
858
+ ),
859
+ value: t
860
+ }), Ye = (t) => ({
861
+ schema: oe().test(
862
+ "isArrayOrString",
863
+ "Must be an array of strings/numbers or a single string",
864
+ (e) => Array.isArray(e) ? e.every(
865
+ (n) => typeof n == "string" || typeof n == "number"
866
+ ) : typeof e == "string"
867
+ ),
868
+ value: t
869
+ }), We = (t) => {
870
+ const e = (t == null ? void 0 : t.from) ?? 0, n = (t == null ? void 0 : t.to) ?? 0;
871
+ return {
872
+ schema: M({
873
+ from: q().required("Range From is required").max(n, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
874
+ to: q().min(0, "To value must be greater than or equal to 0").required("To value is required").test(
875
+ "is-greater",
876
+ "To value must be greater than From value",
877
+ function(i) {
878
+ const { from: o } = this.parent;
879
+ return i > o;
880
+ }
881
+ )
882
+ }),
883
+ value: { from: e, to: n }
884
+ };
885
+ }, z = (t, e) => e === k.PERCENTAGE ? {
886
+ schema: q().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
887
+ value: t
888
+ } : {
889
+ schema: B().required("Required"),
890
+ value: t
891
+ }, Je = {
892
+ [x.LIST_OF_VALUES]: Qe,
893
+ [x.LIST_OF_VALUES_MULTI]: Ye,
894
+ [x.RANGE]: We,
895
+ [x.GREATER_THAN]: z,
896
+ [x.LESS_THAN]: z,
897
+ [x.EQUAL]: z
898
+ }, X = (t) => Je[t] || Ge;
899
+ function Ke({
900
+ decision: t,
901
+ onSubmitEvent: e,
902
+ textValues: n
903
+ }) {
904
+ const i = {
905
+ ruleName: t.ruleName || "",
906
+ decisionDataType: t.decisionDataType || k.ALPHABETICAL,
907
+ howToSetTheDecision: t.howToSetTheDecision || "",
908
+ value: t.value || "",
909
+ effectiveFrom: t.effectiveFrom || "",
910
+ validUntil: t.validUntil || "",
911
+ toggleNone: !0,
912
+ conditionsThatEstablishesTheDecision: {},
913
+ checkClosed: !1,
914
+ terms: !0
915
+ };
916
+ let o;
917
+ const r = {
918
+ ruleName: B().required("Name is required"),
919
+ value: Y(() => X(
920
+ o.values.howToSetTheDecision
921
+ )(
922
+ o.values.value,
923
+ o.values.decisionDataType
924
+ ).schema),
925
+ conditionsThatEstablishesTheDecision: Y((s, { parent: d }) => {
926
+ var b;
927
+ if ((d == null ? void 0 : d.toggleNone) && Object.keys(d.conditionsThatEstablishesTheDecision || {}).length > 0) return M().shape({});
928
+ const l = (b = t.conditionsThatEstablishesTheDecision) == null ? void 0 : b.reduce(
929
+ (T, m) => {
930
+ if (o.values.conditionsThatEstablishesTheDecision[m.conditionName] !== void 0) {
931
+ const w = X(
932
+ m.howToSetTheCondition
933
+ );
934
+ T[m.conditionName] = w(
935
+ m.value,
936
+ m.conditionDataType
937
+ ).schema;
938
+ }
939
+ return T;
940
+ },
941
+ {}
942
+ );
943
+ return M(l).test(
944
+ "at-least-one-condition",
945
+ "It must be at least one condition in order for the decision to be validated correctly.",
946
+ (T) => T ? Object.values(T).some(
947
+ (m) => m != null && m !== ""
948
+ ) : !1
949
+ );
950
+ })
951
+ };
952
+ n.terms && (r.effectiveFrom = W().required(
953
+ "effective From date is required"
954
+ ), r.validUntil = W().when(
955
+ "checkClosed",
956
+ (s, d, { parent: c }) => (c == null ? void 0 : c.checkClosed) ? d.required("valid Until date is required").test(
957
+ "is-after-startDate",
958
+ "valid Until date must be greater than or equal to Start date",
959
+ function(b) {
960
+ const T = this.parent.effectiveFrom;
961
+ return !T || !b ? !0 : new Date(b) >= new Date(T);
962
+ }
963
+ ) : d.notRequired()
964
+ ));
965
+ const p = M(r);
966
+ return o = xe({
967
+ initialValues: i,
968
+ validationSchema: p,
969
+ validateOnBlur: !0,
970
+ onSubmit: (s) => {
971
+ var c;
972
+ const d = {
973
+ ...t,
974
+ ruleName: s.ruleName,
975
+ decisionDataType: s.decisionDataType,
976
+ howToSetTheDecision: s.howToSetTheDecision,
977
+ value: s.value,
978
+ effectiveFrom: s.effectiveFrom,
979
+ validUntil: s.validUntil,
980
+ conditionsThatEstablishesTheDecision: (c = t.conditionsThatEstablishesTheDecision) == null ? void 0 : c.filter((l) => {
981
+ const b = s.conditionsThatEstablishesTheDecision[l.conditionName];
982
+ return b != null && b !== "";
983
+ }).map((l) => ({
984
+ ...l,
985
+ value: s.conditionsThatEstablishesTheDecision[l.conditionName]
986
+ }))
987
+ };
988
+ e(d);
989
+ }
990
+ }), { formik: o, handleToggleNoneChange: (s) => {
991
+ var d;
992
+ o.setFieldValue("toggleNone", s), (d = t.conditionsThatEstablishesTheDecision) == null || d.forEach((c) => {
993
+ if (s)
994
+ o.setFieldValue(
995
+ `conditionsThatEstablishesTheDecision.${c.conditionName}`,
996
+ void 0
997
+ );
998
+ else {
999
+ const l = c.howToSetTheCondition === x.LIST_OF_VALUES_MULTI ? [] : "";
1000
+ o.setFieldValue(
1001
+ `conditionsThatEstablishesTheDecision.${c.conditionName}`,
1002
+ l
1003
+ );
1004
+ }
1005
+ });
1006
+ } };
1007
+ }
1008
+ const Xe = f.div`
1009
+ & > div {
1010
+ border-radius: 8px;
1011
+ border: 1px solid
1012
+ ${({ theme: t }) => {
1013
+ var e, n;
1014
+ return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || v.palette.neutral.N30;
1015
+ }};
1016
+ }
1017
+ `, Ze = f.div`
1018
+ width: 100%;
1019
+ height: 100%;
1020
+ overflow-y: auto;
1021
+ &::-webkit-scrollbar {
1022
+ width: 4px;
1023
+ }
1024
+
1025
+ &::-webkit-scrollbar-thumb {
1026
+ background-color: #c1c7d0;
1027
+ border-radius: 8px;
1028
+ }
1029
+
1030
+ &::-webkit-scrollbar-track {
1031
+ background-color: #ebecf0;
1032
+ border-radius: 8px;
1033
+ }
1034
+ `, et = (t) => {
1035
+ const {
1036
+ checked: e,
1037
+ children: n,
1038
+ handleToggleChange: i,
1039
+ id: o,
1040
+ labelToggle: r,
1041
+ name: p,
1042
+ valueToggle: g = ""
1043
+ } = t, [s, d] = V(e), c = (l) => {
1044
+ d(l.target.checked), i(l);
1045
+ };
1046
+ return ye(() => {
1047
+ d(e);
1048
+ }, [e]), /* @__PURE__ */ u(E, { children: [
1049
+ /* @__PURE__ */ a(h, { children: /* @__PURE__ */ a(
1050
+ ie,
1051
+ {
1052
+ checked: s,
1053
+ id: o,
1054
+ name: p,
1055
+ onChange: c,
1056
+ size: "small",
1057
+ value: g,
1058
+ children: /* @__PURE__ */ a(y, { size: "medium", type: "label", weight: "bold", children: r })
1059
+ }
1060
+ ) }),
1061
+ s && /* @__PURE__ */ a(E, { children: n })
1062
+ ] });
1063
+ }, tt = (t) => {
1064
+ const {
1065
+ onHandleStartChange: e,
1066
+ onHandleEndChange: n,
1067
+ onCheckClosedChange: i,
1068
+ labelStart: o,
1069
+ labelEnd: r,
1070
+ checkedClosed: p = !1,
1071
+ required: g = !1,
1072
+ valueStart: s = "",
1073
+ valueEnd: d = "",
1074
+ messageStart: c = "",
1075
+ messageEnd: l = "",
1076
+ statusStart: b = "pending",
1077
+ statusEnd: T = "pending"
1078
+ } = t, [m, C] = V(p), [w, F] = V(s), [U, R] = V(d), P = ({ target: S }) => {
1079
+ C(S.checked), i && i(S.checked);
1080
+ }, de = (S) => {
1081
+ F(S.target.value), e(S);
1082
+ }, se = (S) => {
1083
+ R(S.target.value), n(S);
1084
+ }, ce = I("(max-width: 400px)");
1085
+ return /* @__PURE__ */ u(E, { children: [
1086
+ /* @__PURE__ */ u(h, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
1087
+ /* @__PURE__ */ a(
1088
+ y,
1089
+ {
1090
+ appearance: "gray",
1091
+ margin: "10px 0",
1092
+ size: "medium",
1093
+ type: "title",
1094
+ weight: "bold",
1095
+ children: "Vigencia"
1096
+ }
1097
+ ),
1098
+ /* @__PURE__ */ a(
1099
+ h,
1100
+ {
1101
+ alignContent: "center",
1102
+ justifyContent: "center",
1103
+ wrap: "wrap",
1104
+ gap: "4px",
1105
+ children: /* @__PURE__ */ a(
1106
+ Te,
1107
+ {
1108
+ label: "Cerrada",
1109
+ onChange: P,
1110
+ checked: m,
1111
+ value: ""
1112
+ }
1113
+ )
1114
+ }
1115
+ )
1116
+ ] }),
1117
+ /* @__PURE__ */ u(
968
1118
  h,
969
1119
  {
970
- direction: "column",
971
- gap: "28px",
972
- width: "100%",
973
- height: w ? "auto" : "435px",
974
- justifyContent: "center",
975
- alignItems: "center",
1120
+ direction: ce ? "column" : "row",
1121
+ justifyContent: "space-between",
1122
+ gap: "24px",
976
1123
  children: [
977
- /* @__PURE__ */ a(v, { as: "span", type: "label", size: "large", appearance: "gray", children: i || /* @__PURE__ */ u(D, { children: [
978
- "Aún NO tienes definidas tasas de interés efectivas . Presiona",
979
- /* @__PURE__ */ u(
980
- v,
981
- {
982
- as: "span",
983
- type: "label",
984
- size: "large",
985
- appearance: "gray",
986
- weight: "bold",
987
- children: [
988
- "“",
989
- n || "+ Agregar decisión",
990
- "”"
991
- ]
992
- }
993
- ),
994
- "para empezar."
995
- ] }) }),
996
1124
  /* @__PURE__ */ a(
997
- $,
1125
+ G,
998
1126
  {
999
- iconBefore: /* @__PURE__ */ a(te, {}),
1000
- onClick: () => c ? c() : null,
1001
- children: n || "Agregar decisión"
1127
+ id: "dateStart",
1128
+ label: o,
1129
+ onChange: de,
1130
+ value: w,
1131
+ required: g,
1132
+ size: "compact",
1133
+ status: b,
1134
+ message: c
1135
+ }
1136
+ ),
1137
+ m && /* @__PURE__ */ a(
1138
+ G,
1139
+ {
1140
+ id: "dateEnd",
1141
+ label: r,
1142
+ onChange: se,
1143
+ value: U,
1144
+ required: g,
1145
+ size: "compact",
1146
+ status: T,
1147
+ message: l
1002
1148
  }
1003
1149
  )
1004
1150
  ]
1005
1151
  }
1006
- ) : /* @__PURE__ */ u(
1007
- ce,
1152
+ )
1153
+ ] });
1154
+ }, nt = (t) => {
1155
+ const {
1156
+ formik: e,
1157
+ textValues: n,
1158
+ onCancel: i,
1159
+ visibleConditions: o,
1160
+ normalizedDecision: r,
1161
+ handleToggleNoneChange: p,
1162
+ handleConditionToggleChange: g,
1163
+ showConditionsError: s,
1164
+ termStartStatus: d,
1165
+ termEndStatus: c
1166
+ } = t;
1167
+ return /* @__PURE__ */ a("form", { onSubmit: e.handleSubmit, children: /* @__PURE__ */ u(h, { direction: "column", gap: "24px", children: [
1168
+ Q({
1169
+ condition: r,
1170
+ formik: e,
1171
+ isDecision: !0
1172
+ }),
1173
+ /* @__PURE__ */ a(D, { dashed: !0 }),
1174
+ /* @__PURE__ */ a(Xe, { children: /* @__PURE__ */ a(Ze, { children: /* @__PURE__ */ u(
1175
+ h,
1008
1176
  {
1009
- templateColumns: C ? "repeat(auto-fill, minmax(200px, 1fr))" : "repeat(auto-fill, minmax(300px, 1fr))",
1010
- autoFlow: "row dense",
1011
- gap: "24px",
1012
- alignItems: "start",
1013
- justifyContent: "center",
1014
- autoRows: "1fr",
1015
- justifyItems: "center",
1016
- padding: "6px",
1017
- height: w ? "auto" : "484px",
1177
+ direction: "column",
1178
+ padding: "6px 12px",
1179
+ gap: "16px",
1180
+ height: "272px",
1018
1181
  children: [
1019
- k,
1020
- U && q({
1021
- type: "add",
1022
- index: o == null ? void 0 : o.length,
1023
- controls: e,
1024
- customTitleContentAddCard: n,
1025
- customMessageEmptyDecisions: i,
1026
- loading: s,
1027
- handleOpenModal: c,
1028
- handleDelete: T,
1029
- textValues: r,
1030
- shouldRenderEmptyMessage: I,
1031
- terms: g
1032
- })
1033
- ]
1034
- }
1035
- ) }) }) }),
1036
- m && /* @__PURE__ */ a(
1037
- $e,
1038
- {
1039
- portalId: "modal-portal",
1040
- onCloseModal: l,
1041
- title: d ? "Editar Decisión" : "Nueva decisión",
1042
- children: /* @__PURE__ */ a(
1043
- Ne,
1044
- {
1045
- decision: d || p,
1046
- onSubmitEvent: b,
1047
- textValues: r,
1048
- onCancel: () => l ? l() : () => {
1182
+ /* @__PURE__ */ u(
1183
+ h,
1184
+ {
1185
+ justifyContent: "space-between",
1186
+ alignItems: "center",
1187
+ gap: "64px",
1188
+ children: [
1189
+ /* @__PURE__ */ a(y, { type: "title", size: "small", weight: "bold", appearance: "gray", children: n.factsThatConditionIt }),
1190
+ /* @__PURE__ */ a(
1191
+ ie,
1192
+ {
1193
+ id: "toggleNone",
1194
+ onChange: () => p(!e.values.toggleNone),
1195
+ checked: e.values.toggleNone,
1196
+ size: "small",
1197
+ children: /* @__PURE__ */ a(y, { as: "span", size: "medium", type: "label", weight: "bold", children: n.none })
1198
+ }
1199
+ )
1200
+ ]
1049
1201
  }
1050
- }
1051
- )
1202
+ ),
1203
+ /* @__PURE__ */ a(h, { direction: "column", gap: "20px", children: o == null ? void 0 : o.map((l) => /* @__PURE__ */ a(
1204
+ et,
1205
+ {
1206
+ id: `toggle-${l.conditionName}`,
1207
+ name: `toggle.${l.conditionName}`,
1208
+ labelToggle: l.labelName,
1209
+ checked: !e.values.toggleNone && e.values.conditionsThatEstablishesTheDecision[l.conditionName] !== void 0,
1210
+ handleToggleChange: (b) => g(
1211
+ l.conditionName,
1212
+ l.howToSetTheCondition === x.LIST_OF_VALUES_MULTI
1213
+ )(b.target.checked),
1214
+ children: Q({ condition: l, formik: e })
1215
+ },
1216
+ l.conditionName
1217
+ )) })
1218
+ ]
1052
1219
  }
1053
- )
1054
- ] });
1055
- }, lt = (t) => {
1220
+ ) }) }),
1221
+ n.terms && /* @__PURE__ */ u(E, { children: [
1222
+ /* @__PURE__ */ a(D, { dashed: !0 }),
1223
+ /* @__PURE__ */ a(
1224
+ tt,
1225
+ {
1226
+ labelStart: n.termStart,
1227
+ labelEnd: n.termEnd,
1228
+ valueStart: e.values.effectiveFrom,
1229
+ valueEnd: e.values.validUntil,
1230
+ messageStart: e.errors.effectiveFrom,
1231
+ messageEnd: e.errors.validUntil,
1232
+ statusStart: d,
1233
+ statusEnd: c,
1234
+ onHandleStartChange: (l) => e.setFieldValue("effectiveFrom", l.target.value),
1235
+ onHandleEndChange: (l) => e.setFieldValue("validUntil", l.target.value),
1236
+ onCheckClosedChange: (l) => {
1237
+ e.setFieldValue("checkClosed", l), l && e.setFieldValue("validUntil", "");
1238
+ },
1239
+ checkedClosed: e.values.checkClosed
1240
+ }
1241
+ )
1242
+ ] }),
1243
+ /* @__PURE__ */ a(D, {}),
1244
+ s && /* @__PURE__ */ a(y, { type: "label", size: "medium", appearance: "danger", children: String(e.errors.conditionsThatEstablishesTheDecision) }),
1245
+ /* @__PURE__ */ u(h, { direction: "row", justifyContent: "end", gap: "16px", children: [
1246
+ /* @__PURE__ */ a(N, { appearance: "gray", onClick: i, children: n.cancel }),
1247
+ /* @__PURE__ */ a(N, { type: "submit", children: n.confirm })
1248
+ ] })
1249
+ ] }) });
1250
+ }, it = (t) => {
1251
+ var T;
1252
+ const { decision: e, onSubmitEvent: n, textValues: i, onCancel: o } = t, { formik: r, handleToggleNoneChange: p } = Ke({
1253
+ decision: e,
1254
+ onSubmitEvent: n,
1255
+ textValues: i
1256
+ }), g = {
1257
+ ruleName: e.ruleName,
1258
+ labelName: e.labelName,
1259
+ howToSetTheCondition: e.howToSetTheDecision,
1260
+ decisionDataType: e.decisionDataType,
1261
+ listOfPossibleValues: e.listOfPossibleValues
1262
+ }, s = ((T = e.conditionsThatEstablishesTheDecision) == null ? void 0 : T.filter(
1263
+ (m) => !m.hidden
1264
+ )) || [], d = !!r.errors.conditionsThatEstablishesTheDecision && r.submitCount > 0, c = r.touched.effectiveFrom ? r.errors.effectiveFrom ? "invalid" : "valid" : void 0, l = r.touched.validUntil ? r.errors.validUntil ? "invalid" : "valid" : void 0;
1265
+ return /* @__PURE__ */ a(
1266
+ nt,
1267
+ {
1268
+ formik: r,
1269
+ onCancel: o,
1270
+ textValues: i,
1271
+ decision: e,
1272
+ visibleConditions: s,
1273
+ normalizedDecision: g,
1274
+ handleToggleNoneChange: p,
1275
+ handleConditionToggleChange: (m, C) => (w) => {
1276
+ if (!w)
1277
+ r.setFieldValue(
1278
+ `conditionsThatEstablishesTheDecision.${m}`,
1279
+ void 0
1280
+ ), r.setFieldTouched(
1281
+ `conditionsThatEstablishesTheDecision.${m}`,
1282
+ !1,
1283
+ !1
1284
+ );
1285
+ else {
1286
+ const F = C ? [] : "";
1287
+ r.setFieldValue(
1288
+ `conditionsThatEstablishesTheDecision.${m}`,
1289
+ F
1290
+ );
1291
+ }
1292
+ },
1293
+ showConditionsError: d,
1294
+ termStartStatus: c,
1295
+ termEndStatus: l
1296
+ }
1297
+ );
1298
+ }, yt = (t) => {
1056
1299
  var o;
1057
1300
  const { decisionTemplate: e } = t, n = { ...e }, i = (o = n.conditionsThatEstablishesTheDecision) == null ? void 0 : o.find(
1058
1301
  (r) => r.switchPlaces
@@ -1068,7 +1311,7 @@ const Ye = {
1068
1311
  (r) => r.conditionName === i.conditionName ? { ...r, hidden: !0 } : r
1069
1312
  )
1070
1313
  } : n;
1071
- }, st = (t) => {
1314
+ }, vt = (t) => {
1072
1315
  const { decisions: e } = t;
1073
1316
  return e == null ? void 0 : e.map((n) => {
1074
1317
  var o;
@@ -1087,51 +1330,18 @@ const Ye = {
1087
1330
  )
1088
1331
  } : n;
1089
1332
  });
1090
- }, dt = (t) => {
1091
- console.log(t);
1092
- const { dataDecision: e, originalDecision: n } = t, i = {
1093
- conditionName: e.ruleName || "",
1094
- labelName: e.labelName || "",
1095
- conditionDataType: e.decisionDataType || "alphabetical",
1096
- value: e.value || "",
1097
- howToSetTheCondition: e.howToSetTheDecision || "EqualTo",
1098
- switchPlaces: !0,
1099
- hidden: !1
1100
- };
1101
- return {
1102
- ...n,
1103
- conditionsThatEstablishesTheDecision: n.conditionsThatEstablishesTheDecision.map(
1104
- (o) => o.hidden ? { ...i } : o
1105
- )
1106
- };
1107
- }, ct = (t) => {
1108
- const { decisions: e } = t;
1109
- return e == null ? void 0 : e.map((n) => {
1110
- var o;
1111
- const i = (o = n.conditionsThatEstablishesTheDecision) == null ? void 0 : o.find(
1112
- (r) => r.hidden
1113
- );
1114
- return i ? {
1115
- ...n,
1116
- ruleName: n.ruleName,
1117
- labelName: n.labelName,
1118
- decisionDataType: n.decisionDataType,
1119
- value: n.value,
1120
- howToSetTheDecision: n.howToSetTheDecision,
1121
- conditionsThatEstablishesTheDecision: n.conditionsThatEstablishesTheDecision.map(
1122
- (r) => r.hidden ? { ...i, hidden: !1 } : r
1123
- )
1124
- } : n;
1125
- });
1126
1333
  };
1127
1334
  export {
1128
1335
  H as BusinessRuleCard,
1129
- ne as BusinessRuleView,
1130
- rt as BusinessRules,
1131
- $e as ModalRules,
1132
- Ne as RulesForm,
1133
- dt as revertSortedDataSampleSwitchPlaces,
1134
- ct as revertSortedDataSwitchPlaces,
1135
- lt as sortDisplayDataSampleSwitchPlaces,
1136
- st as sortDisplayDataSwitchPlaces
1336
+ re as BusinessRuleView,
1337
+ gt as BusinessRules,
1338
+ mt as Filter,
1339
+ bt as FilterModal,
1340
+ Tt as FormFilter,
1341
+ Re as ModalRules,
1342
+ it as RulesForm,
1343
+ ft as revertSortedDataSampleSwitchPlaces,
1344
+ xt as revertSortedDataSwitchPlaces,
1345
+ yt as sortDisplayDataSampleSwitchPlaces,
1346
+ vt as sortDisplayDataSwitchPlaces
1137
1347
  };