@proveanything/smartlinks 1.1.8 → 1.1.10
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 +323 -239
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +2 -1
- package/dist/api/interactions.d.ts +41 -0
- package/dist/api/interactions.js +118 -0
- package/dist/api/template.d.ts +15 -0
- package/dist/api/template.js +59 -0
- package/dist/types/actions.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js +2 -1
- package/dist/types/interaction.d.ts +172 -0
- package/dist/types/interaction.js +2 -0
- package/dist/types/template.d.ts +30 -0
- package/dist/types/template.js +2 -0
- package/package.json +1 -1
package/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.10 | Generated: 2025-12-24T21:01:46.345Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -29,9 +29,6 @@ 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
|
-
- **actions** - Log and analyze actions/outcomes; aggregates and actor lists; action definition CRUD.
|
|
34
|
-
|
|
35
32
|
— Automation —
|
|
36
33
|
- **journeys** - Configure automated flows triggered by events or schedules; steps, rules; full CRUD.
|
|
37
34
|
|
|
@@ -47,6 +44,8 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
47
44
|
|
|
48
45
|
— Other —
|
|
49
46
|
- **attestation** - Functions for attestation operations
|
|
47
|
+
- **interactions** - Functions for interactions operations
|
|
48
|
+
- **template** - Functions for template operations
|
|
50
49
|
|
|
51
50
|
## HTTP Utilities
|
|
52
51
|
|
|
@@ -107,192 +106,6 @@ Sends a custom proxy message to the parent Smartlinks application when running i
|
|
|
107
106
|
|
|
108
107
|
## Types
|
|
109
108
|
|
|
110
|
-
### actions
|
|
111
|
-
|
|
112
|
-
**AdminByUserRequest** (interface)
|
|
113
|
-
```typescript
|
|
114
|
-
interface AdminByUserRequest {
|
|
115
|
-
userId?: string
|
|
116
|
-
contactId?: string
|
|
117
|
-
appId?: string
|
|
118
|
-
actionId?: string
|
|
119
|
-
broadcastId?: string
|
|
120
|
-
outcome?: string | null
|
|
121
|
-
from?: string
|
|
122
|
-
to?: string
|
|
123
|
-
limit?: number
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
**AdminCountsByOutcomeRequest** (interface)
|
|
128
|
-
```typescript
|
|
129
|
-
interface AdminCountsByOutcomeRequest {
|
|
130
|
-
appId?: string
|
|
131
|
-
actionId?: string
|
|
132
|
-
from?: string
|
|
133
|
-
to?: string
|
|
134
|
-
limit?: number
|
|
135
|
-
dedupeLatest?: boolean
|
|
136
|
-
idField?: IdField
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
**AdminActorIdsByActionRequest** (interface)
|
|
141
|
-
```typescript
|
|
142
|
-
interface AdminActorIdsByActionRequest {
|
|
143
|
-
actionId: string
|
|
144
|
-
idField?: IdField
|
|
145
|
-
outcome?: string | null
|
|
146
|
-
includeOutcome?: boolean
|
|
147
|
-
from?: string
|
|
148
|
-
to?: string
|
|
149
|
-
limit?: number
|
|
150
|
-
}
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
**PublicCountsByOutcomeRequest** (interface)
|
|
154
|
-
```typescript
|
|
155
|
-
interface PublicCountsByOutcomeRequest {
|
|
156
|
-
appId: string
|
|
157
|
-
actionId: string
|
|
158
|
-
from?: string
|
|
159
|
-
to?: string
|
|
160
|
-
limit?: number
|
|
161
|
-
}
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
**PublicByUserRequest** (interface)
|
|
165
|
-
```typescript
|
|
166
|
-
interface PublicByUserRequest {
|
|
167
|
-
appId: string
|
|
168
|
-
actionId: string
|
|
169
|
-
from?: string
|
|
170
|
-
to?: string
|
|
171
|
-
limit?: number
|
|
172
|
-
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
**ActionEventRow** (interface)
|
|
176
|
-
```typescript
|
|
177
|
-
interface ActionEventRow {
|
|
178
|
-
orgId: string
|
|
179
|
-
collectionId: string
|
|
180
|
-
timestamp: string
|
|
181
|
-
appId?: string
|
|
182
|
-
actionId?: string
|
|
183
|
-
broadcastId?: string
|
|
184
|
-
userId?: string
|
|
185
|
-
contactId?: string
|
|
186
|
-
outcome?: string | null
|
|
187
|
-
metadata?: Record<string, unknown>
|
|
188
|
-
[k: string]: unknown
|
|
189
|
-
}
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
**OutcomeCount** (interface)
|
|
193
|
-
```typescript
|
|
194
|
-
interface OutcomeCount {
|
|
195
|
-
outcome: string | null; count: number
|
|
196
|
-
}
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
**ActorWithOutcome** (interface)
|
|
200
|
-
```typescript
|
|
201
|
-
interface ActorWithOutcome {
|
|
202
|
-
id: string; outcome: string | null
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
**AppendActionBody** (interface)
|
|
207
|
-
```typescript
|
|
208
|
-
interface AppendActionBody {
|
|
209
|
-
userId?: string
|
|
210
|
-
contactId?: string
|
|
211
|
-
actionId: string
|
|
212
|
-
appId?: string
|
|
213
|
-
broadcastId?: string
|
|
214
|
-
outcome?: string
|
|
215
|
-
timestamp?: string
|
|
216
|
-
metadata?: Record<string, unknown>
|
|
217
|
-
[k: string]: any
|
|
218
|
-
}
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
**ActionPermissions** (interface)
|
|
222
|
-
```typescript
|
|
223
|
-
interface ActionPermissions {
|
|
224
|
-
allowOwnRead?: boolean
|
|
225
|
-
allowPublicSummary?: boolean
|
|
226
|
-
allowAuthenticatedSummary?: boolean
|
|
227
|
-
}
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
**ActionRecord** (interface)
|
|
231
|
-
```typescript
|
|
232
|
-
interface ActionRecord {
|
|
233
|
-
id: string
|
|
234
|
-
collectionId: string
|
|
235
|
-
appId: string
|
|
236
|
-
permissions?: ActionPermissions
|
|
237
|
-
data?: {
|
|
238
|
-
display?: {
|
|
239
|
-
title?: string
|
|
240
|
-
description?: string
|
|
241
|
-
icon?: string
|
|
242
|
-
color?: string
|
|
243
|
-
}
|
|
244
|
-
actionType?: string
|
|
245
|
-
[key: string]: unknown
|
|
246
|
-
}
|
|
247
|
-
createdAt: string
|
|
248
|
-
}
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
**ActionList** (interface)
|
|
252
|
-
```typescript
|
|
253
|
-
interface ActionList {
|
|
254
|
-
items: ActionRecord[]
|
|
255
|
-
limit: number
|
|
256
|
-
offset: number
|
|
257
|
-
}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
**CreateActionBody** (interface)
|
|
261
|
-
```typescript
|
|
262
|
-
interface CreateActionBody {
|
|
263
|
-
id: string
|
|
264
|
-
appId: string
|
|
265
|
-
permissions?: ActionPermissions
|
|
266
|
-
data?: Record<string, unknown>
|
|
267
|
-
}
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
**UpdateActionBody** (interface)
|
|
271
|
-
```typescript
|
|
272
|
-
interface UpdateActionBody {
|
|
273
|
-
appId?: string
|
|
274
|
-
permissions?: ActionPermissions
|
|
275
|
-
data?: Record<string, unknown>
|
|
276
|
-
}
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
**ListActionsQuery** (interface)
|
|
280
|
-
```typescript
|
|
281
|
-
interface ListActionsQuery {
|
|
282
|
-
appId?: string
|
|
283
|
-
limit?: number
|
|
284
|
-
offset?: number
|
|
285
|
-
}
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
**ActorId** = `string`
|
|
289
|
-
|
|
290
|
-
**ActionQueryByUser** = `AdminByUserRequest`
|
|
291
|
-
|
|
292
|
-
**ActionCountsQuery** = `AdminCountsByOutcomeRequest`
|
|
293
|
-
|
|
294
|
-
**ActorIdsByActionQuery** = `AdminActorIdsByActionRequest`
|
|
295
|
-
|
|
296
109
|
### appConfiguration
|
|
297
110
|
|
|
298
111
|
**AppConfigurationResponse** (interface)
|
|
@@ -962,6 +775,210 @@ interface ErrorResponse {
|
|
|
962
775
|
}
|
|
963
776
|
```
|
|
964
777
|
|
|
778
|
+
### interaction
|
|
779
|
+
|
|
780
|
+
**AdminInteractionsByUserRequest** (interface)
|
|
781
|
+
```typescript
|
|
782
|
+
interface AdminInteractionsByUserRequest {
|
|
783
|
+
userId?: string
|
|
784
|
+
contactId?: string
|
|
785
|
+
appId?: string
|
|
786
|
+
interactionId?: string
|
|
787
|
+
broadcastId?: string
|
|
788
|
+
outcome?: string | null
|
|
789
|
+
from?: string
|
|
790
|
+
to?: string
|
|
791
|
+
limit?: number
|
|
792
|
+
}
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
**AdminInteractionsCountsByOutcomeRequest** (interface)
|
|
796
|
+
```typescript
|
|
797
|
+
interface AdminInteractionsCountsByOutcomeRequest {
|
|
798
|
+
appId?: string
|
|
799
|
+
interactionId?: string
|
|
800
|
+
from?: string
|
|
801
|
+
to?: string
|
|
802
|
+
limit?: number
|
|
803
|
+
dedupeLatest?: boolean
|
|
804
|
+
idField?: IdField
|
|
805
|
+
}
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
**AdminActorIdsByInteractionRequest** (interface)
|
|
809
|
+
```typescript
|
|
810
|
+
interface AdminActorIdsByInteractionRequest {
|
|
811
|
+
interactionId: string
|
|
812
|
+
idField?: IdField
|
|
813
|
+
outcome?: string | null
|
|
814
|
+
includeOutcome?: boolean
|
|
815
|
+
from?: string
|
|
816
|
+
to?: string
|
|
817
|
+
limit?: number
|
|
818
|
+
}
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
**PublicInteractionsCountsByOutcomeRequest** (interface)
|
|
822
|
+
```typescript
|
|
823
|
+
interface PublicInteractionsCountsByOutcomeRequest {
|
|
824
|
+
appId: string
|
|
825
|
+
interactionId: string
|
|
826
|
+
from?: string
|
|
827
|
+
to?: string
|
|
828
|
+
limit?: number
|
|
829
|
+
}
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
**PublicInteractionsByUserRequest** (interface)
|
|
833
|
+
```typescript
|
|
834
|
+
interface PublicInteractionsByUserRequest {
|
|
835
|
+
appId: string
|
|
836
|
+
interactionId: string
|
|
837
|
+
from?: string
|
|
838
|
+
to?: string
|
|
839
|
+
limit?: number
|
|
840
|
+
}
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
**InteractionEventRow** (interface)
|
|
844
|
+
```typescript
|
|
845
|
+
interface InteractionEventRow {
|
|
846
|
+
orgId: string
|
|
847
|
+
collectionId: string
|
|
848
|
+
timestamp: string
|
|
849
|
+
appId?: string
|
|
850
|
+
interactionId?: string
|
|
851
|
+
broadcastId?: string
|
|
852
|
+
userId?: string
|
|
853
|
+
contactId?: string
|
|
854
|
+
outcome?: string | null
|
|
855
|
+
metadata?: Record<string, unknown>
|
|
856
|
+
[k: string]: unknown
|
|
857
|
+
}
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
**OutcomeCount** (interface)
|
|
861
|
+
```typescript
|
|
862
|
+
interface OutcomeCount {
|
|
863
|
+
outcome: string | null; count: number
|
|
864
|
+
}
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
**ActorWithOutcome** (interface)
|
|
868
|
+
```typescript
|
|
869
|
+
interface ActorWithOutcome {
|
|
870
|
+
id: string; outcome: string | null
|
|
871
|
+
}
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
**InteractionEventBase** (interface)
|
|
875
|
+
```typescript
|
|
876
|
+
interface InteractionEventBase {
|
|
877
|
+
collectionId: string,
|
|
878
|
+
ordId: string,
|
|
879
|
+
userId?: string
|
|
880
|
+
contactId?: string
|
|
881
|
+
interactionId: string
|
|
882
|
+
appId?: string
|
|
883
|
+
broadcastId?: string
|
|
884
|
+
journeyId?: string
|
|
885
|
+
productId?: string
|
|
886
|
+
proofId?: string
|
|
887
|
+
variantId?: string
|
|
888
|
+
batchId?: string
|
|
889
|
+
source?: string,
|
|
890
|
+
eventType?: string
|
|
891
|
+
outcome?: string
|
|
892
|
+
timestamp?: string
|
|
893
|
+
metadata?: Record<string, unknown>
|
|
894
|
+
[k: string]: any
|
|
895
|
+
}
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
**InteractionPermissions** (interface)
|
|
899
|
+
```typescript
|
|
900
|
+
interface InteractionPermissions {
|
|
901
|
+
enabled?: boolean
|
|
902
|
+
requireAuth?: boolean
|
|
903
|
+
allowPublicSubmit?: boolean
|
|
904
|
+
allowAnonymousSubmit?: boolean
|
|
905
|
+
allowedOrigins?: string[]
|
|
906
|
+
startAt?: string
|
|
907
|
+
endAt?: string
|
|
908
|
+
* Enforce uniqueness per user: prevent duplicate submissions for this interaction.
|
|
909
|
+
* If true, optionally use `uniquePerUserWindowSeconds` to scope the window.
|
|
910
|
+
uniquePerUser?: boolean
|
|
911
|
+
uniquePerUserWindowSeconds?: number
|
|
912
|
+
uniqueOutcome?: string
|
|
913
|
+
* Public summary visibility (counts, aggregates) without auth.
|
|
914
|
+
* If false, summaries require `allowAuthenticatedSummary` + user auth.
|
|
915
|
+
allowPublicSummary?: boolean
|
|
916
|
+
* Authenticated summary visibility (counts, aggregates) when user is signed in.
|
|
917
|
+
allowAuthenticatedSummary?: boolean
|
|
918
|
+
allowOwnRead?: boolean
|
|
919
|
+
}
|
|
920
|
+
```
|
|
921
|
+
|
|
922
|
+
**InteractionTypeRecord** (interface)
|
|
923
|
+
```typescript
|
|
924
|
+
interface InteractionTypeRecord {
|
|
925
|
+
id?: string
|
|
926
|
+
collectionId: string
|
|
927
|
+
appId: string
|
|
928
|
+
permissions?: InteractionPermissions
|
|
929
|
+
data?: {
|
|
930
|
+
display?: {
|
|
931
|
+
title?: string
|
|
932
|
+
description?: string
|
|
933
|
+
icon?: string
|
|
934
|
+
color?: string
|
|
935
|
+
}
|
|
936
|
+
interactionType?: string
|
|
937
|
+
[key: string]: unknown
|
|
938
|
+
}
|
|
939
|
+
createdAt: string
|
|
940
|
+
}
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
**InteractionTypeList** (interface)
|
|
944
|
+
```typescript
|
|
945
|
+
interface InteractionTypeList {
|
|
946
|
+
items: InteractionTypeRecord[]
|
|
947
|
+
limit: number
|
|
948
|
+
offset: number
|
|
949
|
+
}
|
|
950
|
+
```
|
|
951
|
+
|
|
952
|
+
**CreateInteractionTypeBody** (interface)
|
|
953
|
+
```typescript
|
|
954
|
+
interface CreateInteractionTypeBody {
|
|
955
|
+
id: string
|
|
956
|
+
appId: string
|
|
957
|
+
permissions?: InteractionPermissions
|
|
958
|
+
data?: Record<string, unknown>
|
|
959
|
+
}
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
**UpdateInteractionTypeBody** (interface)
|
|
963
|
+
```typescript
|
|
964
|
+
interface UpdateInteractionTypeBody {
|
|
965
|
+
appId?: string
|
|
966
|
+
permissions?: InteractionPermissions
|
|
967
|
+
data?: Record<string, unknown>
|
|
968
|
+
}
|
|
969
|
+
```
|
|
970
|
+
|
|
971
|
+
**ListInteractionTypesQuery** (interface)
|
|
972
|
+
```typescript
|
|
973
|
+
interface ListInteractionTypesQuery {
|
|
974
|
+
appId?: string
|
|
975
|
+
limit?: number
|
|
976
|
+
offset?: number
|
|
977
|
+
}
|
|
978
|
+
```
|
|
979
|
+
|
|
980
|
+
**ActorId** = `string`
|
|
981
|
+
|
|
965
982
|
### journeys
|
|
966
983
|
|
|
967
984
|
**JourneyRecord** (interface)
|
|
@@ -1233,6 +1250,39 @@ interface SegmentRecipientsResponse {
|
|
|
1233
1250
|
}
|
|
1234
1251
|
```
|
|
1235
1252
|
|
|
1253
|
+
### template
|
|
1254
|
+
|
|
1255
|
+
**TemplateBase** (interface)
|
|
1256
|
+
```typescript
|
|
1257
|
+
interface TemplateBase {
|
|
1258
|
+
id: string
|
|
1259
|
+
collectionId: string
|
|
1260
|
+
name: string
|
|
1261
|
+
description?: string
|
|
1262
|
+
type: string
|
|
1263
|
+
resizeMode?: string
|
|
1264
|
+
pdf?: {
|
|
1265
|
+
base: { url: string }
|
|
1266
|
+
orientation: 'portrait' | 'landscape'
|
|
1267
|
+
}
|
|
1268
|
+
subject?: string
|
|
1269
|
+
body?: string
|
|
1270
|
+
css?: string
|
|
1271
|
+
public?: boolean
|
|
1272
|
+
engine?: string
|
|
1273
|
+
component?: string
|
|
1274
|
+
defaultProps?: Record<string, any>
|
|
1275
|
+
collections?: string[]
|
|
1276
|
+
[k: string]: any
|
|
1277
|
+
}
|
|
1278
|
+
```
|
|
1279
|
+
|
|
1280
|
+
**TemplateInput** = `Omit<TemplateBase, 'id' | 'collectionId'>`
|
|
1281
|
+
|
|
1282
|
+
**TemplateUpdate** = `Partial<Omit<TemplateBase, 'id' | 'collectionId'>>`
|
|
1283
|
+
|
|
1284
|
+
**TemplatePublic** = `TemplateBase`
|
|
1285
|
+
|
|
1236
1286
|
### variant
|
|
1237
1287
|
|
|
1238
1288
|
**VariantResponse** = `any`
|
|
@@ -1369,55 +1419,6 @@ type AccountInfoResponse = {
|
|
|
1369
1419
|
|
|
1370
1420
|
## API Functions
|
|
1371
1421
|
|
|
1372
|
-
### actions
|
|
1373
|
-
|
|
1374
|
-
**byUser**(collectionId: string,
|
|
1375
|
-
query: AdminByUserRequest | ActionQueryByUser = {}) → `Promise<ActionEventRow[]>`
|
|
1376
|
-
POST /admin/collection/:collectionId/actions/by-user Returns BigQuery action rows, newest first.
|
|
1377
|
-
|
|
1378
|
-
**countsByOutcome**(collectionId: string,
|
|
1379
|
-
query: AdminCountsByOutcomeRequest | ActionCountsQuery = {}) → `Promise<OutcomeCount[]>`
|
|
1380
|
-
POST /admin/collection/:collectionId/actions/counts-by-outcome Returns array of { outcome, count }.
|
|
1381
|
-
|
|
1382
|
-
**actorIdsByAction**(collectionId: string,
|
|
1383
|
-
query: AdminActorIdsByActionRequest | ActorIdsByActionQuery) → `Promise<ActorId[] | ActorWithOutcome[]>`
|
|
1384
|
-
POST /admin/collection/:collectionId/actions/actor-ids/by-action Returns list of IDs, optionally with outcome when includeOutcome=true.
|
|
1385
|
-
|
|
1386
|
-
**append**(collectionId: string,
|
|
1387
|
-
body: AppendActionBody) → `Promise<`
|
|
1388
|
-
POST /admin/collection/:collectionId/actions/append Appends one action event.
|
|
1389
|
-
|
|
1390
|
-
**create**(collectionId: string,
|
|
1391
|
-
body: CreateActionBody) → `Promise<ActionRecord>`
|
|
1392
|
-
POST /admin/collection/:collectionId/actions/append Appends one action event.
|
|
1393
|
-
|
|
1394
|
-
**list**(collectionId: string,
|
|
1395
|
-
query: ListActionsQuery = {}) → `Promise<ActionList>`
|
|
1396
|
-
POST /admin/collection/:collectionId/actions/append Appends one action event.
|
|
1397
|
-
|
|
1398
|
-
**get**(collectionId: string,
|
|
1399
|
-
id: string) → `Promise<ActionRecord>`
|
|
1400
|
-
POST /admin/collection/:collectionId/actions/append Appends one action event.
|
|
1401
|
-
|
|
1402
|
-
**update**(collectionId: string,
|
|
1403
|
-
id: string,
|
|
1404
|
-
patchBody: UpdateActionBody) → `Promise<ActionRecord>`
|
|
1405
|
-
POST /admin/collection/:collectionId/actions/append Appends one action event.
|
|
1406
|
-
|
|
1407
|
-
**remove**(collectionId: string,
|
|
1408
|
-
id: string) → `Promise<void>`
|
|
1409
|
-
POST /admin/collection/:collectionId/actions/append Appends one action event.
|
|
1410
|
-
|
|
1411
|
-
**publicCountsByOutcome**(collectionId: string,
|
|
1412
|
-
body: PublicCountsByOutcomeRequest,
|
|
1413
|
-
authToken?: string) → `Promise<OutcomeCount[]>`
|
|
1414
|
-
POST /admin/collection/:collectionId/actions/append Appends one action event.
|
|
1415
|
-
|
|
1416
|
-
**publicMyActions**(collectionId: string,
|
|
1417
|
-
body: PublicByUserRequest,
|
|
1418
|
-
authToken?: string) → `Promise<ActionEventRow[]>`
|
|
1419
|
-
POST /admin/collection/:collectionId/actions/append Appends one action event.
|
|
1420
|
-
|
|
1421
1422
|
### ai
|
|
1422
1423
|
|
|
1423
1424
|
**generateContent**(collectionId: string,
|
|
@@ -1875,6 +1876,63 @@ Update a form for a collection (admin only).
|
|
|
1875
1876
|
**remove**(collectionId: string, formId: string) → `Promise<void>`
|
|
1876
1877
|
Delete a form for a collection (admin only).
|
|
1877
1878
|
|
|
1879
|
+
### interactions
|
|
1880
|
+
|
|
1881
|
+
**byUser**(collectionId: string,
|
|
1882
|
+
query: AdminInteractionsByUserRequest = {}) → `Promise<InteractionEventRow[]>`
|
|
1883
|
+
POST /admin/collection/:collectionId/interaction/by-user Returns BigQuery interaction rows, newest first.
|
|
1884
|
+
|
|
1885
|
+
**countsByOutcome**(collectionId: string,
|
|
1886
|
+
query: AdminInteractionsCountsByOutcomeRequest = {}) → `Promise<OutcomeCount[]>`
|
|
1887
|
+
POST /admin/collection/:collectionId/interaction/counts-by-outcome Returns array of { outcome, count }.
|
|
1888
|
+
|
|
1889
|
+
**actorIdsByInteraction**(collectionId: string,
|
|
1890
|
+
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.
|
|
1892
|
+
|
|
1893
|
+
**appendEvent**(collectionId: string,
|
|
1894
|
+
body: AppendInteractionBody) → `Promise<`
|
|
1895
|
+
POST /admin/collection/:collectionId/interaction/append Appends one interaction event.
|
|
1896
|
+
|
|
1897
|
+
**updateEvent**(collectionId: string,
|
|
1898
|
+
body: UpdateInteractionBody) → `Promise<`
|
|
1899
|
+
POST /admin/collection/:collectionId/interaction/append Appends one interaction event.
|
|
1900
|
+
|
|
1901
|
+
**submitPublicEvent**(collectionId: string,
|
|
1902
|
+
body: AppendInteractionBody) → `Promise<`
|
|
1903
|
+
Appends one interaction event from a public source.
|
|
1904
|
+
|
|
1905
|
+
**create**(collectionId: string,
|
|
1906
|
+
body: CreateInteractionTypeBody) → `Promise<InteractionTypeRecord>`
|
|
1907
|
+
Appends one interaction event from a public source.
|
|
1908
|
+
|
|
1909
|
+
**list**(collectionId: string,
|
|
1910
|
+
query: ListInteractionTypesQuery = {}) → `Promise<InteractionTypeList>`
|
|
1911
|
+
Appends one interaction event from a public source.
|
|
1912
|
+
|
|
1913
|
+
**get**(collectionId: string,
|
|
1914
|
+
id: string) → `Promise<InteractionTypeRecord>`
|
|
1915
|
+
Appends one interaction event from a public source.
|
|
1916
|
+
|
|
1917
|
+
**update**(collectionId: string,
|
|
1918
|
+
id: string,
|
|
1919
|
+
patchBody: UpdateInteractionTypeBody) → `Promise<InteractionTypeRecord>`
|
|
1920
|
+
Appends one interaction event from a public source.
|
|
1921
|
+
|
|
1922
|
+
**remove**(collectionId: string,
|
|
1923
|
+
id: string) → `Promise<void>`
|
|
1924
|
+
Appends one interaction event from a public source.
|
|
1925
|
+
|
|
1926
|
+
**publicCountsByOutcome**(collectionId: string,
|
|
1927
|
+
body: PublicInteractionsCountsByOutcomeRequest,
|
|
1928
|
+
authToken?: string) → `Promise<OutcomeCount[]>`
|
|
1929
|
+
Appends one interaction event from a public source.
|
|
1930
|
+
|
|
1931
|
+
**publicMyInteractions**(collectionId: string,
|
|
1932
|
+
body: PublicInteractionsByUserRequest,
|
|
1933
|
+
authToken?: string) → `Promise<InteractionEventRow[]>`
|
|
1934
|
+
Appends one interaction event from a public source.
|
|
1935
|
+
|
|
1878
1936
|
### journeys
|
|
1879
1937
|
|
|
1880
1938
|
**create**(collectionId: string,
|
|
@@ -2022,6 +2080,32 @@ Resolve a short code to related resource identifiers.
|
|
|
2022
2080
|
id: string,
|
|
2023
2081
|
query: { limit?: number; offset?: number } = {}) → `Promise<SegmentRecipientsResponse>`
|
|
2024
2082
|
|
|
2083
|
+
### template
|
|
2084
|
+
|
|
2085
|
+
**getAll**(collectionId: string) → `Promise<Template[]>`
|
|
2086
|
+
|
|
2087
|
+
**get**(collectionId: string, templateId: string) → `Promise<Template>`
|
|
2088
|
+
|
|
2089
|
+
**create**(collectionId: string, data: TemplateInput) → `Promise<Template>`
|
|
2090
|
+
|
|
2091
|
+
**update**(collectionId: string,
|
|
2092
|
+
templateId: string,
|
|
2093
|
+
data: TemplateUpdate) → `Promise<Template>`
|
|
2094
|
+
|
|
2095
|
+
**del**(collectionId: string, templateId: string) → `Promise<Template>`
|
|
2096
|
+
|
|
2097
|
+
**uploadAsset**(collectionId: string,
|
|
2098
|
+
templateId: string,
|
|
2099
|
+
file: File | Blob) → `Promise<`
|
|
2100
|
+
|
|
2101
|
+
**getAllowed**(collectionId: string) → `Promise<TemplatePublic[]>`
|
|
2102
|
+
|
|
2103
|
+
**getPublic**(collectionId: string, templateId: string) → `Promise<TemplatePublic>`
|
|
2104
|
+
|
|
2105
|
+
**getGlobal**(templateId: string) → `Promise<TemplatePublic>`
|
|
2106
|
+
|
|
2107
|
+
**getAllowedGlobal**(collectionId: string) → `Promise<TemplatePublic[]>`
|
|
2108
|
+
|
|
2025
2109
|
### variant
|
|
2026
2110
|
|
|
2027
2111
|
**get**(collectionId: string,
|
package/dist/api/index.d.ts
CHANGED
|
@@ -16,9 +16,10 @@ export { ai } from "./ai";
|
|
|
16
16
|
export { comms } from "./comms";
|
|
17
17
|
export { nfc } from "./nfc";
|
|
18
18
|
export { contact } from "./contact";
|
|
19
|
-
export { actions } from "./actions";
|
|
20
19
|
export { broadcasts } from "./broadcasts";
|
|
21
20
|
export { segments } from "./segments";
|
|
22
21
|
export { journeys } from "./journeys";
|
|
23
22
|
export { qr } from "./qr";
|
|
23
|
+
export { template } from "./template";
|
|
24
|
+
export { interactions } from "./interactions";
|
|
24
25
|
export type { AIGenerateContentRequest, AIGenerateImageRequest, AISearchPhotosRequest, AISearchPhotosPhoto } from "./ai";
|
package/dist/api/index.js
CHANGED
|
@@ -18,8 +18,9 @@ export { ai } from "./ai";
|
|
|
18
18
|
export { comms } from "./comms";
|
|
19
19
|
export { nfc } from "./nfc";
|
|
20
20
|
export { contact } from "./contact";
|
|
21
|
-
export { actions } from "./actions";
|
|
22
21
|
export { broadcasts } from "./broadcasts";
|
|
23
22
|
export { segments } from "./segments";
|
|
24
23
|
export { journeys } from "./journeys";
|
|
25
24
|
export { qr } from "./qr";
|
|
25
|
+
export { template } from "./template";
|
|
26
|
+
export { interactions } from "./interactions";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { AdminInteractionsByUserRequest, AdminInteractionsCountsByOutcomeRequest, AdminActorIdsByInteractionRequest, AppendInteractionBody, UpdateInteractionBody, OutcomeCount, ActorId, ActorWithOutcome, InteractionEventRow, PublicInteractionsCountsByOutcomeRequest, PublicInteractionsByUserRequest, CreateInteractionTypeBody, UpdateInteractionTypeBody, ListInteractionTypesQuery, InteractionTypeRecord, InteractionTypeList } from "../types/interaction";
|
|
2
|
+
export declare namespace interactions {
|
|
3
|
+
/**
|
|
4
|
+
* POST /admin/collection/:collectionId/interaction/by-user
|
|
5
|
+
* Returns BigQuery interaction rows, newest first.
|
|
6
|
+
*/
|
|
7
|
+
function byUser(collectionId: string, query?: AdminInteractionsByUserRequest): Promise<InteractionEventRow[]>;
|
|
8
|
+
/**
|
|
9
|
+
* POST /admin/collection/:collectionId/interaction/counts-by-outcome
|
|
10
|
+
* Returns array of { outcome, count }.
|
|
11
|
+
*/
|
|
12
|
+
function countsByOutcome(collectionId: string, query?: AdminInteractionsCountsByOutcomeRequest): Promise<OutcomeCount[]>;
|
|
13
|
+
/**
|
|
14
|
+
* POST /admin/collection/:collectionId/interaction/actor-ids/by-interaction
|
|
15
|
+
* Returns list of IDs, optionally with outcome when includeOutcome=true.
|
|
16
|
+
*/
|
|
17
|
+
function actorIdsByInteraction(collectionId: string, query: AdminActorIdsByInteractionRequest): Promise<ActorId[] | ActorWithOutcome[]>;
|
|
18
|
+
/**
|
|
19
|
+
* POST /admin/collection/:collectionId/interaction/append
|
|
20
|
+
* Appends one interaction event.
|
|
21
|
+
*/
|
|
22
|
+
function appendEvent(collectionId: string, body: AppendInteractionBody): Promise<{
|
|
23
|
+
success: true;
|
|
24
|
+
}>;
|
|
25
|
+
function updateEvent(collectionId: string, body: UpdateInteractionBody): Promise<{
|
|
26
|
+
success: true;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Appends one interaction event from a public source.
|
|
30
|
+
*/
|
|
31
|
+
function submitPublicEvent(collectionId: string, body: AppendInteractionBody): Promise<{
|
|
32
|
+
success: true;
|
|
33
|
+
}>;
|
|
34
|
+
function create(collectionId: string, body: CreateInteractionTypeBody): Promise<InteractionTypeRecord>;
|
|
35
|
+
function list(collectionId: string, query?: ListInteractionTypesQuery): Promise<InteractionTypeList>;
|
|
36
|
+
function get(collectionId: string, id: string): Promise<InteractionTypeRecord>;
|
|
37
|
+
function update(collectionId: string, id: string, patchBody: UpdateInteractionTypeBody): Promise<InteractionTypeRecord>;
|
|
38
|
+
function remove(collectionId: string, id: string): Promise<void>;
|
|
39
|
+
function publicCountsByOutcome(collectionId: string, body: PublicInteractionsCountsByOutcomeRequest, authToken?: string): Promise<OutcomeCount[]>;
|
|
40
|
+
function publicMyInteractions(collectionId: string, body: PublicInteractionsByUserRequest, authToken?: string): Promise<InteractionEventRow[]>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// src/api/interactions.ts
|
|
2
|
+
import { request, post, patch, del } from "../http";
|
|
3
|
+
function encodeQuery(params) {
|
|
4
|
+
const search = new URLSearchParams();
|
|
5
|
+
for (const [key, value] of Object.entries(params)) {
|
|
6
|
+
if (value === undefined || value === null || value === "")
|
|
7
|
+
continue;
|
|
8
|
+
if (typeof value === "boolean") {
|
|
9
|
+
search.set(key, value ? "true" : "false");
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
search.set(key, String(value));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const qs = search.toString();
|
|
16
|
+
return qs ? `?${qs}` : "";
|
|
17
|
+
}
|
|
18
|
+
export var interactions;
|
|
19
|
+
(function (interactions) {
|
|
20
|
+
/**
|
|
21
|
+
* POST /admin/collection/:collectionId/interaction/by-user
|
|
22
|
+
* Returns BigQuery interaction rows, newest first.
|
|
23
|
+
*/
|
|
24
|
+
async function byUser(collectionId, query = {}) {
|
|
25
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/by-user`;
|
|
26
|
+
return post(path, query);
|
|
27
|
+
}
|
|
28
|
+
interactions.byUser = byUser;
|
|
29
|
+
/**
|
|
30
|
+
* POST /admin/collection/:collectionId/interaction/counts-by-outcome
|
|
31
|
+
* Returns array of { outcome, count }.
|
|
32
|
+
*/
|
|
33
|
+
async function countsByOutcome(collectionId, query = {}) {
|
|
34
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/counts-by-outcome`;
|
|
35
|
+
return post(path, query);
|
|
36
|
+
}
|
|
37
|
+
interactions.countsByOutcome = countsByOutcome;
|
|
38
|
+
/**
|
|
39
|
+
* POST /admin/collection/:collectionId/interaction/actor-ids/by-interaction
|
|
40
|
+
* Returns list of IDs, optionally with outcome when includeOutcome=true.
|
|
41
|
+
*/
|
|
42
|
+
async function actorIdsByInteraction(collectionId, query) {
|
|
43
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/actor-ids/by-interaction`;
|
|
44
|
+
return post(path, query);
|
|
45
|
+
}
|
|
46
|
+
interactions.actorIdsByInteraction = actorIdsByInteraction;
|
|
47
|
+
/**
|
|
48
|
+
* POST /admin/collection/:collectionId/interaction/append
|
|
49
|
+
* Appends one interaction event.
|
|
50
|
+
*/
|
|
51
|
+
async function appendEvent(collectionId, body) {
|
|
52
|
+
if (!body.userId && !body.contactId) {
|
|
53
|
+
throw new Error("AppendInteractionBody must include one of userId or contactId");
|
|
54
|
+
}
|
|
55
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/append`;
|
|
56
|
+
return post(path, body);
|
|
57
|
+
}
|
|
58
|
+
interactions.appendEvent = appendEvent;
|
|
59
|
+
async function updateEvent(collectionId, body) {
|
|
60
|
+
if (!body.userId && !body.contactId) {
|
|
61
|
+
throw new Error("AppendInteractionBody must include one of userId or contactId");
|
|
62
|
+
}
|
|
63
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/append`;
|
|
64
|
+
return post(path, body);
|
|
65
|
+
}
|
|
66
|
+
interactions.updateEvent = updateEvent;
|
|
67
|
+
/**
|
|
68
|
+
* Appends one interaction event from a public source.
|
|
69
|
+
*/
|
|
70
|
+
async function submitPublicEvent(collectionId, body) {
|
|
71
|
+
if (!body.userId && !body.contactId) {
|
|
72
|
+
throw new Error("AppendInteractionBody must include one of userId or contactId");
|
|
73
|
+
}
|
|
74
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/interaction/submit`;
|
|
75
|
+
return post(path, body);
|
|
76
|
+
}
|
|
77
|
+
interactions.submitPublicEvent = submitPublicEvent;
|
|
78
|
+
// CRUD: Interaction Types (Postgres)
|
|
79
|
+
async function create(collectionId, body) {
|
|
80
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/`;
|
|
81
|
+
return post(path, body);
|
|
82
|
+
}
|
|
83
|
+
interactions.create = create;
|
|
84
|
+
async function list(collectionId, query = {}) {
|
|
85
|
+
const qs = encodeQuery(query);
|
|
86
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/${qs}`;
|
|
87
|
+
return request(path);
|
|
88
|
+
}
|
|
89
|
+
interactions.list = list;
|
|
90
|
+
async function get(collectionId, id) {
|
|
91
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/${encodeURIComponent(id)}`;
|
|
92
|
+
return request(path);
|
|
93
|
+
}
|
|
94
|
+
interactions.get = get;
|
|
95
|
+
async function update(collectionId, id, patchBody) {
|
|
96
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/${encodeURIComponent(id)}`;
|
|
97
|
+
return patch(path, patchBody);
|
|
98
|
+
}
|
|
99
|
+
interactions.update = update;
|
|
100
|
+
async function remove(collectionId, id) {
|
|
101
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/interaction/${encodeURIComponent(id)}`;
|
|
102
|
+
return del(path);
|
|
103
|
+
}
|
|
104
|
+
interactions.remove = remove;
|
|
105
|
+
// Public endpoints (permission-aware)
|
|
106
|
+
async function publicCountsByOutcome(collectionId, body, authToken) {
|
|
107
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/interaction/counts-by-outcome`;
|
|
108
|
+
const headers = authToken ? { AUTHORIZATION: `Bearer ${authToken}` } : undefined;
|
|
109
|
+
return post(path, body, headers);
|
|
110
|
+
}
|
|
111
|
+
interactions.publicCountsByOutcome = publicCountsByOutcome;
|
|
112
|
+
async function publicMyInteractions(collectionId, body, authToken) {
|
|
113
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/interaction/by-user`;
|
|
114
|
+
const headers = authToken ? { AUTHORIZATION: `Bearer ${authToken}` } : undefined;
|
|
115
|
+
return post(path, body, headers);
|
|
116
|
+
}
|
|
117
|
+
interactions.publicMyInteractions = publicMyInteractions;
|
|
118
|
+
})(interactions || (interactions = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Template, TemplateInput, TemplateUpdate, TemplatePublic } from "../types";
|
|
2
|
+
export declare namespace template {
|
|
3
|
+
function getAll(collectionId: string): Promise<Template[]>;
|
|
4
|
+
function get(collectionId: string, templateId: string): Promise<Template>;
|
|
5
|
+
function create(collectionId: string, data: TemplateInput): Promise<Template>;
|
|
6
|
+
function update(collectionId: string, templateId: string, data: TemplateUpdate): Promise<Template>;
|
|
7
|
+
function del(collectionId: string, templateId: string): Promise<Template>;
|
|
8
|
+
function uploadAsset(collectionId: string, templateId: string, file: File | Blob): Promise<{
|
|
9
|
+
url: string;
|
|
10
|
+
}>;
|
|
11
|
+
function getAllowed(collectionId: string): Promise<TemplatePublic[]>;
|
|
12
|
+
function getPublic(collectionId: string, templateId: string): Promise<TemplatePublic>;
|
|
13
|
+
function getGlobal(templateId: string): Promise<TemplatePublic>;
|
|
14
|
+
function getAllowedGlobal(collectionId: string): Promise<TemplatePublic[]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { request, post, put, del as httpDel } from "../http";
|
|
2
|
+
export var template;
|
|
3
|
+
(function (template) {
|
|
4
|
+
// Admin APIs
|
|
5
|
+
async function getAll(collectionId) {
|
|
6
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/template`;
|
|
7
|
+
return request(path);
|
|
8
|
+
}
|
|
9
|
+
template.getAll = getAll;
|
|
10
|
+
async function get(collectionId, templateId) {
|
|
11
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/template/${encodeURIComponent(templateId)}`;
|
|
12
|
+
return request(path);
|
|
13
|
+
}
|
|
14
|
+
template.get = get;
|
|
15
|
+
async function create(collectionId, data) {
|
|
16
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/template`;
|
|
17
|
+
return post(path, data);
|
|
18
|
+
}
|
|
19
|
+
template.create = create;
|
|
20
|
+
async function update(collectionId, templateId, data) {
|
|
21
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/template/${encodeURIComponent(templateId)}`;
|
|
22
|
+
return put(path, data);
|
|
23
|
+
}
|
|
24
|
+
template.update = update;
|
|
25
|
+
// Delete returns the (soft-deleted) Template per spec
|
|
26
|
+
async function del(collectionId, templateId) {
|
|
27
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/template/${encodeURIComponent(templateId)}`;
|
|
28
|
+
return httpDel(path);
|
|
29
|
+
}
|
|
30
|
+
template.del = del;
|
|
31
|
+
async function uploadAsset(collectionId, templateId, file) {
|
|
32
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/template/${encodeURIComponent(templateId)}/addFile`;
|
|
33
|
+
const form = new FormData();
|
|
34
|
+
form.append("file", file);
|
|
35
|
+
return post(path, form);
|
|
36
|
+
}
|
|
37
|
+
template.uploadAsset = uploadAsset;
|
|
38
|
+
// Public APIs
|
|
39
|
+
async function getAllowed(collectionId) {
|
|
40
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/template/getAllowed`;
|
|
41
|
+
return request(path);
|
|
42
|
+
}
|
|
43
|
+
template.getAllowed = getAllowed;
|
|
44
|
+
async function getPublic(collectionId, templateId) {
|
|
45
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/template/${encodeURIComponent(templateId)}`;
|
|
46
|
+
return request(path);
|
|
47
|
+
}
|
|
48
|
+
template.getPublic = getPublic;
|
|
49
|
+
async function getGlobal(templateId) {
|
|
50
|
+
const path = `/public/template/${encodeURIComponent(templateId)}`;
|
|
51
|
+
return request(path);
|
|
52
|
+
}
|
|
53
|
+
template.getGlobal = getGlobal;
|
|
54
|
+
async function getAllowedGlobal(collectionId) {
|
|
55
|
+
const path = `/public/template/getAllowed/${encodeURIComponent(collectionId)}`;
|
|
56
|
+
return request(path);
|
|
57
|
+
}
|
|
58
|
+
template.getAllowedGlobal = getAllowedGlobal;
|
|
59
|
+
})(template || (template = {}));
|
package/dist/types/actions.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -11,9 +11,10 @@ export * from "./auth";
|
|
|
11
11
|
export * from "./comms";
|
|
12
12
|
export * from "./nfc";
|
|
13
13
|
export * from "./contact";
|
|
14
|
-
export * from "./actions";
|
|
15
14
|
export * from "./broadcasts";
|
|
16
15
|
export * from "./segments";
|
|
17
16
|
export * from "./common";
|
|
18
17
|
export * from "./journeys";
|
|
19
18
|
export * from "./qr";
|
|
19
|
+
export * from "./template";
|
|
20
|
+
export * from "./interaction";
|
package/dist/types/index.js
CHANGED
|
@@ -13,9 +13,10 @@ export * from "./auth";
|
|
|
13
13
|
export * from "./comms";
|
|
14
14
|
export * from "./nfc";
|
|
15
15
|
export * from "./contact";
|
|
16
|
-
export * from "./actions";
|
|
17
16
|
export * from "./broadcasts";
|
|
18
17
|
export * from "./segments";
|
|
19
18
|
export * from "./common";
|
|
20
19
|
export * from "./journeys";
|
|
21
20
|
export * from "./qr";
|
|
21
|
+
export * from "./template";
|
|
22
|
+
export * from "./interaction";
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { IdField } from './common';
|
|
2
|
+
export interface AdminInteractionsByUserRequest {
|
|
3
|
+
userId?: string;
|
|
4
|
+
contactId?: string;
|
|
5
|
+
appId?: string;
|
|
6
|
+
interactionId?: string;
|
|
7
|
+
broadcastId?: string;
|
|
8
|
+
outcome?: string | null;
|
|
9
|
+
from?: string;
|
|
10
|
+
to?: string;
|
|
11
|
+
limit?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface AdminInteractionsCountsByOutcomeRequest {
|
|
14
|
+
appId?: string;
|
|
15
|
+
interactionId?: string;
|
|
16
|
+
from?: string;
|
|
17
|
+
to?: string;
|
|
18
|
+
limit?: number;
|
|
19
|
+
dedupeLatest?: boolean;
|
|
20
|
+
idField?: IdField;
|
|
21
|
+
}
|
|
22
|
+
export interface AdminActorIdsByInteractionRequest {
|
|
23
|
+
interactionId: string;
|
|
24
|
+
idField?: IdField;
|
|
25
|
+
outcome?: string | null;
|
|
26
|
+
includeOutcome?: boolean;
|
|
27
|
+
from?: string;
|
|
28
|
+
to?: string;
|
|
29
|
+
limit?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface PublicInteractionsCountsByOutcomeRequest {
|
|
32
|
+
appId: string;
|
|
33
|
+
interactionId: string;
|
|
34
|
+
from?: string;
|
|
35
|
+
to?: string;
|
|
36
|
+
limit?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface PublicInteractionsByUserRequest {
|
|
39
|
+
appId: string;
|
|
40
|
+
interactionId: string;
|
|
41
|
+
from?: string;
|
|
42
|
+
to?: string;
|
|
43
|
+
limit?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface InteractionEventRow {
|
|
46
|
+
orgId: string;
|
|
47
|
+
collectionId: string;
|
|
48
|
+
timestamp: string;
|
|
49
|
+
appId?: string;
|
|
50
|
+
interactionId?: string;
|
|
51
|
+
broadcastId?: string;
|
|
52
|
+
userId?: string;
|
|
53
|
+
contactId?: string;
|
|
54
|
+
outcome?: string | null;
|
|
55
|
+
metadata?: Record<string, unknown>;
|
|
56
|
+
[k: string]: unknown;
|
|
57
|
+
}
|
|
58
|
+
export interface OutcomeCount {
|
|
59
|
+
outcome: string | null;
|
|
60
|
+
count: number;
|
|
61
|
+
}
|
|
62
|
+
export type ActorId = string;
|
|
63
|
+
export interface ActorWithOutcome {
|
|
64
|
+
id: string;
|
|
65
|
+
outcome: string | null;
|
|
66
|
+
}
|
|
67
|
+
export interface InteractionEventBase {
|
|
68
|
+
collectionId: string;
|
|
69
|
+
ordId: string;
|
|
70
|
+
userId?: string;
|
|
71
|
+
contactId?: string;
|
|
72
|
+
interactionId: string;
|
|
73
|
+
appId?: string;
|
|
74
|
+
broadcastId?: string;
|
|
75
|
+
journeyId?: string;
|
|
76
|
+
productId?: string;
|
|
77
|
+
proofId?: string;
|
|
78
|
+
variantId?: string;
|
|
79
|
+
batchId?: string;
|
|
80
|
+
source?: string;
|
|
81
|
+
eventType?: string;
|
|
82
|
+
outcome?: string;
|
|
83
|
+
timestamp?: string;
|
|
84
|
+
metadata?: Record<string, unknown>;
|
|
85
|
+
[k: string]: any;
|
|
86
|
+
}
|
|
87
|
+
export interface AppendInteractionBody extends InteractionEventBase {
|
|
88
|
+
}
|
|
89
|
+
export interface UpdateInteractionBody extends InteractionEventBase {
|
|
90
|
+
eventId: string;
|
|
91
|
+
status?: 'active' | 'deleted';
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* InteractionPermissions: configuration for public + authenticated interaction behavior.
|
|
95
|
+
*
|
|
96
|
+
* Stored under the `permissions` JSON for an interaction definition (Postgres `interactions` table).
|
|
97
|
+
* These keys control whether submissions are allowed, visibility of summaries, and guardrails.
|
|
98
|
+
*/
|
|
99
|
+
export interface InteractionPermissions {
|
|
100
|
+
/** Enable/disable submissions globally for this interaction (default: enabled). */
|
|
101
|
+
enabled?: boolean;
|
|
102
|
+
/** Require an authenticated user to submit. If true, anonymous/public submissions are blocked. */
|
|
103
|
+
requireAuth?: boolean;
|
|
104
|
+
/** Allow public (non-auth) submissions in general. */
|
|
105
|
+
allowPublicSubmit?: boolean;
|
|
106
|
+
/** Allow anonymous submissions even without a session (subset of public). */
|
|
107
|
+
allowAnonymousSubmit?: boolean;
|
|
108
|
+
/** Restrict submissions to matching origins (e.g., site domains). Uses substring match. */
|
|
109
|
+
allowedOrigins?: string[];
|
|
110
|
+
/** ISO datetime: submissions allowed at or after this time. */
|
|
111
|
+
startAt?: string;
|
|
112
|
+
/** ISO datetime: submissions allowed up to and including this time. */
|
|
113
|
+
endAt?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Enforce uniqueness per user: prevent duplicate submissions for this interaction.
|
|
116
|
+
* If true, optionally use `uniquePerUserWindowSeconds` to scope the window.
|
|
117
|
+
*/
|
|
118
|
+
uniquePerUser?: boolean;
|
|
119
|
+
/** Time window in seconds for uniqueness checks (e.g., 86400 for one day). */
|
|
120
|
+
uniquePerUserWindowSeconds?: number;
|
|
121
|
+
/** Optional outcome tag used when checking duplicates (e.g., "submitted"). */
|
|
122
|
+
uniqueOutcome?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Public summary visibility (counts, aggregates) without auth.
|
|
125
|
+
* If false, summaries require `allowAuthenticatedSummary` + user auth.
|
|
126
|
+
*/
|
|
127
|
+
allowPublicSummary?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Authenticated summary visibility (counts, aggregates) when user is signed in.
|
|
130
|
+
*/
|
|
131
|
+
allowAuthenticatedSummary?: boolean;
|
|
132
|
+
/** Allow an authenticated user to read their own interaction history via the public API. */
|
|
133
|
+
allowOwnRead?: boolean;
|
|
134
|
+
}
|
|
135
|
+
export interface InteractionTypeRecord {
|
|
136
|
+
id?: string;
|
|
137
|
+
collectionId: string;
|
|
138
|
+
appId: string;
|
|
139
|
+
permissions?: InteractionPermissions;
|
|
140
|
+
data?: {
|
|
141
|
+
display?: {
|
|
142
|
+
title?: string;
|
|
143
|
+
description?: string;
|
|
144
|
+
icon?: string;
|
|
145
|
+
color?: string;
|
|
146
|
+
};
|
|
147
|
+
interactionType?: string;
|
|
148
|
+
[key: string]: unknown;
|
|
149
|
+
};
|
|
150
|
+
createdAt: string;
|
|
151
|
+
}
|
|
152
|
+
export interface InteractionTypeList {
|
|
153
|
+
items: InteractionTypeRecord[];
|
|
154
|
+
limit: number;
|
|
155
|
+
offset: number;
|
|
156
|
+
}
|
|
157
|
+
export interface CreateInteractionTypeBody {
|
|
158
|
+
id: string;
|
|
159
|
+
appId: string;
|
|
160
|
+
permissions?: InteractionPermissions;
|
|
161
|
+
data?: Record<string, unknown>;
|
|
162
|
+
}
|
|
163
|
+
export interface UpdateInteractionTypeBody {
|
|
164
|
+
appId?: string;
|
|
165
|
+
permissions?: InteractionPermissions;
|
|
166
|
+
data?: Record<string, unknown>;
|
|
167
|
+
}
|
|
168
|
+
export interface ListInteractionTypesQuery {
|
|
169
|
+
appId?: string;
|
|
170
|
+
limit?: number;
|
|
171
|
+
offset?: number;
|
|
172
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface TemplateBase {
|
|
2
|
+
id: string;
|
|
3
|
+
collectionId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
type: string;
|
|
7
|
+
resizeMode?: string;
|
|
8
|
+
pdf?: {
|
|
9
|
+
base: {
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
|
12
|
+
orientation: 'portrait' | 'landscape';
|
|
13
|
+
};
|
|
14
|
+
subject?: string;
|
|
15
|
+
body?: string;
|
|
16
|
+
css?: string;
|
|
17
|
+
public?: boolean;
|
|
18
|
+
engine?: string;
|
|
19
|
+
component?: string;
|
|
20
|
+
defaultProps?: Record<string, any>;
|
|
21
|
+
collections?: string[];
|
|
22
|
+
[k: string]: any;
|
|
23
|
+
}
|
|
24
|
+
export interface Template extends TemplateBase {
|
|
25
|
+
deleted?: boolean;
|
|
26
|
+
deletedAt?: string;
|
|
27
|
+
}
|
|
28
|
+
export type TemplateInput = Omit<TemplateBase, 'id' | 'collectionId'>;
|
|
29
|
+
export type TemplateUpdate = Partial<Omit<TemplateBase, 'id' | 'collectionId'>>;
|
|
30
|
+
export type TemplatePublic = TemplateBase;
|