@company-semantics/contracts 6.2.0 → 6.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "6.2.0",
3
+ "version": "6.3.1",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,6 +22,12 @@ describe('EMAIL_KINDS golden snapshot', () => {
22
22
  plainTextRequired: true,
23
23
  htmlSupported: true,
24
24
  },
25
+ 'org.leadership_granted': {
26
+ kind: 'org.leadership_granted',
27
+ subject: "You've been added to a team",
28
+ plainTextRequired: true,
29
+ htmlSupported: true,
30
+ },
25
31
  'security.alert': {
26
32
  kind: 'security.alert',
27
33
  subject: 'Security alert for your account',
@@ -95,7 +101,7 @@ describe('getEmailKindDefinition', () => {
95
101
  })
96
102
 
97
103
  describe('isValidEmailKind', () => {
98
- it('returns true for all 5 valid email kinds', () => {
104
+ it('returns true for all valid email kinds', () => {
99
105
  for (const kind of Object.keys(EMAIL_KINDS)) {
100
106
  expect(isValidEmailKind(kind)).toBe(true)
101
107
  }
@@ -76,6 +76,12 @@ export const EMAIL_KINDS = {
76
76
  plainTextRequired: true,
77
77
  htmlSupported: true,
78
78
  },
79
+ 'org.leadership_granted': {
80
+ kind: 'org.leadership_granted',
81
+ subject: "You've been added to a team",
82
+ plainTextRequired: true,
83
+ htmlSupported: true,
84
+ },
79
85
  'security.alert': {
80
86
  kind: 'security.alert',
81
87
  subject: 'Security alert for your account',
@@ -27,6 +27,7 @@ export type EmailKind =
27
27
  | 'auth.otp'
28
28
  | 'auth.magic_link' // future
29
29
  | 'org.invite' // future
30
+ | 'org.leadership_granted'
30
31
  | 'security.alert' // future
31
32
  | 'chat.shared'
32
33
 
@@ -58,6 +59,20 @@ export interface EmailPayloads {
58
59
  acceptUrl: string
59
60
  expiresInDays: number
60
61
  }
62
+ 'org.leadership_granted': {
63
+ /** Display name of the person who granted access */
64
+ granterName: string
65
+ /** Display name of the recipient (optional; falls back to a neutral greeting) */
66
+ recipientName?: string
67
+ /** Name of the org unit / team the access applies to */
68
+ unitName: string
69
+ /** Human-readable role label the recipient was given */
70
+ roleLabel: 'Leader' | 'Delegate'
71
+ /** Full URL to view the org unit in the app */
72
+ ctaUrl: string
73
+ /** Optional message from the granter, shown in the email and recorded with the grant */
74
+ message?: string
75
+ }
61
76
  'security.alert': {
62
77
  /** Type of security alert */
63
78
  alertType: 'excessive_otp_requests' | 'unusual_login_location'
@@ -912,6 +912,13 @@ export const CreateDelegationRequestSchema = z.object({
912
912
  * UI captures a date and sends end-of-day in the user's timezone.
913
913
  */
914
914
  expiresAt: z.string().datetime().nullable().optional(),
915
+ /**
916
+ * When true, the granted user is emailed a notification (carrying `note` as
917
+ * the message). Not persisted — it only gates the side-effect email. Omitted
918
+ * is treated as false; left without a default so the inferred request type
919
+ * keeps `notify` optional rather than forcing every caller to pass it.
920
+ */
921
+ notify: z.boolean().optional(),
915
922
  });
916
923
  export type CreateDelegationRequest = z.infer<typeof CreateDelegationRequestSchema>;
917
924