@isettingkit/business-rules 2.2.15 → 2.2.16

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.
@@ -1,5 +1,5 @@
1
1
  import { IButton } from '@inubekit/inubekit';
2
- import { ICondition } from '@isettingkit/input';
2
+ import { ICondition as ICondition_2 } from '@isettingkit/input';
3
3
  import { IDecision } from '@isettingkit/input';
4
4
  import { IOption } from '@inubekit/inubekit';
5
5
  import { IRuleDecision } from '@isettingkit/input';
@@ -80,7 +80,7 @@ export declare const formatDecisionForBackend: (props: {
80
80
  businessRuleId?: string;
81
81
  conditionDataType?: ValueDataType[keyof ValueDataType];
82
82
  conditionName?: string;
83
- conditionGroups?: ICondition[];
83
+ conditionGroups?: ICondition_2[];
84
84
  decision?: IDecision;
85
85
  decisions?: IDecision[];
86
86
  decisionDataType?: ValueDataType[keyof ValueDataType];
@@ -107,6 +107,20 @@ export declare const groupsRecordToArrayNew: (record: Record<string, any[]>) =>
107
107
  conditionsThatEstablishesTheDecision: any[];
108
108
  }[];
109
109
 
110
+ declare interface IAttributesGridItem<TData> {
111
+ id: string;
112
+ label: string;
113
+ render?: (value: unknown, ctx: IRenderCtx<TData>) => React.ReactNode;
114
+ value: IPath<TData>;
115
+ withTag?: boolean;
116
+ }
117
+
118
+ declare interface IAttributesGridNode<TData> extends INodeBase<TData> {
119
+ items: IAttributesGridItem<TData>[];
120
+ layout?: ILayout;
121
+ type: "attributesGrid";
122
+ }
123
+
110
124
  export declare interface IBackAndNextButton extends Omit<IButton, "onClick" | "path" | "children"> {
111
125
  handleBack: () => void;
112
126
  handleNext: () => void;
@@ -219,6 +233,10 @@ export declare interface ICheckpickerField {
219
233
 
220
234
  export declare type IClientLabel = string;
221
235
 
236
+ export declare interface ICondition<TData> {
237
+ (data: TData): boolean;
238
+ }
239
+
222
240
  export declare interface IDragAndDropBoxes {
223
241
  group?: string;
224
242
  left: IDragAndDropColumn;
@@ -278,6 +296,15 @@ export declare interface IDropdownMenuGroup {
278
296
  path?: string;
279
297
  }
280
298
 
299
+ declare interface IEntriesGridNode<TData, TEntry> extends INodeBase<TData> {
300
+ entries: IPath<TData>;
301
+ keyOf: (entry: TEntry) => string;
302
+ labelOf: (entry: TEntry) => string;
303
+ layout?: ILayout;
304
+ type: "entriesGrid";
305
+ valueOf: (entry: TEntry) => string;
306
+ }
307
+
281
308
  export declare interface IFilter {
282
309
  appliedFilters?: IFilterTag[];
283
310
  onClear: () => void;
@@ -302,6 +329,25 @@ export declare interface IFormFilter {
302
329
  noFiltersLabel?: string;
303
330
  }
304
331
 
332
+ declare interface IGroupNode<TData> extends INodeBase<TData> {
333
+ children: Array<TSchemaNode<TData, any>>;
334
+ type: "group";
335
+ }
336
+
337
+ declare interface IJsonNode<TData> extends INodeBase<TData> {
338
+ type: "json";
339
+ value: IPath<TData>;
340
+ }
341
+
342
+ declare interface ILayout {
343
+ columns?: {
344
+ desktop: string;
345
+ mobile: string;
346
+ };
347
+ gapToken?: string;
348
+ variant?: "lightCard" | "none";
349
+ }
350
+
305
351
  declare type IListSide = "left" | "right";
306
352
 
307
353
  declare interface IModalRules {
@@ -312,6 +358,27 @@ declare interface IModalRules {
312
358
  description?: string;
313
359
  }
314
360
 
361
+ declare interface INodeBase<TData> {
362
+ id: string;
363
+ when?: ICondition<TData>;
364
+ }
365
+
366
+ export declare type IPath<TData> = string | IPathFn<TData>;
367
+
368
+ declare interface IPathFn<TData> {
369
+ (data: TData): unknown;
370
+ }
371
+
372
+ export declare interface IRenderCtx<TData> {
373
+ data: TData;
374
+ isMobile: boolean;
375
+ isTablet: boolean;
376
+ }
377
+
378
+ declare interface IRenderer<TData> {
379
+ (node: TSchemaNode<TData, any>, ctx: IRenderCtx<TData>): React.ReactNode;
380
+ }
381
+
315
382
  declare interface IRevertSortedData {
316
383
  decisionTemplate?: IRuleDecision;
317
384
  dataDecision?: IRuleDecision;
@@ -383,11 +450,32 @@ declare interface IRulesFormTextValues_3 {
383
450
  validUntil?: string;
384
451
  }
385
452
 
453
+ export declare interface IStepSchema<TData> {
454
+ id: string;
455
+ name: string;
456
+ nodes: Array<TSchemaNode<TData, any>>;
457
+ onBack?: (ctx: {
458
+ stepId: string;
459
+ }) => void;
460
+ }
461
+
386
462
  declare interface ITranslateOptions {
387
463
  url: string;
388
464
  apiKey: string;
389
465
  }
390
466
 
467
+ declare interface IVerificationEngine<TData> {
468
+ data: TData;
469
+ isMobile: boolean;
470
+ isTablet: boolean;
471
+ onBackStep?: (stepId: string) => void;
472
+ schema?: IVerificationSchema<TData>;
473
+ }
474
+
475
+ export declare interface IVerificationSchema<TData> {
476
+ steps: IStepSchema<TData>[];
477
+ }
478
+
391
479
  export declare const mapByGroupNew: (raw: any, mapFn: (condition: any) => any) => Record<string, any[]>;
392
480
 
393
481
  export declare const ModalRules: (props: IModalRules) => ReactPortal;
@@ -400,11 +488,11 @@ export declare const parseRangeFromString: (value: string | number | string[] |
400
488
  } | undefined;
401
489
 
402
490
  export declare const revertSortedDataSampleSwitchPlaces: (props: IRevertSortedData) => {
403
- conditionsThatEstablishesTheDecision: ICondition[];
491
+ conditionsThatEstablishesTheDecision: ICondition_2[];
404
492
  businessRuleId?: string;
405
493
  conditionDataType?: ValueDataType[keyof ValueDataType];
406
494
  conditionName?: string;
407
- conditionGroups?: ICondition[];
495
+ conditionGroups?: ICondition_2[];
408
496
  decision?: IDecision;
409
497
  decisions?: IDecision[];
410
498
  decisionDataType?: ValueDataType[keyof ValueDataType];
@@ -434,8 +522,8 @@ export declare const sortDisplayDataSampleSwitchPlaces: (props: IRevertSortedDat
434
522
  businessRuleId?: string;
435
523
  conditionDataType?: ValueDataType[keyof ValueDataType];
436
524
  conditionName?: string;
437
- conditionGroups?: ICondition[];
438
- conditionsThatEstablishesTheDecision?: ICondition[];
525
+ conditionGroups?: ICondition_2[];
526
+ conditionsThatEstablishesTheDecision?: ICondition_2[];
439
527
  decision?: IDecision;
440
528
  decisions?: IDecision[];
441
529
  decisionDataType?: ValueDataType[keyof ValueDataType];
@@ -467,4 +555,10 @@ export declare const translateObject: (data: Record<string, any>, targetLang: st
467
555
 
468
556
  export declare const translateText: (text: string, targetLang: string, { url, apiKey }: ITranslateOptions) => Promise<string>;
469
557
 
558
+ export declare type TRegistry<TData> = Record<TSchemaNode<TData, any>["type"], IRenderer<TData>>;
559
+
560
+ export declare type TSchemaNode<TData, TEntry> = IAttributesGridNode<TData> | IEntriesGridNode<TData, TEntry> | IGroupNode<TData> | IJsonNode<TData>;
561
+
562
+ export declare function Verification<TData>(props: IVerificationEngine<TData>): JSX.Element;
563
+
470
564
  export { }