@opencrvs/toolkit 1.8.1-rc.44f4f51 → 1.8.1-rc.46405f6
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.
@@ -21,6 +21,7 @@ export declare const FullName: z.ZodObject<{
|
|
21
21
|
given: string[];
|
22
22
|
family: string;
|
23
23
|
}>;
|
24
|
+
export type FullName = z.infer<typeof FullName>;
|
24
25
|
export declare const Recipient: z.ZodObject<{
|
25
26
|
name: z.ZodArray<z.ZodObject<{
|
26
27
|
use: z.ZodString;
|
@@ -327,8 +328,9 @@ export declare const TriggerPayload: {
|
|
327
328
|
mobile?: string | undefined;
|
328
329
|
}>;
|
329
330
|
}, {
|
330
|
-
|
331
|
+
code: z.ZodString;
|
331
332
|
}>, "strip", z.ZodTypeAny, {
|
333
|
+
code: string;
|
332
334
|
recipient: {
|
333
335
|
name: {
|
334
336
|
use: string;
|
@@ -338,8 +340,8 @@ export declare const TriggerPayload: {
|
|
338
340
|
email?: string | undefined;
|
339
341
|
mobile?: string | undefined;
|
340
342
|
};
|
341
|
-
temporaryPassword: string;
|
342
343
|
}, {
|
344
|
+
code: string;
|
343
345
|
recipient: {
|
344
346
|
name: {
|
345
347
|
use: string;
|
@@ -349,7 +351,6 @@ export declare const TriggerPayload: {
|
|
349
351
|
email?: string | undefined;
|
350
352
|
mobile?: string | undefined;
|
351
353
|
};
|
352
|
-
temporaryPassword: string;
|
353
354
|
}>;
|
354
355
|
readonly "reset-password-by-admin": z.ZodObject<z.objectUtil.extendShape<{
|
355
356
|
recipient: z.ZodObject<{
|
@@ -534,10 +535,13 @@ export declare const TriggerPayload: {
|
|
534
535
|
export type TriggerPayload = {
|
535
536
|
[K in TriggerEvent]: z.infer<(typeof TriggerPayload)[K]>;
|
536
537
|
};
|
537
|
-
export declare function
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
538
|
+
export declare function triggerUserEventNotification<T extends TriggerEvent>({ event, payload, countryConfigUrl, authHeader }: {
|
539
|
+
event: T;
|
540
|
+
payload: TriggerPayload[T];
|
541
|
+
countryConfigUrl: string;
|
542
|
+
authHeader: {
|
543
|
+
Authorization: string;
|
544
|
+
};
|
545
|
+
}): Promise<Response>;
|
542
546
|
export declare function parseUserEventTrigger<T extends TriggerEvent>(event: T, body: unknown): TriggerPayload[T];
|
543
547
|
//# sourceMappingURL=UserNotifications.d.ts.map
|
package/dist/events/index.js
CHANGED
@@ -5741,44 +5741,41 @@ var tennisClubMembershipEvent = defineConfig({
|
|
5741
5741
|
},
|
5742
5742
|
{
|
5743
5743
|
id: "identity-check",
|
5744
|
-
type: PageTypes.enum.
|
5744
|
+
type: PageTypes.enum.VERIFICATION,
|
5745
5745
|
title: {
|
5746
|
-
id: "event.
|
5747
|
-
defaultMessage: "Verify
|
5746
|
+
id: "v2.event.birth.action.correction.form.section.requester.identity.verify.title",
|
5747
|
+
defaultMessage: "Verify ID",
|
5748
5748
|
description: "This is the title of the section"
|
5749
5749
|
},
|
5750
|
-
fields: [
|
5751
|
-
|
5752
|
-
|
5753
|
-
type: "PAGE_HEADER",
|
5750
|
+
fields: [],
|
5751
|
+
actions: {
|
5752
|
+
verify: {
|
5754
5753
|
label: {
|
5755
|
-
|
5756
|
-
|
5757
|
-
|
5754
|
+
defaultMessage: "Verified",
|
5755
|
+
description: "This is the label for the verification button",
|
5756
|
+
id: "v2.event.birth.action.correction.form.verify"
|
5758
5757
|
}
|
5759
5758
|
},
|
5760
|
-
{
|
5761
|
-
id: "correction.identity-check.verified",
|
5762
|
-
type: "RADIO_GROUP",
|
5759
|
+
cancel: {
|
5763
5760
|
label: {
|
5764
|
-
|
5765
|
-
|
5766
|
-
|
5761
|
+
defaultMessage: "Identity does not match",
|
5762
|
+
description: "This is the label for the verification cancellation button",
|
5763
|
+
id: "v2.event.birth.action.correction.form.cancel"
|
5767
5764
|
},
|
5768
|
-
|
5769
|
-
|
5770
|
-
|
5771
|
-
|
5772
|
-
|
5773
|
-
|
5774
|
-
|
5775
|
-
|
5776
|
-
|
5777
|
-
|
5765
|
+
confirmation: {
|
5766
|
+
title: {
|
5767
|
+
defaultMessage: "Correct without proof of ID?",
|
5768
|
+
description: "This is the title for the verification cancellation modal",
|
5769
|
+
id: "v2.event.birth.action.correction.form.cancel.confirmation.title"
|
5770
|
+
},
|
5771
|
+
body: {
|
5772
|
+
defaultMessage: "Please be aware that if you proceed, you will be responsible for making a change to this record without the necessary proof of identification",
|
5773
|
+
description: "This is the body for the verification cancellation modal",
|
5774
|
+
id: "v2.event.birth.action.correction.form.cancel.confirmation.body"
|
5778
5775
|
}
|
5779
|
-
|
5776
|
+
}
|
5780
5777
|
}
|
5781
|
-
|
5778
|
+
}
|
5782
5779
|
},
|
5783
5780
|
{
|
5784
5781
|
id: "correction-request.supporting-documents",
|
@@ -6752,6 +6749,7 @@ function eventPayloadGenerator(rng) {
|
|
6752
6749
|
annotation: {
|
6753
6750
|
"correction.requester.relationship": "ANOTHER_AGENT",
|
6754
6751
|
"correction.request.reason": "Child's name was incorrect",
|
6752
|
+
"identity-check": true,
|
6755
6753
|
...annotation
|
6756
6754
|
},
|
6757
6755
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
@@ -35,11 +35,17 @@ __export(notification_exports, {
|
|
35
35
|
Recipient: () => Recipient,
|
36
36
|
TriggerEvent: () => TriggerEvent,
|
37
37
|
TriggerPayload: () => TriggerPayload,
|
38
|
-
|
39
|
-
|
38
|
+
parseUserEventTrigger: () => parseUserEventTrigger,
|
39
|
+
triggerUserEventNotification: () => triggerUserEventNotification
|
40
40
|
});
|
41
41
|
module.exports = __toCommonJS(notification_exports);
|
42
42
|
|
43
|
+
// ../commons/src/url.ts
|
44
|
+
function joinURL(base, path) {
|
45
|
+
const baseWithSlash = base.endsWith("/") ? base : base + "/";
|
46
|
+
return new URL(path, baseWithSlash);
|
47
|
+
}
|
48
|
+
|
43
49
|
// ../commons/src/events/Constants.ts
|
44
50
|
var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
45
51
|
var BIRTH_EVENT = "v2-birth";
|
@@ -4332,44 +4338,41 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4332
4338
|
},
|
4333
4339
|
{
|
4334
4340
|
id: "identity-check",
|
4335
|
-
type: PageTypes.enum.
|
4341
|
+
type: PageTypes.enum.VERIFICATION,
|
4336
4342
|
title: {
|
4337
|
-
id: "event.
|
4338
|
-
defaultMessage: "Verify
|
4343
|
+
id: "v2.event.birth.action.correction.form.section.requester.identity.verify.title",
|
4344
|
+
defaultMessage: "Verify ID",
|
4339
4345
|
description: "This is the title of the section"
|
4340
4346
|
},
|
4341
|
-
fields: [
|
4342
|
-
|
4343
|
-
|
4344
|
-
type: "PAGE_HEADER",
|
4347
|
+
fields: [],
|
4348
|
+
actions: {
|
4349
|
+
verify: {
|
4345
4350
|
label: {
|
4346
|
-
|
4347
|
-
|
4348
|
-
|
4351
|
+
defaultMessage: "Verified",
|
4352
|
+
description: "This is the label for the verification button",
|
4353
|
+
id: "v2.event.birth.action.correction.form.verify"
|
4349
4354
|
}
|
4350
4355
|
},
|
4351
|
-
{
|
4352
|
-
id: "correction.identity-check.verified",
|
4353
|
-
type: "RADIO_GROUP",
|
4356
|
+
cancel: {
|
4354
4357
|
label: {
|
4355
|
-
|
4356
|
-
|
4357
|
-
|
4358
|
+
defaultMessage: "Identity does not match",
|
4359
|
+
description: "This is the label for the verification cancellation button",
|
4360
|
+
id: "v2.event.birth.action.correction.form.cancel"
|
4358
4361
|
},
|
4359
|
-
|
4360
|
-
|
4361
|
-
|
4362
|
-
|
4363
|
-
|
4364
|
-
|
4365
|
-
|
4366
|
-
|
4367
|
-
|
4368
|
-
|
4362
|
+
confirmation: {
|
4363
|
+
title: {
|
4364
|
+
defaultMessage: "Correct without proof of ID?",
|
4365
|
+
description: "This is the title for the verification cancellation modal",
|
4366
|
+
id: "v2.event.birth.action.correction.form.cancel.confirmation.title"
|
4367
|
+
},
|
4368
|
+
body: {
|
4369
|
+
defaultMessage: "Please be aware that if you proceed, you will be responsible for making a change to this record without the necessary proof of identification",
|
4370
|
+
description: "This is the body for the verification cancellation modal",
|
4371
|
+
id: "v2.event.birth.action.correction.form.cancel.confirmation.body"
|
4369
4372
|
}
|
4370
|
-
|
4373
|
+
}
|
4371
4374
|
}
|
4372
|
-
|
4375
|
+
}
|
4373
4376
|
},
|
4374
4377
|
{
|
4375
4378
|
id: "correction-request.supporting-documents",
|
@@ -5331,7 +5334,7 @@ var TriggerPayload = {
|
|
5331
5334
|
username: import_zod36.z.string()
|
5332
5335
|
}),
|
5333
5336
|
[TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
|
5334
|
-
|
5337
|
+
code: import_zod36.z.string()
|
5335
5338
|
}),
|
5336
5339
|
[TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
|
5337
5340
|
temporaryPassword: import_zod36.z.string(),
|
@@ -5341,12 +5344,20 @@ var TriggerPayload = {
|
|
5341
5344
|
code: import_zod36.z.string()
|
5342
5345
|
})
|
5343
5346
|
};
|
5344
|
-
function
|
5345
|
-
|
5346
|
-
|
5347
|
+
async function triggerUserEventNotification({
|
5348
|
+
event: event2,
|
5349
|
+
payload,
|
5350
|
+
countryConfigUrl,
|
5351
|
+
authHeader
|
5352
|
+
}) {
|
5353
|
+
return await fetch(joinURL(countryConfigUrl, `triggers/user/${event2}`), {
|
5347
5354
|
method: "POST",
|
5348
|
-
body: JSON.stringify(payload)
|
5349
|
-
|
5355
|
+
body: JSON.stringify(payload),
|
5356
|
+
headers: {
|
5357
|
+
"Content-Type": "application/json",
|
5358
|
+
...authHeader
|
5359
|
+
}
|
5360
|
+
});
|
5350
5361
|
}
|
5351
5362
|
function parseUserEventTrigger(event2, body) {
|
5352
5363
|
const schema = TriggerPayload[event2];
|