@socotra/ec-react-utils 2.20.1 → 2.21.0-next.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/README.md CHANGED
@@ -62,6 +62,7 @@ Follow instructions in the `ec-react/packages/docs/README.md` file to build the
62
62
 
63
63
  | Function | Description | Returns |
64
64
  |----------|-------------|---------|
65
+ | `getAccountEvaluatedConstraintsRequest` | Creates a request payload to evaluate constraints for an account. | `AccountEvaluateConstraintsRequest` |
65
66
  | `extractElementByLocator` | Extracts the first element from a policy, quote, or transaction segment that matches the specified locator. | `Element` or `undefined` |
66
67
  | `extractElementByType` | Extracts the first element from a policy, quote, or transaction segment that matches the specified type. | `Element` or `undefined` |
67
68
  | `extractElementsByType` | Extracts all elements from a policy, quote, or transaction segment that match the specified type. | `Element[]` |
package/dist/index.d.ts CHANGED
@@ -1,16 +1,19 @@
1
1
  import { AccountConfigRecord } from '@socotra/ec-react-schemas';
2
2
  import { AccountCreateRequest } from '@socotra/ec-react-schemas';
3
+ import { AccountEvaluateConstraintsRequest } from '@socotra/ec-react-schemas';
3
4
  import { AccountResponse } from '@socotra/ec-react-schemas';
4
5
  import { AccountUpdateRequest } from '@socotra/ec-react-schemas';
5
- import { ConstraintEvaluationResponse } from '@socotra/ec-react-schemas';
6
6
  import { CoverageTermsConfigRecord } from '@socotra/ec-react-schemas';
7
7
  import { DataFieldValue } from '@socotra/ec-react-schemas';
8
8
  import { DataModel } from '@socotra/ec-react-schemas';
9
9
  import { DataTypeConfigRecord } from '@socotra/ec-react-schemas';
10
+ import { DependencyMapResponse } from '@socotra/ec-react-schemas';
10
11
  import { ElementConfig } from '@socotra/ec-react-schemas';
11
12
  import { ElementRequest } from '@socotra/ec-react-schemas';
12
13
  import { ElementResponse } from '@socotra/ec-react-schemas';
13
14
  import { ErrorObject } from 'ajv';
15
+ import { EvaluateConstraintsRequest } from '@socotra/ec-react-schemas';
16
+ import { EvaluateConstraintsResponse } from '@socotra/ec-react-schemas';
14
17
  import { FieldConfigRecord } from '@socotra/ec-react-schemas';
15
18
  import { JsonSchema7 } from '@jsonforms/core';
16
19
  import { ModifyChangeInstructionCreateRequest } from '@socotra/ec-react-schemas';
@@ -19,7 +22,6 @@ import { PolicyResponse } from '@socotra/ec-react-schemas';
19
22
  import { PrimitiveValue } from '@socotra/ec-react-schemas';
20
23
  import { ProductConfig } from '@socotra/ec-react-schemas';
21
24
  import { Quantifiers } from '@socotra/ec-react-schemas';
22
- import { QuoteDependencyMapResponse } from '@socotra/ec-react-schemas';
23
25
  import { QuoteRequest } from '@socotra/ec-react-schemas';
24
26
  import { QuoteResponse } from '@socotra/ec-react-schemas';
25
27
  import { SegmentResponse } from '@socotra/ec-react-schemas';
@@ -93,13 +95,14 @@ declare interface DataModelToJsonSchemaProps {
93
95
  data: FieldConfigRecord;
94
96
  timezone?: string;
95
97
  dataTypes?: DataTypeConfigRecord;
96
- evaluatedConstraints?: ConstraintEvaluationResponse;
97
- constraintDependencyMap?: QuoteDependencyMapResponse;
98
+ evaluatedConstraints?: EvaluateConstraintsResponse;
99
+ constraintDependencyMap?: DependencyMapResponse;
98
100
  ignoreConstraints?: boolean;
99
101
  scope: Array<'P' | 'Q' | 'QQ'>;
100
102
  rootDisplayName?: string;
101
103
  account?: AccountResponse;
102
104
  quote?: QuoteResponse;
105
+ isStaticData?: boolean;
103
106
  element?: ElementResponse;
104
107
  transactionElement?: ElementResponse;
105
108
  customDataTypeKey?: string;
@@ -303,6 +306,12 @@ export declare const extractProductElements: ({ dataModel, contents, }: {
303
306
  contents: string[];
304
307
  }) => ProductElementMap;
305
308
 
309
+ export declare const getAccountEvaluatedConstraintsRequest: ({ dependencyMap, locator, data, }: {
310
+ dependencyMap: DependencyMapResponse;
311
+ data: any;
312
+ locator: string;
313
+ }) => AccountEvaluateConstraintsRequest;
314
+
306
315
  export declare function getAccountRequest(params: {
307
316
  data: {
308
317
  [key: string]: any;
@@ -470,6 +479,7 @@ export declare const getDefaultQuoteValues: (quote: QuoteResponse, productModel:
470
479
  autoRenewalPlanName: string | undefined;
471
480
  };
472
481
  coverageTerms: Record<string, string>;
482
+ static: Record<string, any> | undefined;
473
483
  };
474
484
 
475
485
  /**
@@ -496,10 +506,10 @@ export declare const getElementTransactionUpdateRequestFromFormData: (params: Tr
496
506
  };
497
507
 
498
508
  export declare const getEvaluatedConstraintsRequest: ({ dependencyMap, locator, data, }: {
499
- dependencyMap: QuoteDependencyMapResponse;
509
+ dependencyMap: DependencyMapResponse;
500
510
  data: any;
501
511
  locator: string;
502
- }) => Record<string, Record<string, Record<string, string | Record<string, string>>>>;
512
+ }) => EvaluateConstraintsRequest;
503
513
 
504
514
  export declare const getModifyChangeInstructionCreateRequestFromFormData: ({ data, transactionSnapshot, staticLocator, }: TransactionFormData_2) => {
505
515
  action: "modify";
@@ -534,7 +544,7 @@ export declare const getQuoteRequest: (params: QuoteFormData) => QuoteRequest;
534
544
  */
535
545
  export declare function getRemoveDataFieldValues(originalObj: AnyObject, modifiedObj: AnyObject): AnyObject;
536
546
 
537
- export declare const getUpdatedDataFromConstraints: (newData: Record<string, PrimitiveValue>, evaluatedConstraintMap: ConstraintEvaluationResponse | undefined, elementLocator: string) => Record<string, PrimitiveValue>;
547
+ export declare const getUpdatedDataFromConstraints: (newData: Record<string, PrimitiveValue>, evaluatedConstraintMap: EvaluateConstraintsResponse | undefined, elementLocator: string) => Record<string, PrimitiveValue>;
538
548
 
539
549
  export declare const parseToPrimitive: (str: string) => any;
540
550