@socotra/ec-react-utils 2.24.1-next.2 → 2.24.1-next.3

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
@@ -15,6 +15,9 @@ import { ErrorObject } from 'ajv';
15
15
  import { EvaluateConstraintsRequest } from '@socotra/ec-react-schemas';
16
16
  import { EvaluateConstraintsResponse } from '@socotra/ec-react-schemas';
17
17
  import { FieldConfigRecord } from '@socotra/ec-react-schemas';
18
+ import { FnolCreateRequest } from '@socotra/ec-react-schemas';
19
+ import { FnolPatchRequest } from '@socotra/ec-react-schemas';
20
+ import { FnolResponse } from '@socotra/ec-react-schemas';
18
21
  import { JsonSchema7 } from '@jsonforms/core';
19
22
  import { ModifyChangeInstructionCreateRequest } from '@socotra/ec-react-schemas';
20
23
  import { ParamsChangeInstructionCreateRequest } from '@socotra/ec-react-schemas';
@@ -70,6 +73,14 @@ declare type AnyObject = {
70
73
 
71
74
  export declare const compareData: (originalData: Record<string, PrimitiveValue>, updatedData: Record<string, PrimitiveValue>, path?: string[]) => DataChange[];
72
75
 
76
+ export declare interface CreateRequestParams {
77
+ data: {
78
+ [key: string]: any;
79
+ };
80
+ fnol?: never;
81
+ default: Partial<Omit<FnolCreateRequest, 'data'>>;
82
+ }
83
+
73
84
  declare type DataChange = {
74
85
  originalValue: DataFieldValue;
75
86
  newValue: DataFieldValue;
@@ -434,6 +445,30 @@ export declare const getDefaultElementValues: (element: ElementResponse, coverag
434
445
  coverageTerms?: Record<string, string> | undefined;
435
446
  };
436
447
 
448
+ /**
449
+ * The function `getDefaultFnolValues` returns a partial copy of an FnolResponse object with
450
+ * default values for the type, incidentTime, incidentSummary, policyLocator, accountLocator,
451
+ * region, and autoValidate properties.
452
+ * @param {Partial<FnolResponse>} fnol - The `fnol` parameter is of type `Partial<FnolResponse>`,
453
+ * which means it is an optional object that extends the `FnolResponse` interface.
454
+ * @returns A partial FnolResponse object is being returned, with the data from the input fnol
455
+ * and the default property set to an object with the type, incidentTime, incidentSummary,
456
+ * policyLocator, accountLocator, region, and autoValidate properties.
457
+ */
458
+ export declare const getDefaultFnolValues: (fnol: Partial<FnolResponse>) => {
459
+ default: {
460
+ type: string;
461
+ incidentTime: string | undefined;
462
+ incidentTimezone: string | undefined;
463
+ incidentSummary: string | undefined;
464
+ policyLocator: string | undefined;
465
+ accountLocator: string | undefined;
466
+ region: string | undefined;
467
+ autoValidate: boolean;
468
+ };
469
+ data?: Record<string, any> | undefined;
470
+ };
471
+
437
472
  /**
438
473
  * The function `getDefaultInitializedTransactionValues` takes an `ElementResponse` object and a `CoverageTermsConfigRecord` object,
439
474
  * and returns the default initialized transaction values for the element.
@@ -555,6 +590,19 @@ export declare const getEvaluatedConstraintsRequest: ({ dependencyMap, locator,
555
590
  locator: string;
556
591
  }) => EvaluateConstraintsRequest;
557
592
 
593
+ /**
594
+ * The function `getFnolNameByType` returns the name of an Fnol type by removing the 'Fnol' suffix
595
+ * if it exists.
596
+ * @param {string} type - The `type` parameter is a string that represents the type of an Fnol.
597
+ * @returns The function `getFnolNameByType` returns a string which is the name of the Fnol type
598
+ * without the 'Fnol' suffix if it exists.
599
+ */
600
+ export declare const getFnolNameByType: (type: string) => string;
601
+
602
+ export declare function getFnolRequest(params: PatchRequestParams): FnolPatchRequest;
603
+
604
+ export declare function getFnolRequest(params: CreateRequestParams): FnolCreateRequest;
605
+
558
606
  export declare const getModifyChangeInstructionCreateRequestFromFormData: ({ data, transactionSnapshot, staticLocator, }: TransactionFormData_2) => {
559
607
  staticLocator: string;
560
608
  action: "modify";
@@ -594,6 +642,14 @@ export { JsonSchema7 }
594
642
 
595
643
  export declare const parseToPrimitive: (str: string) => any;
596
644
 
645
+ export declare interface PatchRequestParams {
646
+ fnol: Partial<FnolResponse>;
647
+ data: {
648
+ [key: string]: any;
649
+ };
650
+ default: Partial<Omit<FnolPatchRequest, 'setData' | 'removeData'>>;
651
+ }
652
+
597
653
  /**
598
654
  * The type `PolicyRequestAdvancedFields` is a zod inferred type that represents the advanced fields of a policy request.
599
655
  * It follows the fields that are found on the PolicyForm in @socotra/ec-react-components