@open-loyalty/mcp-server 1.1.0 → 1.3.3
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 +180 -177
- package/dist/auth/provider.js +2 -14
- package/dist/auth/storage.js +22 -0
- package/dist/client/http.js +10 -0
- package/dist/config.d.ts +0 -13
- package/dist/config.js +0 -14
- package/dist/http.js +35 -3
- package/dist/instructions.d.ts +5 -0
- package/dist/instructions.js +440 -0
- package/dist/prompts/fan-engagement-setup.d.ts +107 -0
- package/dist/prompts/fan-engagement-setup.js +492 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +60 -273
- package/dist/tools/achievement/handlers.d.ts +117 -0
- package/dist/tools/achievement/handlers.js +161 -0
- package/dist/tools/achievement/index.d.ts +479 -0
- package/dist/tools/achievement/index.js +74 -0
- package/dist/tools/achievement/schemas.d.ts +433 -0
- package/dist/tools/achievement/schemas.js +142 -0
- package/dist/tools/achievement.d.ts +141 -121
- package/dist/tools/achievement.js +60 -24
- package/dist/tools/admin.d.ts +6 -6
- package/dist/tools/admin.js +12 -12
- package/dist/tools/analytics.d.ts +11 -11
- package/dist/tools/analytics.js +30 -29
- package/dist/tools/apikey.d.ts +3 -3
- package/dist/tools/apikey.js +6 -6
- package/dist/tools/audit.d.ts +2 -2
- package/dist/tools/audit.js +4 -4
- package/dist/tools/badge.d.ts +6 -6
- package/dist/tools/badge.js +23 -18
- package/dist/tools/campaign/handlers.d.ts +42 -0
- package/dist/tools/campaign/handlers.js +223 -0
- package/dist/tools/campaign/index.d.ts +783 -0
- package/dist/tools/campaign/index.js +117 -0
- package/dist/tools/campaign/member-handlers.d.ts +60 -0
- package/dist/tools/campaign/member-handlers.js +159 -0
- package/dist/tools/campaign/schemas.d.ts +704 -0
- package/dist/tools/campaign/schemas.js +259 -0
- package/dist/tools/campaign/types.d.ts +161 -0
- package/dist/tools/campaign/types.js +2 -0
- package/dist/tools/custom-event.d.ts +315 -0
- package/dist/tools/custom-event.js +270 -0
- package/dist/tools/export.d.ts +4 -4
- package/dist/tools/export.js +12 -12
- package/dist/tools/import.d.ts +3 -3
- package/dist/tools/import.js +23 -15
- package/dist/tools/index.js +13 -5
- package/dist/tools/member/handlers.d.ts +111 -0
- package/dist/tools/member/handlers.js +206 -0
- package/dist/tools/member/index.d.ts +169 -0
- package/dist/tools/member/index.js +92 -0
- package/dist/tools/member/schemas.d.ts +89 -0
- package/dist/tools/member/schemas.js +65 -0
- package/dist/tools/points.d.ts +7 -6
- package/dist/tools/points.js +21 -20
- package/dist/tools/referral/handlers.d.ts +47 -0
- package/dist/tools/referral/handlers.js +115 -0
- package/dist/tools/referral/index.d.ts +44 -0
- package/dist/tools/referral/index.js +44 -0
- package/dist/tools/referral/schemas.d.ts +34 -0
- package/dist/tools/referral/schemas.js +52 -0
- package/dist/tools/reward/handlers.d.ts +110 -0
- package/dist/tools/reward/handlers.js +289 -0
- package/dist/tools/reward/index.d.ts +177 -0
- package/dist/tools/reward/index.js +93 -0
- package/dist/tools/reward/schemas.d.ts +116 -0
- package/dist/tools/reward/schemas.js +92 -0
- package/dist/tools/role.d.ts +6 -6
- package/dist/tools/role.js +12 -12
- package/dist/tools/segment/handlers.d.ts +87 -0
- package/dist/tools/segment/handlers.js +174 -0
- package/dist/tools/segment/index.d.ts +395 -0
- package/dist/tools/segment/index.js +88 -0
- package/dist/tools/segment/schemas.d.ts +337 -0
- package/dist/tools/segment/schemas.js +79 -0
- package/dist/tools/segment.d.ts +10 -10
- package/dist/tools/segment.js +55 -31
- package/dist/tools/store.d.ts +4 -4
- package/dist/tools/store.js +8 -8
- package/dist/tools/tierset.d.ts +10 -10
- package/dist/tools/tierset.js +69 -37
- package/dist/tools/transaction.d.ts +4 -4
- package/dist/tools/transaction.js +12 -12
- package/dist/tools/wallet-type.d.ts +221 -16
- package/dist/tools/wallet-type.js +248 -17
- package/dist/tools/webhook.d.ts +6 -6
- package/dist/tools/webhook.js +90 -31
- package/dist/types/schemas/achievement.d.ts +18 -18
- package/dist/types/schemas/campaign.d.ts +64 -184
- package/dist/types/schemas/campaign.js +2 -7
- package/dist/types/schemas/common.d.ts +5 -0
- package/dist/types/schemas/common.js +5 -0
- package/dist/types/schemas/member.d.ts +2 -2
- package/dist/types/schemas/reward.d.ts +94 -18
- package/dist/types/schemas/reward.js +8 -3
- package/dist/types/schemas/wallet-type.d.ts +306 -8
- package/dist/types/schemas/wallet-type.js +82 -1
- package/dist/utils/errors.js +32 -5
- package/dist/workflows/app-login-streak.d.ts +39 -0
- package/dist/workflows/app-login-streak.js +298 -0
- package/dist/workflows/early-arrival.d.ts +33 -0
- package/dist/workflows/early-arrival.js +148 -0
- package/dist/workflows/index.d.ts +101 -0
- package/dist/workflows/index.js +208 -0
- package/dist/workflows/match-attendance.d.ts +45 -0
- package/dist/workflows/match-attendance.js +308 -0
- package/dist/workflows/sportsbar-visit.d.ts +41 -0
- package/dist/workflows/sportsbar-visit.js +284 -0
- package/dist/workflows/vod-watching.d.ts +43 -0
- package/dist/workflows/vod-watching.js +326 -0
- package/package.json +8 -2
package/dist/tools/tierset.js
CHANGED
|
@@ -5,18 +5,21 @@ import { formatApiError } from "../utils/errors.js";
|
|
|
5
5
|
import { getStoreCode } from "../config.js";
|
|
6
6
|
import { buildPaginationQuery } from "../utils/pagination.js";
|
|
7
7
|
export const TierSetListInputSchema = {
|
|
8
|
-
storeCode: z.string().optional().describe("Store code.
|
|
8
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
9
9
|
page: z.number().optional().describe("Page number for pagination (starts at 1)."),
|
|
10
10
|
perPage: z.number().optional().describe("Number of items per page."),
|
|
11
11
|
};
|
|
12
12
|
export const TierSetCreateInputSchema = {
|
|
13
|
-
storeCode: z.string().optional().describe("Store code.
|
|
13
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
14
14
|
name: z.string().describe("Name of the tier set."),
|
|
15
15
|
description: z.string().optional().describe("Description of the tier set."),
|
|
16
16
|
conditions: z.array(z.object({
|
|
17
|
-
attribute: TierSetAttributeEnum.describe("
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
attribute: TierSetAttributeEnum.describe("VALID VALUES: 'activeUnits' (current balance), 'totalEarnedUnits' (lifetime points - NOT 'earnedUnits'), " +
|
|
18
|
+
"'totalSpending' (lifetime spend), 'monthsSinceJoiningProgram' (tenure), 'cumulatedEarnedUnits'. " +
|
|
19
|
+
"Use 'totalEarnedUnits' for lifetime points earned."),
|
|
20
|
+
walletType: z.string().optional().describe("Wallet type CODE (not UUID). Required for unit-based attributes (activeUnits, totalEarnedUnits, cumulatedEarnedUnits). " +
|
|
21
|
+
"Use wallet_type_list to find walletType.code (e.g., 'default')."),
|
|
22
|
+
})).describe("Array of conditions that define tier progression criteria. IMPORTANT: Use 'totalEarnedUnits' for lifetime points (NOT 'earnedUnits')."),
|
|
20
23
|
downgrade: z.object({
|
|
21
24
|
mode: DowngradeModeEnum.describe("Downgrade mode."),
|
|
22
25
|
days: z.number().optional().describe("Number of days for x_days mode (required if mode is x_days)."),
|
|
@@ -24,11 +27,11 @@ export const TierSetCreateInputSchema = {
|
|
|
24
27
|
active: z.boolean().optional().describe("Whether the tier set is active. Defaults to true."),
|
|
25
28
|
};
|
|
26
29
|
export const TierSetGetInputSchema = {
|
|
27
|
-
storeCode: z.string().optional().describe("Store code.
|
|
30
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
28
31
|
tierSetId: z.string().describe("The tier set ID to retrieve."),
|
|
29
32
|
};
|
|
30
33
|
export const TierSetUpdateInputSchema = {
|
|
31
|
-
storeCode: z.string().optional().describe("Store code.
|
|
34
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
32
35
|
tierSetId: z.string().describe("The tier set ID to update."),
|
|
33
36
|
name: z.string().optional().describe("New name for the tier set."),
|
|
34
37
|
description: z.string().optional().describe("New description for the tier set."),
|
|
@@ -39,7 +42,7 @@ export const TierSetUpdateInputSchema = {
|
|
|
39
42
|
}).optional().describe("Downgrade configuration."),
|
|
40
43
|
};
|
|
41
44
|
export const TierSetUpdateTiersInputSchema = {
|
|
42
|
-
storeCode: z.string().optional().describe("Store code.
|
|
45
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
43
46
|
tierSetId: z.string().describe("The tier set ID to update tiers for."),
|
|
44
47
|
tiers: z.array(z.object({
|
|
45
48
|
levelId: z.string().optional().describe("Existing level ID (for updates). Omit for new tiers."),
|
|
@@ -53,7 +56,7 @@ export const TierSetUpdateTiersInputSchema = {
|
|
|
53
56
|
})).describe("Array of tier definitions."),
|
|
54
57
|
};
|
|
55
58
|
export const TierSetGetTiersInputSchema = {
|
|
56
|
-
storeCode: z.string().optional().describe("Store code.
|
|
59
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
57
60
|
tierSetId: z.string().describe("The tier set ID to get tiers for."),
|
|
58
61
|
};
|
|
59
62
|
export async function tiersetList(input) {
|
|
@@ -79,12 +82,13 @@ export async function tiersetList(input) {
|
|
|
79
82
|
};
|
|
80
83
|
}
|
|
81
84
|
catch (error) {
|
|
82
|
-
throw formatApiError(error, "
|
|
85
|
+
throw formatApiError(error, "ol_tierset_list");
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
export async function tiersetCreate(input) {
|
|
86
89
|
const storeCode = getStoreCode(input.storeCode);
|
|
87
90
|
// API requires tierSet wrapper with translations (at least en is required)
|
|
91
|
+
// Also include empty tiers array - some API versions require it
|
|
88
92
|
const payload = {
|
|
89
93
|
tierSet: {
|
|
90
94
|
translations: {
|
|
@@ -94,6 +98,7 @@ export async function tiersetCreate(input) {
|
|
|
94
98
|
},
|
|
95
99
|
},
|
|
96
100
|
conditions: input.conditions,
|
|
101
|
+
tiers: [], // Required by API - tiers are added separately via tierset_update_tiers
|
|
97
102
|
downgrade: input.downgrade,
|
|
98
103
|
active: input.active ?? true,
|
|
99
104
|
},
|
|
@@ -110,7 +115,7 @@ export async function tiersetCreate(input) {
|
|
|
110
115
|
};
|
|
111
116
|
}
|
|
112
117
|
catch (error) {
|
|
113
|
-
throw formatApiError(error, "
|
|
118
|
+
throw formatApiError(error, "ol_tierset_create");
|
|
114
119
|
}
|
|
115
120
|
}
|
|
116
121
|
export async function tiersetGet(input) {
|
|
@@ -121,31 +126,46 @@ export async function tiersetGet(input) {
|
|
|
121
126
|
return validated;
|
|
122
127
|
}
|
|
123
128
|
catch (error) {
|
|
124
|
-
throw formatApiError(error, "
|
|
129
|
+
throw formatApiError(error, "ol_tierset_get");
|
|
125
130
|
}
|
|
126
131
|
}
|
|
127
132
|
export async function tiersetUpdate(input) {
|
|
128
133
|
const storeCode = getStoreCode(input.storeCode);
|
|
129
|
-
// API requires
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
// API requires conditions to be present in PUT requests, even for metadata-only updates.
|
|
135
|
+
// Fetch existing tier set to preserve conditions.
|
|
136
|
+
let existingTierSet;
|
|
137
|
+
try {
|
|
138
|
+
const response = await apiGet(`/${storeCode}/tierSet/${input.tierSetId}`);
|
|
139
|
+
existingTierSet = TierSetSchema.parse(response);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
throw formatApiError(error, "ol_tierset_update");
|
|
143
|
+
}
|
|
144
|
+
// Build payload using existing values as defaults
|
|
145
|
+
const tierSetPayload = {
|
|
146
|
+
// Always include conditions - API requires this even for metadata updates
|
|
147
|
+
conditions: existingTierSet.conditions.map((c) => ({
|
|
148
|
+
attribute: c.attribute,
|
|
149
|
+
walletType: c.walletType,
|
|
150
|
+
})),
|
|
151
|
+
// Always include translations
|
|
152
|
+
translations: {
|
|
134
153
|
en: {
|
|
135
|
-
name: input.name
|
|
136
|
-
description: input.description
|
|
154
|
+
name: input.name ?? existingTierSet.name,
|
|
155
|
+
description: input.description ?? existingTierSet.description ?? "",
|
|
137
156
|
},
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (input.downgrade !== undefined)
|
|
157
|
+
},
|
|
158
|
+
// Preserve active status unless explicitly changed
|
|
159
|
+
active: input.active ?? existingTierSet.active,
|
|
160
|
+
};
|
|
161
|
+
if (input.downgrade !== undefined) {
|
|
143
162
|
tierSetPayload.downgrade = input.downgrade;
|
|
163
|
+
}
|
|
144
164
|
try {
|
|
145
165
|
await apiPut(`/${storeCode}/tierSet/${input.tierSetId}`, { tierSet: tierSetPayload });
|
|
146
166
|
}
|
|
147
167
|
catch (error) {
|
|
148
|
-
throw formatApiError(error, "
|
|
168
|
+
throw formatApiError(error, "ol_tierset_update");
|
|
149
169
|
}
|
|
150
170
|
}
|
|
151
171
|
export async function tiersetUpdateTiers(input) {
|
|
@@ -171,7 +191,7 @@ export async function tiersetUpdateTiers(input) {
|
|
|
171
191
|
await apiPut(`/${storeCode}/tierSet/${input.tierSetId}/tiers`, payload);
|
|
172
192
|
}
|
|
173
193
|
catch (error) {
|
|
174
|
-
throw formatApiError(error, "
|
|
194
|
+
throw formatApiError(error, "ol_tierset_update_tiers");
|
|
175
195
|
}
|
|
176
196
|
}
|
|
177
197
|
export async function tiersetGetTiers(input) {
|
|
@@ -188,44 +208,56 @@ export async function tiersetGetTiers(input) {
|
|
|
188
208
|
};
|
|
189
209
|
}
|
|
190
210
|
catch (error) {
|
|
191
|
-
throw formatApiError(error, "
|
|
211
|
+
throw formatApiError(error, "ol_tierset_get_tiers");
|
|
192
212
|
}
|
|
193
213
|
}
|
|
194
214
|
export const tiersetToolDefinitions = [
|
|
195
215
|
{
|
|
196
|
-
name: "
|
|
216
|
+
name: "ol_tierset_list",
|
|
197
217
|
title: "List Loyalty Programs",
|
|
198
|
-
description: "List all tier sets.
|
|
218
|
+
description: "List all tier sets. RECOMMENDED: Check if tier set already exists before creating a new one. " +
|
|
219
|
+
"If exists, use tierset_get to fetch conditionId needed for defining tiers via tierset_update_tiers. " +
|
|
220
|
+
"Returns tierSetId, name, active status, and tier count for each tier set.",
|
|
199
221
|
readOnly: true,
|
|
200
222
|
inputSchema: TierSetListInputSchema,
|
|
201
223
|
handler: tiersetList,
|
|
202
224
|
},
|
|
203
225
|
{
|
|
204
|
-
name: "
|
|
226
|
+
name: "ol_tierset_create",
|
|
205
227
|
title: "Create Loyalty Program",
|
|
206
|
-
description: "Create a new tier set (loyalty program structure).
|
|
228
|
+
description: "Create a new tier set (loyalty program structure). " +
|
|
229
|
+
"⚠️ LIMIT: Maximum 3 ACTIVE tier sets per store. ALWAYS call tierset_list FIRST to check existing tier sets - if one exists that matches your needs, REUSE IT instead of creating a new one. " +
|
|
230
|
+
"WORKFLOW: 1) tierset_list (check existing) → 2) tierset_create (only if needed) → 3) tierset_get (to get conditionId) → 4) tierset_update_tiers (to define thresholds). " +
|
|
231
|
+
"Valid attributes: 'totalEarnedUnits' (lifetime points), 'activeUnits' (current balance), 'totalSpending', 'monthsSinceJoiningProgram'. " +
|
|
232
|
+
"COMMON MISTAKE: Use 'totalEarnedUnits' NOT 'earnedUnits' for lifetime points. " +
|
|
233
|
+
"For unit-based attributes, set walletType to 'default'.",
|
|
207
234
|
readOnly: false,
|
|
208
235
|
inputSchema: TierSetCreateInputSchema,
|
|
209
236
|
handler: tiersetCreate,
|
|
210
237
|
},
|
|
211
238
|
{
|
|
212
|
-
name: "
|
|
239
|
+
name: "ol_tierset_get",
|
|
213
240
|
title: "Get Loyalty Program Details",
|
|
214
|
-
description: "Get tier set details including conditionId values needed for tierset_update_tiers.
|
|
241
|
+
description: "Get tier set details including conditionId values needed for tierset_update_tiers. " +
|
|
242
|
+
"CRITICAL: After tierset_create, you MUST call this to get the conditionId from the conditions array. " +
|
|
243
|
+
"The conditionId is then used in tierset_update_tiers to set tier thresholds. " +
|
|
244
|
+
"Response includes conditions[].id (this is the conditionId) and conditions[].attribute.",
|
|
215
245
|
readOnly: true,
|
|
216
246
|
inputSchema: TierSetGetInputSchema,
|
|
217
247
|
handler: tiersetGet,
|
|
218
248
|
},
|
|
219
249
|
{
|
|
220
|
-
name: "
|
|
250
|
+
name: "ol_tierset_update",
|
|
221
251
|
title: "Update Loyalty Program",
|
|
222
|
-
description: "Update tier set metadata (name, description, active status, downgrade settings).
|
|
252
|
+
description: "Update tier set metadata (name, description, active status, downgrade settings). " +
|
|
253
|
+
"Automatically preserves existing conditions (API requires them in update requests). " +
|
|
254
|
+
"Does not modify tiers - use tierset_update_tiers for that.",
|
|
223
255
|
readOnly: false,
|
|
224
256
|
inputSchema: TierSetUpdateInputSchema,
|
|
225
257
|
handler: tiersetUpdate,
|
|
226
258
|
},
|
|
227
259
|
{
|
|
228
|
-
name: "
|
|
260
|
+
name: "ol_tierset_update_tiers",
|
|
229
261
|
title: "Configure Tier Thresholds",
|
|
230
262
|
description: `Define tier thresholds for a tier set. PREREQUISITE: Call tierset_get first to obtain conditionId values. Each tier's conditions array uses conditionId from the parent tier set plus a threshold value.
|
|
231
263
|
|
|
@@ -240,7 +272,7 @@ The conditionId must match one from tierset_get response.`,
|
|
|
240
272
|
handler: tiersetUpdateTiers,
|
|
241
273
|
},
|
|
242
274
|
{
|
|
243
|
-
name: "
|
|
275
|
+
name: "ol_tierset_get_tiers",
|
|
244
276
|
title: "Get Tier Configuration",
|
|
245
277
|
description: "Get all tiers in a tier set. Returns levelId values that can be used for campaign targeting. Includes each tier's name and condition thresholds.",
|
|
246
278
|
readOnly: true,
|
|
@@ -214,7 +214,7 @@ export declare function transactionAssignMember(input: {
|
|
|
214
214
|
pointsEarned?: number;
|
|
215
215
|
}>;
|
|
216
216
|
export declare const transactionToolDefinitions: readonly [{
|
|
217
|
-
readonly name: "
|
|
217
|
+
readonly name: "ol_transaction_create";
|
|
218
218
|
readonly title: "Record Purchase";
|
|
219
219
|
readonly description: string;
|
|
220
220
|
readonly readOnly: false;
|
|
@@ -322,7 +322,7 @@ export declare const transactionToolDefinitions: readonly [{
|
|
|
322
322
|
};
|
|
323
323
|
readonly handler: typeof transactionCreate;
|
|
324
324
|
}, {
|
|
325
|
-
readonly name: "
|
|
325
|
+
readonly name: "ol_transaction_get";
|
|
326
326
|
readonly title: "Get Transaction Details";
|
|
327
327
|
readonly description: "Get transaction details including items, customerData, matched status, and pointsEarned.";
|
|
328
328
|
readonly readOnly: true;
|
|
@@ -332,7 +332,7 @@ export declare const transactionToolDefinitions: readonly [{
|
|
|
332
332
|
};
|
|
333
333
|
readonly handler: typeof transactionGet;
|
|
334
334
|
}, {
|
|
335
|
-
readonly name: "
|
|
335
|
+
readonly name: "ol_transaction_list";
|
|
336
336
|
readonly title: "Search Transactions";
|
|
337
337
|
readonly description: string;
|
|
338
338
|
readonly readOnly: true;
|
|
@@ -350,7 +350,7 @@ export declare const transactionToolDefinitions: readonly [{
|
|
|
350
350
|
};
|
|
351
351
|
readonly handler: typeof transactionList;
|
|
352
352
|
}, {
|
|
353
|
-
readonly name: "
|
|
353
|
+
readonly name: "ol_transaction_assign_member";
|
|
354
354
|
readonly title: "Link Transaction to Member";
|
|
355
355
|
readonly description: string;
|
|
356
356
|
readonly readOnly: false;
|
|
@@ -34,17 +34,17 @@ const CustomerDataInputSchema = z.object({
|
|
|
34
34
|
loyaltyCardNumber: z.string().optional().describe("Loyalty card for auto-matching."),
|
|
35
35
|
});
|
|
36
36
|
export const TransactionCreateInputSchema = {
|
|
37
|
-
storeCode: z.string().optional().describe("Store code.
|
|
37
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
38
38
|
header: TransactionHeaderInputSchema.describe("Transaction header with document info."),
|
|
39
39
|
items: z.array(TransactionItemInputSchema).describe("Array of purchased items (at least 1 required)."),
|
|
40
40
|
customerData: CustomerDataInputSchema.optional().describe("Customer data for auto-matching to member. If provided, triggers point campaigns."),
|
|
41
41
|
};
|
|
42
42
|
export const TransactionGetInputSchema = {
|
|
43
|
-
storeCode: z.string().optional().describe("Store code.
|
|
43
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
44
44
|
transactionId: z.string().describe("The transaction ID (UUID) to retrieve."),
|
|
45
45
|
};
|
|
46
46
|
export const TransactionListInputSchema = {
|
|
47
|
-
storeCode: z.string().optional().describe("Store code.
|
|
47
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
48
48
|
cursor: z.string().optional().describe("Pagination cursor from previous response. If provided, page/perPage are ignored."),
|
|
49
49
|
page: z.number().optional().describe("Page number (default: 1)."),
|
|
50
50
|
perPage: z.number().max(50).optional().describe("Items per page (default: 10, max: 50). Use 50 for aggregation queries to reduce API calls."),
|
|
@@ -56,7 +56,7 @@ export const TransactionListInputSchema = {
|
|
|
56
56
|
purchasedAtTo: z.string().optional().describe("Filter transactions purchased on or before this date (ISO format: YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ)."),
|
|
57
57
|
};
|
|
58
58
|
export const TransactionAssignMemberInputSchema = {
|
|
59
|
-
storeCode: z.string().optional().describe("Store code.
|
|
59
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
60
60
|
documentNumber: z.string().describe("Document number of the transaction to assign."),
|
|
61
61
|
customerId: z.string().optional().describe("Member ID (UUID) to assign."),
|
|
62
62
|
loyaltyCardNumber: z.string().optional().describe("Loyalty card number to match member."),
|
|
@@ -95,7 +95,7 @@ export async function transactionCreate(input) {
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
catch (error) {
|
|
98
|
-
throw formatApiError(error, "
|
|
98
|
+
throw formatApiError(error, "ol_transaction_create");
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
export async function transactionGet(input) {
|
|
@@ -116,7 +116,7 @@ export async function transactionGet(input) {
|
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
118
|
catch (error) {
|
|
119
|
-
throw formatApiError(error, "
|
|
119
|
+
throw formatApiError(error, "ol_transaction_get");
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
export async function transactionList(input) {
|
|
@@ -168,7 +168,7 @@ export async function transactionList(input) {
|
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
catch (error) {
|
|
171
|
-
throw formatApiError(error, "
|
|
171
|
+
throw formatApiError(error, "ol_transaction_list");
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
export async function transactionAssignMember(input) {
|
|
@@ -196,13 +196,13 @@ export async function transactionAssignMember(input) {
|
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
198
|
catch (error) {
|
|
199
|
-
throw formatApiError(error, "
|
|
199
|
+
throw formatApiError(error, "ol_transaction_assign_member");
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
// Tool definitions
|
|
203
203
|
export const transactionToolDefinitions = [
|
|
204
204
|
{
|
|
205
|
-
name: "
|
|
205
|
+
name: "ol_transaction_create",
|
|
206
206
|
title: "Record Purchase",
|
|
207
207
|
description: "Record a purchase transaction. If customerData provided, auto-matches to member and triggers point campaigns. " +
|
|
208
208
|
"For returns, set documentType='return' and provide linkedDocumentNumber referencing original sale. " +
|
|
@@ -212,7 +212,7 @@ export const transactionToolDefinitions = [
|
|
|
212
212
|
handler: transactionCreate,
|
|
213
213
|
},
|
|
214
214
|
{
|
|
215
|
-
name: "
|
|
215
|
+
name: "ol_transaction_get",
|
|
216
216
|
title: "Get Transaction Details",
|
|
217
217
|
description: "Get transaction details including items, customerData, matched status, and pointsEarned.",
|
|
218
218
|
readOnly: true,
|
|
@@ -220,7 +220,7 @@ export const transactionToolDefinitions = [
|
|
|
220
220
|
handler: transactionGet,
|
|
221
221
|
},
|
|
222
222
|
{
|
|
223
|
-
name: "
|
|
223
|
+
name: "ol_transaction_list",
|
|
224
224
|
title: "Search Transactions",
|
|
225
225
|
description: "List transactions with optional filters. Filter by customerId, documentNumber, documentType, matched status, or date range (purchasedAtFrom/purchasedAtTo). " +
|
|
226
226
|
"Use ISO date format for date filters (e.g., '2025-07-01' or '2025-07-01T00:00:00Z'). " +
|
|
@@ -235,7 +235,7 @@ export const transactionToolDefinitions = [
|
|
|
235
235
|
handler: transactionList,
|
|
236
236
|
},
|
|
237
237
|
{
|
|
238
|
-
name: "
|
|
238
|
+
name: "ol_transaction_assign_member",
|
|
239
239
|
title: "Link Transaction to Member",
|
|
240
240
|
description: "Assign unmatched transaction to member by ID, card number, or phone. Triggers point campaigns. " +
|
|
241
241
|
"Use this to link a transaction that wasn't matched at creation time. Returns transactionId, customerId, and pointsEarned.",
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const WalletTypeListInputSchema: {
|
|
4
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
5
|
-
};
|
|
6
|
-
export declare const WalletTypeGetInputSchema: {
|
|
7
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
8
|
-
walletTypeId: z.ZodString;
|
|
9
|
-
};
|
|
1
|
+
import { WalletType, WalletTypeListInputSchema, WalletTypeGetInputSchema, WalletTypeCreateInputSchema, WalletTypeUpdateInputSchema } from "../types/schemas/wallet-type.js";
|
|
2
|
+
export { WalletTypeListInputSchema, WalletTypeGetInputSchema, WalletTypeCreateInputSchema, WalletTypeUpdateInputSchema, };
|
|
10
3
|
export declare function walletTypeList(input: {
|
|
11
4
|
storeCode?: string;
|
|
12
5
|
}): Promise<WalletType[]>;
|
|
@@ -14,23 +7,235 @@ export declare function walletTypeGet(input: {
|
|
|
14
7
|
storeCode?: string;
|
|
15
8
|
walletTypeId: string;
|
|
16
9
|
}): Promise<WalletType>;
|
|
10
|
+
export declare function walletTypeCreate(input: {
|
|
11
|
+
storeCode?: string;
|
|
12
|
+
translations: {
|
|
13
|
+
en: {
|
|
14
|
+
name: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
unitSingularName: string;
|
|
19
|
+
unitPluralName: string;
|
|
20
|
+
unitDaysExpiryAfter: string;
|
|
21
|
+
code?: string;
|
|
22
|
+
allowNegativeBalance?: boolean;
|
|
23
|
+
unitExpiryDate?: string;
|
|
24
|
+
unitDaysActiveCount?: number;
|
|
25
|
+
unitYearsActiveCount?: number;
|
|
26
|
+
unitDaysLocked?: number;
|
|
27
|
+
allTimeNotLocked?: boolean;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
walletTypeId: string;
|
|
30
|
+
name: string;
|
|
31
|
+
code?: string;
|
|
32
|
+
}>;
|
|
33
|
+
export declare function walletTypeUpdate(input: {
|
|
34
|
+
storeCode?: string;
|
|
35
|
+
walletTypeId: string;
|
|
36
|
+
name?: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
unitSingularName?: string;
|
|
39
|
+
unitPluralName?: string;
|
|
40
|
+
active?: boolean;
|
|
41
|
+
allowNegativeBalance?: boolean;
|
|
42
|
+
limits?: {
|
|
43
|
+
points?: {
|
|
44
|
+
interval?: {
|
|
45
|
+
type: string;
|
|
46
|
+
value: number;
|
|
47
|
+
};
|
|
48
|
+
value: number;
|
|
49
|
+
};
|
|
50
|
+
pointsPerMember?: {
|
|
51
|
+
interval?: {
|
|
52
|
+
type: string;
|
|
53
|
+
value: number;
|
|
54
|
+
};
|
|
55
|
+
value: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
unitExpiryDate?: string;
|
|
59
|
+
unitDaysExpiryAfter?: string;
|
|
60
|
+
unitDaysActiveCount?: number;
|
|
61
|
+
unitYearsActiveCount?: number;
|
|
62
|
+
unitDaysLocked?: number;
|
|
63
|
+
allTimeNotLocked?: boolean;
|
|
64
|
+
}): Promise<void>;
|
|
17
65
|
export declare const walletTypeToolDefinitions: readonly [{
|
|
18
|
-
readonly name: "
|
|
66
|
+
readonly name: "ol_wallet_type_list";
|
|
19
67
|
readonly title: "List Point Currencies";
|
|
20
|
-
readonly description:
|
|
68
|
+
readonly description: string;
|
|
21
69
|
readonly readOnly: true;
|
|
22
70
|
readonly inputSchema: {
|
|
23
|
-
storeCode:
|
|
71
|
+
storeCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
24
72
|
};
|
|
25
73
|
readonly handler: typeof walletTypeList;
|
|
26
74
|
}, {
|
|
27
|
-
readonly name: "
|
|
75
|
+
readonly name: "ol_wallet_type_get";
|
|
28
76
|
readonly title: "Get Point Currency Details";
|
|
29
|
-
readonly description:
|
|
77
|
+
readonly description: string;
|
|
30
78
|
readonly readOnly: true;
|
|
31
79
|
readonly inputSchema: {
|
|
32
|
-
storeCode:
|
|
33
|
-
walletTypeId:
|
|
80
|
+
storeCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
81
|
+
walletTypeId: import("zod").ZodString;
|
|
34
82
|
};
|
|
35
83
|
readonly handler: typeof walletTypeGet;
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "ol_wallet_type_create";
|
|
86
|
+
readonly title: "Create Point Currency";
|
|
87
|
+
readonly description: string;
|
|
88
|
+
readonly readOnly: false;
|
|
89
|
+
readonly inputSchema: {
|
|
90
|
+
storeCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
91
|
+
translations: import("zod").ZodObject<{
|
|
92
|
+
en: import("zod").ZodObject<{
|
|
93
|
+
name: import("zod").ZodString;
|
|
94
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
95
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
96
|
+
name: string;
|
|
97
|
+
description?: string | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
name: string;
|
|
100
|
+
description?: string | undefined;
|
|
101
|
+
}>;
|
|
102
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
103
|
+
en: import("zod").ZodObject<{
|
|
104
|
+
name: import("zod").ZodString;
|
|
105
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
106
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
107
|
+
name: string;
|
|
108
|
+
description?: string | undefined;
|
|
109
|
+
}, {
|
|
110
|
+
name: string;
|
|
111
|
+
description?: string | undefined;
|
|
112
|
+
}>;
|
|
113
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
114
|
+
en: import("zod").ZodObject<{
|
|
115
|
+
name: import("zod").ZodString;
|
|
116
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
117
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
118
|
+
name: string;
|
|
119
|
+
description?: string | undefined;
|
|
120
|
+
}, {
|
|
121
|
+
name: string;
|
|
122
|
+
description?: string | undefined;
|
|
123
|
+
}>;
|
|
124
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
125
|
+
unitSingularName: import("zod").ZodString;
|
|
126
|
+
unitPluralName: import("zod").ZodString;
|
|
127
|
+
unitDaysExpiryAfter: import("zod").ZodString;
|
|
128
|
+
code: import("zod").ZodOptional<import("zod").ZodString>;
|
|
129
|
+
allowNegativeBalance: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
130
|
+
unitExpiryDate: import("zod").ZodOptional<import("zod").ZodString>;
|
|
131
|
+
unitDaysActiveCount: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
132
|
+
unitYearsActiveCount: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
133
|
+
unitDaysLocked: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
134
|
+
allTimeNotLocked: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
135
|
+
};
|
|
136
|
+
readonly handler: typeof walletTypeCreate;
|
|
137
|
+
}, {
|
|
138
|
+
readonly name: "ol_wallet_type_update";
|
|
139
|
+
readonly title: "Update Point Currency";
|
|
140
|
+
readonly description: string;
|
|
141
|
+
readonly readOnly: false;
|
|
142
|
+
readonly inputSchema: {
|
|
143
|
+
storeCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
144
|
+
walletTypeId: import("zod").ZodString;
|
|
145
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
146
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
147
|
+
unitSingularName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
148
|
+
unitPluralName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
149
|
+
active: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
150
|
+
allowNegativeBalance: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
151
|
+
limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
152
|
+
points: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
153
|
+
interval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
154
|
+
type: import("zod").ZodEnum<["calendarHours", "calendarDays", "calendarWeeks", "calendarMonths", "calendarYears"]>;
|
|
155
|
+
value: import("zod").ZodNumber;
|
|
156
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
157
|
+
value: number;
|
|
158
|
+
type: "calendarHours" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears";
|
|
159
|
+
}, {
|
|
160
|
+
value: number;
|
|
161
|
+
type: "calendarHours" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears";
|
|
162
|
+
}>>;
|
|
163
|
+
value: import("zod").ZodNumber;
|
|
164
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
165
|
+
value: number;
|
|
166
|
+
interval?: {
|
|
167
|
+
value: number;
|
|
168
|
+
type: "calendarHours" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears";
|
|
169
|
+
} | undefined;
|
|
170
|
+
}, {
|
|
171
|
+
value: number;
|
|
172
|
+
interval?: {
|
|
173
|
+
value: number;
|
|
174
|
+
type: "calendarHours" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears";
|
|
175
|
+
} | undefined;
|
|
176
|
+
}>>;
|
|
177
|
+
pointsPerMember: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
178
|
+
interval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
179
|
+
type: import("zod").ZodEnum<["calendarHours", "calendarDays", "calendarWeeks", "calendarMonths", "calendarYears"]>;
|
|
180
|
+
value: import("zod").ZodNumber;
|
|
181
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
182
|
+
value: number;
|
|
183
|
+
type: "calendarHours" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears";
|
|
184
|
+
}, {
|
|
185
|
+
value: number;
|
|
186
|
+
type: "calendarHours" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears";
|
|
187
|
+
}>>;
|
|
188
|
+
value: import("zod").ZodNumber;
|
|
189
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
190
|
+
value: number;
|
|
191
|
+
interval?: {
|
|
192
|
+
value: number;
|
|
193
|
+
type: "calendarHours" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears";
|
|
194
|
+
} | undefined;
|
|
195
|
+
}, {
|
|
196
|
+
value: number;
|
|
197
|
+
interval?: {
|
|
198
|
+
value: number;
|
|
199
|
+
type: "calendarHours" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears";
|
|
200
|
+
} | undefined;
|
|
201
|
+
}>>;
|
|
202
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
203
|
+
points?: {
|
|
204
|
+
value: number;
|
|
205
|
+
interval?: {
|
|
206
|
+
value: number;
|
|
207
|
+
type: "calendarHours" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears";
|
|
208
|
+
} | undefined;
|
|
209
|
+
} | undefined;
|
|
210
|
+
pointsPerMember?: {
|
|
211
|
+
value: number;
|
|
212
|
+
interval?: {
|
|
213
|
+
value: number;
|
|
214
|
+
type: "calendarHours" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears";
|
|
215
|
+
} | undefined;
|
|
216
|
+
} | undefined;
|
|
217
|
+
}, {
|
|
218
|
+
points?: {
|
|
219
|
+
value: number;
|
|
220
|
+
interval?: {
|
|
221
|
+
value: number;
|
|
222
|
+
type: "calendarHours" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears";
|
|
223
|
+
} | undefined;
|
|
224
|
+
} | undefined;
|
|
225
|
+
pointsPerMember?: {
|
|
226
|
+
value: number;
|
|
227
|
+
interval?: {
|
|
228
|
+
value: number;
|
|
229
|
+
type: "calendarHours" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears";
|
|
230
|
+
} | undefined;
|
|
231
|
+
} | undefined;
|
|
232
|
+
}>>;
|
|
233
|
+
unitExpiryDate: import("zod").ZodOptional<import("zod").ZodString>;
|
|
234
|
+
unitDaysExpiryAfter: import("zod").ZodOptional<import("zod").ZodString>;
|
|
235
|
+
unitDaysActiveCount: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
236
|
+
unitYearsActiveCount: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
237
|
+
unitDaysLocked: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
238
|
+
allTimeNotLocked: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
239
|
+
};
|
|
240
|
+
readonly handler: typeof walletTypeUpdate;
|
|
36
241
|
}];
|