@proveanything/smartlinks 1.1.11 → 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.11 | Generated: 2025-12-26T15:12:34.830Z
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,8 @@ 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
51
+ - **location** - Functions for location operations
50
52
  - **template** - Functions for template operations
51
53
 
52
54
  ## HTTP Utilities
@@ -600,6 +602,7 @@ interface RecipientWithOutcome {
600
602
  interface CommsRecipientIdsQuery {
601
603
  broadcastId?: string
602
604
  journeyId?: string
605
+ journeyStepId?: string
603
606
  idField?: IdField
604
607
  from?: string
605
608
  to?: string
@@ -834,8 +837,8 @@ interface PublicInteractionsCountsByOutcomeRequest {
834
837
  **PublicInteractionsByUserRequest** (interface)
835
838
  ```typescript
836
839
  interface PublicInteractionsByUserRequest {
837
- appId: string
838
- interactionId: string
840
+ appId?: string
841
+ interactionId?: string
839
842
  from?: string
840
843
  to?: string
841
844
  limit?: number
@@ -877,7 +880,7 @@ interface ActorWithOutcome {
877
880
  ```typescript
878
881
  interface InteractionEventBase {
879
882
  collectionId: string,
880
- ordId: string,
883
+ orgId?: string,
881
884
  userId?: string
882
885
  contactId?: string
883
886
  interactionId: string
@@ -1053,6 +1056,121 @@ interface UpdateJourneyBody {
1053
1056
  }
1054
1057
  ```
1055
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
+
1126
+ ### location
1127
+
1128
+ **Location** (interface)
1129
+ ```typescript
1130
+ interface Location {
1131
+ locationId: string
1132
+ collectionId: string | null
1133
+ scope: 'global' | 'collection'
1134
+ name: string
1135
+ category?: string
1136
+ description?: string
1137
+ countryName?: string
1138
+ countryCode?: string
1139
+ websiteUrl?: string
1140
+ logoUrl?: string
1141
+ phone?: string
1142
+ email?: string
1143
+ geofence?: Geofence | {}
1144
+ metadata?: Record<string, unknown>
1145
+ createdAt: string
1146
+ updatedAt: string
1147
+ }
1148
+ ```
1149
+
1150
+ **LocationSearchQuery** (interface)
1151
+ ```typescript
1152
+ interface LocationSearchQuery {
1153
+ q?: string
1154
+ category?: string
1155
+ countryCode?: string
1156
+ countryName?: string
1157
+ limit?: number // default 20; max 100
1158
+ sort?: 'name' | 'countryCode' | 'countryName' // default 'name'
1159
+ }
1160
+ ```
1161
+
1162
+ **LocationSearchResponse** (interface)
1163
+ ```typescript
1164
+ interface LocationSearchResponse {
1165
+ items: Location[]
1166
+ count: number
1167
+ }
1168
+ ```
1169
+
1170
+ **Geofence** = ``
1171
+
1172
+ **LocationPayload** = `Omit<`
1173
+
1056
1174
  ### nfc
1057
1175
 
1058
1176
  **NfcTagInfo** (interface)
@@ -1953,6 +2071,43 @@ Appends one interaction event from a public source.
1953
2071
  **remove**(collectionId: string,
1954
2072
  id: string) → `Promise<void>`
1955
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
+
2092
+ ### location
2093
+
2094
+ **createGlobal**(params: LocationPayload) → `Promise<Location>`
2095
+ Platform: Create a global location (super admin; requires features.adminApps) POST /platform/location
2096
+
2097
+ **create**(collectionId: string, params: LocationPayload) → `Promise<Location>`
2098
+ Admin: Create a collection-scoped location POST /admin/collection/:collectionId/location
2099
+
2100
+ **search**(collectionId: string,
2101
+ query: LocationSearchQuery = {}) → `Promise<LocationSearchResponse>`
2102
+ Admin: Search locations to pick during setup (combines collection + global) GET /admin/collection/:collectionId/location/search
2103
+
2104
+ **getPublic**(locationId: string) → `Promise<Location>`
2105
+ Public: Fetch a global location by ID GET /public/location/:locationId
2106
+
2107
+ **getPublicForCollection**(collectionId: string,
2108
+ locationId: string) → `Promise<Location>`
2109
+ Public: Fetch a location for a collection; returns either a collection-owned or global fallback GET /public/collection/:collectionId/location/:locationId
2110
+
1956
2111
  ### nfc
1957
2112
 
1958
2113
  **claimTag**(data: NfcClaimTagRequest) → `Promise<NfcTagInfo>`
@@ -19,7 +19,9 @@ 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";
26
+ export { location } from "./location";
25
27
  export type { AIGenerateContentRequest, AIGenerateImageRequest, AISearchPhotosRequest, AISearchPhotosPhoto } from "./ai";
package/dist/api/index.js CHANGED
@@ -21,6 +21,8 @@ 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";
28
+ export { location } from "./location";
@@ -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 = {}));
@@ -0,0 +1,28 @@
1
+ import type { Location, LocationPayload, LocationSearchQuery, LocationSearchResponse } from "../types/location";
2
+ export declare namespace location {
3
+ /**
4
+ * Platform: Create a global location (super admin; requires features.adminApps)
5
+ * POST /platform/location
6
+ */
7
+ function createGlobal(params: LocationPayload): Promise<Location>;
8
+ /**
9
+ * Admin: Create a collection-scoped location
10
+ * POST /admin/collection/:collectionId/location
11
+ */
12
+ function create(collectionId: string, params: LocationPayload): Promise<Location>;
13
+ /**
14
+ * Admin: Search locations to pick during setup (combines collection + global)
15
+ * GET /admin/collection/:collectionId/location/search
16
+ */
17
+ function search(collectionId: string, query?: LocationSearchQuery): Promise<LocationSearchResponse>;
18
+ /**
19
+ * Public: Fetch a global location by ID
20
+ * GET /public/location/:locationId
21
+ */
22
+ function getPublic(locationId: string): Promise<Location>;
23
+ /**
24
+ * Public: Fetch a location for a collection; returns either a collection-owned or global fallback
25
+ * GET /public/collection/:collectionId/location/:locationId
26
+ */
27
+ function getPublicForCollection(collectionId: string, locationId: string): Promise<Location>;
28
+ }
@@ -0,0 +1,69 @@
1
+ // src/api/location.ts
2
+ import { request, post } from "../http";
3
+ function buildQueryString(q = {}) {
4
+ var _a, _b;
5
+ const params = new URLSearchParams();
6
+ if (q.q)
7
+ params.set('q', q.q);
8
+ if (q.category)
9
+ params.set('category', q.category);
10
+ if (q.countryCode)
11
+ params.set('countryCode', q.countryCode);
12
+ if (q.countryName)
13
+ params.set('countryName', q.countryName);
14
+ const limit = Math.min(Math.max((_a = q.limit) !== null && _a !== void 0 ? _a : 20, 1), 100);
15
+ params.set('limit', String(limit));
16
+ const sort = ((_b = q.sort) !== null && _b !== void 0 ? _b : 'name');
17
+ params.set('sort', sort);
18
+ const s = params.toString();
19
+ return s ? `?${s}` : '';
20
+ }
21
+ export var location;
22
+ (function (location) {
23
+ /**
24
+ * Platform: Create a global location (super admin; requires features.adminApps)
25
+ * POST /platform/location
26
+ */
27
+ async function createGlobal(params) {
28
+ const path = `/platform/location`;
29
+ return post(path, params);
30
+ }
31
+ location.createGlobal = createGlobal;
32
+ /**
33
+ * Admin: Create a collection-scoped location
34
+ * POST /admin/collection/:collectionId/location
35
+ */
36
+ async function create(collectionId, params) {
37
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/location`;
38
+ return post(path, params);
39
+ }
40
+ location.create = create;
41
+ /**
42
+ * Admin: Search locations to pick during setup (combines collection + global)
43
+ * GET /admin/collection/:collectionId/location/search
44
+ */
45
+ async function search(collectionId, query = {}) {
46
+ const qs = buildQueryString(query);
47
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/location/search${qs}`;
48
+ return request(path);
49
+ }
50
+ location.search = search;
51
+ /**
52
+ * Public: Fetch a global location by ID
53
+ * GET /public/location/:locationId
54
+ */
55
+ async function getPublic(locationId) {
56
+ const path = `/public/location/${encodeURIComponent(locationId)}`;
57
+ return request(path);
58
+ }
59
+ location.getPublic = getPublic;
60
+ /**
61
+ * Public: Fetch a location for a collection; returns either a collection-owned or global fallback
62
+ * GET /public/collection/:collectionId/location/:locationId
63
+ */
64
+ async function getPublicForCollection(collectionId, locationId) {
65
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/location/${encodeURIComponent(locationId)}`;
66
+ return request(path);
67
+ }
68
+ location.getPublicForCollection = getPublicForCollection;
69
+ })(location || (location = {}));
@@ -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,8 @@ 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";
22
+ export * from "./location";
@@ -17,6 +17,8 @@ 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";
24
+ export * from "./location";
@@ -36,8 +36,8 @@ export interface PublicInteractionsCountsByOutcomeRequest {
36
36
  limit?: number;
37
37
  }
38
38
  export interface PublicInteractionsByUserRequest {
39
- appId: string;
40
- interactionId: string;
39
+ appId?: string;
40
+ interactionId?: string;
41
41
  from?: string;
42
42
  to?: string;
43
43
  limit?: number;
@@ -66,7 +66,7 @@ export interface ActorWithOutcome {
66
66
  }
67
67
  export interface InteractionEventBase {
68
68
  collectionId: string;
69
- ordId: string;
69
+ orgId?: string;
70
70
  userId?: string;
71
71
  contactId?: string;
72
72
  interactionId: string;
@@ -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 {};
@@ -0,0 +1,41 @@
1
+ export type Geofence = {
2
+ type: 'bbox';
3
+ minLat: number;
4
+ minLon: number;
5
+ maxLat: number;
6
+ maxLon: number;
7
+ } | {
8
+ type: 'polygon';
9
+ coordinates: Array<[lat: number, lon: number]>;
10
+ } | Record<string, unknown>;
11
+ export type LocationPayload = Omit<Location, 'locationId' | 'collectionId' | 'scope' | 'createdAt' | 'updatedAt'>;
12
+ export interface Location {
13
+ locationId: string;
14
+ collectionId: string | null;
15
+ scope: 'global' | 'collection';
16
+ name: string;
17
+ category?: string;
18
+ description?: string;
19
+ countryName?: string;
20
+ countryCode?: string;
21
+ websiteUrl?: string;
22
+ logoUrl?: string;
23
+ phone?: string;
24
+ email?: string;
25
+ geofence?: Geofence | {};
26
+ metadata?: Record<string, unknown>;
27
+ createdAt: string;
28
+ updatedAt: string;
29
+ }
30
+ export interface LocationSearchQuery {
31
+ q?: string;
32
+ category?: string;
33
+ countryCode?: string;
34
+ countryName?: string;
35
+ limit?: number;
36
+ sort?: 'name' | 'countryCode' | 'countryName';
37
+ }
38
+ export interface LocationSearchResponse {
39
+ items: Location[];
40
+ count: number;
41
+ }
@@ -0,0 +1,2 @@
1
+ // src/types/location.ts
2
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.1.11",
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",