@socotra/ec-react-components 2.6.3-next.0 → 2.6.3-next.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
@@ -1,12 +1,14 @@
1
1
  import { AccountConfigRecord } from '@socotra/ec-react-schemas';
2
2
  import { AccountRequest } from '@socotra/ec-react-schemas';
3
3
  import { AccountResponse } from '@socotra/ec-react-schemas';
4
+ import { ConstraintEvaluationResponse } from '@socotra/ec-react-schemas';
4
5
  import { CoverageTermsConfigRecord } from '@socotra/ec-react-schemas';
5
6
  import { DataModel } from '@socotra/ec-react-schemas';
6
7
  import { DataTypeConfigRecord } from '@socotra/ec-react-schemas';
7
8
  import { ElementConfig } from '@socotra/ec-react-schemas';
8
9
  import { ElementRequest } from '@socotra/ec-react-schemas';
9
10
  import { ElementResponse } from '@socotra/ec-react-schemas';
11
+ import { EvaluateConstraintsRequest } from '@socotra/ec-react-schemas';
10
12
  import { JSX as JSX_2 } from 'react/jsx-runtime';
11
13
  import { ModifyChangeInstructionCreateRequest } from '@socotra/ec-react-schemas';
12
14
  import { ModifyChangeInstructionResponse } from '@socotra/ec-react-schemas';
@@ -14,6 +16,7 @@ import { ParamsChangeInstructionCreateRequest } from '@socotra/ec-react-schemas'
14
16
  import { ParamsChangeInstructionResponse } from '@socotra/ec-react-schemas';
15
17
  import { PolicyResponse } from '@socotra/ec-react-schemas';
16
18
  import { ProductConfig } from '@socotra/ec-react-schemas';
19
+ import { QuoteDependencyMapResponse } from '@socotra/ec-react-schemas';
17
20
  import { QuoteRequest } from '@socotra/ec-react-schemas';
18
21
  import { QuoteResponse } from '@socotra/ec-react-schemas';
19
22
  import { SegmentResponse } from '@socotra/ec-react-schemas';
@@ -39,7 +42,7 @@ export declare const DraftTransactionForm: {
39
42
  * ElementForm is a form for creating or updating an element of a Quote. It required the element's data model, custom data types, and an element response object.
40
43
  */
41
44
  export declare const ElementForm: {
42
- ({ elementModel, dataTypes, disabled, handleSubmit, coverageTerms, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, element, validateOnSubmit, submitButtonText, id, titles, }: Props_3): JSX_2.Element;
45
+ ({ elementModel, dataTypes, disabled, handleSubmit, dataModel, coverageTerms, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, element, validateOnSubmit, submitButtonText, id, titles, getEvaluatedConstraints, dependencyMap, }: Props_3): JSX_2.Element;
43
46
  displayName: string;
44
47
  };
45
48
 
@@ -214,6 +217,10 @@ declare type Props_3 = {
214
217
  * The custom data types for the configuration that may be referenced by the elementModel
215
218
  */
216
219
  dataTypes?: DataTypeConfigRecord;
220
+ /**
221
+ * The resolved data model retrieved from data model response
222
+ */
223
+ dataModel: DataModel;
217
224
  /**
218
225
  * The coverage terms configuration that may be referenced by the elementModel
219
226
  */
@@ -256,11 +263,50 @@ declare type Props_3 = {
256
263
  * ID for the form wrapper
257
264
  * */
258
265
  id?: string;
266
+ /**
267
+ * The dependency map for the quote's constraints (if any)
268
+ *
269
+ * This map must be provided to enable the form to evaluate constraints, retrieved by
270
+ *
271
+ * @example
272
+ * const dependencyMap = await fetch(`/policy/${tenantLocator}/quotes/${locator}/constraints/dependency`, {
273
+ * method: "GET",
274
+ * headers: {
275
+ * Authorization: `Bearer ${token}`,
276
+ * "Content-Type": "application/json",
277
+ * }
278
+ * });
279
+ */
280
+ dependencyMap?: QuoteDependencyMapResponse;
281
+ /**
282
+ * Evaluates constraints for the quote to determine the values of other fields
283
+ *
284
+ * This function must be provided to enable the form to evaluate constraints
285
+ *
286
+ * @param {object} request - The request object containing the quote locator
287
+ * @param {string} tenantLocator - The tenant locator
288
+ * @param {string} locator - The locator of the element to evaluate constraints for
289
+ * @example
290
+ * const getEvaluatedConstraints = async (request: EvaluateConstraintsRequest, tenantLocator: string, locator: string) => {
291
+ * const response = await fetch(`/policy/${tenantLocator}/quotes/${locator}/constraints/evaluate`, {
292
+ * method: "POST",
293
+ * body: JSON.stringify(request),
294
+ * headers: {
295
+ * Authorization: `Bearer ${token}`,
296
+ * "Content-Type": "application/json",
297
+ * }
298
+ * });
299
+ * const data = await response.json();
300
+ * return data;
301
+ * }
302
+ */
303
+ getEvaluatedConstraints?: (request: EvaluateConstraintsRequest, tenantLocator: string, locator: string) => Promise<ConstraintEvaluationResponse | undefined>;
259
304
  /**
260
305
  * Titles for the form
261
306
  */
262
307
  titles?: {
263
308
  coverageTerms?: string;
309
+ details?: string;
264
310
  };
265
311
  };
266
312
 
@@ -287,6 +333,7 @@ declare type Props_4 = {
287
333
  titles?: {
288
334
  formTitle?: string;
289
335
  seeAdvancedDetails?: string;
336
+ coverageTerms?: string;
290
337
  };
291
338
  };
292
339