@peopl-health/nexus 5.57.4 → 5.57.6

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.
@@ -46,11 +46,12 @@ function contentSignature(variables) {
46
46
  return crypto.createHash('sha1').update(source).digest('hex').slice(0, 12);
47
47
  }
48
48
 
49
- function buildSendClaimKey({ code, contentSid, variables, idempotencyKey } = {}) {
49
+ function buildSendClaimKey({ code, contactCode, contentSid, variables, idempotencyKey } = {}) {
50
50
  if (idempotencyKey) return `idem:${idempotencyKey}`;
51
51
  if (!code || !contentSid) return null;
52
52
  const signature = contentSignature(variables);
53
- return `tpl:${ensureWhatsAppFormat(code)}:${contentSid}${signature ? `:${signature}` : ''}`;
53
+ const recipient = contactCode ? `${ensureWhatsAppFormat(code)}>${ensureWhatsAppFormat(contactCode)}` : ensureWhatsAppFormat(code);
54
+ return `tpl:${recipient}:${contentSid}${signature ? `:${signature}` : ''}`;
54
55
  }
55
56
 
56
57
  async function isCompletedClaim(key) {
package/lib/index.d.ts CHANGED
@@ -188,6 +188,8 @@ declare module '@peopl-health/nexus' {
188
188
  media: any | null;
189
189
  type: 'message' | 'interactive' | 'media';
190
190
  raw?: { role?: string; replyRequested?: boolean };
191
+ contactCode?: string;
192
+ contactRole?: 'caregiver' | null;
191
193
  }
192
194
 
193
195
  export interface MessageStatusEventData {
@@ -95,6 +95,7 @@ class MongoStorage {
95
95
  fromMe: doc.from_me,
96
96
  triggeredBy: doc.triggeredBy,
97
97
  ...(doc.origin === 'system' && doc.raw ? { raw: doc.raw } : {}),
98
+ ...(doc.contact_code && { contactCode: doc.contact_code, contactRole: doc.contact_role }),
98
99
  status,
99
100
  ...(frontendId && { frontendId })
100
101
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.57.4",
3
+ "version": "5.57.6",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",