@socotra/ec-react-utils 2.2.5-alpha.1 → 2.2.5-alpha.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.d.ts CHANGED
@@ -2,10 +2,12 @@ import { AccountRequest } from '@socotra/ec-react-schemas';
2
2
  import { AccountResponse } from '@socotra/ec-react-schemas';
3
3
  import { DataModel } from '@socotra/ec-react-schemas';
4
4
  import { DataTypeConfigRecord } from '@socotra/ec-react-schemas';
5
+ import { ElementConfig } from '@socotra/ec-react-schemas';
5
6
  import { ElementResponse } from '@socotra/ec-react-schemas';
6
7
  import { ErrorObject } from 'ajv';
7
8
  import { FieldConfigRecord } from '@socotra/ec-react-schemas';
8
9
  import { JsonSchema7 } from '@jsonforms/core';
10
+ import { ProductConfig } from '@socotra/ec-react-schemas';
9
11
  import { QuoteRequest } from '@socotra/ec-react-schemas';
10
12
  import { QuoteResponse } from '@socotra/ec-react-schemas';
11
13
 
@@ -21,6 +23,37 @@ declare interface DataModelToJsonSchemaProps {
21
23
  element?: ElementResponse;
22
24
  }
23
25
 
26
+ export declare const extractElementDataModel: ({ dataModel, quote, elementLocator, }: {
27
+ quote: QuoteResponse;
28
+ dataModel: DataModel;
29
+ elementLocator: string;
30
+ }) => ElementConfig | false;
31
+
32
+ export declare const extractElementFromQuote: (quote: QuoteResponse, elementLocator: string) => false | ({
33
+ type: string;
34
+ locator: string;
35
+ staticLocator: string;
36
+ data?: Record<string, any> | undefined;
37
+ coverageTerms?: Record<string, string> | undefined;
38
+ rootLocator?: string | undefined;
39
+ tenantLocator?: string | undefined;
40
+ parentLocator?: string | undefined;
41
+ } & {
42
+ elements?: any[] | undefined;
43
+ });
44
+
45
+ export declare const extractProductDataModel: ({ dataModel, element: { productName }, }: {
46
+ element: {
47
+ productName: string;
48
+ };
49
+ dataModel: DataModel;
50
+ }) => ProductConfig;
51
+
52
+ export declare const extractProductElements: ({ dataModel, productDataModel, }: {
53
+ dataModel: DataModel;
54
+ productDataModel: ProductConfig;
55
+ }) => ProductElementMap;
56
+
24
57
  export declare const getAccountRequest: (formData: TODO) => AccountRequest;
25
58
 
26
59
  export declare const getDefaultValues: (quote: QuoteResponse) => {
@@ -57,6 +90,15 @@ export declare const getQuoteRequest: ({ data }: QuoteFormData) => QuoteRequest;
57
90
  */
58
91
  export declare const parseElementTypeAndScopeByElementType: (elementType: string) => [elementName: string, scope: 'Quote' | 'QuickQuote' | 'Policy' | null];
59
92
 
93
+ declare type ProductElement = Record<string, ElementConfig>;
94
+
95
+ declare interface ProductElementMap {
96
+ coverages: ProductElement;
97
+ exposures: ProductElement;
98
+ policyLines: ProductElement;
99
+ exposureGroups: ProductElement;
100
+ }
101
+
60
102
  declare interface QuoteFormData {
61
103
  data: {
62
104
  default?: {
@@ -105,6 +147,8 @@ export declare function retrieveDataModelFromElement(element: ElementResponse, d
105
147
  readOnly?: boolean | undefined;
106
148
  }> | undefined;
107
149
  contents?: string[] | undefined;
150
+ coverageTerms?: string[] | undefined;
151
+ charges?: string[] | undefined;
108
152
  };
109
153
 
110
154
  /**
@@ -115,6 +159,11 @@ export declare function retrieveDataModelFromElement(element: ElementResponse, d
115
159
  */
116
160
  export declare function retrieveElementFromQuoteByLocator(quoteElement: ElementResponse, locator: string): ElementResponse | undefined;
117
161
 
162
+ export declare const splitInputAndQuantifier: (input: string | undefined) => {
163
+ name: string;
164
+ quantifier: "" | "*" | "?" | "+" | "!";
165
+ };
166
+
118
167
  export declare function transformErrors(errors: ErrorObject<string, Record<string, any>, unknown>[] | null | undefined): ErrorObject<string, Record<string, any>, unknown>[] | undefined;
119
168
 
120
169
  export { }