@isettingkit/business-rules 0.2.1 → 0.2.2

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