@socotra/ec-react-utils 2.2.5-alpha.1 → 2.2.5-alpha.4

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
@@ -1,11 +1,12 @@
1
- import { AccountRequest } from '@socotra/ec-react-schemas';
2
1
  import { AccountResponse } from '@socotra/ec-react-schemas';
3
2
  import { DataModel } from '@socotra/ec-react-schemas';
4
3
  import { DataTypeConfigRecord } from '@socotra/ec-react-schemas';
4
+ import { ElementConfig } from '@socotra/ec-react-schemas';
5
5
  import { ElementResponse } from '@socotra/ec-react-schemas';
6
6
  import { ErrorObject } from 'ajv';
7
7
  import { FieldConfigRecord } from '@socotra/ec-react-schemas';
8
8
  import { JsonSchema7 } from '@jsonforms/core';
9
+ import { ProductConfig } from '@socotra/ec-react-schemas';
9
10
  import { QuoteRequest } from '@socotra/ec-react-schemas';
10
11
  import { QuoteResponse } from '@socotra/ec-react-schemas';
11
12
 
@@ -21,9 +22,49 @@ declare interface DataModelToJsonSchemaProps {
21
22
  element?: ElementResponse;
22
23
  }
23
24
 
24
- export declare const getAccountRequest: (formData: TODO) => AccountRequest;
25
+ export declare const extractElementDataModel: ({ dataModel, quote, elementLocator, }: {
26
+ quote: QuoteResponse;
27
+ dataModel: DataModel;
28
+ elementLocator: string;
29
+ }) => ElementConfig | false;
25
30
 
26
- export declare const getDefaultValues: (quote: QuoteResponse) => {
31
+ export declare const extractElementFromQuote: (quote: QuoteResponse, elementLocator: string) => false | ({
32
+ type: string;
33
+ locator: string;
34
+ staticLocator: string;
35
+ data?: Record<string, any> | undefined;
36
+ coverageTerms?: Record<string, string> | undefined;
37
+ rootLocator?: string | undefined;
38
+ tenantLocator?: string | undefined;
39
+ parentLocator?: string | undefined;
40
+ } & {
41
+ elements?: ({
42
+ type: string;
43
+ locator: string;
44
+ staticLocator: string;
45
+ data?: Record<string, any> | undefined;
46
+ coverageTerms?: Record<string, string> | undefined;
47
+ rootLocator?: string | undefined;
48
+ tenantLocator?: string | undefined;
49
+ parentLocator?: string | undefined;
50
+ } & any)[];
51
+ });
52
+
53
+ export declare const extractProductDataModel: ({ dataModel, element: { productName }, }: {
54
+ element: {
55
+ productName: string;
56
+ };
57
+ dataModel: DataModel;
58
+ }) => ProductConfig;
59
+
60
+ export declare const extractProductElements: ({ dataModel, productDataModel, }: {
61
+ dataModel: DataModel;
62
+ productDataModel: ProductConfig;
63
+ }) => ProductElementMap;
64
+
65
+ export declare const getDefaultElementValues: (element: ElementResponse) => Partial<ElementResponse>;
66
+
67
+ export declare const getDefaultQuoteValues: (quote: QuoteResponse) => {
27
68
  default: {
28
69
  expirationTime?: string | undefined;
29
70
  endTime?: string | undefined;
@@ -55,7 +96,16 @@ export declare const getQuoteRequest: ({ data }: QuoteFormData) => QuoteRequest;
55
96
  * @param elementType The element type to parse, e.g. `element.type` from an `ElementResponse`
56
97
  * @returns [elementName: string, scope: 'Quote' | 'QuickQuote' | 'Policy' | null]
57
98
  */
58
- export declare const parseElementTypeAndScopeByElementType: (elementType: string) => [elementName: string, scope: 'Quote' | 'QuickQuote' | 'Policy' | null];
99
+ export declare const parseElementTypeAndScopeByElementType: (elementType: string) => [elementName: string, scope: "Quote" | "QuickQuote" | "Policy" | null];
100
+
101
+ declare type ProductElement = Record<string, ElementConfig>;
102
+
103
+ declare interface ProductElementMap {
104
+ coverages: ProductElement;
105
+ exposures: ProductElement;
106
+ policyLines: ProductElement;
107
+ exposureGroups: ProductElement;
108
+ }
59
109
 
60
110
  declare interface QuoteFormData {
61
111
  data: {
@@ -105,6 +155,8 @@ export declare function retrieveDataModelFromElement(element: ElementResponse, d
105
155
  readOnly?: boolean | undefined;
106
156
  }> | undefined;
107
157
  contents?: string[] | undefined;
158
+ coverageTerms?: string[] | undefined;
159
+ charges?: string[] | undefined;
108
160
  };
109
161
 
110
162
  /**
@@ -115,6 +167,11 @@ export declare function retrieveDataModelFromElement(element: ElementResponse, d
115
167
  */
116
168
  export declare function retrieveElementFromQuoteByLocator(quoteElement: ElementResponse, locator: string): ElementResponse | undefined;
117
169
 
170
+ export declare const splitInputAndQuantifier: (input: string | undefined) => {
171
+ name: string;
172
+ quantifier: "" | "*" | "?" | "+" | "!";
173
+ };
174
+
118
175
  export declare function transformErrors(errors: ErrorObject<string, Record<string, any>, unknown>[] | null | undefined): ErrorObject<string, Record<string, any>, unknown>[] | undefined;
119
176
 
120
177
  export { }