@opencrvs/toolkit 1.8.0-rc.f8f3eb3 → 1.8.0-rc.faeb298
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/commons/api/router.d.ts +242 -36
- package/dist/commons/events/ActionConfig.d.ts +1597 -387
- package/dist/commons/events/ActionInput.d.ts +0 -84
- package/dist/commons/events/Draft.d.ts +0 -3
- package/dist/commons/events/EventConfig.d.ts +1448 -96
- package/dist/commons/events/EventConfigInput.d.ts +2 -2
- package/dist/commons/events/FieldConfig.d.ts +175 -2
- package/dist/commons/events/FieldType.d.ts +6 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +21 -1
- package/dist/commons/events/FormConfig.d.ts +278 -26
- package/dist/commons/events/TemplateConfig.d.ts +38 -0
- package/dist/commons/events/defineConfig.d.ts +242 -24
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/utils.d.ts +60 -6
- package/dist/events/index.js +101 -10
- package/package.json +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
import { z } from 'zod';
|
2
2
|
import { EventConfig } from './EventConfig';
|
3
|
-
import { FormConfig, FormConfigInput,
|
3
|
+
import { FormConfig, FormConfigInput, Page, PageInput } from './FormConfig';
|
4
4
|
export type EventConfigInput = z.input<typeof EventConfig>;
|
5
5
|
export declare const defineForm: (form: FormConfigInput) => FormConfig;
|
6
|
-
export declare const
|
6
|
+
export declare const definePage: (formPage: PageInput) => Page;
|
7
7
|
//# sourceMappingURL=EventConfigInput.d.ts.map
|
@@ -3189,10 +3189,183 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3189
3189
|
} | undefined;
|
3190
3190
|
hideLabel?: boolean | undefined;
|
3191
3191
|
}>;
|
3192
|
+
declare const Data: z.ZodObject<z.objectUtil.extendShape<{
|
3193
|
+
id: z.ZodString;
|
3194
|
+
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodString, z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodObject<{
|
3195
|
+
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
3196
|
+
expression: z.ZodString;
|
3197
|
+
}, "strip", z.ZodTypeAny, {
|
3198
|
+
dependsOn: string[];
|
3199
|
+
expression: string;
|
3200
|
+
}, {
|
3201
|
+
expression: string;
|
3202
|
+
dependsOn?: string[] | undefined;
|
3203
|
+
}>]>>;
|
3204
|
+
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", import("./Conditional").AllActionConditionalFields[]>, "many">>>;
|
3205
|
+
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
3206
|
+
disabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
3207
|
+
hidden: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
3208
|
+
placeholder: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
3209
|
+
id: string;
|
3210
|
+
description: string;
|
3211
|
+
defaultMessage: string;
|
3212
|
+
}>>;
|
3213
|
+
validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
3214
|
+
validator: z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>;
|
3215
|
+
message: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
3216
|
+
id: string;
|
3217
|
+
description: string;
|
3218
|
+
defaultMessage: string;
|
3219
|
+
}>;
|
3220
|
+
}, "strip", z.ZodTypeAny, {
|
3221
|
+
message: TranslationConfig;
|
3222
|
+
validator: import(".").JSONSchema;
|
3223
|
+
}, {
|
3224
|
+
message: {
|
3225
|
+
id: string;
|
3226
|
+
description: string;
|
3227
|
+
defaultMessage: string;
|
3228
|
+
};
|
3229
|
+
validator: import(".").JSONSchema;
|
3230
|
+
}>, "many">>>;
|
3231
|
+
dependsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
3232
|
+
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
3233
|
+
id: string;
|
3234
|
+
description: string;
|
3235
|
+
defaultMessage: string;
|
3236
|
+
}>;
|
3237
|
+
hideLabel: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
3238
|
+
}, {
|
3239
|
+
type: z.ZodLiteral<"DATA">;
|
3240
|
+
configuration: z.ZodObject<{
|
3241
|
+
title: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
3242
|
+
id: string;
|
3243
|
+
description: string;
|
3244
|
+
defaultMessage: string;
|
3245
|
+
}>>;
|
3246
|
+
subtitle: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
3247
|
+
id: string;
|
3248
|
+
description: string;
|
3249
|
+
defaultMessage: string;
|
3250
|
+
}>>;
|
3251
|
+
data: z.ZodArray<z.ZodObject<{
|
3252
|
+
fieldId: z.ZodString;
|
3253
|
+
}, "strip", z.ZodTypeAny, {
|
3254
|
+
fieldId: string;
|
3255
|
+
}, {
|
3256
|
+
fieldId: string;
|
3257
|
+
}>, "many">;
|
3258
|
+
}, "strip", z.ZodTypeAny, {
|
3259
|
+
data: {
|
3260
|
+
fieldId: string;
|
3261
|
+
}[];
|
3262
|
+
title?: TranslationConfig | undefined;
|
3263
|
+
subtitle?: TranslationConfig | undefined;
|
3264
|
+
}, {
|
3265
|
+
data: {
|
3266
|
+
fieldId: string;
|
3267
|
+
}[];
|
3268
|
+
title?: {
|
3269
|
+
id: string;
|
3270
|
+
description: string;
|
3271
|
+
defaultMessage: string;
|
3272
|
+
} | undefined;
|
3273
|
+
subtitle?: {
|
3274
|
+
id: string;
|
3275
|
+
description: string;
|
3276
|
+
defaultMessage: string;
|
3277
|
+
} | undefined;
|
3278
|
+
}>;
|
3279
|
+
}>, "strip", z.ZodTypeAny, {
|
3280
|
+
type: "DATA";
|
3281
|
+
id: string;
|
3282
|
+
label: TranslationConfig;
|
3283
|
+
configuration: {
|
3284
|
+
data: {
|
3285
|
+
fieldId: string;
|
3286
|
+
}[];
|
3287
|
+
title?: TranslationConfig | undefined;
|
3288
|
+
subtitle?: TranslationConfig | undefined;
|
3289
|
+
};
|
3290
|
+
validation?: {
|
3291
|
+
message: TranslationConfig;
|
3292
|
+
validator: import(".").JSONSchema;
|
3293
|
+
}[] | undefined;
|
3294
|
+
required?: boolean | undefined;
|
3295
|
+
dependsOn?: string[] | undefined;
|
3296
|
+
defaultValue?: string | number | boolean | {
|
3297
|
+
dependsOn: string[];
|
3298
|
+
expression: string;
|
3299
|
+
} | undefined;
|
3300
|
+
conditionals?: ({
|
3301
|
+
type: "SHOW";
|
3302
|
+
conditional: import(".").JSONSchema;
|
3303
|
+
} | {
|
3304
|
+
type: "ENABLE";
|
3305
|
+
conditional: import(".").JSONSchema;
|
3306
|
+
})[] | undefined;
|
3307
|
+
disabled?: boolean | undefined;
|
3308
|
+
hidden?: boolean | undefined;
|
3309
|
+
placeholder?: TranslationConfig | undefined;
|
3310
|
+
hideLabel?: boolean | undefined;
|
3311
|
+
}, {
|
3312
|
+
type: "DATA";
|
3313
|
+
id: string;
|
3314
|
+
label: {
|
3315
|
+
id: string;
|
3316
|
+
description: string;
|
3317
|
+
defaultMessage: string;
|
3318
|
+
};
|
3319
|
+
configuration: {
|
3320
|
+
data: {
|
3321
|
+
fieldId: string;
|
3322
|
+
}[];
|
3323
|
+
title?: {
|
3324
|
+
id: string;
|
3325
|
+
description: string;
|
3326
|
+
defaultMessage: string;
|
3327
|
+
} | undefined;
|
3328
|
+
subtitle?: {
|
3329
|
+
id: string;
|
3330
|
+
description: string;
|
3331
|
+
defaultMessage: string;
|
3332
|
+
} | undefined;
|
3333
|
+
};
|
3334
|
+
validation?: {
|
3335
|
+
message: {
|
3336
|
+
id: string;
|
3337
|
+
description: string;
|
3338
|
+
defaultMessage: string;
|
3339
|
+
};
|
3340
|
+
validator: import(".").JSONSchema;
|
3341
|
+
}[] | undefined;
|
3342
|
+
required?: boolean | undefined;
|
3343
|
+
dependsOn?: string[] | undefined;
|
3344
|
+
defaultValue?: string | number | boolean | {
|
3345
|
+
expression: string;
|
3346
|
+
dependsOn?: string[] | undefined;
|
3347
|
+
} | undefined;
|
3348
|
+
conditionals?: ({
|
3349
|
+
type: "SHOW";
|
3350
|
+
conditional: import(".").JSONSchema;
|
3351
|
+
} | {
|
3352
|
+
type: "ENABLE";
|
3353
|
+
conditional: import(".").JSONSchema;
|
3354
|
+
})[] | undefined;
|
3355
|
+
disabled?: boolean | undefined;
|
3356
|
+
hidden?: boolean | undefined;
|
3357
|
+
placeholder?: {
|
3358
|
+
id: string;
|
3359
|
+
description: string;
|
3360
|
+
defaultMessage: string;
|
3361
|
+
} | undefined;
|
3362
|
+
hideLabel?: boolean | undefined;
|
3363
|
+
}>;
|
3364
|
+
export type Data = z.infer<typeof Data>;
|
3192
3365
|
/** @knipignore */
|
3193
|
-
export type AllFields = typeof Address | typeof TextField | typeof NumberField | typeof TextAreaField | typeof DateField | typeof Paragraph | typeof RadioGroup | typeof BulletList | typeof PageHeader | typeof Select | typeof Checkbox | typeof File | typeof Country | typeof AdministrativeArea | typeof Divider | typeof Location | typeof Facility | typeof Office | typeof SignatureField | typeof EmailField | typeof FileUploadWithOptions;
|
3366
|
+
export type AllFields = typeof Address | typeof TextField | typeof NumberField | typeof TextAreaField | typeof DateField | typeof Paragraph | typeof RadioGroup | typeof BulletList | typeof PageHeader | typeof Select | typeof Checkbox | typeof File | typeof Country | typeof AdministrativeArea | typeof Divider | typeof Location | typeof Facility | typeof Office | typeof SignatureField | typeof EmailField | typeof FileUploadWithOptions | typeof Data;
|
3194
3367
|
/** @knipignore */
|
3195
|
-
export type Inferred = z.infer<typeof Address> | z.infer<typeof TextField> | z.infer<typeof NumberField> | z.infer<typeof TextAreaField> | z.infer<typeof DateField> | z.infer<typeof Paragraph> | z.infer<typeof RadioGroup> | z.infer<typeof BulletList> | z.infer<typeof PageHeader> | z.infer<typeof Select> | z.infer<typeof Checkbox> | z.infer<typeof File> | z.infer<typeof FileUploadWithOptions> | z.infer<typeof Country> | z.infer<typeof AdministrativeArea> | z.infer<typeof Divider> | z.infer<typeof Location> | z.infer<typeof Facility> | z.infer<typeof Office> | z.infer<typeof SignatureField> | z.infer<typeof EmailField>;
|
3368
|
+
export type Inferred = z.infer<typeof Address> | z.infer<typeof TextField> | z.infer<typeof NumberField> | z.infer<typeof TextAreaField> | z.infer<typeof DateField> | z.infer<typeof Paragraph> | z.infer<typeof RadioGroup> | z.infer<typeof BulletList> | z.infer<typeof PageHeader> | z.infer<typeof Select> | z.infer<typeof Checkbox> | z.infer<typeof File> | z.infer<typeof FileUploadWithOptions> | z.infer<typeof Country> | z.infer<typeof AdministrativeArea> | z.infer<typeof Divider> | z.infer<typeof Location> | z.infer<typeof Facility> | z.infer<typeof Office> | z.infer<typeof SignatureField> | z.infer<typeof EmailField> | z.infer<typeof Data>;
|
3196
3369
|
export declare const FieldConfig: z.ZodType<Inferred, any, Inferred>;
|
3197
3370
|
export type SelectField = z.infer<typeof Select>;
|
3198
3371
|
export type LocationField = z.infer<typeof Location>;
|
@@ -21,7 +21,12 @@ export declare const FieldType: {
|
|
21
21
|
readonly FACILITY: "FACILITY";
|
22
22
|
readonly OFFICE: "OFFICE";
|
23
23
|
readonly SIGNATURE: "SIGNATURE";
|
24
|
+
readonly DATA: "DATA";
|
24
25
|
};
|
25
|
-
export declare const fieldTypes: ("ADDRESS" | "TEXT" | "NUMBER" | "TEXTAREA" | "EMAIL" | "DATE" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "HIDDEN" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE")[];
|
26
|
+
export declare const fieldTypes: ("ADDRESS" | "TEXT" | "NUMBER" | "TEXTAREA" | "EMAIL" | "DATE" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "HIDDEN" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA")[];
|
26
27
|
export type FieldType = (typeof fieldTypes)[number];
|
28
|
+
/**
|
29
|
+
* Composite field types are field types that consist of multiple field values.
|
30
|
+
*/
|
31
|
+
export declare const compositeFieldTypes: ("ADDRESS" | "FILE" | "FILE_WITH_OPTIONS")[];
|
27
32
|
//# sourceMappingURL=FieldType.d.ts.map
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { z } from 'zod';
|
2
|
-
import { AddressField, AdministrativeArea, BulletList, Checkbox, Country, DateField, Divider, Facility, EmailField, FieldConfig, File, FileUploadWithOptions, Location, Office, PageHeader, Paragraph, RadioGroup, SelectField, SignatureField, TextAreaField, TextField, NumberField } from './FieldConfig';
|
2
|
+
import { AddressField, AdministrativeArea, BulletList, Checkbox, Country, DateField, Divider, Facility, EmailField, FieldConfig, File, FileUploadWithOptions, Location, Office, PageHeader, Paragraph, RadioGroup, SelectField, SignatureField, TextAreaField, TextField, NumberField, Data } from './FieldConfig';
|
3
3
|
import { FieldType } from './FieldType';
|
4
4
|
import { FieldValue, FieldUpdateValueSchema } from './FieldValue';
|
5
5
|
import { AddressFieldValue, FileFieldValue, FileFieldWithOptionValue } from './CompositeFieldValue';
|
@@ -257,6 +257,19 @@ export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number):
|
|
257
257
|
street?: undefined;
|
258
258
|
number?: undefined;
|
259
259
|
zipCode?: undefined;
|
260
|
+
} | {
|
261
|
+
country?: undefined;
|
262
|
+
province?: undefined;
|
263
|
+
district?: undefined;
|
264
|
+
urbanOrRural?: undefined;
|
265
|
+
town?: undefined;
|
266
|
+
residentialArea?: undefined;
|
267
|
+
street?: undefined;
|
268
|
+
number?: undefined;
|
269
|
+
zipCode?: undefined;
|
270
|
+
filename?: undefined;
|
271
|
+
originalFilename?: undefined;
|
272
|
+
type?: undefined;
|
260
273
|
} | null;
|
261
274
|
export declare const isParagraphFieldType: (field: {
|
262
275
|
config: FieldConfig;
|
@@ -405,5 +418,12 @@ export declare const isOfficeFieldType: (field: {
|
|
405
418
|
value: string;
|
406
419
|
config: Office;
|
407
420
|
};
|
421
|
+
export declare const isDataFieldType: (field: {
|
422
|
+
config: FieldConfig;
|
423
|
+
value: FieldValue;
|
424
|
+
}) => field is {
|
425
|
+
value: any;
|
426
|
+
config: Data;
|
427
|
+
};
|
408
428
|
export {};
|
409
429
|
//# sourceMappingURL=FieldTypeMapping.d.ts.map
|
@@ -1,6 +1,10 @@
|
|
1
1
|
import { z } from 'zod';
|
2
2
|
import { TranslationConfig } from './TranslationConfig';
|
3
|
-
export declare
|
3
|
+
export declare enum PageType {
|
4
|
+
FORM = "FORM",
|
5
|
+
VERIFICATION = "VERIFICATION"
|
6
|
+
}
|
7
|
+
export declare const PageBase: z.ZodObject<{
|
4
8
|
id: z.ZodString;
|
5
9
|
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
6
10
|
id: string;
|
@@ -8,7 +12,9 @@ export declare const FormPage: z.ZodObject<{
|
|
8
12
|
defaultMessage: string;
|
9
13
|
}>;
|
10
14
|
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").Inferred>, "many">;
|
15
|
+
type: z.ZodDefault<z.ZodEnum<["FORM", "VERIFICATION"]>>;
|
11
16
|
}, "strip", z.ZodTypeAny, {
|
17
|
+
type: "FORM" | "VERIFICATION";
|
12
18
|
id: string;
|
13
19
|
title: TranslationConfig;
|
14
20
|
fields: import("./FieldConfig").Inferred[];
|
@@ -20,7 +26,216 @@ export declare const FormPage: z.ZodObject<{
|
|
20
26
|
defaultMessage: string;
|
21
27
|
};
|
22
28
|
fields: import("./FieldConfig").Inferred[];
|
29
|
+
type?: "FORM" | "VERIFICATION" | undefined;
|
23
30
|
}>;
|
31
|
+
export declare const FormPage: z.ZodObject<z.objectUtil.extendShape<{
|
32
|
+
id: z.ZodString;
|
33
|
+
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
34
|
+
id: string;
|
35
|
+
description: string;
|
36
|
+
defaultMessage: string;
|
37
|
+
}>;
|
38
|
+
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").Inferred>, "many">;
|
39
|
+
type: z.ZodDefault<z.ZodEnum<["FORM", "VERIFICATION"]>>;
|
40
|
+
}, {
|
41
|
+
type: z.ZodOptional<z.ZodLiteral<"FORM">>;
|
42
|
+
}>, "strip", z.ZodTypeAny, {
|
43
|
+
id: string;
|
44
|
+
title: TranslationConfig;
|
45
|
+
fields: import("./FieldConfig").Inferred[];
|
46
|
+
type?: "FORM" | undefined;
|
47
|
+
}, {
|
48
|
+
id: string;
|
49
|
+
title: {
|
50
|
+
id: string;
|
51
|
+
description: string;
|
52
|
+
defaultMessage: string;
|
53
|
+
};
|
54
|
+
fields: import("./FieldConfig").Inferred[];
|
55
|
+
type?: "FORM" | undefined;
|
56
|
+
}>;
|
57
|
+
export declare const VerificationPage: z.ZodObject<z.objectUtil.extendShape<{
|
58
|
+
id: z.ZodString;
|
59
|
+
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
60
|
+
id: string;
|
61
|
+
description: string;
|
62
|
+
defaultMessage: string;
|
63
|
+
}>;
|
64
|
+
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").Inferred>, "many">;
|
65
|
+
type: z.ZodDefault<z.ZodEnum<["FORM", "VERIFICATION"]>>;
|
66
|
+
}, {
|
67
|
+
type: z.ZodLiteral<"VERIFICATION">;
|
68
|
+
actions: z.ZodObject<{
|
69
|
+
verify: z.ZodObject<{
|
70
|
+
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
71
|
+
id: string;
|
72
|
+
description: string;
|
73
|
+
defaultMessage: string;
|
74
|
+
}>;
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
76
|
+
label: TranslationConfig;
|
77
|
+
}, {
|
78
|
+
label: {
|
79
|
+
id: string;
|
80
|
+
description: string;
|
81
|
+
defaultMessage: string;
|
82
|
+
};
|
83
|
+
}>;
|
84
|
+
cancel: z.ZodObject<{
|
85
|
+
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
86
|
+
id: string;
|
87
|
+
description: string;
|
88
|
+
defaultMessage: string;
|
89
|
+
}>;
|
90
|
+
confirmation: z.ZodObject<{
|
91
|
+
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
92
|
+
id: string;
|
93
|
+
description: string;
|
94
|
+
defaultMessage: string;
|
95
|
+
}>;
|
96
|
+
body: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
97
|
+
id: string;
|
98
|
+
description: string;
|
99
|
+
defaultMessage: string;
|
100
|
+
}>;
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
102
|
+
title: TranslationConfig;
|
103
|
+
body: TranslationConfig;
|
104
|
+
}, {
|
105
|
+
title: {
|
106
|
+
id: string;
|
107
|
+
description: string;
|
108
|
+
defaultMessage: string;
|
109
|
+
};
|
110
|
+
body: {
|
111
|
+
id: string;
|
112
|
+
description: string;
|
113
|
+
defaultMessage: string;
|
114
|
+
};
|
115
|
+
}>;
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
117
|
+
label: TranslationConfig;
|
118
|
+
confirmation: {
|
119
|
+
title: TranslationConfig;
|
120
|
+
body: TranslationConfig;
|
121
|
+
};
|
122
|
+
}, {
|
123
|
+
label: {
|
124
|
+
id: string;
|
125
|
+
description: string;
|
126
|
+
defaultMessage: string;
|
127
|
+
};
|
128
|
+
confirmation: {
|
129
|
+
title: {
|
130
|
+
id: string;
|
131
|
+
description: string;
|
132
|
+
defaultMessage: string;
|
133
|
+
};
|
134
|
+
body: {
|
135
|
+
id: string;
|
136
|
+
description: string;
|
137
|
+
defaultMessage: string;
|
138
|
+
};
|
139
|
+
};
|
140
|
+
}>;
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
142
|
+
verify: {
|
143
|
+
label: TranslationConfig;
|
144
|
+
};
|
145
|
+
cancel: {
|
146
|
+
label: TranslationConfig;
|
147
|
+
confirmation: {
|
148
|
+
title: TranslationConfig;
|
149
|
+
body: TranslationConfig;
|
150
|
+
};
|
151
|
+
};
|
152
|
+
}, {
|
153
|
+
verify: {
|
154
|
+
label: {
|
155
|
+
id: string;
|
156
|
+
description: string;
|
157
|
+
defaultMessage: string;
|
158
|
+
};
|
159
|
+
};
|
160
|
+
cancel: {
|
161
|
+
label: {
|
162
|
+
id: string;
|
163
|
+
description: string;
|
164
|
+
defaultMessage: string;
|
165
|
+
};
|
166
|
+
confirmation: {
|
167
|
+
title: {
|
168
|
+
id: string;
|
169
|
+
description: string;
|
170
|
+
defaultMessage: string;
|
171
|
+
};
|
172
|
+
body: {
|
173
|
+
id: string;
|
174
|
+
description: string;
|
175
|
+
defaultMessage: string;
|
176
|
+
};
|
177
|
+
};
|
178
|
+
};
|
179
|
+
}>;
|
180
|
+
}>, "strip", z.ZodTypeAny, {
|
181
|
+
type: "VERIFICATION";
|
182
|
+
id: string;
|
183
|
+
title: TranslationConfig;
|
184
|
+
actions: {
|
185
|
+
verify: {
|
186
|
+
label: TranslationConfig;
|
187
|
+
};
|
188
|
+
cancel: {
|
189
|
+
label: TranslationConfig;
|
190
|
+
confirmation: {
|
191
|
+
title: TranslationConfig;
|
192
|
+
body: TranslationConfig;
|
193
|
+
};
|
194
|
+
};
|
195
|
+
};
|
196
|
+
fields: import("./FieldConfig").Inferred[];
|
197
|
+
}, {
|
198
|
+
type: "VERIFICATION";
|
199
|
+
id: string;
|
200
|
+
title: {
|
201
|
+
id: string;
|
202
|
+
description: string;
|
203
|
+
defaultMessage: string;
|
204
|
+
};
|
205
|
+
actions: {
|
206
|
+
verify: {
|
207
|
+
label: {
|
208
|
+
id: string;
|
209
|
+
description: string;
|
210
|
+
defaultMessage: string;
|
211
|
+
};
|
212
|
+
};
|
213
|
+
cancel: {
|
214
|
+
label: {
|
215
|
+
id: string;
|
216
|
+
description: string;
|
217
|
+
defaultMessage: string;
|
218
|
+
};
|
219
|
+
confirmation: {
|
220
|
+
title: {
|
221
|
+
id: string;
|
222
|
+
description: string;
|
223
|
+
defaultMessage: string;
|
224
|
+
};
|
225
|
+
body: {
|
226
|
+
id: string;
|
227
|
+
description: string;
|
228
|
+
defaultMessage: string;
|
229
|
+
};
|
230
|
+
};
|
231
|
+
};
|
232
|
+
};
|
233
|
+
fields: import("./FieldConfig").Inferred[];
|
234
|
+
}>;
|
235
|
+
export type AllPageConfigs = typeof FormPage | typeof VerificationPage;
|
236
|
+
export declare const PageConfig: z.ZodDiscriminatedUnion<"type", AllPageConfigs[]>;
|
237
|
+
export type PageInput = z.input<typeof PageConfig>;
|
238
|
+
export type Page = z.infer<typeof PageConfig>;
|
24
239
|
export declare const FormConfig: z.ZodObject<{
|
25
240
|
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
26
241
|
id: string;
|
@@ -46,27 +261,7 @@ export declare const FormConfig: z.ZodObject<{
|
|
46
261
|
};
|
47
262
|
}>;
|
48
263
|
active: z.ZodDefault<z.ZodBoolean>;
|
49
|
-
pages: z.ZodArray<z.
|
50
|
-
id: z.ZodString;
|
51
|
-
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
52
|
-
id: string;
|
53
|
-
description: string;
|
54
|
-
defaultMessage: string;
|
55
|
-
}>;
|
56
|
-
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").Inferred>, "many">;
|
57
|
-
}, "strip", z.ZodTypeAny, {
|
58
|
-
id: string;
|
59
|
-
title: TranslationConfig;
|
60
|
-
fields: import("./FieldConfig").Inferred[];
|
61
|
-
}, {
|
62
|
-
id: string;
|
63
|
-
title: {
|
64
|
-
id: string;
|
65
|
-
description: string;
|
66
|
-
defaultMessage: string;
|
67
|
-
};
|
68
|
-
fields: import("./FieldConfig").Inferred[];
|
69
|
-
}>, "many">;
|
264
|
+
pages: z.ZodArray<z.ZodDiscriminatedUnion<"type", AllPageConfigs[]>, "many">;
|
70
265
|
review: z.ZodObject<{
|
71
266
|
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
72
267
|
id: string;
|
@@ -92,11 +287,29 @@ export declare const FormConfig: z.ZodObject<{
|
|
92
287
|
label: TranslationConfig;
|
93
288
|
};
|
94
289
|
label: TranslationConfig;
|
95
|
-
pages: {
|
290
|
+
pages: ({
|
96
291
|
id: string;
|
97
292
|
title: TranslationConfig;
|
98
293
|
fields: import("./FieldConfig").Inferred[];
|
99
|
-
|
294
|
+
type?: "FORM" | undefined;
|
295
|
+
} | {
|
296
|
+
type: "VERIFICATION";
|
297
|
+
id: string;
|
298
|
+
title: TranslationConfig;
|
299
|
+
actions: {
|
300
|
+
verify: {
|
301
|
+
label: TranslationConfig;
|
302
|
+
};
|
303
|
+
cancel: {
|
304
|
+
label: TranslationConfig;
|
305
|
+
confirmation: {
|
306
|
+
title: TranslationConfig;
|
307
|
+
body: TranslationConfig;
|
308
|
+
};
|
309
|
+
};
|
310
|
+
};
|
311
|
+
fields: import("./FieldConfig").Inferred[];
|
312
|
+
})[];
|
100
313
|
review: {
|
101
314
|
title: TranslationConfig;
|
102
315
|
fields: import("./FieldConfig").Inferred[];
|
@@ -115,15 +328,53 @@ export declare const FormConfig: z.ZodObject<{
|
|
115
328
|
description: string;
|
116
329
|
defaultMessage: string;
|
117
330
|
};
|
118
|
-
pages: {
|
331
|
+
pages: ({
|
332
|
+
id: string;
|
333
|
+
title: {
|
334
|
+
id: string;
|
335
|
+
description: string;
|
336
|
+
defaultMessage: string;
|
337
|
+
};
|
338
|
+
fields: import("./FieldConfig").Inferred[];
|
339
|
+
type?: "FORM" | undefined;
|
340
|
+
} | {
|
341
|
+
type: "VERIFICATION";
|
119
342
|
id: string;
|
120
343
|
title: {
|
121
344
|
id: string;
|
122
345
|
description: string;
|
123
346
|
defaultMessage: string;
|
124
347
|
};
|
348
|
+
actions: {
|
349
|
+
verify: {
|
350
|
+
label: {
|
351
|
+
id: string;
|
352
|
+
description: string;
|
353
|
+
defaultMessage: string;
|
354
|
+
};
|
355
|
+
};
|
356
|
+
cancel: {
|
357
|
+
label: {
|
358
|
+
id: string;
|
359
|
+
description: string;
|
360
|
+
defaultMessage: string;
|
361
|
+
};
|
362
|
+
confirmation: {
|
363
|
+
title: {
|
364
|
+
id: string;
|
365
|
+
description: string;
|
366
|
+
defaultMessage: string;
|
367
|
+
};
|
368
|
+
body: {
|
369
|
+
id: string;
|
370
|
+
description: string;
|
371
|
+
defaultMessage: string;
|
372
|
+
};
|
373
|
+
};
|
374
|
+
};
|
375
|
+
};
|
125
376
|
fields: import("./FieldConfig").Inferred[];
|
126
|
-
}[];
|
377
|
+
})[];
|
127
378
|
review: {
|
128
379
|
title: {
|
129
380
|
id: string;
|
@@ -135,6 +386,7 @@ export declare const FormConfig: z.ZodObject<{
|
|
135
386
|
active?: boolean | undefined;
|
136
387
|
}>;
|
137
388
|
export type FormPage = z.infer<typeof FormPage>;
|
389
|
+
export type FormPageInput = z.input<typeof FormPage>;
|
138
390
|
export type FormConfig = z.infer<typeof FormConfig>;
|
139
391
|
export type FormConfigInput = z.input<typeof FormConfig>;
|
140
392
|
//# sourceMappingURL=FormConfig.d.ts.map
|
@@ -0,0 +1,38 @@
|
|
1
|
+
/**
|
2
|
+
* TemplateConfig defines configuration rules for system-based variables (e.g. $user.province).
|
3
|
+
* They are currently used for providing default values in FieldConfig.
|
4
|
+
*/
|
5
|
+
import { FieldValue } from './FieldValue';
|
6
|
+
/**
|
7
|
+
* Available system variables for configuration.
|
8
|
+
*/
|
9
|
+
export interface MetaFields {
|
10
|
+
$user: {
|
11
|
+
province: string;
|
12
|
+
district: string;
|
13
|
+
};
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Recursively flatten the keys of an object. Used to limit types when configuring default values in country config.
|
17
|
+
* @example
|
18
|
+
* type Test = FlattenedKeyStrings<{ a: { b: string, c: { d: string } } }>
|
19
|
+
* // 'a.b' | 'a.c.d' but not 'a' or 'a.c'
|
20
|
+
*/
|
21
|
+
type FlattenedKeyStrings<T, Prefix extends string = ''> = {
|
22
|
+
[K in keyof T]: T[K] extends Record<string, any> ? FlattenedKeyStrings<T[K], `${Prefix}${K & string}.`> : `${Prefix}${K & string}`;
|
23
|
+
}[keyof T];
|
24
|
+
export type FlattenedMetaFields = FlattenedKeyStrings<MetaFields>;
|
25
|
+
/**
|
26
|
+
* Default value for a field when configuring a form.
|
27
|
+
*/
|
28
|
+
export type FieldConfigDefaultValue = FieldValue | FlattenedMetaFields | Record<string, FlattenedMetaFields | FieldValue>;
|
29
|
+
export declare function isTemplateVariable(value: FieldConfigDefaultValue): value is FlattenedMetaFields;
|
30
|
+
export declare function isFieldValue(value: FieldConfigDefaultValue): value is FieldValue;
|
31
|
+
/**
|
32
|
+
* Checks if given value is valid for a field, and known template variables are already resolved.
|
33
|
+
* @todo: Extend functionality to arbitrary depth objects. Currently only checks first level since our compoosite fields are only 1 level deep.
|
34
|
+
*/
|
35
|
+
export declare function isFieldValueWithoutTemplates(value: FieldConfigDefaultValue): value is FieldValue;
|
36
|
+
export declare function isFieldConfigDefaultValue(value: any): value is FieldConfigDefaultValue;
|
37
|
+
export {};
|
38
|
+
//# sourceMappingURL=TemplateConfig.d.ts.map
|