@proveanything/smartlinks 1.1.10 → 1.1.12

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.10 | Generated: 2025-12-24T21:01:46.345Z
3
+ Version: 1.1.12 | Generated: 2025-12-28T18:01:35.628Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -29,6 +29,9 @@ The Smartlinks SDK is organized into the following namespaces:
29
29
  - **broadcasts** - Define broadcast campaigns; append recipients/events; analytics and CRUD.
30
30
  - **segments** - Define dynamic/static audience segments; estimate and list recipients; schedule calculations.
31
31
 
32
+ — Analytics & Events —
33
+ - **interactions** - Log and analyze interactions/outcomes; aggregates and actor lists; interaction definition CRUD.
34
+
32
35
  — Automation —
33
36
  - **journeys** - Configure automated flows triggered by events or schedules; steps, rules; full CRUD.
34
37
 
@@ -44,7 +47,7 @@ The Smartlinks SDK is organized into the following namespaces:
44
47
 
45
48
  — Other —
46
49
  - **attestation** - Functions for attestation operations
47
- - **interactions** - Functions for interactions operations
50
+ - **location** - Functions for location operations
48
51
  - **template** - Functions for template operations
49
52
 
50
53
  ## HTTP Utilities
@@ -832,8 +835,8 @@ interface PublicInteractionsCountsByOutcomeRequest {
832
835
  **PublicInteractionsByUserRequest** (interface)
833
836
  ```typescript
834
837
  interface PublicInteractionsByUserRequest {
835
- appId: string
836
- interactionId: string
838
+ appId?: string
839
+ interactionId?: string
837
840
  from?: string
838
841
  to?: string
839
842
  limit?: number
@@ -875,7 +878,7 @@ interface ActorWithOutcome {
875
878
  ```typescript
876
879
  interface InteractionEventBase {
877
880
  collectionId: string,
878
- ordId: string,
881
+ orgId?: string,
879
882
  userId?: string
880
883
  contactId?: string
881
884
  interactionId: string
@@ -1051,6 +1054,54 @@ interface UpdateJourneyBody {
1051
1054
  }
1052
1055
  ```
1053
1056
 
1057
+ ### location
1058
+
1059
+ **Location** (interface)
1060
+ ```typescript
1061
+ interface Location {
1062
+ locationId: string
1063
+ collectionId: string | null
1064
+ scope: 'global' | 'collection'
1065
+ name: string
1066
+ category?: string
1067
+ description?: string
1068
+ countryName?: string
1069
+ countryCode?: string
1070
+ websiteUrl?: string
1071
+ logoUrl?: string
1072
+ phone?: string
1073
+ email?: string
1074
+ geofence?: Geofence | {}
1075
+ metadata?: Record<string, unknown>
1076
+ createdAt: string
1077
+ updatedAt: string
1078
+ }
1079
+ ```
1080
+
1081
+ **LocationSearchQuery** (interface)
1082
+ ```typescript
1083
+ interface LocationSearchQuery {
1084
+ q?: string
1085
+ category?: string
1086
+ countryCode?: string
1087
+ countryName?: string
1088
+ limit?: number // default 20; max 100
1089
+ sort?: 'name' | 'countryCode' | 'countryName' // default 'name'
1090
+ }
1091
+ ```
1092
+
1093
+ **LocationSearchResponse** (interface)
1094
+ ```typescript
1095
+ interface LocationSearchResponse {
1096
+ items: Location[]
1097
+ count: number
1098
+ }
1099
+ ```
1100
+
1101
+ **Geofence** = ``
1102
+
1103
+ **LocationPayload** = `Omit<`
1104
+
1054
1105
  ### nfc
1055
1106
 
1056
1107
  **NfcTagInfo** (interface)
@@ -1880,23 +1931,23 @@ Delete a form for a collection (admin only).
1880
1931
 
1881
1932
  **byUser**(collectionId: string,
1882
1933
  query: AdminInteractionsByUserRequest = {}) → `Promise<InteractionEventRow[]>`
1883
- POST /admin/collection/:collectionId/interaction/by-user Returns BigQuery interaction rows, newest first.
1934
+ POST /admin/collection/:collectionId/interactions/by-user Returns BigQuery interaction rows, newest first.
1884
1935
 
1885
1936
  **countsByOutcome**(collectionId: string,
1886
1937
  query: AdminInteractionsCountsByOutcomeRequest = {}) → `Promise<OutcomeCount[]>`
1887
- POST /admin/collection/:collectionId/interaction/counts-by-outcome Returns array of { outcome, count }.
1938
+ POST /admin/collection/:collectionId/interactions/counts-by-outcome Returns array of { outcome, count }.
1888
1939
 
1889
1940
  **actorIdsByInteraction**(collectionId: string,
1890
1941
  query: AdminActorIdsByInteractionRequest) → `Promise<ActorId[] | ActorWithOutcome[]>`
1891
- POST /admin/collection/:collectionId/interaction/actor-ids/by-interaction Returns list of IDs, optionally with outcome when includeOutcome=true.
1942
+ POST /admin/collection/:collectionId/interactions/actor-ids/by-interaction Returns list of IDs, optionally with outcome when includeOutcome=true.
1892
1943
 
1893
1944
  **appendEvent**(collectionId: string,
1894
1945
  body: AppendInteractionBody) → `Promise<`
1895
- POST /admin/collection/:collectionId/interaction/append Appends one interaction event.
1946
+ POST /admin/collection/:collectionId/interactions/append Appends one interaction event.
1896
1947
 
1897
1948
  **updateEvent**(collectionId: string,
1898
1949
  body: UpdateInteractionBody) → `Promise<`
1899
- POST /admin/collection/:collectionId/interaction/append Appends one interaction event.
1950
+ POST /admin/collection/:collectionId/interactions/append Appends one interaction event.
1900
1951
 
1901
1952
  **submitPublicEvent**(collectionId: string,
1902
1953
  body: AppendInteractionBody) → `Promise<`
@@ -1951,6 +2002,25 @@ Appends one interaction event from a public source.
1951
2002
  **remove**(collectionId: string,
1952
2003
  id: string) → `Promise<void>`
1953
2004
 
2005
+ ### location
2006
+
2007
+ **createGlobal**(params: LocationPayload) → `Promise<Location>`
2008
+ Platform: Create a global location (super admin; requires features.adminApps) POST /platform/location
2009
+
2010
+ **create**(collectionId: string, params: LocationPayload) → `Promise<Location>`
2011
+ Admin: Create a collection-scoped location POST /admin/collection/:collectionId/location
2012
+
2013
+ **search**(collectionId: string,
2014
+ query: LocationSearchQuery = {}) → `Promise<LocationSearchResponse>`
2015
+ Admin: Search locations to pick during setup (combines collection + global) GET /admin/collection/:collectionId/location/search
2016
+
2017
+ **getPublic**(locationId: string) → `Promise<Location>`
2018
+ Public: Fetch a global location by ID GET /public/location/:locationId
2019
+
2020
+ **getPublicForCollection**(collectionId: string,
2021
+ locationId: string) → `Promise<Location>`
2022
+ Public: Fetch a location for a collection; returns either a collection-owned or global fallback GET /public/collection/:collectionId/location/:locationId
2023
+
1954
2024
  ### nfc
1955
2025
 
1956
2026
  **claimTag**(data: NfcClaimTagRequest) → `Promise<NfcTagInfo>`
@@ -22,4 +22,5 @@ export { journeys } from "./journeys";
22
22
  export { qr } from "./qr";
23
23
  export { template } from "./template";
24
24
  export { interactions } from "./interactions";
25
+ export { location } from "./location";
25
26
  export type { AIGenerateContentRequest, AIGenerateImageRequest, AISearchPhotosRequest, AISearchPhotosPhoto } from "./ai";
package/dist/api/index.js CHANGED
@@ -24,3 +24,4 @@ export { journeys } from "./journeys";
24
24
  export { qr } from "./qr";
25
25
  export { template } from "./template";
26
26
  export { interactions } from "./interactions";
27
+ export { location } from "./location";
@@ -1,22 +1,22 @@
1
1
  import type { AdminInteractionsByUserRequest, AdminInteractionsCountsByOutcomeRequest, AdminActorIdsByInteractionRequest, AppendInteractionBody, UpdateInteractionBody, OutcomeCount, ActorId, ActorWithOutcome, InteractionEventRow, PublicInteractionsCountsByOutcomeRequest, PublicInteractionsByUserRequest, CreateInteractionTypeBody, UpdateInteractionTypeBody, ListInteractionTypesQuery, InteractionTypeRecord, InteractionTypeList } from "../types/interaction";
2
2
  export declare namespace interactions {
3
3
  /**
4
- * POST /admin/collection/:collectionId/interaction/by-user
4
+ * POST /admin/collection/:collectionId/interactions/by-user
5
5
  * Returns BigQuery interaction rows, newest first.
6
6
  */
7
7
  function byUser(collectionId: string, query?: AdminInteractionsByUserRequest): Promise<InteractionEventRow[]>;
8
8
  /**
9
- * POST /admin/collection/:collectionId/interaction/counts-by-outcome
9
+ * POST /admin/collection/:collectionId/interactions/counts-by-outcome
10
10
  * Returns array of { outcome, count }.
11
11
  */
12
12
  function countsByOutcome(collectionId: string, query?: AdminInteractionsCountsByOutcomeRequest): Promise<OutcomeCount[]>;
13
13
  /**
14
- * POST /admin/collection/:collectionId/interaction/actor-ids/by-interaction
14
+ * POST /admin/collection/:collectionId/interactions/actor-ids/by-interaction
15
15
  * Returns list of IDs, optionally with outcome when includeOutcome=true.
16
16
  */
17
17
  function actorIdsByInteraction(collectionId: string, query: AdminActorIdsByInteractionRequest): Promise<ActorId[] | ActorWithOutcome[]>;
18
18
  /**
19
- * POST /admin/collection/:collectionId/interaction/append
19
+ * POST /admin/collection/:collectionId/interactions/append
20
20
  * Appends one interaction event.
21
21
  */
22
22
  function appendEvent(collectionId: string, body: AppendInteractionBody): Promise<{
@@ -18,41 +18,41 @@ function encodeQuery(params) {
18
18
  export var interactions;
19
19
  (function (interactions) {
20
20
  /**
21
- * POST /admin/collection/:collectionId/interaction/by-user
21
+ * POST /admin/collection/:collectionId/interactions/by-user
22
22
  * Returns BigQuery interaction rows, newest first.
23
23
  */
24
24
  async function byUser(collectionId, query = {}) {
25
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/by-user`;
25
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/interactions/by-user`;
26
26
  return post(path, query);
27
27
  }
28
28
  interactions.byUser = byUser;
29
29
  /**
30
- * POST /admin/collection/:collectionId/interaction/counts-by-outcome
30
+ * POST /admin/collection/:collectionId/interactions/counts-by-outcome
31
31
  * Returns array of { outcome, count }.
32
32
  */
33
33
  async function countsByOutcome(collectionId, query = {}) {
34
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/counts-by-outcome`;
34
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/interactions/counts-by-outcome`;
35
35
  return post(path, query);
36
36
  }
37
37
  interactions.countsByOutcome = countsByOutcome;
38
38
  /**
39
- * POST /admin/collection/:collectionId/interaction/actor-ids/by-interaction
39
+ * POST /admin/collection/:collectionId/interactions/actor-ids/by-interaction
40
40
  * Returns list of IDs, optionally with outcome when includeOutcome=true.
41
41
  */
42
42
  async function actorIdsByInteraction(collectionId, query) {
43
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/actor-ids/by-interaction`;
43
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/interactions/actor-ids/by-interaction`;
44
44
  return post(path, query);
45
45
  }
46
46
  interactions.actorIdsByInteraction = actorIdsByInteraction;
47
47
  /**
48
- * POST /admin/collection/:collectionId/interaction/append
48
+ * POST /admin/collection/:collectionId/interactions/append
49
49
  * Appends one interaction event.
50
50
  */
51
51
  async function appendEvent(collectionId, body) {
52
52
  if (!body.userId && !body.contactId) {
53
53
  throw new Error("AppendInteractionBody must include one of userId or contactId");
54
54
  }
55
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/append`;
55
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/interactions/append`;
56
56
  return post(path, body);
57
57
  }
58
58
  interactions.appendEvent = appendEvent;
@@ -60,7 +60,7 @@ export var interactions;
60
60
  if (!body.userId && !body.contactId) {
61
61
  throw new Error("AppendInteractionBody must include one of userId or contactId");
62
62
  }
63
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/append`;
63
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/interactions/append`;
64
64
  return post(path, body);
65
65
  }
66
66
  interactions.updateEvent = updateEvent;
@@ -71,46 +71,46 @@ export var interactions;
71
71
  if (!body.userId && !body.contactId) {
72
72
  throw new Error("AppendInteractionBody must include one of userId or contactId");
73
73
  }
74
- const path = `/public/collection/${encodeURIComponent(collectionId)}/interaction/submit`;
74
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/interactions/submit`;
75
75
  return post(path, body);
76
76
  }
77
77
  interactions.submitPublicEvent = submitPublicEvent;
78
78
  // CRUD: Interaction Types (Postgres)
79
79
  async function create(collectionId, body) {
80
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/`;
80
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/interactions/`;
81
81
  return post(path, body);
82
82
  }
83
83
  interactions.create = create;
84
84
  async function list(collectionId, query = {}) {
85
85
  const qs = encodeQuery(query);
86
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/${qs}`;
86
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/interactions/${qs}`;
87
87
  return request(path);
88
88
  }
89
89
  interactions.list = list;
90
90
  async function get(collectionId, id) {
91
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/${encodeURIComponent(id)}`;
91
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/interactions/${encodeURIComponent(id)}`;
92
92
  return request(path);
93
93
  }
94
94
  interactions.get = get;
95
95
  async function update(collectionId, id, patchBody) {
96
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/${encodeURIComponent(id)}`;
96
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/interactions/${encodeURIComponent(id)}`;
97
97
  return patch(path, patchBody);
98
98
  }
99
99
  interactions.update = update;
100
100
  async function remove(collectionId, id) {
101
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/${encodeURIComponent(id)}`;
101
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/interactions/${encodeURIComponent(id)}`;
102
102
  return del(path);
103
103
  }
104
104
  interactions.remove = remove;
105
105
  // Public endpoints (permission-aware)
106
106
  async function publicCountsByOutcome(collectionId, body, authToken) {
107
- const path = `/public/collection/${encodeURIComponent(collectionId)}/interaction/counts-by-outcome`;
107
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/interactions/counts-by-outcome`;
108
108
  const headers = authToken ? { AUTHORIZATION: `Bearer ${authToken}` } : undefined;
109
109
  return post(path, body, headers);
110
110
  }
111
111
  interactions.publicCountsByOutcome = publicCountsByOutcome;
112
112
  async function publicMyInteractions(collectionId, body, authToken) {
113
- const path = `/public/collection/${encodeURIComponent(collectionId)}/interaction/by-user`;
113
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/interactions/by-user`;
114
114
  const headers = authToken ? { AUTHORIZATION: `Bearer ${authToken}` } : undefined;
115
115
  return post(path, body, headers);
116
116
  }
@@ -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 = {}));
@@ -18,3 +18,4 @@ export * from "./journeys";
18
18
  export * from "./qr";
19
19
  export * from "./template";
20
20
  export * from "./interaction";
21
+ export * from "./location";
@@ -20,3 +20,4 @@ export * from "./journeys";
20
20
  export * from "./qr";
21
21
  export * from "./template";
22
22
  export * from "./interaction";
23
+ 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,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.10",
3
+ "version": "1.1.12",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",