@isettingkit/business-rules 3.1.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  isettingkit is a modular UI toolkit designed to streamline the creation and management of business rule-driven interfaces. It offers a suite of reusable components, utilities, and type definitions to facilitate the development of dynamic, rule-based forms and configurations.
4
4
 
5
+ ## Packages
6
+
7
+ - [isettingkit-input](https://github.com/selsa-inube/isettingkit-input)
8
+ - [isettingkit-view](https://github.com/selsa-inube/isettingkit-view)
9
+
5
10
  ## 📁 Project Structure
6
11
 
7
12
  The src directory is organized into the following primary modules:
@@ -1,14 +1,8 @@
1
1
  import { IButton } from '@inubekit/inubekit';
2
- import { ICondition as ICondition_2 } from '@isettingkit/input';
3
- import { IDecision } from '@isettingkit/input';
4
2
  import { IOption } from '@inubekit/inubekit';
5
- import { IRuleDecision } from '@isettingkit/input';
6
- import { IValue } from '@isettingkit/input';
7
3
  import { JSX } from 'react/jsx-runtime';
8
4
  import { JSX as JSX_2 } from 'react';
9
5
  import { ReactPortal } from 'react';
10
- import { ValueDataType } from '@isettingkit/input';
11
- import { ValueHowToSetUp } from '@isettingkit/input';
12
6
 
13
7
  export declare const BackAndNextButton: (props: IBackAndNextButton) => JSX.Element;
14
8
 
@@ -45,6 +39,14 @@ export declare const DropdownMenu: (props: IDropdownMenu) => JSX.Element;
45
39
 
46
40
  export declare const DropdownMenuContainer: (props: IDropdownMenuContainer) => JSX.Element;
47
41
 
42
+ declare enum EFieldTypeNew {
43
+ ALPHABETICAL = "alphabetical",
44
+ CURRENCY = "currency",
45
+ DATE = "date",
46
+ NUMBER = "number",
47
+ PERCENTAGE = "percentage"
48
+ }
49
+
48
50
  export declare enum EValueHowToSetUp {
49
51
  EQUAL = "EqualTo",
50
52
  GREATER_THAN = "GreaterThan",
@@ -78,23 +80,23 @@ export declare const formatDecisionForBackend: (props: {
78
80
  value: any;
79
81
  conditionsThatEstablishesTheDecision: any;
80
82
  businessRuleId?: string;
81
- conditionDataType?: ValueDataType[keyof ValueDataType];
83
+ conditionDataType?: "number" | "alphabetical" | "currency" | "date" | "monetary" | "percentage";
82
84
  conditionName?: string;
83
85
  conditionGroups?: ICondition_2[];
84
86
  decision?: IDecision;
85
87
  decisions?: IDecision[];
86
- decisionDataType?: ValueDataType[keyof ValueDataType];
88
+ decisionDataType?: "number" | "alphabetical" | "currency" | "date" | "monetary" | "percentage";
87
89
  descriptionOfChange?: string;
88
90
  descriptionUse?: string;
89
91
  effectiveFrom?: Date | string;
90
- howToSetTheCondition?: ValueHowToSetUp[keyof ValueHowToSetUp];
91
- howToSetTheDecision?: ValueHowToSetUp[keyof ValueHowToSetUp];
92
+ howToSetTheCondition?: "EqualTo" | "GreaterThan" | "LessThan" | "ListOfValues" | "ListOfValuesMulti" | "Range";
93
+ howToSetTheDecision?: "EqualTo" | "GreaterThan" | "LessThan" | "ListOfValues" | "ListOfValuesMulti" | "Range";
92
94
  labelName?: string;
93
95
  placeholder?: string;
94
96
  placeholderFrom?: string;
95
97
  placeholderTo?: string;
96
98
  listOfPossibleValues?: IValue;
97
- ruleDataType?: ValueDataType[keyof ValueDataType];
99
+ ruleDataType?: "number" | "alphabetical" | "currency" | "date" | "monetary" | "percentage";
98
100
  ruleName?: string;
99
101
  timeUnit?: string;
100
102
  transactionOperation?: string;
@@ -184,23 +186,22 @@ declare interface IBusinessRules_3 {
184
186
  controls?: boolean;
185
187
  customTitleContentAddCard?: string;
186
188
  customMessageEmptyDecisions?: string;
187
- decisions?: IRuleDecision[];
189
+ decisions?: IRuleDecisionNew[];
188
190
  editionMode?: "classic" | "versioned";
189
- textValues: IRulesFormTextValues_3;
190
- decisionTemplate: IRuleDecision;
191
+ decisionTemplate: IRuleDecisionNew;
191
192
  isRulesModalOpen: boolean;
192
- selectedDecision: IRuleDecision | null;
193
+ selectedDecision: IRuleDecisionNew | null;
193
194
  loading: boolean;
194
195
  configureDecisionModal: boolean;
195
196
  handleOpenModal?: () => void;
196
197
  handleCloseModal?: () => void;
197
- handleSubmitForm?: (dataDecision: IRuleDecision) => void;
198
- handleOpenRulesModal?: (checkedItems?: IOption[], decision?: IRuleDecision | null) => void;
198
+ handleSubmitForm?: (dataDecision: IRuleDecisionNew) => void;
199
+ handleOpenRulesModal?: (checkedItems?: IOption[], decision?: IRuleDecisionNew | null) => void;
199
200
  handleDelete?: (id: string) => void;
200
201
  terms?: boolean;
201
202
  onRemoveCondition?: (conditionName: string) => void;
202
203
  onRestoreConditions?: (conditionNames: string[]) => void;
203
- baseDecisionTemplate?: IRuleDecision;
204
+ baseDecisionTemplate?: IRuleDecisionNew;
204
205
  shouldRenderEmptyMessage?: boolean;
205
206
  withEditOption?: boolean;
206
207
  configurateDecisionOptions?: IOption[];
@@ -221,9 +222,8 @@ export declare interface IBusinessRuleView {
221
222
  declare interface IBusinessRuleView_2 {
222
223
  cardTitle?: boolean;
223
224
  controls?: boolean;
224
- decision?: IRuleDecision;
225
+ decision?: IRuleDecisionNew;
225
226
  loading?: boolean;
226
- textValues?: IRulesFormTextValues_3;
227
227
  position?: number;
228
228
  isOpen?: boolean;
229
229
  onToggle?: () => void;
@@ -251,6 +251,34 @@ export declare interface ICondition<TData> {
251
251
  (data: TData): boolean;
252
252
  }
253
253
 
254
+ declare interface ICondition_2 {
255
+ conditionsThatEstablishesTheDecision?: ICondition_2[];
256
+ conditionDataType: (typeof ValueDataType)[keyof typeof ValueDataType];
257
+ hidden?: boolean;
258
+ conditionName: string;
259
+ listOfPossibleValues?: IValue;
260
+ switchPlaces?: boolean;
261
+ value?: string | string[] | number | IValue | undefined;
262
+ howToSetTheCondition: (typeof ValueHowToSetUp)[keyof typeof ValueHowToSetUp];
263
+ labelName: string;
264
+ descriptionUse?: string;
265
+ i18n?: Partial<Record<string, string>>;
266
+ i18nValue?: string | string[] | number | IValue;
267
+ }
268
+
269
+ declare interface IDecision {
270
+ decisionDataType: (typeof ValueDataType)[keyof typeof ValueDataType];
271
+ validUntil?: Date;
272
+ labelName: string;
273
+ ruleDataType: (typeof ValueDataType)[keyof typeof ValueDataType];
274
+ ruleName: string;
275
+ listOfPossibleValues?: IValue;
276
+ effectiveFrom?: Date;
277
+ value?: string | string[] | number | IValue | undefined;
278
+ howToSetTheDecision: (typeof ValueHowToSetUp)[keyof typeof ValueHowToSetUp];
279
+ descriptionUse?: string;
280
+ }
281
+
254
282
  export declare interface IDragAndDropBoxes {
255
283
  group?: string;
256
284
  left: IDragAndDropColumn;
@@ -348,6 +376,11 @@ declare interface IGroupNode<TData> extends INodeBase<TData> {
348
376
  type: "group";
349
377
  }
350
378
 
379
+ declare interface IInputStatus {
380
+ from?: string | number | Date;
381
+ to?: string | number | Date;
382
+ }
383
+
351
384
  declare interface IJsonNode<TData> extends INodeBase<TData> {
352
385
  type: "json";
353
386
  value: IPath<TData>;
@@ -401,6 +434,64 @@ declare interface IRevertSortedData {
401
434
  originalDecision?: IRuleDecision;
402
435
  }
403
436
 
437
+ declare interface IRuleDecision {
438
+ businessRuleId?: string;
439
+ conditionDataType?: (typeof ValueDataType)[keyof typeof ValueDataType];
440
+ conditionName?: string;
441
+ conditionGroups?: ICondition_2[];
442
+ conditionsThatEstablishesTheDecision?: ICondition_2[];
443
+ decision?: IDecision;
444
+ decisions?: IDecision[];
445
+ decisionDataType?: (typeof ValueDataType)[keyof typeof ValueDataType];
446
+ decisionId?: string;
447
+ descriptionOfChange?: string;
448
+ descriptionUse?: string;
449
+ effectiveFrom?: Date | string;
450
+ howToSetTheCondition?: (typeof ValueHowToSetUp)[keyof typeof ValueHowToSetUp];
451
+ howToSetTheDecision?: (typeof ValueHowToSetUp)[keyof typeof ValueHowToSetUp];
452
+ labelName?: string;
453
+ placeholder?: string;
454
+ placeholderFrom?: string;
455
+ placeholderTo?: string;
456
+ listOfPossibleValues?: IValue;
457
+ ruleDataType?: (typeof ValueDataType)[keyof typeof ValueDataType];
458
+ ruleName?: string;
459
+ timeUnit?: string;
460
+ transactionOperation?: string;
461
+ validUntil?: Date | string;
462
+ value?: string | string[] | number | IValue | undefined;
463
+ i18nValue?: string | string[] | number | IValue;
464
+ }
465
+
466
+ declare interface IRuleDecisionNew {
467
+ businessRuleId?: string;
468
+ conditionDataType?: EFieldTypeNew;
469
+ conditionName?: string;
470
+ conditionGroups?: ICondition_2[];
471
+ conditionsThatEstablishesTheDecision?: ICondition_2[];
472
+ decision?: IDecision;
473
+ decisions?: IDecision[];
474
+ decisionDataType?: EFieldTypeNew;
475
+ decisionId?: string;
476
+ descriptionOfChange?: string;
477
+ descriptionUse?: string;
478
+ effectiveFrom?: Date | string;
479
+ howToSetTheCondition?: (typeof ValueHowToSetUp)[keyof typeof ValueHowToSetUp];
480
+ howToSetTheDecision?: (typeof ValueHowToSetUp)[keyof typeof ValueHowToSetUp];
481
+ labelName?: string;
482
+ placeholder?: string;
483
+ placeholderFrom?: string;
484
+ placeholderTo?: string;
485
+ listOfPossibleValues?: IValue;
486
+ ruleDataType?: EFieldTypeNew;
487
+ ruleName?: string;
488
+ timeUnit?: string;
489
+ transactionOperation?: string;
490
+ validUntil?: Date | string;
491
+ value?: string | string[] | number | IValue | undefined;
492
+ i18nValue?: string | string[] | number | IValue;
493
+ }
494
+
404
495
  export declare interface IRulesForm {
405
496
  decision: IRuleDecision;
406
497
  onCancel?: () => void;
@@ -444,26 +535,6 @@ declare interface IRulesFormTextValues_2 {
444
535
  termStart: string;
445
536
  }
446
537
 
447
- declare interface IRulesFormTextValues_3 {
448
- cancel: string;
449
- change: string;
450
- changePlaceholder: string;
451
- confirm: string;
452
- criteria: string;
453
- factsThatConditionIt: string;
454
- none: string;
455
- rangeMax: (label: string) => string;
456
- rangeMin: (label: string) => string;
457
- reasonForChange: string;
458
- selectOption: string;
459
- selectOptions: string;
460
- termEnd: string;
461
- terms?: string;
462
- termStart: string;
463
- effectiveFrom?: string;
464
- validUntil?: string;
465
- }
466
-
467
538
  export declare interface IStepSchema<TData> {
468
539
  id: string;
469
540
  name: string;
@@ -478,6 +549,20 @@ declare interface ITranslateOptions {
478
549
  apiKey: string;
479
550
  }
480
551
 
552
+ declare interface IValue {
553
+ from?: number | string | Date;
554
+ labelFrom?: string;
555
+ labelTo?: string;
556
+ list?: string[];
557
+ listSelected?: string[];
558
+ messageFrom?: string;
559
+ messageTo?: string;
560
+ statusFrom?: IInputStatus;
561
+ statusTo?: IInputStatus;
562
+ to?: number | string | Date;
563
+ value?: string | number | string[];
564
+ }
565
+
481
566
  declare interface IVerificationEngine<TData> {
482
567
  data: TData;
483
568
  isMobile: boolean;
@@ -496,7 +581,7 @@ export declare const ModalRules: (props: IModalRules) => ReactPortal;
496
581
 
497
582
  export declare const normalizeDecisionToNewShape: (decision: any) => any;
498
583
 
499
- export declare const parseRangeFromString: (value: string | number | string[] | IValue | undefined) => string | number | IValue | string[] | {
584
+ export declare const parseRangeFromString: (value: string | number | string[] | IValue | undefined) => string | number | string[] | IValue | {
500
585
  from?: number;
501
586
  to?: number;
502
587
  } | undefined;
@@ -504,24 +589,24 @@ export declare const parseRangeFromString: (value: string | number | string[] |
504
589
  export declare const revertSortedDataSampleSwitchPlaces: (props: IRevertSortedData) => {
505
590
  conditionsThatEstablishesTheDecision: ICondition_2[];
506
591
  businessRuleId?: string;
507
- conditionDataType?: ValueDataType[keyof ValueDataType];
592
+ conditionDataType?: "number" | "alphabetical" | "currency" | "date" | "monetary" | "percentage";
508
593
  conditionName?: string;
509
594
  conditionGroups?: ICondition_2[];
510
595
  decision?: IDecision;
511
596
  decisions?: IDecision[];
512
- decisionDataType?: ValueDataType[keyof ValueDataType];
597
+ decisionDataType?: "number" | "alphabetical" | "currency" | "date" | "monetary" | "percentage";
513
598
  decisionId?: string;
514
599
  descriptionOfChange?: string;
515
600
  descriptionUse?: string;
516
601
  effectiveFrom?: Date | string;
517
- howToSetTheCondition?: ValueHowToSetUp[keyof ValueHowToSetUp];
518
- howToSetTheDecision?: ValueHowToSetUp[keyof ValueHowToSetUp];
602
+ howToSetTheCondition?: "EqualTo" | "GreaterThan" | "LessThan" | "ListOfValues" | "ListOfValuesMulti" | "Range";
603
+ howToSetTheDecision?: "EqualTo" | "GreaterThan" | "LessThan" | "ListOfValues" | "ListOfValuesMulti" | "Range";
519
604
  labelName?: string;
520
605
  placeholder?: string;
521
606
  placeholderFrom?: string;
522
607
  placeholderTo?: string;
523
608
  listOfPossibleValues?: IValue;
524
- ruleDataType?: ValueDataType[keyof ValueDataType];
609
+ ruleDataType?: "number" | "alphabetical" | "currency" | "date" | "monetary" | "percentage";
525
610
  ruleName?: string;
526
611
  timeUnit?: string;
527
612
  transactionOperation?: string;
@@ -538,25 +623,25 @@ export declare const SendButton: (props: IButton) => JSX.Element;
538
623
 
539
624
  export declare const sortDisplayDataSampleSwitchPlaces: (props: IRevertSortedData) => {
540
625
  businessRuleId?: string;
541
- conditionDataType?: ValueDataType[keyof ValueDataType];
626
+ conditionDataType?: "number" | "alphabetical" | "currency" | "date" | "monetary" | "percentage";
542
627
  conditionName?: string;
543
628
  conditionGroups?: ICondition_2[];
544
629
  conditionsThatEstablishesTheDecision?: ICondition_2[];
545
630
  decision?: IDecision;
546
631
  decisions?: IDecision[];
547
- decisionDataType?: ValueDataType[keyof ValueDataType];
632
+ decisionDataType?: "number" | "alphabetical" | "currency" | "date" | "monetary" | "percentage";
548
633
  decisionId?: string;
549
634
  descriptionOfChange?: string;
550
635
  descriptionUse?: string;
551
636
  effectiveFrom?: Date | string;
552
- howToSetTheCondition?: ValueHowToSetUp[keyof ValueHowToSetUp];
553
- howToSetTheDecision?: ValueHowToSetUp[keyof ValueHowToSetUp];
637
+ howToSetTheCondition?: "EqualTo" | "GreaterThan" | "LessThan" | "ListOfValues" | "ListOfValuesMulti" | "Range";
638
+ howToSetTheDecision?: "EqualTo" | "GreaterThan" | "LessThan" | "ListOfValues" | "ListOfValuesMulti" | "Range";
554
639
  labelName?: string;
555
640
  placeholder?: string;
556
641
  placeholderFrom?: string;
557
642
  placeholderTo?: string;
558
643
  listOfPossibleValues?: IValue;
559
- ruleDataType?: ValueDataType[keyof ValueDataType];
644
+ ruleDataType?: "number" | "alphabetical" | "currency" | "date" | "monetary" | "percentage";
560
645
  ruleName?: string;
561
646
  timeUnit?: string;
562
647
  transactionOperation?: string;
@@ -581,6 +666,24 @@ export declare type TRegistry<TData> = Record<TSchemaNode<TData, any>["type"], I
581
666
 
582
667
  export declare type TSchemaNode<TData, TEntry> = IAttributesGridNode<TData> | IEntriesGridNode<TData, TEntry> | IGroupNode<TData> | IJsonNode<TData>;
583
668
 
669
+ declare const ValueDataType: {
670
+ readonly ALPHABETICAL: "alphabetical";
671
+ readonly CURRENCY: "currency";
672
+ readonly MONETARY: "monetary";
673
+ readonly DATE: "date";
674
+ readonly NUMBER: "number";
675
+ readonly PERCENTAGE: "percentage";
676
+ };
677
+
678
+ declare const ValueHowToSetUp: {
679
+ readonly EQUAL: "EqualTo";
680
+ readonly GREATER_THAN: "GreaterThan";
681
+ readonly LESS_THAN: "LessThan";
682
+ readonly LIST_OF_VALUES: "ListOfValues";
683
+ readonly LIST_OF_VALUES_MULTI: "ListOfValuesMulti";
684
+ readonly RANGE: "Range";
685
+ };
686
+
584
687
  export declare function Verification<TData>(props: IVerificationEngine<TData>): JSX.Element;
585
688
 
586
689
  export { }