@proveanything/smartlinks 1.8.11 → 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.
@@ -32,3 +32,4 @@ export { order } from "./order";
32
32
  export { app } from "./appObjects";
33
33
  export { attestations } from "./attestations";
34
34
  export { containers } from "./containers";
35
+ export { loyalty } from "./loyalty";
package/dist/api/index.js CHANGED
@@ -35,3 +35,4 @@ export { order } from "./order";
35
35
  export { app } from "./appObjects";
36
36
  export { attestations } from "./attestations";
37
37
  export { containers } from "./containers";
38
+ export { loyalty } from "./loyalty";
@@ -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 = {}));
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.8.11 | Generated: 2026-03-19T19:58:44.820Z
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.
@@ -4861,6 +4863,174 @@ interface LocationSearchResponse {
4861
4863
 
4862
4864
  **LocationPayload** = `Omit<`
4863
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
+
4864
5034
  ### nfc
4865
5035
 
4866
5036
  **NfcTagInfo** (interface)
@@ -7064,6 +7234,89 @@ Public: Fetch a global location by ID GET /public/location/:locationId
7064
7234
  locationId: string) → `Promise<Location>`
7065
7235
  Public: Fetch a location for a collection; returns either a collection-owned or global fallback GET /public/collection/:collectionId/location/:locationId
7066
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
+
7067
7320
  ### models
7068
7321
 
7069
7322
  **list**(collectionId: string, params?: AIModelListParams) → `Promise<AIModelListResponse>`