@socotra/ec-react-utils 2.5.1-next.7 → 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
@@ -204,6 +211,35 @@ export declare const getDefaultQuoteValues: (quote: QuoteResponse, productModel:
204
211
  coverageTerms: Record<string, string>;
205
212
  };
206
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
+
207
243
  /**
208
244
  * The function `getQuoteRequest` processes form data to create a `QuoteRequest` object.
209
245
  * @param {QuoteFormData} - The `getQuoteRequest` function takes in a parameter `data` of type
@@ -213,6 +249,14 @@ export declare const getDefaultQuoteValues: (quote: QuoteResponse, productModel:
213
249
  */
214
250
  export declare const getQuoteRequest: ({ data }: QuoteFormData) => QuoteRequest;
215
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
+
216
260
  declare type ProductElement = Record<string, ElementConfig>;
217
261
 
218
262
  declare interface ProductElementMap {
@@ -261,6 +305,39 @@ export declare const splitInputAndQuantifier: (input: string | undefined) => {
261
305
  quantifier: "" | "*" | "?" | "+" | "!";
262
306
  };
263
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
+
264
341
  export declare function translateError(error: ErrorObject): string;
265
342
 
266
343
  export { }