@proveanything/smartlinks 1.0.40 → 1.0.42

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.0.40 | Generated: 2025-11-09T13:05:52.500Z
3
+ Version: 1.0.42 | Generated: 2025-11-18T13:09:06.423Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -17,6 +17,7 @@ The Smartlinks SDK is organized into the following namespaces:
17
17
  - **batch** - Product batch management and tracking
18
18
  - **claimSet** - Claim creation, management, and verification
19
19
  - **collection** - Collection CRUD operations and management
20
+ - **comms** - Functions for comms operations
20
21
  - **crate** - Container/crate management for organizing products
21
22
  - **form** - Dynamic form creation and submission
22
23
  - **product** - Product CRUD operations and management within collections
@@ -221,6 +222,92 @@ interface CollectionResponse {
221
222
  }
222
223
  ```
223
224
 
225
+ ### comms
226
+
227
+ **NotificationSubjectTarget** (interface)
228
+ ```typescript
229
+ interface NotificationSubjectTarget {
230
+ type: 'product' | 'collection' | 'user' | 'batch' | 'proof'
231
+ id: string
232
+ }
233
+ ```
234
+
235
+ **PushNotificationTemplate** (interface)
236
+ ```typescript
237
+ interface PushNotificationTemplate {
238
+ title: string
239
+ body: string
240
+ icon?: string
241
+ }
242
+ ```
243
+
244
+ **EmailNotificationTemplate** (interface)
245
+ ```typescript
246
+ interface EmailNotificationTemplate {
247
+ subject: string
248
+ body: string
249
+ }
250
+ ```
251
+
252
+ **WalletUpdateTemplate** (interface)
253
+ ```typescript
254
+ interface WalletUpdateTemplate {
255
+ textModulesData?: Array<{
256
+ id: string
257
+ header: string
258
+ body: string
259
+ }>
260
+ }
261
+ ```
262
+
263
+ **NotificationTemplate** (interface)
264
+ ```typescript
265
+ interface NotificationTemplate {
266
+ push?: PushNotificationTemplate
267
+ email?: EmailNotificationTemplate
268
+ walletUpdate?: WalletUpdateTemplate
269
+ }
270
+ ```
271
+
272
+ **SendNotificationRequest** (interface)
273
+ ```typescript
274
+ interface SendNotificationRequest {
275
+ subjectTargets: NotificationSubjectTarget[]
276
+ severity: 'low' | 'normal' | 'important' | 'critical'
277
+ mode: 'preferred' | 'all'
278
+ channels : ("push" | "email" | "wallet")[]
279
+ template: NotificationTemplate
280
+ }
281
+ ```
282
+
283
+ **SendNotificationResponse** (interface)
284
+ ```typescript
285
+ interface SendNotificationResponse {
286
+ ok: boolean
287
+ notificationId: string
288
+ counts: {
289
+ contacts: number
290
+ attempts: number
291
+ }
292
+ status: {
293
+ notification: {
294
+ notificationId: string
295
+ state: 'queued' | 'sent' | 'failed' | 'confirmed' | string
296
+ subjectTargets: NotificationSubjectTarget[]
297
+ severity: 'low' | 'normal' | 'important' | 'critical' | string
298
+ channelsOverride: Record<string, any>
299
+ template: NotificationTemplate
300
+ }
301
+ totals: {
302
+ queued: number
303
+ sent: number
304
+ failed: number
305
+ confirmed: number
306
+ }
307
+ }
308
+ }
309
+ ```
310
+
224
311
  ### error
225
312
 
226
313
  **ErrorResponse** (interface)
@@ -678,6 +765,12 @@ Look up a serial number by code for a collection (admin only).
678
765
  value: any) → `Promise<any>`
679
766
  Assign a value to a serial number for a collection (admin only).
680
767
 
768
+ ### comms
769
+
770
+ **sendNotification**(collectionId: string,
771
+ request: SendNotificationRequest) → `Promise<SendNotificationResponse>`
772
+ 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) } ```
773
+
681
774
  ### crate
682
775
 
683
776
  **get**(collectionId: string, crateId: string) → `Promise<any>`
@@ -752,10 +845,12 @@ Look up a serial number by code for a product (admin only).
752
845
  **get**(collectionId: string,
753
846
  productId: string,
754
847
  proofId: string,
755
- admin?: boolean) → `Promise<ProofResponse>`
848
+ admin?: boolean,
849
+ include?: string[]) → `Promise<ProofResponse>`
756
850
  Retrieves a single Proof by Collection ID, Product ID, and Proof ID. Both public and admin endpoints now include productId in the path.
757
851
 
758
- **list**(collectionId: string) → `Promise<ProofResponse[]>`
852
+ **list**(collectionId: string,
853
+ include?: string[]) → `Promise<ProofResponse[]>`
759
854
  List all Proofs for a Collection.
760
855
 
761
856
  **create**(collectionId: string,
@@ -0,0 +1,47 @@
1
+ import type { SendNotificationRequest, SendNotificationResponse } from "../types/comms";
2
+ /**
3
+ * Communications namespace for sending notifications and managing user communications
4
+ */
5
+ export declare namespace comms {
6
+ /**
7
+ * Send a notification to specified targets within a collection.
8
+ *
9
+ * Supports multiple delivery methods including push notifications, email, and wallet pass updates.
10
+ * The notification will be delivered based on user preferences and the specified delivery mode.
11
+ *
12
+ * @param collectionId - ID of the collection containing the notification targets
13
+ * @param request - Notification configuration including targets, severity, and content templates
14
+ * @returns Promise resolving to the notification enqueue/queue status and totals
15
+ * @throws ErrorResponse if the request fails or targets are invalid
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const result = await comms.sendNotification('my-collection', {
20
+ * subjectTargets: [{ type: 'product', id: 'prod_123' }],
21
+ * severity: 'important',
22
+ * mode: 'preferred',
23
+ * template: {
24
+ * push: {
25
+ * title: 'Update available',
26
+ * body: 'We\'ve shipped an important update.',
27
+ * icon: 'https://cdn.example.com/brand/logo-128.png'
28
+ * },
29
+ * email: {
30
+ * subject: 'Important update for your product',
31
+ * body: 'There\'s an important update. Open your pass or profile to learn more.'
32
+ * },
33
+ * walletUpdate: {
34
+ * textModulesData: [
35
+ * { id: 'notice', header: 'Update', body: 'Open your wallet pass for details.' }
36
+ * ]
37
+ * }
38
+ * }
39
+ * })
40
+ * if (result.ok) {
41
+ * console.log('Notification queued:', result.notificationId)
42
+ * console.log('Totals:', result.status.totals)
43
+ * }
44
+ * ```
45
+ */
46
+ function sendNotification(collectionId: string, request: SendNotificationRequest): Promise<SendNotificationResponse>;
47
+ }
@@ -0,0 +1,54 @@
1
+ // src/api/comms.ts
2
+ // Communications and notifications API for Smartlinks
3
+ import { post } from "../http";
4
+ /**
5
+ * Communications namespace for sending notifications and managing user communications
6
+ */
7
+ export var comms;
8
+ (function (comms) {
9
+ /**
10
+ * Send a notification to specified targets within a collection.
11
+ *
12
+ * Supports multiple delivery methods including push notifications, email, and wallet pass updates.
13
+ * The notification will be delivered based on user preferences and the specified delivery mode.
14
+ *
15
+ * @param collectionId - ID of the collection containing the notification targets
16
+ * @param request - Notification configuration including targets, severity, and content templates
17
+ * @returns Promise resolving to the notification enqueue/queue status and totals
18
+ * @throws ErrorResponse if the request fails or targets are invalid
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const result = await comms.sendNotification('my-collection', {
23
+ * subjectTargets: [{ type: 'product', id: 'prod_123' }],
24
+ * severity: 'important',
25
+ * mode: 'preferred',
26
+ * template: {
27
+ * push: {
28
+ * title: 'Update available',
29
+ * body: 'We\'ve shipped an important update.',
30
+ * icon: 'https://cdn.example.com/brand/logo-128.png'
31
+ * },
32
+ * email: {
33
+ * subject: 'Important update for your product',
34
+ * body: 'There\'s an important update. Open your pass or profile to learn more.'
35
+ * },
36
+ * walletUpdate: {
37
+ * textModulesData: [
38
+ * { id: 'notice', header: 'Update', body: 'Open your wallet pass for details.' }
39
+ * ]
40
+ * }
41
+ * }
42
+ * })
43
+ * if (result.ok) {
44
+ * console.log('Notification queued:', result.notificationId)
45
+ * console.log('Totals:', result.status.totals)
46
+ * }
47
+ * ```
48
+ */
49
+ async function sendNotification(collectionId, request) {
50
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/notify`;
51
+ return post(path, request);
52
+ }
53
+ comms.sendNotification = sendNotification;
54
+ })(comms || (comms = {}));
@@ -12,4 +12,5 @@ export { crate } from "./crate";
12
12
  export { batch } from "./batch";
13
13
  export { variant } from "./variant";
14
14
  export { ai } from "./ai";
15
+ export { comms } from "./comms";
15
16
  export type { AIGenerateContentRequest, AIGenerateImageRequest, AISearchPhotosRequest, AISearchPhotosPhoto } from "./ai";
package/dist/api/index.js CHANGED
@@ -14,3 +14,4 @@ export { crate } from "./crate";
14
14
  export { batch } from "./batch";
15
15
  export { variant } from "./variant";
16
16
  export { ai } from "./ai";
17
+ export { comms } from "./comms";
@@ -4,11 +4,11 @@ export declare namespace proof {
4
4
  * Retrieves a single Proof by Collection ID, Product ID, and Proof ID.
5
5
  * Both public and admin endpoints now include productId in the path.
6
6
  */
7
- function get(collectionId: string, productId: string, proofId: string, admin?: boolean): Promise<ProofResponse>;
7
+ function get(collectionId: string, productId: string, proofId: string, admin?: boolean, include?: string[]): Promise<ProofResponse>;
8
8
  /**
9
9
  * List all Proofs for a Collection.
10
10
  */
11
- function list(collectionId: string): Promise<ProofResponse[]>;
11
+ function list(collectionId: string, include?: string[]): Promise<ProofResponse[]>;
12
12
  /**
13
13
  * Create a proof for a product (admin only).
14
14
  * POST /admin/collection/:collectionId/product/:productId/proof
package/dist/api/proof.js CHANGED
@@ -6,17 +6,19 @@ export var proof;
6
6
  * Retrieves a single Proof by Collection ID, Product ID, and Proof ID.
7
7
  * Both public and admin endpoints now include productId in the path.
8
8
  */
9
- async function get(collectionId, productId, proofId, admin) {
9
+ async function get(collectionId, productId, proofId, admin, include) {
10
10
  const base = admin ? '/admin' : '/public';
11
- const path = `${base}/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}`;
11
+ const qp = include && include.length ? `?include=${encodeURIComponent(include.join(','))}` : '';
12
+ const path = `${base}/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}${qp}`;
12
13
  return request(path);
13
14
  }
14
15
  proof.get = get;
15
16
  /**
16
17
  * List all Proofs for a Collection.
17
18
  */
18
- async function list(collectionId) {
19
- const path = `/public/collection/${encodeURIComponent(collectionId)}/proof`;
19
+ async function list(collectionId, include) {
20
+ const qp = include && include.length ? `?include=${encodeURIComponent(include.join(','))}` : '';
21
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/proof${qp}`;
20
22
  return request(path);
21
23
  }
22
24
  proof.list = list;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from "./api";
3
3
  export * from "./types";
4
4
  export type { LoginResponse, VerifyTokenResponse, AccountInfoResponse, } from "./api/auth";
5
5
  export type { UserAccountRegistrationRequest, } from "./types/auth";
6
+ export type { SendNotificationRequest, SendNotificationResponse, NotificationSubjectTarget, NotificationTemplate, PushNotificationTemplate, EmailNotificationTemplate, WalletUpdateTemplate, } from "./types/comms";
6
7
  export type { AttestationResponse, AttestationCreateRequest, AttestationUpdateRequest, } from "./types/attestation";
7
8
  export type { BatchResponse, BatchCreateRequest, BatchUpdateRequest, } from "./types/batch";
8
9
  export type { VariantResponse, VariantCreateRequest, VariantUpdateRequest, } from "./types/variant";
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Target subject for notifications (product, collection, etc.)
3
+ */
4
+ export interface NotificationSubjectTarget {
5
+ /** Type of target entity */
6
+ type: 'product' | 'collection' | 'user' | 'batch' | 'proof';
7
+ /** ID of the target entity */
8
+ id: string;
9
+ }
10
+ /**
11
+ * Push notification template content
12
+ */
13
+ export interface PushNotificationTemplate {
14
+ /** Notification title */
15
+ title: string;
16
+ /** Notification body text */
17
+ body: string;
18
+ /** Optional icon URL for the notification */
19
+ icon?: string;
20
+ }
21
+ /**
22
+ * Email notification template content
23
+ */
24
+ export interface EmailNotificationTemplate {
25
+ /** Email subject line */
26
+ subject: string;
27
+ /** Email body content (plain text or HTML) */
28
+ body: string;
29
+ }
30
+ /**
31
+ * Wallet pass update template content
32
+ */
33
+ export interface WalletUpdateTemplate {
34
+ /** Text modules to update in the wallet pass */
35
+ textModulesData?: Array<{
36
+ /** Module ID */
37
+ id: string;
38
+ /** Module header text */
39
+ header: string;
40
+ /** Module body text */
41
+ body: string;
42
+ }>;
43
+ }
44
+ /**
45
+ * Notification template containing different delivery methods
46
+ */
47
+ export interface NotificationTemplate {
48
+ /** Push notification content */
49
+ push?: PushNotificationTemplate;
50
+ /** Email notification content */
51
+ email?: EmailNotificationTemplate;
52
+ /** Wallet pass update content */
53
+ walletUpdate?: WalletUpdateTemplate;
54
+ }
55
+ /**
56
+ * Request payload for sending notifications
57
+ */
58
+ export interface SendNotificationRequest {
59
+ /** Target subjects that should receive the notification */
60
+ subjectTargets: NotificationSubjectTarget[];
61
+ /** Severity level of the notification */
62
+ severity: 'low' | 'normal' | 'important' | 'critical';
63
+ /** Delivery chanell mode preference */
64
+ mode: 'preferred' | 'all';
65
+ /** Specific channels to use for delivery */
66
+ channels: ("push" | "email" | "wallet")[];
67
+ /** Notification content templates for different delivery methods */
68
+ template: NotificationTemplate;
69
+ }
70
+ /**
71
+ * Response from sending notifications
72
+ */
73
+ export interface SendNotificationResponse {
74
+ /** Whether the request was accepted */
75
+ ok: boolean;
76
+ /** Unique ID for this notification */
77
+ notificationId: string;
78
+ /** Basic counts for contacts and attempts */
79
+ counts: {
80
+ contacts: number;
81
+ attempts: number;
82
+ };
83
+ /** Detailed status for the notification */
84
+ status: {
85
+ notification: {
86
+ /** The notification ID (repeated for convenience) */
87
+ notificationId: string;
88
+ /** Current processing state */
89
+ state: 'queued' | 'sent' | 'failed' | 'confirmed' | string;
90
+ /** Targets this notification refers to */
91
+ subjectTargets: NotificationSubjectTarget[];
92
+ /** Severity of this notification */
93
+ severity: 'low' | 'normal' | 'important' | 'critical' | string;
94
+ /** Optional channel overrides used when sending */
95
+ channelsOverride: Record<string, any>;
96
+ /** The effective template used */
97
+ template: NotificationTemplate;
98
+ };
99
+ /** Totals across all contacts */
100
+ totals: {
101
+ queued: number;
102
+ sent: number;
103
+ failed: number;
104
+ confirmed: number;
105
+ };
106
+ };
107
+ }
@@ -0,0 +1,3 @@
1
+ // src/types/comms.ts
2
+ // Communication and notification types for the Smartlinks API
3
+ export {};
@@ -8,3 +8,4 @@ export * from "./batch";
8
8
  export * from "./variant";
9
9
  export * from "./claimSet";
10
10
  export * from "./auth";
11
+ export * from "./comms";
@@ -10,3 +10,4 @@ export * from "./batch";
10
10
  export * from "./variant";
11
11
  export * from "./claimSet";
12
12
  export * from "./auth";
13
+ export * from "./comms";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.0.40",
3
+ "version": "1.0.42",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",