@proveanything/smartlinks 1.8.10 → 1.8.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/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/interactions.d.ts +10 -1
- package/dist/api/interactions.js +16 -0
- package/dist/api/loyalty.d.ts +65 -0
- package/dist/api/loyalty.js +139 -0
- package/dist/docs/API_SUMMARY.md +308 -1
- package/dist/docs/loyalty.md +333 -0
- package/dist/openapi.yaml +1151 -155
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/interaction.d.ts +34 -0
- package/dist/types/loyalty.d.ts +145 -0
- package/dist/types/loyalty.js +2 -0
- package/docs/API_SUMMARY.md +308 -1
- package/docs/loyalty.md +333 -0
- package/openapi.yaml +1151 -155
- package/package.json +1 -1
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdminInteractionsCountsByOutcomeRequest, AdminInteractionsQueryRequest, AppendInteractionBody, UpdateInteractionBody, OutcomeCount, InteractionEventRow, PublicInteractionsCountsByOutcomeRequest, PublicInteractionsByUserRequest, CreateInteractionTypeBody, UpdateInteractionTypeBody, ListInteractionTypesQuery, InteractionTypeRecord, InteractionTypeList } from "../types/interaction";
|
|
1
|
+
import type { AdminInteractionsCountsByOutcomeRequest, AdminInteractionsQueryRequest, AdminInteractionsAggregateRequest, AdminInteractionsAggregateResponse, AppendInteractionBody, UpdateInteractionBody, OutcomeCount, InteractionEventRow, PublicInteractionsCountsByOutcomeRequest, PublicInteractionsByUserRequest, CreateInteractionTypeBody, UpdateInteractionTypeBody, ListInteractionTypesQuery, InteractionTypeRecord, InteractionTypeList } from "../types/interaction";
|
|
2
2
|
export declare namespace interactions {
|
|
3
3
|
/**
|
|
4
4
|
* POST /admin/collection/:collectionId/interactions/query
|
|
@@ -10,6 +10,15 @@ export declare namespace interactions {
|
|
|
10
10
|
* Returns array of { outcome, count }.
|
|
11
11
|
*/
|
|
12
12
|
function countsByOutcome(collectionId: string, query?: AdminInteractionsCountsByOutcomeRequest): Promise<OutcomeCount[]>;
|
|
13
|
+
/**
|
|
14
|
+
* POST /admin/collection/:collectionId/interactions/aggregate
|
|
15
|
+
* Returns grouped numeric aggregates (sum, avg, min, max, count).
|
|
16
|
+
*/
|
|
17
|
+
function aggregate(collectionId: string, body: AdminInteractionsAggregateRequest): Promise<AdminInteractionsAggregateResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Legacy-friendly alias for aggregate().
|
|
20
|
+
*/
|
|
21
|
+
function aggregateByOutcome(collectionId: string, body: AdminInteractionsAggregateRequest): Promise<AdminInteractionsAggregateResponse>;
|
|
13
22
|
/**
|
|
14
23
|
* POST /admin/collection/:collectionId/interactions/append
|
|
15
24
|
* Appends one interaction event.
|
package/dist/api/interactions.js
CHANGED
|
@@ -35,6 +35,22 @@ export var interactions;
|
|
|
35
35
|
return post(path, query);
|
|
36
36
|
}
|
|
37
37
|
interactions.countsByOutcome = countsByOutcome;
|
|
38
|
+
/**
|
|
39
|
+
* POST /admin/collection/:collectionId/interactions/aggregate
|
|
40
|
+
* Returns grouped numeric aggregates (sum, avg, min, max, count).
|
|
41
|
+
*/
|
|
42
|
+
async function aggregate(collectionId, body) {
|
|
43
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/interactions/aggregate`;
|
|
44
|
+
return post(path, body);
|
|
45
|
+
}
|
|
46
|
+
interactions.aggregate = aggregate;
|
|
47
|
+
/**
|
|
48
|
+
* Legacy-friendly alias for aggregate().
|
|
49
|
+
*/
|
|
50
|
+
async function aggregateByOutcome(collectionId, body) {
|
|
51
|
+
return aggregate(collectionId, body);
|
|
52
|
+
}
|
|
53
|
+
interactions.aggregateByOutcome = aggregateByOutcome;
|
|
38
54
|
// Deprecated endpoint removed: actorIdsByInteraction
|
|
39
55
|
/**
|
|
40
56
|
* POST /admin/collection/:collectionId/interactions/append
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { LoyaltyScheme, LoyaltyMember, LoyaltyTransaction, LoyaltyEarningRule, LoyaltySchemeWithMembership, LoyaltyTransactionResult, LoyaltyPaginationParams, LoyaltyPaginatedResult, CreateLoyaltySchemeBody, UpdateLoyaltySchemeBody, CreateLoyaltyEarningRuleBody, UpdateLoyaltyEarningRuleBody, RecordLoyaltyTransactionBody } from "../types/loyalty";
|
|
2
|
+
export declare namespace loyalty {
|
|
3
|
+
function list(collectionId: string, params?: {
|
|
4
|
+
includeDeleted?: boolean;
|
|
5
|
+
}): Promise<LoyaltyScheme[]>;
|
|
6
|
+
function get(collectionId: string, schemeId: string): Promise<LoyaltyScheme>;
|
|
7
|
+
function create(collectionId: string, body: CreateLoyaltySchemeBody): Promise<LoyaltyScheme>;
|
|
8
|
+
function update(collectionId: string, schemeId: string, body: UpdateLoyaltySchemeBody): Promise<LoyaltyScheme>;
|
|
9
|
+
function remove(collectionId: string, schemeId: string): Promise<LoyaltyScheme>;
|
|
10
|
+
function listEarningRules(collectionId: string, schemeId: string): Promise<LoyaltyEarningRule[]>;
|
|
11
|
+
function getEarningRule(collectionId: string, schemeId: string, ruleId: string): Promise<LoyaltyEarningRule>;
|
|
12
|
+
function createEarningRule(collectionId: string, schemeId: string, body: CreateLoyaltyEarningRuleBody): Promise<LoyaltyEarningRule>;
|
|
13
|
+
function updateEarningRule(collectionId: string, schemeId: string, ruleId: string, body: UpdateLoyaltyEarningRuleBody): Promise<LoyaltyEarningRule>;
|
|
14
|
+
function removeEarningRule(collectionId: string, schemeId: string, ruleId: string): Promise<LoyaltyEarningRule>;
|
|
15
|
+
function listMembers(collectionId: string, schemeId: string, params?: LoyaltyPaginationParams): Promise<LoyaltyPaginatedResult<LoyaltyMember>>;
|
|
16
|
+
function getMember(collectionId: string, schemeId: string, contactId: string): Promise<LoyaltyMember>;
|
|
17
|
+
/**
|
|
18
|
+
* Manually award or deduct points for a contact.
|
|
19
|
+
*
|
|
20
|
+
* - `points` must be a non-zero integer
|
|
21
|
+
* - Positive = award, negative = deduct
|
|
22
|
+
* - Deducting below zero returns HTTP 422 `INSUFFICIENT_BALANCE`
|
|
23
|
+
* - Supply `idempotencyKey` to safely retry without double-crediting
|
|
24
|
+
*
|
|
25
|
+
* Points earned via interaction events are awarded automatically by the
|
|
26
|
+
* server — this endpoint is for manual adjustments and admin overrides.
|
|
27
|
+
*/
|
|
28
|
+
function recordTransaction(collectionId: string, schemeId: string, contactId: string, body: RecordLoyaltyTransactionBody): Promise<LoyaltyTransactionResult>;
|
|
29
|
+
function getMemberHistory(collectionId: string, schemeId: string, contactId: string, params?: LoyaltyPaginationParams): Promise<LoyaltyPaginatedResult<LoyaltyTransaction>>;
|
|
30
|
+
/**
|
|
31
|
+
* List active schemes for a collection. No authentication required.
|
|
32
|
+
*/
|
|
33
|
+
function publicList(collectionId: string): Promise<LoyaltyScheme[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Get a single active scheme. No authentication required.
|
|
36
|
+
*/
|
|
37
|
+
function publicGet(collectionId: string, schemeId: string): Promise<LoyaltyScheme>;
|
|
38
|
+
/**
|
|
39
|
+
* List active earning rules for a scheme — useful for showing "how to earn"
|
|
40
|
+
* in a loyalty UI. No authentication required.
|
|
41
|
+
*/
|
|
42
|
+
function publicListEarningRules(collectionId: string, schemeId: string): Promise<LoyaltyEarningRule[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Get all active schemes with the caller's membership embedded in each.
|
|
45
|
+
*
|
|
46
|
+
* This is the primary entry point for a loyalty widget — one call gives
|
|
47
|
+
* you everything needed to render a user's loyalty status across all
|
|
48
|
+
* programs in a collection.
|
|
49
|
+
*
|
|
50
|
+
* - Authenticated: `member` is populated with balance + lifetimePoints
|
|
51
|
+
* (or null if not yet enrolled in that scheme)
|
|
52
|
+
* - Unauthenticated: `member` is null on all schemes
|
|
53
|
+
*/
|
|
54
|
+
function publicGetMe(collectionId: string): Promise<LoyaltySchemeWithMembership[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Get the authenticated caller's membership (balance + lifetimePoints)
|
|
57
|
+
* on a specific scheme. Requires authentication.
|
|
58
|
+
*/
|
|
59
|
+
function publicGetMine(collectionId: string, schemeId: string): Promise<LoyaltyMember>;
|
|
60
|
+
/**
|
|
61
|
+
* Get the authenticated caller's transaction history on a specific scheme.
|
|
62
|
+
* Ordered newest first. Requires authentication.
|
|
63
|
+
*/
|
|
64
|
+
function publicGetMineHistory(collectionId: string, schemeId: string, params?: LoyaltyPaginationParams): Promise<LoyaltyPaginatedResult<LoyaltyTransaction>>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// src/api/loyalty.ts
|
|
2
|
+
import { request, post, patch, del } from "../http";
|
|
3
|
+
function encodeQuery(params) {
|
|
4
|
+
const q = new URLSearchParams();
|
|
5
|
+
for (const [k, v] of Object.entries(params)) {
|
|
6
|
+
if (v !== undefined)
|
|
7
|
+
q.set(k, String(v));
|
|
8
|
+
}
|
|
9
|
+
const s = q.toString();
|
|
10
|
+
return s ? `?${s}` : "";
|
|
11
|
+
}
|
|
12
|
+
export var loyalty;
|
|
13
|
+
(function (loyalty) {
|
|
14
|
+
// ── Admin — Schemes ───────────────────────────────────────────────────────────
|
|
15
|
+
async function list(collectionId, params = {}) {
|
|
16
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme${encodeQuery(params)}`);
|
|
17
|
+
}
|
|
18
|
+
loyalty.list = list;
|
|
19
|
+
async function get(collectionId, schemeId) {
|
|
20
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}`);
|
|
21
|
+
}
|
|
22
|
+
loyalty.get = get;
|
|
23
|
+
async function create(collectionId, body) {
|
|
24
|
+
return post(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme`, body);
|
|
25
|
+
}
|
|
26
|
+
loyalty.create = create;
|
|
27
|
+
async function update(collectionId, schemeId, body) {
|
|
28
|
+
return patch(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}`, body);
|
|
29
|
+
}
|
|
30
|
+
loyalty.update = update;
|
|
31
|
+
async function remove(collectionId, schemeId) {
|
|
32
|
+
return del(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}`);
|
|
33
|
+
}
|
|
34
|
+
loyalty.remove = remove;
|
|
35
|
+
// ── Admin — Earning Rules ─────────────────────────────────────────────────────
|
|
36
|
+
async function listEarningRules(collectionId, schemeId) {
|
|
37
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/earningRule`);
|
|
38
|
+
}
|
|
39
|
+
loyalty.listEarningRules = listEarningRules;
|
|
40
|
+
async function getEarningRule(collectionId, schemeId, ruleId) {
|
|
41
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/earningRule/${encodeURIComponent(ruleId)}`);
|
|
42
|
+
}
|
|
43
|
+
loyalty.getEarningRule = getEarningRule;
|
|
44
|
+
async function createEarningRule(collectionId, schemeId, body) {
|
|
45
|
+
return post(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/earningRule`, body);
|
|
46
|
+
}
|
|
47
|
+
loyalty.createEarningRule = createEarningRule;
|
|
48
|
+
async function updateEarningRule(collectionId, schemeId, ruleId, body) {
|
|
49
|
+
return patch(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/earningRule/${encodeURIComponent(ruleId)}`, body);
|
|
50
|
+
}
|
|
51
|
+
loyalty.updateEarningRule = updateEarningRule;
|
|
52
|
+
async function removeEarningRule(collectionId, schemeId, ruleId) {
|
|
53
|
+
return del(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/earningRule/${encodeURIComponent(ruleId)}`);
|
|
54
|
+
}
|
|
55
|
+
loyalty.removeEarningRule = removeEarningRule;
|
|
56
|
+
// ── Admin — Members ───────────────────────────────────────────────────────────
|
|
57
|
+
async function listMembers(collectionId, schemeId, params = {}) {
|
|
58
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/member${encodeQuery(params)}`);
|
|
59
|
+
}
|
|
60
|
+
loyalty.listMembers = listMembers;
|
|
61
|
+
async function getMember(collectionId, schemeId, contactId) {
|
|
62
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/member/${encodeURIComponent(contactId)}`);
|
|
63
|
+
}
|
|
64
|
+
loyalty.getMember = getMember;
|
|
65
|
+
// ── Admin — Transactions ──────────────────────────────────────────────────────
|
|
66
|
+
/**
|
|
67
|
+
* Manually award or deduct points for a contact.
|
|
68
|
+
*
|
|
69
|
+
* - `points` must be a non-zero integer
|
|
70
|
+
* - Positive = award, negative = deduct
|
|
71
|
+
* - Deducting below zero returns HTTP 422 `INSUFFICIENT_BALANCE`
|
|
72
|
+
* - Supply `idempotencyKey` to safely retry without double-crediting
|
|
73
|
+
*
|
|
74
|
+
* Points earned via interaction events are awarded automatically by the
|
|
75
|
+
* server — this endpoint is for manual adjustments and admin overrides.
|
|
76
|
+
*/
|
|
77
|
+
async function recordTransaction(collectionId, schemeId, contactId, body) {
|
|
78
|
+
return post(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/member/${encodeURIComponent(contactId)}/transaction`, body);
|
|
79
|
+
}
|
|
80
|
+
loyalty.recordTransaction = recordTransaction;
|
|
81
|
+
async function getMemberHistory(collectionId, schemeId, contactId, params = {}) {
|
|
82
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/member/${encodeURIComponent(contactId)}/history${encodeQuery(params)}`);
|
|
83
|
+
}
|
|
84
|
+
loyalty.getMemberHistory = getMemberHistory;
|
|
85
|
+
// ── Public ────────────────────────────────────────────────────────────────────
|
|
86
|
+
/**
|
|
87
|
+
* List active schemes for a collection. No authentication required.
|
|
88
|
+
*/
|
|
89
|
+
async function publicList(collectionId) {
|
|
90
|
+
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme`);
|
|
91
|
+
}
|
|
92
|
+
loyalty.publicList = publicList;
|
|
93
|
+
/**
|
|
94
|
+
* Get a single active scheme. No authentication required.
|
|
95
|
+
*/
|
|
96
|
+
async function publicGet(collectionId, schemeId) {
|
|
97
|
+
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}`);
|
|
98
|
+
}
|
|
99
|
+
loyalty.publicGet = publicGet;
|
|
100
|
+
/**
|
|
101
|
+
* List active earning rules for a scheme — useful for showing "how to earn"
|
|
102
|
+
* in a loyalty UI. No authentication required.
|
|
103
|
+
*/
|
|
104
|
+
async function publicListEarningRules(collectionId, schemeId) {
|
|
105
|
+
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/earningRule`);
|
|
106
|
+
}
|
|
107
|
+
loyalty.publicListEarningRules = publicListEarningRules;
|
|
108
|
+
/**
|
|
109
|
+
* Get all active schemes with the caller's membership embedded in each.
|
|
110
|
+
*
|
|
111
|
+
* This is the primary entry point for a loyalty widget — one call gives
|
|
112
|
+
* you everything needed to render a user's loyalty status across all
|
|
113
|
+
* programs in a collection.
|
|
114
|
+
*
|
|
115
|
+
* - Authenticated: `member` is populated with balance + lifetimePoints
|
|
116
|
+
* (or null if not yet enrolled in that scheme)
|
|
117
|
+
* - Unauthenticated: `member` is null on all schemes
|
|
118
|
+
*/
|
|
119
|
+
async function publicGetMe(collectionId) {
|
|
120
|
+
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/me`);
|
|
121
|
+
}
|
|
122
|
+
loyalty.publicGetMe = publicGetMe;
|
|
123
|
+
/**
|
|
124
|
+
* Get the authenticated caller's membership (balance + lifetimePoints)
|
|
125
|
+
* on a specific scheme. Requires authentication.
|
|
126
|
+
*/
|
|
127
|
+
async function publicGetMine(collectionId, schemeId) {
|
|
128
|
+
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/member/me`);
|
|
129
|
+
}
|
|
130
|
+
loyalty.publicGetMine = publicGetMine;
|
|
131
|
+
/**
|
|
132
|
+
* Get the authenticated caller's transaction history on a specific scheme.
|
|
133
|
+
* Ordered newest first. Requires authentication.
|
|
134
|
+
*/
|
|
135
|
+
async function publicGetMineHistory(collectionId, schemeId, params = {}) {
|
|
136
|
+
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/member/me/history${encodeQuery(params)}`);
|
|
137
|
+
}
|
|
138
|
+
loyalty.publicGetMineHistory = publicGetMineHistory;
|
|
139
|
+
})(loyalty || (loyalty = {}));
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.12 | Generated: 2026-03-22T11:27:19.142Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -26,6 +26,7 @@ For detailed guides on specific features:
|
|
|
26
26
|
- **[App Objects: Cases, Threads & Records](app-objects.md)** - Generic app-scoped building blocks for support cases, discussions, bookings, registrations, and more
|
|
27
27
|
- **[Communications](comms.md)** - Transactional sends, multi-channel broadcasts, consent management, push registration, and analytics
|
|
28
28
|
- **[Interactions & Event Tracking](interactions.md)** - Log user events, count outcomes, query history, and define interaction types with permissions
|
|
29
|
+
- **[Loyalty: Points, Members & Earning Rules](loyalty.md)** - Loyalty schemes, automatic point earning via interaction rules, member balances, transaction history, and manual adjustments
|
|
29
30
|
- **[Deep Link Discovery](deep-link-discovery.md)** - Registering and discovering navigable app states for portal menus and AI orchestration
|
|
30
31
|
- **[AI-Native App Manifests](manifests.md)** - How AI workflows discover, configure, and import apps via structured manifests and prose guides
|
|
31
32
|
- **[AI Guide Template](ai-guide-template.md)** - A sample for an app on how to build an AI setup guide
|
|
@@ -79,6 +80,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
79
80
|
|
|
80
81
|
— Analytics & Events —
|
|
81
82
|
- **interactions** - Log and analyze interactions/outcomes; aggregates and actor lists; interaction definition CRUD. → [Guide](interactions.md)
|
|
83
|
+
- **loyalty** - Loyalty programmes: schemes, earning rules tied to interactions, member balances, transaction ledger, and manual adjustments. → [Guide](loyalty.md)
|
|
82
84
|
|
|
83
85
|
— Automation —
|
|
84
86
|
- **journeys** - Configure automated flows triggered by events or schedules; steps, rules; full CRUD.
|
|
@@ -4401,6 +4403,52 @@ interface AdminInteractionsCountsByOutcomeRequest {
|
|
|
4401
4403
|
}
|
|
4402
4404
|
```
|
|
4403
4405
|
|
|
4406
|
+
**AdminInteractionsAggregateRequest** (interface)
|
|
4407
|
+
```typescript
|
|
4408
|
+
interface AdminInteractionsAggregateRequest {
|
|
4409
|
+
appId?: string
|
|
4410
|
+
interactionId?: string
|
|
4411
|
+
interactionIds?: string[]
|
|
4412
|
+
scope?: string
|
|
4413
|
+
outcome?: string | null
|
|
4414
|
+
from?: string
|
|
4415
|
+
to?: string
|
|
4416
|
+
limit?: number
|
|
4417
|
+
dedupeLatest?: boolean
|
|
4418
|
+
groupBy: string
|
|
4419
|
+
aggregate: {
|
|
4420
|
+
field: string
|
|
4421
|
+
ops: Array<'count' | 'sum' | 'avg' | 'min' | 'max'>
|
|
4422
|
+
}
|
|
4423
|
+
}
|
|
4424
|
+
```
|
|
4425
|
+
|
|
4426
|
+
**AdminInteractionsAggregateResponse** (interface)
|
|
4427
|
+
```typescript
|
|
4428
|
+
interface AdminInteractionsAggregateResponse {
|
|
4429
|
+
groupBy: string
|
|
4430
|
+
aggregate: {
|
|
4431
|
+
field: string
|
|
4432
|
+
ops: Array<'count' | 'sum' | 'avg' | 'min' | 'max'>
|
|
4433
|
+
dedupeLatest?: boolean
|
|
4434
|
+
}
|
|
4435
|
+
rows: AdminInteractionsAggregateRow[]
|
|
4436
|
+
}
|
|
4437
|
+
```
|
|
4438
|
+
|
|
4439
|
+
**AdminInteractionsAggregateRow** (interface)
|
|
4440
|
+
```typescript
|
|
4441
|
+
interface AdminInteractionsAggregateRow {
|
|
4442
|
+
groupValue: string | null
|
|
4443
|
+
eventCount: number
|
|
4444
|
+
count?: number
|
|
4445
|
+
sum?: number
|
|
4446
|
+
avg?: number
|
|
4447
|
+
min?: number
|
|
4448
|
+
max?: number
|
|
4449
|
+
}
|
|
4450
|
+
```
|
|
4451
|
+
|
|
4404
4452
|
**PublicInteractionsCountsByOutcomeRequest** (interface)
|
|
4405
4453
|
```typescript
|
|
4406
4454
|
interface PublicInteractionsCountsByOutcomeRequest {
|
|
@@ -4815,6 +4863,174 @@ interface LocationSearchResponse {
|
|
|
4815
4863
|
|
|
4816
4864
|
**LocationPayload** = `Omit<`
|
|
4817
4865
|
|
|
4866
|
+
### loyalty
|
|
4867
|
+
|
|
4868
|
+
**LoyaltyScheme** (interface)
|
|
4869
|
+
```typescript
|
|
4870
|
+
interface LoyaltyScheme {
|
|
4871
|
+
id: string
|
|
4872
|
+
orgId: string
|
|
4873
|
+
collectionId: string
|
|
4874
|
+
name: string
|
|
4875
|
+
type: string
|
|
4876
|
+
active: boolean
|
|
4877
|
+
createdAt: string // ISO
|
|
4878
|
+
updatedAt: string // ISO
|
|
4879
|
+
deletedAt: string | null // ISO
|
|
4880
|
+
data: DataBlock
|
|
4881
|
+
owner?: DataBlock
|
|
4882
|
+
admin?: DataBlock
|
|
4883
|
+
}
|
|
4884
|
+
```
|
|
4885
|
+
|
|
4886
|
+
**LoyaltyMember** (interface)
|
|
4887
|
+
```typescript
|
|
4888
|
+
interface LoyaltyMember {
|
|
4889
|
+
id: string
|
|
4890
|
+
orgId: string
|
|
4891
|
+
collectionId: string
|
|
4892
|
+
schemeId: string
|
|
4893
|
+
contactId: string
|
|
4894
|
+
userId: string | null
|
|
4895
|
+
balance: number
|
|
4896
|
+
lifetimePoints: number
|
|
4897
|
+
createdAt: string // ISO
|
|
4898
|
+
updatedAt: string // ISO
|
|
4899
|
+
data: DataBlock
|
|
4900
|
+
owner?: DataBlock
|
|
4901
|
+
admin?: DataBlock
|
|
4902
|
+
}
|
|
4903
|
+
```
|
|
4904
|
+
|
|
4905
|
+
**LoyaltyTransaction** (interface)
|
|
4906
|
+
```typescript
|
|
4907
|
+
interface LoyaltyTransaction {
|
|
4908
|
+
id: string
|
|
4909
|
+
orgId: string
|
|
4910
|
+
collectionId: string
|
|
4911
|
+
schemeId: string
|
|
4912
|
+
memberId: string
|
|
4913
|
+
points: number
|
|
4914
|
+
reason: string | null
|
|
4915
|
+
idempotencyKey: string | null
|
|
4916
|
+
metadata: DataBlock
|
|
4917
|
+
createdAt: string // ISO
|
|
4918
|
+
}
|
|
4919
|
+
```
|
|
4920
|
+
|
|
4921
|
+
**LoyaltyEarningRule** (interface)
|
|
4922
|
+
```typescript
|
|
4923
|
+
interface LoyaltyEarningRule {
|
|
4924
|
+
id: string
|
|
4925
|
+
orgId: string
|
|
4926
|
+
collectionId: string
|
|
4927
|
+
schemeId: string
|
|
4928
|
+
interactionId: string
|
|
4929
|
+
points: number
|
|
4930
|
+
* Key-value conditions matched against the interaction event before awarding.
|
|
4931
|
+
* Supports top-level event fields (outcome, scope, status, eventType, etc.)
|
|
4932
|
+
* and dot-path into metadata (e.g. `"metadata.tier": "gold"`).
|
|
4933
|
+
* Empty object = always fires for any event on this interaction.
|
|
4934
|
+
conditions: Record<string, string>
|
|
4935
|
+
maxPerContact: number | null
|
|
4936
|
+
cooldownHours: number | null
|
|
4937
|
+
active: boolean
|
|
4938
|
+
createdAt: string // ISO
|
|
4939
|
+
updatedAt: string // ISO
|
|
4940
|
+
data: DataBlock
|
|
4941
|
+
}
|
|
4942
|
+
```
|
|
4943
|
+
|
|
4944
|
+
**LoyaltyTransactionResult** (interface)
|
|
4945
|
+
```typescript
|
|
4946
|
+
interface LoyaltyTransactionResult {
|
|
4947
|
+
member: LoyaltyMember
|
|
4948
|
+
transaction: LoyaltyTransaction
|
|
4949
|
+
}
|
|
4950
|
+
```
|
|
4951
|
+
|
|
4952
|
+
**LoyaltyPaginationParams** (interface)
|
|
4953
|
+
```typescript
|
|
4954
|
+
interface LoyaltyPaginationParams {
|
|
4955
|
+
limit?: number // default 50, max 200
|
|
4956
|
+
offset?: number
|
|
4957
|
+
}
|
|
4958
|
+
```
|
|
4959
|
+
|
|
4960
|
+
**LoyaltyPaginatedResult<T>** (interface)
|
|
4961
|
+
```typescript
|
|
4962
|
+
interface LoyaltyPaginatedResult<T> {
|
|
4963
|
+
items: T[]
|
|
4964
|
+
limit: number
|
|
4965
|
+
offset: number
|
|
4966
|
+
}
|
|
4967
|
+
```
|
|
4968
|
+
|
|
4969
|
+
**CreateLoyaltySchemeBody** (interface)
|
|
4970
|
+
```typescript
|
|
4971
|
+
interface CreateLoyaltySchemeBody {
|
|
4972
|
+
name: string
|
|
4973
|
+
type: string
|
|
4974
|
+
active?: boolean
|
|
4975
|
+
data?: DataBlock
|
|
4976
|
+
owner?: DataBlock
|
|
4977
|
+
admin?: DataBlock
|
|
4978
|
+
}
|
|
4979
|
+
```
|
|
4980
|
+
|
|
4981
|
+
**UpdateLoyaltySchemeBody** (interface)
|
|
4982
|
+
```typescript
|
|
4983
|
+
interface UpdateLoyaltySchemeBody {
|
|
4984
|
+
name?: string
|
|
4985
|
+
type?: string
|
|
4986
|
+
active?: boolean
|
|
4987
|
+
data?: DataBlock
|
|
4988
|
+
owner?: DataBlock
|
|
4989
|
+
admin?: DataBlock
|
|
4990
|
+
}
|
|
4991
|
+
```
|
|
4992
|
+
|
|
4993
|
+
**CreateLoyaltyEarningRuleBody** (interface)
|
|
4994
|
+
```typescript
|
|
4995
|
+
interface CreateLoyaltyEarningRuleBody {
|
|
4996
|
+
interactionId: string
|
|
4997
|
+
points: number
|
|
4998
|
+
conditions?: Record<string, string>
|
|
4999
|
+
maxPerContact?: number | null
|
|
5000
|
+
cooldownHours?: number | null
|
|
5001
|
+
active?: boolean
|
|
5002
|
+
data?: DataBlock
|
|
5003
|
+
}
|
|
5004
|
+
```
|
|
5005
|
+
|
|
5006
|
+
**UpdateLoyaltyEarningRuleBody** (interface)
|
|
5007
|
+
```typescript
|
|
5008
|
+
interface UpdateLoyaltyEarningRuleBody {
|
|
5009
|
+
points?: number
|
|
5010
|
+
conditions?: Record<string, string>
|
|
5011
|
+
maxPerContact?: number | null
|
|
5012
|
+
cooldownHours?: number | null
|
|
5013
|
+
active?: boolean
|
|
5014
|
+
data?: DataBlock
|
|
5015
|
+
}
|
|
5016
|
+
```
|
|
5017
|
+
|
|
5018
|
+
**RecordLoyaltyTransactionBody** (interface)
|
|
5019
|
+
```typescript
|
|
5020
|
+
interface RecordLoyaltyTransactionBody {
|
|
5021
|
+
points: number
|
|
5022
|
+
reason?: string
|
|
5023
|
+
* Optional caller-supplied key scoped to the scheme.
|
|
5024
|
+
* If a transaction with this key already exists the server returns 409.
|
|
5025
|
+
* Use to safely retry without double-crediting points.
|
|
5026
|
+
idempotencyKey?: string
|
|
5027
|
+
metadata?: DataBlock
|
|
5028
|
+
userId?: string
|
|
5029
|
+
}
|
|
5030
|
+
```
|
|
5031
|
+
|
|
5032
|
+
**DataBlock** = `Record<string, unknown>`
|
|
5033
|
+
|
|
4818
5034
|
### nfc
|
|
4819
5035
|
|
|
4820
5036
|
**NfcTagInfo** (interface)
|
|
@@ -6894,6 +7110,14 @@ POST /admin/collection/:collectionId/interactions/query Flexible query for inter
|
|
|
6894
7110
|
query: AdminInteractionsCountsByOutcomeRequest = {}) → `Promise<OutcomeCount[]>`
|
|
6895
7111
|
POST /admin/collection/:collectionId/interactions/counts-by-outcome Returns array of { outcome, count }.
|
|
6896
7112
|
|
|
7113
|
+
**aggregate**(collectionId: string,
|
|
7114
|
+
body: AdminInteractionsAggregateRequest) → `Promise<AdminInteractionsAggregateResponse>`
|
|
7115
|
+
POST /admin/collection/:collectionId/interactions/aggregate Returns grouped numeric aggregates (sum, avg, min, max, count).
|
|
7116
|
+
|
|
7117
|
+
**aggregateByOutcome**(collectionId: string,
|
|
7118
|
+
body: AdminInteractionsAggregateRequest) → `Promise<AdminInteractionsAggregateResponse>`
|
|
7119
|
+
Legacy-friendly alias for aggregate().
|
|
7120
|
+
|
|
6897
7121
|
**appendEvent**(collectionId: string,
|
|
6898
7122
|
body: AppendInteractionBody) → `Promise<`
|
|
6899
7123
|
POST /admin/collection/:collectionId/interactions/append Appends one interaction event.
|
|
@@ -7010,6 +7234,89 @@ Public: Fetch a global location by ID GET /public/location/:locationId
|
|
|
7010
7234
|
locationId: string) → `Promise<Location>`
|
|
7011
7235
|
Public: Fetch a location for a collection; returns either a collection-owned or global fallback GET /public/collection/:collectionId/location/:locationId
|
|
7012
7236
|
|
|
7237
|
+
### loyalty
|
|
7238
|
+
|
|
7239
|
+
Loyalty programmes built on top of collections. Configure schemes and earning rules; contacts earn points automatically via interaction events. See the [Loyalty guide](loyalty.md) for the full walkthrough.
|
|
7240
|
+
|
|
7241
|
+
**list**(collectionId: string,
|
|
7242
|
+
params: { includeDeleted?: boolean } = {}) → `Promise<LoyaltyScheme[]>`
|
|
7243
|
+
|
|
7244
|
+
**get**(collectionId: string,
|
|
7245
|
+
schemeId: string) → `Promise<LoyaltyScheme>`
|
|
7246
|
+
|
|
7247
|
+
**create**(collectionId: string,
|
|
7248
|
+
body: CreateLoyaltySchemeBody) → `Promise<LoyaltyScheme>`
|
|
7249
|
+
|
|
7250
|
+
**update**(collectionId: string,
|
|
7251
|
+
schemeId: string,
|
|
7252
|
+
body: UpdateLoyaltySchemeBody) → `Promise<LoyaltyScheme>`
|
|
7253
|
+
|
|
7254
|
+
**remove**(collectionId: string,
|
|
7255
|
+
schemeId: string) → `Promise<LoyaltyScheme>`
|
|
7256
|
+
|
|
7257
|
+
**listEarningRules**(collectionId: string,
|
|
7258
|
+
schemeId: string) → `Promise<LoyaltyEarningRule[]>`
|
|
7259
|
+
|
|
7260
|
+
**getEarningRule**(collectionId: string,
|
|
7261
|
+
schemeId: string,
|
|
7262
|
+
ruleId: string) → `Promise<LoyaltyEarningRule>`
|
|
7263
|
+
|
|
7264
|
+
**createEarningRule**(collectionId: string,
|
|
7265
|
+
schemeId: string,
|
|
7266
|
+
body: CreateLoyaltyEarningRuleBody) → `Promise<LoyaltyEarningRule>`
|
|
7267
|
+
|
|
7268
|
+
**updateEarningRule**(collectionId: string,
|
|
7269
|
+
schemeId: string,
|
|
7270
|
+
ruleId: string,
|
|
7271
|
+
body: UpdateLoyaltyEarningRuleBody) → `Promise<LoyaltyEarningRule>`
|
|
7272
|
+
|
|
7273
|
+
**removeEarningRule**(collectionId: string,
|
|
7274
|
+
schemeId: string,
|
|
7275
|
+
ruleId: string) → `Promise<LoyaltyEarningRule>`
|
|
7276
|
+
|
|
7277
|
+
**listMembers**(collectionId: string,
|
|
7278
|
+
schemeId: string,
|
|
7279
|
+
params: LoyaltyPaginationParams = {}) → `Promise<LoyaltyPaginatedResult<LoyaltyMember>>`
|
|
7280
|
+
|
|
7281
|
+
**getMember**(collectionId: string,
|
|
7282
|
+
schemeId: string,
|
|
7283
|
+
contactId: string) → `Promise<LoyaltyMember>`
|
|
7284
|
+
|
|
7285
|
+
**recordTransaction**(collectionId: string,
|
|
7286
|
+
schemeId: string,
|
|
7287
|
+
contactId: string,
|
|
7288
|
+
body: RecordLoyaltyTransactionBody) → `Promise<LoyaltyTransactionResult>`
|
|
7289
|
+
Manually award or deduct points for a contact. - `points` must be a non-zero integer - Positive = award, negative = deduct - Deducting below zero returns HTTP 422 `INSUFFICIENT_BALANCE` - Supply `idempotencyKey` to safely retry without double-crediting Points earned via interaction events are awarded automatically by the server — this endpoint is for manual adjustments and admin overrides.
|
|
7290
|
+
|
|
7291
|
+
**getMemberHistory**(collectionId: string,
|
|
7292
|
+
schemeId: string,
|
|
7293
|
+
contactId: string,
|
|
7294
|
+
params: LoyaltyPaginationParams = {}) → `Promise<LoyaltyPaginatedResult<LoyaltyTransaction>>`
|
|
7295
|
+
Manually award or deduct points for a contact. - `points` must be a non-zero integer - Positive = award, negative = deduct - Deducting below zero returns HTTP 422 `INSUFFICIENT_BALANCE` - Supply `idempotencyKey` to safely retry without double-crediting Points earned via interaction events are awarded automatically by the server — this endpoint is for manual adjustments and admin overrides.
|
|
7296
|
+
|
|
7297
|
+
**publicList**(collectionId: string) → `Promise<LoyaltyScheme[]>`
|
|
7298
|
+
List active schemes for a collection. No authentication required.
|
|
7299
|
+
|
|
7300
|
+
**publicGet**(collectionId: string,
|
|
7301
|
+
schemeId: string) → `Promise<LoyaltyScheme>`
|
|
7302
|
+
Get a single active scheme. No authentication required.
|
|
7303
|
+
|
|
7304
|
+
**publicListEarningRules**(collectionId: string,
|
|
7305
|
+
schemeId: string) → `Promise<LoyaltyEarningRule[]>`
|
|
7306
|
+
List active earning rules for a scheme — useful for showing "how to earn" in a loyalty UI. No authentication required.
|
|
7307
|
+
|
|
7308
|
+
**publicGetMe**(collectionId: string) → `Promise<LoyaltySchemeWithMembership[]>`
|
|
7309
|
+
Get all active schemes with the caller's membership embedded in each. This is the primary entry point for a loyalty widget — one call gives you everything needed to render a user's loyalty status across all programs in a collection. - Authenticated: `member` is populated with balance + lifetimePoints (or null if not yet enrolled in that scheme) - Unauthenticated: `member` is null on all schemes
|
|
7310
|
+
|
|
7311
|
+
**publicGetMine**(collectionId: string,
|
|
7312
|
+
schemeId: string) → `Promise<LoyaltyMember>`
|
|
7313
|
+
Get the authenticated caller's membership (balance + lifetimePoints) on a specific scheme. Requires authentication.
|
|
7314
|
+
|
|
7315
|
+
**publicGetMineHistory**(collectionId: string,
|
|
7316
|
+
schemeId: string,
|
|
7317
|
+
params: LoyaltyPaginationParams = {}) → `Promise<LoyaltyPaginatedResult<LoyaltyTransaction>>`
|
|
7318
|
+
Get the authenticated caller's transaction history on a specific scheme. Ordered newest first. Requires authentication.
|
|
7319
|
+
|
|
7013
7320
|
### models
|
|
7014
7321
|
|
|
7015
7322
|
**list**(collectionId: string, params?: AIModelListParams) → `Promise<AIModelListResponse>`
|