@opencrvs/toolkit 1.8.0-rc.ff2e7b6 → 1.8.0-rc.ff62f9e

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.
@@ -5,8 +5,10 @@ import { EventConfigInput } from './EventConfigInput';
5
5
  import { EventMetadataKeys } from './EventMetadata';
6
6
  import { FieldConfig } from './FieldConfig';
7
7
  import { WorkqueueConfig } from './WorkqueueConfig';
8
- import { EventState } from './ActionDocument';
9
- import { FormConfig } from './FormConfig';
8
+ import { ActionUpdate, EventState } from './ActionDocument';
9
+ import { FormConfig, FormPageConfig } from './FormConfig';
10
+ import { Draft } from './Draft';
11
+ import { EventDocument } from './EventDocument';
10
12
  /**
11
13
  * @returns All the fields in the event configuration input.
12
14
  */
@@ -38,11 +40,31 @@ export declare const resolveLabelsFromKnownFields: ({ pageFields, refFields }: {
38
40
  label?: TranslationConfig;
39
41
  }[];
40
42
  export declare function getAllFields(configuration: EventConfig): import("./FieldConfig").Inferred[];
41
- export declare function getAllPages(configuration: EventConfig): {
43
+ export declare function getAllPages(configuration: EventConfig): ({
44
+ type: "FORM";
42
45
  id: string;
43
46
  title: TranslationConfig;
44
47
  fields: import("./FieldConfig").Inferred[];
45
- }[];
48
+ conditional?: import(".").JSONSchema | undefined;
49
+ } | {
50
+ type: "VERIFICATION";
51
+ id: string;
52
+ title: TranslationConfig;
53
+ actions: {
54
+ verify: {
55
+ label: TranslationConfig;
56
+ };
57
+ cancel: {
58
+ label: TranslationConfig;
59
+ confirmation: {
60
+ title: TranslationConfig;
61
+ body: TranslationConfig;
62
+ };
63
+ };
64
+ };
65
+ fields: import("./FieldConfig").Inferred[];
66
+ conditional?: import(".").JSONSchema | undefined;
67
+ })[];
46
68
  export declare function validateWorkqueueConfig(workqueueConfigs: WorkqueueConfig[]): void;
47
69
  export declare const findActiveActionForm: (configuration: EventConfig, action: ActionType) => {
48
70
  active: boolean;
@@ -51,22 +73,64 @@ export declare const findActiveActionForm: (configuration: EventConfig, action:
51
73
  label: TranslationConfig;
52
74
  };
53
75
  label: TranslationConfig;
54
- pages: {
76
+ pages: ({
77
+ type: "FORM";
55
78
  id: string;
56
79
  title: TranslationConfig;
57
80
  fields: import("./FieldConfig").Inferred[];
58
- }[];
81
+ conditional?: import(".").JSONSchema | undefined;
82
+ } | {
83
+ type: "VERIFICATION";
84
+ id: string;
85
+ title: TranslationConfig;
86
+ actions: {
87
+ verify: {
88
+ label: TranslationConfig;
89
+ };
90
+ cancel: {
91
+ label: TranslationConfig;
92
+ confirmation: {
93
+ title: TranslationConfig;
94
+ body: TranslationConfig;
95
+ };
96
+ };
97
+ };
98
+ fields: import("./FieldConfig").Inferred[];
99
+ conditional?: import(".").JSONSchema | undefined;
100
+ })[];
59
101
  review: {
60
102
  title: TranslationConfig;
61
103
  fields: import("./FieldConfig").Inferred[];
62
104
  };
63
105
  } | undefined;
64
- export declare const findActiveActionFormPages: (configuration: EventConfig, action: ActionType) => {
106
+ export declare const findActiveActionFormPages: (configuration: EventConfig, action: ActionType) => ({
107
+ type: "FORM";
108
+ id: string;
109
+ title: TranslationConfig;
110
+ fields: import("./FieldConfig").Inferred[];
111
+ conditional?: import(".").JSONSchema | undefined;
112
+ } | {
113
+ type: "VERIFICATION";
65
114
  id: string;
66
115
  title: TranslationConfig;
116
+ actions: {
117
+ verify: {
118
+ label: TranslationConfig;
119
+ };
120
+ cancel: {
121
+ label: TranslationConfig;
122
+ confirmation: {
123
+ title: TranslationConfig;
124
+ body: TranslationConfig;
125
+ };
126
+ };
127
+ };
67
128
  fields: import("./FieldConfig").Inferred[];
68
- }[] | undefined;
129
+ conditional?: import(".").JSONSchema | undefined;
130
+ })[] | undefined;
69
131
  export declare const getFormFields: (formConfig: FormConfig) => import("./FieldConfig").Inferred[];
132
+ export declare function isPageVisible(page: FormPageConfig, formValues: ActionUpdate): boolean;
133
+ export declare const getVisiblePagesFormFields: (formConfig: FormConfig, formData: ActionUpdate) => import("./FieldConfig").Inferred[];
70
134
  /**
71
135
  * Returns only form fields for the action type, if any, excluding review fields.
72
136
  */
@@ -74,12 +138,32 @@ export declare const findActiveActionFormFields: (configuration: EventConfig, ac
74
138
  /**
75
139
  * Returns all fields for the action type, including review fields, if any.
76
140
  */
77
- export declare const findActiveActionFields: (configuration: EventConfig, action: ActionType) => FieldConfig[] | undefined;
78
- export declare const getActiveActionFormPages: (configuration: EventConfig, action: ActionType) => {
141
+ export declare const findActiveActionFields: (configuration: EventConfig, action: ActionType, formData?: ActionUpdate) => FieldConfig[] | undefined;
142
+ export declare const getActiveActionFormPages: (configuration: EventConfig, action: ActionType) => ({
143
+ type: "FORM";
79
144
  id: string;
80
145
  title: TranslationConfig;
81
146
  fields: import("./FieldConfig").Inferred[];
82
- }[];
147
+ conditional?: import(".").JSONSchema | undefined;
148
+ } | {
149
+ type: "VERIFICATION";
150
+ id: string;
151
+ title: TranslationConfig;
152
+ actions: {
153
+ verify: {
154
+ label: TranslationConfig;
155
+ };
156
+ cancel: {
157
+ label: TranslationConfig;
158
+ confirmation: {
159
+ title: TranslationConfig;
160
+ body: TranslationConfig;
161
+ };
162
+ };
163
+ };
164
+ fields: import("./FieldConfig").Inferred[];
165
+ conditional?: import(".").JSONSchema | undefined;
166
+ })[];
83
167
  /**
84
168
  * Returns all fields for the action type, including review fields, or throws
85
169
  */
@@ -92,6 +176,7 @@ export declare function stripHiddenFields(fields: FieldConfig[], data: EventStat
92
176
  } | {
93
177
  country: string;
94
178
  district: string;
179
+ addressType: "DOMESTIC";
95
180
  province: string;
96
181
  urbanOrRural: "URBAN";
97
182
  number?: string | undefined;
@@ -102,13 +187,145 @@ export declare function stripHiddenFields(fields: FieldConfig[], data: EventStat
102
187
  } | {
103
188
  country: string;
104
189
  district: string;
190
+ addressType: "DOMESTIC";
105
191
  province: string;
106
192
  urbanOrRural: "RURAL";
107
193
  village?: string | undefined;
194
+ } | {
195
+ country: string;
196
+ state: string;
197
+ addressType: "INTERNATIONAL";
198
+ district2: string;
199
+ cityOrTown?: string | undefined;
200
+ addressLine1?: string | undefined;
201
+ addressLine2?: string | undefined;
202
+ addressLine3?: string | undefined;
203
+ postcodeOrZip?: string | undefined;
108
204
  } | {
109
205
  type: string;
110
206
  option: string;
111
207
  filename: string;
112
208
  originalFilename: string;
113
- }[]>;
209
+ }[] | undefined>;
210
+ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]): {
211
+ id: string;
212
+ createdAt: string;
213
+ eventId: string;
214
+ transactionId: string;
215
+ action: {
216
+ type: ActionType;
217
+ data: Record<string, string | number | boolean | {
218
+ type: string;
219
+ filename: string;
220
+ originalFilename: string;
221
+ } | {
222
+ country: string;
223
+ district: string;
224
+ addressType: "DOMESTIC";
225
+ province: string;
226
+ urbanOrRural: "URBAN";
227
+ number?: string | null | undefined;
228
+ town?: string | null | undefined;
229
+ residentialArea?: string | null | undefined;
230
+ street?: string | null | undefined;
231
+ zipCode?: string | null | undefined;
232
+ } | {
233
+ country: string;
234
+ district: string;
235
+ addressType: "DOMESTIC";
236
+ province: string;
237
+ urbanOrRural: "RURAL";
238
+ village?: string | null | undefined;
239
+ } | {
240
+ country: string;
241
+ state: string;
242
+ addressType: "INTERNATIONAL";
243
+ district2: string;
244
+ cityOrTown?: string | null | undefined;
245
+ addressLine1?: string | null | undefined;
246
+ addressLine2?: string | null | undefined;
247
+ addressLine3?: string | null | undefined;
248
+ postcodeOrZip?: string | null | undefined;
249
+ } | {
250
+ type: string;
251
+ option: string;
252
+ filename: string;
253
+ originalFilename: string;
254
+ }[] | undefined>;
255
+ createdAt: string;
256
+ createdBy: string;
257
+ createdAtLocation: string;
258
+ metadata?: Record<string, string | number | boolean | {
259
+ type: string;
260
+ filename: string;
261
+ originalFilename: string;
262
+ } | {
263
+ country: string;
264
+ district: string;
265
+ addressType: "DOMESTIC";
266
+ province: string;
267
+ urbanOrRural: "URBAN";
268
+ number?: string | null | undefined;
269
+ town?: string | null | undefined;
270
+ residentialArea?: string | null | undefined;
271
+ street?: string | null | undefined;
272
+ zipCode?: string | null | undefined;
273
+ } | {
274
+ country: string;
275
+ district: string;
276
+ addressType: "DOMESTIC";
277
+ province: string;
278
+ urbanOrRural: "RURAL";
279
+ village?: string | null | undefined;
280
+ } | {
281
+ country: string;
282
+ state: string;
283
+ addressType: "INTERNATIONAL";
284
+ district2: string;
285
+ cityOrTown?: string | null | undefined;
286
+ addressLine1?: string | null | undefined;
287
+ addressLine2?: string | null | undefined;
288
+ addressLine3?: string | null | undefined;
289
+ postcodeOrZip?: string | null | undefined;
290
+ } | {
291
+ type: string;
292
+ option: string;
293
+ filename: string;
294
+ originalFilename: string;
295
+ }[] | undefined> | undefined;
296
+ };
297
+ }[];
298
+ export declare function createEmptyDraft(eventId: string, draftId: string, actionType: ActionType): {
299
+ id: string;
300
+ eventId: string;
301
+ createdAt: string;
302
+ transactionId: import("../uuid").UUID;
303
+ action: {
304
+ type: ActionType;
305
+ data: {};
306
+ metadata: {};
307
+ createdAt: string;
308
+ createdBy: string;
309
+ createdAtLocation: string;
310
+ };
311
+ };
312
+ export declare function isVerificationPage(page: FormPageConfig): page is {
313
+ type: "VERIFICATION";
314
+ id: string;
315
+ title: TranslationConfig;
316
+ actions: {
317
+ verify: {
318
+ label: TranslationConfig;
319
+ };
320
+ cancel: {
321
+ label: TranslationConfig;
322
+ confirmation: {
323
+ title: TranslationConfig;
324
+ body: TranslationConfig;
325
+ };
326
+ };
327
+ };
328
+ fields: import("./FieldConfig").Inferred[];
329
+ conditional?: import(".").JSONSchema | undefined;
330
+ };
114
331
  //# sourceMappingURL=utils.d.ts.map
@@ -239,6 +239,23 @@ function field(fieldId) {
239
239
  }
240
240
  },
241
241
  required: ["$form"]
242
+ }),
243
+ isValidEnglishName: () => defineConditional({
244
+ type: "object",
245
+ properties: {
246
+ $form: {
247
+ type: "object",
248
+ properties: {
249
+ [fieldId]: {
250
+ type: "string",
251
+ pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
252
+ description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
253
+ }
254
+ },
255
+ required: [fieldId]
256
+ }
257
+ },
258
+ required: ["$form"]
242
259
  })
243
260
  };
244
261
  }