@socotra/ec-react-components 2.21.0-next.0 → 2.21.0-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/README.md CHANGED
@@ -15,11 +15,11 @@ Our components are built with modern, robust technologies including **React**, *
15
15
 
16
16
  ## Key Features
17
17
 
18
- - **Schema-Driven UI**: Forms for quotes, policies, accounts, and transactions are generated dynamically from your data model, not hardcoded.
19
- - **Complex Logic Handling**: Built-in support for sophisticated insurance workflows, including constraint evaluation for real-time field dependency updates.
20
- - **Highly Customizable**: A powerful `tag` system allows for deep customization of field behavior directly from the data model—from conditional visibility to special UI controls like multi-select and currency inputs.
21
- - **Enterprise-Ready**: Designed to handle the intricate details of policy administration, including endorsements, payments, disbursements, and renewals.
22
- - **Modern Tech Stack**: A clean, modern, and performant codebase that is a pleasure to work with and extend.
18
+ - **Schema-Driven UI**: Forms for quotes, policies, accounts, and transactions are generated dynamically from your data model, not hardcoded.
19
+ - **Complex Logic Handling**: Built-in support for sophisticated insurance workflows, including constraint evaluation for real-time field dependency updates.
20
+ - **Highly Customizable**: A powerful `tag` system allows for deep customization of field behavior directly from the data model—from conditional visibility to special UI controls like multi-select and currency inputs.
21
+ - **Enterprise-Ready**: Designed to handle the intricate details of policy administration, including endorsements, payments, disbursements, and renewals.
22
+ - **Modern Tech Stack**: A clean, modern, and performant codebase that is a pleasure to work with and extend.
23
23
 
24
24
  ---
25
25
 
@@ -37,23 +37,24 @@ Dive into the detailed documentation for our core components to understand their
37
37
 
38
38
  ### Core Forms
39
39
 
40
- | Component | Description |
41
- | :--- | :--- |
42
- | **AccountForm** | A dynamic form for creating and updating customer accounts based on configurable account types. |
43
- | **QuoteForm** | The cornerstone of the quoting process. A comprehensive, multi-section form for creating and updating quotes with full support for constraint evaluation. |
44
- | **PolicyForm** | A specialized, read-only view for displaying the complete data of an issued policy in a structured format. |
45
- | **ElementForm** | A versatile and powerful form for rendering any sub-element of a policy or quote, such as a vehicle, driver, or location. |
46
- | **PaymentForm** | A suite of components for handling all payment-related actions: creating new payments, applying existing credit, and reversing transactions. |
47
- | **DisbursementForm** | A specialized form for processing disbursements from an account, with dynamic fields based on disbursement type. |
40
+ | Component | Description |
41
+ | :------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------- |
42
+ | **AccountForm** | A dynamic form for creating and updating customer accounts based on configurable account types. |
43
+ | **QuoteForm** | The cornerstone of the quoting process. A comprehensive, multi-section form for creating and updating quotes with full support for constraint evaluation. |
44
+ | **PolicyForm** | A specialized, read-only view for displaying the complete data of an issued policy in a structured format. |
45
+ | **ElementForm** | A versatile and powerful form for rendering any sub-element of a policy or quote, such as a vehicle, driver, or location. |
46
+ | **PaymentForm** | A suite of components for handling all payment-related actions: creating new payments, applying existing credit, and reversing transactions. |
47
+ | **DisbursementForm** | A specialized form for processing disbursements from an account, with dynamic fields based on disbursement type. |
48
+ | **DataPropertyForm** | A dynamic form used for rendering and editing data properties using a provided data model and property schema. |
48
49
 
49
50
  ### Transaction Forms
50
51
 
51
52
  These forms are used for handling changes to policies post-issuance (endorsements, renewals, etc.).
52
53
 
53
- | Component | Description |
54
- | :--- | :--- |
54
+ | Component | Description |
55
+ | :----------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55
56
  | **InitializedTransactionForm** | Handles transactions in an `initialized` state (e.g., a new business quote), with full support for constraint evaluation to manage complex field dependencies before issuance. |
56
- | **DraftTransactionForm** | A specialized form for midterm policy changes. It generates the necessary `param` and `modify` change instructions to accurately update a `draft` transaction. |
57
+ | **DraftTransactionForm** | A specialized form for midterm policy changes. It generates the necessary `param` and `modify` change instructions to accurately update a `draft` transaction. |
57
58
 
58
59
  ---
59
60
 
@@ -62,21 +63,21 @@ These forms are used for handling changes to policies post-issuance (endorsement
62
63
  To unlock the full potential of this library, it's essential to understand the `tag` system. Our custom rendering guide provides a detailed walkthrough of how to control form behavior directly from your data model.
63
64
 
64
65
  This guide covers:
65
- - Conditional Field Hiding (`hidden|...`, `rootHidden|...`, `hidden`)
66
- - Advanced UI Controls (`multiselect`, `horizontal-layout`)
67
- - Data Formatting (`currency`)
68
66
 
67
+ - Conditional Field Hiding (`hidden|...`, `rootHidden|...`, `hidden`)
68
+ - Advanced UI Controls (`multiselect`, `horizontal-layout`)
69
+ - Data Formatting (`currency`)
69
70
 
70
71
  ## Theming
71
72
 
72
73
  To style the components, follow the instructions in the theming guide.
73
74
 
74
- This guide covers:
75
+ This guide covers:
76
+
75
77
  - Theming with Tailwind CSS and `shadcn/ui`
76
78
  - CSS Imports from the package
77
79
  - Per-Component Style Overrides
78
80
 
79
-
80
81
  ## Documentation
81
82
 
82
83
  The documentation for this package is generated from a script that must be run after the package is built.
@@ -92,4 +93,4 @@ Edit files under the `components` directory.
92
93
 
93
94
  Run `pnpm run sync` to update the documentation in the `README.md` files of the other packages.
94
95
 
95
- Follow instructions in the `ec-react/packages/docs/README.md` file to build the documentation and update the `Socotra Documentation` repo.
96
+ Follow instructions in the `ec-react/packages/docs/README.md` file to build the documentation and update the `Socotra Documentation` repo.
package/dist/index.d.ts CHANGED
@@ -1,20 +1,22 @@
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 { CreditDistributionRequest } from '@socotra/ec-react-schemas';
8
8
  import { CreditDistributionReverseRequest } from '@socotra/ec-react-schemas';
9
9
  import { CurrencyType } from '@socotra/ec-react-schemas';
10
10
  import { DataModel } from '@socotra/ec-react-schemas';
11
11
  import { DataTypeConfigRecord } from '@socotra/ec-react-schemas';
12
+ import { DependencyMapResponse } from '@socotra/ec-react-schemas';
12
13
  import { DisbursementCreateRequest } from '@socotra/ec-react-schemas';
13
14
  import { DisbursementRefRecord } from '@socotra/ec-react-schemas';
14
15
  import { ElementConfig } from '@socotra/ec-react-schemas';
15
16
  import { ElementRequest } from '@socotra/ec-react-schemas';
16
17
  import { ElementResponse } from '@socotra/ec-react-schemas';
17
18
  import { EvaluateConstraintsRequest } from '@socotra/ec-react-schemas';
19
+ import { EvaluateConstraintsResponse } from '@socotra/ec-react-schemas';
18
20
  import { FieldConfigRecord } from '@socotra/ec-react-schemas';
19
21
  import { ForwardRefExoticComponent } from 'react';
20
22
  import { JSX as JSX_2 } from 'react/jsx-runtime';
@@ -27,7 +29,6 @@ import { PaymentRequest as PaymentRequest_2 } from '@socotra/ec-react-schemas';
27
29
  import { PolicyResponse } from '@socotra/ec-react-schemas';
28
30
  import { ProductConfig } from '@socotra/ec-react-schemas';
29
31
  import { PropertyRef } from '@socotra/ec-react-schemas';
30
- import { QuoteDependencyMapResponse } from '@socotra/ec-react-schemas';
31
32
  import { QuoteRequest } from '@socotra/ec-react-schemas';
32
33
  import { QuoteResponse } from '@socotra/ec-react-schemas';
33
34
  import { RefAttributes } from 'react';
@@ -40,7 +41,10 @@ import { TransactionSnapshotResponse } from '@socotra/ec-react-schemas';
40
41
  * AccountForm is a form for creating or updating an account. It required a resolved data model, custom data types, and an optional account object to put the form in update mode.
41
42
  */
42
43
  export declare const AccountForm: {
43
- ({ dataModel, accountType, disabled, handleSubmit, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, hideAdvancedFields, validateOnSubmit, account, submitButtonText, id, titles, styles, }: Props): JSX_2.Element;
44
+ ({ dataModel, accountType, disabled, handleSubmit, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, hideAdvancedFields, validateOnSubmit, account, submitButtonText, id, titles, styles, dependencyMap, getEvaluatedConstraints, }: Props & {
45
+ dependencyMap?: DependencyMapResponse;
46
+ getEvaluatedConstraints?: (request: AccountEvaluateConstraintsRequest) => Promise<EvaluateConstraintsResponse | undefined>;
47
+ }): JSX_2.Element;
44
48
  displayName: string;
45
49
  };
46
50
 
@@ -104,6 +108,14 @@ declare type BaseProps = {
104
108
  invoiceDocument?: string;
105
109
  installmentPlanName?: string;
106
110
  };
111
+ /**
112
+ * Optional dependency map for account constraints
113
+ */
114
+ dependencyMap?: DependencyMapResponse;
115
+ /**
116
+ * Optional function to evaluate constraints for the account
117
+ */
118
+ getEvaluatedConstraints?: (request: AccountEvaluateConstraintsRequest) => Promise<EvaluateConstraintsResponse | undefined>;
107
119
  };
108
120
 
109
121
  /**
@@ -403,14 +415,14 @@ declare type Props_2 = {
403
415
  * }
404
416
  * });
405
417
  */
406
- dependencyMap?: QuoteDependencyMapResponse;
418
+ dependencyMap?: DependencyMapResponse;
407
419
  /**
408
420
  * Evaluates constraints for the quote to determine the values of other fields
409
421
  *
410
422
  * This function must be provided to enable the form to evaluate constraints
411
423
  *
412
424
  * @param {object} request - The request object containing the quote locator
413
- * @param {string} tenantLocator - The tenant locator
425
+ * @param {string} quoteLocator - The locator of the quote
414
426
  * @param {string} locator - The locator of the element to evaluate constraints for
415
427
  * @example
416
428
  * const getEvaluatedConstraints = async (request: EvaluateConstraintsRequest, tenantLocator: string, locator: string) => {
@@ -426,7 +438,7 @@ declare type Props_2 = {
426
438
  * return data;
427
439
  * }
428
440
  */
429
- getEvaluatedConstraints?: (request: EvaluateConstraintsRequest, tenantLocator: string, locator: string) => Promise<ConstraintEvaluationResponse | undefined>;
441
+ getEvaluatedConstraints?: (request: EvaluateConstraintsRequest, quoteLocator: string, locator: string) => Promise<EvaluateConstraintsResponse | undefined>;
430
442
  /**
431
443
  * Whether to hide all fields
432
444
  */
@@ -547,7 +559,7 @@ declare type Props_3 = {
547
559
  * }
548
560
  * });
549
561
  */
550
- dependencyMap?: QuoteDependencyMapResponse;
562
+ dependencyMap?: DependencyMapResponse;
551
563
  /**
552
564
  * Evaluates constraints for the quote to determine the values of other fields
553
565
  *
@@ -570,7 +582,7 @@ declare type Props_3 = {
570
582
  * return data;
571
583
  * }
572
584
  */
573
- getEvaluatedConstraints?: (request: EvaluateConstraintsRequest, tenantLocator: string, locator: string) => Promise<ConstraintEvaluationResponse | undefined>;
585
+ getEvaluatedConstraints?: (request: EvaluateConstraintsRequest, tenantLocator: string, locator: string) => Promise<EvaluateConstraintsResponse | undefined>;
574
586
  /**
575
587
  * Custom form styling
576
588
  * See https://github.com/eclipsesource/jsonforms/blob/master/packages/vanilla-renderers/Styles.md
@@ -904,7 +916,7 @@ declare type Props_8 = {
904
916
  * }
905
917
  * });
906
918
  */
907
- dependencyMap?: QuoteDependencyMapResponse;
919
+ dependencyMap?: DependencyMapResponse;
908
920
  /**
909
921
  * Evaluates constraints for the quote to determine the values of other fields
910
922
  *
@@ -927,7 +939,7 @@ declare type Props_8 = {
927
939
  * return data;
928
940
  * }
929
941
  */
930
- getEvaluatedConstraints?: (request: EvaluateConstraintsRequest, tenantLocator: string, locator: string) => Promise<ConstraintEvaluationResponse | undefined>;
942
+ getEvaluatedConstraints?: (request: EvaluateConstraintsRequest, tenantLocator: string, locator: string) => Promise<EvaluateConstraintsResponse | undefined>;
931
943
  /**
932
944
  * Custom form styling
933
945
  * See https://github.com/eclipsesource/jsonforms/blob/master/packages/vanilla-renderers/Styles.md