@proveanything/smartlinks 1.1.0 → 1.1.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/API_SUMMARY.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.1.0 | Generated: 2025-12-18T21:46:20.895Z
3
+ Version: 1.1.1 | Generated: 2025-12-18T22:33:00.019Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -532,127 +532,6 @@ interface AuthKitConfig {
532
532
 
533
533
  ### broadcasts
534
534
 
535
- **BroadcastEvent** (interface)
536
- ```typescript
537
- interface BroadcastEvent {
538
- orgId: string
539
- broadcastId: string
540
- userId?: string
541
- contactId?: string
542
- channel?: string
543
- timestamp: string
544
- [k: string]: any
545
- }
546
- ```
547
-
548
- **BroadcastQueryByUser** (interface)
549
- ```typescript
550
- interface BroadcastQueryByUser {
551
- userId?: string
552
- contactId?: string
553
- from?: string
554
- to?: string
555
- limit?: number
556
- }
557
- ```
558
-
559
- **RecipientIdsQuery** (interface)
560
- ```typescript
561
- interface RecipientIdsQuery {
562
- broadcastId: string
563
- idField?: IdField
564
- from?: string
565
- to?: string
566
- limit?: number
567
- }
568
- ```
569
-
570
- **RecipientsWithoutActionQuery** (interface)
571
- ```typescript
572
- interface RecipientsWithoutActionQuery {
573
- broadcastId: string
574
- actionId?: string
575
- appId?: string
576
- idField?: IdField
577
- from?: string
578
- to?: string
579
- limit?: number
580
- }
581
- ```
582
-
583
- **RecipientsWithActionQuery** (interface)
584
- ```typescript
585
- interface RecipientsWithActionQuery {
586
- broadcastId: string
587
- actionId?: string
588
- appId?: string
589
- outcome?: string
590
- idField?: IdField
591
- includeOutcome?: boolean
592
- from?: string
593
- to?: string
594
- limit?: number
595
- }
596
- ```
597
-
598
- **RecipientWithOutcome** (interface)
599
- ```typescript
600
- interface RecipientWithOutcome {
601
- id: string; outcome: string
602
- }
603
- ```
604
-
605
- **AppendBroadcastBody** (interface)
606
- ```typescript
607
- interface AppendBroadcastBody {
608
- broadcastId: string
609
- userId?: string
610
- contactId?: string
611
- channel?: string
612
- timestamp?: string
613
- [k: string]: any
614
- }
615
- ```
616
-
617
- **AppendBroadcastBulkBody** (interface)
618
- ```typescript
619
- interface AppendBroadcastBulkBody {
620
- params: { broadcastId: string; [k: string]: any }
621
- ids: string[]
622
- idField?: IdField
623
- }
624
- ```
625
-
626
- **AppendResult** (interface)
627
- ```typescript
628
- interface AppendResult {
629
- success: true
630
- }
631
- ```
632
-
633
- **AppendBulkResult** (interface)
634
- ```typescript
635
- interface AppendBulkResult {
636
- success: true; count: number
637
- }
638
- ```
639
-
640
- **CreateBroadcastBody** (interface)
641
- ```typescript
642
- interface CreateBroadcastBody {
643
- appId: string
644
- data?: Record<string, any>
645
- }
646
- ```
647
-
648
- **UpdateBroadcastBody** (interface)
649
- ```typescript
650
- interface UpdateBroadcastBody {
651
- appId?: string
652
- data?: Record<string, any>
653
- }
654
- ```
655
-
656
535
  **ListBroadcastsQuery** (interface)
657
536
  ```typescript
658
537
  interface ListBroadcastsQuery {
@@ -668,11 +547,11 @@ interface BroadcastRecord {
668
547
  id: string
669
548
  collectionId: string
670
549
  appId: string
671
- templateId?: string
672
- segmentId?: string
673
- status?: 'draft' | 'scheduled' | 'sending' | 'sent' | string
674
- scheduledAt?: string
675
- sentAt?: string
550
+ templateId?: string | null
551
+ segmentId?: string | null
552
+ status?: string | null
553
+ scheduledAt?: string | null
554
+ sentAt?: string | null
676
555
  data?: {
677
556
  display?: {
678
557
  title?: string
@@ -696,8 +575,6 @@ interface BroadcastList {
696
575
  }
697
576
  ```
698
577
 
699
- **RecipientId** = `string`
700
-
701
578
  ### claimSet
702
579
 
703
580
  **ClaimCodeRef** (interface)
@@ -865,6 +742,119 @@ interface SendNotificationResponse {
865
742
  }
866
743
  ```
867
744
 
745
+ **CommunicationEvent** (interface)
746
+ ```typescript
747
+ interface CommunicationEvent {
748
+ orgId: string
749
+ sourceId?: string
750
+ userId?: string
751
+ contactId?: string
752
+ channel?: string
753
+ timestamp: string
754
+ eventType?: string
755
+ outcome?: string | null
756
+ templateId?: string | null
757
+ [k: string]: any
758
+ }
759
+ ```
760
+
761
+ **CommsQueryByUser** (interface)
762
+ ```typescript
763
+ interface CommsQueryByUser {
764
+ userId?: string
765
+ contactId?: string
766
+ from?: string
767
+ to?: string
768
+ limit?: number
769
+ }
770
+ ```
771
+
772
+ **RecipientWithOutcome** (interface)
773
+ ```typescript
774
+ interface RecipientWithOutcome {
775
+ id: string; outcome: string
776
+ }
777
+ ```
778
+
779
+ **CommsRecipientIdsQuery** (interface)
780
+ ```typescript
781
+ interface CommsRecipientIdsQuery {
782
+ sourceId: string
783
+ idField?: 'userId' | 'contactId'
784
+ from?: string
785
+ to?: string
786
+ limit?: number
787
+ }
788
+ ```
789
+
790
+ **CommsRecipientsWithoutActionQuery** (interface)
791
+ ```typescript
792
+ interface CommsRecipientsWithoutActionQuery {
793
+ sourceId: string
794
+ actionId?: string
795
+ appId?: string
796
+ idField?: 'userId' | 'contactId'
797
+ from?: string
798
+ to?: string
799
+ limit?: number
800
+ }
801
+ ```
802
+
803
+ **CommsRecipientsWithActionQuery** (interface)
804
+ ```typescript
805
+ interface CommsRecipientsWithActionQuery {
806
+ sourceId: string
807
+ actionId?: string
808
+ appId?: string
809
+ outcome?: string
810
+ idField?: 'userId' | 'contactId'
811
+ includeOutcome?: boolean
812
+ from?: string
813
+ to?: string
814
+ limit?: number
815
+ }
816
+ ```
817
+
818
+ **LogCommunicationEventBody** (interface)
819
+ ```typescript
820
+ interface LogCommunicationEventBody {
821
+ sourceId: string
822
+ userId?: string
823
+ contactId?: string
824
+ channel?: string
825
+ eventType?: string
826
+ outcome?: string
827
+ templateId?: string
828
+ timestamp?: string
829
+ [k: string]: any
830
+ }
831
+ ```
832
+
833
+ **LogBulkCommunicationEventsBody** (interface)
834
+ ```typescript
835
+ interface LogBulkCommunicationEventsBody {
836
+ params: { sourceId: string; [k: string]: any }
837
+ ids: string[]
838
+ idField?: 'userId' | 'contactId'
839
+ }
840
+ ```
841
+
842
+ **AppendResult** (interface)
843
+ ```typescript
844
+ interface AppendResult {
845
+ success: true
846
+ }
847
+ ```
848
+
849
+ **AppendBulkResult** (interface)
850
+ ```typescript
851
+ interface AppendBulkResult {
852
+ success: true; count: number
853
+ }
854
+ ```
855
+
856
+ **RecipientId** = `string`
857
+
868
858
  ### contact
869
859
 
870
860
  **ContactResponse** (interface)
@@ -1633,50 +1623,21 @@ Look up a serial number by code for a batch (admin only).
1633
1623
 
1634
1624
  ### broadcasts
1635
1625
 
1636
- **byUser**(collectionId: string,
1637
- query: BroadcastQueryByUser = {}) → `Promise<BroadcastEvent[]>`
1638
- POST /admin/collection/:collectionId/broadcasts/by-user Returns broadcast events array, newest first.
1639
-
1640
- **recipientIds**(collectionId: string,
1641
- query: RecipientIdsQuery) → `Promise<RecipientId[]>`
1642
- POST /admin/collection/:collectionId/broadcasts/recipient-ids Returns recipient IDs for a broadcast.
1643
-
1644
- **recipientsWithoutAction**(collectionId: string,
1645
- query: RecipientsWithoutActionQuery) → `Promise<RecipientId[]>`
1646
- POST /admin/collection/:collectionId/broadcasts/recipients/without-action Returns IDs who received the broadcast but did not perform an action.
1647
-
1648
- **recipientsWithAction**(collectionId: string,
1649
- query: RecipientsWithActionQuery) → `Promise<RecipientId[] | RecipientWithOutcome[]>`
1650
- POST /admin/collection/:collectionId/broadcasts/recipients/with-action Returns IDs who received the broadcast and performed an action; optionally includes outcome.
1651
-
1652
- **append**(collectionId: string,
1653
- body: AppendBroadcastBody) → `Promise<AppendResult>`
1654
- POST /admin/collection/:collectionId/broadcasts/append Appends one broadcast event.
1655
-
1656
- **appendBulk**(collectionId: string,
1657
- body: AppendBroadcastBulkBody | ({ broadcastId: string; ids: string[]; idField?: 'userId'|'contactId'; [k: string]: any }) → `void`
1658
- POST /admin/collection/:collectionId/broadcasts/append/bulk Appends many broadcast recipients. Accepts preferred body shape with params + ids, and legacy flat shape.
1659
-
1660
1626
  **create**(collectionId: string,
1661
- body: CreateBroadcastBody) → `Promise<BroadcastRecord>`
1662
- POST /admin/collection/:collectionId/broadcasts/append/bulk Appends many broadcast recipients. Accepts preferred body shape with params + ids, and legacy flat shape.
1627
+ body: Omit<BroadcastRecord, 'id' | 'collectionId' | 'createdAt'>) → `Promise<BroadcastRecord>`
1663
1628
 
1664
1629
  **list**(collectionId: string,
1665
1630
  query: ListBroadcastsQuery = {}) → `Promise<BroadcastList>`
1666
- POST /admin/collection/:collectionId/broadcasts/append/bulk Appends many broadcast recipients. Accepts preferred body shape with params + ids, and legacy flat shape.
1667
1631
 
1668
1632
  **get**(collectionId: string,
1669
1633
  id: string) → `Promise<BroadcastRecord>`
1670
- POST /admin/collection/:collectionId/broadcasts/append/bulk Appends many broadcast recipients. Accepts preferred body shape with params + ids, and legacy flat shape.
1671
1634
 
1672
1635
  **update**(collectionId: string,
1673
1636
  id: string,
1674
- body: UpdateBroadcastBody) → `Promise<BroadcastRecord>`
1675
- POST /admin/collection/:collectionId/broadcasts/append/bulk Appends many broadcast recipients. Accepts preferred body shape with params + ids, and legacy flat shape.
1637
+ body: Partial<Omit<BroadcastRecord, 'id' | 'collectionId' | 'createdAt'>>) → `Promise<BroadcastRecord>`
1676
1638
 
1677
1639
  **remove**(collectionId: string,
1678
1640
  id: string) → `Promise<void>`
1679
- POST /admin/collection/:collectionId/broadcasts/append/bulk Appends many broadcast recipients. Accepts preferred body shape with params + ids, and legacy flat shape.
1680
1641
 
1681
1642
  ### claimSet
1682
1643
 
@@ -1762,6 +1723,30 @@ Assign a value to a serial number for a collection (admin only).
1762
1723
  request: SendNotificationRequest) → `Promise<SendNotificationResponse>`
1763
1724
  Send a notification to specified targets within a collection. Supports multiple delivery methods including push notifications, email, and wallet pass updates. The notification will be delivered based on user preferences and the specified delivery mode. ```typescript const result = await comms.sendNotification('my-collection', { subjectTargets: [{ type: 'product', id: 'prod_123' }], severity: 'important', mode: 'preferred', template: { push: { title: 'Update available', body: 'We\'ve shipped an important update.', icon: 'https://cdn.example.com/brand/logo-128.png' }, email: { subject: 'Important update for your product', body: 'There\'s an important update. Open your pass or profile to learn more.' }, walletUpdate: { textModulesData: [ { id: 'notice', header: 'Update', body: 'Open your wallet pass for details.' } ] } } }) if (result.ok) { console.log('Notification queued:', result.notificationId) console.log('Totals:', result.status.totals) } ```
1764
1725
 
1726
+ **queryByUser**(collectionId: string,
1727
+ body: CommsQueryByUser = {}) → `Promise<CommunicationEvent[]>`
1728
+ Analytics: Query communication events by user or contact. POST /admin/collection/:collectionId/comm/query/by-user
1729
+
1730
+ **queryRecipientIds**(collectionId: string,
1731
+ body: CommsRecipientIdsQuery) → `Promise<RecipientId[]>`
1732
+ Analytics: Recipient IDs for a communication source. POST /admin/collection/:collectionId/comm/query/recipient-ids
1733
+
1734
+ **queryRecipientsWithoutAction**(collectionId: string,
1735
+ body: CommsRecipientsWithoutActionQuery) → `Promise<RecipientId[]>`
1736
+ Analytics: Recipients who did not perform an action. POST /admin/collection/:collectionId/comm/query/recipients/without-action
1737
+
1738
+ **queryRecipientsWithAction**(collectionId: string,
1739
+ body: CommsRecipientsWithActionQuery) → `Promise<RecipientId[] | RecipientWithOutcome[]>`
1740
+ Analytics: Recipients who performed an action, optionally with outcome. POST /admin/collection/:collectionId/comm/query/recipients/with-action
1741
+
1742
+ **logCommunicationEvent**(collectionId: string,
1743
+ body: LogCommunicationEventBody) → `Promise<AppendResult>`
1744
+ Logging: Append a single communication event. POST /admin/collection/:collectionId/comm/log
1745
+
1746
+ **logBulkCommunicationEvents**(collectionId: string,
1747
+ body: LogBulkCommunicationEventsBody | ({ sourceId: string; ids: string[]; idField?: 'userId'|'contactId'; [k: string]: any }) → `void`
1748
+ Logging: Append many communication events for a list of IDs. POST /admin/collection/:collectionId/comm/log/bulk
1749
+
1765
1750
  ### contact
1766
1751
 
1767
1752
  **create**(collectionId: string, data: ContactCreateRequest) → `Promise<ContactResponse>`
@@ -1,44 +1,8 @@
1
- import type { BroadcastQueryByUser, RecipientIdsQuery, RecipientsWithoutActionQuery, RecipientsWithActionQuery, AppendBroadcastBody, AppendBroadcastBulkBody, BroadcastEvent, RecipientId, RecipientWithOutcome, AppendResult, AppendBulkResult, CreateBroadcastBody, UpdateBroadcastBody, ListBroadcastsQuery, BroadcastRecord, BroadcastList } from "../types/broadcasts";
1
+ import type { ListBroadcastsQuery, BroadcastRecord, BroadcastList } from "../types/broadcasts";
2
2
  export declare namespace broadcasts {
3
- /**
4
- * POST /admin/collection/:collectionId/broadcasts/by-user
5
- * Returns broadcast events array, newest first.
6
- */
7
- function byUser(collectionId: string, query?: BroadcastQueryByUser): Promise<BroadcastEvent[]>;
8
- /**
9
- * POST /admin/collection/:collectionId/broadcasts/recipient-ids
10
- * Returns recipient IDs for a broadcast.
11
- */
12
- function recipientIds(collectionId: string, query: RecipientIdsQuery): Promise<RecipientId[]>;
13
- /**
14
- * POST /admin/collection/:collectionId/broadcasts/recipients/without-action
15
- * Returns IDs who received the broadcast but did not perform an action.
16
- */
17
- function recipientsWithoutAction(collectionId: string, query: RecipientsWithoutActionQuery): Promise<RecipientId[]>;
18
- /**
19
- * POST /admin/collection/:collectionId/broadcasts/recipients/with-action
20
- * Returns IDs who received the broadcast and performed an action; optionally includes outcome.
21
- */
22
- function recipientsWithAction(collectionId: string, query: RecipientsWithActionQuery): Promise<RecipientId[] | RecipientWithOutcome[]>;
23
- /**
24
- * POST /admin/collection/:collectionId/broadcasts/append
25
- * Appends one broadcast event.
26
- */
27
- function append(collectionId: string, body: AppendBroadcastBody): Promise<AppendResult>;
28
- /**
29
- * POST /admin/collection/:collectionId/broadcasts/append/bulk
30
- * Appends many broadcast recipients.
31
- * Accepts preferred body shape with params + ids, and legacy flat shape.
32
- */
33
- function appendBulk(collectionId: string, body: AppendBroadcastBulkBody | ({
34
- broadcastId: string;
35
- ids: string[];
36
- idField?: 'userId' | 'contactId';
37
- [k: string]: any;
38
- })): Promise<AppendBulkResult>;
39
- function create(collectionId: string, body: CreateBroadcastBody): Promise<BroadcastRecord>;
3
+ function create(collectionId: string, body: Omit<BroadcastRecord, 'id' | 'collectionId' | 'createdAt'>): Promise<BroadcastRecord>;
40
4
  function list(collectionId: string, query?: ListBroadcastsQuery): Promise<BroadcastList>;
41
5
  function get(collectionId: string, id: string): Promise<BroadcastRecord>;
42
- function update(collectionId: string, id: string, body: UpdateBroadcastBody): Promise<BroadcastRecord>;
6
+ function update(collectionId: string, id: string, body: Partial<Omit<BroadcastRecord, 'id' | 'collectionId' | 'createdAt'>>): Promise<BroadcastRecord>;
43
7
  function remove(collectionId: string, id: string): Promise<void>;
44
8
  }
@@ -17,61 +17,6 @@ function encodeQuery(params) {
17
17
  }
18
18
  export var broadcasts;
19
19
  (function (broadcasts) {
20
- /**
21
- * POST /admin/collection/:collectionId/broadcasts/by-user
22
- * Returns broadcast events array, newest first.
23
- */
24
- async function byUser(collectionId, query = {}) {
25
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/by-user`;
26
- return post(path, query);
27
- }
28
- broadcasts.byUser = byUser;
29
- /**
30
- * POST /admin/collection/:collectionId/broadcasts/recipient-ids
31
- * Returns recipient IDs for a broadcast.
32
- */
33
- async function recipientIds(collectionId, query) {
34
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/recipient-ids`;
35
- return post(path, query);
36
- }
37
- broadcasts.recipientIds = recipientIds;
38
- /**
39
- * POST /admin/collection/:collectionId/broadcasts/recipients/without-action
40
- * Returns IDs who received the broadcast but did not perform an action.
41
- */
42
- async function recipientsWithoutAction(collectionId, query) {
43
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/recipients/without-action`;
44
- return post(path, query);
45
- }
46
- broadcasts.recipientsWithoutAction = recipientsWithoutAction;
47
- /**
48
- * POST /admin/collection/:collectionId/broadcasts/recipients/with-action
49
- * Returns IDs who received the broadcast and performed an action; optionally includes outcome.
50
- */
51
- async function recipientsWithAction(collectionId, query) {
52
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/recipients/with-action`;
53
- return post(path, query);
54
- }
55
- broadcasts.recipientsWithAction = recipientsWithAction;
56
- /**
57
- * POST /admin/collection/:collectionId/broadcasts/append
58
- * Appends one broadcast event.
59
- */
60
- async function append(collectionId, body) {
61
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/append`;
62
- return post(path, body);
63
- }
64
- broadcasts.append = append;
65
- /**
66
- * POST /admin/collection/:collectionId/broadcasts/append/bulk
67
- * Appends many broadcast recipients.
68
- * Accepts preferred body shape with params + ids, and legacy flat shape.
69
- */
70
- async function appendBulk(collectionId, body) {
71
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/append/bulk`;
72
- return post(path, body);
73
- }
74
- broadcasts.appendBulk = appendBulk;
75
20
  // CRUD: Create broadcast
76
21
  async function create(collectionId, body) {
77
22
  const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/`;
@@ -1,4 +1,4 @@
1
- import type { SendNotificationRequest, SendNotificationResponse } from "../types/comms";
1
+ import type { SendNotificationRequest, SendNotificationResponse, CommunicationEvent, CommsQueryByUser, CommsRecipientIdsQuery, CommsRecipientsWithoutActionQuery, CommsRecipientsWithActionQuery, RecipientId, RecipientWithOutcome, LogCommunicationEventBody, LogBulkCommunicationEventsBody, AppendResult, AppendBulkResult } from "../types/comms";
2
2
  /**
3
3
  * Communications namespace for sending notifications and managing user communications
4
4
  */
@@ -44,4 +44,39 @@ export declare namespace comms {
44
44
  * ```
45
45
  */
46
46
  function sendNotification(collectionId: string, request: SendNotificationRequest): Promise<SendNotificationResponse>;
47
+ /**
48
+ * Analytics: Query communication events by user or contact.
49
+ * POST /admin/collection/:collectionId/comm/query/by-user
50
+ */
51
+ function queryByUser(collectionId: string, body?: CommsQueryByUser): Promise<CommunicationEvent[]>;
52
+ /**
53
+ * Analytics: Recipient IDs for a communication source.
54
+ * POST /admin/collection/:collectionId/comm/query/recipient-ids
55
+ */
56
+ function queryRecipientIds(collectionId: string, body: CommsRecipientIdsQuery): Promise<RecipientId[]>;
57
+ /**
58
+ * Analytics: Recipients who did not perform an action.
59
+ * POST /admin/collection/:collectionId/comm/query/recipients/without-action
60
+ */
61
+ function queryRecipientsWithoutAction(collectionId: string, body: CommsRecipientsWithoutActionQuery): Promise<RecipientId[]>;
62
+ /**
63
+ * Analytics: Recipients who performed an action, optionally with outcome.
64
+ * POST /admin/collection/:collectionId/comm/query/recipients/with-action
65
+ */
66
+ function queryRecipientsWithAction(collectionId: string, body: CommsRecipientsWithActionQuery): Promise<RecipientId[] | RecipientWithOutcome[]>;
67
+ /**
68
+ * Logging: Append a single communication event.
69
+ * POST /admin/collection/:collectionId/comm/log
70
+ */
71
+ function logCommunicationEvent(collectionId: string, body: LogCommunicationEventBody): Promise<AppendResult>;
72
+ /**
73
+ * Logging: Append many communication events for a list of IDs.
74
+ * POST /admin/collection/:collectionId/comm/log/bulk
75
+ */
76
+ function logBulkCommunicationEvents(collectionId: string, body: LogBulkCommunicationEventsBody | ({
77
+ sourceId: string;
78
+ ids: string[];
79
+ idField?: 'userId' | 'contactId';
80
+ [k: string]: any;
81
+ })): Promise<AppendBulkResult>;
47
82
  }
package/dist/api/comms.js CHANGED
@@ -51,4 +51,58 @@ export var comms;
51
51
  return post(path, request);
52
52
  }
53
53
  comms.sendNotification = sendNotification;
54
+ /**
55
+ * Analytics: Query communication events by user or contact.
56
+ * POST /admin/collection/:collectionId/comm/query/by-user
57
+ */
58
+ async function queryByUser(collectionId, body = {}) {
59
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/query/by-user`;
60
+ return post(path, body);
61
+ }
62
+ comms.queryByUser = queryByUser;
63
+ /**
64
+ * Analytics: Recipient IDs for a communication source.
65
+ * POST /admin/collection/:collectionId/comm/query/recipient-ids
66
+ */
67
+ async function queryRecipientIds(collectionId, body) {
68
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/query/recipient-ids`;
69
+ return post(path, body);
70
+ }
71
+ comms.queryRecipientIds = queryRecipientIds;
72
+ /**
73
+ * Analytics: Recipients who did not perform an action.
74
+ * POST /admin/collection/:collectionId/comm/query/recipients/without-action
75
+ */
76
+ async function queryRecipientsWithoutAction(collectionId, body) {
77
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/query/recipients/without-action`;
78
+ return post(path, body);
79
+ }
80
+ comms.queryRecipientsWithoutAction = queryRecipientsWithoutAction;
81
+ /**
82
+ * Analytics: Recipients who performed an action, optionally with outcome.
83
+ * POST /admin/collection/:collectionId/comm/query/recipients/with-action
84
+ */
85
+ async function queryRecipientsWithAction(collectionId, body) {
86
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/query/recipients/with-action`;
87
+ return post(path, body);
88
+ }
89
+ comms.queryRecipientsWithAction = queryRecipientsWithAction;
90
+ /**
91
+ * Logging: Append a single communication event.
92
+ * POST /admin/collection/:collectionId/comm/log
93
+ */
94
+ async function logCommunicationEvent(collectionId, body) {
95
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/log`;
96
+ return post(path, body);
97
+ }
98
+ comms.logCommunicationEvent = logCommunicationEvent;
99
+ /**
100
+ * Logging: Append many communication events for a list of IDs.
101
+ * POST /admin/collection/:collectionId/comm/log/bulk
102
+ */
103
+ async function logBulkCommunicationEvents(collectionId, body) {
104
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/log/bulk`;
105
+ return post(path, body);
106
+ }
107
+ comms.logBulkCommunicationEvents = logBulkCommunicationEvents;
54
108
  })(comms || (comms = {}));
@@ -1,83 +1,3 @@
1
- import type { IdField } from './common';
2
- export interface BroadcastEvent {
3
- orgId: string;
4
- broadcastId: string;
5
- userId?: string;
6
- contactId?: string;
7
- channel?: string;
8
- timestamp: string;
9
- [k: string]: any;
10
- }
11
- export interface BroadcastQueryByUser {
12
- userId?: string;
13
- contactId?: string;
14
- from?: string;
15
- to?: string;
16
- limit?: number;
17
- }
18
- export interface RecipientIdsQuery {
19
- broadcastId: string;
20
- idField?: IdField;
21
- from?: string;
22
- to?: string;
23
- limit?: number;
24
- }
25
- export interface RecipientsWithoutActionQuery {
26
- broadcastId: string;
27
- actionId?: string;
28
- appId?: string;
29
- idField?: IdField;
30
- from?: string;
31
- to?: string;
32
- limit?: number;
33
- }
34
- export interface RecipientsWithActionQuery {
35
- broadcastId: string;
36
- actionId?: string;
37
- appId?: string;
38
- outcome?: string;
39
- idField?: IdField;
40
- includeOutcome?: boolean;
41
- from?: string;
42
- to?: string;
43
- limit?: number;
44
- }
45
- export type RecipientId = string;
46
- export interface RecipientWithOutcome {
47
- id: string;
48
- outcome: string;
49
- }
50
- export interface AppendBroadcastBody {
51
- broadcastId: string;
52
- userId?: string;
53
- contactId?: string;
54
- channel?: string;
55
- timestamp?: string;
56
- [k: string]: any;
57
- }
58
- export interface AppendBroadcastBulkBody {
59
- params: {
60
- broadcastId: string;
61
- [k: string]: any;
62
- };
63
- ids: string[];
64
- idField?: IdField;
65
- }
66
- export interface AppendResult {
67
- success: true;
68
- }
69
- export interface AppendBulkResult {
70
- success: true;
71
- count: number;
72
- }
73
- export interface CreateBroadcastBody {
74
- appId: string;
75
- data?: Record<string, any>;
76
- }
77
- export interface UpdateBroadcastBody {
78
- appId?: string;
79
- data?: Record<string, any>;
80
- }
81
1
  export interface ListBroadcastsQuery {
82
2
  limit?: number;
83
3
  offset?: number;
@@ -87,11 +7,11 @@ export interface BroadcastRecord {
87
7
  id: string;
88
8
  collectionId: string;
89
9
  appId: string;
90
- templateId?: string;
91
- segmentId?: string;
92
- status?: 'draft' | 'scheduled' | 'sending' | 'sent' | string;
93
- scheduledAt?: string;
94
- sentAt?: string;
10
+ templateId?: string | null;
11
+ segmentId?: string | null;
12
+ status?: string | null;
13
+ scheduledAt?: string | null;
14
+ sentAt?: string | null;
95
15
  data?: {
96
16
  display?: {
97
17
  title?: string;
@@ -104,3 +104,80 @@ export interface SendNotificationResponse {
104
104
  };
105
105
  };
106
106
  }
107
+ export interface CommunicationEvent {
108
+ orgId: string;
109
+ sourceId?: string;
110
+ userId?: string;
111
+ contactId?: string;
112
+ channel?: string;
113
+ timestamp: string;
114
+ eventType?: string;
115
+ outcome?: string | null;
116
+ templateId?: string | null;
117
+ [k: string]: any;
118
+ }
119
+ export interface CommsQueryByUser {
120
+ userId?: string;
121
+ contactId?: string;
122
+ from?: string;
123
+ to?: string;
124
+ limit?: number;
125
+ }
126
+ export type RecipientId = string;
127
+ export interface RecipientWithOutcome {
128
+ id: string;
129
+ outcome: string;
130
+ }
131
+ export interface CommsRecipientIdsQuery {
132
+ sourceId: string;
133
+ idField?: 'userId' | 'contactId';
134
+ from?: string;
135
+ to?: string;
136
+ limit?: number;
137
+ }
138
+ export interface CommsRecipientsWithoutActionQuery {
139
+ sourceId: string;
140
+ actionId?: string;
141
+ appId?: string;
142
+ idField?: 'userId' | 'contactId';
143
+ from?: string;
144
+ to?: string;
145
+ limit?: number;
146
+ }
147
+ export interface CommsRecipientsWithActionQuery {
148
+ sourceId: string;
149
+ actionId?: string;
150
+ appId?: string;
151
+ outcome?: string;
152
+ idField?: 'userId' | 'contactId';
153
+ includeOutcome?: boolean;
154
+ from?: string;
155
+ to?: string;
156
+ limit?: number;
157
+ }
158
+ export interface LogCommunicationEventBody {
159
+ sourceId: string;
160
+ userId?: string;
161
+ contactId?: string;
162
+ channel?: string;
163
+ eventType?: string;
164
+ outcome?: string;
165
+ templateId?: string;
166
+ timestamp?: string;
167
+ [k: string]: any;
168
+ }
169
+ export interface LogBulkCommunicationEventsBody {
170
+ params: {
171
+ sourceId: string;
172
+ [k: string]: any;
173
+ };
174
+ ids: string[];
175
+ idField?: 'userId' | 'contactId';
176
+ }
177
+ export interface AppendResult {
178
+ success: true;
179
+ }
180
+ export interface AppendBulkResult {
181
+ success: true;
182
+ count: number;
183
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",