@socotra/ec-react-utils 2.5.1-next.6 → 2.5.1-next.8

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
@@ -7,9 +7,16 @@ import { ElementResponse } from '@socotra/ec-react-schemas';
7
7
  import { ErrorObject } from 'ajv';
8
8
  import { FieldConfigRecord } from '@socotra/ec-react-schemas';
9
9
  import { JsonSchema7 } from '@jsonforms/core';
10
+ import { ModifyChangeInstructionCreateRequest } from '@socotra/ec-react-schemas';
11
+ import { ParamsChangeInstructionCreateRequest } from '@socotra/ec-react-schemas';
10
12
  import { ProductConfig } from '@socotra/ec-react-schemas';
11
13
  import { QuoteRequest } from '@socotra/ec-react-schemas';
12
14
  import { QuoteResponse } from '@socotra/ec-react-schemas';
15
+ import { TransactionSnapshotResponse } from '@socotra/ec-react-schemas';
16
+
17
+ declare type AnyObject = {
18
+ [key: string]: any;
19
+ };
13
20
 
14
21
  /**
15
22
  * The function `dataModelToJSONSchema` converts a data model to a JSON schema based on specified
@@ -184,9 +191,13 @@ export declare const getDefaultElementValues: (element: ElementResponse, coverag
184
191
  */
185
192
  export declare const getDefaultQuoteValues: (quote: QuoteResponse, productModel: ProductConfig, dataModel: DataModel) => {
186
193
  default: {
187
- expirationTime?: string | undefined;
188
- endTime?: string | undefined;
189
- startTime?: string | undefined;
194
+ startTime: string;
195
+ endTime: string;
196
+ expirationTime: string | undefined;
197
+ } | {
198
+ startTime: string;
199
+ expirationTime: string | undefined;
200
+ endTime?: undefined;
190
201
  };
191
202
  advanced: {
192
203
  currency: string | undefined;
@@ -200,6 +211,35 @@ export declare const getDefaultQuoteValues: (quote: QuoteResponse, productModel:
200
211
  coverageTerms: Record<string, string>;
201
212
  };
202
213
 
214
+ export declare const getDefaultTransactionValues: ({ transactionSnapshot, paramsChangeInstruction, modifyChangeInstruction, coverageTerms, }: {
215
+ transactionSnapshot: TransactionSnapshotResponse;
216
+ paramsChangeInstruction: ParamsChangeInstructionCreateRequest;
217
+ modifyChangeInstruction?: ModifyChangeInstructionCreateRequest;
218
+ coverageTerms: CoverageTermsConfigRecord;
219
+ }) => {
220
+ default: {
221
+ newPolicyEndDate?: string | undefined;
222
+ effectiveTime: string;
223
+ };
224
+ coverageTerms: Record<string, string>;
225
+ };
226
+
227
+ export declare const getModifyChangeInstructionCreateRequestFromFormData: ({ data, transactionSnapshot, staticLocator, }: TransactionFormData) => {
228
+ staticLocator: string;
229
+ action: "modify";
230
+ removeCoverageTerms?: Record<string, any> | undefined;
231
+ removeData?: Record<string, any> | undefined;
232
+ setCoverageTerms?: Record<string, string> | undefined;
233
+ setData?: Record<string, any> | undefined;
234
+ };
235
+
236
+ /**
237
+ * Get ParamsChangeInstructionCreateRequest from form data
238
+ * @param data - form data
239
+ * @returns ParamsChangeInstructionCreateRequest
240
+ */
241
+ export declare const getParamsChangeInstructionCreateRequestFromFormData: ({ data, }: TransactionFormData_2) => ParamsChangeInstructionCreateRequest;
242
+
203
243
  /**
204
244
  * The function `getQuoteRequest` processes form data to create a `QuoteRequest` object.
205
245
  * @param {QuoteFormData} - The `getQuoteRequest` function takes in a parameter `data` of type
@@ -209,6 +249,14 @@ export declare const getDefaultQuoteValues: (quote: QuoteResponse, productModel:
209
249
  */
210
250
  export declare const getQuoteRequest: ({ data }: QuoteFormData) => QuoteRequest;
211
251
 
252
+ /**
253
+ * Recursively compare two objects and return the values that should be removed.
254
+ * @param originalObj - The original object.
255
+ * @param modifiedObj - The modified object.
256
+ * @returns The values that should be removed.
257
+ */
258
+ export declare function getRemoveDataFieldValues(originalObj: AnyObject, modifiedObj: AnyObject): AnyObject;
259
+
212
260
  declare type ProductElement = Record<string, ElementConfig>;
213
261
 
214
262
  declare interface ProductElementMap {
@@ -257,6 +305,39 @@ export declare const splitInputAndQuantifier: (input: string | undefined) => {
257
305
  quantifier: "" | "*" | "?" | "+" | "!";
258
306
  };
259
307
 
308
+ declare interface TransactionFormData {
309
+ data: {
310
+ default?: {
311
+ effectiveTime: string;
312
+ newPolicyEndDate?: string;
313
+ };
314
+ advanced?: {
315
+ currency?: string;
316
+ timezone?: string;
317
+ billingPlan?: string;
318
+ defaultTermDuration?: string;
319
+ installmentPlan?: string;
320
+ durationBasis?: string;
321
+ delinquencyPlanName?: string;
322
+ };
323
+ coverageTerms?: {
324
+ [key: string]: string;
325
+ };
326
+ [key: string]: any;
327
+ };
328
+ staticLocator: string;
329
+ transactionSnapshot: TransactionSnapshotResponse;
330
+ }
331
+
332
+ declare interface TransactionFormData_2 {
333
+ data: {
334
+ default: {
335
+ effectiveTime: string;
336
+ newPolicyEndDate?: string;
337
+ };
338
+ };
339
+ }
340
+
260
341
  export declare function translateError(error: ErrorObject): string;
261
342
 
262
343
  export { }