@proveanything/smartlinks 1.1.12 → 1.1.13

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.12 | Generated: 2025-12-28T18:01:35.628Z
3
+ Version: 1.1.13 | Generated: 2025-12-28T23:26:13.738Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -47,6 +47,7 @@ The Smartlinks SDK is organized into the following namespaces:
47
47
 
48
48
  — Other —
49
49
  - **attestation** - Functions for attestation operations
50
+ - **journeysAnalytics** - Functions for journeysAnalytics operations
50
51
  - **location** - Functions for location operations
51
52
  - **template** - Functions for template operations
52
53
 
@@ -601,6 +602,7 @@ interface RecipientWithOutcome {
601
602
  interface CommsRecipientIdsQuery {
602
603
  broadcastId?: string
603
604
  journeyId?: string
605
+ journeyStepId?: string
604
606
  idField?: IdField
605
607
  from?: string
606
608
  to?: string
@@ -1054,6 +1056,73 @@ interface UpdateJourneyBody {
1054
1056
  }
1055
1057
  ```
1056
1058
 
1059
+ ### journeysAnalytics
1060
+
1061
+ **JourneyStatsRequest** (interface)
1062
+ ```typescript
1063
+ interface JourneyStatsRequest {
1064
+ idField?: IdField // 'userId' | 'contactId'
1065
+ from?: string
1066
+ to?: string
1067
+ finalStepId?: string
1068
+ stepMappings?: Array<{ stepId: string; interactionId?: string; outcome?: string }>
1069
+ }
1070
+ ```
1071
+
1072
+ **JourneyStatsResponse** (interface)
1073
+ ```typescript
1074
+ interface JourneyStatsResponse {
1075
+ journeyId: string
1076
+ totalEntered: number
1077
+ currentlyActive?: number
1078
+ completed?: number
1079
+ exitedViaGoal?: number
1080
+ lastUpdated: string
1081
+ stepStats: Array<{ stepId: string; entered: number; completed: number; pending: number }>
1082
+ }
1083
+ ```
1084
+
1085
+ **JourneyStepRecipientsRequest** (interface)
1086
+ ```typescript
1087
+ interface JourneyStepRecipientsRequest {
1088
+ status?: 'entered' | 'completed' | 'pending'
1089
+ idField?: IdField
1090
+ interactionId?: string
1091
+ outcome?: string
1092
+ from?: string
1093
+ to?: string
1094
+ limit?: number
1095
+ }
1096
+ ```
1097
+
1098
+ **JourneyFunnelReportRequest** (interface)
1099
+ ```typescript
1100
+ interface JourneyFunnelReportRequest {
1101
+ idField?: IdField
1102
+ periodStart?: string
1103
+ periodEnd?: string
1104
+ stepMappings: Array<{ stepId: string; interactionId?: string; outcome?: string }>
1105
+ }
1106
+ ```
1107
+
1108
+ **JourneyFunnelReportResponse** (interface)
1109
+ ```typescript
1110
+ interface JourneyFunnelReportResponse {
1111
+ journeyId: string
1112
+ periodStart: string | null
1113
+ periodEnd: string | null
1114
+ steps: Array<{
1115
+ stepId: string
1116
+ enteredCount: number
1117
+ completedCount: number
1118
+ conversionRate: number
1119
+ avgTimeToComplete: number | null
1120
+ }>
1121
+ }
1122
+ ```
1123
+
1124
+ **JourneyStepRecipientsResponse** = `string[]`
1125
+
1057
1126
  ### location
1058
1127
 
1059
1128
  **Location** (interface)
@@ -2002,6 +2071,24 @@ Appends one interaction event from a public source.
2002
2071
  **remove**(collectionId: string,
2003
2072
  id: string) → `Promise<void>`
2004
2073
 
2074
+ ### journeysAnalytics
2075
+
2076
+ **stats**(collectionId: string,
2077
+ journeyId: string,
2078
+ body: JourneyStatsRequest = {}) → `Promise<JourneyStatsResponse>`
2079
+ POST /admin/collection/:collectionId/journeys.analytics/:journeyId/stats Computes journey stats over a time window; outcome defaults to 'success'. If `finalStepId` is provided, includes `currentlyActive` and `completed` fields.
2080
+
2081
+ **recipients**(collectionId: string,
2082
+ journeyId: string,
2083
+ stepId: string,
2084
+ body: JourneyStepRecipientsRequest = {}) → `Promise<JourneyStepRecipientsResponse>`
2085
+ POST /admin/collection/:collectionId/journeys.analytics/:journeyId/steps/:stepId/recipients Returns recipient IDs for a given journey step. For completed/pending, `interactionId` is required; outcome defaults to 'success'.
2086
+
2087
+ **funnelReport**(collectionId: string,
2088
+ journeyId: string,
2089
+ body: JourneyFunnelReportRequest) → `Promise<JourneyFunnelReportResponse>`
2090
+ POST /admin/collection/:collectionId/journeys.analytics/:journeyId/funnel-report Computes conversion, counts, and avg time across mapped steps in a period.
2091
+
2005
2092
  ### location
2006
2093
 
2007
2094
  **createGlobal**(params: LocationPayload) → `Promise<Location>`
@@ -19,6 +19,7 @@ export { contact } from "./contact";
19
19
  export { broadcasts } from "./broadcasts";
20
20
  export { segments } from "./segments";
21
21
  export { journeys } from "./journeys";
22
+ export { journeysAnalytics } from "./journeysAnalytics";
22
23
  export { qr } from "./qr";
23
24
  export { template } from "./template";
24
25
  export { interactions } from "./interactions";
package/dist/api/index.js CHANGED
@@ -21,6 +21,7 @@ export { contact } from "./contact";
21
21
  export { broadcasts } from "./broadcasts";
22
22
  export { segments } from "./segments";
23
23
  export { journeys } from "./journeys";
24
+ export { journeysAnalytics } from "./journeysAnalytics";
24
25
  export { qr } from "./qr";
25
26
  export { template } from "./template";
26
27
  export { interactions } from "./interactions";
@@ -0,0 +1,20 @@
1
+ import type { JourneyStatsRequest, JourneyStatsResponse, JourneyStepRecipientsRequest, JourneyStepRecipientsResponse, JourneyFunnelReportRequest, JourneyFunnelReportResponse } from "../types/journeysAnalytics";
2
+ export declare namespace journeysAnalytics {
3
+ /**
4
+ * POST /admin/collection/:collectionId/journeys.analytics/:journeyId/stats
5
+ * Computes journey stats over a time window; outcome defaults to 'success'.
6
+ * If `finalStepId` is provided, includes `currentlyActive` and `completed` fields.
7
+ */
8
+ function stats(collectionId: string, journeyId: string, body?: JourneyStatsRequest): Promise<JourneyStatsResponse>;
9
+ /**
10
+ * POST /admin/collection/:collectionId/journeys.analytics/:journeyId/steps/:stepId/recipients
11
+ * Returns recipient IDs for a given journey step.
12
+ * For completed/pending, `interactionId` is required; outcome defaults to 'success'.
13
+ */
14
+ function recipients(collectionId: string, journeyId: string, stepId: string, body?: JourneyStepRecipientsRequest): Promise<JourneyStepRecipientsResponse>;
15
+ /**
16
+ * POST /admin/collection/:collectionId/journeys.analytics/:journeyId/funnel-report
17
+ * Computes conversion, counts, and avg time across mapped steps in a period.
18
+ */
19
+ function funnelReport(collectionId: string, journeyId: string, body: JourneyFunnelReportRequest): Promise<JourneyFunnelReportResponse>;
20
+ }
@@ -0,0 +1,34 @@
1
+ // src/api/journeysAnalytics.ts
2
+ import { post } from "../http";
3
+ export var journeysAnalytics;
4
+ (function (journeysAnalytics) {
5
+ /**
6
+ * POST /admin/collection/:collectionId/journeys.analytics/:journeyId/stats
7
+ * Computes journey stats over a time window; outcome defaults to 'success'.
8
+ * If `finalStepId` is provided, includes `currentlyActive` and `completed` fields.
9
+ */
10
+ async function stats(collectionId, journeyId, body = {}) {
11
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/journeys.analytics/${encodeURIComponent(journeyId)}/stats`;
12
+ return post(path, body);
13
+ }
14
+ journeysAnalytics.stats = stats;
15
+ /**
16
+ * POST /admin/collection/:collectionId/journeys.analytics/:journeyId/steps/:stepId/recipients
17
+ * Returns recipient IDs for a given journey step.
18
+ * For completed/pending, `interactionId` is required; outcome defaults to 'success'.
19
+ */
20
+ async function recipients(collectionId, journeyId, stepId, body = {}) {
21
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/journeys.analytics/${encodeURIComponent(journeyId)}/steps/${encodeURIComponent(stepId)}/recipients`;
22
+ return post(path, body);
23
+ }
24
+ journeysAnalytics.recipients = recipients;
25
+ /**
26
+ * POST /admin/collection/:collectionId/journeys.analytics/:journeyId/funnel-report
27
+ * Computes conversion, counts, and avg time across mapped steps in a period.
28
+ */
29
+ async function funnelReport(collectionId, journeyId, body) {
30
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/journeys.analytics/${encodeURIComponent(journeyId)}/funnel-report`;
31
+ return post(path, body);
32
+ }
33
+ journeysAnalytics.funnelReport = funnelReport;
34
+ })(journeysAnalytics || (journeysAnalytics = {}));
@@ -133,6 +133,7 @@ export interface RecipientWithOutcome {
133
133
  export interface CommsRecipientIdsQuery {
134
134
  broadcastId?: string;
135
135
  journeyId?: string;
136
+ journeyStepId?: string;
136
137
  idField?: IdField;
137
138
  from?: string;
138
139
  to?: string;
@@ -15,6 +15,7 @@ export * from "./broadcasts";
15
15
  export * from "./segments";
16
16
  export * from "./common";
17
17
  export * from "./journeys";
18
+ export * from "./journeysAnalytics";
18
19
  export * from "./qr";
19
20
  export * from "./template";
20
21
  export * from "./interaction";
@@ -17,6 +17,7 @@ export * from "./broadcasts";
17
17
  export * from "./segments";
18
18
  export * from "./common";
19
19
  export * from "./journeys";
20
+ export * from "./journeysAnalytics";
20
21
  export * from "./qr";
21
22
  export * from "./template";
22
23
  export * from "./interaction";
@@ -0,0 +1,58 @@
1
+ import type { IdField } from './common';
2
+ export interface JourneyStatsRequest {
3
+ idField?: IdField;
4
+ from?: string;
5
+ to?: string;
6
+ finalStepId?: string;
7
+ stepMappings?: Array<{
8
+ stepId: string;
9
+ interactionId?: string;
10
+ outcome?: string;
11
+ }>;
12
+ }
13
+ export interface JourneyStatsResponse {
14
+ journeyId: string;
15
+ totalEntered: number;
16
+ currentlyActive?: number;
17
+ completed?: number;
18
+ exitedViaGoal?: number;
19
+ lastUpdated: string;
20
+ stepStats: Array<{
21
+ stepId: string;
22
+ entered: number;
23
+ completed: number;
24
+ pending: number;
25
+ }>;
26
+ }
27
+ export interface JourneyStepRecipientsRequest {
28
+ status?: 'entered' | 'completed' | 'pending';
29
+ idField?: IdField;
30
+ interactionId?: string;
31
+ outcome?: string;
32
+ from?: string;
33
+ to?: string;
34
+ limit?: number;
35
+ }
36
+ export type JourneyStepRecipientsResponse = string[];
37
+ export interface JourneyFunnelReportRequest {
38
+ idField?: IdField;
39
+ periodStart?: string;
40
+ periodEnd?: string;
41
+ stepMappings: Array<{
42
+ stepId: string;
43
+ interactionId?: string;
44
+ outcome?: string;
45
+ }>;
46
+ }
47
+ export interface JourneyFunnelReportResponse {
48
+ journeyId: string;
49
+ periodStart: string | null;
50
+ periodEnd: string | null;
51
+ steps: Array<{
52
+ stepId: string;
53
+ enteredCount: number;
54
+ completedCount: number;
55
+ conversionRate: number;
56
+ avgTimeToComplete: number | null;
57
+ }>;
58
+ }
@@ -0,0 +1,2 @@
1
+ // src/types/journeysAnalytics.ts
2
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",