@proveanything/smartlinks 3.0.0-alpha.1 → 3.0.0-alpha.2
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/README.md +7 -7
- package/dist/api/analytics.d.ts +5 -4
- package/dist/api/analytics.js +5 -4
- package/dist/api/appConfiguration.d.ts +23 -18
- package/dist/api/appConfiguration.js +24 -18
- package/dist/api/appObjects.d.ts +54 -10
- package/dist/api/appObjects.js +75 -40
- package/dist/api/asset.d.ts +28 -22
- package/dist/api/asset.js +45 -56
- package/dist/api/attestation.d.ts +11 -3
- package/dist/api/attestation.js +12 -3
- package/dist/api/attestations.d.ts +12 -8
- package/dist/api/attestations.js +18 -21
- package/dist/api/authKit.d.ts +15 -10
- package/dist/api/authKit.js +17 -11
- package/dist/api/batch.d.ts +36 -25
- package/dist/api/batch.js +46 -39
- package/dist/api/bookings.d.ts +18 -9
- package/dist/api/bookings.js +23 -13
- package/dist/api/broadcasts.js +3 -17
- package/dist/api/claimSet.d.ts +26 -12
- package/dist/api/claimSet.js +32 -24
- package/dist/api/collection.d.ts +15 -10
- package/dist/api/collection.js +17 -11
- package/dist/api/comms.d.ts +12 -6
- package/dist/api/comms.js +12 -6
- package/dist/api/conditions.d.ts +7 -6
- package/dist/api/conditions.js +8 -6
- package/dist/api/contact.d.ts +6 -2
- package/dist/api/contact.js +25 -60
- package/dist/api/containers.d.ts +14 -10
- package/dist/api/containers.js +19 -14
- package/dist/api/crate.js +7 -9
- package/dist/api/dpp.d.ts +20 -13
- package/dist/api/dpp.js +23 -15
- package/dist/api/facets.d.ts +38 -13
- package/dist/api/facets.js +40 -15
- package/dist/api/files.d.ts +5 -2
- package/dist/api/files.js +7 -4
- package/dist/api/form.d.ts +8 -5
- package/dist/api/form.js +9 -5
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +0 -1
- package/dist/api/integrations.d.ts +29 -17
- package/dist/api/integrations.js +32 -25
- package/dist/api/interactions.d.ts +11 -6
- package/dist/api/interactions.js +14 -23
- package/dist/api/jobs.d.ts +16 -6
- package/dist/api/jobs.js +30 -20
- package/dist/api/journeys.js +2 -14
- package/dist/api/journeysAnalytics.d.ts +8 -5
- package/dist/api/journeysAnalytics.js +8 -5
- package/dist/api/knowledge.d.ts +20 -14
- package/dist/api/knowledge.js +22 -15
- package/dist/api/location.d.ts +6 -3
- package/dist/api/location.js +8 -22
- package/dist/api/lots.d.ts +9 -5
- package/dist/api/lots.js +22 -26
- package/dist/api/loyalty.d.ts +25 -16
- package/dist/api/loyalty.js +33 -32
- package/dist/api/nfc.d.ts +3 -1
- package/dist/api/nfc.js +3 -1
- package/dist/api/order.d.ts +45 -39
- package/dist/api/order.js +48 -65
- package/dist/api/partner.d.ts +17 -14
- package/dist/api/partner.js +21 -22
- package/dist/api/products.d.ts +35 -12
- package/dist/api/products.js +36 -13
- package/dist/api/proof.d.ts +41 -19
- package/dist/api/proof.js +44 -23
- package/dist/api/segments.js +3 -15
- package/dist/api/serviceAccounts.d.ts +8 -5
- package/dist/api/serviceAccounts.js +9 -6
- package/dist/api/shop.d.ts +7 -5
- package/dist/api/shop.js +13 -19
- package/dist/api/subscriptions.d.ts +12 -10
- package/dist/api/subscriptions.js +17 -25
- package/dist/api/tags.d.ts +23 -20
- package/dist/api/tags.js +40 -52
- package/dist/api/template.d.ts +16 -11
- package/dist/api/template.js +19 -13
- package/dist/api/translations.js +2 -12
- package/dist/api/userGroups.d.ts +26 -16
- package/dist/api/userGroups.js +43 -30
- package/dist/api/variant.d.ts +10 -7
- package/dist/api/variant.js +11 -7
- package/dist/api/wallet.d.ts +14 -11
- package/dist/api/wallet.js +15 -12
- package/dist/docs/API_SUMMARY.md +289 -483
- package/dist/docs/ai.md +15 -15
- package/dist/docs/analytics.md +1 -1
- package/dist/docs/app-objects.md +4 -4
- package/dist/docs/attestations.md +8 -8
- package/dist/docs/contact-search.md +2 -3
- package/dist/docs/knowledge.md +3 -3
- package/dist/docs/lists.md +58 -15
- package/dist/docs/upgrading-to-3.md +238 -136
- package/dist/list.d.ts +12 -0
- package/dist/list.js +59 -0
- package/dist/openapi.yaml +301 -662
- package/dist/types/analytics.d.ts +7 -3
- package/dist/types/appObjects.d.ts +27 -12
- package/dist/types/appOptions.d.ts +2 -2
- package/dist/types/asset.d.ts +5 -6
- package/dist/types/attestations.d.ts +7 -9
- package/dist/types/batch.d.ts +5 -5
- package/dist/types/bookings.d.ts +10 -5
- package/dist/types/comms.d.ts +9 -5
- package/dist/types/contact.d.ts +7 -4
- package/dist/types/containers.d.ts +2 -1
- package/dist/types/facets.d.ts +14 -2
- package/dist/types/files.d.ts +3 -2
- package/dist/types/integrations.d.ts +2 -1
- package/dist/types/interaction.d.ts +15 -7
- package/dist/types/jobs.d.ts +1 -1
- package/dist/types/journeysAnalytics.d.ts +3 -2
- package/dist/types/knowledge.d.ts +6 -3
- package/dist/types/knowledge.js +0 -1
- package/dist/types/list.d.ts +30 -2
- package/dist/types/location.d.ts +7 -2
- package/dist/types/location.js +0 -1
- package/dist/types/lots.d.ts +5 -2
- package/dist/types/lots.js +0 -6
- package/dist/types/order.d.ts +22 -20
- package/dist/types/product.d.ts +28 -11
- package/dist/types/proof.d.ts +7 -8
- package/dist/types/tags.d.ts +5 -3
- package/dist/types/userGroups.d.ts +3 -3
- package/dist/types/userGroups.js +0 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/API_SUMMARY.md +289 -483
- package/docs/ai.md +15 -15
- package/docs/analytics.md +1 -1
- package/docs/app-objects.md +4 -4
- package/docs/attestations.md +8 -8
- package/docs/contact-search.md +2 -3
- package/docs/knowledge.md +3 -3
- package/docs/lists.md +58 -15
- package/docs/upgrading-to-3.md +238 -136
- package/openapi.yaml +301 -662
- package/package.json +1 -1
- package/scripts/lib/upgrade.mjs +216 -60
- package/scripts/upgrade.mjs +33 -10
- package/upgrade/3.json +2731 -2213
package/dist/api/loyalty.d.ts
CHANGED
|
@@ -2,14 +2,16 @@ import type { LoyaltyScheme, LoyaltyMember, LoyaltyTransaction, LoyaltyEarningRu
|
|
|
2
2
|
import type { ListResult, ListOptions } from "../types/list.js";
|
|
3
3
|
export declare namespace loyalty {
|
|
4
4
|
/**
|
|
5
|
-
* The collection's loyalty schemes (admin).
|
|
5
|
+
* The collection's loyalty schemes (admin), a page at a time. Page with `limit` (50 unless you
|
|
6
|
+
* say) and `cursor`. Pass `includeDeleted: true` to include deleted schemes.
|
|
6
7
|
*
|
|
7
8
|
* @example
|
|
8
9
|
* ```typescript
|
|
9
|
-
*
|
|
10
|
+
* let page = await loyalty.list('coll_123', { limit: 50 })
|
|
11
|
+
* while (page.nextCursor) page = await loyalty.list('coll_123', { limit: 50, cursor: page.nextCursor })
|
|
10
12
|
* ```
|
|
11
13
|
*/
|
|
12
|
-
function list(collectionId: string, params?: {
|
|
14
|
+
function list(collectionId: string, params?: ListOptions & {
|
|
13
15
|
includeDeleted?: boolean;
|
|
14
16
|
}): Promise<ListResult<LoyaltyScheme>>;
|
|
15
17
|
function get(collectionId: string, schemeId: string): Promise<LoyaltyScheme>;
|
|
@@ -17,14 +19,16 @@ export declare namespace loyalty {
|
|
|
17
19
|
function update(collectionId: string, schemeId: string, body: UpdateLoyaltySchemeBody): Promise<LoyaltyScheme>;
|
|
18
20
|
function remove(collectionId: string, schemeId: string): Promise<LoyaltyScheme>;
|
|
19
21
|
/**
|
|
20
|
-
* A scheme's earning rules (admin).
|
|
22
|
+
* A scheme's earning rules (admin), a page at a time. Page with `limit` (50 unless you say) and
|
|
23
|
+
* `cursor`.
|
|
21
24
|
*
|
|
22
25
|
* @example
|
|
23
26
|
* ```typescript
|
|
24
|
-
*
|
|
27
|
+
* let page = await loyalty.listEarningRules('coll_123', schemeId, { limit: 50 })
|
|
28
|
+
* while (page.nextCursor) page = await loyalty.listEarningRules('coll_123', schemeId, { limit: 50, cursor: page.nextCursor })
|
|
25
29
|
* ```
|
|
26
30
|
*/
|
|
27
|
-
function listEarningRules(collectionId: string, schemeId: string): Promise<ListResult<LoyaltyEarningRule>>;
|
|
31
|
+
function listEarningRules(collectionId: string, schemeId: string, options?: ListOptions): Promise<ListResult<LoyaltyEarningRule>>;
|
|
28
32
|
function getEarningRule(collectionId: string, schemeId: string, ruleId: string): Promise<LoyaltyEarningRule>;
|
|
29
33
|
function createEarningRule(collectionId: string, schemeId: string, body: CreateLoyaltyEarningRuleBody): Promise<LoyaltyEarningRule>;
|
|
30
34
|
function updateEarningRule(collectionId: string, schemeId: string, ruleId: string, body: UpdateLoyaltyEarningRuleBody): Promise<LoyaltyEarningRule>;
|
|
@@ -62,28 +66,32 @@ export declare namespace loyalty {
|
|
|
62
66
|
*/
|
|
63
67
|
function getMemberHistory(collectionId: string, schemeId: string, contactId: string, params?: ListOptions): Promise<ListResult<LoyaltyTransaction>>;
|
|
64
68
|
/**
|
|
65
|
-
* List active schemes for a collection. No authentication required.
|
|
69
|
+
* List active schemes for a collection, a page at a time. No authentication required. Page with
|
|
70
|
+
* `limit` (50 unless you say) and `cursor`.
|
|
66
71
|
*
|
|
67
72
|
* @example
|
|
68
73
|
* ```typescript
|
|
69
|
-
*
|
|
74
|
+
* let page = await loyalty.publicList('coll_123', { limit: 50 })
|
|
75
|
+
* while (page.nextCursor) page = await loyalty.publicList('coll_123', { limit: 50, cursor: page.nextCursor })
|
|
70
76
|
* ```
|
|
71
77
|
*/
|
|
72
|
-
function publicList(collectionId: string): Promise<ListResult<LoyaltyScheme>>;
|
|
78
|
+
function publicList(collectionId: string, options?: ListOptions): Promise<ListResult<LoyaltyScheme>>;
|
|
73
79
|
/**
|
|
74
80
|
* Get a single active scheme. No authentication required.
|
|
75
81
|
*/
|
|
76
82
|
function publicGet(collectionId: string, schemeId: string): Promise<LoyaltyScheme>;
|
|
77
83
|
/**
|
|
78
84
|
* List active earning rules for a scheme — useful for showing "how to earn"
|
|
79
|
-
* in a loyalty UI. No authentication required.
|
|
85
|
+
* in a loyalty UI. No authentication required. A page at a time: page with `limit` (50 unless you
|
|
86
|
+
* say) and `cursor`.
|
|
80
87
|
*
|
|
81
88
|
* @example
|
|
82
89
|
* ```typescript
|
|
83
|
-
*
|
|
90
|
+
* let page = await loyalty.publicListEarningRules('coll_123', schemeId, { limit: 50 })
|
|
91
|
+
* while (page.nextCursor) page = await loyalty.publicListEarningRules('coll_123', schemeId, { limit: 50, cursor: page.nextCursor })
|
|
84
92
|
* ```
|
|
85
93
|
*/
|
|
86
|
-
function publicListEarningRules(collectionId: string, schemeId: string): Promise<ListResult<LoyaltyEarningRule>>;
|
|
94
|
+
function publicListEarningRules(collectionId: string, schemeId: string, options?: ListOptions): Promise<ListResult<LoyaltyEarningRule>>;
|
|
87
95
|
/**
|
|
88
96
|
* Get all active schemes with the caller's membership embedded in each.
|
|
89
97
|
*
|
|
@@ -95,15 +103,16 @@ export declare namespace loyalty {
|
|
|
95
103
|
* (or null if not yet enrolled in that scheme)
|
|
96
104
|
* - Unauthenticated: `member` is null on all schemes
|
|
97
105
|
*
|
|
98
|
-
*
|
|
106
|
+
* A page at a time: page with `limit` (50 unless you say) and `cursor`.
|
|
99
107
|
*
|
|
100
108
|
* @example
|
|
101
109
|
* ```typescript
|
|
102
|
-
*
|
|
103
|
-
* for (const scheme of items) console.log(scheme.name, scheme.member?.balance ?? 0)
|
|
110
|
+
* let page = await loyalty.publicGetMe('coll_123')
|
|
111
|
+
* for (const scheme of page.items) console.log(scheme.name, scheme.member?.balance ?? 0)
|
|
112
|
+
* while (page.nextCursor) page = await loyalty.publicGetMe('coll_123', { cursor: page.nextCursor })
|
|
104
113
|
* ```
|
|
105
114
|
*/
|
|
106
|
-
function publicGetMe(collectionId: string): Promise<ListResult<LoyaltySchemeWithMembership>>;
|
|
115
|
+
function publicGetMe(collectionId: string, options?: ListOptions): Promise<ListResult<LoyaltySchemeWithMembership>>;
|
|
107
116
|
/**
|
|
108
117
|
* Get the authenticated caller's membership (balance + lifetimePoints)
|
|
109
118
|
* on a specific scheme. Requires authentication.
|
package/dist/api/loyalty.js
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
// src/api/loyalty.ts
|
|
2
2
|
import { request, post, patch, del } from "../http.js";
|
|
3
|
-
|
|
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
|
-
}
|
|
3
|
+
import { listQuery } from "../list.js";
|
|
12
4
|
export var loyalty;
|
|
13
5
|
(function (loyalty) {
|
|
14
6
|
// ── Admin — Schemes ───────────────────────────────────────────────────────────
|
|
15
7
|
/**
|
|
16
|
-
* The collection's loyalty schemes (admin).
|
|
8
|
+
* The collection's loyalty schemes (admin), a page at a time. Page with `limit` (50 unless you
|
|
9
|
+
* say) and `cursor`. Pass `includeDeleted: true` to include deleted schemes.
|
|
17
10
|
*
|
|
18
11
|
* @example
|
|
19
12
|
* ```typescript
|
|
20
|
-
*
|
|
13
|
+
* let page = await loyalty.list('coll_123', { limit: 50 })
|
|
14
|
+
* while (page.nextCursor) page = await loyalty.list('coll_123', { limit: 50, cursor: page.nextCursor })
|
|
21
15
|
* ```
|
|
22
16
|
*/
|
|
23
17
|
async function list(collectionId, params = {}) {
|
|
24
|
-
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme${
|
|
18
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme${listQuery(params)}`);
|
|
25
19
|
}
|
|
26
20
|
loyalty.list = list;
|
|
27
21
|
async function get(collectionId, schemeId) {
|
|
@@ -42,15 +36,17 @@ export var loyalty;
|
|
|
42
36
|
loyalty.remove = remove;
|
|
43
37
|
// ── Admin — Earning Rules ─────────────────────────────────────────────────────
|
|
44
38
|
/**
|
|
45
|
-
* A scheme's earning rules (admin).
|
|
39
|
+
* A scheme's earning rules (admin), a page at a time. Page with `limit` (50 unless you say) and
|
|
40
|
+
* `cursor`.
|
|
46
41
|
*
|
|
47
42
|
* @example
|
|
48
43
|
* ```typescript
|
|
49
|
-
*
|
|
44
|
+
* let page = await loyalty.listEarningRules('coll_123', schemeId, { limit: 50 })
|
|
45
|
+
* while (page.nextCursor) page = await loyalty.listEarningRules('coll_123', schemeId, { limit: 50, cursor: page.nextCursor })
|
|
50
46
|
* ```
|
|
51
47
|
*/
|
|
52
|
-
async function listEarningRules(collectionId, schemeId) {
|
|
53
|
-
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/earningRule`);
|
|
48
|
+
async function listEarningRules(collectionId, schemeId, options = {}) {
|
|
49
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/earningRule${listQuery(options)}`);
|
|
54
50
|
}
|
|
55
51
|
loyalty.listEarningRules = listEarningRules;
|
|
56
52
|
async function getEarningRule(collectionId, schemeId, ruleId) {
|
|
@@ -80,7 +76,7 @@ export var loyalty;
|
|
|
80
76
|
* ```
|
|
81
77
|
*/
|
|
82
78
|
async function listMembers(collectionId, schemeId, params = {}) {
|
|
83
|
-
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/member${
|
|
79
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/member${listQuery(params)}`);
|
|
84
80
|
}
|
|
85
81
|
loyalty.listMembers = listMembers;
|
|
86
82
|
async function getMember(collectionId, schemeId, contactId) {
|
|
@@ -112,20 +108,22 @@ export var loyalty;
|
|
|
112
108
|
* ```
|
|
113
109
|
*/
|
|
114
110
|
async function getMemberHistory(collectionId, schemeId, contactId, params = {}) {
|
|
115
|
-
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/member/${encodeURIComponent(contactId)}/history${
|
|
111
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/member/${encodeURIComponent(contactId)}/history${listQuery(params)}`);
|
|
116
112
|
}
|
|
117
113
|
loyalty.getMemberHistory = getMemberHistory;
|
|
118
114
|
// ── Public ────────────────────────────────────────────────────────────────────
|
|
119
115
|
/**
|
|
120
|
-
* List active schemes for a collection. No authentication required.
|
|
116
|
+
* List active schemes for a collection, a page at a time. No authentication required. Page with
|
|
117
|
+
* `limit` (50 unless you say) and `cursor`.
|
|
121
118
|
*
|
|
122
119
|
* @example
|
|
123
120
|
* ```typescript
|
|
124
|
-
*
|
|
121
|
+
* let page = await loyalty.publicList('coll_123', { limit: 50 })
|
|
122
|
+
* while (page.nextCursor) page = await loyalty.publicList('coll_123', { limit: 50, cursor: page.nextCursor })
|
|
125
123
|
* ```
|
|
126
124
|
*/
|
|
127
|
-
async function publicList(collectionId) {
|
|
128
|
-
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme`);
|
|
125
|
+
async function publicList(collectionId, options = {}) {
|
|
126
|
+
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme${listQuery(options)}`);
|
|
129
127
|
}
|
|
130
128
|
loyalty.publicList = publicList;
|
|
131
129
|
/**
|
|
@@ -137,15 +135,17 @@ export var loyalty;
|
|
|
137
135
|
loyalty.publicGet = publicGet;
|
|
138
136
|
/**
|
|
139
137
|
* List active earning rules for a scheme — useful for showing "how to earn"
|
|
140
|
-
* in a loyalty UI. No authentication required.
|
|
138
|
+
* in a loyalty UI. No authentication required. A page at a time: page with `limit` (50 unless you
|
|
139
|
+
* say) and `cursor`.
|
|
141
140
|
*
|
|
142
141
|
* @example
|
|
143
142
|
* ```typescript
|
|
144
|
-
*
|
|
143
|
+
* let page = await loyalty.publicListEarningRules('coll_123', schemeId, { limit: 50 })
|
|
144
|
+
* while (page.nextCursor) page = await loyalty.publicListEarningRules('coll_123', schemeId, { limit: 50, cursor: page.nextCursor })
|
|
145
145
|
* ```
|
|
146
146
|
*/
|
|
147
|
-
async function publicListEarningRules(collectionId, schemeId) {
|
|
148
|
-
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/earningRule`);
|
|
147
|
+
async function publicListEarningRules(collectionId, schemeId, options = {}) {
|
|
148
|
+
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/earningRule${listQuery(options)}`);
|
|
149
149
|
}
|
|
150
150
|
loyalty.publicListEarningRules = publicListEarningRules;
|
|
151
151
|
/**
|
|
@@ -159,16 +159,17 @@ export var loyalty;
|
|
|
159
159
|
* (or null if not yet enrolled in that scheme)
|
|
160
160
|
* - Unauthenticated: `member` is null on all schemes
|
|
161
161
|
*
|
|
162
|
-
*
|
|
162
|
+
* A page at a time: page with `limit` (50 unless you say) and `cursor`.
|
|
163
163
|
*
|
|
164
164
|
* @example
|
|
165
165
|
* ```typescript
|
|
166
|
-
*
|
|
167
|
-
* for (const scheme of items) console.log(scheme.name, scheme.member?.balance ?? 0)
|
|
166
|
+
* let page = await loyalty.publicGetMe('coll_123')
|
|
167
|
+
* for (const scheme of page.items) console.log(scheme.name, scheme.member?.balance ?? 0)
|
|
168
|
+
* while (page.nextCursor) page = await loyalty.publicGetMe('coll_123', { cursor: page.nextCursor })
|
|
168
169
|
* ```
|
|
169
170
|
*/
|
|
170
|
-
async function publicGetMe(collectionId) {
|
|
171
|
-
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/me`);
|
|
171
|
+
async function publicGetMe(collectionId, options = {}) {
|
|
172
|
+
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/me${listQuery(options)}`);
|
|
172
173
|
}
|
|
173
174
|
loyalty.publicGetMe = publicGetMe;
|
|
174
175
|
/**
|
|
@@ -190,7 +191,7 @@ export var loyalty;
|
|
|
190
191
|
* ```
|
|
191
192
|
*/
|
|
192
193
|
async function publicGetMineHistory(collectionId, schemeId, params = {}) {
|
|
193
|
-
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/member/me/history${
|
|
194
|
+
return request(`/public/collection/${encodeURIComponent(collectionId)}/loyaltyScheme/${encodeURIComponent(schemeId)}/member/me/history${listQuery(params)}`);
|
|
194
195
|
}
|
|
195
196
|
loyalty.publicGetMineHistory = publicGetMineHistory;
|
|
196
197
|
})(loyalty || (loyalty = {}));
|
package/dist/api/nfc.d.ts
CHANGED
|
@@ -12,9 +12,11 @@ export declare namespace nfc {
|
|
|
12
12
|
*/
|
|
13
13
|
function validate(data: NfcValidateRequest): Promise<NfcValidateResponse>;
|
|
14
14
|
/**
|
|
15
|
-
* Lookup a tag by its ID (public): every code that tag is known as
|
|
15
|
+
* Lookup a tag by its ID (public): every code that tag is known as, a page at a time.
|
|
16
16
|
* GET /public/nfc/findByTag/:tagId
|
|
17
17
|
*
|
|
18
|
+
* @param tagId - The tag's ID
|
|
19
|
+
*
|
|
18
20
|
* @example
|
|
19
21
|
* ```typescript
|
|
20
22
|
* const { items } = await nfc.lookupTag('04A1B2C3D4E5F6')
|
package/dist/api/nfc.js
CHANGED
|
@@ -19,9 +19,11 @@ export var nfc;
|
|
|
19
19
|
}
|
|
20
20
|
nfc.validate = validate;
|
|
21
21
|
/**
|
|
22
|
-
* Lookup a tag by its ID (public): every code that tag is known as
|
|
22
|
+
* Lookup a tag by its ID (public): every code that tag is known as, a page at a time.
|
|
23
23
|
* GET /public/nfc/findByTag/:tagId
|
|
24
24
|
*
|
|
25
|
+
* @param tagId - The tag's ID
|
|
26
|
+
*
|
|
25
27
|
* @example
|
|
26
28
|
* ```typescript
|
|
27
29
|
* const { items } = await nfc.lookupTag('04A1B2C3D4E5F6')
|
package/dist/api/order.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ export declare namespace order {
|
|
|
114
114
|
* // Filter by customer with items
|
|
115
115
|
* const customerOrders = await order.list('coll_123', {
|
|
116
116
|
* customerId: 'CUST-789',
|
|
117
|
-
*
|
|
117
|
+
* expand: ['items']
|
|
118
118
|
* })
|
|
119
119
|
*
|
|
120
120
|
* // Purchase orders from one supplier
|
|
@@ -124,7 +124,7 @@ export declare namespace order {
|
|
|
124
124
|
function list(collectionId: string, params?: ListOrdersRequest): Promise<ListResult<Order>>;
|
|
125
125
|
/**
|
|
126
126
|
* Get items from an order with pagination support.
|
|
127
|
-
* Use this for orders with many items instead of
|
|
127
|
+
* Use this for orders with many items instead of `expand: ['items']`.
|
|
128
128
|
*
|
|
129
129
|
* @param collectionId - Identifier of the parent collection
|
|
130
130
|
* @param orderId - Order ID
|
|
@@ -198,21 +198,18 @@ export declare namespace order {
|
|
|
198
198
|
* More powerful than the basic list() function.
|
|
199
199
|
*
|
|
200
200
|
* @param collectionId - Identifier of the parent collection
|
|
201
|
-
* @param data -
|
|
201
|
+
* @param data - The filters (`query`), plus `orderBy`, the date ranges `createdAt` / `updatedAt`,
|
|
202
|
+
* `expand: ['items']`, and `limit` and `cursor` for paging. These all sit beside `query`, not inside it.
|
|
202
203
|
* @returns Promise resolving to `{ items, nextCursor }`: the matching orders, and the cursor for the next page (null on the last)
|
|
203
204
|
* @throws ErrorResponse if the request fails
|
|
204
205
|
*
|
|
205
206
|
* @example
|
|
206
207
|
* ```typescript
|
|
207
|
-
* // Find pending orders created in January 2026
|
|
208
|
+
* // Find pending orders created in January 2026, newest first
|
|
208
209
|
* const result = await order.query('coll_123', {
|
|
209
|
-
* query: {
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* createdBefore: '2026-02-01T00:00:00Z',
|
|
213
|
-
* sortBy: 'createdAt',
|
|
214
|
-
* sortOrder: 'desc'
|
|
215
|
-
* },
|
|
210
|
+
* query: { status: 'pending' },
|
|
211
|
+
* createdAt: { gte: '2026-01-01T00:00:00Z', lte: '2026-02-01T00:00:00Z' },
|
|
212
|
+
* orderBy: [{ createdAt: 'desc' }],
|
|
216
213
|
* limit: 50
|
|
217
214
|
* })
|
|
218
215
|
* console.log(result.items.length)
|
|
@@ -220,40 +217,42 @@ export declare namespace order {
|
|
|
220
217
|
* // The next page: the same query with the cursor
|
|
221
218
|
* if (result.nextCursor) {
|
|
222
219
|
* const next = await order.query('coll_123', {
|
|
223
|
-
* query: { status: 'pending'
|
|
220
|
+
* query: { status: 'pending' },
|
|
221
|
+
* createdAt: { gte: '2026-01-01T00:00:00Z', lte: '2026-02-01T00:00:00Z' },
|
|
222
|
+
* orderBy: [{ createdAt: 'desc' }],
|
|
224
223
|
* limit: 50,
|
|
225
224
|
* cursor: result.nextCursor
|
|
226
225
|
* })
|
|
227
226
|
* }
|
|
228
227
|
*
|
|
229
|
-
* // Find orders with specific metadata and item count
|
|
228
|
+
* // Find orders with specific metadata and item count, with their items
|
|
230
229
|
* const highPriority = await order.query('coll_123', {
|
|
231
230
|
* query: {
|
|
232
231
|
* metadata: { priority: 'high' },
|
|
233
232
|
* minItemCount: 10,
|
|
234
233
|
* maxItemCount: 100
|
|
235
234
|
* },
|
|
236
|
-
*
|
|
235
|
+
* expand: ['items']
|
|
237
236
|
* })
|
|
238
237
|
*
|
|
239
|
-
|
|
238
|
+
* // Find orders containing a specific product batch
|
|
240
239
|
* const batchOrders = await order.query('coll_123', {
|
|
241
240
|
* query: {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
241
|
+
* productId: 'prod_789',
|
|
242
|
+
* batchId: 'BATCH-2024-001'
|
|
243
|
+
* },
|
|
244
|
+
* expand: ['items']
|
|
245
|
+
* })
|
|
246
|
+
*
|
|
247
|
+
* // Find an order containing one of several specific items
|
|
248
|
+
* const matched = await order.query('coll_123', {
|
|
249
|
+
* query: {
|
|
250
|
+
* items: [
|
|
251
|
+
* { itemType: 'tag', itemId: 'TAG001' },
|
|
252
|
+
* { itemType: 'serial', itemId: 'SN12345' }
|
|
253
|
+
* ]
|
|
255
254
|
* },
|
|
256
|
-
*
|
|
255
|
+
* expand: ['items']
|
|
257
256
|
* })
|
|
258
257
|
* ```
|
|
259
258
|
*/
|
|
@@ -325,20 +324,23 @@ export declare namespace order {
|
|
|
325
324
|
*
|
|
326
325
|
* @param collectionId - Identifier of the parent collection
|
|
327
326
|
* @param orderId - Order ID
|
|
328
|
-
* @param params - Optional filters (
|
|
329
|
-
* @returns Promise resolving to `{ items, nextCursor, orderRef, orderId }`: the scan events
|
|
330
|
-
*
|
|
327
|
+
* @param params - Optional filters (`from` / `to` time window, `isAdmin`), plus `limit` and `cursor` for paging
|
|
328
|
+
* @returns Promise resolving to `{ items, nextCursor, orderRef, orderId }`: the scan events, a page at a
|
|
329
|
+
* time (`limit` says how many, default 1000), with the order they belong to
|
|
331
330
|
* @throws ErrorResponse if the request fails
|
|
332
331
|
*
|
|
333
332
|
* @example
|
|
334
333
|
* ```typescript
|
|
335
|
-
* //
|
|
336
|
-
*
|
|
334
|
+
* // The first page of scan events
|
|
335
|
+
* let timeline = await order.getTimeline('coll_123', 'order_abc123')
|
|
337
336
|
*
|
|
338
337
|
* timeline.items.forEach(event => {
|
|
339
338
|
* console.log(`${event.timestamp}: ${event.eventType} by ${event.isAdmin ? 'admin' : 'customer'}`)
|
|
340
339
|
* })
|
|
341
340
|
*
|
|
341
|
+
* // The next page
|
|
342
|
+
* if (timeline.nextCursor) timeline = await order.getTimeline('coll_123', 'order_abc123', { cursor: timeline.nextCursor })
|
|
343
|
+
*
|
|
342
344
|
* // Get admin scans only from last week
|
|
343
345
|
* const adminScans = await order.getTimeline('coll_123', 'order_abc123', {
|
|
344
346
|
* isAdmin: true,
|
|
@@ -357,21 +359,25 @@ export declare namespace order {
|
|
|
357
359
|
*
|
|
358
360
|
* @param collectionId - Identifier of the parent collection
|
|
359
361
|
* @param orderId - Order ID
|
|
360
|
-
* @param params - Optional limit
|
|
361
|
-
* @returns Promise resolving to `{ items, nextCursor, orderRef, orderId }`: the scans that have a location
|
|
362
|
-
*
|
|
362
|
+
* @param params - Optional `limit` and `cursor` for paging
|
|
363
|
+
* @returns Promise resolving to `{ items, nextCursor, orderRef, orderId }`: the scans that have a location,
|
|
364
|
+
* a page at a time (`limit` says how many, default 1000), with the order they belong to
|
|
363
365
|
* @throws ErrorResponse if the request fails
|
|
364
366
|
*
|
|
365
367
|
* @example
|
|
366
368
|
* ```typescript
|
|
367
|
-
*
|
|
369
|
+
* let locations = await order.getLocationHistory('coll_123', 'order_abc123', {
|
|
368
370
|
* limit: 100
|
|
369
371
|
* })
|
|
370
372
|
*
|
|
371
|
-
* console.log(`Order has ${locations.items.length} scans with a location`)
|
|
372
373
|
* locations.items.forEach(scan => {
|
|
373
374
|
* console.log(`${scan.location} at ${scan.timestamp}`)
|
|
374
375
|
* })
|
|
376
|
+
*
|
|
377
|
+
* // The next page
|
|
378
|
+
* if (locations.nextCursor) {
|
|
379
|
+
* locations = await order.getLocationHistory('coll_123', 'order_abc123', { limit: 100, cursor: locations.nextCursor })
|
|
380
|
+
* }
|
|
375
381
|
* ```
|
|
376
382
|
*/
|
|
377
383
|
function getLocationHistory(collectionId: string, orderId: string, params?: LocationRequest): Promise<ListResult<LocationScan> & {
|