@socotra/ec-react-utils 2.16.1 → 2.16.2-next.0

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,7 @@ import { FieldConfigRecord } from '@socotra/ec-react-schemas';
15
15
  import { JsonSchema7 } from '@jsonforms/core';
16
16
  import { ModifyChangeInstructionCreateRequest } from '@socotra/ec-react-schemas';
17
17
  import { ParamsChangeInstructionCreateRequest } from '@socotra/ec-react-schemas';
18
+ import { PolicyResponse } from '@socotra/ec-react-schemas';
18
19
  import { PrimitiveValue } from '@socotra/ec-react-schemas';
19
20
  import { ProductConfig } from '@socotra/ec-react-schemas';
20
21
  import { Quantifiers } from '@socotra/ec-react-schemas';
@@ -29,11 +30,13 @@ import { z } from 'zod';
29
30
  * The type `QuoteRequestAdvancedFields` is a zod infererred type that represents the advanced fields of a quote request.
30
31
  * It follows the fields that are found on the QuoteForm in @socotra/ec-react-components
31
32
  */
32
- declare type AccountRequestAdvancedFields = z.infer<typeof advancedFieldSchema_2>;
33
+ declare type AccountRequestAdvancedFields = z.infer<typeof advancedFieldSchema_3>;
33
34
 
34
35
  declare const advancedFieldSchema: z.ZodRecord<z.ZodEnum<["billingLevel", "billingTrigger", "durationBasis", "delinquencyPlanName", "autoRenewalPlanName"]>, z.ZodOptional<z.ZodString>>;
35
36
 
36
- declare const advancedFieldSchema_2: z.ZodObject<{
37
+ declare const advancedFieldSchema_2: z.ZodRecord<z.ZodEnum<["billingLevel", "billingTrigger", "durationBasis", "delinquencyPlanName", "autoRenewalPlanName"]>, z.ZodOptional<z.ZodString>>;
38
+
39
+ declare const advancedFieldSchema_3: z.ZodObject<{
37
40
  autoRenewalPlanName: z.ZodOptional<z.ZodString>;
38
41
  delinquencyPlanName: z.ZodOptional<z.ZodString>;
39
42
  excessCreditPlanName: z.ZodOptional<z.ZodString>;
@@ -107,6 +110,8 @@ declare interface DataModelToJsonSchemaProps {
107
110
 
108
111
  declare const defaultFieldSchema: z.ZodRecord<z.ZodEnum<["startTime", "endTime", "expirationTime", "installmentPlanName", "timezone", "currency"]>, z.ZodOptional<z.ZodString>>;
109
112
 
113
+ declare const defaultFieldSchema_2: z.ZodRecord<z.ZodEnum<["startTime", "endTime", "timezone", "currency"]>, z.ZodOptional<z.ZodString>>;
114
+
110
115
  declare interface ElementFormData {
111
116
  data: {
112
117
  [key: string]: any;
@@ -370,6 +375,36 @@ export declare const getDefaultInitializedTransactionValues: ({ elementResponse,
370
375
  coverageTerms?: Record<string, string> | undefined;
371
376
  };
372
377
 
378
+ /**
379
+ * The `getDefaultPolicyValues` function extracts default values from a `PolicyResponse`
380
+ * object and sets them based on certain conditions.
381
+ * @param {PolicyResponse} policy - The `getDefaultPolicyValues` function takes in three parameters:
382
+ * @param {ProductConfig} productModel - The `productModel` parameter in the `getDefaultPolicyValues`
383
+ * function represents the configuration settings for a specific product.
384
+ * @param {ElementResponse} element - The `element` parameter in the `getDefaultPolicyValues` function
385
+ * represents the element used in the context of generating default values for a policy.
386
+ * @param {DataModel} dataModel - The `dataModel` parameter in the `getDefaultPolicyValues` function
387
+ * represents the data model used in the context of generating default values for a policy.
388
+ * @returns The `getDefaultPolicyValues` function returns an object with properties `default` and
389
+ * `advanced`.
390
+ */
391
+ export declare const getDefaultPolicyValues: (policy: PolicyResponse, productModel: ProductConfig, element: ElementResponse, dataModel: DataModel) => {
392
+ default: {
393
+ currency: string;
394
+ timezone: string | undefined;
395
+ startTime: string;
396
+ endTime: string;
397
+ };
398
+ advanced: {
399
+ billingLevel: "account" | "inherit" | "policy";
400
+ billingTrigger: "accept" | "issue";
401
+ durationBasis: "years" | "months" | "weeks" | "days" | "hours";
402
+ delinquencyPlanName: string | undefined;
403
+ autoRenewalPlanName: string | undefined;
404
+ };
405
+ coverageTerms: Record<string, string>;
406
+ };
407
+
373
408
  /**
374
409
  * The `getDefaultQuoteValues` function extracts default values from a `QuoteResponse`
375
410
  * object and sets them based on certain conditions.
@@ -471,6 +506,18 @@ export declare function getRemoveDataFieldValues(originalObj: AnyObject, modifie
471
506
 
472
507
  export declare const getUpdatedDataFromConstraints: (newData: Record<string, PrimitiveValue>, evaluatedConstraintMap: ConstraintEvaluationResponse | undefined, elementLocator: string) => Record<string, PrimitiveValue>;
473
508
 
509
+ /**
510
+ * The type `PolicyRequestAdvancedFields` is a zod inferred type that represents the advanced fields of a policy request.
511
+ * It follows the fields that are found on the PolicyForm in @socotra/ec-react-components
512
+ */
513
+ export declare type PolicyRequestAdvancedFields = z.infer<typeof advancedFieldSchema_2>;
514
+
515
+ /**
516
+ * The type `PolicyRequestDefaultFields` is a zod inferred type that represents the default fields of a policy request.
517
+ * It follows the fields that are found on the PolicyForm in @socotra/ec-react-components
518
+ */
519
+ export declare type PolicyRequestDefaultFields = z.infer<typeof defaultFieldSchema_2>;
520
+
474
521
  declare type ProductElement = Record<string, ElementConfig & {
475
522
  quantifier: Quantifiers;
476
523
  }>;