@opencrvs/toolkit 1.8.0-rc.f8f3eb3 → 1.8.0-rc.f9911ed

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.
@@ -7,6 +7,8 @@ import { FieldConfig } from './FieldConfig';
7
7
  import { WorkqueueConfig } from './WorkqueueConfig';
8
8
  import { EventState } from './ActionDocument';
9
9
  import { FormConfig } 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,29 @@ 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
+ } | {
49
+ type: "VERIFICATION";
50
+ id: string;
51
+ title: TranslationConfig;
52
+ actions: {
53
+ verify: {
54
+ label: TranslationConfig;
55
+ };
56
+ cancel: {
57
+ label: TranslationConfig;
58
+ confirmation: {
59
+ title: TranslationConfig;
60
+ body: TranslationConfig;
61
+ };
62
+ };
63
+ };
64
+ fields: import("./FieldConfig").Inferred[];
65
+ })[];
46
66
  export declare function validateWorkqueueConfig(workqueueConfigs: WorkqueueConfig[]): void;
47
67
  export declare const findActiveActionForm: (configuration: EventConfig, action: ActionType) => {
48
68
  active: boolean;
@@ -51,21 +71,57 @@ export declare const findActiveActionForm: (configuration: EventConfig, action:
51
71
  label: TranslationConfig;
52
72
  };
53
73
  label: TranslationConfig;
54
- pages: {
74
+ pages: ({
75
+ type: "FORM";
55
76
  id: string;
56
77
  title: TranslationConfig;
57
78
  fields: import("./FieldConfig").Inferred[];
58
- }[];
79
+ } | {
80
+ type: "VERIFICATION";
81
+ id: string;
82
+ title: TranslationConfig;
83
+ actions: {
84
+ verify: {
85
+ label: TranslationConfig;
86
+ };
87
+ cancel: {
88
+ label: TranslationConfig;
89
+ confirmation: {
90
+ title: TranslationConfig;
91
+ body: TranslationConfig;
92
+ };
93
+ };
94
+ };
95
+ fields: import("./FieldConfig").Inferred[];
96
+ })[];
59
97
  review: {
60
98
  title: TranslationConfig;
61
99
  fields: import("./FieldConfig").Inferred[];
62
100
  };
63
101
  } | undefined;
64
- export declare const findActiveActionFormPages: (configuration: EventConfig, action: ActionType) => {
102
+ export declare const findActiveActionFormPages: (configuration: EventConfig, action: ActionType) => ({
103
+ type: "FORM";
65
104
  id: string;
66
105
  title: TranslationConfig;
67
106
  fields: import("./FieldConfig").Inferred[];
68
- }[] | undefined;
107
+ } | {
108
+ type: "VERIFICATION";
109
+ id: string;
110
+ title: TranslationConfig;
111
+ actions: {
112
+ verify: {
113
+ label: TranslationConfig;
114
+ };
115
+ cancel: {
116
+ label: TranslationConfig;
117
+ confirmation: {
118
+ title: TranslationConfig;
119
+ body: TranslationConfig;
120
+ };
121
+ };
122
+ };
123
+ fields: import("./FieldConfig").Inferred[];
124
+ })[] | undefined;
69
125
  export declare const getFormFields: (formConfig: FormConfig) => import("./FieldConfig").Inferred[];
70
126
  /**
71
127
  * Returns only form fields for the action type, if any, excluding review fields.
@@ -75,6 +131,29 @@ export declare const findActiveActionFormFields: (configuration: EventConfig, ac
75
131
  * Returns all fields for the action type, including review fields, if any.
76
132
  */
77
133
  export declare const findActiveActionFields: (configuration: EventConfig, action: ActionType) => FieldConfig[] | undefined;
134
+ export declare const getActiveActionFormPages: (configuration: EventConfig, action: ActionType) => ({
135
+ type: "FORM";
136
+ id: string;
137
+ title: TranslationConfig;
138
+ fields: import("./FieldConfig").Inferred[];
139
+ } | {
140
+ type: "VERIFICATION";
141
+ id: string;
142
+ title: TranslationConfig;
143
+ actions: {
144
+ verify: {
145
+ label: TranslationConfig;
146
+ };
147
+ cancel: {
148
+ label: TranslationConfig;
149
+ confirmation: {
150
+ title: TranslationConfig;
151
+ body: TranslationConfig;
152
+ };
153
+ };
154
+ };
155
+ fields: import("./FieldConfig").Inferred[];
156
+ })[];
78
157
  /**
79
158
  * Returns all fields for the action type, including review fields, or throws
80
159
  */
@@ -87,6 +166,7 @@ export declare function stripHiddenFields(fields: FieldConfig[], data: EventStat
87
166
  } | {
88
167
  country: string;
89
168
  district: string;
169
+ addressType: "DOMESTIC";
90
170
  province: string;
91
171
  urbanOrRural: "URBAN";
92
172
  number?: string | undefined;
@@ -97,13 +177,127 @@ export declare function stripHiddenFields(fields: FieldConfig[], data: EventStat
97
177
  } | {
98
178
  country: string;
99
179
  district: string;
180
+ addressType: "DOMESTIC";
100
181
  province: string;
101
182
  urbanOrRural: "RURAL";
102
183
  village?: string | undefined;
184
+ } | {
185
+ country: string;
186
+ state: string;
187
+ addressType: "INTERNATIONAL";
188
+ district2: string;
189
+ cityOrTown?: string | undefined;
190
+ addressLine1?: string | undefined;
191
+ addressLine2?: string | undefined;
192
+ addressLine3?: string | undefined;
193
+ postcodeOrZip?: string | undefined;
103
194
  } | {
104
195
  type: string;
105
196
  option: string;
106
197
  filename: string;
107
198
  originalFilename: string;
108
- }[]>;
199
+ }[] | undefined>;
200
+ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]): {
201
+ id: string;
202
+ createdAt: string;
203
+ eventId: string;
204
+ transactionId: string;
205
+ action: {
206
+ type: ActionType;
207
+ data: Record<string, string | number | boolean | {
208
+ type: string;
209
+ filename: string;
210
+ originalFilename: string;
211
+ } | {
212
+ country: string;
213
+ district: string;
214
+ addressType: "DOMESTIC";
215
+ province: string;
216
+ urbanOrRural: "URBAN";
217
+ number?: string | null | undefined;
218
+ town?: string | null | undefined;
219
+ residentialArea?: string | null | undefined;
220
+ street?: string | null | undefined;
221
+ zipCode?: string | null | undefined;
222
+ } | {
223
+ country: string;
224
+ district: string;
225
+ addressType: "DOMESTIC";
226
+ province: string;
227
+ urbanOrRural: "RURAL";
228
+ village?: string | null | undefined;
229
+ } | {
230
+ country: string;
231
+ state: string;
232
+ addressType: "INTERNATIONAL";
233
+ district2: string;
234
+ cityOrTown?: string | null | undefined;
235
+ addressLine1?: string | null | undefined;
236
+ addressLine2?: string | null | undefined;
237
+ addressLine3?: string | null | undefined;
238
+ postcodeOrZip?: string | null | undefined;
239
+ } | {
240
+ type: string;
241
+ option: string;
242
+ filename: string;
243
+ originalFilename: string;
244
+ }[] | undefined>;
245
+ createdAt: string;
246
+ createdBy: string;
247
+ createdAtLocation: string;
248
+ metadata?: Record<string, string | number | boolean | {
249
+ type: string;
250
+ filename: string;
251
+ originalFilename: string;
252
+ } | {
253
+ country: string;
254
+ district: string;
255
+ addressType: "DOMESTIC";
256
+ province: string;
257
+ urbanOrRural: "URBAN";
258
+ number?: string | null | undefined;
259
+ town?: string | null | undefined;
260
+ residentialArea?: string | null | undefined;
261
+ street?: string | null | undefined;
262
+ zipCode?: string | null | undefined;
263
+ } | {
264
+ country: string;
265
+ district: string;
266
+ addressType: "DOMESTIC";
267
+ province: string;
268
+ urbanOrRural: "RURAL";
269
+ village?: string | null | undefined;
270
+ } | {
271
+ country: string;
272
+ state: string;
273
+ addressType: "INTERNATIONAL";
274
+ district2: string;
275
+ cityOrTown?: string | null | undefined;
276
+ addressLine1?: string | null | undefined;
277
+ addressLine2?: string | null | undefined;
278
+ addressLine3?: string | null | undefined;
279
+ postcodeOrZip?: string | null | undefined;
280
+ } | {
281
+ type: string;
282
+ option: string;
283
+ filename: string;
284
+ originalFilename: string;
285
+ }[] | undefined> | undefined;
286
+ };
287
+ }[];
288
+ export declare function createEmptyDraft(eventId: string, draftId: string, actionType: ActionType): {
289
+ id: string;
290
+ eventId: string;
291
+ createdAt: string;
292
+ transactionId: import("../uuid").UUID;
293
+ action: {
294
+ type: ActionType;
295
+ data: {};
296
+ metadata: {};
297
+ createdAt: string;
298
+ createdBy: string;
299
+ createdAtLocation: string;
300
+ };
301
+ };
302
+ export declare function findActiveActionVerificationPageIds(configuration: EventConfig, action: ActionType): string[];
109
303
  //# 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
  }