@socotra/ec-react-utils 2.23.1 → 2.24.0-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
@@ -26,7 +26,7 @@ import { QuoteRequest } from '@socotra/ec-react-schemas';
26
26
  import { QuoteResponse } from '@socotra/ec-react-schemas';
27
27
  import { SegmentResponse } from '@socotra/ec-react-schemas';
28
28
  import { TransactionSnapshotResponse } from '@socotra/ec-react-schemas';
29
- import { z } from 'zod/v3';
29
+ import { z } from 'zod';
30
30
 
31
31
  /**
32
32
  * The type `QuoteRequestAdvancedFields` is a zod infererred type that represents the advanced fields of a quote request.
@@ -34,35 +34,35 @@ import { z } from 'zod/v3';
34
34
  */
35
35
  declare type AccountRequestAdvancedFields = z.infer<typeof advancedFieldSchema_3>;
36
36
 
37
- declare const advancedFieldSchema: z.ZodRecord<z.ZodEnum<["billingLevel", "billingTrigger", "durationBasis", "delinquencyPlanName", "autoRenewalPlanName"]>, z.ZodOptional<z.ZodString>>;
37
+ declare const advancedFieldSchema: z.ZodObject<{
38
+ billingLevel: z.ZodOptional<z.ZodString>;
39
+ billingTrigger: z.ZodOptional<z.ZodString>;
40
+ durationBasis: z.ZodOptional<z.ZodString>;
41
+ delinquencyPlanName: z.ZodOptional<z.ZodString>;
42
+ autoRenewalPlanName: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strip>;
38
44
 
39
- declare const advancedFieldSchema_2: z.ZodRecord<z.ZodEnum<["billingLevel", "billingTrigger", "durationBasis", "delinquencyPlanName", "autoRenewalPlanName"]>, z.ZodOptional<z.ZodString>>;
45
+ declare const advancedFieldSchema_2: z.ZodObject<{
46
+ billingLevel: z.ZodOptional<z.ZodString>;
47
+ billingTrigger: z.ZodOptional<z.ZodString>;
48
+ durationBasis: z.ZodOptional<z.ZodString>;
49
+ delinquencyPlanName: z.ZodOptional<z.ZodString>;
50
+ autoRenewalPlanName: z.ZodOptional<z.ZodString>;
51
+ }, z.core.$strip>;
40
52
 
41
53
  declare const advancedFieldSchema_3: z.ZodObject<{
42
54
  autoRenewalPlanName: z.ZodOptional<z.ZodString>;
43
55
  delinquencyPlanName: z.ZodOptional<z.ZodString>;
44
56
  excessCreditPlanName: z.ZodOptional<z.ZodString>;
45
57
  shortfallTolerancePlanName: z.ZodOptional<z.ZodString>;
46
- billingLevel: z.ZodOptional<z.ZodEnum<["account", "inherit", "policy"]>>;
58
+ billingLevel: z.ZodOptional<z.ZodEnum<{
59
+ account: "account";
60
+ inherit: "inherit";
61
+ policy: "policy";
62
+ }>>;
47
63
  invoiceDocument: z.ZodOptional<z.ZodString>;
48
64
  installmentPlanName: z.ZodOptional<z.ZodString>;
49
- }, "strip", z.ZodTypeAny, {
50
- billingLevel?: "account" | "policy" | "inherit" | undefined;
51
- delinquencyPlanName?: string | undefined;
52
- autoRenewalPlanName?: string | undefined;
53
- installmentPlanName?: string | undefined;
54
- shortfallTolerancePlanName?: string | undefined;
55
- excessCreditPlanName?: string | undefined;
56
- invoiceDocument?: string | undefined;
57
- }, {
58
- billingLevel?: "account" | "policy" | "inherit" | undefined;
59
- delinquencyPlanName?: string | undefined;
60
- autoRenewalPlanName?: string | undefined;
61
- installmentPlanName?: string | undefined;
62
- shortfallTolerancePlanName?: string | undefined;
63
- excessCreditPlanName?: string | undefined;
64
- invoiceDocument?: string | undefined;
65
- }>;
65
+ }, z.core.$strip>;
66
66
 
67
67
  declare type AnyObject = {
68
68
  [key: string]: any;
@@ -112,9 +112,21 @@ declare interface DataModelToJsonSchemaProps {
112
112
  hiddenExceptions?: string[];
113
113
  }
114
114
 
115
- declare const defaultFieldSchema: z.ZodRecord<z.ZodEnum<["startTime", "endTime", "expirationTime", "installmentPlanName", "timezone", "currency"]>, z.ZodOptional<z.ZodString>>;
115
+ declare const defaultFieldSchema: z.ZodObject<{
116
+ startTime: z.ZodOptional<z.ZodString>;
117
+ endTime: z.ZodOptional<z.ZodString>;
118
+ expirationTime: z.ZodOptional<z.ZodString>;
119
+ installmentPlanName: z.ZodOptional<z.ZodString>;
120
+ timezone: z.ZodOptional<z.ZodString>;
121
+ currency: z.ZodOptional<z.ZodString>;
122
+ }, z.core.$strip>;
116
123
 
117
- declare const defaultFieldSchema_2: z.ZodRecord<z.ZodEnum<["startTime", "endTime", "timezone", "currency"]>, z.ZodOptional<z.ZodString>>;
124
+ declare const defaultFieldSchema_2: z.ZodObject<{
125
+ startTime: z.ZodOptional<z.ZodString>;
126
+ endTime: z.ZodOptional<z.ZodString>;
127
+ timezone: z.ZodOptional<z.ZodString>;
128
+ currency: z.ZodOptional<z.ZodString>;
129
+ }, z.core.$strip>;
118
130
 
119
131
  declare interface ElementFormData {
120
132
  data: {
@@ -229,49 +241,49 @@ export declare const extractElementsByType: <T extends ElementResponse>(response
229
241
 
230
242
  export declare const extractElementsFromQuote: (elements: Array<ElementResponse>, elementType: string) => ({
231
243
  locator: string;
232
- type: string;
233
244
  staticLocator: string;
245
+ type: string;
246
+ rootLocator?: string | undefined;
247
+ tenantLocator?: string | undefined;
234
248
  data?: Record<string, any> | undefined;
235
- coverageTerms?: Record<string, any> | undefined;
236
249
  parentLocator?: string | undefined;
250
+ coverageTerms?: Record<string, any> | undefined;
237
251
  originalEffectiveTime?: string | undefined;
238
- tenantLocator?: string | undefined;
239
- rootLocator?: string | undefined;
240
252
  } & {
241
253
  elements?: ({
242
254
  locator: string;
243
- type: string;
244
255
  staticLocator: string;
256
+ type: string;
257
+ rootLocator?: string | undefined;
258
+ tenantLocator?: string | undefined;
245
259
  data?: Record<string, any> | undefined;
246
- coverageTerms?: Record<string, any> | undefined;
247
260
  parentLocator?: string | undefined;
261
+ coverageTerms?: Record<string, any> | undefined;
248
262
  originalEffectiveTime?: string | undefined;
249
- tenantLocator?: string | undefined;
250
- rootLocator?: string | undefined;
251
263
  } & /*elided*/ any)[];
252
264
  })[];
253
265
 
254
266
  export declare const extractElementsFromTransactionSegment: (elements: Array<ElementResponse>, elementType: string) => ({
255
267
  locator: string;
256
- type: string;
257
268
  staticLocator: string;
269
+ type: string;
270
+ rootLocator?: string | undefined;
271
+ tenantLocator?: string | undefined;
258
272
  data?: Record<string, any> | undefined;
259
- coverageTerms?: Record<string, any> | undefined;
260
273
  parentLocator?: string | undefined;
274
+ coverageTerms?: Record<string, any> | undefined;
261
275
  originalEffectiveTime?: string | undefined;
262
- tenantLocator?: string | undefined;
263
- rootLocator?: string | undefined;
264
276
  } & {
265
277
  elements?: ({
266
278
  locator: string;
267
- type: string;
268
279
  staticLocator: string;
280
+ type: string;
281
+ rootLocator?: string | undefined;
282
+ tenantLocator?: string | undefined;
269
283
  data?: Record<string, any> | undefined;
270
- coverageTerms?: Record<string, any> | undefined;
271
284
  parentLocator?: string | undefined;
285
+ coverageTerms?: Record<string, any> | undefined;
272
286
  originalEffectiveTime?: string | undefined;
273
- tenantLocator?: string | undefined;
274
- rootLocator?: string | undefined;
275
287
  } & /*elided*/ any)[];
276
288
  })[];
277
289
 
@@ -387,7 +399,7 @@ export declare const getDefaultAccountFormValues: ({ defaultValues, accountType,
387
399
  delinquencyPlanName: string | undefined;
388
400
  excessCreditPlanName: string | undefined;
389
401
  shortfallTolerancePlanName: string | undefined;
390
- billingLevel: "account" | "policy" | "inherit" | undefined;
402
+ billingLevel: "account" | "inherit" | "policy" | undefined;
391
403
  invoiceDocument: string | undefined;
392
404
  installmentPlanName: string | undefined;
393
405
  };
@@ -467,7 +479,7 @@ export declare const getDefaultPolicyValues: (policy: PolicyResponse, productMod
467
479
  endTime: string;
468
480
  };
469
481
  advanced: {
470
- billingLevel: "account" | "policy" | "inherit";
482
+ billingLevel: "account" | "inherit" | "policy";
471
483
  billingTrigger: "accept" | "issue";
472
484
  durationBasis: "none" | "years" | "months" | "monthsE360" | "weeks" | "days" | "hours";
473
485
  delinquencyPlanName: string | undefined;
@@ -531,10 +543,10 @@ export declare const getElementRequest: (formData: ElementFormData) => ElementRe
531
543
 
532
544
  export declare const getElementTransactionUpdateRequestFromFormData: (params: TransactionFormData) => {
533
545
  locator: string;
534
- setData?: Record<string, unknown> | undefined;
546
+ removeCoverageTerms?: Record<string, unknown> | undefined;
535
547
  removeData?: Record<string, unknown> | undefined;
536
548
  setCoverageTerms?: Record<string, unknown> | undefined;
537
- removeCoverageTerms?: Record<string, unknown> | undefined;
549
+ setData?: Record<string, unknown> | undefined;
538
550
  };
539
551
 
540
552
  export declare const getEvaluatedConstraintsRequest: ({ dependencyMap, locator, data, }: {
@@ -544,12 +556,12 @@ export declare const getEvaluatedConstraintsRequest: ({ dependencyMap, locator,
544
556
  }) => EvaluateConstraintsRequest;
545
557
 
546
558
  export declare const getModifyChangeInstructionCreateRequestFromFormData: ({ data, transactionSnapshot, staticLocator, }: TransactionFormData_2) => {
547
- action: "modify";
548
559
  staticLocator: string;
549
- setData?: Record<string, any> | undefined;
560
+ action: "modify";
561
+ removeCoverageTerms?: Record<string, any> | undefined;
550
562
  removeData?: Record<string, any> | undefined;
551
563
  setCoverageTerms?: Record<string, any> | undefined;
552
- removeCoverageTerms?: Record<string, any> | undefined;
564
+ setData?: Record<string, any> | undefined;
553
565
  };
554
566
 
555
567
  /**