@opencrvs/toolkit 1.9.13-rc.27c76a8 → 1.9.13-rc.28c6d53
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.
|
@@ -20,7 +20,6 @@ export type ValidatorContext = {
|
|
|
20
20
|
id: UUID;
|
|
21
21
|
}>;
|
|
22
22
|
event?: EventDocument;
|
|
23
|
-
baseFormState?: EventState;
|
|
24
23
|
};
|
|
25
24
|
export declare function isFieldVisible(field: FieldConfig, form: Partial<ActionUpdate | EventState>, context: ValidatorContext): boolean;
|
|
26
25
|
export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState, context: ValidatorContext): boolean;
|
|
@@ -2784,6 +2784,7 @@ declare const Paragraph: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
2784
2784
|
analytics: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
2785
2785
|
}, {
|
|
2786
2786
|
type: z.ZodLiteral<"PARAGRAPH">;
|
|
2787
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
2787
2788
|
configuration: z.ZodDefault<z.ZodObject<{
|
|
2788
2789
|
styles: z.ZodOptional<z.ZodObject<{
|
|
2789
2790
|
fontVariant: z.ZodOptional<z.ZodEnum<["reg12", "reg14", "reg16", "reg18", "h4", "h3", "h2", "h1"]>>;
|
|
@@ -2853,6 +2854,7 @@ declare const Paragraph: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
2853
2854
|
hideLabel?: boolean | undefined;
|
|
2854
2855
|
uncorrectable?: boolean | undefined;
|
|
2855
2856
|
analytics?: boolean | undefined;
|
|
2857
|
+
defaultValue?: string | undefined;
|
|
2856
2858
|
}, {
|
|
2857
2859
|
type: "PARAGRAPH";
|
|
2858
2860
|
id: string;
|
|
@@ -2914,6 +2916,7 @@ declare const Paragraph: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
2914
2916
|
hideLabel?: boolean | undefined;
|
|
2915
2917
|
uncorrectable?: boolean | undefined;
|
|
2916
2918
|
analytics?: boolean | undefined;
|
|
2919
|
+
defaultValue?: string | undefined;
|
|
2917
2920
|
configuration?: {
|
|
2918
2921
|
styles?: {
|
|
2919
2922
|
fontVariant?: "reg12" | "reg14" | "reg16" | "reg18" | "h4" | "h3" | "h2" | "h1" | undefined;
|
|
@@ -3017,6 +3020,7 @@ declare const PageHeader: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
3017
3020
|
analytics: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
3018
3021
|
}, {
|
|
3019
3022
|
type: z.ZodLiteral<"PAGE_HEADER">;
|
|
3023
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
3020
3024
|
}>, "strip", z.ZodTypeAny, {
|
|
3021
3025
|
type: "PAGE_HEADER";
|
|
3022
3026
|
id: string;
|
|
@@ -3058,6 +3062,7 @@ declare const PageHeader: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
3058
3062
|
hideLabel?: boolean | undefined;
|
|
3059
3063
|
uncorrectable?: boolean | undefined;
|
|
3060
3064
|
analytics?: boolean | undefined;
|
|
3065
|
+
defaultValue?: string | undefined;
|
|
3061
3066
|
}, {
|
|
3062
3067
|
type: "PAGE_HEADER";
|
|
3063
3068
|
id: string;
|
|
@@ -3119,6 +3124,7 @@ declare const PageHeader: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
3119
3124
|
hideLabel?: boolean | undefined;
|
|
3120
3125
|
uncorrectable?: boolean | undefined;
|
|
3121
3126
|
analytics?: boolean | undefined;
|
|
3127
|
+
defaultValue?: string | undefined;
|
|
3122
3128
|
}>;
|
|
3123
3129
|
export type PageHeader = z.infer<typeof PageHeader>;
|
|
3124
3130
|
declare const File: z.ZodObject<z.objectUtil.extendShape<{
|
|
@@ -4169,6 +4175,7 @@ declare const BulletList: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
4169
4175
|
analytics: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
4170
4176
|
}, {
|
|
4171
4177
|
type: z.ZodLiteral<"BULLET_LIST">;
|
|
4178
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
4172
4179
|
items: z.ZodArray<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
|
4173
4180
|
id: string;
|
|
4174
4181
|
description: string;
|
|
@@ -4238,6 +4245,7 @@ declare const BulletList: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
4238
4245
|
hideLabel?: boolean | undefined;
|
|
4239
4246
|
uncorrectable?: boolean | undefined;
|
|
4240
4247
|
analytics?: boolean | undefined;
|
|
4248
|
+
defaultValue?: string | undefined;
|
|
4241
4249
|
}, {
|
|
4242
4250
|
type: "BULLET_LIST";
|
|
4243
4251
|
id: string;
|
|
@@ -4304,6 +4312,7 @@ declare const BulletList: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
4304
4312
|
hideLabel?: boolean | undefined;
|
|
4305
4313
|
uncorrectable?: boolean | undefined;
|
|
4306
4314
|
analytics?: boolean | undefined;
|
|
4315
|
+
defaultValue?: string | undefined;
|
|
4307
4316
|
configuration?: {
|
|
4308
4317
|
styles?: {
|
|
4309
4318
|
fontVariant?: "reg12" | "reg14" | "reg16" | "reg18" | "h4" | "h3" | "h2" | "h1" | undefined;
|
|
@@ -94,7 +94,176 @@ export declare function findActiveDraftForEvent(event: EventDocument, draft: Dra
|
|
|
94
94
|
export declare function createEmptyDraft(eventId: UUID, draftId: UUID, actionType: Exclude<ActionType, 'DELETE'>): Draft;
|
|
95
95
|
export declare function isVerificationPage(page: PageConfig): page is VerificationPageConfig;
|
|
96
96
|
export declare function getVisibleVerificationPageIds(pages: PageConfig[], annotation: ActionUpdate, context: ValidatorContext): string[];
|
|
97
|
-
export declare function omitHiddenAnnotationFields(actionConfig: ActionConfig, declaration: EventState, annotation: ActionUpdate, context: ValidatorContext): Partial<
|
|
97
|
+
export declare function omitHiddenAnnotationFields(actionConfig: ActionConfig, declaration: EventState, annotation: ActionUpdate, context: ValidatorContext): Partial<{
|
|
98
|
+
[x: string]: string | number | boolean | {
|
|
99
|
+
type: string;
|
|
100
|
+
path: string;
|
|
101
|
+
originalFilename: string;
|
|
102
|
+
} | {
|
|
103
|
+
firstname: string;
|
|
104
|
+
surname: string;
|
|
105
|
+
middlename?: string | undefined;
|
|
106
|
+
} | {
|
|
107
|
+
firstname?: string | null | undefined;
|
|
108
|
+
surname?: string | null | undefined;
|
|
109
|
+
middlename?: string | null | undefined;
|
|
110
|
+
} | {
|
|
111
|
+
country: string;
|
|
112
|
+
addressType: "DOMESTIC";
|
|
113
|
+
administrativeArea: string;
|
|
114
|
+
streetLevelDetails?: Record<string, string> | undefined;
|
|
115
|
+
} | {
|
|
116
|
+
country: string;
|
|
117
|
+
addressType: "INTERNATIONAL";
|
|
118
|
+
streetLevelDetails?: Record<string, string> | undefined;
|
|
119
|
+
} | {
|
|
120
|
+
addressType: "DOMESTIC";
|
|
121
|
+
country?: string | null | undefined;
|
|
122
|
+
streetLevelDetails?: Record<string, string | null> | null | undefined;
|
|
123
|
+
administrativeArea?: string | null | undefined;
|
|
124
|
+
} | {
|
|
125
|
+
addressType: "INTERNATIONAL";
|
|
126
|
+
country?: string | null | undefined;
|
|
127
|
+
streetLevelDetails?: Record<string, string | null> | null | undefined;
|
|
128
|
+
} | {
|
|
129
|
+
type: string;
|
|
130
|
+
option: string;
|
|
131
|
+
path: string;
|
|
132
|
+
originalFilename: string;
|
|
133
|
+
}[] | {
|
|
134
|
+
loading: boolean;
|
|
135
|
+
data?: any;
|
|
136
|
+
error?: {
|
|
137
|
+
message: string;
|
|
138
|
+
statusCode: number;
|
|
139
|
+
} | null | undefined;
|
|
140
|
+
} | {
|
|
141
|
+
data?: any;
|
|
142
|
+
error?: {
|
|
143
|
+
message: string;
|
|
144
|
+
statusCode: number;
|
|
145
|
+
} | null | undefined;
|
|
146
|
+
loading?: boolean | null | undefined;
|
|
147
|
+
} | {
|
|
148
|
+
data: Record<string, string>;
|
|
149
|
+
} | {
|
|
150
|
+
data: Record<string, string>;
|
|
151
|
+
} | {
|
|
152
|
+
data?: any;
|
|
153
|
+
} | {
|
|
154
|
+
numericValue: number;
|
|
155
|
+
unit: string;
|
|
156
|
+
} | {
|
|
157
|
+
numericValue?: number | undefined;
|
|
158
|
+
unit?: string | undefined;
|
|
159
|
+
} | (string & import("zod").BRAND<"PlainDate">) | {
|
|
160
|
+
age: number;
|
|
161
|
+
asOfDateRef: string;
|
|
162
|
+
} | {
|
|
163
|
+
start: string & import("zod").BRAND<"PlainDate">;
|
|
164
|
+
end: string & import("zod").BRAND<"PlainDate">;
|
|
165
|
+
} | Record<string, string | number | boolean | {
|
|
166
|
+
type: string;
|
|
167
|
+
path: string;
|
|
168
|
+
originalFilename: string;
|
|
169
|
+
} | {
|
|
170
|
+
firstname: string;
|
|
171
|
+
surname: string;
|
|
172
|
+
middlename?: string | undefined;
|
|
173
|
+
} | {
|
|
174
|
+
firstname?: string | null | undefined;
|
|
175
|
+
surname?: string | null | undefined;
|
|
176
|
+
middlename?: string | null | undefined;
|
|
177
|
+
} | {
|
|
178
|
+
country: string;
|
|
179
|
+
addressType: "DOMESTIC";
|
|
180
|
+
administrativeArea: string;
|
|
181
|
+
streetLevelDetails?: Record<string, string> | undefined;
|
|
182
|
+
} | {
|
|
183
|
+
country: string;
|
|
184
|
+
addressType: "INTERNATIONAL";
|
|
185
|
+
streetLevelDetails?: Record<string, string> | undefined;
|
|
186
|
+
} | {
|
|
187
|
+
type: string;
|
|
188
|
+
option: string;
|
|
189
|
+
path: string;
|
|
190
|
+
originalFilename: string;
|
|
191
|
+
}[] | {
|
|
192
|
+
loading: boolean;
|
|
193
|
+
data?: any;
|
|
194
|
+
error?: {
|
|
195
|
+
message: string;
|
|
196
|
+
statusCode: number;
|
|
197
|
+
} | null | undefined;
|
|
198
|
+
} | {
|
|
199
|
+
data: Record<string, string>;
|
|
200
|
+
} | {
|
|
201
|
+
data?: any;
|
|
202
|
+
} | {
|
|
203
|
+
numericValue: number;
|
|
204
|
+
unit: string;
|
|
205
|
+
} | {
|
|
206
|
+
numericValue?: number | undefined;
|
|
207
|
+
unit?: string | undefined;
|
|
208
|
+
} | (string & import("zod").BRAND<"PlainDate">) | {
|
|
209
|
+
age: number;
|
|
210
|
+
asOfDateRef: string;
|
|
211
|
+
} | {
|
|
212
|
+
start: string & import("zod").BRAND<"PlainDate">;
|
|
213
|
+
end: string & import("zod").BRAND<"PlainDate">;
|
|
214
|
+
} | null | undefined> | {
|
|
215
|
+
data: Record<string, string | number | boolean | {
|
|
216
|
+
type: string;
|
|
217
|
+
path: string;
|
|
218
|
+
originalFilename: string;
|
|
219
|
+
} | {
|
|
220
|
+
firstname: string;
|
|
221
|
+
surname: string;
|
|
222
|
+
middlename?: string | undefined;
|
|
223
|
+
} | {
|
|
224
|
+
firstname?: string | null | undefined;
|
|
225
|
+
surname?: string | null | undefined;
|
|
226
|
+
middlename?: string | null | undefined;
|
|
227
|
+
} | {
|
|
228
|
+
country: string;
|
|
229
|
+
addressType: "DOMESTIC";
|
|
230
|
+
administrativeArea: string;
|
|
231
|
+
streetLevelDetails?: Record<string, string> | undefined;
|
|
232
|
+
} | {
|
|
233
|
+
country: string;
|
|
234
|
+
addressType: "INTERNATIONAL";
|
|
235
|
+
streetLevelDetails?: Record<string, string> | undefined;
|
|
236
|
+
} | {
|
|
237
|
+
type: string;
|
|
238
|
+
option: string;
|
|
239
|
+
path: string;
|
|
240
|
+
originalFilename: string;
|
|
241
|
+
}[] | {
|
|
242
|
+
loading: boolean;
|
|
243
|
+
data?: any;
|
|
244
|
+
error?: {
|
|
245
|
+
message: string;
|
|
246
|
+
statusCode: number;
|
|
247
|
+
} | null | undefined;
|
|
248
|
+
} | {
|
|
249
|
+
data: Record<string, string>;
|
|
250
|
+
} | {
|
|
251
|
+
data?: any;
|
|
252
|
+
} | {
|
|
253
|
+
numericValue: number;
|
|
254
|
+
unit: string;
|
|
255
|
+
} | {
|
|
256
|
+
numericValue?: number | undefined;
|
|
257
|
+
unit?: string | undefined;
|
|
258
|
+
} | (string & import("zod").BRAND<"PlainDate">) | {
|
|
259
|
+
age: number;
|
|
260
|
+
asOfDateRef: string;
|
|
261
|
+
} | {
|
|
262
|
+
start: string & import("zod").BRAND<"PlainDate">;
|
|
263
|
+
end: string & import("zod").BRAND<"PlainDate">;
|
|
264
|
+
} | null | undefined>;
|
|
265
|
+
} | null | undefined;
|
|
266
|
+
}>;
|
|
98
267
|
/**
|
|
99
268
|
* Merges two documents together.
|
|
100
269
|
*
|
package/dist/events/index.js
CHANGED
|
@@ -2154,10 +2154,12 @@ var ParagraphConfiguration = import_zod17.z.object({
|
|
|
2154
2154
|
}).default({});
|
|
2155
2155
|
var Paragraph = BaseField.extend({
|
|
2156
2156
|
type: import_zod17.z.literal(FieldType.PARAGRAPH),
|
|
2157
|
+
defaultValue: NonEmptyTextValue.optional(),
|
|
2157
2158
|
configuration: ParagraphConfiguration
|
|
2158
2159
|
}).describe("A read-only HTML <p> paragraph");
|
|
2159
2160
|
var PageHeader = BaseField.extend({
|
|
2160
|
-
type: import_zod17.z.literal(FieldType.PAGE_HEADER)
|
|
2161
|
+
type: import_zod17.z.literal(FieldType.PAGE_HEADER),
|
|
2162
|
+
defaultValue: NonEmptyTextValue.optional()
|
|
2161
2163
|
}).describe("A read-only header component for form pages");
|
|
2162
2164
|
var File = BaseField.extend({
|
|
2163
2165
|
type: import_zod17.z.literal(FieldType.FILE),
|
|
@@ -2207,6 +2209,7 @@ var RadioGroup = BaseField.extend({
|
|
|
2207
2209
|
}).describe("Grouped radio options");
|
|
2208
2210
|
var BulletList = BaseField.extend({
|
|
2209
2211
|
type: import_zod17.z.literal(FieldType.BULLET_LIST),
|
|
2212
|
+
defaultValue: TextValue.optional(),
|
|
2210
2213
|
items: import_zod17.z.array(TranslationConfig).describe("A list of items"),
|
|
2211
2214
|
configuration: import_zod17.z.object({
|
|
2212
2215
|
styles: import_zod17.z.object({
|
|
@@ -3416,9 +3419,6 @@ ajv.addKeyword({
|
|
|
3416
3419
|
return locations.some((location) => location.id === locationIdInput);
|
|
3417
3420
|
}
|
|
3418
3421
|
});
|
|
3419
|
-
function mergeWithBaseFormState(values, context) {
|
|
3420
|
-
return { ...context.baseFormState, ...values };
|
|
3421
|
-
}
|
|
3422
3422
|
function validate(schema, data) {
|
|
3423
3423
|
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
3424
3424
|
if ("$form" in data) {
|
|
@@ -3461,7 +3461,7 @@ function isOnline() {
|
|
|
3461
3461
|
}
|
|
3462
3462
|
function isConditionMet(conditional, values, context) {
|
|
3463
3463
|
return validate(conditional, {
|
|
3464
|
-
$form:
|
|
3464
|
+
$form: values,
|
|
3465
3465
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3466
3466
|
$online: isOnline(),
|
|
3467
3467
|
$user: context.user,
|
|
@@ -3488,7 +3488,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
|
3488
3488
|
return true;
|
|
3489
3489
|
}
|
|
3490
3490
|
const validConditionals = getConditionalActionsForField(field3, {
|
|
3491
|
-
$form:
|
|
3491
|
+
$form: form,
|
|
3492
3492
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3493
3493
|
$online: isOnline(),
|
|
3494
3494
|
$user: context.user,
|
|
@@ -3641,7 +3641,7 @@ function runFieldValidations({
|
|
|
3641
3641
|
return [];
|
|
3642
3642
|
}
|
|
3643
3643
|
const conditionalParameters = {
|
|
3644
|
-
$form:
|
|
3644
|
+
$form: form,
|
|
3645
3645
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3646
3646
|
/**
|
|
3647
3647
|
* In real use cases, there can be hundreds of thousands of locations.
|
|
@@ -3873,7 +3873,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
|
|
|
3873
3873
|
const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
3874
3874
|
const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
3875
3875
|
const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
|
|
3876
|
-
return hiddenFields.some((f) => f.id === fieldId)
|
|
3876
|
+
return hiddenFields.some((f) => f.id === fieldId);
|
|
3877
3877
|
});
|
|
3878
3878
|
return omitHiddenFields(
|
|
3879
3879
|
visibleFields,
|
|
@@ -3920,10 +3920,11 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
|
|
|
3920
3920
|
}
|
|
3921
3921
|
function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
|
|
3922
3922
|
const annotationFields = getActionAnnotationFields(actionConfig);
|
|
3923
|
-
return omitHiddenFields(
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3923
|
+
return omitHiddenFields(
|
|
3924
|
+
annotationFields,
|
|
3925
|
+
{ ...declaration, ...annotation },
|
|
3926
|
+
context
|
|
3927
|
+
);
|
|
3927
3928
|
}
|
|
3928
3929
|
function deepMerge(currentDocument, actionDocument) {
|
|
3929
3930
|
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
|
@@ -1660,10 +1660,12 @@ var ParagraphConfiguration = import_zod17.z.object({
|
|
|
1660
1660
|
}).default({});
|
|
1661
1661
|
var Paragraph = BaseField.extend({
|
|
1662
1662
|
type: import_zod17.z.literal(FieldType.PARAGRAPH),
|
|
1663
|
+
defaultValue: NonEmptyTextValue.optional(),
|
|
1663
1664
|
configuration: ParagraphConfiguration
|
|
1664
1665
|
}).describe("A read-only HTML <p> paragraph");
|
|
1665
1666
|
var PageHeader = BaseField.extend({
|
|
1666
|
-
type: import_zod17.z.literal(FieldType.PAGE_HEADER)
|
|
1667
|
+
type: import_zod17.z.literal(FieldType.PAGE_HEADER),
|
|
1668
|
+
defaultValue: NonEmptyTextValue.optional()
|
|
1667
1669
|
}).describe("A read-only header component for form pages");
|
|
1668
1670
|
var File = BaseField.extend({
|
|
1669
1671
|
type: import_zod17.z.literal(FieldType.FILE),
|
|
@@ -1713,6 +1715,7 @@ var RadioGroup = BaseField.extend({
|
|
|
1713
1715
|
}).describe("Grouped radio options");
|
|
1714
1716
|
var BulletList = BaseField.extend({
|
|
1715
1717
|
type: import_zod17.z.literal(FieldType.BULLET_LIST),
|
|
1718
|
+
defaultValue: TextValue.optional(),
|
|
1716
1719
|
items: import_zod17.z.array(TranslationConfig).describe("A list of items"),
|
|
1717
1720
|
configuration: import_zod17.z.object({
|
|
1718
1721
|
styles: import_zod17.z.object({
|