@proteos/sdk 0.92.0 → 0.92.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": "@proteos/sdk",
3
- "version": "0.92.0",
3
+ "version": "0.92.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "TypeScript SDK for the Proteos platform",
6
6
  "repository": {
@@ -95,6 +95,7 @@ import type {
95
95
  ListMessagesQuery,
96
96
  ListMessageTemplatesQuery,
97
97
  ListMistranscribedTermsQuery,
98
+ ListPermissionEventsResponse,
98
99
  ListReactionsResponse,
99
100
  ListResponse,
100
101
  ListRoomsQuery,
@@ -619,6 +620,8 @@ export interface ContactService {
619
620
  unlinkRecord(linkId: string): Promise<void>
620
621
  /** Fold source_contact_id into contactId (contactId wins). */
621
622
  merge(contactId: string, request: MergeContactsRequest): Promise<Contact>
623
+ /** The contact's permission ledger, newest first, with per-purpose consent. */
624
+ listPermissionEvents(contactId: string): Promise<ListPermissionEventsResponse>
622
625
  recordPermissionEvent(contactId: string, request: RecordPermissionEventRequest): Promise<Contact>
623
626
  block(contactId: string, request?: BlockContactRequest): Promise<Contact>
624
627
  unblock(contactId: string, request?: BlockContactRequest): Promise<Contact>
@@ -708,6 +711,13 @@ class ContactServiceImpl implements ContactService {
708
711
  )
709
712
  }
710
713
 
714
+ listPermissionEvents(contactId: string): Promise<ListPermissionEventsResponse> {
715
+ return this.client.request(
716
+ 'GET',
717
+ `${CONVERSATION_BASE_PATH}/contacts/${encodeURIComponent(contactId)}/permission-events`,
718
+ )
719
+ }
720
+
711
721
  recordPermissionEvent(
712
722
  contactId: string,
713
723
  request: RecordPermissionEventRequest,
@@ -2531,6 +2531,11 @@ export type ContactSource = 'sync' | 'ingest' | 'manual' | 'merge'
2531
2531
  export type ContactStatus = 'active' | 'merged' | 'archived' | 'erased'
2532
2532
  export type ConsentStatus = 'unknown' | 'opted_in' | 'opted_out'
2533
2533
  export type PermissionEventType = 'opt_in' | 'opt_out' | 'block' | 'unblock'
2534
+ /**
2535
+ * Why a message is sent — the unit a person consents to. A fixed set.
2536
+ * `transactional` is never consent-gated (only blocks and erasure stop it).
2537
+ */
2538
+ export type Purpose = 'transactional' | 'service' | 'sales' | 'marketing' | 'newsletter'
2534
2539
  /**
2535
2540
  * Where a permission event came from. `provider` = the sending platform
2536
2541
  * observed it (its unsubscribe link, a spam complaint relayed by the mailbox
@@ -2631,6 +2636,8 @@ export interface ContactPermissionEvent {
2631
2636
  /** Scopes the event to one address; absent/empty = contact-level. */
2632
2637
  contact_address_id?: string
2633
2638
  event: PermissionEventType
2639
+ /** Narrows a consent event to one purpose; absent = all purposes. */
2640
+ purpose?: Purpose
2634
2641
  basis?: string
2635
2642
  source: PermissionEventSource
2636
2643
  occurred_at: string
@@ -2640,6 +2647,24 @@ export interface ContactPermissionEvent {
2640
2647
  created_by: UserRef
2641
2648
  }
2642
2649
 
2650
+ /** A contact's consent for one purpose, derived from the ledger (not stored). */
2651
+ export interface ContactPurposeStatus {
2652
+ purpose: Exclude<Purpose, 'transactional'>
2653
+ status: ConsentStatus
2654
+ /** The ledger event that set `status`; absent when unknown. */
2655
+ decided_by_event_id?: string
2656
+ /** True when that event applies to all purposes. */
2657
+ is_inherited: boolean
2658
+ /** Addresses opted out of this purpose (or all) on their own scope. */
2659
+ opted_out_address_ids: string[]
2660
+ }
2661
+
2662
+ /** A contact's ledger, newest first, with the per-purpose consent. */
2663
+ export interface ListPermissionEventsResponse {
2664
+ data: ContactPermissionEvent[]
2665
+ purposes: ContactPurposeStatus[]
2666
+ }
2667
+
2643
2668
  /** One candidate duplicate pair awaiting review. */
2644
2669
  export interface ContactMergeProposal {
2645
2670
  id: string
@@ -2818,6 +2843,8 @@ export interface RecordPermissionEventRequest {
2818
2843
  */
2819
2844
  address?: string
2820
2845
  event: PermissionEventType
2846
+ /** One purpose; absent = all purposes. Consent events only; never `transactional`. */
2847
+ purpose?: Purpose
2821
2848
  basis?: string
2822
2849
  source?: PermissionEventSource
2823
2850
  occurred_at?: string
package/src/index.ts CHANGED
@@ -333,6 +333,8 @@ export type {
333
333
  ContactGroupService,
334
334
  ContactGroupSource,
335
335
  ContactMergeProposal,
336
+ ContactPermissionEvent,
337
+ ContactPurposeStatus,
336
338
  ContactRecordLink,
337
339
  ContactRecordLinkSource,
338
340
  ContactRef,
@@ -482,6 +484,7 @@ export type {
482
484
  ListMessagesQuery,
483
485
  ListMessageTemplatesQuery,
484
486
  ListMistranscribedTermsQuery,
487
+ ListPermissionEventsResponse,
485
488
  // Conversation-local page envelope ({meta, data}) — distinct from the
486
489
  // PageIterator-based ListResult used by the other modules.
487
490
  ListResponse,
@@ -526,6 +529,7 @@ export type {
526
529
  PhoneNumberRouting,
527
530
  PhoneNumberStatus,
528
531
  ProfileVisitParams,
532
+ Purpose,
529
533
  Reaction,
530
534
  ReactionCapability,
531
535
  ReactionOption,