@socotra/ec-react-components 2.12.0-next.2 → 2.12.0-next.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,6 +1,7 @@
1
1
  import { AccountConfigRecord } from '@socotra/ec-react-schemas';
2
- import { AccountRequest } from '@socotra/ec-react-schemas';
2
+ import { AccountCreateRequest } from '@socotra/ec-react-schemas';
3
3
  import { AccountResponse } from '@socotra/ec-react-schemas';
4
+ import { AccountUpdateRequest } from '@socotra/ec-react-schemas';
4
5
  import { ConstraintEvaluationResponse } from '@socotra/ec-react-schemas';
5
6
  import { CoverageTermsConfigRecord } from '@socotra/ec-react-schemas';
6
7
  import { CreditDistributionRequest } from '@socotra/ec-react-schemas';
@@ -39,11 +40,88 @@ export declare const AccountForm: {
39
40
  displayName: string;
40
41
  };
41
42
 
43
+ declare type BaseProps = {
44
+ /**
45
+ * The resolved data model for **all** accounts retrieved from the data model response
46
+ */
47
+ accountsModel: AccountConfigRecord;
48
+ /**
49
+ * The account type to use for the form, used to pick the correct data model from the accountsModel
50
+ */
51
+ accountType: keyof AccountConfigRecord;
52
+ /**
53
+ * The custom data types for the configuration that may be referenced by the account's data model
54
+ */
55
+ dataTypes?: DataTypeConfigRecord;
56
+ advancedOptions?: {
57
+ /**
58
+ * The auto renewal plans for the account
59
+ */
60
+ autoRenewalPlans?: string[];
61
+ /**
62
+ * The delinquency plans available for the account
63
+ */
64
+ delinquencyPlans?: string[];
65
+ /**
66
+ * The excess credit plans available for the account
67
+ */
68
+ excessCreditPlans?: string[];
69
+ /**
70
+ * The shortfall tolerance plans available for the account
71
+ */
72
+ shortfallTolerancePlans?: string[];
73
+ /**
74
+ * The invoice documents available for the account
75
+ */
76
+ invoiceDocument?: string[];
77
+ };
78
+ /**
79
+ * Set to true when the form is submitting to set fields to readonly and disable the submit button
80
+ */
81
+ isSubmitting?: boolean;
82
+ /**
83
+ * Disables the form
84
+ */
85
+ disabled?: boolean;
86
+ /**
87
+ * Prevents the form from resetting when disabled
88
+ * default is true
89
+ */
90
+ preventFormResetOnDisabled?: boolean;
91
+ /**
92
+ * The default values for the form
93
+ */
94
+ defaultValues?: Partial<AccountResponse> & {
95
+ autoValidate?: boolean;
96
+ };
97
+ /**
98
+ * Hides the submit button
99
+ */
100
+ hideSubmitButton?: boolean;
101
+ /**
102
+ * The text to display on the submit button
103
+ */
104
+ submitButtonText?: string;
105
+ /**
106
+ * Whether to validate the form on submit
107
+ */
108
+ validateOnSubmit?: boolean;
109
+ /**
110
+ * ID for the form wrapper
111
+ * */
112
+ id?: string;
113
+ titles?: {
114
+ seeAdvancedDetails?: string;
115
+ truthyLabel?: string;
116
+ falsyLabel?: string;
117
+ };
118
+ };
119
+
42
120
  /**
43
121
  * `DraftTransactionForm` is a form for updating a transaction on an issued policy. It requires a transaction in a `draft` state, a `transactionSnapshot`, `paramsChangeInstruction` (created when the transaction is created), and data types / product model / coverage terms from the tenant data model.
44
122
  */
45
123
  export declare const DraftTransactionForm: {
46
- ({ transactionSnapshot, handleSubmit, paramsChangeInstruction, modifyChangeInstruction, preventFormResetOnDisabled, disabled, hideSubmitButton, validateOnSubmit, isSubmitting, submitButtonText, id, dataTypes, productModel, coverageTerms, titles, }: Props_9): JSX_2.Element;
124
+ ({ transactionSnapshot, handleSubmit, paramsChangeInstruction, modifyChangeInstruction, preventFormResetOnDisabled, disabled, hideSubmitButton, validateOnSubmit, isSubmitting, submitButtonText, id, dataTypes, productModel, coverageTerms: coverageTermsDataModel, titles, }: Props_9): JSX_2.Element;
47
125
  displayName: string;
48
126
  };
49
127
 
@@ -51,7 +129,7 @@ export declare const DraftTransactionForm: {
51
129
  * 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.
52
130
  */
53
131
  export declare const ElementForm: {
54
- ({ elementModel, dataTypes, disabled, handleSubmit, dataModel, coverageTerms, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, element, validateOnSubmit, submitButtonText, id, titles, getEvaluatedConstraints, dependencyMap, }: Props_3): JSX_2.Element;
132
+ ({ elementModel, dataTypes, disabled, handleSubmit, dataModel, coverageTerms: coverageTermsDataModel, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, element, validateOnSubmit, submitButtonText, id, titles, getEvaluatedConstraints, dependencyMap, }: Props_3): JSX_2.Element;
55
133
  displayName: string;
56
134
  };
57
135
 
@@ -93,7 +171,7 @@ declare type GetPaymentFormDefaultFieldsProps = {
93
171
  * `InitializedTransactionForm` is a form for updating a transaction on an issued policy. It requires a transaction in an `initialized` state, the current `segment`, and data types / product model / coverage terms from the tenant data model.
94
172
  */
95
173
  export declare const InitializedTransactionForm: {
96
- ({ elementResponse, handleSubmit, paramsChangeInstruction, preventFormResetOnDisabled, disabled, hideSubmitButton, validateOnSubmit, isSubmitting, submitButtonText, id, dataTypes, productModel, coverageTerms, titles, getEvaluatedConstraints, dependencyMap, }: Props_8): JSX_2.Element;
174
+ ({ elementResponse, handleSubmit, paramsChangeInstruction, preventFormResetOnDisabled, disabled, hideSubmitButton, validateOnSubmit, isSubmitting, submitButtonText, id, dataTypes, productModel, coverageTerms: coverageTermsDataModel, titles, getEvaluatedConstraints, dependencyMap, }: Props_8): JSX_2.Element;
97
175
  displayName: string;
98
176
  };
99
177
 
@@ -121,90 +199,19 @@ export declare const PolicyForm: {
121
199
  displayName: string;
122
200
  };
123
201
 
124
- declare type Props = {
202
+ declare type Props = (BaseProps & {
203
+ account: AccountResponse;
125
204
  /**
126
- * The resolved data model for **all** accounts retrieved from the data model response
127
- */
128
- accountsModel: AccountConfigRecord;
129
- /**
130
- * The account type to use for the form, used to pick the correct data model from the accountsModel
131
- */
132
- accountType: keyof AccountConfigRecord;
133
- /**
134
- * The custom data types for the configuration that may be referenced by the account's data model
135
- */
136
- dataTypes?: DataTypeConfigRecord;
137
- advancedOptions?: {
138
- /**
139
- * The auto renewal plans for the account
140
- */
141
- autoRenewalPlans?: string[];
142
- /**
143
- * The delinquency plans available for the account
144
- */
145
- delinquencyPlans?: string[];
146
- /**
147
- * The excess credit plans available for the account
148
- */
149
- excessCreditPlans?: string[];
150
- /**
151
- * The shortfall tolerance plans available for the account
152
- */
153
- shortfallTolerancePlans?: string[];
154
- /**
155
- * The invoice documents available for the account
156
- */
157
- invoiceDocument?: string[];
158
- };
159
- /**
160
- * The function to call when the form is submitted. It will create an AccountRequest from the form data.
205
+ * The function to call when the form is submitted. It will create an AccountUpdateRequest from the form data.
161
206
  */
162
- handleSubmit: (data: AccountRequest) => void;
207
+ handleSubmit: (data: AccountUpdateRequest) => void;
208
+ }) | (BaseProps & {
163
209
  /**
164
- * Set to true when the form is submitting to set fields to readonly and disable the submit button
210
+ * The function to call when the form is submitted. It will create an AccountCreateRequest from the form data.
165
211
  */
166
- isSubmitting?: boolean;
167
- /**
168
- * Disables the form
169
- */
170
- disabled?: boolean;
171
- /**
172
- * Prevents the form from resetting when disabled
173
- * default is true
174
- */
175
- preventFormResetOnDisabled?: boolean;
176
- /**
177
- * The account object to put the form in update mode
178
- */
179
- account?: AccountResponse;
180
- /**
181
- * The default values for the form
182
- */
183
- defaultValues?: Partial<AccountResponse> & {
184
- autoValidate?: boolean;
185
- };
186
- /**
187
- * Hides the submit button
188
- */
189
- hideSubmitButton?: boolean;
190
- /**
191
- * The text to display on the submit button
192
- */
193
- submitButtonText?: string;
194
- /**
195
- * Whether to validate the form on submit
196
- */
197
- validateOnSubmit?: boolean;
198
- /**
199
- * ID for the form wrapper
200
- * */
201
- id?: string;
202
- titles?: {
203
- seeAdvancedDetails?: string;
204
- truthyLabel?: string;
205
- falsyLabel?: string;
206
- };
207
- };
212
+ account: undefined;
213
+ handleSubmit: (data: AccountCreateRequest) => void;
214
+ });
208
215
 
209
216
  declare type Props_10 = {
210
217
  /**